Denis Ovsienko [Wed, 5 Mar 2014 22:31:25 +0000 (02:31 +0400)]
VRRP: add a sample capture and two test cases
The sample capture consists of VRRPv2/IPv4, VRRPv3/IPv4 and VRRPv3/IPv6
packets. It was produced using 7 MikroTik devices running RouterOS 6.10
and configured for the same set of virtual addresses with different
priorities per device. The devices were powered on one after another
with a ~30 seconds delay in the order of VRRP priority ascending. The
test cases decode the capture with and without "-v".
Gisle Vanem [Wed, 5 Mar 2014 09:19:24 +0000 (13:19 +0400)]
ZMTP: fix an MSVC compiler warning
The prototype and implementation of 'zmtp1_print_datagram()' is slightly
different; the prototype has a 'const u_int len' as the last parameter.
Whereas the implementation has no 'const'. Hence I get a warning from
MSVC.
Guy Harris [Tue, 4 Mar 2014 23:15:09 +0000 (15:15 -0800)]
Use a common style for all option parsers.
Report "length bogus, should be ..." for invalid lengths for all
options. That's not a fatal error - the next option can be parsed - so
don't return 0 in that case.
Don't put a colon after the option length unless there's something
following it.
Do the TCHECKs for particular CCP options in the code to handle the
option, as is done elsewhere.
Print the values for the CCP options on the same line, as is done
elsewhere.
Denis Ovsienko [Fri, 28 Feb 2014 09:10:28 +0000 (13:10 +0400)]
don't include pcap.h needlessly
Both interface.h and netdissect.h include <pcap.h>, thus most files
should not include it regardless if these need it or not. The only
exceptions so far remain:
* addrtoname.c
* missing/datalinks.c
* missing/dlnames.c
* tcpdump.c
Denis Ovsienko [Wed, 26 Feb 2014 14:16:53 +0000 (18:16 +0400)]
revert the latest change
./configure fails during the "BUILD_LIBPCAP=true BUILD_IPV6=true"
scenarios (both GCC and Clang):
Makefile:8411: warning: overriding commands for target `configure'
Makefile:455: warning: ignoring old commands for target `configure'
Makefile:8416: warning: overriding commands for target `stamp-h.in'
Makefile:460: warning: ignoring old commands for target `stamp-h.in'
Makefile:8421: warning: overriding commands for target `stamp-h'
Makefile:465: warning: ignoring old commands for target `stamp-h'
Makefile:8424: warning: overriding commands for target `Makefile'
Makefile:468: warning: ignoring old commands for target `Makefile'
Makefile:8427: warning: overriding commands for target `config.status'
Makefile:471: warning: ignoring old commands for target `config.status'
[...]
./config.status: line 1103: syntax error near unexpected token `done'
./config.status: line 1103: `done # for ac_tag'
I don't have the expertise to resolve it well right now, keep Travis CI
working meanwihle.
Guy Harris [Sun, 16 Feb 2014 10:21:28 +0000 (02:21 -0800)]
Fetch the sequence number the way we fetch the acknowledgment number.
Fetch 24 bits if the X bit isn't set, 48 bits if it is, using the
appropriate EXTRACT_ macros.
We do this with "struct dccp_hdr" being a header structure with a 24-bit
sequence number and "struct dccp_hdr_ext" being a header structure with
a 48-bit sequence number.
Guy Harris [Sun, 16 Feb 2014 04:37:28 +0000 (20:37 -0800)]
Add {40,48,56}-bit big-endian extract macros and use them for DCCP ACKs.
Add macros to, given an octet pointer, extract 40-bit, 48-bit, and
56-bit big-endian numbers from the location pointed to by that pointer,
and use them when extracting ACK numbers from DCCP packets. This fixes
problems on big-endian(!) machines.
Guy Harris [Sun, 16 Feb 2014 04:01:06 +0000 (20:01 -0800)]
Mark structures with UNALIGNED.
Maybe this will fix the crashes that appear to be occurring on the
opencsw.org buildbot; it's building with Sun/Oracle C, not GCC, but it's
at least worth a try.
Guy Harris [Mon, 3 Feb 2014 08:01:56 +0000 (00:01 -0800)]
With -A and -AA, don't send CRs to the standard output.
They don't belong on the ends of lines on UN*X, and the standard I/O
library will give us one at the end of the line on Windows so they're
not needed there. In the middle of a line, just print a ".".
Guy Harris [Sat, 1 Feb 2014 22:02:17 +0000 (14:02 -0800)]
Don't use the __attribute__((packed)) on most platforms.
It won't necessarily work with non-GCC-compatible compilers, so use it
only on GCC-compatible compilers.
Even with some GCC-compatible compilers (such as, err, umm, GCC), it
doesn't do the right thing on some platforms, e.g. 64-bit SPARC, where
the compiler generates code that assumes alignment even when using it.
The only platforms I know of where an unaligned big-endian load can be
done better than by loading bytes and shifting-and-ORing them together
are MIPS and possibly Alpha, so only do it there.
Denis Ovsienko [Mon, 20 Jan 2014 11:26:06 +0000 (15:26 +0400)]
test scripts overhaul
Rewrite TESTonce to do only one thing (run a test with given parameters)
but do it well. Split TESTrun.sh into functions and extend it to do only
a specific test if requested. Justify format of the test results and
move most of the test results printing from TESTrun.sh to TESTonce.
Guy Harris [Sat, 18 Jan 2014 20:06:36 +0000 (12:06 -0800)]
No need for casting back and forth.
That might also convince the compiler that it can "helpfully" optimize
the copy into something that assumes 4-byte alignment, which we don't
want it to do on platforms where the optimized code will trap if the IP
header *isn't* aligned on a 4-byte boundary, given that there's no
guarantee that it *is* aligned on a 4-byte boundary.
Guy Harris [Fri, 17 Jan 2014 22:08:39 +0000 (14:08 -0800)]
Check for compiling for IPv6; don't check whether we can create an IPv6 socket.
Don't check whether we can create a TCP-over-IPv6 socket; that appears
to fail in some cases where tcpdump can be built with IPv6 support.
Instead, just check whether AF_INET6 and struct in6_addr are defined.
Guy Harris [Thu, 16 Jan 2014 19:14:49 +0000 (11:14 -0800)]
Merge git://github.com/the-tcpdump-group/tcpdump
"Please enter a commit message to explain why this merge is necessary" -
because Git appears to think it is, for some reason, otherwise it
wouldn't have told me to enter that message.
Guy Harris [Thu, 16 Jan 2014 02:12:06 +0000 (18:12 -0800)]
Move safememcpy() to util.c so it doesn't get inlined.
It appears that some C compilers will inline safememcpy() *and* will, as
a result, optimize to assume alignment it if it's passed a
putatively-aligned pointer. As the pointers in question are not
guaranteed to be aligned, that can cause crashes on, for example, SPARC.
Also, rename the function to unaligned_memcpy(), to clarify what's
"safe" about it, and change some direct memcpy() calls to use it as
well.
Guy Harris [Wed, 15 Jan 2014 22:40:52 +0000 (14:40 -0800)]
Point to IP addresses with "void *"s.
This keeps GCC from assuming the IP addresses are aligned and generating
32-bit load/store pairs on SPARC; those require alignment and cause
tcpdump to crash.