Guy Harris [Wed, 1 Dec 2010 00:18:32 +0000 (16:18 -0800)]
Add support for nommu systems.
Rather than hardcode the WIN32 define, add proper fork checks to the
configure script and check those. This fixes building for nommu systems
which lack the fork function.
While we're here though, add support for this functionality via vfork
so that it does work on nommu systems. And fix an old bug where we
exit properly in the forked child when the exec failed instead of just
returning to the calling code (which isn't expecting it).
Mike Frysinger [Wed, 1 Dec 2010 00:13:05 +0000 (16:13 -0800)]
Use AC_PATH_TOOL, not AC_PATH_PROG, to find pcap-config.
The PROG variant does not take into consideration cross-compilation, so
it always looks for "pcap-config" which finds the host script. So use
the TOOL variant instead which first searches for the cross-prefixed
pcap-config before falling back to the bare "pcap-config".
Guy Harris [Sun, 14 Nov 2010 20:23:40 +0000 (12:23 -0800)]
Make sure we can link with libpcap.
After finding libpcap and getting a list of other flags needed when
linking, we check for "pcap_loop()", to make sure we found a working
libpcap and have all the right other libraries with which dnl to link.
(Otherwise, for example, the check for pcap_list_datalinks() will fail,
not because the routines are missing from the library, but because we
aren't linking properly with libpcap, and that will cause confusing
errors at build time.)
Paul Ferrell [Sun, 7 Nov 2010 02:28:10 +0000 (19:28 -0700)]
Switch user ID/root directory with -Z before opening savefiles for output.
In addition to Paul's change, I added a comment explaining why we do
this, and explaining that doing so after opening the first savefile
doesn't help with subsequent savefiles, so you'll have to come up with a
better fix if you want the savefiles opened by the original UID or
outside the chroot.
Guy Harris [Tue, 31 Aug 2010 17:03:47 +0000 (10:03 -0700)]
Mark various IPv4 and IPv6 headers as unaligned.
This prevents GCC on SPARC from generating code that assumes those
structures are aligned naturally, which they are not guaranteed to be.
Move some #defines from interface.h to tcpdump-stdinc.h to make them
available to code that doesn't include interface.h.
Move the declaration of nextproto6_cksum() to ip6.h, so that only files
that use it get it declared, and thus so that you don't need to define
"struct ip6_hdr" in everything that includes interface.h. Don't include
ip6.h in tcpdump-stdinc.h.
Guy Harris [Mon, 23 Aug 2010 10:30:54 +0000 (03:30 -0700)]
Get rid of some more include files we no longer need.
We have our own copies of those include files, which we use; we haven't
used the system versions for a long time, so we don't need to drag them
along for compiling WinDump.
Guy Harris [Mon, 23 Aug 2010 10:22:25 +0000 (03:22 -0700)]
Clean up handling of tftp.h.
Don't include the win32/Include/Arpa copy in print-udp.c; don't put that
copy into the release tarball; and don't talk about <arpa/tftp.h>, or
work around its deficiencies in some OSes, as we no longer include it,
we include our own tftp.h, which has a th_stuff array in its structure
definition.
Guy Harris [Mon, 16 Aug 2010 22:02:12 +0000 (15:02 -0700)]
Print AppleTalk layer-3 network numbers as 16-bit unsigned decimal numbers.
Pick up from FreeBSD:
revision 1.3
date: 1996/09/11 06:18:26; author: pst; state: Exp; lines: +9 -12
branches: 1.3.2;
Print appletalk layer 3 addresses as 16 bit unsigned decimal numbers,
not two 8 bit values. This conforms to industry standard.
These changes have been sent back to LBL.
Inside AppleTalk(R), Second Edition speaks of node numbers as 16-bit.
Guy Harris [Mon, 16 Aug 2010 17:43:28 +0000 (10:43 -0700)]
Get rid of no-longer-valid comment.
We no longer guarantee alignment in any printer routine; all printers
must use the EXTRACT_ macros to extract integral quantities - and the
Appletalk printers now do so.
where bp is a pointer to a struct bootp, that loads the first 4-byte
word in that structure, masks out the field in that structure that's not
being compared, and compares against a word with the appropriate values
in the other fields. That won't work, because there's no guarantee that
bp points to a value aligned on a 4-byte boundary.
Declaring "struct bootp" to be packed appears to keep at least GCC 4.2.4
from performing that optimization; we define an "UNALIGNED" tag to apply
to structures to prevent that optimization, and apply that tag to the
structures in bootp.h. (We'll apply it to other structures as we
discover the need for it.)
Romain Francoise [Sat, 5 Jun 2010 07:37:27 +0000 (00:37 -0700)]
If -U is specified, flush the file after creating it, so it's not zero-length.
Reading from a capture file that has not yet received any packets fails
with "truncated dump file"; to avoid this, flush the file (forcing the
pcap header out) immediately after opening it.
Romain Francoise [Sat, 5 Jun 2010 03:10:07 +0000 (20:10 -0700)]
Merge back changes from the Debian package:
- fix TCP flags output description, by Christophe Rhodes <[email protected]>
Original patch submitted in http://bugs.debian.org/575724
- two remaining typo fixes, by A Costa <[email protected]>
Original patch submitted in http://bugs.debian.org/342310
Guy Harris [Fri, 28 May 2010 06:58:01 +0000 (23:58 -0700)]
Add a -h flag, and only attempt to recognize 802.11s mesh headers if it's set.
I give up. I have no access to the 802.11s drafts, I can't find
anything that suggests whether a heuristic check for an 802.11s header
should check for To DS and From DS both being set or either being set or
unset, or whether it should check for a QoS frame type (the examples in
all the documentation I can find have To DS and From DS set, and have a
QoS field, in the 802.11 header, but that might just be an example
802.11 header showing all the fields), so I'm just adding a -h
command-line flag; you need to specify it to get tcpdump to try to guess
whether a frame has a mesh header or not. I'll leave it up to somebody
else to figure out what the best heuristic for detecting the presence of
mesh headers is (note that tcpdump and Wireshark have different
heuristics, both of which can probably get false positives, especially
with encrypted frames where the first payload byte just *happens* not to
have any of the reserved bits in the mesh header flags set).
Guy Harris [Wed, 19 May 2010 02:25:18 +0000 (19:25 -0700)]
Fix check for malformed frames.
Don't get confused by some malformed frames - always return -1 - and
assign the result of extract_header_length() to an int, so we don't get
warnings when we compare it against -1. (Its return value always fits
in an int.)
Guy Harris [Sun, 4 Apr 2010 20:36:21 +0000 (13:36 -0700)]
Don't depend on the settings of SIZEOF_ values.
We're eventually going to stop defining the SIZEOF_ values, as we
support, for example, building fat on Mac OS X, and SIZEOF_LONG, for
example, is different between 32-bit and 64-bit builds.
Guy Harris [Sun, 4 Apr 2010 19:08:11 +0000 (12:08 -0700)]
Build universal on OS X by default; add an option to disable that.
Instead of requiring the user to specify -arch options on OS X to build
a universal version of tcpdump, just default to universal on OS X by
default. Pick the particular targets to match the way tcpdump is built
for the OS for which we're building.
Guy Harris [Thu, 1 Apr 2010 00:24:33 +0000 (17:24 -0700)]
Add a --with-arch-flags configuration option to specify target architectures.
They allow the user to specify flags to indicate the target
architecture(s) (yes, possibly plural - think, for example, Mac OS X)
for which we're building. Those might need to be used not only when
compiling, but also when linking and when building a shared library.
This is not for general cross-compiling, it's for use on platforms where
versions of the native OS support more than one instruction set and
where you want to build for the OS on which you're running but not for
the default build architecture on the machine on which you're running.
This may currently be less useful for tcpdump, as tcpdump currently
builds no libraries, but it's there for compatibility with libpcap.
Guy Harris [Fri, 19 Mar 2010 18:47:19 +0000 (11:47 -0700)]
The draft in question has nothing to do with MPLS; clarify that.
Presumably the idea is that the technique is generally applicable as
long as the traffic being carried is either IPv4, IPv6, OSI CLNP, ES-IS,
or IS-IS.
Also, by the time we get there, we know we've reached the bottom of the
MPLS stack (the do loop either fails by running past the end of the
packet and going to trunc, or by terminating because we find a label
entry with the BOS bit set); there's no need to check for that.
Guy Harris [Sun, 21 Feb 2010 20:44:53 +0000 (12:44 -0800)]
Process VLAN frames and Alteon jumbo frames in the Ethernet printer.
Instead of having the Ethernet-type handler process the VLAN and Alteon
jumbo frame Ethernet type values, process them in the Ethernet (and
Linux cooked-mode) dissectors. This makes it easier for the right MAC
addresses to be printed for those packets.
As part of that, rename ether_encap_print() to ethertype_print() - it
doesn't print encapsulated Ethernet frames, it prints payloads whose
packet type is indicated by an Ethernet type field value - and remove
the no-longer-needed "extracted Ethernet type" argument. That also lets
us eliminate it from the SNAP print routine.
Make ether_print() take a function, and an argument to pass to that
function, as parameters, so that, for example, the ATM LANE printer can
use it and put the LEC ID into the link-layer headeer printout.
Guy Harris [Sun, 21 Feb 2010 19:27:41 +0000 (11:27 -0800)]
Don't directly fetch multi-byte integers from packets.
Use the EXTRACT_ macros to extract multi-byte integral values from
packets, rather than just dereferencing pointers into the packet; there
is no guarantee that the packet data will be aligned on the right
boundary, and there is no guarantee that, if they're not, a direct
access will work correctly.
Guy Harris [Sun, 21 Feb 2010 08:27:00 +0000 (00:27 -0800)]
Don't directly fetch multi-byte integers from packets.
Use the EXTRACT_ macros to extract multi-byte integral values from
packets, rather than just dereferencing pointers into the packet; there
is no guarantee that the packet data will be aligned on the right
boundary, and there is no guarantee that, if they're not, a direct
access will work correctly.