]> The Tcpdump Group git mirrors - tcpdump/log
tcpdump
4 years ago.cirrus.yml: quote strings in only_if expression
Nikolay Edigaryev [Fri, 5 Mar 2021 18:46:23 +0000 (21:46 +0300)] 
.cirrus.yml: quote strings in only_if expression

4 years agoCI: Relax the branch filters back. [skip ci]
Denis Ovsienko [Thu, 4 Mar 2021 21:43:16 +0000 (21:43 +0000)] 
CI: Relax the branch filters back. [skip ci]

Address feedback from Francois-Xavier and do not limit everyday CI to
the branches that are known-good for running build_matrix.sh, only mind
to skip the coverity_scan branch. Although this arrangement is not what
an upstream repository should use, it keeps CI simple in fork
repositories that have arbitrarily named branches with a working
build_matrix.sh.

This should also restore pull requests CI if the strict filters had
affected it.

4 years agoAppVeyor: Specify the same branches as elsewhere. [skip ci]
Denis Ovsienko [Thu, 4 Mar 2021 00:11:59 +0000 (00:11 +0000)] 
AppVeyor: Specify the same branches as elsewhere. [skip ci]

4 years agoTravis CI: Clean up. [skip ci]
Denis Ovsienko [Wed, 3 Mar 2021 04:37:40 +0000 (04:37 +0000)] 
Travis CI: Clean up. [skip ci]

4 years agoCI: Switch Coverity Scan from Travis to Cirrus. [skip appveyor]
Denis Ovsienko [Wed, 3 Mar 2021 01:57:13 +0000 (01:57 +0000)] 
CI: Switch Coverity Scan from Travis to Cirrus. [skip appveyor]

4 years agoCoverity: Get HTTP status codes right. [skip ci]
Denis Ovsienko [Wed, 3 Mar 2021 01:35:35 +0000 (01:35 +0000)] 
Coverity: Get HTTP status codes right. [skip ci]

See tcpslice commit 9f4f0b9.

4 years agoVTP: Fix a warning
Francois-Xavier Le Bail [Sun, 28 Feb 2021 13:50:06 +0000 (14:50 +0100)] 
VTP: Fix a warning

The warning on AppVeyor (Visual Studio 2017) was:
print-vtp.c(122): warning C4028: formal parameter 3 different from
declaration

4 years agoTravis CI: Allow the ppc64le job to fail
Francois-Xavier Le Bail [Wed, 24 Feb 2021 17:56:02 +0000 (18:56 +0100)] 
Travis CI: Allow the ppc64le job to fail

4 years agoTCP: Add a comment
Francois-Xavier Le Bail [Tue, 16 Feb 2021 20:01:27 +0000 (21:01 +0100)] 
TCP: Add a comment

This is a follow-up to commit 568d18f6eafb8df0d2500652b1cad49618051349.

[skip ci]

4 years agoBFD: Refine the previous commit.
Denis Ovsienko [Tue, 16 Feb 2021 00:59:17 +0000 (00:59 +0000)] 
BFD: Refine the previous commit.

Spell acronyms as they appear in respective specifications, fix a
reference in a comment, add a change log entry and update some tests.

4 years agoBFD: add SBFD support (RFC7880 and RFC7881) 905/head
Bill Fenner [Fri, 5 Feb 2021 05:10:31 +0000 (21:10 -0800)] 
BFD: add SBFD support (RFC7880 and RFC7881)

Add support for SBFD on UDP port 7784.  SBFD is different
in that packets from the reflector will be sent with *source*
port 7784; in all other BFD mechanisms, it is only the
destination port that matters.  For SBFD print-udp.c has to
check both source and destination port.

4 years agoL2TP: Add a bounds check
Francois-Xavier Le Bail [Sun, 14 Feb 2021 10:35:40 +0000 (11:35 +0100)] 
L2TP: Add a bounds check

Check if the offset padding octets are in the packet buffer.

4 years agoTCP: Add a bounds check before decoding the payload
Francois-Xavier Le Bail [Fri, 12 Feb 2021 20:49:40 +0000 (21:49 +0100)] 
TCP: Add a bounds check before decoding the payload

At least the header data is required.

Moreover:
Update the output of a test accordingly.
Fix indentation.

4 years agoIP: Add a bounds check before calling ip_demux_print()
Francois-Xavier Le Bail [Fri, 12 Feb 2021 13:20:52 +0000 (14:20 +0100)] 
IP: Add a bounds check before calling ip_demux_print()

At least the header data is required.

Moreover:
Fix indentation.

4 years agoTCP: Update the snapend before decoding a MPTCP option
Francois-Xavier Le Bail [Thu, 11 Feb 2021 20:09:00 +0000 (21:09 +0100)] 
TCP: Update the snapend before decoding a MPTCP option

Update the snapend to the end of the option before calling mptcp_print().
Some options (MPTCP or others) may be present after a MPTCP option.
This prevents that, in mptcp_print(), the remaining length < the remaining
caplen.

4 years agoDHCPv6: Rework the update of the snapend for nested DHCPv6 packets
Francois-Xavier Le Bail [Thu, 11 Feb 2021 18:41:39 +0000 (19:41 +0100)] 
DHCPv6: Rework the update of the snapend for nested DHCPv6 packets

There is no need to use nd_push_snapend()/nd_pop_packet_info().

4 years agoDHCPv6: Update the snapend for nested DHCPv6 packets
Francois-Xavier Le Bail [Thu, 11 Feb 2021 16:46:02 +0000 (17:46 +0100)] 
DHCPv6: Update the snapend for nested DHCPv6 packets

Update the snapend to the end of the option before calling recursively
dhcp6_print() for the nested packet.
Other options may be present after the nested DHCPv6 packet.
This prevents that, in dhcp6_print(), for the nested DHCPv6 packet,
the remaining length < remaining caplen.

4 years agoRestore the possibility of building when remote is enabled in libpcap
Francois-Xavier Le Bail [Thu, 11 Feb 2021 08:25:29 +0000 (09:25 +0100)] 
Restore the possibility of building when remote is enabled in libpcap

This change allows to test the build with HAVE_PCAP_FINDALLDEVS_EX and
HAVE_PCAP_OPEN enabled.

Some ways to run theses tests:

MATRIX_BUILD_LIBPCAP=yes MATRIX_REMOTE=yes MATRIX_CMAKE=no MATRIX_CC=gcc \
MATRIX_CRYPTO=no MATRIX_SMB=no ./build_matrix.sh
(configure should display:
checking for pcap_open... yes
checking for pcap_findalldevs_ex... yes)

MATRIX_BUILD_LIBPCAP=yes MATRIX_REMOTE=yes MATRIX_CMAKE=yes MATRIX_CC=gcc \
MATRIX_CRYPTO=no MATRIX_SMB=no ./build_matrix.sh
(cmake should display:
Looking for pcap_open - found
Looking for pcap_findalldevs_ex - found)

Don't enable the builds with REMOTE=yes by default.

This partially reverts commit 3861a41bfa60b9a8bed2d5a11a2ba7a7b1bbed3d.
"Remove the REMOTE dimension from the nested matrix."

4 years agoCirrus CI: Try to speed FreeBSD 13.0 up. [skip appveyor] [skip travis]
Denis Ovsienko [Thu, 11 Feb 2021 00:53:59 +0000 (00:53 +0000)] 
Cirrus CI: Try to speed FreeBSD 13.0 up. [skip appveyor] [skip travis]

Whatever the underlying reason, freebsd-13-0-snap used to take a couple
times more time to make it through the build than the other two image
families. After switching to the full nested matrix this started to
cause task timeouts and rescheduling. Let's see if a different
distribution of resources can improve this. Update the Linux task
comment while at it.

4 years agoESP: Remove padding, padding length and next header from the buffer
Francois-Xavier Le Bail [Wed, 10 Feb 2021 19:48:18 +0000 (20:48 +0100)] 
ESP: Remove padding, padding length and next header from the buffer

Moreover:
Fix indentation.

4 years agoCirrus CI: Refine some resource allocation. [skip appveyor] [skip travis]
Denis Ovsienko [Wed, 10 Feb 2021 16:27:15 +0000 (16:27 +0000)] 
Cirrus CI: Refine some resource allocation. [skip appveyor] [skip travis]

For FreeBSD and Linux request less memory than the default 4 GB.

Cirrus build graph claims that both FreeBSD and Linux tasks never use
more than 2 CPUs. For FreeBSD request 2 CPUs instead of 4 to enable all
three permutations run in parallel. For Linux request 4 CPUs instead of
8 to enable two concurrent tasks and split the nested matrix into two to
take advantage of that.

For macOS move and expand the comment.

4 years agoCirrus CI: Run build_matrix.sh on FreeBSD. [skip appveyor] [skip travis]
Denis Ovsienko [Wed, 10 Feb 2021 15:34:22 +0000 (15:34 +0000)] 
Cirrus CI: Run build_matrix.sh on FreeBSD. [skip appveyor] [skip travis]

4 years agoRemove the REMOTE dimension from the nested matrix. [skip appveyor]
Denis Ovsienko [Wed, 10 Feb 2021 14:10:06 +0000 (14:10 +0000)] 
Remove the REMOTE dimension from the nested matrix. [skip appveyor]

Neither the build process nor the tests of tcpdump currently depend on
presence or absence of the libpcap remote feature, and there is already
the libpcap nested matrix to cover that dimension, thus in the tcpdump
nested matrix just leave this aspect of the local libpcap build
unspecified and reduce the total number of rounds from 48 to 32.

4 years agobuild_matrix.sh: Update the SETUP line and the 'Build libpcap' printings
Francois-Xavier Le Bail [Wed, 10 Feb 2021 13:48:56 +0000 (14:48 +0100)] 
build_matrix.sh: Update the SETUP line and the 'Build libpcap' printings

4 years agobuild_matrix.sh: Fix typoes
Francois-Xavier Le Bail [Wed, 10 Feb 2021 13:02:45 +0000 (14:02 +0100)] 
build_matrix.sh: Fix typoes

For harmonization s/=/:/ between some keywords and values.

4 years agoTravis CI: Use AMD64 Linux build only for Coverity build
Francois-Xavier Le Bail [Wed, 10 Feb 2021 10:24:55 +0000 (11:24 +0100)] 
Travis CI: Use AMD64 Linux build only for Coverity build

4 years agoCirrus CI: Start building AMD64 Linux. [skip appveyor] [skip travis]
Denis Ovsienko [Tue, 9 Feb 2021 19:06:58 +0000 (19:06 +0000)] 
Cirrus CI: Start building AMD64 Linux. [skip appveyor] [skip travis]

4 years agoCI: Move [AMD64] macOS from Travis to Cirrus. [skip appveyor]
Denis Ovsienko [Tue, 9 Feb 2021 16:23:53 +0000 (16:23 +0000)] 
CI: Move [AMD64] macOS from Travis to Cirrus. [skip appveyor]

This change restores macOS CI, it might also unblock the stuck Travis CI
builds, as was the case with tcpslice and libpcap earlier. Let's see.

Also refine the FreeBSD tasks a bit, but do not switch them to
build_matrix.sh yet, as that combination is currently broken.

4 years agoAdd the build_matrix.sh and build.sh scripts
Francois-Xavier Le Bail [Sun, 7 Feb 2021 10:22:24 +0000 (11:22 +0100)] 
Add the build_matrix.sh and build.sh scripts

Use them with Travis CI to build with less builders and save CI runtime.
This will currently run five builders: amd64, arm64, ppc64le, s390x and osx.

The build_matrix.sh script executes the matrix loops, exclude tests and
cleaning.
It conditionally builds libpcap running the build.sh script of libpcap.
It calls the build.sh script which runs one build with setup environment
variables: BUILD_LIBPCAP, REMOTE, CC, CMAKE, CRYPTO and SMB
(default: BUILD_LIBPCAP=no, REMOTE=no, CC=gcc, CMAKE=no, CRYPTO=no, SMB=no).
The matrix can be configured with environment variables
MATRIX_BUILD_LIBPCAP, MATRIX_REMOTE, MATRIX_CC, MATRIX_CMAKE, MATRIX_CRYPTO
and MATRIX_SMB
(default: MATRIX_BUILD_LIBPCAP='no yes', MATRIX_REMOTE='no yes',
MATRIX_CC='gcc clang', MATRIX_CMAKE='no yes', MATRIX_CRYPTO='no yes',
MATRIX_SMB='no yes').

These scripts can easily be updated to run new tests (32 bits builds,
sanitizers, coverage, etc).

They can be used locally for build tests or used with other CI systems.

Run examples:
./build_matrix.sh
MATRIX_BUILD_LIBPCAP=yes ./build_matrix.sh
MATRIX_CC=clang ./build_matrix.sh
CC=clang ./build.sh
CMAKE=yes ./build.sh
CC=clang CMAKE=yes CRYPTO=yes ./build.sh

Moreover:
Remove the old workaround PATH=$PATH...
Update the install directory prefix to /tmp/local.
Use vim modeline in the two shell scripts.

4 years agoRemove GENSRC remnants from Makefile.in. [skip appveyor]
Denis Ovsienko [Sat, 6 Feb 2021 01:45:41 +0000 (01:45 +0000)] 
Remove GENSRC remnants from Makefile.in. [skip appveyor]

The variable does not exist since commit 4943adf.

4 years agoSMB: Disable the printer by default with CMake build
Francois-Xavier Le Bail [Fri, 5 Feb 2021 17:01:41 +0000 (18:01 +0100)] 
SMB: Disable the printer by default with CMake build

This is a follow-up to commit 192db0a116f5ee419fddbdadf5822a7a3179d6c3.

[skip ci]

4 years agoDrop a stale comment. [skip appveyor]
Denis Ovsienko [Fri, 5 Feb 2021 16:08:46 +0000 (16:08 +0000)] 
Drop a stale comment. [skip appveyor]

Let's see if one more commit helps Travis CI pull itself together.

4 years agoRefine Markdown in README.md. [skip appveyor]
Denis Ovsienko [Fri, 5 Feb 2021 14:25:11 +0000 (14:25 +0000)] 
Refine Markdown in README.md. [skip appveyor]

Move "by TTG" to the main header and eliminate a few duplicate "by"
sentences. Update a CI badge to use the travis-ci.com URLs. Make the
security note bold to help more people actually get it. Change the git
URL to github.com to be consistent with libpcap. Add and refine a few
headers. Add and improve hyperlink formatting in a few places. Lose a
few excess generic sentences. Fixup some minor editorial issues. Fence
the "from LBL" boilerplate, move it to the bottom of the dedicated
section and eliminate a few duplicate "from" sentences.

Skip only some CI on this occasion, so Travis CI can transfer the build
history from travis-ci.org to travus-ci.com and complete the migration.

4 years agoZMTP: Replace custom code with bittok2str().
Denis Ovsienko [Tue, 2 Feb 2021 00:25:25 +0000 (00:25 +0000)] 
ZMTP: Replace custom code with bittok2str().

4 years agoPTP: Use ND_LCHECK_U for checking invalid length
Francois-Xavier Le Bail [Mon, 1 Feb 2021 12:44:21 +0000 (13:44 +0100)] 
PTP: Use ND_LCHECK_U for checking invalid length

Moreover:
Rename a variable.

4 years agoMSDP: Print ": " before the protocol name
Francois-Xavier Le Bail [Mon, 1 Feb 2021 09:31:34 +0000 (10:31 +0100)] 
MSDP: Print ": " before the protocol name

Like with most TCP encapsulated protocols.
Use nd_print_protocol().
No more ":" after protocol name.
This change will print the protocol name even in truncation cases.

4 years agoRemove some storage class specifier 'register'
Francois-Xavier Le Bail [Sat, 30 Jan 2021 08:49:25 +0000 (09:49 +0100)] 
Remove some storage class specifier 'register'

This is a follow-up to commit 5cea2703185c6af1616dc338c43c6cf67b0bec60.

[skip ci]

4 years agoDCCP: Replace custom code with tok2str(). [skip ci]
Denis Ovsienko [Fri, 29 Jan 2021 17:03:15 +0000 (17:03 +0000)] 
DCCP: Replace custom code with tok2str(). [skip ci]

4 years agoVQP: Do not print unknown error codes twice. [skip ci]
Denis Ovsienko [Fri, 29 Jan 2021 16:23:05 +0000 (16:23 +0000)] 
VQP: Do not print unknown error codes twice. [skip ci]

4 years agoman: Update a reference as www.cifs.org is gone. [skip ci]
Denis Ovsienko [Thu, 28 Jan 2021 23:29:57 +0000 (23:29 +0000)] 
man: Update a reference as www.cifs.org is gone. [skip ci]

4 years agoAdd an entry in CHANGES
Francois-Xavier Le Bail [Wed, 27 Jan 2021 09:33:11 +0000 (10:33 +0100)] 
Add an entry in CHANGES

[skip ci]

4 years agoMACsec: Add a comment about the previous change
Francois-Xavier Le Bail [Tue, 26 Jan 2021 11:22:30 +0000 (12:22 +0100)] 
MACsec: Add a comment about the previous change

[skip ci]

4 years agoMACsec: Update the snapend thus the ICV field is not payload for the caller
Francois-Xavier Le Bail [Mon, 25 Jan 2021 17:05:59 +0000 (18:05 +0100)] 
MACsec: Update the snapend thus the ICV field is not payload for the caller

The ICV (Integrity Check Value) is at the end of the frame, after the
secure data.

4 years agoRPKI-Router: Refine length and bounds checks. [skip ci]
Denis Ovsienko [Mon, 25 Jan 2021 19:09:49 +0000 (19:09 +0000)] 
RPKI-Router: Refine length and bounds checks. [skip ci]

Fetch PDU version only once and use the PDU header structure for that.
Check data length before accessing it. Remove two redundant
ND_TCHECK_LEN() instances and move the associated comments below
respective GET_BE_U_4() instances.

List recent updates in CHANGES while at it.

4 years agoOpenFlow 1.0: Simplify the snapend management. [skip ci]
Denis Ovsienko [Mon, 25 Jan 2021 12:51:54 +0000 (12:51 +0000)] 
OpenFlow 1.0: Simplify the snapend management. [skip ci]

As Guy explains it, nd_push_snapend() makes it easy to save and to
restore the snapend from different functions or different invocations
of the same function. In a simple case a local variable and ND_MIN()
do the job just as well without the associated memory management and
error checking.

4 years agoMACsec: Put the function definition names at the beginning of the line
Francois-Xavier Le Bail [Mon, 25 Jan 2021 11:07:08 +0000 (12:07 +0100)] 
MACsec: Put the function definition names at the beginning of the line

This change allows easier update by script.

[skip ci]

4 years agoICMP: Update the snapend for some nested IP packets
Francois-Xavier Le Bail [Sun, 24 Jan 2021 09:52:50 +0000 (10:52 +0100)] 
ICMP: Update the snapend for some nested IP packets

Update the snapend because extensions (MPLS, ...) may be present
after the IP packet. In this case the current (outer) packet's
snapend is not what ip_print() needs to decode an IP packet nested
in the middle of an ICMP payload.

This prevents that, in ip_print(), for the nested IP packet, the
remaining length < remaining caplen.

Moreover:
Reduce the scope of a variable.
Fix spaces

4 years ago.gitignore: Add *.gcda *.gcno *.gcov (coverage files)
Francois-Xavier Le Bail [Sun, 24 Jan 2021 13:56:15 +0000 (14:56 +0100)] 
.gitignore: Add *.gcda *.gcno *.gcov (coverage files)

[skip ci]

4 years agoNetFlow: Modernize packet parsing style. [skip ci]
Denis Ovsienko [Sat, 23 Jan 2021 15:24:32 +0000 (15:24 +0000)] 
NetFlow: Modernize packet parsing style. [skip ci]

Enable ND_LONGJMP_FROM_TCHECK. Remove one redundant ND_TCHECK_SIZE()
instance and place the remaining ones after the code that prints
individual structure fields, so it can print incomplete structures. Lose
intermediate snprintf() calls and associated props. Lose trailing spaces
in v1 and v5 output.

4 years agoOSPF: Update more router properties bits. [skip ci]
Denis Ovsienko [Sat, 23 Jan 2021 14:18:22 +0000 (14:18 +0000)] 
OSPF: Update more router properties bits. [skip ci]

4 years agoospf: add support bit Nt RFC3101 904/head
ckishimo [Fri, 22 Jan 2021 09:45:24 +0000 (10:45 +0100)] 
ospf: add support bit Nt RFC3101

4 years agoOpenFlow 1.0: Get snapend right for nested frames. [skip ci]
Denis Ovsienko [Fri, 22 Jan 2021 12:51:15 +0000 (12:51 +0000)] 
OpenFlow 1.0: Get snapend right for nested frames. [skip ci]

The current and the nested packets can and do have different snapend,
implement and comment that in of10_packet_data_print() to fix an issue
discovered by Francois-Xavier Le Bail.

4 years agoIEEE 802.11: Simplify handle_action(). [skip ci]
Denis Ovsienko [Fri, 22 Jan 2021 01:24:15 +0000 (01:24 +0000)] 
IEEE 802.11: Simplify handle_action(). [skip ci]

Lose PRINT_MESHLINK_ACTION(), PRINT_MESHPEERING_ACTION() and
PRINT_MESHPATH_ACTION(), which were unused since commit f1c0553. Convert
the remaining 5 macros and hard-coded strings using tok2str() and
uint2tokary().

4 years agoForCES: Modernize packet parsing style.
Denis Ovsienko [Thu, 21 Jan 2021 01:43:42 +0000 (01:43 +0000)] 
ForCES: Modernize packet parsing style.

Enable ND_LONGJMP_FROM_TCHECK. Add and use many standard "invalid"
sections. Use tok2str() in asttlv_print(). In forces_print() don't
hex-dump the invalid data by default, there's ndo_vflag for that.
Simplify some code in genoptlv_print(). In pdata_print() instead of 0
return the value that pdatacnt_print() returned if it was not good. Lose
a disabled debug line.

4 years agoSNMP: Modernize packet parsing style.
Denis Ovsienko [Wed, 20 Jan 2021 14:50:59 +0000 (14:50 +0000)] 
SNMP: Modernize packet parsing style.

Enable ND_LONGJMP_FROM_TCHECK. Remove a few redundant ND_TCHECK*()
instances. Make asn1_print_octets() and asn1_print_string() void. Harden
an improvised snapshot end guard with ND_TCHECK_LEN().

4 years agoSCTP: Modernize packet parsing style.
Denis Ovsienko [Tue, 19 Jan 2021 16:25:27 +0000 (16:25 +0000)] 
SCTP: Modernize packet parsing style.

Enable ND_LONGJMP_FROM_TCHECK. Report invalid packets as invalid.

4 years agoAdd missing and regroup existing entries in CHANGES. [skip ci]
Denis Ovsienko [Tue, 19 Jan 2021 00:25:45 +0000 (00:25 +0000)] 
Add missing and regroup existing entries in CHANGES. [skip ci]

4 years agoTCP: Add a test with data in the RST segment, truncated example
Francois-Xavier Le Bail [Tue, 19 Jan 2021 13:58:48 +0000 (14:58 +0100)] 
TCP: Add a test with data in the RST segment, truncated example

4 years agoNTP: Modernize packet parsing style. [skip ci]
Denis Ovsienko [Mon, 18 Jan 2021 23:59:45 +0000 (23:59 +0000)] 
NTP: Modernize packet parsing style. [skip ci]

Enable ND_LONGJMP_FROM_TCHECK. Remove a few redundant ND_TCHECK()
instances. Move one ND_TCHECK_4() to where it belongs. Have nd_printjn()
guard the snapshot end.

4 years agoTCP: Add a test with data in the RST segment
Francois-Xavier Le Bail [Mon, 18 Jan 2021 11:46:23 +0000 (12:46 +0100)] 
TCP: Add a test with data in the RST segment

4 years agoTry the new ND_LCHECK*() macros. [skip ci]
Denis Ovsienko [Sun, 17 Jan 2021 23:11:19 +0000 (23:11 +0000)] 
Try the new ND_LCHECK*() macros. [skip ci]

4 years agoTCP: Modernize packet parsing style.
Denis Ovsienko [Sun, 17 Jan 2021 21:22:34 +0000 (21:22 +0000)] 
TCP: Modernize packet parsing style.

Enable ND_LONGJMP_FROM_TCHECK. Report invalid packets as invalid. Remove
most ND_TCHECK*() instances as they were redundant. Update a custom
snapend guard to use nd_trunc_longjmp(). Reduce arity of
print_tcp_fastopen_option(). Use ND_TTEST_LEN() in
tcp_verify_signature() and nd_printn() in print_tcp_rst_data(). For
NFS_PORT remove ND_TTEST_4() from the test condition as it is not a
valid factor, there is the subsequent GET_BE_U_4() to check bounds.

4 years agoMPTCP: Put GET_U_1() outside of macros.
Denis Ovsienko [Sat, 16 Jan 2021 23:39:01 +0000 (23:39 +0000)] 
MPTCP: Put GET_U_1() outside of macros.

This way it is much easier to proof-read the bounds checks coverage
even without the comments. Fixup some whitespace while at it.

4 years agoNetFlow: Use tcp_flag_values[] for TCP flags.
Denis Ovsienko [Sat, 16 Jan 2021 10:56:30 +0000 (10:56 +0000)] 
NetFlow: Use tcp_flag_values[] for TCP flags.

This way there is less code duplication and more consistency.

4 years agoOLSR: Fix a goto before ND_PRINT
Francois-Xavier Le Bail [Sun, 17 Jan 2021 10:30:26 +0000 (11:30 +0100)] 
OLSR: Fix a goto before ND_PRINT

4 years agoFix a typo in ND_LCHECK_ZU definition
Francois-Xavier Le Bail [Sun, 17 Jan 2021 09:29:12 +0000 (10:29 +0100)] 
Fix a typo in ND_LCHECK_ZU definition

[skip ci]

4 years agoAdd ND_LCHECKMSG_U, ND_LCHECK_U, ND_LCHECKMSG_ZU and ND_LCHECK_ZU macros
Francois-Xavier Le Bail [Sat, 16 Jan 2021 13:27:21 +0000 (14:27 +0100)] 
Add ND_LCHECKMSG_U, ND_LCHECK_U, ND_LCHECKMSG_ZU and ND_LCHECK_ZU macros

They check length < minimum for invalid packet with or without a custom
message, format %u or %zu.

%zu (ND_LCHECKMSG_ZU and ND_LCHECK_ZU) is useful when minimum is a
sizeof(...).

[skip ci]

4 years agoDCCP: Replace some magic numbers
Francois-Xavier Le Bail [Sat, 16 Jan 2021 10:54:03 +0000 (11:54 +0100)] 
DCCP: Replace some magic numbers

4 years agoAODV: Modernize packet parsing style.
Denis Ovsienko [Fri, 15 Jan 2021 22:30:40 +0000 (22:30 +0000)] 
AODV: Modernize packet parsing style.

Make all ND_TCHECK_SIZE() instances redundant and remove them. Always
print a reason when reporting a packet as invalid. Undo the changes from
commit f875106 to remove support for draft-perkins-aodv6-01, which had
expired in 2001. Use tok2str() to print the message type. Don't print an
additional "v6" for RREQ, as the address family is apparent from the UDP
header. Update a test.

4 years agoOLSR: Print the protocol name even if the packet is invalid
Francois-Xavier Le Bail [Fri, 15 Jan 2021 13:16:18 +0000 (14:16 +0100)] 
OLSR: Print the protocol name even if the packet is invalid

4 years agoRIP: Modernize packet parsing style.
Denis Ovsienko [Thu, 14 Jan 2021 03:48:28 +0000 (03:48 +0000)] 
RIP: Modernize packet parsing style.

Enable ND_LONGJMP_FROM_TCHECK. Report invalid packets as invalid. Remove
two redundant ND_TCHECK_SIZE() instances and an improvised snapshot end
guard. Check bounds for the remaining part of the packet header after
printing version and command, not before. Lose one pointer and one
length variable in rip_print(), also account for the header size when
estimating the number of routes. Update two tests.

4 years agoRIP: Make a couple trivial protocol updates.
Denis Ovsienko [Thu, 14 Jan 2021 03:31:50 +0000 (03:31 +0000)] 
RIP: Make a couple trivial protocol updates.

Synchronize with the RIP Commands IANA registry and treat version 0 as
invalid.

4 years agoOpenFlow 1.0: Fix indentation of PORT_MOD.
Denis Ovsienko [Wed, 13 Jan 2021 15:42:01 +0000 (15:42 +0000)] 
OpenFlow 1.0: Fix indentation of PORT_MOD.

Also lose an unused constant while at it.

4 years agoRefine print_unknown_data().
Denis Ovsienko [Wed, 13 Jan 2021 15:21:25 +0000 (15:21 +0000)] 
Refine print_unknown_data().

Use __func__ and ND_MIN() for simplicity.

4 years agoAppleTalk: Modernize packet parsing style.
Denis Ovsienko [Wed, 13 Jan 2021 00:43:49 +0000 (00:43 +0000)] 
AppleTalk: Modernize packet parsing style.

Enable ND_LONGJMP_FROM_TCHECK. Report invalid packets as invalid. Remove
all improvised snapshot end guards as they were redundant. In
print_cstring() have nd_printjn() guard the snapshot end. Use tok2str()
in nbp_print(). Update two tests.

4 years agoAppleTalk: Declutter appletalk.h.
Denis Ovsienko [Tue, 12 Jan 2021 18:13:26 +0000 (18:13 +0000)] 
AppleTalk: Declutter appletalk.h.

Lose unused definitions and structures. Move most other contents into
print-atalk.c and rearrange for clarity. Lose a dead #ifdef block.

4 years agoUDP: Modernize packet parsing style.
Denis Ovsienko [Tue, 12 Jan 2021 15:52:23 +0000 (15:52 +0000)] 
UDP: Modernize packet parsing style.

Remove all ND_TCHECK_*() instances as redundant. Remove or convert a few
improvised snapshot end guards. Reduce arity of rtcp_print(). Test the
AppleTalk LAP type after testing the UDP port numbers, not before.

4 years agoUDP: Clean up address and port printing.
Denis Ovsienko [Tue, 12 Jan 2021 13:37:50 +0000 (13:37 +0000)] 
UDP: Clean up address and port printing.

udp_print() always knows whether UDP port numbers are available or not,
so split udpipaddr_print() into two functions to lose some arity, much
branching and all type casting. In the new functions test for IPv4
explicitly. In udp_print() convert duplicate code into a conditional
call to udpipaddr_print().

4 years agoEGP: Modernize packet parsing style.
Denis Ovsienko [Mon, 11 Jan 2021 14:47:59 +0000 (14:47 +0000)] 
EGP: Modernize packet parsing style.

Enable ND_LONGJMP_FROM_TCHECK. Report invalid packets as invalid.

4 years agoMention the recent EIGRP changes.
Denis Ovsienko [Mon, 11 Jan 2021 14:38:29 +0000 (14:38 +0000)] 
Mention the recent EIGRP changes.

4 years agoSLIP: Remove 4 ND_TCHECK_SIZE() calls
Francois-Xavier Le Bail [Thu, 1 Oct 2020 20:07:58 +0000 (22:07 +0200)] 
SLIP: Remove 4 ND_TCHECK_SIZE() calls

IP_HL() and TH_OFF() macros use GET_U_1().

4 years agotravis_terminate *causes* the problem on macOS; use it only on Linux.
Guy Harris [Sun, 10 Jan 2021 02:06:50 +0000 (18:06 -0800)] 
travis_terminate *causes* the problem on macOS; use it only on Linux.

More fun in the new world.

4 years agoEIGRP: Modernize packet parsing style.
Denis Ovsienko [Sun, 10 Jan 2021 00:53:43 +0000 (00:53 +0000)] 
EIGRP: Modernize packet parsing style.

Enable ND_LONGJMP_FROM_TCHECK. Report invalid packets as invalid. Remove
two redundant ND_TCHECK_*() instances. When giving up on a packet for
whatever reason, test that the rest of it is within the buffer. Do the
header length check before accessing any header data and refine the TLV
length checks. Update a test.

4 years agoEIGRP: Get the packet header fields right.
Denis Ovsienko [Sat, 9 Jan 2021 22:04:28 +0000 (22:04 +0000)] 
EIGRP: Get the packet header fields right.

In the spec the packet diagram instead of a 32-bit AS number shows a
16-bit virtual router ID followed by a 16-bit AS number, implement
that. Also add two missing flag values and use bittok2str() to print
the bitmask. Lose a stale comment and update some tests.

4 years agoTravis CI: Fix a typo in a comment
Francois-Xavier Le Bail [Sat, 9 Jan 2021 18:32:57 +0000 (19:32 +0100)] 
Travis CI: Fix a typo in a comment

[skip ci]

4 years agoRemove the no more used nd_print() function
Francois-Xavier Le Bail [Sat, 9 Jan 2021 13:07:53 +0000 (14:07 +0100)] 
Remove the no more used nd_print() function

The function to use now is: nd_printjnp().
(Added by commit 635e3cc92b72ca048a6b5b89b883980e4e1b4bdc)

4 years agoTravis: use travis_terminate instead of exit in script:.
Guy Harris [Sat, 9 Jan 2021 05:23:58 +0000 (21:23 -0800)] 
Travis: use travis_terminate instead of exit in script:.

That was the Travis maintainer's recommendation to fix the hang we were
seeing on non-x86-64 Linux coverity_scan builds.

4 years agoRemove debugging printouts.
Guy Harris [Fri, 8 Jan 2021 20:23:04 +0000 (12:23 -0800)] 
Remove debugging printouts.

The problem appears to be with the

if [ "$COVERITY_SCAN_BRANCH" = 1 ]; then exit 0; fi

line in the script: section of .travis.yml; libpcap has the line

if [ "$COVERITY_SCAN_BRANCH" = 1 ]; then echo "Coverity build - nothing more to do"; exit 0; fi

and also fails, so exiting without a message isn't the problem, and when
I tried adding

if [ "$COVERITY_SCAN_BRANCH" = 0 ]; then echo "Non-Coverity build - pstill nothing more to do"; exit 0; fi

and the ppc64le Linux builds were failing with a timeout rather than
just doing nothing - the AMD64 Linux didn't have a problem, so there's
something different about the non-x86-64 builds that's causing the "exit
0" stuff not to work.

4 years agoReplace the (void)nd_printn(..., NULL) calls by nd_printjn() calls
Francois-Xavier Le Bail [Fri, 8 Jan 2021 15:21:39 +0000 (16:21 +0100)] 
Replace the (void)nd_printn(..., NULL) calls by nd_printjn() calls

Moreover:
Remove a now useless comment.

4 years agoAdd a nd_printjn() function
Francois-Xavier Le Bail [Fri, 8 Jan 2021 15:09:41 +0000 (16:09 +0100)] 
Add a nd_printjn() function

It prints a counted filename (or other ASCII string), part of
the packet buffer, filtering out non-printable characters.
Stop if truncated (via GET_U_1/longjmp) or after n bytes,
whichever is first.
The suffix comes from: j:longJmp, n:after N bytes.

4 years agoTravis CI: Add a folded 'ldd tcpdump' (Linux builds)
Francois-Xavier Le Bail [Wed, 6 Jan 2021 15:41:09 +0000 (16:41 +0100)] 
Travis CI: Add a folded 'ldd tcpdump' (Linux builds)

4 years agoTravis CI: Add 'echo '$ cmake [...]' to the folded cmake
Francois-Xavier Le Bail [Wed, 6 Jan 2021 17:42:09 +0000 (18:42 +0100)] 
Travis CI: Add 'echo '$ cmake [...]' to the folded cmake

With this change the output can be unfolded.

4 years agoTravis/Coverity: put some debugging printouts into coverity-scan-build.
Guy Harris [Fri, 8 Jan 2021 10:10:23 +0000 (02:10 -0800)] 
Travis/Coverity: put some debugging printouts into coverity-scan-build.

4 years agoTravis: we should no longer need to set PKG_CONFIG_PATH for CMake.
Guy Harris [Fri, 8 Jan 2021 09:38:16 +0000 (01:38 -0800)] 
Travis: we should no longer need to set PKG_CONFIG_PATH for CMake.

FindPCAP.cmake should now pick up directories from CMAKE_PREFIX_PATH and
add the corresponding pkgconfig directories to PKG_CONFIG_PATH before
running pkg-config, so we shouldnt need to set PKG_CONFIG_PATH
ourselves.

We still need to do it when running the autoonf script, as there's no
equivalent for CMAKE_PREFIX_PATH in autoconf.

4 years agoCMake: add stuff from CMAKE_PREFIX_PATH to PKG_CONFIG_PATH.
Guy Harris [Fri, 8 Jan 2021 09:35:31 +0000 (01:35 -0800)] 
CMake: add stuff from CMAKE_PREFIX_PATH to PKG_CONFIG_PATH.

Pull in some code from CMake 3.12.4's FindPkgConfig.cmake to arrange
that, when running pkg-config, directories from CMAKE_PREFIX_PATH are in
the PKG_CONFIG_PATH environment variable.

We do this because we want to make sure that, if CMAKE_PREFIX_PATH is
set, and it points to a directory that contains a libpcap that has a .pc
file installed, we get that .pc file, but we don't yet want to require a
minimum of CMake 3.1 or later (CMake 3.1 and later do that
automatically) because there might be some long-term support OS version
that comes with an older version of CMake.

4 years agoBOOTP: Modernize packet parsing style.
Denis Ovsienko [Fri, 8 Jan 2021 03:23:26 +0000 (03:23 +0000)] 
BOOTP: Modernize packet parsing style.

Enable ND_LONGJMP_FROM_TCHECK. Report invalid packets as invalid. Have
nd_printn() and nd_printztn() guard the snapshot end. Replace
client_fqdn_flags() with bittok2str_nosep().

4 years agoPoint the configure script at the installed pkg-config directory in /tmp.
Guy Harris [Thu, 7 Jan 2021 22:36:52 +0000 (14:36 -0800)] 
Point the configure script at the installed pkg-config directory in /tmp.

Getting the configure script to look for the temporarily-installed
libpcap.pc file requires that we set PKG_CONFIG_PATH to
/tmp/lib/pkgconfig.

4 years agoPoint cmake at the installed pkg-config directory in /tmp.
Guy Harris [Thu, 7 Jan 2021 20:45:12 +0000 (12:45 -0800)] 
Point cmake at the installed pkg-config directory in /tmp.

Getting CMake to look for the temporarily-installed libpcap.pc file
requires that we set PKG_CONFIG_PATH to /tmp/lib/pkgconfig; otherwise,
the configuration process won't find it, and hilarity ensues.

Try turning the 'BUILD_LIBPCAP=yes CMAKE=yes' builds on, to see if that
fixes them.

4 years agoDenis has made changes to the 5.0.0 entry in CHANGES as well.
Guy Harris [Thu, 7 Jan 2021 19:41:30 +0000 (11:41 -0800)] 
Denis has made changes to the 5.0.0 entry in CHANGES as well.

[skip ci]

4 years agoUpdate a comment.
Guy Harris [Thu, 7 Jan 2021 19:40:32 +0000 (11:40 -0800)] 
Update a comment.

Apple's released ARM-based Macs, so it's no longer just a possibility.
(Travis doesn't have any, so we don't add an arm64 build for macOS.)

[skip ci]