Commit Graph

7213 Commits

Author SHA1 Message Date
giulio-sido
e69972a8ef rt6: parse TLV
Parse Type Length Values (TLV) in IPv6 Routing Header as specified by
RFC 8754 [1].

[1] https://datatracker.ietf.org/doc/html/rfc8754

Signed-off-by: Giulio Sidoretti <giulio.sidoretti@uniroma2.it>
2023-04-18 14:36:06 +02:00
Francois-Xavier Le Bail
61d5da84a0 EAP: Assign ndo_protocol in the eap_print() function 2023-04-12 09:52:33 +02:00
Guy Harris
7a8e7f79c4 nhrp: handle draft-detienne-dmvpn-01, improve indication decoding.
Handle the I-D draft-detienne-dmvpn-01 traffic indication packet.

Print the error code in an error indication symbolically if it's a known
code.

Print the address fields in the mandatory part of the header for error
and traffic indication packets.
2023-04-12 00:14:53 -07:00
Francois-Xavier Le Bail
52f602dbea Geneve: Add a bounds check 2023-04-11 21:05:41 +02:00
Guy Harris
1f3cdf9e55 nhrp: add casts to squelch narrowing warnings.
Get rid of some commented-out code while we're at it.
2023-04-11 04:21:10 -07:00
Guy Harris
6c8a3facc7 Add support for dissecting RFC 2332 NHRP.
This is from the OpenBSD tcpdump.
2023-04-11 04:11:49 -07:00
Guy Harris
cebc5988bd cdp: require that the Address TLV have at least 4 bytes of data.
Specify a minimum length of 4 in the cdptlvs table, rather than having
its printer do the length check itself.
2023-04-10 23:36:21 -07:00
Guy Harris
c845af5666 cdp: show the TLV type as a 4-digit hex number.
It's 2 bytes long.
2023-04-10 22:57:58 -07:00
Guy Harris
9469f62884 cdp: support CDP TLV 0x001a.
Based on the way it's dissected in Wireshark.
2023-04-10 22:49:46 -07:00
Guy Harris
a7f57c74c9 cdp: don't explicitly check for T_DEV_ID when printing.
Instead, have an additional element in a struct cdp_tlvinfo that
indicates whether to print the TLV in all modes or only in verbose mode;
that would allow other TLVs to printed in non-verbose mode.

Also, use the usual (sizeof x / sizeof x[0]) trick to determine how big
the table is, rather than having a defined size.
2023-04-10 17:06:18 -07:00
Eamon Doyle
9c37f53dde bootp/dhcp6: DHCPv4/v6 ZTP and SZTP option support
DHCPv4: RFC8572 specifies the SZTP redirect tag.

DHCPv6: RFC5970 specifies the boot file URL, used for ZTP,
 and RFC8572 specifies the SZTP redirect tag
 The base DHCPv6 RFC3315 specifies the user class option.
2023-04-10 23:43:48 +01:00
Guy Harris
11b62366cb gre: support CDP over GRE.
Taken from the OpenBSD version of tcpdump.
2023-04-10 12:18:41 -07:00
Guy Harris
b81d83a1bd tests: wccp_redirect_gre.pcap contains SMB, so it needs two tests.
Have separate .out files for dissection of wccp_redirect_gre.pcap with,
and without, SMB dissection enabled in tcpdump.
2023-04-10 00:46:57 -07:00
Guy Harris
0a31117de8 cdp: only hex-dump unknown TLVs in verbose mode.
If we're not in verbose mode, we only show the Device ID TLV, so there's
no good reason to show a hex dump of other TLVs if we don't happen to
have a printer for them - especially given that we don't show the type
value for the TLV, so it's not clear to what type value those hex bytes
correspond.  Furthermore, the hex dump causes the non-verbose output to
be multiple lines, and causes the ", length N" to show up at the end of
the hex dump rather than at the end of the first line.

I.e., it seems as if either 1) printing the hex dump in non-verbose mode
wasn't intended or 2) it was intended by whoever intended it didn't look
into what it would involve.
2023-04-10 00:27:05 -07:00
Denis Ovsienko
86bed03b47 GRE: Refine the WCCP header commit. [skip ci]
Fixup the comment and have the case block actually fall through
consistently with the comment and the OpenBSD implementation.  Update
the test case, which now has the IPv4 packet after the WCCP header.  The
indentation does not represent the header nesting, but the same stands
for the OpenBSD implementation.
2023-04-09 11:20:41 +01:00
Guy Harris
0b0686d0d9 gre: handle Network Service Header (NSH), RFC 8300
This, and the previous multicast MPLS change, come from the OpenBSD
tcpdump.
2023-04-08 22:59:21 -07:00
Guy Harris
a9d4a1133e gre: handle multicast MPLS.
Pass ETHERTYPE_MPLS_MULTI packets to the MPLS dissector.
2023-04-08 22:45:00 -07:00
Guy Harris
7025734d3a gre: add support for WCCP redirects over GRE.
Add a test capture for it - and for GRE keepalives.

Both this and the previous GRE keepalive changes are based on OpenBSD
code.
2023-04-08 22:11:28 -07:00
Guy Harris
a3274b6d29 gre: recognize (Cisco?) GRE keepalives.
The RFCs don't seem to mention this use, but Cisco, at least, uses
packets with a protocol value of 0x0000 as keepalives.
2023-04-08 20:01:34 -07:00
Guy Harris
84161db758 gre: expand a comment, mention NVGRE. [skip ci]
When processing the key field, note that OpenBSD shows it both a a 32bit
key and an NVGRE VSID+FlowID.
2023-04-08 19:57:00 -07:00
Denis Ovsienko
23fc6548bc CHANGES: Synchronize the 4.99.x sections. [skip ci] 2023-04-07 23:16:50 +01:00
Francois-Xavier Le Bail
b3c37e3fbb CHANGES: Add a change backported to 4.99 2023-04-07 14:31:18 +02:00
Francois-Xavier Le Bail
d308963f46 Update config.{guess,sub}, timestamps 2023-01-01,2023-01-21
From repository git://git.savannah.gnu.org/config.git
2023-04-06 17:50:27 +02:00
Denis Ovsienko
b2bf252649 CHANGES: List more backported commits. [skip ci]
(cherry picked from commit af4b5f7537)
2023-04-02 21:06:38 +02:00
Michael Richardson
e9b059b7a9
Merge pull request #1039 from mspncp/ikev2-add-missing-notification-types
IKEv2: add missing notification types
2023-04-02 14:30:31 -04:00
Denis Ovsienko
f2272cbe83 Autoconf: Update a stale comment in aclocal.m4. [skip ci] 2023-03-27 00:48:33 +01:00
Denis Ovsienko
58940573f8 Autoconf: Fix --static-pcap-only test on Solaris 10. [skip appveyor]
On Solaris 10 /usr/bin/grep does not implement the -q flag:

checking for pcap-config... ../libpcap/pcap-config
grep: illegal option -- q
Usage: grep -hblcnsviw pattern file . . .
checking for pcap_loop... yes

Follow recommendation of the "Limitations of Usual Tools" section of GNU
Autoconf manual and use output redirection to fix it:

checking for pcap-config... ../libpcap/pcap-config
checking for pcap_loop... yes
2023-03-26 21:50:22 +01:00
Denis Ovsienko
19c46646c0 doc: Add more Solaris-related particulars. [skip ci] 2023-03-18 18:31:32 +00:00
Denis Ovsienko
658778cc02 man: Format "output format" subsections properly. [skip ci] 2023-03-18 16:24:26 +00:00
Francois-Xavier Le Bail
04f25f8b1e Cirrus CI: Configure with --enable-instrument-functions, Coverity task
Add the required binutils-dev package.

[skip ci]
2023-03-13 10:50:26 +01:00
Francois-Xavier Le Bail
9ca86a0927 instrument functions: Use an environment variable instead of config files
If the environment variable INSTRUMENT is
- unset or set to an empty string, print nothing, like with no
  instrumentation
- set to "all" or "a", print all the functions names
- set to "global" or "g", print only the global functions names

The configuration with --enable-instrument-functions remains.

Note that before this change, the default was to print all functions.
Now it is to print nothing. So by default 'make check' runs without errors.

This allows to run:
$ INSTRUMENT=a ./tcpdump ...
$ INSTRUMENT=g ./tcpdump ...
$ INSTRUMENT= ./tcpdump ...
or
$ export INSTRUMENT=global
$ ./tcpdump ...

This also allows to run the statically compiled binary on another host
after copying it.

It is no longer necessary to modify the configuration with:
$ make instrument_all
$ make instrument_global
$ make instrument_off
(Targets removed.)

Update .gitignore, CONTRIBUTING.md and Makefile.in accordingly.

Moreover:
Reduce the scope of a variable.
Rename a variable.
Remove '\n' in the perror() call.
Remove 2 spaces in function calls (style).

[skip ci]
2023-03-13 10:24:43 +01:00
Denis Ovsienko
eb2f8839ac man: Spell TCP header flags names. [skip ci]
In the prose use the names from respective registry [1], which says:

* "PSH", not "PUSH",
* "CWR", not "ECN CWR", and
* "ECE", not "ECN-Echo".

This does not resolve all known inconsistencies related to TCP flags,
but at least makes the problem smaller.

1: https://www.iana.org/assignments/tcp-parameters/tcp-parameters.xhtml
2023-03-12 20:25:22 +00:00
Francois-Xavier Le Bail
7be9376fdf instrument functions: Add a NULL check
Same as in tcpslice to fix a Coverity issue.

The issue was:
Null pointer dereferences  (FORWARD_NULL)
Passing null pointer "func" to "strncmp", which dereferences it.
2023-03-11 09:47:07 +01:00
Francois-Xavier Le Bail
1b838e1c5b instrument functions: Add a length check
We need space for the '\0'.

Same as in tcpslice to fix a Coverity issue.

Moreover:
Use '\0' for the null character.
2023-03-11 09:46:09 +01:00
Denis Ovsienko
5414c0e869 Refine the patterns in .gitignore. [skip ci]
Spell patterns that are supposed to apply at the source tree root only
and remove two patterns that already appear in tests/.gitignore.
2023-03-05 19:28:43 +00:00
Matthias St. Pierre
5f9da62cc5 IKEv2: add missing notification types
The notification type entries were crafted from the CSV files
provided by IANA for the [error types] resp. [status types].

[error types]:  https://www.iana.org/assignments/ikev2-parameters/ikev2-parameters-14.csv
[status types]: https://www.iana.org/assignments/ikev2-parameters/ikev2-parameters-16.csv
2023-03-05 12:44:09 +01:00
Denis Ovsienko
8ac21d1524 Get Markdown right in the previous change. [skip ci]
HTML 3 had problems, but confusing italic for bold was not one of them.
2023-03-04 23:21:31 +00:00
Denis Ovsienko
957d0adcac Fix minor issues in INSTALL.md. [skip ci] 2023-03-04 23:06:59 +00:00
Francois-Xavier Le Bail
5bb94bb36e Makefile.in: Add instrument-functions.o in CLEANFILES
It is not in LIBNETDISSECT_OBJ because it is optionally built.

[skip ci]
2023-03-01 14:54:42 +01:00
Francois-Xavier Le Bail
523f7537a3 Makefile.in: Add print-smb.o and smbutil.o in CLEANFILES
They are not in LIBNETDISSECT_OBJ because they are optionally built.

[skip ci]
2023-03-01 10:19:23 +01:00
Francois-Xavier Le Bail
c1a3d3cc29 Cirrus CI: Configure with --enable-smb in the Coverity task 2023-02-27 22:05:15 +01:00
Francois-Xavier Le Bail
2fd087001d Rename a test. The protocol is IEEE 802.11 2023-02-27 11:26:11 +01:00
Francois-Xavier Le Bail
ded255a178 man: Add the TCP flag names tcp-ece and tcp-cwr
State that these flag names became available when linking with libpcap
1.9.0 or later.
2023-02-26 15:16:11 +01:00
Denis Ovsienko
0cbc480ba7 doc: Update Haiku particulars. [skip ci]
Add a section for the 32-bit version.
2023-02-26 00:04:39 +00:00
Denis Ovsienko
161c18fa34 Untangle detection of pcap_findalldevs().
tcpdump.c requires both HAVE_PCAP_IF_T and HAVE_PCAP_FINDALLDEVS to
manage the code that depends on pcap_findalldevs().  Other than that,
the Autoconf and CMake checks that produce these two macros do not
relate directly, so having the check for pcap_if_t conditional on the
check for pcap_findalldevs() is an unnecessary complication.

More importantly, in the CMake case this places the check_type_size()
for pcap_if_t into a context with CMAKE_REQUIRED_LIBRARIES already set
to PCAP_LIBRARIES.  This works only if check_type_size() does not have
to check for <sys/types.h>, <stdint.h> or <stddef.h> implicitly.  This
was the case so long as another check_type_size() before the
CMAKE_REQUIRED_LIBRARIES change made the implicit checks and cached the
results, but removing that earlier instance resulted in a warning:

  Policy CMP0075 is not set: Include file check macros honor
  CMAKE_REQUIRED_LIBRARIES.  Run "cmake --help-policy CMP0075" for policy
  details.  Use the cmake_policy command to set the policy and suppress this
  warning.

  CMAKE_REQUIRED_LIBRARIES is set to:

    /usr/lib/x86_64-linux-gnu/libpcap.so

  For compatibility with CMake 3.11 and below this check is ignoring it.

To fix that, in both Autoconf and CMake make the two checks separate and
unconditional and place the check for pcap_if_t where it fits better.
In CMake remove the earlier workaround with in6_addr.
2023-02-25 18:02:18 +00:00
Denis Ovsienko
00fd858c85 CI: Introduce TEST_RELEASETAR. [skip ci]
Same as in tcpslice and libpcap.
2023-02-25 17:52:18 +00:00
Guy Harris
97c31661ed tcpdump.c: fix a comment. [skip ci]
Some versions of Mac OS X (as it was then called) *did*, in fact, ship
with a libpcap that had pcap_findalldevs() but a pcap.h that didn't
define pcap_if_t; it's not a question of "may ship", it's a fact of "did
ship".
2023-02-25 01:51:45 -08:00
Francois-Xavier Le Bail
d7769a9a90 State there are currently no OS dependent defines and prototypes
The last header was removed by commit
6008cb83b7.
2023-02-24 09:46:27 +01:00
Guy Harris
008b90f611 CMake: balance cmake_push_check_state() and cmake_pop_check_state().
We didn't completely pop the check state after we finished the checks
for libpcap.
2023-02-22 22:38:19 -08:00
Denis Ovsienko
10b807441e Detect OS IPv6 support using AF_INET6 only.
tcpdump source code has not been using struct in6_addr since commit
0c9cfdc in 2019, so lose the conditional structure declaration, which is
a no-op.

Since commit de7c619 in 2015 netdissect-stdinc.h on Windows defines
HAVE_OS_IPV6_SUPPORT if AF_INET6 if defined, which makes it equivalent
to AF_INET6.  On Unix-like systems taking struct in6_addr out of scope
would make HAVE_OS_IPV6_SUPPORT equivalent to AF_INET6, thus after
removing struct in6_addr remove HAVE_OS_IPV6_SUPPORT together with
Autoconf and CMake checks that define it.  Leave an unrelated CMake
workaround in place for later debugging.

On Windows do not define AF_INET6 if it is not defined, which makes
AF_INET6 a universal indicator of the OS IPv6 support on all supported
OSes.  The few remaining use cases that genuinely need AF_INET6 use it
to make OS API calls, so if the macro is not defined, it most likely
means such an API call in the best case would return just a well-formed
error status.  With this in mind, in win32_gethostbyaddr() and
ip6addr_string() guard all IPv6-specific code with #ifdef AF_INET6.  In
tcpdump.c add a comment to note why a guard is not required for
Casper-specific conditional code that uses AF_INET6.

This way when the OS does not support IPv6, IPv6 addresses will not
resolve to names, which is expected.  Other than that, tcpdump should be
able to process IPv6 addresses the usual way regardless if the OS would
be able to process the packets with these addresses.
2023-02-22 20:05:58 +00:00