dect
/
libpcap
Archived
13
0
Fork 0
Commit Graph

1174 Commits

Author SHA1 Message Date
guy ff2ebcf09a A pile of comments, from looking at aircrack-ng's airmon-ng, and
experimenting with an adapter with a mac80211 driver.
2008-09-22 01:12:34 +00:00
guy 9d151025a4 Only set the cleanup and set/get nonblocking mode handlers to the
zerocopy handlers when we decide to use zerocopy mode.  That means they
don't need to check whether zerocopy mode is being used.
2008-09-16 18:42:29 +00:00
guy 46a126edaf Use the PCAP_ERROR #define rather than a raw -1 in all cases where an
error message has been constructed, to make it clearer when that's
happening.  Use the PCAP_ERROR_BREAK #define rather than a raw -2.
2008-09-16 17:20:32 +00:00
guy 9512b57a22 Clean up indentation.
Redo some if statements to make it clearer which branch handles the
zerocopy case and which branch handles the non-zerocopy case.

Support setting the buffer size for zerocopy BPF.
2008-09-16 07:45:11 +00:00
guy 87aace3722 Combine the capture-mechanism-dependent tests into one big case
statement.
2008-09-16 07:10:31 +00:00
guy 2b61a87b6d Fix a comment. 2008-09-16 06:36:23 +00:00
guy 73e8fef161 Zero-copy BPF support, from Christian Peron. 2008-09-16 00:20:23 +00:00
guy 0a9a829a65 malloc(strlen(X) + 1) followed by strcpy(result-of-malloc, str) is
equivalent to strdup(str); use that, so people don't freak out upon
seeing a strcpy() call that, out of context, looks as if it's not
buffer-overflow-safe.
2008-09-15 23:37:51 +00:00
guy f254ca4520 From Patrick McHardy: fix AC_LBL_LINUX_TPACKET_AUXDATA_TP_VLAN_TCI macro
(cut-and-pasteo).
2008-08-07 16:44:57 +00:00
guy b1a458c84e Check whether the tpacket_auxdata structure has a tp_vlan_tci member
before using that member.

Don't define variables if we aren't going to use them.

If we have an unknown tpacket version (this "can't happen"), return an
error.
2008-08-06 08:29:07 +00:00
guy 8c970e4d60 From Patrick McHardy:
pcap-linux: fix invalid rcvbuf size

Libpcap issues a SO_RCVBUF when the buffer size if unspecified (zero).
The intention is to set it when its *not* zero.
2008-08-06 07:53:34 +00:00
guy 7eb4516342 From Patrick McHardy:
Similar to PACKET_AUXDATA for non-mmaped sockets, the VLAN TCI is
present in a new member of struct tpacket2_hdr. Use it to reconstruct
the VLAN header when necessary.
2008-08-06 07:51:29 +00:00
guy c6eedee1a5 From Patrick McHardy:
The tpacket_hdr is not clean for 64 bit kernel/32 bit userspace and
is not extendable because the struct sockaddr_ll following it is
expected at a fixed offset.

Linux 2.6.27-rc supports a new tpacket frame header that removes these
two limitations. Convert the mmap ring support to support both formats
and probe for availability of the new version.
2008-08-06 07:49:19 +00:00
guy e59abf81d3 From Patrick McHardy:
VLAN packets sent over devices supporting VLAN tagging/stripping in
hardware don't have a VLAN header when they are received on packet
sockets. The VLAN TCI is available through the PACKET_AUXDATA cmsg,
reconstruct the entire header when necessary.
2008-08-06 07:45:00 +00:00
guy 59b463d614 From Patrick McHardy: Convert pcap-linux to use recvmsg() as preparation
for using PACKET_AUXDATA cmsgs.
2008-08-06 07:39:44 +00:00
guy f34a88b3c4 We shouldn't need to include <sys/file.h>, and, as I remember, it caused
problems on some platform.
2008-08-06 07:34:09 +00:00
guy 34624f128f When activating a device, return PCAP_ERROR_IFACE_NOT_UP if the device
isn't up, so applications can report that differently from a generic
error (the latter could mean there's a bug somewhere in libpcap).

When capturing on a device without mmap on Linux, ignore ENETDOWN, so
that we can continue to capture traffic if the interface goes down and
comes back up again; comments in the kernel indicate that we'll just
block waiting for packets if we try to receive from a socket that
delivered ENETDOWN, and, if we're using a memory-mapped buffer, we won't
even get notified of "network down" events.
2008-07-01 08:02:33 +00:00
guy a8e63c60ed Get rid of declaration of non-existent routine. 2008-07-01 07:05:54 +00:00
guy ae8f708268 Handle ARPHRD_NONE, used by some tunnel devices, by mapping to DLT_RAW,
as it has a zero-length link-layer header.
2008-06-24 06:44:32 +00:00
guy ff0b6ac4a0 Update the NeXTStEP, SCO UNIX/SCO OpenServer, and UnixWare information. 2008-06-12 20:21:51 +00:00
guy 16b2f49992 Make sure <sys/dlpi.h> is usable; it exists in SCO OpenServer 5, but it
doesn't define what we need for DLPI support.
2008-06-12 19:59:57 +00:00
guy dc637abc26 Improve the help message for --enable-ipv6. 2008-06-11 09:05:10 +00:00
guy bc54719c2f It's 2008 - time to enable IPv6 support by default, as long as you have
getaddrinfo().
2008-06-11 08:52:29 +00:00
guy c76180e1ae Update README.macosx to talk about the launchd daemon, and to give more
information.
2008-06-07 18:53:31 +00:00
guy 6057eda6f0 This is probably the right way to run something once at startup time; it
works on Tiger, and setting OnDemand to false appears to cause the job
to be run over and over again on Leopard.
2008-06-05 08:10:59 +00:00
guy 83206d9b13 Fix more patches@tcpdump.org references to point to the SourceForge
site.
2008-05-30 01:43:21 +00:00
guy 757827db5f packaging/pcap.spec is generated from packaging/pcap.spec.in; don't
check in the generated version, and don't put it into the distribution.

Fix a bunch of references to tcpdump-workers@tcpdump.org to refer to the
new address, tcpdump-workers@lists.tcpdump.org.

Fix a reference to the pcap man page from the pcap-filter(4) man page.

Note that patches should be submitted on the SourceForge site, not sent
to the spam-trap patches@tcpdump.org list.
2008-05-30 01:35:33 +00:00
guy d9e031714d Get rid of the AUTHORS and BUGS section; only the main pcap(3PCAP) man
page should have that (no other pages for particular functions have it).
2008-05-30 01:32:34 +00:00
guy f8c1a3770e Add a script to change the permissions of /dev/bpf*, and a launchd plist
for it, for Mac OS X 10.4 and later.  (The script could be useful for
BPF-based systems that don't use devfs as well.) We're not installing it
at this point; that might happen later.
2008-05-28 02:14:10 +00:00
guy 720a1e8328 Don't echo the commands for "make releasetar" (they were echoed when
debugging, but they're not supposed to be echoed).
2008-05-27 07:17:04 +00:00
guy e2da3dba8c Add a missing file to EXTRA_DIST. 2008-05-26 21:12:23 +00:00
guy f2054ca165 FILES isn't used to make the tarball any more; get rid of it.
Update HDR in Makefile.in to include all headers.

Add pcap_activate.3pcap to the list of man pages in the 3PCAP section.

Add an EXTRA_DIST variable to include all the files that should go into
the tarball and that aren't in CSRC, HDR, MAN3PCAP, or MAN4.

Use CSRC, HDR, MAN3PCAP, MAN4, and EXTRA_DIST to determine what goes
into the tarball, rather than doing a "make distclean" and putting
everything into the tarball; that way, you can do "make releasetar"
without cleaning out the current directory.

Given that we're not just tarring up the entire source directory, we can
make the tarball directory as a subdirectory of the current directory and
put the tarball into the current directory, rather than putting it into
a (not-entirely-obvious) ../n directory.  Clean out the tarball
directory when we're done.
2008-05-26 21:05:47 +00:00
guy d592f692d0 Add pcap_free_datalinks() - on Windows, something allocated in Vegas^Wa
library has to be freed by the library, as an application or other
library using that library might have been built with a different
version of the C runtime library.
2008-05-26 19:58:06 +00: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
guy 1f93b0fda9 Pick up pcap_offline_filter() from WinPcap.
Add pcap_compile() to the SEE ALSO section for pcap_setfilter().
2008-05-13 15:19:56 +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 59e8b67528 From Gisle Vanem:
* gnuc.h not needed.

* sys/pack*.h was renamed in a recent Watt-32 distro.
2008-04-22 17:20:25 +00:00
guy 86b399c3ca From Gisle Vanem:
Update his e-mail address.

	Make a table const.
2008-04-22 17:16:30 +00:00
guy 9545f44f88 Expand a comment with more information on getting interface names. 2008-04-20 18:19:02 +00:00
guy ddfa7ac185 From Gisle Vanem and me: fix some typoes of mine in the conversion to
the new pcap_create/pcap_activate model, use pcap->opt.source rather
than pcap->md.device in the activate routine (pcap->md.device isn't
set), don't free the pcap_t if the activate routine fails, fix the
error return code paths not to set handle_to_device, fix references to
pcap_close_dos() to refer to pcap_cleanup_dos() as we renamed the
routine.
2008-04-19 17:49:21 +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 30b39d84b7 Fix typoes (sigh, using both "p" and "handle" for the pcap_t pointer in
different modules can lead to confusion).
2008-04-14 21:06:09 +00:00
guy f35ab115a6 Fix a typo (sigh, using both "p" and "handle" for the pcap_t pointer in
different modules can lead to confusion).
2008-04-14 21:04:51 +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
guy 0fdc174e4c Plug some leaks. 2008-04-10 03:10:33 +00:00
guy 4506350ab5 Add commands use to configure capture privileges to the SEE ALSO list. 2008-04-10 01:56:24 +00:00
guy f873417558 Copy information about privileges need to capture from the tcpdump man
page here, and update the information on Solaris to talk about the
net_rawaccess privileges.
2008-04-10 01:52:44 +00:00
guy 1fd4389877 Report PCAP_ERROR_PERM_DENIED if you don't have permission to open a
PF_PACKET socket.
2008-04-10 01:26:43 +00:00