dect
/
libpcap
Archived
13
0
Fork 0
Commit Graph

44 Commits

Author SHA1 Message Date
test 9c54f8726d Removed some leftover tracing messages. 2009-07-15 13:30:41 -07:00
test 32c168dad4 Added a critical section on Windows to make pcap_compile thread safe.
This is a temporary patch that can be removed when we will make the
lexer, parser and code generator fully reentrant.
2009-07-15 11:57:07 -07:00
gianluca c975220bd1 pcap_create() should accept UNICODE device names as well as ASCII ones
on Windows.
2008-05-21 22:15:25 +00:00
gianluca cab77babbb Fixed a couple initializations related to the buffer sizes. Removed some duplicated
code.
2008-04-25 20:03:34 +00:00
guy 2527d1ac88 Turn close_op into cleanup_op; the routine that handles it can also be
used to clean up after a failed pcap_activate() call.  Convert the
existing close_op routines to cleanup_op routines, and use them to clean
up; rename pcap_close_common() to pcap_cleanup_live_common(), and use it
directly if there's no platform-dependent cleanup needed.  That means we
don't have to write the same cleanup code twice (and possibly forget
stuff in the version done on a failed pcap_activate() call).

Have the cleanup routines do whatever is necessary to indicate that
cleanup has been done, and not do any particular cleaning up if it's
already been done (i.e., don't free something if the pointer to it is
null and null out the pointer once it's been freed, don't close an FD if
it's -1 and set it to -1 once it's been closed, etc.).

For device types/platforms where we don't support monitor mode, check
for it and return PCAP_ERROR_RFMON_NOTSUP - but do so after we've
checked whether we can open the device, so we return "no such device" or
"permission denied" rather than "that device doesn't support monitor
mode" if we can't open the device in the first place.

Fix a comment.
2008-04-14 20:40:58 +00:00
gianluca 0bee352573 Fixed a compilation error under Windows. Some code left while porting the
libpcap code to the new pcap_create() pcap_activate() pattern.
2008-04-09 21:20:26 +00:00
guy 745e497e4c Fix some errors left behind by the conversion to the create/activate
model.
2008-04-08 03:06:03 +00:00
guy d9b420231a From Paolo Abeni and me: split pcap_open_live() into a "get a pcap_t
handle" routine, an 'activate a pcap_t handle" routine, and some "set
the properties of the pcap_t handle" routines, so that, for example, the
buffer size can be set on a BPF device before the device is bound to an
interface.

Add additional routines to set monitor mode, and make at least an
initial attempt at supporting that on Linux, *BSD, and Mac OS X 10.4 and
10.5.  (Very much "initial" for Linux, which is a twisty little maze of
wireless drivers, many different.)

Have a "timeout" member of the pcap_md structure on all platforms, use
that on Windows instead of the "timeout" member of the pcap_t structure,
and get rid of the "timeout" member of that structure.
2008-04-04 19:37:44 +00:00
gianluca 18f99473ee Under MingW/cygwin, we need to use ddk/ndis.h instead of ntddndis.h. 2007-11-13 21:55:51 +00:00
guy 3a0937cfba On Win32, have pcap_setbuff, pcap_setmode, and pcap_setmintocopy ops, so
add-on capture mechanisms can supply their own code for that.
2007-10-17 18:52:41 +00:00
guy 231404ec64 Add pcap_platform_finddevs() to WinPcap. 2007-09-25 20:34:36 +00:00
gianluca cf5ea4eeec Added support for PPI. 2007-06-14 22:08:38 +00:00
gianluca 04203b96b6 Fixed a bug in pcap_open_live(). The return value of PacketSetHwFilter was
not checked. This was the culprit of WinPcap failing to capture on wireless
adapters when in promiscuous mode. Most of the wireless adapters drivers
do not support the promiscuous hardware, and fail the HW filter OID request.
This failure was not detected by pcap_open_live(), and resulted in no packets
being captured as no hw filter was actually set at the driver level (no hw filter
means "reject all").
2007-02-19 18:35:06 +00:00
loris cbfba20e99 Added support for DLT_IEEE802_11 and DLT_IEEE802_11_RADIO link layers in windows 2006-08-08 16:39:08 +00:00
gianluca ea6367e572 Fixed some capitalization that could cause problems cross compiling under linux.
Updated the copyright notice.
2006-02-22 17:08:31 +00:00
risso 34023facce Added a missing initialization of pcap_t::timeout when an adapter is opened
with pcap_open_live. This bug caused pcap_setnonblock to misbehave when
the adapter was set to blocking mode.
2005-07-10 17:53:08 +00:00
risso b1a06c1017 Fixed a leak in pcap_open_live (win32): the pcap_t handle was not freed
if PacketOpenAdapter fails.
[The previous fix was in the wrong place].
2005-06-10 03:52:19 +00:00
risso 5636631e58 Fixed a leak in pcap_open_live (win32): the pcap_t handle was not freed
if PacketOpenAdapter fails.
2005-06-10 03:49:19 +00:00
guy e987a615e2 From Pawel Pokrywka: add support for requesting that only received
packets, only sent packets, or all packets be accepted, with an
implementation for Linux.

Add an implementation for BPF platforms that support BIOCSSEESENT.
2005-05-03 18:53:58 +00:00
guy 16889bae3e On the platforms where we do in-kernel filtering and can read more than
one packet from the kernel at a time, when the filter is changed, clear
the libpcap buffer to discard packets read from the kernel before the
filter was changed.
2005-02-26 21:58:05 +00:00
guy 3ba117b68d On Win32, don't close "p->fd" in "pcap_close_common()", as there is no
"p->fd".  Do, however, use "pcap_close_common()" to free up "p->buffer",
as is done on other platforms.
2004-12-17 20:41:59 +00:00
risso 6ec634f388 Fixed a memory leak in pcap_close_win32: p->Packet was not freed when
the adapter is closed.
2004-06-16 15:51:46 +00:00
risso 8106848e48 Added a check against a NULL pointer in pcap_inject_win32.
Added an explicit cast in pcap_inject_win32 to avoid a compilation warning
under Visual C.
2004-06-07 13:27:46 +00:00
guy 2d2890dd37 Add support for sending packets; includes contributions from Mark
Pizzolato <List-tcpdump-workers@subscriptions.pizzolato.net>.
2004-03-23 19:18:04 +00:00
risso cd98f8f525 Added support for Endace Dag cards under Windows 2004-01-28 14:06:20 +00:00
guy 619a9fe31b For devices that we have some reason to believe are real live Ethernet
devices, offer DLT_DOCSIS as one of the choices of link-layer type, and
support setting that type as meaning just "set libpcap's notion of the
link-layer type to DLT_DOCSIS" without telling the driver to use
DLT_DOCSIS.
2003-12-18 23:32:31 +00:00
guy b7a5a71b3a From Gisle Vanem: enter the packet-processing loop even if no packets
were read, so we check "p->break_loop"; that way, we can break out of
the loop even if we get no packets (because of a timeout).

Also, check "p->break_loop" before reading packets from the driver.
2003-11-30 02:31:04 +00:00
guy 2c618b93a0 Add "getnonblock" and "setnonblock" operations, and set the function
pointers appropriately, rather than using #ifdefs and run-time checks.

Get rid of declaration of non-existent "pcap_set_datalink_platform()"
routine.
2003-11-20 02:02:38 +00:00
guy 30e89f192a Add _U_ to "rcsid[]" definitions, to eliminate "unused variable"
warnings from newer versions of GCC.
2003-11-15 23:23:57 +00:00
guy 991d444f71 Add a "pcap_breakloop()" API to break out of the loop in
"pcap_dispatch()" and "pcap_loop()".
2003-11-04 07:05:32 +00:00
risso 9cc72b7f06 Updated pcap_open_live() since PacketOpenAdapter() now requires an ascii string under WinNTx as well. 2003-09-22 11:48:40 +00:00
guy cd0d893ef9 Add a "read" function pointer to the pcap_t structure, which handles
reading packets from a pcap_t, and make "pcap_read()" call it.  That
removes the last place where we have to check for a pcap_t that refers
to a DAG card rather than a live capture, so get rid of the "is_dag" flag.
2003-07-25 05:32:02 +00:00
guy 08658f1c93 Add a "set_datalink" function pointer to the pcap_t structure, whichhandles
setting a filter for a pcap_t.  Have "pcap_set_datalink()" call it,
rather than explicitly calling "pcap_set_datalink_platform()".
2003-07-25 05:07:01 +00:00
guy cd2807e08d Add a "setfilter" function pointer to the pcap_t structure, which
handles setting a filter for a pcap_t.  Have "pcap_setfilter()" call it,
rather than being a per-platform function.  The per-platform functions
don't need to check for an offline capture any more, as they're not
called for an offline capture (and the ones that just call
"install_bpf_program()" don't need to exist at all).
2003-07-25 04:42:02 +00:00
guy 9792990eb8 Add a "stats" function pointer to the pcap_t structure, which handles
getting statistics for a pcap_t.  Have "pcap_stats()" call it, rather
than being a per-platform function; have stats routines for non-live
pcap_t's that return an error.
2003-07-25 04:04:56 +00:00
guy e648c9e593 Add a "close" function pointer to the pcap_t structure, which handles
the platform-dependent part of closing a pcap_t (and the
live-vs-savefile part as well, so that function must close the file
descriptor and free up any buffers allocated).

In the Digital UNIX support, add in a check for a memory allocation
failure.
2003-07-25 03:25:45 +00:00
risso 6ca7c69b0b Modified the license at the beginning of the files created by the Politecno di Torino developers from the 4-clause BSD code to the modified BSD license 2003-05-15 14:30:29 +00:00
risso 8103ed43f8 Added the definition of the bpf_hdr structure needed to compile under Win32. This definition was previously in bpf.h. 2003-04-09 10:01:10 +00:00
guy 04672f261b Put in break statements after every case in the switch on the NDIS
medium type.
2003-01-23 09:40:09 +00:00
guy 8cd68a0fa4 From Yoann Vandoorselaere <yoann@prelude-ids.org>: make the "device"
argument to "pcap_open_live()" a "const" pointer.

Constify some additional device name arguments, and update the man page
to reflect some arguments that were already consts.
2002-12-22 02:36:48 +00:00
guy 482fa426bc NetBSD support for multiple data link types on an interface, from David
Young <dyoung@ojctech.com>, with some minor changes by Jason R.  Thorpe
<thorpej@netbsd.org>, and further changes by me to support it on BPF
systems lacking BIOCGDLTLIST and other platforms lacking an equivalent
feature.

Update Jason Thorpe's e-mail address (Zembu is going away, if it hasn't
done so already).

Add APIs to map DLT names to DLT values and vice versa.
2002-12-19 09:05:45 +00:00
risso b323d42b7a Added support for raw ARCNET (878.1) under Win32. 2002-11-11 10:34:06 +00:00
guy 7989614935 Give the file an SCCS and RCS ID. 2002-08-05 07:45:09 +00:00
risso 6831542ec7 Added support for Win32, based on WinPcap. 2002-08-01 08:33:01 +00:00