Commit Graph

4797 Commits

Author SHA1 Message Date
Ulrich Windl
d42caa3128 Improve CONTRIBUTING (sample.pcap)
Improve "6) Add/update sample.pcap files" in CONTRIBUTING, clarifying the
options to use.
2017-09-28 08:44:17 +02:00
Denis Ovsienko
53686d12ea Spell "the tcpdump group" consistently. 2017-09-26 09:18:00 +01:00
Denis Ovsienko
0bc9b44dfa RADIUS: Fix some issues in print_attr_netmask6().
This is a follow-up to commit e606750 (RFC 3162).

Move the bounds check before the code that reads from the input buffer,
make the IPv6 address temporary buffer right-sized, add a test and a
diagnostic message for the prefix length.
2017-09-24 14:14:38 +01:00
Herwin Weststrate
3cd5403c8f Added RADIUS attribute from RFC 4818
Delegated-IPv6-Prefix (123)
2017-09-22 11:46:27 +02:00
Herwin Weststrate
d9241d621c Added RADIUS attributes from RFC 5090
Digest-Response (103)
Digest-Realm (104)
Digest-Nonce (105)
Digest-Response-Auth (106)
Digest-Nextnonce (107)
Digest-Method (108)
Digest-URI (109)
Digest-Qop (110)
Digest-Algorithm (111)
Digest-Entity-Body-Hash (112)
Digest-CNonce (113)
Digest-Nonce-Count (114)
Digest-Username (115)
Digest-Opaque (116)
Digest-Auth-Param (117)
Digest-AKA-Auts (118)
Digest-Domain (119)
Digest-Stale (120)
Digest-HA1 (121)
SIP-AOR (122)
2017-09-22 11:46:27 +02:00
Herwin Weststrate
e105384b80 Added RADIUS attribute from RFC 4072
EAP-Key-Name (102)
2017-09-22 11:46:26 +02:00
Herwin Weststrate
866dbf0803 Added RADIUS attribute from RFC5176/RFC5580
Error Cause (101)
2017-09-22 11:46:26 +02:00
Herwin Weststrate
e606750e59 Added RADIUS attributes from RFC3162
NAS IPv6 Address (95)
Framed Interface ID (96)
Framed IPv6 Prefix (97)
Login IPv6 Host (98)
Framed IPv6 Route (99)
Framed IPv6 Pool (100)

Added new functions to print ipv6 address and netmask, added unit test to test those.
2017-09-22 11:46:26 +02:00
Guy Harris
893b1b1cfb Make the delta between 1970 and 1900 a 64-bit signed integral constant.
It doesn't fit in a 32-bit signed integral constant, so make sure it's
64-bit; the only use is to subtract it from a 64-bit signed integral
value.
2017-09-21 10:05:33 -07:00
Guy Harris
eff1d12656 Allow -C arguments > 2^31-1 GB if they can fit into a long.
Use strtol() to get the size, as it's a long.

Make sure the argument is > 0; negative values, and 0, are invalid.

Make sure it won't overflow a long when it's multiplied by 1000000.

Note in a comment that this doesn't yet handle those arguments if they
can't fit into a long; that would require a new API in libpcap.

This should fix GitHub issue #488, at least on platforms where a long is
large enough (64-bit UN*Xes) and where files > 2^31 GB are supported.
2017-09-21 09:48:19 -07:00
Francois-Xavier Le Bail
42208e6a24 Remove useless #if 1 2017-09-21 12:04:49 +02:00
Denis Ovsienko
578d116b24 NTP: Add more test files by Ulrich Windl.
Put the new tests at the bottom of the list together with the existing
NTP tests to match the not yet merged work by Ulrich better.
2017-09-21 10:36:01 +01:00
Francois-Xavier Le Bail
bc61fc8f73 Rename a test 2017-09-21 10:39:18 +02:00
Guy Harris
bfeb9275e7 Fix function definition to match declaration.
It's declared as static, so define it as static.
2017-09-20 21:09:34 -07:00
Guy Harris
0aa9e5a417 Fix handling of NTP time stamps.
The seconds value in a 64-bit NTP timestamp is unsigned.  Treat it as
such.

When converting it to a UN*X seconds-since-the-Epoch, cast the 32-bit
seconds value from an NTP timestap to a 64-bit signed value (which is
always possible), and then subtract the signed delta between 1900 and
1970, giving a signed seconds-since-the-Epoch value.

Then assign that to a time_t; if that variable doesn't have the same
value as the calculated 64-bit value, we can't represent it in a time_t,
so just report it as unrepresentable.

Otherwise, use that resulting value in a gmtime() call - and make sure
gmtime() doesn't return NULL, which it can do with some versions of the
Microsoft C runtime.  If it does, report the time as unrepresentable,
otherwise report it as YYYY-MM-DDTHH:MM:SS.

This fixes the 32-bit vs. 64-bit issue for tests.

It also changes the test output, so update that.
2017-09-20 19:17:22 -07:00
Guy Harris
40bcb22217 Don't use -q, just send the standard output to /dev/null.
The default *grep in Solaris is *NOT* SUSv3-compliant, and doesn't
support -q; you have to use the one in /usr/xpg4/bin for that one.

Just use egrep (to make sure we support alternation, which we use),
don't pass it -q, and send its output to /dev/null, as we don't need to
see it.
2017-09-20 18:12:51 -07:00
Guy Harris
050d41a163 Use grep, not egrep.
If there's a performance difference between them, it probably won't make
a difference here, and the Single UNIX Specification does include grep,
and says it has to support -q, but doesn't mention egrep.  See if this
eliminates a complaint from the OpenCSW buildbot.
2017-09-20 17:51:54 -07:00
Guy Harris
6e7ccf0ecd Merge branch 'master' of github.com:the-tcpdump-group/tcpdump 2017-09-20 17:07:45 -07:00
Guy Harris
b972c2dfb6 Don't test ntp.pcap with a 32-bit tcpdump.
A 32-bit tcpdump probably has a signed 32-bit time_t (it might not, on,
for example, newer versions of NetBSD).  Some time stamps in ntp.pcap
fall after the Y2.038K deadline, and get misreported if they don't fit
in 31 bits (the topmost bit is a sign bit).
2017-09-20 17:02:50 -07:00
Francois-Xavier Le Bail
48abded133 Fix a comment 2017-09-20 20:45:37 +02:00
Francois-Xavier Le Bail
7871b86d08 Compile with '-Wassign-enum' in devel mode if supported 2017-09-20 20:41:25 +02:00
Guy Harris
56f5180267 Actually, the UNALIGNED might not be necessary. 2017-09-20 11:20:36 -07:00
Francois-Xavier Le Bail
0b1bccb50d Better 'make check' output in case of failed test(s) 2017-09-20 18:42:58 +02:00
Denis Ovsienko
11a7aeda39 NTP: Run one test with -v and another without. 2017-09-20 14:45:24 +01:00
Denis Ovsienko
4d42441161 NTP: Remove some duplicate output.
In ntp_time_print() do not print the information already printed in
ntp_print(): mode, leap indicator, version (all part of the Status
header field) and length. Update the test case.
2017-09-20 14:40:18 +01:00
Guy Harris
c7b0738460 Try marking structures as UNALIGNED.
See if this fixes the crashes on the OpenCSW SPARC buildbots.  If so, it
means that the compiler may think that even structures made up of
nothing but bytes (char/unsigned char) and arrays of bytes are aligned,
even if there's no guarantee of that.

(Bad compiler!  No biscuit!)
2017-09-20 01:37:35 -07:00
Denis Ovsienko
4dafda3fbb NTP: Update the test output after the last commit. 2017-09-19 16:08:12 +01:00
Miroslav Lichvar
fdd0cf43a6 Add NTP test. 2017-09-19 15:43:41 +01:00
Mitsunori Komatsu
4def3a4c8d Fix typo "tcp-act" in manpage 2017-09-19 15:41:42 +01:00
Guy Harris
f0475768c0 Make most constants unsigned, to match the types of variables.
This should squelch some warnings.
2017-09-18 10:01:01 -07:00
Denis Ovsienko
7ea6b55ab4 ICMP: Make a few cppcheck-inspired fixups.
[print-icmp.c:402]: (warning) %d in format string (no. 2) requires 'int'
but the argument type is 'unsigned int'.
[print-icmp.c:560]: (style) The scope of the variable 'sum' can be
reduced.
[print-icmp.c:560]: (style) The scope of the variable 'icmp_sum' can be
reduced.
[print-icmp.c:509]: (warning) %d in format string (no. 1) requires 'int'
but the argument type is 'unsigned int'.
[print-icmp.c:517]: (warning) %d in format string (no. 1) requires 'int'
but the argument type is 'unsigned int'.
2017-09-15 17:12:34 +01:00
Denis Ovsienko
34367df6ab IS-IS: Update a reference.
draft-ietf-isis-traffic-05 became RFC 3784 (Informational), which was
later republished as RFC 5305 (Standards Track). As far as I could tell
from the diffs, the changes between those documents do not require
changes to the decoder (which does not cover 100% of the specification,
but that is another story).
2017-09-15 16:00:05 +01:00
Denis Ovsienko
01275098ee Add missing parentheses to macro definitions.
This does not fix a known bug but prevents a possible bug in future
because without the parentheses an expression like "2 * NODE_ID_LEN"
looks differently from how it actually works. Drop some unnecessary
parentheses in the source code.
2017-09-15 15:38:16 +01:00
Denis Ovsienko
7dd7b7e187 HNCP: Declare some variables as uint8_t.
u_char and uint8_t are the same type, just use uint8_t for some variables
and leave some no-op type casting out.
2017-09-15 11:57:50 +01:00
Guy Harris
14c81f0a4a Clean up the stuff we do to get <inttypes.h> stuff defined.
If we have a libpcap with <pcap/pcap-inttypes.h>, include it, so that we
don't have to worry about definitions colliding if we later include a
pcap header file that includes pcap/pcap-inttypes.h.

Otherwise, do the same stuff pcap-inttypes.h does.  This means that, on
UN*X, we require that there be an <inttypes.h> that defines everything
we need.

Don't bother doing checks that are no longer necessary as a result of
those changes.
2017-09-14 18:53:34 -07:00
Guy Harris
cd246d166d Clean up the crud supporting passed/failed count global variables as files.
Fetch the values from the files at the end of runComplexTests, rather
than at the beginning of runSimpleTests - they're already set to 0 if
you haven't run runComplexTests.

Set the variables to 0 right before writing their values to the files,
just to make it clearer that they're both being initialized to 0.

Read the files unconditionally in tests/crypto.sh, as we do tests
regardless of whether we were built with libcrypto or not.
2017-09-14 18:21:45 -07:00
Guy Harris
b09a65ece6 This is an array of 16 character values, not a C character string.
Don't initialize it with a string, so no compiler whinges about there
being no room for a null terminator.
2017-09-14 11:59:38 -07:00
Andrew Lunn
9a18f084be Print EIGRP when carried in IPv6
The EIGRP protocol can be carried in IPv4 or IPv6. The basic protocol
remains the same. So call the EIGRP dissector for IPv6 packets with
IPPROTO_EIGRP.
2017-09-14 19:50:40 +01:00
Denis Ovsienko
17f0687292 HNCP: There is no bug, update the comments. 2017-09-13 20:46:47 +01:00
Denis Ovsienko
94420af69d CFM: Fix a few typos. 2017-09-13 14:06:47 +01:00
Denis Ovsienko
66c434bac2 BGP: Fix a typo. 2017-09-13 14:03:58 +01:00
Denis Ovsienko
46b3d82855 RPKI-Router: Remove an unused macro. 2017-09-13 14:03:53 +01:00
Denis Ovsienko
75dd033651 RSVP: Update a reference. 2017-09-13 13:56:59 +01:00
Denis Ovsienko
c43351c021 RSVP: Fix some spelling. 2017-09-13 13:44:58 +01:00
Denis Ovsienko
1a2d21409f Remove a duplicate #define. 2017-09-13 13:36:55 +01:00
Denis Ovsienko
413840cf18 Don't specify struct as "const" within sizeof().
The only difference the const qualifier makes in this context is visual,
make it consistent with the rest of the source code.
2017-09-13 13:33:02 +01:00
Denis Ovsienko
e5ab6e7001 Complete the 4.9.2 section in CHANGES. 2017-09-13 12:25:44 +01:00
Francois-Xavier Le Bail
05acc48c54 Rx: Fix alignment issue on Solaris 10 SPARC
Fix the 'Segmentation fault' issue with the 'rx_ubik-oobr' test in
'rx_cache_insert' function with the method described in commit 1376682.
2017-09-13 12:25:44 +01:00
Guy Harris
8dca25d26c CVE-2017-13690/IKEv2: Fix some bounds checks.
Use a pointer of the correct type in ND_TCHECK(), or use ND_TCHECK2()
and provide the correct length.

While we're at it, remove the blank line between some checks and the
UNALIGNED_MEMCPY()s they protect.

Also, note the places where we print the entire payload.

This fixes a buffer over-read discovered by Bhargava Shastry,
SecT/TU Berlin.

Add a test using the capture file supplied by the reporter(s).
2017-09-13 12:25:44 +01:00
Guy Harris
061e7371a9 CVE-2017-13689/IKEv1: Fix addr+subnet length check.
An IPv6 address plus subnet mask is 32 bytes, not 20 bytes.
16 bytes of IPv6 address, 16 bytes of subnet mask.

This fixes a buffer over-read discovered by Bhargava Shastry,
SecT/TU Berlin.

Add a test using the capture file supplied by the reporter(s).
2017-09-13 12:25:44 +01:00