Francois-Xavier Le Bail [Mon, 18 Mar 2019 21:51:44 +0000 (22:51 +0100)]
PPP: Fix two loops for undefined behavior at runtime
The errors were:
print-ppp.c:518:9: runtime error: unsigned integer overflow: 38 - 230
cannot be represented in type 'unsigned int'
print-ppp.c:1138:63: runtime error: unsigned integer overflow: 204 - 220
cannot be represented in type 'unsigned int'
Francois-Xavier Le Bail [Sun, 17 Mar 2019 20:23:07 +0000 (21:23 +0100)]
NFS: Fix an undefined behavior at runtime
The error was:
print-nfs.c:537:2: runtime error: unsigned integer overflow: 4294967295 + 3 cannot be represented in type 'unsigned int'
print-nfs.c:541:14: runtime error: unsigned integer overflow: 4294967295 + 3 cannot be represented in type 'unsigned int'
Francois-Xavier Le Bail [Sat, 16 Mar 2019 16:25:19 +0000 (17:25 +0100)]
BRCMTAG: Fix some warnings
The warnings were:
no previous extern declaration for non-static variable 'brcm_tag_te_values'
[-Wmissing-variable-declarations]
no previous extern declaration for non-static variable 'brcm_tag_rc_values'
[-Wmissing-variable-declarations]
Loganaden Velvindron [Sat, 16 Mar 2019 11:31:26 +0000 (15:31 +0400)]
ICMPv6: Add the IPv6-Only flag
This flag in defined in a draft which is close to getting published as
an IETF RFC: https://tools.ietf.org/html/draft-ietf-6man-ipv6only-flag-05.
Florian Fainelli [Sat, 26 Jan 2019 00:58:42 +0000 (16:58 -0800)]
Add Broadcom tags tests
Add 3 tests to test that we can properly dissect Broadcom tags. Two are
for DSA_TAG_BRCM where the tag is between Ethernet MAC SA and
Type/Length and one for DSA_TAG_BRCM_PREPEND where the tag is
encapsulating the Ethernet frame (thus requires -e to be shown).
Florian Fainelli [Fri, 18 Jan 2019 23:24:33 +0000 (15:24 -0800)]
Add support for decoding Broadcom Ethernet switches tags
This adds support for decoding the Broadcom Ethernet switches tags which
are are 4byte in length and are located between the Ethernet MAC SA and
the Type/Length field (DSA_TAG_BRCM) as well as the pre-pended Broadcom
tag (DSA_TAG_BRCM_PREPEND) which are located in front of the standard
Ethernet header.
This makes use of the recently introduced ether_print_hdr_len() to allow
specifying the non-standard Ethernet header length of 12 + 4 + 2 bytes.
A fair number of proprietary Ethernet switch tagging protocols, such as
Broadcom tags for instance, will place their tag between the MAC SA and
the Type/Length field.
Move the body of ether_print() into ether_print_hdr_len() and specify
the Ethernet header length as an argument to that function.
ether_print() calls ether_print_hdr_len() with a standard Ethernet
header lenght of 14 bytes, while other callers could specify an
arbitrary length. We still assume that the first Length/Type field to
parse is located 2 bytes before the end of that Ethernet header length.
This will be used in a subsequent commit to parse Broadcom tags.
Andrea Ieri [Sun, 16 Dec 2018 12:13:58 +0000 (13:13 +0100)]
Amend the documentation about the use of the -C -G and -W switches.
When using all three switches (-C -G and -W), the behavior is
practically identical to only using -C and -G, as the -W flag will only
affect the filename suffix.
Guy Harris [Tue, 11 Dec 2018 07:16:45 +0000 (23:16 -0800)]
Add, and use, macros to do locale-independent case mapping.
This means we get the same behavior in Turkish locales (where, if we
aren't in the C locale, we might get lower-case "i" mapped to upper-case
"I with dot" and upper-case "I" mapped to lower-case "i without dot),
and may also suppress some shortening warnings from MSVC.
We may just want to suppress the warning, as in "trust us, we know what
we're doing", although it'd be nice if the format string passed to those
functions could be checked to make sure it is one that takes exactly one
integer argument.
Guy Harris [Tue, 11 Dec 2018 05:53:58 +0000 (21:53 -0800)]
Try to squelch a warning about non-constant format strings.
Declare the format-string argument to tok2strbuf(), tok2str(),
bittok2str(), and bittok2str_nosep() as such, to see whether that gets
MSVC not to complain - or if it just gets upset because there's no "..."
argument list for it.
Guy Harris [Tue, 11 Dec 2018 04:14:57 +0000 (20:14 -0800)]
Squelch a warning.
We're returning the calculated checksum result modulo 65536, given that
Internet checksums are 16-bit; throw in a cast to let MSVC know that
this is intended.
Guy Harris [Wed, 21 Nov 2018 23:09:39 +0000 (15:09 -0800)]
Change tests/hoobr_bfd_print.pcap to test the BFD printer again.
Clamp the on-the-wire length values of the packets at 262144, so that we
hand the packets to the BFD printer, rather than just bailing out before
we ever get there.
The sanity check in print.c/pretty_print_packet() function, packet length
(length) >= capture length (caplen), apply when the ether_print()
function is called by ether_if_print(), netanalyzer_if_print() or
netanalyzer_transparent_if_print().
But the ether_print() function is called in some other cases, thus not
sure length always >= caplen.
Guy Harris [Tue, 13 Nov 2018 06:03:49 +0000 (22:03 -0800)]
Fix printing of Linux cooked captures with monitor-mode packets.
Apparently, if you have an interface in monitor mode, capturing on the
"any" device can get packets that have a SLL hatype of 803, which is the
ARPHRD_ value for radiotap, and with the payload containing a radiotap
header, followed by an 802.11 header, followed by the 802.11 payload.
Handle that.
Francois-Xavier Le Bail [Sun, 11 Nov 2018 20:39:25 +0000 (21:39 +0100)]
DCCP: Fix some undefined behaviors at runtime
The errors were like:
print-dccp.c:448:4: runtime error: unsigned integer overflow: 20 - 24
cannot be represented in type 'unsigned int'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior print-dccp.c:448:4
Guy Harris [Fri, 9 Nov 2018 20:00:59 +0000 (12:00 -0800)]
Require sys/capsicum.h to use Capsicum.
My PC-BSD 9.1 VM, at least, has sys/capability.h but not sys/capsicum.h;
we now use sys/capsicum.h, so require it to be present (which it is in
FreeBSD 10 and later).
Guy Harris [Fri, 9 Nov 2018 19:33:55 +0000 (11:33 -0800)]
Require sys/capsicum.h to use Capsicum.
My PC-BSD 9.1 VM, at least, has sys/capability.h but not sys/capsicum.h;
we now use sys/capsicum.h, so require it to be present (which it is in
FreeBSD 10 and later).