dect
/
libpcap
Archived
13
0
Fork 0
Commit Graph

344 Commits

Author SHA1 Message Date
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 da21ca14ff Link-layer type 121 reserved for Siemens HiPath HDLC, as per a request
from Tomas Kukosa <tomas.kukosa@anfdata.cz>.
2002-01-25 08:27:33 +00:00
mcr 8219275ef5 #ifdef to work around NetBSD dlt.h problem. 2002-01-22 23:36:19 +00:00
guy 86c2a855bf Minor tweak to the synopsis for "pcap_setnonblock()" to make it look
more like the other synopses, and note that it returns 0 on success.
2001-12-29 21:57:07 +00:00
guy 99f5637e53 Have "pcap_setnonblock()" just return 0 on success, not the new value of
the file descriptor flags; there's no guarantee that it will actually
*affect* the file descriptor flags (consider a memory-mapped capture
mechanism such as the Linux 2.4 mechanism, where all "non-blocking mode"
means is "don't do a 'select()' or 'poll()' if there aren't any new
packets in the memory-mapped buffer") or, in fact, that there are file
descriptor flags to affect (consider WinPcap).
2001-12-29 21:55:32 +00:00
guy 4c16994790 Free up both "registers" (scratch memory locations, really) used by an
arithmetic expression in a filter; otherwise, we leak registers when
compiling arithmetic expressions.
2001-12-18 09:10:49 +00:00
guy e2537440b7 Replace "target_cpu" and "target_os" with "host_cpu" and "host_os", as
per Maciej W. Rozycki's patch.
2001-12-10 08:33:41 +00:00
guy efc02fd2e3 Put more information into the comments for "pcap_stats()". 2001-12-10 07:14:14 +00:00
guy 4ad66bbfb4 Note that "pcap_stats()" isn't supported on savefiles, as savefiles
don't include statistics.
2001-12-10 06:35:00 +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 fde2e99495 Move the description of "pcap_[sg]etnonblock()" immediately after the
description of the routines to open captures, so that non-blocking mode
is described before "pcap_dispatch()" is described.
2001-12-09 08:58:28 +00:00
guy a82f1618b8 Add APIs to put a "pcap_t" into or out of non-blocking mode, and to get
the current state of non-blocking mode; this allows us to implement, for
example, memory-mapped capture devices, where "pcap_read()" uses
"select()" or "poll()" to wait for packets to arrive, and hide that
implementation detail from applications using this API
("pcap_setnonblock()" would set or clear a non-blocking mode flag in the
"pcap_t", and the "select()" or "poll()" would not be done if the
"pcap_t" is in non-blocking mode).
2001-12-09 05:10:02 +00:00
guy b0ea1152b6 Add support for DLT_PRISM_HEADER. 2001-11-30 07:25:48 +00:00
guy cabc9945d9 Add in items for the new savefile types. 2001-11-28 07:16:53 +00:00
guy 87c019c9e2 Reserve link-layer types for Prism II 802.11 chip monitor mode
information plus 802.11 header (as per Tim Newsham's stuff) and for some
flavor of Aironet 802.11 link-layer header (as per Doug Ambrisko's
FreeBSD patches).
2001-11-28 05:50:05 +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 28e545e149 Note that we now attempt to work around AIX BPF's weirdness, indicate
that there may be compile-time or run-time problems with the
workarounds, suggest that people send in a detailed report and fall back
on DLPI if they have those problems, and suggest that if they construct
fixes for the problems they send them to patches@tcpdump.org.

Fix the white space.
2001-11-17 21:29:58 +00:00
guy 035321a1ac Attempt to work around the ways in which AIX's BPF is unlike BSD's BPF.
Get rid of the mapping of OpenBSD's DLT_LOOP to DLT_NULL; we now handle
DLT_LOOP.
2001-11-17 21:24:09 +00:00
guy ee923fedbb AIX's DLPI devices are, at least in AIX 4.3 and later, in the
"/dev/dlpi" directory, not the "/dev" directory.
2001-11-17 21:07:59 +00:00
fenner e935ae5425 Regenerate. 2001-11-12 22:19:15 +00:00
fenner 93abe845e9 Add comments to BDEBUG and YYDEBUG for autoheader 2001-11-12 22:18:57 +00:00
fenner d1a8dfbe03 Add "const" for autoconf 2.52 compatability. Longer term solution:
go through aclocal.m4 and modernize it.
2001-11-12 22:18:01 +00:00
fenner 4da5bb94e1 Make it easy to turn on optimizer and parser debugging with
--enable-optimizer-dbg and --enable-yydebug
2001-11-12 22:08:46 +00:00
fenner 5795b0ba56 Eliminate duplicate prototypes. 2001-11-12 22:04:23 +00:00
fenner cae054001c Optimize out "jset #0" (always false) and "jset #ffffffff" (always true). 2001-11-12 22:02:50 +00:00
fenner 1c20fa1fee Zero out IPv6 mask before using it. This fixes expressions like
'net 2002::/16', which were previously non-deterministic based on
the previous contents of memory.

Reported by:	Pekka Savola <pekkas@netcore.fi>
2001-11-12 21:59:44 +00:00
fenner 98181e94fc Don't optimize away "sub #0" as it may be required to recognize
the code that is generated for e.g. 'icmp[0] > 0'.
2001-11-12 21:57:06 +00:00
guy 366751fb69 Close a file descriptor leak, as per a patch that comes with Nessus and
Pavel Kankovsky's suggested fix to that patch.
2001-11-11 22:32:28 +00:00
guy 88d9e6cb24 Reserve DLT_ type 118 for Cisco internal use, as per a request from
Gilbert Ramirez of Cisco.

More explicitly reserve 116 and 117 as well.
2001-11-02 08:03:39 +00:00
guy c781d3d992 Fix a call to "pcap_add_if()" that wasn't give a null-pointer
description argument.
2001-10-28 20:40:43 +00:00
guy dfc0d14d3b Add a description to the entry for the "any" device. 2001-10-28 20:31:05 +00:00
guy d71c1c4045 In the description of "pcap_datalink()", enumerate the link-layer types,
and give a description of the link-layer header if it's not directly
implied by the link-layer type.
2001-10-28 03:54:57 +00:00
guy db79c69108 Make the "is_loopback" field of a "pcap_if" structure a general "flags"
field, and make a PCAP_IF_LOOPBACK flag be the first flag bit in that
field, specifying whether the interface is a loopback interface; this
allows us to add more flags without changing the layout of the
structure.
2001-10-28 02:31:49 +00:00
guy c3736d4ff8 When using SOCK_PACKET sockets, which don't support cooked mode, reject
any link-layer types that would get mapped to cooked mode.
2001-10-25 18:09:59 +00:00
guy bc61a9fd37 We weren't returning a warning if the interface had an ARPHRD_ type we
didn't handle; fix the code to do so.

Remove the word "Warning" from the warning - tcpdump will add it when it
prints the warning, as will Ethereal and Tethereal.
2001-10-25 08:27:18 +00:00
guy 03c414f542 Don't print the warning for an ARP type not supported by libpcap, return
it in the error message buffer, as is done for warnings in other
implementations of "pcap_open_live()".
2001-10-25 06:46:14 +00:00
mcr 8ccdbcd8e5 started 0.7 CHANGES. 2001-10-23 04:37:31 +00:00
guy 6e796fb8ba Fix a typo and a formatting nit. 2001-10-13 06:28:53 +00:00
guy daa93e7a2d Add "stamp-h" and "stamp-h.in" to ".cvsignore"; they're already in
tcpdump's ".cvsignore".
2001-10-13 05:29:27 +00:00
fenner 26f0ba1e04 Add some optimizer debugging (not compiled by default) 2001-10-13 04:23:28 +00:00
mcr f3d3a0b363 clarified use of pcap_dump(3) parameters. 2001-10-12 21:43:29 +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 d5735e2448 Split off the code to scan "/proc/net/dev" into a separate routine, and
don't call it if we've already had an error.
2001-10-10 06:46:50 +00:00
guy 519b0b5a59 If we have "/proc/net/dev", and don't have <ifaddrs.h> (i.e., don't have
"getifaddrs()"), after processing the list returned by SIOCGIFCONF, scan
"/proc/net/dev" for interface names, and add to the list of interfaces
entries for those interfaces, with no associated addresses (if the
interfaces were already added, with addresses, from the list returned by
SIOCGIFCONF, they won't get added again).

Clean up the error handling a bit.
2001-10-09 05:43:19 +00:00
guy 5a85948f80 We don't actually use HAVE_FREEIFADDRS, so there's no point in checking
whether we have "freeifaddrs()" (we don't check whether we have
"getifaddrs()", and if we have "getifaddrs()" but not "freeifaddrs()",
we're stuck with leaking memory).

Give the "any" device an instance number of INT_MAX, so it shows up
after all other non-loopback devices.

"getifaddrs()" sometimes appears to supply a destination address even
for non-point-to-point interfaces (it did so on a FreeBSD 4.1 system);
don't use the broadcast address it supplies if an interface isn't a
broadcast interface, and don't use the destination address it supplies
if an interface isn't a point-to-point interface.

If we had an error constructing the list of interfaces, don't attempt to
add the "any" device to the list.
2001-10-09 03:53:38 +00:00
guy 79aeeee5ae Check in the updated configure script, from the following change to
aclocal.m4:

	revision 1.73
	date: 2001/09/14 08:08:15;  author: torsten;  state: Exp;  lines: +2 -2
	The Itanium does not like unaligned memory accesses (the Linux kernel
	warns about them and probably performance suffers). Therefore I added
	the cpu to the list of systems where unaligned access should be avoided.
	See also http://bugs.debian.org/112152
2001-10-08 10:19:55 +00:00
guy 2ae227c882 Bump the version to 0.7. 2001-10-08 08:17:03 +00:00