Fix a segfault with the -C option when the number of files grows
to 1000. Limit has been increased to 1,000,000, and the code
will check for exceeding this.
Also, add a -W option which will limit the number of files
created before 'wrapping around' and writing to the first file
again, creating a 'loop tape'. Very useful if you want to have
this running permanently to capture traffic up to a irregular
event.
Change the way that output files with -C are numbered. -C alone
goes <none>, 1, 2, 3.... -C with -W will number 0, 1, 2 ... or
00, 01, 02 ... etc, depending on the value of -W. I.e., it
sorts properly. (Old behaviour was to go <none>, 2, 3...)
Close the current capture file before trying to allocate the buffer for
the new file's name, so that if that allocation fails we've at least
written out all of the previous file.
Make some variables for command-line arguments, and some functions not
used outside tcpdump.c, static.
hannes [Thu, 15 Jan 2004 18:59:15 +0000 (18:59 +0000)]
- bugfix: rework the AS_PATH decoder per draft-ietf-idr-rfc3065bis:
CONFED_AS_SET and CONFED_AS_SEQUENCE codepoints have changed;
- rework the SEQ and SET display output in accordance with contemporary
routing software
( AS ) indicates an CONFED AS SEQUENCE segment
{ AS } indicates an AS SET segment
({ AS }) indicates an CONFED AS SET segment
guy [Wed, 7 Jan 2004 22:50:40 +0000 (22:50 +0000)]
Note that Mac OS X, as one of the BSDs, has SIGINFO; note that
Digital/Tru64 UNIX has it as well (although the tty(7) man page doesn't
mention VSTATUS - stty(1) mentions "status", however, and signal(4)
mentions SIGINFO, and some Tru64->HP-UX transition pages mention SIGINFO
as a feature available in Tru64 but not HP-UX).
Note that on some systems (e.g., Mac OS X), you might have to set your
"status" character as it defaults, on those systems, to "not set".
Get rid of the reference to "traffic(1C)" (it's not referred to in the
man page, and about the only connection it has with tcpdump is that they
both watch network traffic; traffic(1C) is a SunOS 4.x-ism, not present
on other platforms), and add a reference to pfconfig(8) for
Digital/Tru64 (it *is* referred to, in the section of what privileges
you need in order to capture traffic).
The first critical piece of code is found in print-isakmp.c:332. The
function rawprint() does not check its arguments thus it's easy for
an attacker to pass a big 'len' or a bogus 'loc' leading to a
segmentation fault in the for loop.
The second bug is located in print-radius.c:471. The for loop of
print_attr_string() is written in an unsafe manner. 'length'
and 'data' should be checked.
hannes [Mon, 29 Dec 2003 09:19:38 +0000 (09:19 +0000)]
- handle the case where we know the ethertype but do not have a printer for it
the loopback protocol is a good example:
the patch prints at least the ethertype plus the length
rather than a empty line
hannes [Tue, 23 Dec 2003 22:07:56 +0000 (22:07 +0000)]
add support for the ATTR SET attribute per draft-marques-ppvpn-ibgp
TODO boundary and recursion check
add reference (draft-marques-ppvpn-rt-constrain)
to the Route Target Information SAFI
hannes [Mon, 22 Dec 2003 19:41:51 +0000 (19:41 +0000)]
- initial checkin for OSI CLNP support
(TODO header sanity and lots of boundary checking)
- verify NLPID for ES-IS
- remove bogon TLV #1 from ES-IS printer
hannes [Sat, 20 Dec 2003 22:24:51 +0000 (22:24 +0000)]
rework the print_esis() printer
update option processing
add ES-IS ESH printing
change the IS-IS related TLV #defines into ISIS_TLV_
change the IS-IS related SUBTLV #defines into ISIS_SUBTLV_
guy [Thu, 27 Nov 2003 02:18:53 +0000 (02:18 +0000)]
Print the subtype of management frames *before* parsing the body, so
that if there's an error parsing the body, we at least see the type (and
so that the code to print the subtype isn't duplicated in every
body-printing routine).
hannes [Wed, 26 Nov 2003 08:49:14 +0000 (08:49 +0000)]
-rework the radius decoder for a decent multiline output
-add print_vendor_attr() for dissecting vendor proprietary attributes
-add global oui.h oui.c files containing vendor IDs/Name tok2str() table
developers should use this file for resolving OUIs
guy [Mon, 24 Nov 2003 20:30:51 +0000 (20:30 +0000)]
135 appears to be the current IP protocol number for mobility headers;
support it, as well as 62 (which presumably was one that was used
before, even though it was already assigned to some protocol named
CFTP).
The change adds left- and right-shift (<< and >>) to the list of
binary operators on the tcpdump man page. E.g. "tcp[12] >> 4 > 5" will
test for TCP options. The operators are listed in the '93 Usenix paper,
and appear to have been supported in libpcap since the 0.0 release.
guy [Wed, 19 Nov 2003 09:44:10 +0000 (09:44 +0000)]
Don't check for the OSPF opaque traffic engineering TLV type before
processing the TLV - there might not be any TLVs. Instead, check before
fetching the type.
guy [Wed, 19 Nov 2003 09:42:04 +0000 (09:42 +0000)]
Add missing bounds checking to the DVMRP and PIM print routines.
Instead of checking that there are 8 bytes available at the beginning of
an IGMP packet - which there might not be, e.g. with some DVMRP packets
- do the checks as necessary before fetching values.
guy [Wed, 19 Nov 2003 01:27:54 +0000 (01:27 +0000)]
"icmp6_rrenum_print()" doesn't use its "icmp6len" argument (and, as that
just reflects the payload length, the snapshot length has been trimmed
to correspond to it, so it doesn't need to check it merely to avoid
running past the end of the IPv6 payload); get rid of it.
Pass "icmp6_print()" the IPv6 payload length (i.e., the length of the
ICMPv6 packet), rather than having it compre the length itself.
Make the length argument to "icmp6_cksum()" unsigned, to match the value
passed to it.
Fix the lengths passed to "sctp_print()", "tcp_print()", and
"udp_print()" (we update "len" in the header-processing loop to
correspond to the remaining payload, so we just pass it to those
routines).
guy [Wed, 19 Nov 2003 01:09:48 +0000 (01:09 +0000)]
Put in a long comment explaining what's confusing about this routine,
and explaining that we leave the "unused argument" warning in place as a
reminder that we need to fix this routine someday, when we actually have
a capture against which to test it.
guy [Wed, 19 Nov 2003 00:17:32 +0000 (00:17 +0000)]
Cut off "snapend" at the length of the IPv4 or IPv6 payload, so we don't
run past the end of that payload.
Check that the IPv4 total length isn't less than the header length.
Use "%u", not "%d", to print unsigned values.
Properly update "len" in the header-processing loop for IPv6.
Doing so means we can trust the length passed to the TCP and UDP
dissectors when constructing the IPv6 pseudo-header; do so (but fix the
length we pass to the UDP-over-IPv6 checksum routine).
That length is unsigned; make the corresponding arguments to the TCP and
UDP checksum routines unsigned.
guy [Tue, 18 Nov 2003 23:09:42 +0000 (23:09 +0000)]
Print both the name and the description of a link-layer type (the name
isn't always very suggestive - for example, somebody might think
"EN10MB" is always 10 MB/s, and might not know that "IEEE802" is Token
Ring), using "pcap_datalink_val_to_description()". Supply our own
"pcap_datalink_val_to_description()" if libpcap doesn't have it (even if
it has "pcap_datalink_name_to_val()").
guy [Sun, 16 Nov 2003 09:42:39 +0000 (09:42 +0000)]
Have the configure script arrange that the Makefile define _U_
appropriately, and that GNUmakefile and the MSVC++ project file define
it apppriately, as we do with libpcap, rather than defining it in
"interface.h".
Undo the rcsid-shuffling and addition of extra #includes, as we no
longer need to arrange that "interface.h" be included before using _U_
in an RCS ID or copyright.
guy [Sun, 16 Nov 2003 09:36:07 +0000 (09:36 +0000)]
Have the configure script arrange that the Makefile define _U_
appropriately, and that GNUmakefile and the MSVC++ project file define
it apppriately, as we do with libpcap, rather than defining it in
"interface.h".
Undo the rcsid-shuffling and addition of extra #includes, as we no
longer need to arrange that "interface.h" be included before using _U_
in an RCS ID or copyright.