Guy Harris [Fri, 2 May 2014 06:20:21 +0000 (23:20 -0700)]
Sort options and put in notes for unusable option letters.
Sort the options alphabetically, and put in comments for the options
we're *currently* not using, to note that other versions of tcpdump use
them and that we should only use them for the same purposes.
Guy Harris [Fri, 2 May 2014 02:50:19 +0000 (19:50 -0700)]
Don't assume the Perl interpreter is in /usr/bin/perl.
It's not necessarily there on all platforms. Explicitly invoke the
interpreter to run the TESTonce script; that requires that, when you run
"make check", your path includes the directory in which the Perl
interpreter resides.
Guy Harris [Fri, 2 May 2014 02:48:10 +0000 (19:48 -0700)]
Split the OSPFv3 header and bodies into separate structures.
Some compilers appear to put some padding before the ospf6_un union, so
the OSPFv3 packets aren't dissected correctly. Pull the members of
that union into separate structures, and find the pointer to the OSPFv6
body by adding the header length to the pointer to the beginning of the
header.
Gisle Vanem [Thu, 1 May 2014 10:39:17 +0000 (14:39 +0400)]
fix missing/inet_ntop.c again
All tests that should print IPv6-addresses failed since 'INET6' wasn't
set when my missing/inet_ntop.c was compiled. Due to "config.h" was not
included.
Also got rid of 2 warnings:
Missing/inet_ntop.c:146:23: warning: 'cur.len' may be used
uninitialized in this function [-Wmaybe-uninitialized]
The tests also failed since the inet_ntop_v6() was returning hex-chars
in upper-case. So this patch returns string in lower-case.
Guy Harris [Wed, 30 Apr 2014 22:28:06 +0000 (15:28 -0700)]
Use getopt_long().
This requires us to check for it in the configure script and to include
a version of getopt_long() for the benefit of platforms that don't have
it; we pick up the FreeBSD version and tweak it a bit (eliminating some
features specific to the BSD version of getopt_long(), as we want to use
it only in a fashion portable to Linux/*BSD/Solaris/etc.)
We also get rid of the version of getopt() we supply for Windows in
favor of the version of getopt_long() we provide.
Guy Harris [Wed, 23 Apr 2014 17:56:20 +0000 (10:56 -0700)]
We still need u_intN_t.
Some libpcap headers use them, and even if we change libpcap to use
uintN_t, we don't require that tcpdump 4.x go with libpcap 1.x - we
allow people to install the latest tcpdump even if they have an older
libpcap and don't want to install a newer one.
However, we now define them in terms of the C99 uintN_t types, rather
than trying to guess what's appropriate; using unsigned long long for
u_int64_t meant that, on some platforms, u_int64_t didn't match
PRI[doux]64, and using unsigned long obviously won't work on ILP32
platforms.
Also, we already had calls to the autoconf macros for C99 types; get rid
of the ones we added.
Also also, clean up a comment in tcpdump-stdinc.h.
Guy Harris [Wed, 23 Apr 2014 07:20:40 +0000 (00:20 -0700)]
u_intN_t is dead, long live uintN_t.
And, as we require at least autoconf 2.61, and as autoconf 2.61 and
later have AC_TYPE_UINTn_T and AC_TYPE_INTn_T macros, we use them to
define the uintN_t and intN_t macros if the system doesn't define them
for us.
Guy Harris [Mon, 21 Apr 2014 21:02:29 +0000 (14:02 -0700)]
Shorten sizeof to u_int, to match the %u format used with it.
On LP64 and LLP64 platforms, sizeof returns a 64-bit value, which is
larger than an int or unsigned int, so if you add the result of sizeof
to a value shorter than 64 bits, you can't print the result with %u.
As an M3UA parameter header is much shorter than 2^32 bytes, we can
safely just cast sizeof(struct m3ua_param_header) to u_int.
Merge m3ua.h into the only file that includes it (print-m3ua.c). Make
M3UA functions follow naming pattern, constify some of their arguments
and switch to ND_PRINT(). Make use of tok2str() and ternary conditional.
Eliminate declarations in the middle of code (C89).
Vyacheslav Trushkin [Fri, 22 Nov 2013 09:28:37 +0000 (16:28 +0700)]
M3UA support added (GH #342)
SCTP's payload protocol identifiers added.
M3UA tests provided by wireshark
http://wiki.wireshark.org/SampleCaptures#Sigtran_Protocol_Family
But RFC4666 tells that parameter 0x0002 aren't carried by M3UA, so
it's OK that tcpdump doesn't know about this identifier.
-----------------------------------------------------------------------
The change to sctp_print() does three things:
* makes detection of ForCES consider PPID, not just port number
* verifies chunk length of all SCTP_DATA chunks, not just of ForCES
* adds PPID-specific dispatching with a particular case of M3UA
Guy Harris [Sat, 19 Apr 2014 02:09:49 +0000 (19:09 -0700)]
When parsing information elements, check for the full length beforehand.
When parsing information elements, first check to make sure we have the
element ID and length, and fetch the length; then check to make sure we
have the entire element, including the information. Remove those checks
from the handlers for individual elements.
This squelches a Coverity warning (when we check to make sure the length
remaining in the packet is enough for the element ID; the element ID is
one byte, and the loop continues as long as the length is non-zero, so
that's always true in the loop), and simplifies some other code.
Also check for the right length for fixed-length elements while we're at
it.
Guy Harris [Sat, 19 Apr 2014 00:53:01 +0000 (17:53 -0700)]
The item_len argument to ikev1_id_print() *is* used.
So don't mark it as unused; that *might* be what's causing Coverity to
think that sizeof(struct ikev1_pl_id) is always < item_len and thus that
the "data" variable can never be null.
- add a 'Verify Coverity Scan run condition' step to avoid multiple runs with
Travis matrix.
- add a 'Verify Coverity Scan script test mode' step. if true no uploading, to
avoid reaching the quota. usual processing: false.
- send 'description' as VERSION#SHA (e.g.: 4.6.0-PRE-GIT#c661f8b)
Guy Harris [Sun, 30 Mar 2014 19:45:18 +0000 (12:45 -0700)]
Fix some unsafe print calls.
The format argument to a printf-like routine should either be a constant
string or a variable *known* to point to a format string. It should not
be an arbitrary string you're trying to print - if that string contains
% characters, they will be interpreted as part of a format
specification, which can cause crashes (e.g., "%s", if what appears to
be an argument corresponding to that %s, when interpreted as a pointer,
doesn't point to a valid string) or other incorrect behavior.
If you want to print a string, use "%s" as the format and the string as
the argument.