dect
/
libpcap
Archived
13
0
Fork 0
Commit Graph

68 Commits

Author SHA1 Message Date
Patrick McHardy 481ab2d4a6 Merge branch 'master' of git://bpf.tcpdump.org/libpcap
Conflicts:
	pcap/bpf.h

Signed-off-by: Patrick McHardy <kaber@trash.net>
2011-01-10 14:44:29 +01:00
Gianluca Varenni cc1a80e41e Fixes to compile WinPcap under MINGW32 and MINGW64. 2010-10-15 01:42:59 -07:00
Patrick McHardy f6e28f8d19 Import pcap-dect-linux
Signed-off-by: Patrick McHardy <kaber@trash.net>
2010-10-15 02:21:10 +02:00
Guy Harris c65292b04b Update description fetching code for FreeBSD, fix code for OpenBSD.
Update from Jason (Xin) Li to reflect changes to the FreeBSD
SIOCGIFDESCR implementation - it now doesn't return an error if the
buffer is too short, it sets the buffer pointer to NULL.  No FreeBSD
release has SIOCGIFDESCR, so this doesn't break on any release.

The loop, trying to increase the buffer size until it's big enough,
works only on FreeBSD, as that's the only OS where you get told what
length to use; OpenBSD clamps the description length at IFDESCRSIZE, so
we just use that.
2010-04-28 12:29:19 -07:00
Xin Li f6cbf3b4de Update to handle arbitrary-length interface descriptions on FreeBSD.
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2010-03-10 15:55:44 -08:00
Guy Harris c3184553df Update a comment. 2010-03-10 15:53:55 -08:00
Guy Harris 2d3279a02f Update to work with FreeBSD flavor of SIOCGIFDESCR.
Update to work with FreeBSD flavor of SIOCGIFDESCR as well as the
OpenBSD flavor.  Also, a small tweak from me to use "ifdescr" as a
pointer to the string buffer in both cases ("&ifdescr" and "ifdescr",
although they have different types, point to the same location), and to
put "s" back inside #ifdef SIOCGIFDESCR/#endif, as it's not used if
SIOCGIFDESCR isn't defined.
2010-03-01 15:01:02 -08:00
Christian Bell e1539bdbcb Add Myricom SNF API support as a new pcap device.
This patch adds support for our NICs when run in a specialized capture mode.
It is diffed against the current master.

The Myricom Sniffer10G software uses Myri-10G programmable Network Interface
Cards (NICs), a firmware extension, a specialized driver and a user-level
library (libsnf) to enable sustained capture of 10-Gigabit Ethernet traffic.
Small-packet coalescing and an efficient zero-copy path to host memory allow
Sniffer10G to capture streams at line rate for all Ethernet packet sizes.

Optionally, libpcap can be used concurrently by multiple processes on a single
NIC port to partition the incoming traffic across processes.  While the Linux
kernel enables this through multiple receive queues, the difference is that the
myri_snf driver cooperates with libsnf to set up multiple queues that are each
independently accessible through user-space.

More information here: http://www.myri.com/scs/SNF/doc

Signed-off-by: Guy Harris <guy@alum.mit.edu>
2010-01-26 11:58:37 -08:00
Guy Harris 753c9432ab Fix pcap_lookupnet().
From NetBSD; to quote the checkin comment:

	Fix pcap_lookupnet(): reset ifr before SIOCGIFNETMASK. Without
	it we get back a bogus netmask.

Presumably some stuff left over in ifr from the previous ioctl confuses
the next ioctl.
2010-01-09 12:51:15 -08:00
Guy Harris 3866e83123 From Roman Francoise: rename the USB-sniffing devices to "usbmonN", so
as not to collide with the "usbN" names for USB-based networking
devices.
2009-03-19 09:37:03 -07:00
guy 9545f44f88 Expand a comment with more information on getting interface names. 2008-04-20 18:19:02 +00:00
guy 3fdd4aeaf4 Update a comment. 2008-04-17 19:17:08 +00:00
guy 2198f5dc5b Fix a typo. 2008-04-17 19:09:13 +00:00
guy a4aaa6f939 Use SIOCGIFDESCR to get the interface description if we have
SIOCGIFDESCR.
2008-04-17 18:56:51 +00:00
guy a6186fa56d Pick up changes from NetBSD:
several files:

	date: 2006/02/27 15:53:24;  author: drochner;  state: Exp;
	avoid shadowing globals, for WARNS=2

	date: 2006/02/27 15:55:30;  author: drochner;  state: Exp;
	minor constification, good for WARNS=3 now

	date: 2006/02/27 15:57:17;  author: drochner;  state: Exp;
	NetBSD adaption:

		...

	-const pcap_strerror() for consistency


    gencode.c:

	date: 2006/04/26 09:24:33;  author: tron;  state: Exp;
	Add missing "const" keywords to match declarations in "pcap.h".

	date: 2006/10/15 19:27:21;  author: christos;  state: Exp;
	add a volatile variable to prevent vfork/longjmp clobbering.

    optimize.c:

	date: 2006/05/17 17:48:36;  author: drochner;  state: Exp;
	Make the optimizer use unsigned numbers as the kernel does.
	While it is not agreed on that purely unsigned arithmetics is nice,
	different behaviour of optimized and unoptimized code is less desirable.

    pcap-bpf.c:

	date: 2006/02/27 15:51:38;  author: drochner;  state: Exp;
	pull in from NetBSD's libpcap: use cloning bpf device on NetBSD

Have the configure script check for paths.h, so that we can include it
only if we have it, and use the cloning BPF device only if we're on
NetBSD *and* _PATH_BPF is defined (hopefully this will keep us from
using it on versions of NetBSD that don't have a cloning BPF device; if,
in the future, other OSes with BPF get cloning BPF devices, we can make
this work for them as well).
2007-06-11 10:04:24 +00:00
guy 349ffb7d20 For wltN devices, open the corresponding enN device, so that, for
example, if you don't have permission to open BPF devices, you don't end
up with a list of devices that includes the wltN devices but nothing
else.
2006-12-30 09:54:57 +00:00
guy 660cb8b1ce On Mac OS X, assume any device whose name begins with "wlt" can be
captured on, without trying to open it - if "enN" is an AirPort device,
opening "wltN" is like opening "enN", except that the device is put into
monitor mode, which, for many devices, causes the device to deassociate
from the network with which it's associated.
2006-12-29 19:33:36 +00:00
guy 50ce2663e8 From Paolo Abeni: Bluetooth support. 2006-10-13 17:34:53 +00:00
guy 6fa38c09d7 From Paolo Abeni:
avoid lookupnet to mess with ioctl for usb interface
	and simply return an 0.0.0.0 net and a 0.0.0.0 netmask.
2006-10-13 09:06:05 +00:00
guy de2b502289 In "add_or_find_if()", first check whether we already have an entry in
the list for the interface, and try to open the interface only if we
don't already have an interface, so if you have multiple addresses for
an interface, you don't open the interface for each of them.  (See
Wireshark bug 1151:

	http://bugs.wireshark.org/bugzilla/show_bug.cgi?id=1151

for the reason to do this; pcap_findalldevs() spent a *lot* of time and
energy opening en0 over and over again for all 64K-128K(!) addresses.)
2006-10-10 07:09:14 +00:00
guy cb71eef7ae We've already used strdup(), and nobody's complained about their OS
lacking it, so use it in some other cases, instead of duplicating its
functionality.

Check, however, whether it succeeds, and fail appropriately when it
fails.

Also, when other mallocs fails, free up any memory allocated for data
structures, so it doesn't leak.
2006-01-21 10:45:18 +00:00
guy 0c77a6d811 Put in a note about getting a description of the interface on FreeBSD. 2006-01-10 21:22:00 +00:00
guy a0a4852137 From Gilbert Hoyek <gil_hoyek@hotmail.com>: support for capturing SS7
traffic on Intel Septel cards, and for filtering on SS7 MTP3 fields.

Clean up indentation.
2005-06-20 21:27:07 +00:00
guy 34f7067751 Gisle Vanem notes that some compilers warn about "const register char
*" - use "register const char *" instead.
2005-02-10 19:38:06 +00:00
guy 07ea050fd6 Explain why we're discarding interfaces we can't open for capturing. 2005-01-29 00:47:25 +00:00
guy a16432cb28 Put back the code to try opening a device for capture before adding it
to the list of interfaces, so we don't, for example, include the
loopback device in the list on Solaris - SIOCGIFCONF/SIOCGLIFCONF will
find the device, as it has an IP address, but it's not a DLPI device so
you can't open it for capturing.
2005-01-28 20:51:20 +00:00
guy f8a76d1d76 From Gisle Vanem: MS-DOS support. 2004-12-18 08:52:08 +00:00
guy f4531c5cf3 From Gisle Vanem:
don't include <sys/time.h>, as it's included, if necessary, by
	pcap.h;

	constify some arguments.
2004-12-17 20:32:35 +00:00
guy b9974ec51a We don't call "getifaddrs()" in inet.c, so we don't need to include
<ifaddrs.h> in it.
2004-12-16 22:07:28 +00:00
risso e00313a3db Fixed a memory leak in pcap_lookupdev under Win32. 2004-04-30 09:13:51 +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 ec72fd24fe Get rid of an unused variable. 2003-09-25 22:22:25 +00:00
risso c9f7277b0d pcap_lookupdev() converts the adapter list to unicode for backward compatibility. 2003-09-22 11:51:37 +00:00
guy 77cade932c From Jesper Peterson <jesper@endace.com>: support for capturing from
Endace DAG devices.
2003-07-23 05:29:19 +00:00
risso c6c36989f7 Added a const modifier to the first argument of pcap_lookupnet() for Win32. Without it, libpcap didn't compile under Cygwin. 2003-02-04 09:51:38 +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 215669fbe8 As per Ayamura Kikuchi, on some UNIXes, such as IRIX, "sa_len" is
apparently defined in such a way that you can't use it as a variable
name; use "sa_length" instead.
2002-11-13 06:46:16 +00:00
guy 309e386870 Use <pcap-stdinc.h> only on Windows; on UNIX, selectively include, in
each source file, only the headers that file needs, and all the headers
it needs in order to compile on various platforms and not to get any
avoidable compiler warnings on those platforms (as well as any
incomplete structure definitions needed to avoid those warnings).

That also means that <pcap.h> doesn't include <pcap-stdinc.h> on UNIX;
we don't want it to include <pcap-stdinc.h>, at least on UNIX, as doing
so

	1) would mean we'd have to install that, so that programs can
	   build with libpcap

and

	2) would mean that programs including <pcap.h> would drag in a
	   bunch of header files that they don't need.

Put a newline at the end of "inet.c" - the Sun C compiler doesn't like
it if the last line doesn't end with a newline.
2002-08-02 03:44:19 +00:00
risso 6831542ec7 Added support for Win32, based on WinPcap. 2002-08-01 08:33:01 +00:00
guy 3d856fe865 Leave it up to the platform-dependent "get interface list" code to
figure out how big the addresses are, as the way that's done is, well,
platform-dependent....
2002-07-30 08:12:13 +00:00
guy 2dcac1bb6b Put the different implementations of "pcap_findalldevs()" into separate
source files, rather than having a pile of #ifdefs in "inet.c".  Add
code to the configure script to determine which implementation to use on
the platform for which libpcap is being built.

Add a "pcap_findalldevs()" implementation for Solaris 8 and later that
handles IPv6 addresses.
2002-07-27 18:45:34 +00:00
guy 243b20ec55 Add SunATM support, based on code from Yen Yen Lim at North Dakota State
University.
2002-07-11 09:06:30 +00:00
itojun 5918c491c1 whitespace cleanup 2002-06-11 17:04:44 +00:00
guy 9328cdfd19 Indicate why we have incomplete definitions for "struct mbuf" and
"struct rtentry" (in <net/if.h> on some systems, e.g.  Digital UNIX 4.0,
there are prototypes for kernel functions that include "struct mbuf *"
and "struct rtentry *" arguments, and they are included even if you're
just user-mode code).
2002-04-09 07:37:59 +00:00
guy c781d3d992 Fix a call to "pcap_add_if()" that wasn't give a null-pointer
description argument.
2001-10-28 20:40:43 +00:00
guy dfc0d14d3b Add a description to the entry for the "any" device. 2001-10-28 20:31:05 +00:00
guy db79c69108 Make the "is_loopback" field of a "pcap_if" structure a general "flags"
field, and make a PCAP_IF_LOOPBACK flag be the first flag bit in that
field, specifying whether the interface is a loopback interface; this
allows us to add more flags without changing the layout of the
structure.
2001-10-28 02:31:49 +00:00
guy d5735e2448 Split off the code to scan "/proc/net/dev" into a separate routine, and
don't call it if we've already had an error.
2001-10-10 06:46:50 +00:00
guy 519b0b5a59 If we have "/proc/net/dev", and don't have <ifaddrs.h> (i.e., don't have
"getifaddrs()"), after processing the list returned by SIOCGIFCONF, scan
"/proc/net/dev" for interface names, and add to the list of interfaces
entries for those interfaces, with no associated addresses (if the
interfaces were already added, with addresses, from the list returned by
SIOCGIFCONF, they won't get added again).

Clean up the error handling a bit.
2001-10-09 05:43:19 +00:00
guy 5a85948f80 We don't actually use HAVE_FREEIFADDRS, so there's no point in checking
whether we have "freeifaddrs()" (we don't check whether we have
"getifaddrs()", and if we have "getifaddrs()" but not "freeifaddrs()",
we're stuck with leaking memory).

Give the "any" device an instance number of INT_MAX, so it shows up
after all other non-loopback devices.

"getifaddrs()" sometimes appears to supply a destination address even
for non-point-to-point interfaces (it did so on a FreeBSD 4.1 system);
don't use the broadcast address it supplies if an interface isn't a
broadcast interface, and don't use the destination address it supplies
if an interface isn't a point-to-point interface.

If we had an error constructing the list of interfaces, don't attempt to
add the "any" device to the list.
2001-10-09 03:53:38 +00:00