Denis Ovsienko [Thu, 27 Aug 2020 12:48:08 +0000 (13:48 +0100)]
RADIUS: Fixup the previous commit.
Use GET_ macros and C99 uint types. Use nd_printn() to print RADIUS
strings, which are not NUL-terminated (see RFC 2865 page 25). Use
p_ntp_time() to print NTP timestamps. In print_attr_location_data() print
the Location field as hex and add a comment to explain why. In
print_basic_location_policy_rules() display any non-zero MBZ bits in the
Flags field. Make output format more consistent. Update the test case.
Denis Ovsienko [Wed, 12 Aug 2020 23:59:44 +0000 (00:59 +0100)]
Rx: Make UDP ports 16-bit to compile (GH #868).
Gisle Vanem reported that GCC 7.1 for DJGPP sees u_int and uint32_t as
two different types, hence the forward declaration for rx_cache_find()
was different from the actual function. UDP port numbers are 16-bit and
udp_print() appropriately uses uint16_t for them. Use the same type in
the downstream Rx-specific code to make things simpler and consistent.
Denis Ovsienko [Fri, 7 Aug 2020 18:00:06 +0000 (19:00 +0100)]
DHCP: Make option printing format more consistent.
rfc1048_print() used to print DHCP options in a few different formats
depending on the context (see GH issue #866):
* at the top of an RFC 1048 block:
* known options: [string] name and [decimal] tag
* unknown options: tag twice
* inside a Parameter Request (55) block:
* known options: name
* unknown options: tag
Change it to use the "Name (tag)" format (as in TCP, BGP, etc) in all
contexts. Update output for 8 tests.
Denis Ovsienko [Fri, 7 Aug 2020 17:21:51 +0000 (18:21 +0100)]
DHCP: Remove a few options that are unassigned now.
Commit e89bfcd in December 2000 among other things had introduced
the following code points from the IANA "BOOTP Vendor Extensions and
DHCP Options" registry:
The current revision of the registry lists every code above as
"Removed/Unassigned" with a reference to RFC 3679 published in January
2004. Remove the code points and any associated code.
Francois-Xavier Le Bail [Thu, 6 Aug 2020 17:12:49 +0000 (19:12 +0200)]
Apply the last step of the new way to update the link-layer header length
All the link-layer dissectors are now void functions.
All the functions were moved to the void_printers[] array.
Rename this array to printers[].
Remove the uint_printers[] array, now empty.
Remove the 'ndo_void_printer' flag field, now useless, from
netdissect_options.
Remove other transitional code.
Francois-Xavier Le Bail [Wed, 5 Aug 2020 20:15:45 +0000 (22:15 +0200)]
Remove the unused DLT_LANE8023 link-layer dissector
DLT_LANE8023 was never defined in libpcap.
It was, perhaps, defined in some SuSE libpcap update, but no evidence
of this.
It is not defined in OpenSuSE Leap 15.2 (information from Guy).
Guy Harris [Mon, 20 Jul 2020 03:12:32 +0000 (20:12 -0700)]
autoconf: replace --with-system-libpcap with --disable-local-libpcap.
--with-system-libpcap didn't work - it didn't prevent searching for a
local libpcap - and had a misleading name. Replace it with
--disable-local-libpcap.
This should address a warning with some AppVeyor builds (VS 16 2019):
warning C4061: enumerator 'PT_UNKNOWN' in switch of enum
'mpls_packet_type' is not explicitly handled by a case label
Update ether_print(), ether_common_print() and ether_switch_tag_print()
to void functions.
Add a flag parameter to ether_print(), ether_common_print() and
ether_switch_tag_print() to increment the link-layer header length field
of the netdissect_options when needed.
The calls use TRUE when the return value of the funtions was used.
The calls with FALSE avoid increments when the calls are nested.
Moreover:
Remove trailing "_if" from some protocol names.
This change avoids:
print-rsvp.c:1205:40: runtime error: implicit conversion from type 'int'
of value -8 (32-bit, signed) to type 'unsigned int' changed the value
to 4294967288 (32-bit, unsigned)
#0 0x848e20f in rsvp_obj_print ./print-rsvp.c:1205:40
IEEE 802.11: Fix signedness of the flags parameters of print_chaninfo()
uint32_t for flags, because there are calls with uint16_t and uint32_t.
This change avoids (for presentflags):
print-802_11.c:2795:41: runtime error: implicit conversion from type
'uint32_t' (aka 'unsigned int') of value 2147502191 (32-bit, unsigned)
to type 'int' changed the value to -2147465105 (32-bit, signed)
#0 0x815e130 in print_radiotap_field ./print-802_11.c:2795:41
Moses Devadason [Sun, 28 Jun 2020 05:37:54 +0000 (11:07 +0530)]
LLDP 8021 link aggregation TLV support
As per IEEE std 802.1-AB-2009, 802.3 link aggregation TLV has been
deprecated and link aggregation TLV has been added as an 802.1
TLV. Support for this is given.
Guy Harris [Mon, 15 Jun 2020 00:49:44 +0000 (17:49 -0700)]
TESTrun: add definitions of true and false.
If we don't give them definitions, in some contents they are interpreted
as strings, and 'false', being a non-empty string, is interpreted as
being true. See, for example:
Guy Harris [Sun, 14 Jun 2020 20:45:44 +0000 (13:45 -0700)]
TESTrun: fix copy-and-pasteo.
(Matters only on Windows, and we're still not ready for the check target
to be used on Windows yet; for one thing, it requires that tcpdump be
built with the latest shiniest libpcap, to handle some capture files
that use post-1.9 LINKTYPE_ values, and we aren't yet set up to do
that.)
Guy Harris [Sun, 14 Jun 2020 03:25:31 +0000 (20:25 -0700)]
TESTrun: canonicalize the path of the standard error file.
DEC's decisions and the Multics developers' decisions affect us to this
day. (Unix went with the Multics use of - to indicate options; DOS went
with the DEC use of / to indicate options, so they had to use \ as the
pathname component separator, and Windows followed suit, so here we
are.)
Guy Harris [Sat, 13 Jun 2020 21:14:32 +0000 (14:14 -0700)]
TESTrun: always return a value from runtest().
Falling off the end isn't reported as an issue by the Perl interpreter
here, and doesn't appear to cause a reliable return value, so not all
failed tests are counted.
Guy Harris [Sat, 13 Jun 2020 07:08:49 +0000 (00:08 -0700)]
TESTrun: clean up printing of files.
Many Windows commands only accept paths using backslashes, because
slashes are option separators.
Add a showfile() function that takes a pathname as an argument and:
on Windows, converts the pathname to canonical form - which
means any slashes will be converted to backslashes - and run
"type" on it;
on UN*X, run "cat" on it.
Convert
cat foo | diff bar -
to
diff bar foo
to avoid using cat at all. (Note also that the closest built-in Windows
equivalent of diff, fc, does *not* support reading the standard input as
one of the files to compare, so it also will avoid that when we change
those to use fc on Windows.)
The one remaining use of cat is in a command with pathnames, so use a
type command, with backslash-separated paths, on Windows, and cat, with
slash-separated paths, on UN*X.
We might just want to do that directly in Perl; add a comment about
that.
Francois-Xavier Le Bail [Wed, 10 Jun 2020 10:13:53 +0000 (12:13 +0200)]
DNS: Do the 'over TCP' processing in the printer
Add the parameter 'over_tcp'.
Move the shift by 2 bytes from the TCP printer to the DNS printer.
Move adding a prepended space from the TCP printer to the DNS printer.
Add a length check.
Add some comments about 'over_tcp' and 'is_mdns' call values.
Guy Harris [Fri, 5 Jun 2020 23:34:57 +0000 (16:34 -0700)]
appveyor: add VS 2019 tests.
VS 2019 is different from earlier versions of VS in the way it handles
the target platform; handle that in the fashion that much bashing on
libpcap's .appveyor.yml got to work.
Francois-Xavier Le Bail [Fri, 29 May 2020 21:41:45 +0000 (23:41 +0200)]
PTP: Declare 'static' some variables
Fix warnings given by '-Wmissing-variable-declarations':
./print-ptp.c:262:13: warning: no previous extern declaration for
non-static variable 'p_porigin_ts' [-Wmissing-variable-declarations]
const char *p_porigin_ts = "preciseOriginTimeStamp";
^
./print-ptp.c:262:7: note: declare 'static' if the variable is not
intended to be used outside of this translation unit
const char *p_porigin_ts = "preciseOriginTimeStamp";
^
./print-ptp.c:263:13: warning: no previous extern declaration for
non-static variable 'p_origin_ts' [-Wmissing-variable-declarations]
const char *p_origin_ts = "originTimeStamp";
^
./print-ptp.c:263:7: note: declare 'static' if the variable is not
intended to be used outside of this translation unit
const char *p_origin_ts = "originTimeStamp";
^
./print-ptp.c:264:13: warning: no previous extern declaration for
non-static variable 'p_recv_ts' [-Wmissing-variable-declarations]
const char *p_recv_ts = "receiveTimeStamp";
^
./print-ptp.c:264:7: note: declare 'static' if the variable is not
intended to be used outside of this translation unit
const char *p_recv_ts = "receiveTimeStamp";
Moreover:
Put a function definition name at the beginning of the line.
Guy Harris [Thu, 28 May 2020 23:01:54 +0000 (16:01 -0700)]
macsec: include <config.h>, not "config.h".
That fixes some cases where having an in-tree build and an out-of-tree
build (e.g., an in-tree autotools build and an out-of-tree CMake build)
gets the wrong config.h file.
Guy Harris [Thu, 28 May 2020 19:50:39 +0000 (12:50 -0700)]
macsec, ether: clean up printing of encrypted and changed packets.
If the packet is encrypted or changed, so that we just print the payload
as raw data, and we're not running with -e, print the MAC addresses (if
any) and an indication that it's an 802.11AE packet, followed by the
MACsec header.