Compiling user-provided source code and running the resulting binary
with sudo was a security problem, thus instead of fixing two no-op
blocks remove them altogether. If anyone later needs to debug features
that require higher privileges, they will need to come up with a better
solution. Simplify the debug output test condition and rephrase the
associated comment for clarity.
Running ldd on Linux only originates from the Travis CI setup, where the
OS was either Linux or macOS. However, ldd is available in BSD systems
too, and macOS seems to have its own tool for the same job.
Gokul Sivakumar [Sun, 27 Jun 2021 10:43:06 +0000 (16:13 +0530)]
Fix the misleading comment regarding "From DS", "To DS" Frame Control Flags
In the case where the "From DS" bit is not set and the "To DS" bit is set
in the Frame Control Bitmask, the comment line in the corresponding if else
block was misleading that the "From DS" bit is set and the "To DS" bit is
not set.
Francois-Xavier Le Bail [Fri, 14 May 2021 18:34:35 +0000 (20:34 +0200)]
IEEE 802.15.4: Add a bounds check
This avoids to have cp (current pointer on packet data) > ndo->ndo_snapend
in hex_and_ascii_print(), via ndo_default_print(), via ND_DEFAULTPRINT(),
in some cases.
Francois-Xavier Le Bail [Tue, 11 May 2021 10:21:28 +0000 (12:21 +0200)]
IEEE 802.15.4: Add some bounds checks
This avoids to have cp (current pointer on packet data) > ndo->ndo_snapend
in hex_and_ascii_print(), via ndo_default_print(), via ND_DEFAULTPRINT(),
in some cases.
Francois-Xavier Le Bail [Sun, 9 May 2021 17:48:01 +0000 (19:48 +0200)]
ZEP: Add a bounds check
This avoids to have cp (current pointer on packet data) > ndo->ndo_snapend
in hex_and_ascii_print(), via ndo_default_print(), via ND_DEFAULTPRINT(),
in some cases.
Paolo Abeni [Tue, 23 Mar 2021 17:29:45 +0000 (18:29 +0100)]
MPTCP: parse MPC data_len field
The RFC 8684 introduced a new field in the MPC header: the data_len.
If the client has not seen yet a DSS sub-option from the server, it
must use MPC with data_lan instead of a DSS for the first packet
carrying a data payload.
This change print the data_len, if present, after the receiver_key.
The field is already there in the existent pcap test trace, we just
need to update the expected output.
Refine README.md and some related files. [skip ci]
Lose the README symlink, it was a bad idea of mine to add it in the
first place as it made the packaging problem space bigger, not smaller.
Remove two CI badges at the top of README.md. One badge was stale
anyway, and the other does not represent the current CI configuration,
which is bigger, changes frequently and fits the web-site much better.
Remove the reference to ITA, it has been down for quite a while, it
looks like it won't re-emerge this time.
Denis Ovsienko [Mon, 29 Mar 2021 14:49:58 +0000 (15:49 +0100)]
ForCES: Refine SPARSEDATA-TLV length check.
When ilv_valid() returns a non-zero in sdatailv_print(), the amount of
bytes declared remaining may be insufficient to contain a complete
header, let alone any data. Thus do not try to hex dump the data,
instead print an error message and be done with it.
This fixes an inconsistency discovered by Francois-Xavier.
Francois-Xavier Le Bail [Sat, 27 Mar 2021 15:14:27 +0000 (16:14 +0100)]
ASCII/hex: Use nd_trunc_longjmp() in truncation cases
In functions ascii_print(), hex_and_ascii_print_with_offset() and
hex_print_with_offset().
Therefore indirectly for the functions hex_and_ascii_print(), hex_print()
and ndo_default_print().
Even if hex_and_ascii_print(), hex_print() and ascii_print() are used in
print.c after the setjmp() block with the calls:
sp and h->caplen are unmodified, ndo->ndo_snapend was restored.
1), 3) and 5) the length to print is caplen => no truncation can occur.
2), 4) and 6) the length to print is (caplen - hdrlen) after a shift of
hdrlen => no truncation can occur.
Moreover:
Update the output of three tests accordingly.
Remove an useless comment.
Fix indentation.
Denis Ovsienko [Sun, 21 Mar 2021 12:18:35 +0000 (12:18 +0000)]
CI: Apply more cleanups. [skip appveyor]
Lose travis-conditions in the Travis CI script. Simplify libpcap
cloning. Dissolve choose_libpcap() as it just packed two separate
single-use functions into one, also lose a temporary variable. Fixup
indentation.
Denis Ovsienko [Thu, 18 Mar 2021 02:14:37 +0000 (02:14 +0000)]
CI: Use libpcap.a on MATRIX_BUILD_LIBPCAP=yes. [skip appveyor]
The only way to pass tests on OpenBSD is to link with the upstream
libpcap using ../libpcap/libpcap.a (hence not using CMake) because
-lpcap always results in linking with OpenBSD /usr/lib/libpcap.so
regardless of the libpcap.a and libpcap.so that build.sh installs under
/tmp/local/.
Work around by not cleaning in ../libpcap on MATRIX_BUILD_LIBPCAP=yes,
so Autoconf can pick the static library up. On MATRIX_BUILD_LIBPCAP=no
do the cleaning so it cannot.
Denis Ovsienko [Wed, 17 Mar 2021 04:02:23 +0000 (04:02 +0000)]
Squelch compiler warnings on OpenBSD.
With these changes tcpdump passes "CFLAGS=-Werror make" on OpenBSD 6.8
AMD64, so build.sh has one less reason to fail.
gcc (GCC) 4.2.1 20070719
(also from OpenBSD clang version 10.0.1 with different wording)
./addrtoname.c: In function 'etheraddr_string':
./addrtoname.c:605: warning: passing argument 2 of 'ether_ntohost'
discards qualifiers from pointer target type
./addrtoname.c: In function 'init_etherarray':
./addrtoname.c:980: warning: passing argument 2 of 'ether_ntohost'
discards qualifiers from pointer target type
./print.c: In function 'pretty_print_packet':
./print.c:389: warning: passing argument 2 of 'ts_print' from
incompatible pointer type
./bpf_dump.c:34: warning: no previous prototype for 'bpf_dump'
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.
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.
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.
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.
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.
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.
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.