dect
/
libpcap
Archived
13
0
Fork 0
Commit Graph

1517 Commits

Author SHA1 Message Date
Guy Harris 806f42441a Note that we might not get an interface drop count from /proc/net/dev. 2009-09-07 16:49:10 -07:00
Guy Harris 4b9a27475e handle->md.stat should be zeroed out when we initially allocated the
pcap_t, but, as long as we're initializing ps_drop and ps_recv,
initialize ps_ifdrop.
2009-09-07 16:48:26 -07:00
Guy Harris 1d47ee92c3 Return 0 for the ps_ifdrop value, rather than leaving it with whatever
random data it might have.
2009-09-07 16:45:24 -07:00
Guy Harris 2032d35228 From Dustin Spicuzza: support ps_ifdrop on Linux, using /proc/net/dev.
Fix the title of the pcap_stats man page, and give more detail - and a
lot of caveats.
2009-09-07 16:23:15 -07:00
Guy Harris 8b04d928b6 No, that's not an issue - it'll be a strdup() in any case, and safe to
free.  Revert previous change.
2009-08-11 22:10:51 -07:00
Guy Harris ddea9de623 When using pcap_create_common() in pcap_fopen_offline(), leave
p->opt.source null, so that we don't try to free a constant string when
we close the pcap_t.
2009-08-11 22:09:06 -07:00
Guy Harris b93bc35e51 From Dustin Spicuzza: use pcap_create_common() to allocate the pcap_t in
pcap_fopen_offline(), so that we initialize various function pointers
(not just the oneshot callback, but also functions such as the "can set
rfmon mode" function).
2009-08-11 22:06:38 -07:00
Guy Harris 4e4c320e9f Add opentest.c to the list of files to put into the source tarball. 2009-08-11 21:38:06 -07:00
Guy Harris d316f7ebb2 Add a program for testing both the old (pcap_open_live()) and new
(pcap_create()/.../pcap_activate()) open path, especially for reporting
errors.
2009-08-11 21:37:18 -07:00
Guy Harris 96fece483a From Dustin Spicuzza: if the activate routine doesn't supply an error
message, supply the error message corresponding to the activate
routine's return status, for the benefit of programs that don't handle
different error returns differently.
2009-08-11 21:31:18 -07:00
Guy Harris 1628ad56b0 seltest was renamed selpolltest. 2009-07-30 20:58:34 -07:00
Guy Harris efeaba4650 The pcap_activate() man page says:
If PCAP_WARNING_PROMISC_NOTSUP, PCAP_ERROR_NO_SUCH_DEVICE, or
	PCAP_ERROR_PERM_DENIED is returned, pcap_geterr() or
	pcap_perror() may be called with p as an argument to fetch or
	display an message giving additional details about the problem
	that might be useful for debugging the problem if it's
	unexpected.

but we weren't always setting the error string in question.  Do so.

In pcap_open_live(), if the open fails with PCAP_ERROR, include the
device name in the error string, and if it fails with
PCAP_ERROR_NO_SUCH_DEVICE or PCAP_ERROR_PERM_DENIED, include the device
name and both error messages in the error string.
2009-07-30 20:58:08 -07:00
Guy Harris 0101db9e7c Add the -p flag to the usage message. 2009-07-30 20:32:04 -07:00
Guy Harris e29e700736 Note that what follows the ipnet pseudo-header is an IPv4 or IPv6
datagram.
2009-07-27 12:04:39 -07:00
Guy Harris a685965f2f DLT for Solaris ipnet, requested by Darren Reed. 2009-07-27 12:02:34 -07:00
Guy Harris edf4e2c451 Don't bother printing the "."s per packet received - the summary line
giving packets seen and counted suffices.
2009-07-26 15:51:27 -07:00
Guy Harris c3c51e58e5 Clean up per-packet output a bit; don't output a blank line if no
packets were seen, but do put the "."s on a separate line - which should
all come out in a burst, so don't fflush() after each one, let the
newline at the end do that.

Report POLLNVAL for poll().

When not using select() or poll(), loop forever doing pcap_dispatch(),
rather than just using pcap_loop(), so you see what happens for each
delivered batch of packets.
2009-07-26 15:44:31 -07:00
Guy Harris 559ebc322f Add poll() support to seltest, and rename it to selpolltest.
Just print "."s for packets seen, and count the packets.  Print out the
information from the file descriptor bitsets/poll FDs on one line.
2009-07-26 13:55:35 -07:00
Guy Harris 03bee67123 Use pcap_get_selectable_fd() to get the FD on which to do a select(). 2009-07-24 12:17:10 -07:00
Guy Harris 2f9c8dd44a Check for both readability and exceptional conditions on the pcap FD,
and report on both.
2009-07-24 12:15:22 -07:00
Guy Harris 6e614204bb Get rid of unused variable. 2009-07-24 12:04:09 -07:00
test 04740b6647 Added a bunch of #ifdef directives to make wpcap.dll (WinPcap) compile under cygwin.
cygwin finally ships with ws2tcpip.h, so we need to get rid of some duplicated definitions.
2009-07-16 15:46:55 -07:00
test 7adb5eda4b Added an #ifdef directive to allow compiling the WinPcap samples with VC2008. 2009-07-16 15:09:15 -07:00
Guy Harris 11934bbcf0 Add another Fibre Channel link-layer type value; this one is for frames
that include an encoding of the frame delimiters.
2009-07-23 12:24:14 -07:00
Guy Harris a5b84cdc4f From Peter Volkov:
Fix typo

    pkt_for_oneshot is not difined anywhere, but oneshot_userdata is.
2009-07-22 23:53:22 -07:00
Guy Harris 6de2dedb10 Fix typo. 2009-07-16 15:10:42 -07:00
Guy Harris 34e950492a When doing Linux mmapped capture:
Allocate a buffer into which to copy a packet, and have the
	callback for pcap_next() and pcap_next_ex() copy to that buffer
	and return a pointer to that buffer; we can't return the packet
	data pointer passed to the callback, as, once the callback
	returns, that buffer can be overwritten, even before you read
	the next packet.

	Don't tweak filter programs passed into the kernel to return
	65535 on success - we don't have to, as we're not reading
	packets with recvfrom(), and we don't want to, as, if we return
	the actual snapshot length, the kernel will copy less data to
	the ring buffer.

	Truncate the packet snapshot length to the specified length, as
	we might not have a filter to do that.
2009-07-16 15:08:12 -07:00
Guy Harris 7b6487a8a5 Note that libpcap links with libnl by default - and that this shouldn't
break binary compatibility, so that's not a reason to disable that.
2009-07-15 14:19:13 -07:00
test 9c54f8726d Removed some leftover tracing messages. 2009-07-15 13:30:41 -07:00
Guy Harris f27e3da547 From Dustin Spicuzza:
- Fixed bug where create_ring would fail for particular snaplen and
  buffer size combinations
- Changed ring allocation to retry with 5% less buffer size instead of
  50%
2009-07-15 13:16:36 -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
Guy Harris 0e9481a12a In the test for a bRequestType member of "struct usbdevfs_ctrltransfer",
include various "standard" headers, to make sure "u_int" gets defined.
2009-07-13 01:08:32 -07:00
Guy Harris 14cfcac8fa Rename ADDLOBJ to ADDLOBJS, along the lines of LIBOBJS, etc..
Add ADDLARCHIVEOBJS, so that we can put some stuff from -ldag into the
archive library (so it's self-contained, and the configuration processes
for programs not configured with pcap-config don't have to know about
the DAG library) but not into the shared library (as we can link libpcap
with the DAG shared library, so linking with -lpcap will cause -ldag to
be linked in at run time if necessary).
2009-07-12 16:33:08 -07:00
Guy Harris 6796b164fd Get rid of an assigned-to-but-unused variable. 2009-07-11 14:06:57 -07:00
Guy Harris 719f5a457b Add the test programs to the list of files to ignore. 2009-07-11 12:19:57 -07:00
Guy Harris 3efa666174 For Linux, add to the pcap_md structure a pointer to a memory-mapped
region and the size of the region; use that pointer rather than the bp
or buffer member (that means we don't have to worry about
pcap_cleanup_live_common() attempting to free that buffer).  Use the
saved size when unmapping the memory-mapped region.

Use that for Linux USB memory-mapped access as well - and unmap the
memory-mapped region when we close the pcap_t, because we *do* have to
unmap it.
2009-07-11 11:59:04 -07:00
Guy Harris 6f7074d4b0 commit e61f27f56bef0f229f0bf02911f76cfcfa12f083
Author: Peter Volkov <pva@gentoo.org>
Date:   Wed Jul 8 16:06:18 2009 +0400

    Add --without-libnl configure switch

    Allow build libpcap with libnl disabled even in case libnl is installed
    at system.
2009-07-09 13:55:49 -07:00
Guy Harris 2723ec4198 Check for the intN_t and u_intN_t types the same way we do for tcpdump;
that works better on Tru64 UNIX.

Include the relevant headers for those types in savefile.c, for the same
reason.
2009-07-08 01:10:18 -07:00
Guy Harris 968888b3e0 The SUSv3 says ntoh* and hton* are declared in <arpa/inet.h> and, on
HP-UX 10.20, by default you have to include <arpa/inet.h> to get them
defined.
2009-07-07 11:42:22 -07:00
Guy Harris c435bd7e92 In memory-mapped mode, when turning non-blocking mode on when it's off,
map all non-negative timeouts, including 0, to negative values, so that,
even with no timeout set, non-blocking mode will skip the select() call.
2009-07-06 12:06:22 -07:00
Guy Harris 1f14841bc0 In memory-mapped mode, when turning non-blocking mode on when it's off,
map all non-negative timeouts, including 0, to negative values, so that,
even with no timeout set, non-blocking mode will skip the poll() call.
2009-07-06 11:35:52 -07:00
Guy Harris ffe20c46cb In AC_LBL_C_INIT, don't explicitly set V_CCOPT, just set $1, as is done
elsewhere in the macro.

For the Alpha C compiler, don't set -std1 unless it's necessary for ANSI
mode - we don't want to limit the compiler only to C89 features and,
more importantly, C89 headers (<inttypes.h> doesn't work, on at least
some versions of Digital UNIX and some C compiler versions, with -std1).
2009-07-04 17:56:27 -07:00
Guy Harris bbd8be8360 Older Linux kernels have different member names for "struct
usbdevfs_ctrltransfer"; check for that and handle it.

Don't declare variables in the middle of a block; some versions of GCC
appear to warn about that.
2009-07-04 15:04:59 -07:00
Guy Harris 8844f5bad8 Squelch some compile warnings with older Linux kernels. 2009-07-04 14:17:36 -07:00
Guy Harris 32e1c4bab0 Add a link-layer type value for Fibre Channel FC-2 frames, as requested
by Kahou Leu.

Clean up a comment.
2009-07-03 17:09:22 -07:00
Guy Harris 703acf10e7 Not releasing a packet in Linux memory-mapped mode until we try to read
the next packet breaks select().  Back those changes out; we'll have to
fix the behavior of pcap_next* by making a copy of the packet.
2009-07-03 14:37:06 -07:00
Guy Harris b43a22e65e Print a message when capture starts. 2009-07-03 13:37:58 -07:00
Guy Harris e627fb2f1a Add a "-n" flag to turn on non-blocking mode.
Print the number of packets processed by pcap_dispatch() when it returns.
2009-07-03 12:34:39 -07:00
Guy Harris fda67c0c17 Clean up the shared libpcap, and the test programs, with "make clean". 2009-07-03 12:25:07 -07:00
Guy Harris 16d78cf97c We already add -fpic in AC_LBL_C_INIT; no need to add -fPIC. 2009-07-02 23:23:26 -07:00