Guy Harris [Sun, 19 Oct 2014 20:42:00 +0000 (13:42 -0700)]
Use the length field in the UDP header.
If it's less than the length of the IP payload, use it as the size of
the UDP packet. If it's greater than the length of the IP payload,
and we're not dissecting the payload, report the length as bad.
Guy Harris [Wed, 12 Nov 2014 03:05:48 +0000 (19:05 -0800)]
Further cleanups.
Use ND_TCHECK() rather than home-brew bounds checks. Do simpler length
checks.
Let i be the length of the actual remaining packet data; use ND_TCHECK()
inside loops that iterate over the remaining data.
Let the printers for particular message types cast the raw data pointer
to a pointer of the appropriate type, rather than passing two pointers,
with different types, to the same data.
Guy Harris [Wed, 12 Nov 2014 01:24:12 +0000 (17:24 -0800)]
Add initial bounds check, get rid of union aodv.
Fetch the type field without using a structure, and check to make sure
it's not past the end of the packet.
Pass to each dissection routine a pointer to the appropriate message
type structure, rather than a pointer to a union of all the message type
structures.
Guy Harris [Sat, 10 Mar 2012 23:23:50 +0000 (15:23 -0800)]
Give more information on -l, and note that -U works without -w.
Note that -l, on Windows (i.e., in WinDump), is unbuffered, not
line-buffered, and describe -U as an alternative (that doesn't have that
problem on Windows).
Note that -U does packet-buffering without -w.
Fix up the formatting of the example command lines with -l.
Guy Harris [Sat, 10 Mar 2012 22:57:00 +0000 (14:57 -0800)]
Discuss buffering when describing the -w flag.
Mention that the output of tcpdump -w is buffered, and note that this
means packets won't necessarily show up in the output as soon as they're
received, so programs reading that output won't see them immediately,
and note that the -U flag forces "packet buffering" so that a reader
will see the packets as soon as they're received.
Guy Harris [Sun, 4 Mar 2012 00:10:42 +0000 (16:10 -0800)]
Ask for the libpcap Makefile while we're at it.
...so that we can see what's being used to turn grammar.y into
grammar.c.
While we're at it, say "config.log file from the libpcap source
directory", in the hopes of making it more likely that we'll get it in
addition to the tcpdump config.log.
Guy Harris [Sat, 3 Mar 2012 21:32:11 +0000 (13:32 -0800)]
Ask for more information if we don't find pcap_loop.
I give up.
People keep reporting that the configure process for tcpdump fails to
find pcap_loop, and the config.log file they send us says there's no
pcap_parse in libpcap, which suggests that something went wrong in the
build process for libpcap; perhaps they don't have Bison and the
configure script got confused and failed to cause the parser to be named
"pcap_parse", or something such as that, or perhaps Bison was recently
"improved" in a fashion that breaks that, but I've never been able to
reproduce this on any of the Linux distribution installations to which
*I* have access.
I therefore ask them to send the config.log output and make output for
libpcap; *not one of the reporters of this problem* has bothered to send
that information, so we're stuck. Perhaps they don't care enough (in
which case, why did they bother asking us about it?), or perhaps they're
annoyed that we asked them a further question rather than Just Fixing
The Problem(TM) (in which case, all I have to say is "welcome to the
Wonderful World Of Computer Software(TM) - get used to it").
So let's just ask for all that information. (I would not be surprised
if this doesn't suffice and that they *still* just send us the tcpdump
config.log output, but at least I'll be able to tell them that they
should have Read The Fine Error Message(TM).)
Guy Harris [Fri, 14 Oct 2011 03:03:29 +0000 (20:03 -0700)]
Clean up option-walking code.
Loop as long as the remaining option list length is not zero, even if
that means we try to process the remaining options if the remaining
length is 1, so that if the option length is bogus, we'll report it.
Check for a valid ESIS_OPTION_ES_CONF_TIME length - it's supposed to be
2.
Guy Harris [Sat, 3 Sep 2011 04:31:09 +0000 (21:31 -0700)]
Handle systems with getrpcbynumber() but no header file for it.
Glibc 2.14 doesn't install the ONC RPC headers, but it installs the ONC
RPC routines, presumably for binary compatibility. Don't use
getrpcbynumber() unless we have it *and* the header file to declare it.
Jamal Hadi Salim [Tue, 28 Jun 2011 20:23:35 +0000 (16:23 -0400)]
Fwd: pcap files
On Tue, Jun 28, 2011 at 3:52 PM, Michael Richardson <[email protected]> wrote:
> I'm not aware of a new file.
The email i responded to had 4 attachments sent by Evangelos.
Those were supposed to replace the files with those exact names.
> Please send github tree, ideally.
You mentioned github to me last time and offered to get me to
learn it in 5 minutes;-> I havent had time and the old school stuff i do
still works.
How about i send you patch #1 to delete the old files (as attached)
and another to re-add with new ones.
Alternatively: I could send one that overrides the existing ones.
cheers,
jamal
> --
> ] He who is tired of Weird Al is tired of life! | firewalls [
> ] Michael Richardson, Sandelman Software Works, Ottawa, ON |net architect[
> ] [email protected] http://www.sandelman.ottawa.on.ca/ |device driver[
> Kyoto Plus: watch the video <http://www.youtube.com/watch?v=kzx1ycLXQSE>
> then sign the petition.
>
Guy Harris [Wed, 22 Jun 2011 01:15:50 +0000 (18:15 -0700)]
Use "-H", not "-h", for the 802.11s option, and improve error reporting.
I was rudely surprised to find that "tcpdump -h" wasn't printing a usage
message, and I'm the person who *added* the "-h" option. Make it "-H",
and add an explicit "-h" option to print a usage message, so nobody else
makes the same mistake. Also, don't clear opterr, so that if you give
an illegal command-line option, you get an explanatory error message.
Guy Harris [Fri, 17 Jun 2011 08:17:47 +0000 (01:17 -0700)]
Handle ICMP6 checksums more like TCP checksums.
Instead of printing the result of icmp6_cksum() if it's non-zero, print
the checksum field value and the value it should have had. That means
that what we print is the same regardless of whether we're running on a
big-endian or little-endian machine.
Guy Harris [Fri, 17 Jun 2011 05:10:36 +0000 (22:10 -0700)]
Handle UDP checksums more like TCP checksums.
Instead of printing the result of udp_cksum() if it's non-zero, print
the checksum field value and the value it should have had. That means
that what we print is the same regardless of whether we're running on a
big-endian or little-endian machine.
Also, just as we did with TCP:
Check -v and -K, and the fragmented flag, up front; then check the IP
version etc.. Don't check for IPv6 if we already know it's IPv4. Fetch
the checksum field only once.
Guy Harris [Fri, 17 Jun 2011 04:50:26 +0000 (21:50 -0700)]
Clean up the checksum checking.
Check -v and -K, and the fragmented flag, up front; then check the IP
version etc.. Don't check for IPv6 if we already know it's IPv4. Fetch
the checksum field only once.
Guy Harris [Mon, 13 Jun 2011 21:08:51 +0000 (14:08 -0700)]
Go with Wireshark's Internet checksum routine.
The Wireshark routine is based on the BSD in-kernel portable checksum
routine (thus BSD-licensed); it takes a vector of pointers and lengths
and checksums the concatenation of the buffers in question (just as the
BSD in-kernel routine checksums a chain of mbufs).
This simplifies the "with a pseudo-header" checksums; hopefully it'll
fix up the problems being seen on some big-endian platforms, which might
be due to hand-calculating some or all of the checksum and doing so
incorrectly. It also gets rid of some code that might be dereferencing
unaligned pointers.
Guy Harris [Mon, 13 Jun 2011 01:08:55 +0000 (18:08 -0700)]
Fix some problems with the tests.
Get rid of some no-longer-necessary uudecodes (Git can store binary
files such as pcap files, so we no longer need to uuencode them, and the
uuencoded files are no longer around), and handle the "-X" and "-XX"
flag tests (where we had to rename the "should be" output files to avoid
collisions on case-insensitive file systems such as the default local
file system on the desktop UN*X with the biggest market share).
Rick Jones [Thu, 2 Jun 2011 17:56:08 +0000 (10:56 -0700)]
The ifSpeed field of a generic interface counter in sFlow is 64 bits.
The "overlay" definition in print-sflow.c is correct, but the actual
extract for printing is using EXTRACT_32BITS rather than EXTRACT_64BITS,
which leads to an incorrect report for speed.
Guy Harris [Thu, 5 May 2011 09:25:42 +0000 (02:25 -0700)]
Don't use "struct netdissect_options" in interface.h.
Use it in netdissect.h, where it's defined; otherwise, we get a bunch of
warnings when compiling modules that include interface.h but don't yet
include netdissect.h.
Added support for DCB Exchange protocol (DCBX) version 1.01.
http://www.ieee802.org/1/files/public/docs2008/az-wadekar-dcbx-capability-exchange-discovery-protocol-1108-v1.01.pdf
DCBX protocol exchanges control state machine and generic feature state
machine parameters as Organizationally specific TLVs. The OUI used for
the DCBX TLV 1.01 is 0x001B21. Following TLVs are decoded:
- Control state
- Priority Groups (PG)
- Priority-based Flow Control (PFC)
- Application Protocol (APP)
From me:
Add a bunch of additional error checking, and sort the main switch
statement by TLV code (and thus by the order in the specification).
Also update/add indications of what standards document what items.
Guy Harris [Wed, 27 Apr 2011 22:15:09 +0000 (15:15 -0700)]
Try to handle radiotap Rate values > 127 better.
Use the same heuristic Wireshark uses, i.e. assume that FreeBSD only
reports MCS indices between 0 and 15, and that any other values with the
0x80 bit set are rate values. (Yes, those do exist.)
Also note, as I did in Wireshark, that it might be possible to extract
from the XChannel and Flags field the additional information to convert
an MCS index from the Rate field into a rate. (Whether that's possible
depends on what platforms using the FreeBSD convention do with the
channel width and guard interval information.)
Guy Harris [Wed, 27 Apr 2011 19:08:27 +0000 (12:08 -0700)]
Support RX flags, MCS and the vendor namespace, and fix Rate.
Based on patches from an anonymous donor, support the radiotap RX flags and
MCS fields, and the vendor namespace, and, if Channel and XChannel are
both present, use XChannel, not Channel.
Do not try to look up a rate for an MCS value from the Rate field; you
cannot map an MCS value to a rate without also knowing the channel width
and guard interval length.
Rick Jones [Fri, 15 Apr 2011 17:01:02 +0000 (10:01 -0700)]
Handle the enterprise field of the sflow flow and counter record format.
Thanks to some traces sent my way by Gavin McCullagh, and a comparison
against the output of inMon's sflowtool, I can confidently say "Yes
Virginia, there is an enterprise other than zero." Which means lest we
start trying to decode something as what it is not, we best actually
look at the enterprise field and make sure it is one we recognize.
Rick Jones [Thu, 14 Apr 2011 18:32:08 +0000 (11:32 -0700)]
To enable printing of non-expanded samples I've shuffled a bunch of code
around and created a bunch of smaller routines to more easily support
printing of both expanded and non-expanded counter and flow samples.
I've done simple testing of non-expanded counter and flow, and expanded
counter, but I don't have expanded flow at present with which to test.
So, that part of the change is only compile/eyeball tested.
Guy Harris [Tue, 5 Apr 2011 16:53:57 +0000 (09:53 -0700)]
Fix the handling of unknown tagged parameters in management frames.
Fetch the element length early in the process, rather than fetching it
each time we need it - even after we've advanced the pointer we are
using to fetch it (doing the latter means we fetch the wrong value when
we subtract it from the remaining length).
Guy Harris [Tue, 5 Apr 2011 04:32:58 +0000 (21:32 -0700)]
Process the flags even if parsing the full radiotap header fails.
If we were able to get the flags, we should process them, so we know
whether there's Atheros padding after the 802.11 header or if there's an
FCS at the end of the packet, and properly process them; if we weren't
able to get the flags, they're 0, so we're not doing anything
differently, and that's the best we can do.
Guy Harris [Tue, 5 Apr 2011 02:03:56 +0000 (19:03 -0700)]
Check the sample, flow, and counter lengths.
When dissecting a sample, or a flow or counter within the sample, make
sure we don't run past the length in the sample/flow/counter header.
This also means we count the sample length down as we process the
contents of the sample, so we only add what, if anything, remains of the
sample to the pointer into the packet, and subtract that from the
remaining data length in the packet, which means we properly handle
packets with multiple samples.
Guy Harris [Mon, 4 Apr 2011 19:02:02 +0000 (12:02 -0700)]
Properly define {u_}intN_t types when testing pcap/*.h headers.
pcap/bluetooth.h and pcap/usb.h require those types, so we check for
those types before checking those headers, and we include
"tcpdump-stdinc.h" in the tests, so the appropriate headers to define
those types get pulled in.
Guy Harris [Mon, 4 Apr 2011 08:18:04 +0000 (01:18 -0700)]
Have empty.uu explicitly be a uuencoding of /dev/null.
That way, uudecode will write the decoded output there, rather than to a
file named "empty" that gets left around. That also means we don't need
to redirect the output of uudecode to /dev/null, so don't do that.
Guy Harris [Mon, 4 Apr 2011 07:44:41 +0000 (00:44 -0700)]
Check for uudecode at make time by uudecoding a uuencoded empty file.
Doing it at make time means you don't have to re-run the configure
script if you add uudecode to your system, and doing it by uudecoding a
uuencoded empty file means we don't depend on uudecode supporting
"--help".