]> The Tcpdump Group git mirrors - tcpdump/log
tcpdump
11 years agoprint-ppp: variable 'length' is updated and the new value is never used 373/head
Francois-Xavier Le Bail [Fri, 7 Mar 2014 09:39:46 +0000 (10:39 +0100)] 
print-ppp: variable 'length' is updated and the new value is never used

11 years agoNDOize IP mobile, MSDP and NULL decoders
Denis Ovsienko [Thu, 6 Mar 2014 16:41:44 +0000 (20:41 +0400)] 
NDOize IP mobile, MSDP and NULL decoders

11 years agoVRRP: top off the previous change
Denis Ovsienko [Wed, 5 Mar 2014 22:48:55 +0000 (02:48 +0400)] 
VRRP: top off the previous change

Update the test cases and squelch a compiler warning.

11 years agoAdd support for VRRPv3 (IPv4 only).
Angus Cameron [Sun, 16 Feb 2014 09:08:39 +0000 (20:08 +1100)] 
Add support for VRRPv3 (IPv4 only).

11 years agoVRRP: add a sample capture and two test cases
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".

11 years agoFix commit 833425ab: babel uses 1/100th of seconds, not 1/10th
Baptiste Jonglez [Tue, 4 Mar 2014 17:02:34 +0000 (18:02 +0100)] 
Fix commit 833425ab: babel uses 1/100th of seconds, not 1/10th

Also update affected testcases.

11 years agoZMTP: fix an MSVC compiler warning
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.

11 years agoUse a common style for all option parsers.
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.

11 years agoPrint some PPP CCP options; taken from issue #214, with changes.
Guy Harris [Tue, 4 Mar 2014 22:23:57 +0000 (14:23 -0800)] 
Print some PPP CCP options; taken from issue #214, with changes.

Report the CCP protocol type as CCP.

Decode options for BSD, MRVCA, and DEFLATE compression.

Add some explanatory comments, and add some length checks, while we're
at it.

11 years agoissues/286: get rid of Useless "no IPv4 address assigned" warning
Michael Richardson [Tue, 4 Mar 2014 14:04:45 +0000 (14:04 +0000)] 
issues/286: get rid of Useless "no IPv4 address assigned" warning

11 years agoNDOize HSRP, IGRP and UDLD decoders
Denis Ovsienko [Tue, 4 Mar 2014 09:55:24 +0000 (13:55 +0400)] 
NDOize HSRP, IGRP and UDLD decoders

11 years agoremove unused print-netbios.c
Denis Ovsienko [Tue, 4 Mar 2014 09:25:16 +0000 (13:25 +0400)] 
remove unused print-netbios.c

The file had no purpose as the draft code in it wasn't compiled.

11 years agoupdate Gisle's e-mail address per his request
Denis Ovsienko [Fri, 28 Feb 2014 18:06:22 +0000 (22:06 +0400)] 
update Gisle's e-mail address per his request

11 years agoTravis script: set silent operation for make 370/head
fxlb [Fri, 28 Feb 2014 15:56:05 +0000 (16:56 +0100)] 
Travis script: set silent operation for make

This change allows to see better the possible warnings

11 years agoNDOize CIP, IPComp and IPFC decoders
Denis Ovsienko [Fri, 28 Feb 2014 09:42:37 +0000 (13:42 +0400)] 
NDOize CIP, IPComp and IPFC decoders

Also remove some unneeded includes while at it.

11 years agodon't include pcap.h needlessly
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

11 years agoTravis script: refactor env section 369/head
fxlb [Fri, 28 Feb 2014 12:48:49 +0000 (13:48 +0100)] 
Travis script: refactor env section

11 years agoAsk for more warnings during a Travis CI build 368/head
fxlb [Fri, 28 Feb 2014 11:44:47 +0000 (12:44 +0100)] 
Ask for more warnings during a Travis CI build

.travis.yml: add 'touch .devel configure'

11 years agoNDOize AH, BEEP and DTP decoders
Denis Ovsienko [Thu, 27 Feb 2014 11:13:43 +0000 (15:13 +0400)] 
NDOize AH, BEEP and DTP decoders

Also remove some unnecessary passages.

11 years agorevert the latest change
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.

11 years agorequest more warnings during a Travis build
Denis Ovsienko [Wed, 26 Feb 2014 12:39:15 +0000 (16:39 +0400)] 
request more warnings during a Travis build

11 years agodismiss decode_prefix.h
Denis Ovsienko [Wed, 26 Feb 2014 12:38:53 +0000 (16:38 +0400)] 
dismiss decode_prefix.h

The only purpose of that header file was to provide two declarations
that now fit interface.h same well.

11 years agorefine the previous change
Denis Ovsienko [Wed, 26 Feb 2014 12:15:28 +0000 (16:15 +0400)] 
refine the previous change

This time eliminate a few instances of the code initializing struct tok
with negative values and squelch the warnings like below:

warning: initializer will be sign-extended: -1

11 years agobase struct tok on unsigned rather than signed int
Denis Ovsienko [Wed, 26 Feb 2014 10:49:56 +0000 (14:49 +0400)] 
base struct tok on unsigned rather than signed int

This resolves a few Solaris-specific warnings emitted by
/opt/solarisstudio12.3/bin/cc like below:

warning: initializer does not fit or is out of range: 0xffffffff

(also happened for 0x80000000)

11 years agoNFS: unify TCP and UDP decoding, fix a bug
Denis Ovsienko [Wed, 26 Feb 2014 10:14:06 +0000 (14:14 +0400)] 
NFS: unify TCP and UDP decoding, fix a bug

Change the UDP NFS printing format to match the current format of TCP
NFS printing (this complements commits f3051bc and 29d83db).

Update the man page to use the new format (this complements commit
2c86c75).

Restore printing of NFS packet length, which was broken in commit
68fe98a.

11 years agoCARP: NDOize
Denis Ovsienko [Tue, 25 Feb 2014 14:23:45 +0000 (18:23 +0400)] 
CARP: NDOize

11 years agodon't include addrtoname.h needlessly
Denis Ovsienko [Tue, 25 Feb 2014 13:53:08 +0000 (17:53 +0400)] 
don't include addrtoname.h needlessly

11 years agoDo a bunch more length checking.
Guy Harris [Sun, 16 Feb 2014 22:39:57 +0000 (14:39 -0800)] 
Do a bunch more length checking.

Make sure we don't run past the end of the packet or, when processing
the packet header, run past the end of the header.

11 years agomake OpenSSL-specific tests conditional
Denis Ovsienko [Sun, 16 Feb 2014 20:22:37 +0000 (00:22 +0400)] 
make OpenSSL-specific tests conditional

11 years agoMerge pull request #366 from fxlb/dccpv6
Guy Harris [Sun, 16 Feb 2014 19:53:19 +0000 (11:53 -0800)] 
Merge pull request #366 from fxlb/dccpv6

fix partial checksum errors in DCCP decoder, IPv6 case

11 years agofix partial checksum errors in DCCP decoder, IPv6 case 366/head
Francois-Xavier Le Bail [Sun, 16 Feb 2014 17:29:37 +0000 (18:29 +0100)] 
fix partial checksum errors in DCCP decoder, IPv6 case

11 years agoMerge git://github.com/the-tcpdump-group/tcpdump
Guy Harris [Sun, 16 Feb 2014 10:28:04 +0000 (02:28 -0800)] 
Merge git://github.com/the-tcpdump-group/tcpdump

11 years agoMerge pull request #364 from fxlb/dccp
Guy Harris [Sun, 16 Feb 2014 10:27:30 +0000 (02:27 -0800)] 
Merge pull request #364 from fxlb/dccp

DCCP tests: more verbosity (from -v to -vv)

11 years agoFetch the sequence number the way we fetch the acknowledgment number.
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.

11 years agoUse an 8-octet array when the ACK field is always 8 octets.
Guy Harris [Sun, 16 Feb 2014 09:42:30 +0000 (01:42 -0800)] 
Use an 8-octet array when the ACK field is always 8 octets.

Get rid of "struct dccp_hdr_ack_bits" while we're at it.

11 years agoGet rid of unused function.
Guy Harris [Sun, 16 Feb 2014 09:20:48 +0000 (01:20 -0800)] 
Get rid of unused function.

11 years agoDCCP tests: more verbosity (from -v to -vv) 364/head
Francois-Xavier Le Bail [Sun, 16 Feb 2014 08:46:57 +0000 (09:46 +0100)] 
DCCP tests: more verbosity (from -v to -vv)

11 years agoAdd {40,48,56}-bit big-endian extract macros and use them for DCCP ACKs.
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.

11 years agoMark structures with UNALIGNED.
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.

11 years agoMerge pull request #363 from fxlb/master
Guy Harris [Sat, 15 Feb 2014 19:43:53 +0000 (11:43 -0800)] 
Merge pull request #363 from fxlb/master

fix partial checksum errors in DCCP decoder, IPv4 case

11 years agofix partial checksum errors in DCCP decoder, IPv4 case 363/head
Francois-Xavier Le Bail [Sat, 15 Feb 2014 11:32:44 +0000 (12:32 +0100)] 
fix partial checksum errors in DCCP decoder, IPv4 case

11 years agoonly include udp.h when necessary
Denis Ovsienko [Tue, 11 Feb 2014 05:32:17 +0000 (09:32 +0400)] 
only include udp.h when necessary

11 years agoprint-pptp: add a missing break
Denis Ovsienko [Mon, 10 Feb 2014 13:23:58 +0000 (17:23 +0400)] 
print-pptp: add a missing break

11 years agoprint-pptp: pptp_result_code_print(): badly placed break 360/head
Francois-Xavier Le Bail [Mon, 10 Feb 2014 12:43:14 +0000 (13:43 +0100)] 
print-pptp: pptp_result_code_print(): badly placed break

11 years agoRRCP: remove extra return
Denis Ovsienko [Mon, 10 Feb 2014 10:19:04 +0000 (14:19 +0400)] 
RRCP: remove extra return

11 years agoprint-mobile: mobile_print(): variable 'cp' is assigned a value that is never used 359/head
fxlb [Wed, 5 Feb 2014 21:08:58 +0000 (22:08 +0100)] 
print-mobile: mobile_print(): variable 'cp' is assigned a value that is never used

11 years agoprint-forces: print_metailv(): unused parameter 'len'
fxlb [Wed, 5 Feb 2014 20:35:04 +0000 (21:35 +0100)] 
print-forces: print_metailv(): unused parameter 'len'

11 years agoprint-802_11: cleanup handle_deauth()
fxlb [Wed, 5 Feb 2014 20:08:41 +0000 (21:08 +0100)] 
print-802_11: cleanup handle_deauth()

- variable 'offset' is assigned a value that is never used
- parameter 'length' is updated and the new value is never used

11 years agoprint-icmp6: remove useless break
fxlb [Wed, 5 Feb 2014 13:42:25 +0000 (14:42 +0100)] 
print-icmp6: remove useless break

11 years agoClean up the TLV processing loop.
Guy Harris [Mon, 3 Feb 2014 10:14:24 +0000 (02:14 -0800)] 
Clean up the TLV processing loop.

We want to process TLVs until we run out of data, so make the main loop
condition "length > 0".  Break out of the loop if we see an
NFULA_PAYLOAD TLV.

Add in a bunch of length checks, and make those and existing length
checks report "[|nflog]".

11 years agoWith -A and -AA, don't send CRs to the standard output.
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 ".".

11 years agoUse the new libpcap <pcap/nflog.h> for NFLOG definitions and declarations.
Guy Harris [Mon, 3 Feb 2014 04:14:26 +0000 (20:14 -0800)] 
Use the new libpcap <pcap/nflog.h> for NFLOG definitions and declarations.

Use the header file for information about LINKTYPE_NFLOG files.

Don't build the NFLOG printer if we don't have that header file.

Fix some checks for pcap/XXX.h header files to look for
"tcpdump-stdinc.h" rather than <tcpdump-stdinc.h>, so that we don't fail
to find that header.

11 years agoDo our own isascii(), isprint(), isgraph(), and toascii().
Guy Harris [Sun, 2 Feb 2014 23:17:06 +0000 (15:17 -0800)] 
Do our own isascii(), isprint(), isgraph(), and toascii().

We do *not* want the behavior of isprint() and isgraph() to be
locale-dependent - we want both of them to return "true" only for ASCII
characters.

We have to do our own isascii() and toascii() on non-UN*X systems
anyway, so let's just do all of them ourselves.

11 years agoDon't assume snprintf() returns the number of characters formatted.
Guy Harris [Sun, 2 Feb 2014 23:02:33 +0000 (15:02 -0800)] 
Don't assume snprintf() returns the number of characters formatted.

On some UN*Xes (such as some versions of HP-UX), it doesn't.

11 years agoFix a compiler warning.
Guy Harris [Sat, 1 Feb 2014 22:08:25 +0000 (14:08 -0800)] 
Fix a compiler warning.

It's not necessarily safe to do pre-increment or post-increment in an
argument to an EXTRACT_ macro.

11 years agoDon't use the __attribute__((packed)) on most platforms.
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.

11 years agoNot all OSes have a diff that supports "diff -u".
Guy Harris [Fri, 31 Jan 2014 02:49:56 +0000 (18:49 -0800)] 
Not all OSes have a diff that supports "diff -u".

11 years agojustify some syntax in Travis spec
Denis Ovsienko [Wed, 29 Jan 2014 11:40:32 +0000 (15:40 +0400)] 
justify some syntax in Travis spec

11 years agomissing/inet_ntop.c fix (GH #358)
Gisle Vanem [Fri, 24 Jan 2014 15:14:11 +0000 (19:14 +0400)] 
missing/inet_ntop.c fix (GH #358)

The extra 'return (NULL)' is dead code.

11 years agofix more Solaris testing issues
Denis Ovsienko [Mon, 20 Jan 2014 13:27:18 +0000 (17:27 +0400)] 
fix more Solaris testing issues

echo doesn't support "-n"
grep doesn't support "-q" and "-e"

11 years agothe bugfix missing from the previous commit
Denis Ovsienko [Mon, 20 Jan 2014 12:06:50 +0000 (16:06 +0400)] 
the bugfix missing from the previous commit

11 years agofix some shell mistakes after a Solaris run
Denis Ovsienko [Mon, 20 Jan 2014 12:03:50 +0000 (16:03 +0400)] 
fix some shell mistakes after a Solaris run

It worked on Linux and FreeBSD but OpenCSW build produced the following:

./lmp-v.sh: !: not found
./TESTrun.sh: local: not found
./TESTrun.sh: test: unknown operator ==

11 years agoLMPv1: make the "-v" test GCC-specific (GH #333)
Denis Ovsienko [Mon, 20 Jan 2014 11:38:08 +0000 (15:38 +0400)] 
LMPv1: make the "-v" test GCC-specific (GH #333)

11 years agotest scripts overhaul
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.

11 years agoThe interval in an AODV HELLO extension is not aligned on a 4-byte boundary.
Guy Harris [Mon, 20 Jan 2014 03:19:22 +0000 (19:19 -0800)] 
The interval in an AODV HELLO extension is not aligned on a 4-byte boundary.

11 years agoAs with memcpy, so with memcmp.
Guy Harris [Sat, 18 Jan 2014 20:42:15 +0000 (12:42 -0800)] 
As with memcpy, so with memcmp.

11 years agoMore UNALIGNED_MEM{CPY,CMP} on IP addresses.
Guy Harris [Sat, 18 Jan 2014 20:13:57 +0000 (12:13 -0800)] 
More UNALIGNED_MEM{CPY,CMP} on IP addresses.

11 years agoAnother case where UNALIGNED_MEMCPY() is probably necessary.
Guy Harris [Sat, 18 Jan 2014 20:09:45 +0000 (12:09 -0800)] 
Another case where UNALIGNED_MEMCPY() is probably necessary.

It was necessary in other cases where we copied IP addresses from the IP
header, so it's probably necessary here as well.

11 years agoNo need for casting back and forth.
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.

11 years agoFix typo.
Guy Harris [Sat, 18 Jan 2014 19:57:45 +0000 (11:57 -0800)] 
Fix typo.

11 years agoOnly do the unaligned_mem{cpy,cmp} hack if necessary.
Guy Harris [Sat, 18 Jan 2014 01:51:04 +0000 (17:51 -0800)] 
Only do the unaligned_mem{cpy,cmp} hack if necessary.

If the processor does unaligned accesses, it's not necessary.

11 years agoNo need to declare unaligned_mem{cpy,cmp} in netdissect.h *and* interface.h.
Guy Harris [Sat, 18 Jan 2014 01:37:24 +0000 (17:37 -0800)] 
No need to declare unaligned_mem{cpy,cmp} in netdissect.h *and* interface.h.

11 years agoMore possibly-unaligned memcpy()s and assignments - use unaligned_memcpy().
Guy Harris [Sat, 18 Jan 2014 01:24:23 +0000 (17:24 -0800)] 
More possibly-unaligned memcpy()s and assignments - use unaligned_memcpy().

11 years agoCheck for compiling for IPv6; don't check whether we can create an IPv6 socket.
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.

11 years agoWe don't use missing/sockstorage.h, so get rid of it.
Guy Harris [Fri, 17 Jan 2014 20:52:22 +0000 (12:52 -0800)] 
We don't use missing/sockstorage.h, so get rid of it.

11 years agoWe're not using struct sockaddr_storage any more, so don't check for it.
Guy Harris [Fri, 17 Jan 2014 20:49:49 +0000 (12:49 -0800)] 
We're not using struct sockaddr_storage any more, so don't check for it.

11 years agoRework the SA list code.
Guy Harris [Fri, 17 Jan 2014 20:48:18 +0000 (12:48 -0800)] 
Rework the SA list code.

This simplifies the code, gets rid of some type-punning about which GCC
warns, and reduces the size of the list entries.

11 years agoWe no longer use struct sockaddr_storage, so we don't need to define it.
Guy Harris [Fri, 17 Jan 2014 20:38:29 +0000 (12:38 -0800)] 
We no longer use struct sockaddr_storage, so we don't need to define it.

11 years agoMerge branch 'master' of git+ssh://bpf.tcpdump.org/tcpdump/master/git/tcpdump
Guy Harris [Fri, 17 Jan 2014 20:33:45 +0000 (12:33 -0800)] 
Merge branch 'master' of git+ssh://bpf.tcpdump.org/tcpdump/master/git/tcpdump

Again, it's necessary because Git seems to think it's necessary.

11 years agoWe don't use PACKED, so get rid of it.
Guy Harris [Fri, 17 Jan 2014 20:33:29 +0000 (12:33 -0800)] 
We don't use PACKED, so get rid of it.

11 years agoclean LIBNETDISSECT_SRC definition up
Denis Ovsienko [Fri, 17 Jan 2014 07:51:30 +0000 (11:51 +0400)] 
clean LIBNETDISSECT_SRC definition up

Use one file per line syntax and sort the files by name.

11 years agoUse unaligned_memcmp() to compare with IPv{4,6} addresses in a packet.
Guy Harris [Fri, 17 Jan 2014 01:25:05 +0000 (17:25 -0800)] 
Use unaligned_memcmp() to compare with IPv{4,6} addresses in a packet.

They are, after all, not guaranteed to be aligned.

11 years agoUse EXTRACT_nBITS even when just testing against zero.
Guy Harris [Fri, 17 Jan 2014 00:48:46 +0000 (16:48 -0800)] 
Use EXTRACT_nBITS even when just testing against zero.

*All* references to possibly-unaligned multi-byte fields have to be done
in an unaligned-safe fashion.

11 years agoUse AC_CHECK_TOOL to find ar.
Guy Harris [Thu, 16 Jan 2014 22:40:46 +0000 (14:40 -0800)] 
Use AC_CHECK_TOOL to find ar.

On some platforms, such as at least some versions of HP-UX, AR isn't
automatically set by make.

11 years agoAnother length check, also found by the Clang Static Analyzer.
Guy Harris [Thu, 16 Jan 2014 21:12:06 +0000 (13:12 -0800)] 
Another length check, also found by the Clang Static Analyzer.

11 years agoAdd some length checks for byte-escaped PPP.
Guy Harris [Thu, 16 Jan 2014 21:09:40 +0000 (13:09 -0800)] 
Add some length checks for byte-escaped PPP.

Thanks and a tip of the Hatlo hat to the Clang Static Analyzer for
catching these.

11 years agoFix some more unaligned accesses.
Guy Harris [Thu, 16 Jan 2014 20:09:51 +0000 (12:09 -0800)] 
Fix some more unaligned accesses.

11 years agoRework the cookie cache.
Guy Harris [Thu, 16 Jan 2014 19:59:17 +0000 (11:59 -0800)] 
Rework the cookie cache.

This simplifies the code, gets rid of some type-punning about which GCC
warns, and reduces the size of the cache entries.

11 years agoMerge git://github.com/the-tcpdump-group/tcpdump
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.

11 years agoMerge pull request #356 from msekletar/master
Guy Harris [Thu, 16 Jan 2014 19:14:34 +0000 (11:14 -0800)] 
Merge pull request #356 from msekletar/master

print-forces: remove unused variable

11 years agoprint-forces: remove unused variable 356/head
Michal Sekletar [Thu, 16 Jan 2014 13:42:06 +0000 (14:42 +0100)] 
print-forces: remove unused variable

11 years agomemcmp() doesn't modify either of its arguments.
Guy Harris [Thu, 16 Jan 2014 07:03:31 +0000 (23:03 -0800)] 
memcmp() doesn't modify either of its arguments.

11 years agoRevert print-tcp memcpy() changes, and use unaligned_memcpy() instead.
Guy Harris [Thu, 16 Jan 2014 03:08:07 +0000 (19:08 -0800)] 
Revert print-tcp memcpy() changes, and use unaligned_memcpy() instead.

That should prevent optimizing the memcpy into code that assumes
alignment.

Add unaligned_memcmp(), and use it, as well.

11 years agoGet rid of form feed in source.
Guy Harris [Thu, 16 Jan 2014 02:23:51 +0000 (18:23 -0800)] 
Get rid of form feed in source.

11 years agoMove safememcpy() to util.c so it doesn't get inlined.
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.

11 years agoFix a bug the previous change made a bit more obvious.
Guy Harris [Thu, 16 Jan 2014 01:45:19 +0000 (17:45 -0800)] 
Fix a bug the previous change made a bit more obvious.

11 years agoDon't use a u_int16_t * to extract data from packets.
Guy Harris [Thu, 16 Jan 2014 01:44:02 +0000 (17:44 -0800)] 
Don't use a u_int16_t * to extract data from packets.

That convinces some compilers that the data is 16-bit aligned, but
there's no such guarantee of alignment.

11 years agoAdd changes for 4.5.1 and post-4.5.1 changes.
Guy Harris [Wed, 15 Jan 2014 22:46:17 +0000 (14:46 -0800)] 
Add changes for 4.5.1 and post-4.5.1 changes.

11 years agoPoint to IP addresses with "void *"s.
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.

11 years agoMark the TCP header structure as unaligned.
Guy Harris [Wed, 15 Jan 2014 22:32:39 +0000 (14:32 -0800)] 
Mark the TCP header structure as unaligned.