dect
/
libpcap
Archived
13
0
Fork 0
Commit Graph

108 Commits

Author SHA1 Message Date
guy dceecef700 Indicate *which* ioctl failed. 2006-09-18 17:34:31 +00:00
guy 9651ac1a9b From Ollie Wild: if we're bound to an interface, discard incoming
packets that didn't arrive on that interface, so packets from other
interfaces that get onto the socket queue before we bind the socket to
the interface don't get supplied to the application (binding the socket
doesn't discard incoming packets).
2006-04-07 08:02:45 +00:00
guy 0a6304982c If we succeed in getting packet statistics with the PACKET_STATISTICS
"getsockopt()" argument, return those statistics, rather than falling
through and returning the statistics the way we would if
PACKET_STATISTICS weren't supported.
2006-02-23 07:35:35 +00:00
guy f742f4b148 From Daniele Orlandi <daniele@orlandi.com>: add support for capturing
LAPD frames with vISDN.
2006-01-22 20:12:09 +00:00
guy cbf3dd5b5b Don't double-count received packets on Linux systems that support the
PACKET_STATISTICS getsockopt() argument on PF_PACKET sockets.
2005-11-24 19:28:23 +00:00
guy 16ff5eeb12 Handle too-short snapshot lengths in cooked mode. 2005-10-08 11:31:16 +00:00
guy 260acf5065 From Mike "Dragorn" Kershaw: add support for the new ARPHRD_ value for
802.11 with a radiotap header (used by the madwifi driver, and in the
pipeline to be officially assigned).
2005-08-16 04:25:26 +00:00
guy 655045ea51 OK, we'll be putting out 0.9.2 soon, so add the API changes back in
again.
2005-07-07 02:04:33 +00:00
guy 3e2be26ee9 0.9's already been released, so, for better or worse, we're stuck with
the old names.
2005-07-05 22:33:16 +00:00
guy 35a2ab9527 Rename "direction_t" to "pcap_direction_t", and rename "D_IN" and
"D_OUT" to "PCAP_D_IN" and "PCAP_D_OUT", to avoid potential namespace
collisions, as per a suggestion by Dean Gaudet.
2005-07-05 22:14:06 +00:00
guy 0fe04f098e 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:30:13 +00:00
guy 345029aaf9 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:54:33 +00:00
guy e5aebee6d8 Add a "pcap_close_common()" routine which can be used as the close
routine for some pcap-XXX.c files and can be called by the close routine
in other pcap-XXX.c files.
2004-10-19 07:06:11 +00:00
guy c56022ef76 Not all Linuxes define ARPHRD_IRDA; define it if it's not defined. 2004-09-06 01:23:17 +00:00
guy 841b1f7f77 As per Mark Pizzolato, "sendto()" isn't necessary for sending packets,
at least on 2.2 and later kernels; the socket is bound (except for
sending on the "any" device, which we don't support), so a destination
address isn't necessary.

Generate the right error string for attempts to send on the "any"
device, and also disallow sends if we're in cooked mode.
2004-04-07 08:03:32 +00:00
guy 5f9f6317d2 Fixes from Mark Pizzolato. 2004-03-24 06:49:16 +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
guy 1924b620dc Don't use a static variable for the accumulated statistics, accumulate
the statistics in "handle->md.stat", so that the statistics are
maintained correctly if more than one pcap_t is in use.
2004-01-14 01:56:10 +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 619a9fe31b For devices that we have some reason to believe are real live Ethernet
devices, offer DLT_DOCSIS as one of the choices of link-layer type, and
support setting that type as meaning just "set libpcap's notion of the
link-layer type to DLT_DOCSIS" without telling the driver to use
DLT_DOCSIS.
2003-12-18 23:32:31 +00:00
guy c98ffbcabf Add a "pcap_get_selectable_fd()" API to get an FD on which you can do a
"select()" or "poll()" - or -1 if that won't work.
2003-11-21 10:19:33 +00:00
guy 2c618b93a0 Add "getnonblock" and "setnonblock" operations, and set the function
pointers appropriately, rather than using #ifdefs and run-time checks.

Get rid of declaration of non-existent "pcap_set_datalink_platform()"
routine.
2003-11-20 02:02:38 +00:00
guy a08248f680 From Jean Tourrilhes <jean2@sourceforge.net>: IrDA capture support for
Linux.
2003-11-18 21:06:50 +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 4a0eb92022 From Jesper Peterson: fix a cut-and-pasteo (the Linux libpcap code calls
its pcap_t pointer "handle", not "p", unlike most other libpcap code).
2003-11-05 04:25:24 +00:00
guy 991d444f71 Add a "pcap_breakloop()" API to break out of the loop in
"pcap_dispatch()" and "pcap_loop()".
2003-11-04 07:05:32 +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 cd0d893ef9 Add a "read" function pointer to the pcap_t structure, which handles
reading packets from a pcap_t, and make "pcap_read()" call it.  That
removes the last place where we have to check for a pcap_t that refers
to a DAG card rather than a live capture, so get rid of the "is_dag" flag.
2003-07-25 05:32:02 +00:00
guy 08658f1c93 Add a "set_datalink" function pointer to the pcap_t structure, whichhandles
setting a filter for a pcap_t.  Have "pcap_set_datalink()" call it,
rather than explicitly calling "pcap_set_datalink_platform()".
2003-07-25 05:07:01 +00:00
guy cd2807e08d Add a "setfilter" function pointer to the pcap_t structure, which
handles setting a filter for a pcap_t.  Have "pcap_setfilter()" call it,
rather than being a per-platform function.  The per-platform functions
don't need to check for an offline capture any more, as they're not
called for an offline capture (and the ones that just call
"install_bpf_program()" don't need to exist at all).
2003-07-25 04:42:02 +00:00
guy 9792990eb8 Add a "stats" function pointer to the pcap_t structure, which handles
getting statistics for a pcap_t.  Have "pcap_stats()" call it, rather
than being a per-platform function; have stats routines for non-live
pcap_t's that return an error.
2003-07-25 04:04:56 +00:00
guy e648c9e593 Add a "close" function pointer to the pcap_t structure, which handles
the platform-dependent part of closing a pcap_t (and the
live-vs-savefile part as well, so that function must close the file
descriptor and free up any buffers allocated).

In the Digital UNIX support, add in a check for a memory allocation
failure.
2003-07-25 03:25:45 +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 b3833482d0 Don't turn allmulti mode on if "promisc" isn't set; that causes problems
with some interfaces (see bug 599857 in the SourceForge list of libpcap
bugs), and, even if it doesn't cause problems, it's different from
what's done on other platforms.
2003-04-09 07:19:49 +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 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 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 d1d0fe1d98 Add support for RFC 2625 IP-over-Fibre Channel, mapping all the Linux
ARPHRD_FC* types to it.
2002-10-18 08:46:13 +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 541d54330f Isn't Linux fun? You might have a distribution whose kernel is a shiny
new 2.2-or-later kernel, with PF_PACKET sockets including SOL_PACKET,
but with an older version of the C library whose headers don't define
SOL_PACKET.

On those systems, define SOL_PACKET to have the value it has in the
2.2.0 kernel; this means we can get rid of the "#ifdef
SOL_PACKET"/#endif stuff wrapped around the code to turn promiscuous
mode on or off (we don't want that #ifdeffed out, as if it's absent we
won't pay attention to the "promiscuous mode" flag argument to
"pcap_open_live()").
2002-07-06 21:22:35 +00:00
itojun 5918c491c1 whitespace cleanup 2002-06-11 17:04:44 +00:00
guy c26a724029 Fix white space. 2002-06-01 09:36:26 +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 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 bb0918aeef Have "map_arphrd_to_dlt()" take a flag indicating whether it's OK to
return DLT_LINUX_SLL or not, and, if that flag is false, for those
interface types where we'd used DLT_LINUX_SLL, pick a DLT_ type that
works as well as possible in raw mode, or fail.

Pass 1 as that flag if we're using a PF_PACKET socket; pass 0 as that
flag if we're using a PF_INET/SOCK_PACKET socket.

For PF_INET/SOCK_PACKET sockets, try to get the link-layer type and map
it to a DLT_ value *before* turning promiscuous mode on, so that we
don't try to put the interface into promiscuous mode unless we know we
can handle its link-layer type (and thus that we can use the interface).
2002-02-10 00:05:14 +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 9f5a39497e Fix a typo in a comment. 2002-02-03 23:03:42 +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 efc02fd2e3 Put more information into the comments for "pcap_stats()". 2001-12-10 07:14:14 +00:00