dect
/
libpcap
Archived
13
0
Fork 0
Commit Graph

131 Commits

Author SHA1 Message Date
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 97a8e5112d From Patrick Marie <mycroft@virgaria.org>: add support for port ranges
in tests - "portrange X-Y" matches all ports in the range [X,Y].

Support added for port ranges with IPv6.

Fix some comments.
2005-04-19 04:25:00 +00:00
guy 75e966b257 From Mark C. Brown: don't use hard-code values of 22 and 24 for the SAP
on HP-UX, just keep trying different SAPs until we find one that doesn't
return EBUSY, as attempting to use a SAP that some other descriptor is
already bound to returns EBUSY.
2005-04-17 00:47:40 +00:00
hannes c71f20189b from TANAKA Shin-ya <zstanaka@archer.livedoor.com>:
fix a typo
2005-04-12 20:46:28 +00:00
guy 6dc4f10b78 From Dug Song <dugsong@monkey.org>: don't fetch the filter code until
we're about to apply the filter, so that if it's changed by a callback
routine, we get the current filter, rather than the one in effect when
we started the loop.
2004-11-30 10:51:41 +00:00
guy cccbf10006 From Chris Lightfoot <cwrl@users.sourceforge.net>: add
"pcap_dump_fopen()" to open a pcap_t given a FILE *, and add
"pcap_dump_fopen()" to open a pcap_dumper_t given a FILE *.

On Windows, if we're opening the standard input, put it in binary mode.

Check for errors from "sf_write_header()" and return an error if we get
an error.
2004-11-07 21:40:48 +00:00
guy f9b1d9732a From Dean Gaudet <dean@arctic.org>: handle AF_PACKET addresses on OSes
that have them (Linux).
2004-11-04 07:26:04 +00:00
guy 82281a6f1e From Matthew Luckie <mjl@luckie.org.nz>: FreeBSD version numbers from
"uname()" end with "-RELEASE" (or "-CURRENT" or "-STABLE" or...), so
check the first 4 characters of the release number string for the
version number followed by "-".
2004-09-15 08:01:21 +00:00
guy 2ae5a9fc8c From Nicolas Dade <ndade@nsd.dyndns.org>: the VLAN tag is in the lower
12 bits of the VLAN field - check only those bits, not the priority or
CFI flag.
2004-08-27 07:37:10 +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
hannes f2101dbb5d patch from Erik de Castro Lopo <erik.de.castro.lopo@sensorynetworks.com>:
In the Linux kernel the packet statistics are zeroed during each retrieval.
  In contrast, on FreeBSD, the packet statistics are retrived using
  ioctl(BIOCGSTATS):

  The patch adds a static variable to pcap_stats_linux() which
  holds a running total of the packet statistics so that the behaviour
  of pcap_stats() on Linux matches the behaviour of FreeBSD.
2004-01-02 11:25:26 +00:00
guy 6d75a65bb6 Give Takashi Yamamoto credit for the code generator and optimizer fixes. 2003-12-22 00:08:44 +00:00
guy fcadc89577 From Albert Chin <china@thewrittenword.com>: on platforms that lack
"snprintf()", include one in libpcap with the name "pcap_snprintf()", so
applications don't have to supply their own "snprintf()" on those
platforms in order to use libpcap.
2003-12-15 01:35:03 +00:00
guy 028bb1b31d From Koryn Grant <koryn@endace.com> - DAG support enhancements and fixes:
Added support for nonblocking operation.

	Added support for processing more than a single packet in
	pcap_dispatch().

	Fixed bug in loss counter code.

	Improved portability of loss counter code (e.g. use UINT_MAX
	instead of 0xffff).

	Removed unused local variables.

	Added required headers (ctype.h, limits.h, unistd.h,
	netinet/in.h).

	Changed semantics to match those of standard pcap on linux.
		- packets rejected by the filter are not counted.
2003-11-20 01:21:25 +00:00
guy 086bf17b56 Use Jean Tourrilhes' HP Labs address. 2003-11-18 21:53:03 +00:00
guy a08248f680 From Jean Tourrilhes <jean2@sourceforge.net>: IrDA capture support for
Linux.
2003-11-18 21:06:50 +00:00
mcr 8dd18b1fa9 removed people who shouldn't be bugged since they aren't
actively committing code now.
2003-11-13 03:15:20 +00:00
guy d8ccb0422b From Brian Ginsbach <ginsbach@cray.com>:
correctly handle loopback devices on IRIX and UNICOS/mp (tweak
	the packet header so that it's a 4-byte AF_ value rather than
	the 2-byte AF_ value supplied on snoop sockets);

	add support for IP-over-FC and pseudo-link devices on UNICOS/mp.
2003-11-12 23:15:00 +00:00
guy 4246a40e00 From a Debian patch by Eric Anderson <anderse@hpl.hp.com>, give more
detail if we get a premature EOF when reading packet data.

Also, do the same check when reading the packet *header*, and check for
I/O errors as well.
2003-11-04 01:49:07 +00:00
guy 00f79e19a4 From Krzysztof Halasa <khc@pm.waw.pl>:
support Linux Frame Relay ARPHRD_FRAD as Frame Relay with an FR
	header;

	support Linux Frame Relay ARPHRD_DLCI in cooked mode;

	current Linux kernels use the name ARPHRD_CISCO for Cisco HDLC
	(513).
2003-10-06 07:04:55 +00:00
guy bf56c44d21 From Mike Wiacek: have "get_sa_len()" return 0 if the "addr" pointer
passed to it is NULL, as it might be if, for example, the address or the
netmask isn't supplied.
2003-09-10 23:06:43 +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
guy 2edba7705d From Paul Mundt <lethal@linux-sh.org>: add SuperH to the list of CPUs
where we wire in the idea that it can't handle unaligned accesses.  (I
don't know why the test program doesn't work - but perhaps the test
program is the wrong answer anyway, as it doesn't work when
cross-compiling.)
2003-03-28 08:28:26 +00:00
fenner c5419d46c8 Only look up "tcp" and "udp" in pcap_nametoport(). This fixes the
case in e.g. FreeBSD where /etc/services lists port 4 for the ddp "echo"
 service.

Submitted by:	Alan Bawden <Alan@LCS.MIT.EDU>
2003-02-25 22:12:03 +00:00
guy d4b09f9421 Put in Shaun Clowes' full name. 2003-02-11 02:07:20 +00:00
guy aedf01b20f From Shaun <delius@progsoc.uts.edu.au>: on AIX, load the BPF driver and
create the BPF device nodes if necessary, and rename our "bpf.h" to
"pcap-bpf.h" and install it in "/usr/include", so that "pcap-bpf.c" gets
the system's bpf.h file if it includes <net/bpf.h> - on AIX, it needs to
get an AIX-specific structure from that header in order to support
loading the driver and creating the nodes.

Update "packaging/pcap.spec".
2003-02-11 01:46:05 +00:00
guy 52866495a0 From Gisle Vanem <giva@bgnett.no>: treat CR as white space in
expressions.
2003-02-08 19:27:00 +00:00
guy 2d1ac3b4d5 From Peter Fales <peter@fales-lorenz.net>: support for Linux ARCNET,
which supplies different headers from BSD ARCNET, and fixes to the
ARCNET code generator (the protocol ID field is 1 byte, so the values
for it shouldn't be byte-swapped).

Whitespace cleanups.

The "NetBSD-style" ARCNET headers are used in other BSDs as well, so
just call them "BSD-style".
2003-01-23 07:24:51 +00:00
guy a41135fcd3 From NetBSD, as checked in by Antti Kantee <pooka@netbsd.org>: fix the
documentation for "pcap_next()" to indicate that it returns a "const
u_char *", not just a "u_char *".
2003-01-16 07:43:24 +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 eca5a61ef1 From Andrew Brown <atatat@atatdot.net>: add a "pcap_dump_flush()" call,
to flush the standard I/O buffer for a "pcap_dumper_t" and force all
packets written with "pcap_dump()" to the savefile.
2002-12-21 23:38:51 +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
guy de4c0d816c From Kazushi Sugyo: address pointers in entries returned by
"getifaddrs()" can be null, so make "SA_LEN()" return 0 if the argument
is null, rather than dereferencing the argument and crashing if it's
null.
2002-10-19 02:25:40 +00:00
guy 6d1a64f8b0 From Jon Lindgren <jonl@yubyub.net>, based on a note from Don Ebright
<Don.Ebright@compuware.com>: ignore EFAULT from a BPF read in AIX.
2002-10-08 07:18:07 +00:00
guy bf2270da5b From Guillaume Pelat <endymion_@users.sourceforge.net>: properly
null-terminate the interface name when doing an NIOCBIND.
2002-08-25 21:13:52 +00:00
guy 465f10efe4 Sort the maintainers' names in alphabetical order by the given name, and
add Fulvio Risso and Juergen Schoenwaelder to the list of maintainers, as
they have CVS commit privileges.
2002-08-04 21:10:10 +00:00
guy 88ff6e1792 Add Gianluca Varenni to the list of contributors, as he's one of the
WinPcap developers.
2002-08-03 19:54:33 +00:00
guy 536204d71b Add Loris Digioanni, as he's credited as the main programmer on the
WinPcap credits page.
2002-08-02 04:31:19 +00:00
guy 9e6fbe3b4b Cut-and-pasteo fix, from Greg Stark <gsstark@mit.edu>. 2002-07-12 07:51:15 +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
guy d5645c3c5a To quote Hannes Gredler, "tony has moved a while ago". 2002-05-28 09:25:49 +00:00
guy 03550aa8e2 Add support for gigabit Ethernet interfaces on SGI machines, from David
Kaelbling <drk@sgi.com>.
2002-03-07 11:39:13 +00:00
guy a579c1219c Support for ARPHRD_RAWHDLC, as used by, for example, the Cyclades PC300
synchronous board in Raw HDLC mode, from Octavian Cerna
<tavy@ylabs.com>.
2002-03-07 11:27:57 +00:00
guy 0c86142e99 From John Bankier <jbankier@rainfinity.com>: the buffer into which we
read packets is "p->bufsize" bytes long, not MAXDLBUF bytes long
("p->bufsize" is set to (MAXDLBUF * sizeof sizeof(bpf_u_int32))), so
supply that as the "maxlen" value in the "data" argument to "getmsg()".
2002-03-05 04:05:56 +00:00
guy 6c3ce3a573 Bug fixes from Graeme Hewson <ghewson@cix.compulink.co.uk>:
1. During termination processing set up by atexit() under a 2.0.x
   kernel, if a socket had been previously closed and the handle freed
   due to an error, pcap_close_all() and pcap_close_linux() would
   nevertheless try to work with these structures and then crash.
   pcap_close_linux() is now called directly when necessary during
   error processing.

2. atexit() could get called more than once because the did_atexit
   flag wasn't being set.

3. If iface_get_arptype() returns an error because the ioctl() call
   failed (probably due to "no such device"), live_open_new() now
   returns a fatal error to pcap_open_live() and the call to
   live_open_old() is short-circuited.

4. Applications using libpcap would appear to listen on an interface
   that was down.

   a. iface_bind() and iface_bind_old() now check for pending errors
      after bind().  In turn, pcap_open_live() now returns an error
      status if there was a pending error after bind().

   b. After draining the socket, set_kernel_filter() now checks to see
      if the error was the expected EAGAIN and returns a fatal error
      to pcap_setfilter() if not.  In turn, pcap_setfilter() now
      returns an error status if there was a network error.

5. pcap_setfilter() was putting an error message into errbuf after a
   failed call to install_bpf_program().  This was unnecessary since
   install_bpf_program() puts its own error message into errbuf.
2002-02-22 09:20:11 +00:00
guy e1f3b3be1a From Solomon Peachy <pizza@shaftnet.org>: Linux 2.4.18pre4 defines
ARPHRD_IEEE80211_PRISM, for sniffing on Prism II-based 802.11 interfaces
and getting the special Prism header, so we should map it to
DLT_PRISM_HEADER.
2002-02-05 05:47:14 +00:00
guy fcfc446231 From Jan-Philip Velders <jpv@veldersjes.net>: Linux 2.0[.x] kernels
didn't define ARPHRD_HDLC - define it as per Linux 2.1.13, if it's not
defined.

Do the same with ARPHRD_FDDI, as that's not defined by 2.0, either.
2002-02-03 23:02:07 +00:00
guy 1a00bc6928 Fixes from Phil Wood:
Don't subtract "tp_drops" from "tp_packets" - "ps_recv", on BSD,
	at least, includes packets dropped due to lack of buffer space,
	so it should do so on Linux as well.

	The "len" argument to "getsockopt()" is a value-result
	parameter, initially containing the size of the buffer being
	supplied; set it before the call.

	Catch "getsockopt()" errors and, if it's an error other than
	EOPNOTSUPP, return an error.
2001-12-10 05:49:40 +00:00
guy 4e83ece64c From Maciej W. Rozycki <macro@ds2.pg.gda.pl>: treat all MIPS and SPARC
platforms as always requiring strict alignment, rather than doing
configure-time testing with a sample program.
2001-11-25 02:22:06 +00:00
guy 5ad8d9d9e2 As suggested by Hyung Sik Yoon <hsyn@kr.ibm.com>, use 2 rather than 0 as
the SAP on AIX if a SAP of 1537 doesn't work; he says that 2 works on
Token Ring but 0 doesn't.
2001-10-12 06:43:42 +00:00
guy 9c0a593a2e From Scott Gifford:
Add a new "pcap_findalldevs()" routine to get a list of all
	interfaces that can be opened with "pcap_open_live()", and a
	"pcap_freealldevs()" routine to free the list.

	Make "pcap_lookupdev()" use it, which also arranges that it will
	not return a device that cannot be opened by "pcap_open_live()".

	Allow the "any" device to be opened, on Linux, with "promisc"
	non-zero; ignore the request for promiscuity, and return a
	warning message indicating that promiscuous mode isn't supported
	on the "any" device.

Document "pcap_findalldevs()" and "pcap_lookupdev()", and clean up some
items in the libpcap man page.
2001-10-08 01:06:20 +00:00
guy cec0453730 Patch, based on a patch from Pavel Kankovsky <kan@dcit.cz>, to flush all
packets queued up on the socket when we set a kernel filter on the
socket, so that if there are any queue-up packets that wouldn't have
passed the new filter, we don't see them.  (Some other packet capture
mechanisms do this automatically; this prevents tcpdump, for example,
from showing or saving, when run with a filter, some packets that
wouldn't have passed the filter.)

XXX - do we have to do this on any other platforms?

Choose whether to compile in the code to modify filter programs for use
in the kernel, and to flush queued-up packet and set a kernel filter, on
whether SO_ATTACH_FILTER is defined (i.e., on whether we have kernel
filter support in our build environment), rather than on whether
HAVE_PF_PACKET_SOCKETS is defined (i.e., on whether we have PF_PACKET
support in our build environment), as we choose whether to *use* that
code based on whether SO_ATTACH_FILTER is defined.
2001-08-25 05:08:26 +00:00
guy 380a3dbf49 From Scott Barron <sb125499@ohiou.edu>: use the
SOL_PACKET/PACKET_STATISTICS "getsockopt()" call, on Linux kernels that
support it, to get packet statistics, so that we can report the number
of dropped packets, and always use <linux/if_packet.h> to get
definitions for PF_PACKET sockets, so that we don't depend on glibc's
header files having been updated to support all the latest shiniest
kernel features (many systems with 2.4[.x] kernels don't have a
<netpacket/packet.h> that defines "struct tpacket_stats", for example,
so we wouldn't have been able to support that kernel feature on those
systems).
2001-07-29 18:25:46 +00:00
guy 7aa547ff09 Change from NetBSD, by Martin Husemann <martin@netbsd.org>:
Adapt to (temporary) DLT_PPP_ETHER useage by the pppoe code in tree
	now. This needs to be fixed when a generic PPP sheme is implemented.
2001-06-20 07:12:38 +00:00
guy 77d52cac81 Support for LocalTalk hardware, from Uns Lider <unslider@miranda.org>. 2001-06-18 08:46:28 +00:00
guy 6cd32e5cef 802.11 support, from Javier Achirica <achirica@ttd.net>. 2001-06-10 01:11:39 +00:00
guy 9f302b1f7f Support for capturing on encrypted CIPE tunnels in IRIX, from Franz
Schaefer <schaefer@mond.at>.
2001-06-05 03:48:41 +00:00
guy 8b26b4e6ef Documentation fixes from Chris Pepper <pepper@mail.reppep.com>.
Update the note on libpcap being "not very well suited for interactive
programs" to note that at least some of what it says is necessary is
already supported.
2001-06-05 03:45:53 +00:00
guy 60673d8144 Patch from Xianjie Zhang <xzhang@cup.hp.com> to handle HP-UX systems
with a large number of PPA's.
2001-05-21 03:50:08 +00:00
guy c711e1de8d Patch from Stefan Hudson <hudson@mbay.net> to handle, on Solaris, device
class names with digits in them.
2001-05-21 03:35:04 +00:00
fenner 283da6d726 SCTP support from Armando L. Caro Jr. <acaro@mail.eecis.udel.edu> 2001-05-10 14:48:01 +00:00
guy 5f649f110e Patch from Marcus Felipe Pereira <marcus@task.com.br> to map ARPHRD_HDLC
to DLT_C_HDLC.

Arrange that if "map_arphrd_to_dlt()" supplies DLT_LINUX_SLL as the
link-layer DLT_ value, we capture in cooked mode.

Return DLT_LINUX_SLL for ARPHRD_PPP, as some PPP code in the kernel
supplies no link-layer header whatsoever to PF_PACKET sockets, other PPP
code supplies PPP link-layer headers ("syncppp.c"), and PPP-over-ISDN
appears to supply random link-layer headers (there's code in Ethereal,
for example, to cope with PPP-over-ISDN captures with which the Ethereal
developers have had to cope, heuristically trying to determine which of
the oddball link-layer headers particular packets have).
2001-04-09 05:55:39 +00:00
guy 67e19bff40 Add Jason Thorpe's name to the list of contributors. 2001-02-25 00:54:05 +00:00
guy cae3c555e6 Patch from NetBSD, by Klaus Klein <kleink@netbsd.org>, to support "vrrp"
as an IP protocol, like "udp", "tcp", "icmp", "pim", etc..
2001-02-21 09:33:03 +00:00
guy bc0425f86c Patch from Onno van der Linden <onno@simplex.nl> to support Token Ring
on DLPI systems.
2001-02-21 09:07:40 +00:00
guy a6e177c611 Patch from Igor Khristophorov <igor@atdot.org> to handle adaptive SLIP
interfaces on Linux just like standard SLIP interfaces.
2001-01-20 07:47:53 +00:00
guy fa766cfb0c Patch from Lorenzo Cavallaro <sullivan@sikurezza.org> to create
$(DESTDIR)/$(mandir)/man3 before installing the libpcap man page, if
that directory doesn't already exist.
2001-01-18 04:05:12 +00:00
guy af32a655e1 Add some additional entries. 2001-01-10 04:06:44 +00:00
guy 4ee46797c7 Patch from Olaf Kirch to add support for ARPHRD_TUNNEL (or at least for
some tunnels).
2000-12-22 11:53:27 +00:00
guy 525b970802 Patch from Arkadiusz Miskiewicz <misiek@pld.org.pl> to handle ARPHRD_SIT
(IPv6-inside-IPv4 tunnel).
2000-11-04 07:19:22 +00:00
guy af30d75a3e Tony Li's changes, from FreeBSD, to support filtering for OSI packets
and for ESIS and ISIS packets.
2000-10-28 09:30:20 +00:00
guy 54b2ab13c2 Patch from Monroe Williams <monroe@pobox.com>, submitted with NetBSD PR
#5228, to correctly check for Appletalk for EtherTalk phase II - they
use 802.3 with LLC SNAP packets, rather than D/I/X Ethernet packets.

His patch made "atalk" check for Appletalk ARP as well as other
Appletalk packets; I've instead added a separate "aarp" packet type,
leaving "atalk" checking only for ETHERTYPE_ATALK, so you can check for
ETHERTYPE_ATALK, ETHERTYPE_AARP, or both.
2000-10-28 08:19:29 +00:00
guy 8c16ead778 Fix from Jefferson Ogata <jogata@nodc.noaa.gov> - "count_stmts()" wasn't
counting any extra jumps required by a flowgraph node (the conditional
jump instructions have an 8-bit offset; if the target is more than 256
instructions away, we generate a nearby "jump always" to the target, and
jump to that instead).
2000-10-28 01:22:52 +00:00
guy 4bff247486 Oh, well, maybe *next* time I'll remember that the names are in
alphabetical order by first then last name.
2000-10-22 04:18:44 +00:00
guy 98a503e843 Improved VLAN support, from Peter Jeremy - "vlan" filtering keyword,
letting you filter based on the VLAN to which a packet belongs, and an
improvement to the printing of VLAN packets (adding an extra space to
separate the VLAN priority and flags from the next stuff printed).
2000-10-22 04:15:55 +00:00
torsten 808b77b191 Fixed my mail address. The GMX address might go away. For open source
stuff I prefer using the debian.org address.
2000-09-18 18:47:46 +00:00
guy ef67d43d46 Change my address to my mail-forwarding address; "any problem in
computer science can be solved by adding a layer of indirection".
2000-07-30 05:28:24 +00:00
guy 763e372b7e Fix the names in the entries in the credits for Alexey Kuznetsov and
Fulvio Risso.
2000-07-30 05:20:13 +00:00
assar ccd074109a try fetch names from CVS logs and adding here 2000-07-29 10:16:08 +00:00
torsten 94de442535 Merged the Linux v2.2 packet support into the main trunk (from
tag linux-2-2-packet). Please test this code :)
2000-06-08 06:40:09 +00:00
mcr 3271bef083 updated docs 2000-01-24 23:57:55 +00:00