]> The Tcpdump Group git mirrors - tcpdump/log
tcpdump
4 years agoRADIUS: Fixup the previous commit. 706/head
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.

4 years agoRADIUS: Add attributes from RFC5580. (GH #706)
Herwin Weststrate [Tue, 2 Oct 2018 18:17:42 +0000 (20:17 +0200)] 
RADIUS: Add attributes from RFC5580. (GH #706)

4 years agoRename min() and max() to ND_MIN() and ND_MAX(). [skip ci]
Denis Ovsienko [Mon, 24 Aug 2020 20:53:58 +0000 (21:53 +0100)] 
Rename min() and max() to ND_MIN() and ND_MAX(). [skip ci]

As discussed on tcpdump-workers, it was a place for a potential clash
with non-macros.

4 years agoFixup some letter case in the man page. [skip ci]
Denis Ovsienko [Sat, 22 Aug 2020 00:49:57 +0000 (01:49 +0100)] 
Fixup some letter case in the man page. [skip ci]

4 years agoCirrus CI: Allow FreeBSD 13 task to fail.
Denis Ovsienko [Fri, 21 Aug 2020 17:27:02 +0000 (18:27 +0100)] 
Cirrus CI: Allow FreeBSD 13 task to fail.

Implement the workaround suggested in cirruslabs/cirrus-ci-docs#695.

[skip ci]

4 years agoCirrus CI: Align with Travis CI config more.
Denis Ovsienko [Wed, 19 Aug 2020 00:40:03 +0000 (01:40 +0100)] 
Cirrus CI: Align with Travis CI config more.

Define MAKEFLAGS, move comments to the end of respective lines, run
"make install" and "make releasetar".

[skip ci]

4 years agoRemove an inexistant URL
Francois-Xavier Le Bail [Mon, 19 Aug 2019 14:06:10 +0000 (16:06 +0200)] 
Remove an inexistant URL

4 years agoBGP: Address a -Wformat-truncation= compiler warning
Francois-Xavier Le Bail [Fri, 14 Aug 2020 15:22:15 +0000 (17:22 +0200)] 
BGP: Address a -Wformat-truncation= compiler warning

The warning was:
./print-bgp.c: In function 'bgp_vpn_rd_print':
./print-bgp.c:797:65: warning: '%u' directive output may be truncated
writing between 1 and 3 bytes into a region of size between 2 and 31
[-Wformat-truncation=]
  797 |         snprintf(pos, sizeof(rd) - (pos - rd), "%s:%u (%u.%u.%u.%u:%u)",
      |                                                                 ^~
./print-bgp.c:797:48: note: directive argument in the range [0, 255]
  797 |         snprintf(pos, sizeof(rd) - (pos - rd), "%s:%u (%u.%u.%u.%u:%u)",
      |                                                ^~~~~~~~~~~~~~~~~~~~~~~~
./print-bgp.c:797:48: note: directive argument in the range [0, 65535]
./print-bgp.c:797:9: note: 'snprintf' output between 15 and 50 bytes
into a destination of size 41
  797 |         snprintf(pos, sizeof(rd) - (pos - rd), "%s:%u (%u.%u.%u.%u:%u)",
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  798 |                     as_printf(ndo, astostr, sizeof(astostr), GET_BE_U_4(pptr + 2)),
      |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  799 |                     GET_BE_U_2(pptr + 6), GET_U_1(pptr + 2),
      |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  800 |                     GET_U_1(pptr + 3), GET_U_1(pptr + 4),
      |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  801 |                     GET_U_1(pptr + 5), GET_BE_U_2(pptr + 6));
      |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

4 years agoRx: Make UDP ports 16-bit to compile (GH #868).
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.

4 years agoFix a typo
Francois-Xavier Le Bail [Mon, 10 Aug 2020 18:36:46 +0000 (20:36 +0200)] 
Fix a typo

4 years agoIEEE 802.15.4: Use GET_U_1() to replace direct dereferences
Francois-Xavier Le Bail [Mon, 10 Aug 2020 15:59:55 +0000 (17:59 +0200)] 
IEEE 802.15.4: Use GET_U_1() to replace direct dereferences

This need adding 'netdissect_options *ndo' parameter to
ieee802_15_4_crc16() and ieee802_15_4_crc32().

4 years agoDNS: Use GET_U_1() to replace a direct dereference
Francois-Xavier Le Bail [Mon, 10 Aug 2020 15:46:09 +0000 (17:46 +0200)] 
DNS: Use GET_U_1() to replace a direct dereference

4 years agoRESP: Use GET_U_1() to replace direct dereferences
Francois-Xavier Le Bail [Mon, 10 Aug 2020 15:03:59 +0000 (17:03 +0200)] 
RESP: Use GET_U_1() to replace direct dereferences

Moreover:
Fix spaces

4 years agomacsec: Update the outputs of two tests
Francois-Xavier Le Bail [Mon, 10 Aug 2020 11:54:50 +0000 (13:54 +0200)] 
macsec: Update the outputs of two tests

This is a follow-up to 69a76fb67a36a19779142d07bb0cb31b7736a936.

4 years agomacsec: Update ndo_protocol to lower case as in all other uses
Francois-Xavier Le Bail [Mon, 10 Aug 2020 09:14:50 +0000 (11:14 +0200)] 
macsec: Update ndo_protocol to lower case as in all other uses

4 years agoUpdate the man page for "-d", "-i" and "-y".
Denis Ovsienko [Mon, 10 Aug 2020 11:04:51 +0000 (12:04 +0100)] 
Update the man page for "-d", "-i" and "-y".

Describe the changes in behaviour after commit 74e6075, which implements
the discussion made in GH #804.

[skip ci]

4 years agoFix spaces
Francois-Xavier Le Bail [Sat, 8 Aug 2020 12:55:23 +0000 (14:55 +0200)] 
Fix spaces

4 years agoRename DLT_PPP_WITHDIRECTION to DLT_PPP_PPPD
Francois-Xavier Le Bail [Sat, 8 Aug 2020 12:45:10 +0000 (14:45 +0200)] 
Rename DLT_PPP_WITHDIRECTION to DLT_PPP_PPPD

In libpcap DLT_PPP_WITHDIRECTION was renamed to
DLT_LINUX_PPP_WITHDIRECTION and after to DLT_PPP_PPPD.

Rename other #defines to match.

4 years agoSRv6: Add a test output without '-e'
Francois-Xavier Le Bail [Fri, 7 Aug 2020 16:19:34 +0000 (18:19 +0200)] 
SRv6: Add a test output without '-e'

This is a follow-up to commit 1103418a18d71c0fe448c0459a42ff1bc20bb0dc.

4 years agoDHCP: Make option printing format more 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.

4 years agoDHCP: Remove a few options that are unassigned now.
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:

* TAG_AGENT_MASK (84)
* TAG_6OVER4 (96)
* TAG_IPX_COMPAT (110)
* TAG_FAILOVER (115)
* TAG_EXTENDED_REQUEST (126)
* TAG_EXTENDED_OPTION (127)

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.

4 years agoAdd support for ethernet IP protocol
Ahmed Abdelsalam [Fri, 7 Aug 2020 15:02:16 +0000 (15:02 +0000)] 
Add support for ethernet IP protocol

The SRv6 network programming defines a new IP protocol number [1].

The new protocol number is used in the Next Header field of an IPv6 header
or any extension header indicates that the payload is an Ethernet.

IANA has assigned 143 as the protocol number of ethernet [2].

The SRv6 packet has the following format:
IPv6 HDR + SRH + Ethernet HDR + IPv4/IPv6 packet

This patch allows TCPDUMP to dissect such SRv6 packets.

[1] https://tools.ietf.org/html/draft-ietf-spring-srv6-network-programming-16#section-9.1
[2] https://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml

Signed-off-by: Ahmed Abdelsalam <[email protected]>
4 years agoBroadcom LI: Pass correct caplen value to ether_print()
Francois-Xavier Le Bail [Fri, 7 Aug 2020 11:25:21 +0000 (13:25 +0200)] 
Broadcom LI: Pass correct caplen value to ether_print()

4 years agoApply the last step of the new way to update the link-layer header length
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.

4 years agoRework "Update more link-layer dissectors to void functions"
Francois-Xavier Le Bail [Sat, 1 Aug 2020 12:05:59 +0000 (14:05 +0200)] 
Rework "Update more link-layer dissectors to void functions"

It's a follow-up to commit 81dbf4a0b05092760d0ff0cdd48c692e4769ba99.

There is no need to update ether_print(), ether_common_print() and
ether_switch_tag_print() to void functions: back to u_int functions.

There is also no need to add a flag parameter to ether_print(),
ether_common_print() and ether_switch_tag_print(): Remove it.

4 years agoPFLOG: Update the link-layer dissector to a void function
Francois-Xavier Le Bail [Thu, 6 Aug 2020 15:22:34 +0000 (17:22 +0200)] 
PFLOG: Update the link-layer dissector to a void function

Moreover:
Use GET_U_1() when needed.
Remove trailing "_if" from the protocol name.

4 years agoAppleTalk: Update the link-layer dissector to a void function
Francois-Xavier Le Bail [Thu, 6 Aug 2020 14:23:30 +0000 (16:23 +0200)] 
AppleTalk: Update the link-layer dissector to a void function

Moreover:
Remove trailing "_if" from the protocol name.

4 years agoCHDLC: Update the link-layer dissector to a void function
Francois-Xavier Le Bail [Thu, 6 Aug 2020 14:08:23 +0000 (16:08 +0200)] 
CHDLC: Update the link-layer dissector to a void function

Moreover:
Remove trailing "_if" from the protocol name.

4 years agoPPP: Update the link-layer dissectors to void functions
Francois-Xavier Le Bail [Thu, 6 Aug 2020 09:22:56 +0000 (11:22 +0200)] 
PPP: Update the link-layer dissectors to void functions

Moreover:
Remove trailing "_if" from some protocol names.
Update the outputs of two tests accordingly.

4 years agoRemove the unused DLT_LANE8023 link-layer dissector
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).

4 years agoFR: Update the link-layer dissectors to void functions
Francois-Xavier Le Bail [Tue, 4 Aug 2020 15:24:53 +0000 (17:24 +0200)] 
FR: Update the link-layer dissectors to void functions

Moreover:
Remove trailing "_if" from the protocol name.
Add two comments.

4 years agoATM: Update the link-layer dissector to a void function
Francois-Xavier Le Bail [Sun, 2 Aug 2020 11:58:24 +0000 (13:58 +0200)] 
ATM: Update the link-layer dissector to a void function

Moreover:
Remove trailing "_if" from the protocol name.

4 years agoIPFC: Update the link-layer dissector to a void function
Francois-Xavier Le Bail [Sun, 2 Aug 2020 11:46:55 +0000 (13:46 +0200)] 
IPFC: Update the link-layer dissector to a void function

Moreover:
Remove trailing "_if" from the protocol name.

4 years agoToken Ring: Update the link-layer dissector to a void function
Francois-Xavier Le Bail [Sun, 2 Aug 2020 11:36:10 +0000 (13:36 +0200)] 
Token Ring: Update the link-layer dissector to a void function

Moreover:
Remove trailing "_if" from the protocol name.

4 years agoSLL: Update the link-layer dissectors to void functions
Francois-Xavier Le Bail [Sun, 2 Aug 2020 10:51:01 +0000 (12:51 +0200)] 
SLL: Update the link-layer dissectors to void functions

Moreover:
Fix two probably copy & paste errors (s/SLL_HDR_LEN/SLL2_HDR_LEN/).
Remove trailing "_if" from the protocol name.

4 years agoFDDI: Update the link-layer dissector to a void function
Francois-Xavier Le Bail [Sun, 2 Aug 2020 10:03:19 +0000 (12:03 +0200)] 
FDDI: Update the link-layer dissector to a void function

Moreover:
Remove trailing "_if" from the protocol name.

4 years agoCIP: Update the link-layer dissector to a void function
Francois-Xavier Le Bail [Sun, 2 Aug 2020 09:50:35 +0000 (11:50 +0200)] 
CIP: Update the link-layer dissector to a void function

Moreover:
Remove trailing "_if" from the protocol name.

4 years agoIEEE 802.15.4: Remove trailing "_if" from a protocol name
Francois-Xavier Le Bail [Sun, 2 Aug 2020 09:38:44 +0000 (11:38 +0200)] 
IEEE 802.15.4: Remove trailing "_if" from a protocol name

4 years agoIEEE 802.11: Remove trailing "_if" from protocol names
Francois-Xavier Le Bail [Sun, 2 Aug 2020 09:36:05 +0000 (11:36 +0200)] 
IEEE 802.11: Remove trailing "_if" from protocol names

4 years agoIEEE 802.15.4: Update the link-layer dissectors to void functions
Francois-Xavier Le Bail [Sun, 2 Aug 2020 09:24:45 +0000 (11:24 +0200)] 
IEEE 802.15.4: Update the link-layer dissectors to void functions

4 years agoIEEE 802.11: Update the link-layer header length in two steps (PRISM)
Francois-Xavier Le Bail [Sun, 2 Aug 2020 08:48:50 +0000 (10:48 +0200)] 
IEEE 802.11: Update the link-layer header length in two steps (PRISM)

This way, even if we longjmped out of the code because trucation,
the prism header length is subtracted for -x/-X print.

4 years agoIEEE 802.11: Update the link-layer dissectors to void functions
Francois-Xavier Le Bail [Sun, 2 Aug 2020 07:46:30 +0000 (09:46 +0200)] 
IEEE 802.11: Update the link-layer dissectors to void functions

4 years agoRemove a trailing tab
Francois-Xavier Le Bail [Sat, 1 Aug 2020 10:04:52 +0000 (12:04 +0200)] 
Remove a trailing tab

4 years agoPPPoE: Update the link-layer dissector to a void function
Francois-Xavier Le Bail [Fri, 31 Jul 2020 18:36:17 +0000 (20:36 +0200)] 
PPPoE: Update the link-layer dissector to a void function

Moreover:
Add a length check.
Fix a return.
Use nd_print_trunc().
Remove trailing "_if" from the protocol name.
Style.

4 years agoUDP: Harmonize some function calls
Francois-Xavier Le Bail [Fri, 31 Jul 2020 10:19:51 +0000 (12:19 +0200)] 
UDP: Harmonize some function calls

Some calls use '(const u_char *)(up+1)'.
Other calls use 'cp' (same value).
Update the calls to only use 'cp'.

(follow-up to ea0f25cc7765554e521bf7ea44d94f77500749f5)

4 years agoSync the Ethernet protocols database with the libpcap one
Francois-Xavier Le Bail [Tue, 28 Jul 2020 16:22:04 +0000 (18:22 +0200)] 
Sync the Ethernet protocols database with the libpcap one

Commits in libpcap:
23a2d990d9bce2123e4f6c39bee6f61c9617a3b5
(Fix "unknown ether proto 'aarp'")
and
e902b3e97418c4b11caa07f71d0deae8a5e726de
(Remove undocumented and rather old "ether proto" protocols)

4 years agoUse more BSD style references in the man page.
Denis Ovsienko [Tue, 28 Jul 2020 15:10:59 +0000 (16:10 +0100)] 
Use more BSD style references in the man page.

[skip ci]

4 years agoDefine FMAXINT only once and use it properly.
Denis Ovsienko [Tue, 28 Jul 2020 15:02:07 +0000 (16:02 +0100)] 
Define FMAXINT only once and use it properly.

[skip ci]

4 years agoJuniper: Minus the Ethernet hdr length for -x/-X print (JUNIPER_ETHER)
Francois-Xavier Le Bail [Tue, 28 Jul 2020 12:13:17 +0000 (14:13 +0200)] 
Juniper: Minus the Ethernet hdr length for -x/-X print (JUNIPER_ETHER)

4 years agoJuniper: Update the link-layer dissectors to void functions
Francois-Xavier Le Bail [Mon, 27 Jul 2020 17:20:02 +0000 (19:20 +0200)] 
Juniper: Update the link-layer dissectors to void functions

4 years agoMakefile.in: Remove files win32/prj/* from EXTRA_DIST
Francois-Xavier Le Bail [Mon, 27 Jul 2020 07:25:05 +0000 (09:25 +0200)] 
Makefile.in: Remove files win32/prj/* from EXTRA_DIST

Files removed in commit dbe0eab45550fceaf268fbc740fc4b332ff66b39.

4 years agovsock: Update the link-layer dissector to a void function
Francois-Xavier Le Bail [Sun, 26 Jul 2020 19:19:37 +0000 (21:19 +0200)] 
vsock: Update the link-layer dissector to a void function

Moreover:
Rename some variables/parameters from 'len' to 'caplen' because
they store the capture length.

4 years agoARCNET: Remove trailing "_if" from protocol names
Francois-Xavier Le Bail [Sun, 26 Jul 2020 15:56:08 +0000 (17:56 +0200)] 
ARCNET: Remove trailing "_if" from protocol names

4 years agoIPoIB: Update the link-layer header length when needed
Francois-Xavier Le Bail [Sat, 25 Jul 2020 18:15:52 +0000 (20:15 +0200)] 
IPoIB: Update the link-layer header length when needed

4 years agoIPoIB: Update the link-layer dissector to a void function
Francois-Xavier Le Bail [Sat, 25 Jul 2020 14:55:45 +0000 (16:55 +0200)] 
IPoIB: Update the link-layer dissector to a void function

4 years agoRemove unused files win32/prj/*
Francois-Xavier Le Bail [Sat, 25 Jul 2020 08:12:37 +0000 (10:12 +0200)] 
Remove unused files win32/prj/*

The supported way to build tcpdump on Windows is with CMake.

Nobody in tcpdump-workers list says 'we need to keep them'.

4 years agoSupport for EAP Dump in RADIUS Messages
Aravind Prasad S [Thu, 16 Jul 2020 10:13:25 +0000 (03:13 -0700)] 
Support for EAP Dump in RADIUS Messages

(pull request #864)

4 years agoEAP: Add verbose output for the test case eapon1.pcap
Francois-Xavier Le Bail [Mon, 20 Jul 2020 07:58:35 +0000 (09:58 +0200)] 
EAP: Add verbose output for the test case eapon1.pcap

4 years agoautoconf: replace --with-system-libpcap with --disable-local-libpcap.
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 GitHub issue #823.

4 years agoMPLS: Rework some tests
Francois-Xavier Le Bail [Thu, 16 Jul 2020 16:28:44 +0000 (18:28 +0200)] 
MPLS: Rework some tests

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

4 years agoUpdate more link-layer dissectors to void functions
Francois-Xavier Le Bail [Sun, 12 Jul 2020 20:27:33 +0000 (22:27 +0200)] 
Update more link-layer dissectors to void functions

brcm_tag_if_print()
brcm_tag_prepend_if_print()
dsa_if_print()
edsa_if_print()
ether_if_print()
netanalyzer_if_print()
netanalyzer_transparent_if_print()

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.

4 years agoRename a field of the netdissect_options structure
Francois-Xavier Le Bail [Tue, 14 Jul 2020 15:32:55 +0000 (17:32 +0200)] 
Rename a field of the netdissect_options structure

4 years agoBRCMTAG: Remove a useless test
Francois-Xavier Le Bail [Sun, 12 Jul 2020 19:52:03 +0000 (21:52 +0200)] 
BRCMTAG: Remove a useless test

Because packet length (length) >= capture length (caplen), when
caplen >= BRCM_TAG_LEN, length >= caplen cannot be < BRCM_TAG_LEN.

(see the sanity checks in print.c, pretty_print_packet() function)

4 years agoTCP: Remove an useless test
Francois-Xavier Le Bail [Sun, 5 Jul 2020 09:28:48 +0000 (11:28 +0200)] 
TCP: Remove an useless test

The length is tested in ldp_print().

4 years agoUpdate the GitHub issue template (about attachments)
Francois-Xavier Le Bail [Wed, 1 Jul 2020 10:06:44 +0000 (12:06 +0200)] 
Update the GitHub issue template (about attachments)

[skip ci]

4 years agoRSVP: Make a constant unsigned
Francois-Xavier Le Bail [Wed, 1 Jul 2020 09:16:29 +0000 (11:16 +0200)] 
RSVP: Make a constant unsigned

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

4 years agoIEEE 802.11: Fix signedness of the flags parameters of print_chaninfo()
Francois-Xavier Le Bail [Wed, 1 Jul 2020 08:15:39 +0000 (10:15 +0200)] 
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

4 years agoLLDP 8021 link aggregation TLV support
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.

4 years agoman: Add an example for printing TCP with RST+ACK both set
Francois-Xavier Le Bail [Thu, 25 Jun 2020 07:50:09 +0000 (09:50 +0200)] 
man: Add an example for printing TCP with RST+ACK both set

Partially based on a Guy's comment in issue #860.

[skip ci]

4 years agoIEEE 802.15.4: Fix printing the pending extended address list
Francois-Xavier Le Bail [Wed, 17 Jun 2020 12:19:33 +0000 (14:19 +0200)] 
IEEE 802.15.4: Fix printing the pending extended address list

Fix an index.
Fix a probably copy & paste error.

4 years agoTESTrun: add definitions of true and false.
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:

https://stackoverflow.com/questions/6936194/is-there-a-built-in-true-false-boolean-value-in-perl

4 years agoTESTrun: fix copy-and-pasteo.
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.)

4 years agoBGP: Fix a ND_TCHECK_LEN() use
Francois-Xavier Le Bail [Sun, 14 Jun 2020 11:54:24 +0000 (13:54 +0200)] 
BGP: Fix a ND_TCHECK_LEN() use

The error was:
reading from file bgp-rt-prefix.pcap, link-type EN10MB (Ethernet), snapshot
length 262144
==22310==WARNING: MemorySanitizer: use-of-uninitialized-value
[...]

SUMMARY: MemorySanitizer: use-of-uninitialized-value print-bgp.c:1040:5
in decode_rt_routing_info

Moreover:
Simplify a pointer expression.

4 years agoTESTrun: process the system return value differently on Windows and UN*X.
Guy Harris [Sun, 14 Jun 2020 06:21:43 +0000 (23:21 -0700)] 
TESTrun: process the system return value differently on Windows and UN*X.

We can use the POSIX functions on UN*X, but not on Windows.  Use them on
UN*X, but extract the exit status manually on Windows.

Put in a pile of comments about the return status of commands, command
interpreters, and the Perl system function on UN*X and Windows.

If system simply fails to run at atll (returns -1), put a message into
the faked output file.

Get rid of some duplicate initializations while we're at it.

4 years agoTESTrun: put white space between flags.
Guy Harris [Sun, 14 Jun 2020 03:35:51 +0000 (20:35 -0700)] 
TESTrun: put white space between flags.

I guess that's not allowed, at least not by fc.

4 years agoTESTrun: Windowsify one more path.
Guy Harris [Sun, 14 Jun 2020 03:27:45 +0000 (20:27 -0700)] 
TESTrun: Windowsify one more path.

4 years agoTESTrun: canonicalize the path of the standard error file.
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.)

4 years agoTESTrun: add and expand comments.
Guy Harris [Sun, 14 Jun 2020 01:18:05 +0000 (18:18 -0700)] 
TESTrun: add and expand comments.

[skip ci]

4 years agoTESTrun: put all redirection at the end of the command line.
Guy Harris [Sun, 14 Jun 2020 00:17:05 +0000 (17:17 -0700)] 
TESTrun: put all redirection at the end of the command line.

That makes it a bit easier to read.

4 years agoTESTrun: use the same code paths on Windows and UN*X.
Guy Harris [Sat, 13 Jun 2020 22:49:04 +0000 (15:49 -0700)] 
TESTrun: use the same code paths on Windows and UN*X.

There's no need to treat Windows specially in that code path.

4 years agoTESTrun: always return a value from runtest().
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.

4 years agoTESTrun: I missed one use of $printcmd; use showfile() for it.
Guy Harris [Sat, 13 Jun 2020 21:07:40 +0000 (14:07 -0700)] 
TESTrun: I missed one use of $printcmd; use showfile() for it.

4 years agoRemove some trailing spaces/tabs
Francois-Xavier Le Bail [Sat, 13 Jun 2020 12:55:27 +0000 (14:55 +0200)] 
Remove some trailing spaces/tabs

Moreover:
Remove some spaces before tabs.
Remove extra blank line.

4 years agoAdd two test files for the unsupported link-layer protocols printer
Francois-Xavier Le Bail [Fri, 12 Jun 2020 10:39:43 +0000 (12:39 +0200)] 
Add two test files for the unsupported link-layer protocols printer

This is a follow-up to commit 25687e1a312a3bb63a6e8d7f0af0210a615e24a8.

These files come from the Wireshark menagerie:
0031419.pcap (link type 160) and 5632-Raw_D-BUS.cap (first two packets).

4 years agoTESTrun: use fc, rather than diff, on Windows.
Guy Harris [Sat, 13 Jun 2020 08:55:49 +0000 (01:55 -0700)] 
TESTrun: use fc, rather than diff, on Windows.

diff doesn't come standard with Windows; fc does.

4 years agoTESTrun: clean up printing of files.
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.

4 years agoUse \ rather than / as a pathname separator in Windows.
Guy Harris [Fri, 12 Jun 2020 04:01:31 +0000 (21:01 -0700)] 
Use \ rather than / as a pathname separator in Windows.

4 years agoTESTrun: fix some problems when run on Windows.
Guy Harris [Thu, 11 Jun 2020 21:02:43 +0000 (14:02 -0700)] 
TESTrun: fix some problems when run on Windows.

Run tcpdump, not windump - we build it as tcpdump, not windump, and
there's not really a reason to have a separate windump program.

For now, at least, assume a Visual Studio debug build, so it's in the
Debug subdirectory.

Use that path for *all* calls to tcpdump.

Use "type" rather than "cat" to print files on Windows.

It still needs to be changed to, for example, not use sed.

4 years agoDNS: Do the 'over TCP' processing in the printer
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.

4 years agoDNS: Add two test files (over TCP and over UDP)
Francois-Xavier Le Bail [Wed, 10 Jun 2020 09:44:10 +0000 (11:44 +0200)] 
DNS: Add two test files (over TCP and over UDP)

4 years agoTCP: Update style
Francois-Xavier Le Bail [Tue, 9 Jun 2020 11:55:07 +0000 (13:55 +0200)] 
TCP: Update style

[skip ci]

4 years agoUDP: Harmonize some function calls
Francois-Xavier Le Bail [Tue, 9 Jun 2020 09:57:22 +0000 (11:57 +0200)] 
UDP: Harmonize some function calls

Some calls use '(const u_char *)(up + 1)' or '(const void *)(up + 1)'.
Other calls use 'cp' (same value).
Update the calls to only use 'cp'.

Moreover:
Update some other casted 'up + 1' uses to 'cp'.
Update some pointers to packet bytes from 'void *' to 'u_char *'.

4 years agoappveyor: add VS 2019 tests.
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.

4 years agoPTP: Declare 'static' some variables
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.

4 years agoCompile with '-Wmissing-variable-declarations' if it's available
Francois-Xavier Le Bail [Fri, 29 May 2020 21:37:36 +0000 (23:37 +0200)] 
Compile with '-Wmissing-variable-declarations' if it's available

(In devel mode)

5 years agomacsec: include <config.h>, not "config.h".
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.

5 years agomacsec, ether: clean up printing of encrypted and changed packets.
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.

5 years agoether: for MACsec packets, print the MACsec ethertype if E or C set.
Guy Harris [Thu, 28 May 2020 11:56:52 +0000 (04:56 -0700)] 
ether: for MACsec packets, print the MACsec ethertype if E or C set.

If -e isn't specified, and a MACsec packet is encrypted or changed, so
that we don't print the payload, at least report that it's a MACsec
packet.

5 years agoMerge pull request #603 from qsn/macsec
Guy Harris [Thu, 28 May 2020 11:47:50 +0000 (04:47 -0700)] 
Merge pull request #603 from qsn/macsec

Add support for MACsec (IEEE 802.1AE-2006)

5 years agomacsec: update the test files. 603/head
Guy Harris [Thu, 28 May 2020 09:23:54 +0000 (02:23 -0700)] 
macsec: update the test files.

Add the frame number, as we now run the tests with -#.

Fix some output to match the current state of the code.