Fork 0
Commit Graph

1517 Commits (master)

Author SHA1 Message Date
Patrick McHardy 481ab2d4a6 Merge branch 'master' of git://

Signed-off-by: Patrick McHardy <>
2011-01-10 14:44:29 +01:00
Guy Harris 028204e0f9 Interface IDs are 0-origin.
That means that if an interface ID is greater than *or equal to* the
number of Interface Description Blocks we've seen, we haven't seen an
IDB for that interface.
2010-12-28 13:15:26 -08:00
Guy Harris d58b82da9f Fix alignment of Love's name. 2010-11-30 16:42:35 -08:00
Luis MartinGarcia 6feaf847e5 Use spaces for all entries. Fix Luis MartinGarcia's name.
Reviewed-By: Guy Harris <>
2010-11-30 16:37:51 -08:00
Mike Frysinger 16f6b49c87 Use config.status to generate pcap-config.
Rather than use a custom sed script to replace things in pcap-config,
use the already existing config.status script.  This keeps people from
having to update the every time they want to add a new var
to the file.

Also, clean up the script a bit to set local vars at the
top of the file and then refer to those rather than replacing all things
through out.  This makes it easier to tweak on the fly as there is only
line to change rather than trying and figure out all the locations.

Reviewed-By: Guy Harris <>
2010-11-30 16:06:14 -08:00
Guy Harris a092bafeee In test programs, just as in pcap-usb-linux.c, if we have
<linux/compiler.h> we (probably need to include it before including
<linux/usbdevice_fs.h>, otherwise the test may fail when it shouldn't.
2010-11-30 15:52:45 -08:00
Guy Harris b019cc06cb Check whether we have <linux/compiler.h>.
Not all distributions have it in /usr/include; I guess the ones that
don't have it have versions of other kernel headers that don't require
2010-11-25 14:06:01 -08:00
Guy Harris 0920898be2 Include <linux/compiler.h> before including <linux/usbdevice_fs.h>.
Some versions of the Linux kernel require that.
2010-11-25 13:49:16 -08:00
Guy Harris cbf0ba1e34 Add DLT_DBUS, for raw D-Bus messages. 2010-11-15 08:57:38 -08:00
Guy Harris 77ed5cdd1f Libnl 2.x returns its own error codes, not errnos; handle that.
While we're at it, don't special-case ENFILE for "delete monitor device"
operations; that's not like "add monitor device", where we want to drive
on if a device with that name already exists.
2010-11-14 13:48:19 -08:00
Guy Harris ade794238b Add support for libnl 2.x, adapted from a newer version of the iw command. 2010-11-13 17:42:47 -08:00
Gianluca Varenni 38ef87dd39 Another fix for the compilation of WinPcap under MINGW32/MINGW64. 2010-10-15 16:44:32 -07: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 <>
2010-10-15 02:21:10 +02:00
Guy Harris 4d7214cbc5 Treat either EPERM or EACCES as "no soup for you". 2010-09-21 02:46:53 -07:00
Guy Harris 74b7b4259f Return PCAP_ERROR_PROMISC_PERM_DENIED if you have permission to open the
DLPI device but don't have permission to put the interface in
promiscuous mode; some systems using DLPI work that way.

Change the libdlpi code to return a warning if you *are* using
physical promiscuous mode and you fail to turn on SAP promiscuous mode,
not if you *aren't* using physical promiscuous mode and you fail to turn
on SAP promiscuous mode; that matches with the no-libdlpi code does, and
matches what the comment says.

Pull dlattachreq up into dl_doattach().
2010-09-21 02:07:05 -07:00
Guy Harris b26d8d2aa8 Fix a problem that shows up with a max packet count passed to pcap_dispatch().
If the last record read in by a read() from a BPF device isn't a
multiple of the alignment value for BPF_WORDALIGN(), we could increment
bp past ep; handle that case.

While we're at it, properly set p->bp and p->cc in the case where we
break out of the loop due to a pcap_breakloop() call.
2010-09-01 00:36:07 -07:00
Guy Harris 7f1c9ba7ad Give the names, as well as the #defines, for time stamp types. 2010-08-23 15:36:30 -07:00
Guy Harris 00f5d74bb9 Fixes from Scott Mcmillan. 2010-08-23 12:50:19 -07:00
Guy Harris e84ae717b4 Clean up handling of the "net" symlink made by the configure script.
In "make distclean", get rid of it; in .gitignore, ignore it.
2010-08-23 03:12:12 -07:00
Guy Harris ce38b0cd9b If the specified time stamp type isn't supported, treat that as a warning. 2010-08-22 19:09:50 -07:00
Guy Harris fa4435e65c Add support for setting the time stamp type for a capture.
Based on a patch from Scott Mcmillan <>.

(Second part of the commit.)
2010-08-22 17:36:27 -07:00
Guy Harris 749726f92c Give Scott McMillan credit for the initial time stamp patch. 2010-08-22 17:09:04 -07:00
Guy Harris 951f99bbbd Add support for setting the time stamp type for a capture.
Based on a patch from Scott Mcmillan <>.
2010-08-22 16:58:53 -07:00
Guy Harris 0ba94d1cfa Consistently use "link-layer header type".
Use "link-layer header type" as the term for DLT_ values; it doesn't
necessarily correspond to the actual data link type of the device
(802.11 devices, for example, can supply Ethernet headers).
2010-08-22 15:26:35 -07:00
Guy Harris b9546dd6de Add some additional SEE ALSO references.
In the pcap_list_datalinks() man page, refer to the
pcap_datalink_val_to_name() man page, as the routines described there
can be used to print out names and descriptive text for the values
returned by pcap_list_datalinks().

In the pcap_set_datalink() man page, refer to the
pcap_datalink_name_to_val() man page, as pcap_datalink_name_to_val() can
be used to convert a name for a link-layer header type into a value to
be handed to pcap_set_datalink().

Update the change date on some man pages while we're at it.
2010-08-22 15:08:20 -07:00
Guy Harris 57935bef89 Combine documentation for allocate and free routines.
Pull the documentation for pcap_freealldevs() into the
pcap_findalldevs() man page, and pull the documentation for
pcap_free_datalinks() into the pcap_list_datalinks() man page.
2010-08-22 14:54:10 -07:00
Guy Harris bc8209b71e Fix handling of close of zerocopy BPF; based on a patch from Christian Peron. 2010-08-20 12:17:31 -07:00
Guy Harris 3c13ac2cc3 Fix previous checkin. 2010-08-06 14:58:16 -07:00
Guy Harris f41d444406 Mention the 802.15.4 changes. 2010-08-06 14:45:14 -07:00
Jon Smirl 41bfc71e21 Use DLT_IEEE802_15_4_NOFCS for 802.15.4 interfaces.
Reviewed-By: Guy Harris <>
2010-08-06 14:43:05 -07:00
Guy Harris 6cb3ad9219 New DLT_IEEE802_15_4_NOFCS for 802.15.4 without FCS.
Requested by Jon Smirl.
2010-08-06 14:12:16 -07:00
Guy Harris e04170f756 List the fixes we've checked in so far. 2010-07-20 11:24:25 -07:00
Guy Harris 9e7bc0881a Oops - should convert the LINKTYPE_ value in pcap-ng Interface
Description Blocks to a DLT_ value in the pcap_t, as applications expect
pcap_linktype() to return a DLT_ value.
2010-07-20 10:19:02 -07:00
Guy Harris cc7b2f2e42 Add support for "wlan ra" and "wlan ta".
The RA field is absent from management frames (addr1 is DA there), and
addr1 in other frames.

The TA field is absent from management frames (addr2 is SA there), and
addr2, if present, in other frames.

While we're at it, fix a font glitch in the pcap-filter man page.
2010-07-03 13:15:01 -07:00
Guy Harris aeda5c1d65 More "don't crash if "wlan addr{1,2,3,4}" are used without 802.11 headers". 2010-07-03 11:13:40 -07:00
Guy Harris ccbfd9200e Don't crash if "wlan addr{1,2,3,4}" are used without 802.11 headers. 2010-07-03 10:58:48 -07:00
Guy Harris 85089fea57 Do filtering on USB and Bluetooth capturing.
Do the standard userland filtering on USB and Bluetooth captures, rather
than returning "success" when the filter is installed without doing
anything with the filter.

Also, squelch some "dereferencing type-punned pointer will break
strict-aliasing rules" warnings in pcap-bt-linux.c, by using memcpy
rather than pointer-casting.
2010-06-04 10:48:16 -07:00
Guy Harris f0a4bdf8e0 On FreeBSD/SPARC64, use -fPIC - it's apparently necessary. 2010-05-29 19:27:49 -07:00
Guy Harris 9980b3601f Check for valid port numbers (fit in a 16-bit unsigned field). 2010-05-29 00:02:49 -07:00
Guy Harris 65f960da71 Reject attempts to put savefiles into non-blocking mode.
Don't ignore them, reject them, so applications know that non-blocking
mode didn't get turned on, if they're expecting non-blocking reads from
a pipe, for example.
2010-05-28 20:39:09 -07:00
Guy Harris 8666f21afc Check for "no such device" for the "get the media types" ioctl in *BSD.
This lets us return PCAP_ERROR_NO_SUCH_DEVICE if we've done a
pcap_create() on a non-existent device and asked whether it supports
monitor mode.
2010-05-18 18:56:38 -07:00
Guy Harris 06a81b2e72 Improve error messages from bpf_open(), and let it do the error handling.
bpf_open() already handles returning the right PCAP_ERROR_ value and
setting p->errbuf; let it do its thing.

Enhance its thing so that it tries to do a better job of figuring out
what the problem is (no BPF devices at all, all BPF devices busy, no
permission to open BPF device, something else).
2010-05-18 18:50:30 -07:00
Guy Harris 0a77b1b15f Return more specific errors from pcap_can_set_rfmon(); fix documentation.
Have pcap_can_set_rfmon() return PCAP_ERROR_PERM_DENIED if you don't
have permission to check the device and PCAP_ERROR_NO_SUCH_DEVICE if
there's no such device, at least on Mac OS X.  Other platforms need to
be fixed as well.

Update the documentatation to reflect that it can return
PCAP_ERROR_PERM_DENIED, fix a typo, and speak of capture sources rather
than devices.
2010-05-18 17:54:36 -07:00
Guy Harris 59b866591a Clean up indentation. 2010-05-18 17:50:49 -07: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
andy-1 073a8b37f9 Ignore /sys/net/dev files if we get ENODEV for them, not just ENXIO.
Both of them are indications that there's no such interface, so the file
probably corresponds to something other than a device.

Reviewed-By: Guy Harris <>
2010-04-27 23:33:23 -07:00
Guy Harris ace1a2c86f Fix check for a constant 0 argument to BPF_DIV.
BPV_RVAL() is the macro to check the type of the return value of a "ret"
instruction; it tests more bits than are appropriate for a "div"
instruction, and the test fails.
2010-04-21 02:20:48 -07:00
Alon Bar-Lev e25ea10a13 Use the right version of ar when cross-building.
Reviewed-By: Guy Harris <>
2010-04-16 03:02:27 -07:00
nvercamm b372da4b07 Free any filter set on a savefile when the savefile is closed.
Reviewed-By: Guy Harris <>
2010-04-16 02:54:45 -07:00