]> The Tcpdump Group git mirrors - tcpdump/log
tcpdump
3 years agoCHANGES: another fix now in 4.99.2. [skip ci]
Guy Harris [Sat, 19 Mar 2022 21:18:55 +0000 (14:18 -0700)] 
CHANGES: another fix now in 4.99.2. [skip ci]

3 years agoCHANGES: add another now-backported fix. [skip ci]
Guy Harris [Sat, 19 Mar 2022 21:16:05 +0000 (14:16 -0700)] 
CHANGES: add another now-backported fix. [skip ci]

3 years agoCHANGES: add a change recently backported to 4.99.2. [skip ci]
Guy Harris [Sat, 19 Mar 2022 21:05:18 +0000 (14:05 -0700)] 
CHANGES: add a change recently backported to 4.99.2. [skip ci]

3 years agoCI: Relax the illumos exemption rule. [skip appveyor]
Denis Ovsienko [Fri, 11 Mar 2022 15:07:08 +0000 (15:07 +0000)] 
CI: Relax the illumos exemption rule. [skip appveyor]

As it turns out, the same warnings reproduce with other Clang versions
(at least 11) and other illumos distributions (at least OmniOS), so omit
Clang version in the pattern.

3 years agoRename two pcapng test files to .pcapng
Francois-Xavier Le Bail [Tue, 8 Mar 2022 15:37:42 +0000 (16:37 +0100)] 
Rename two pcapng test files to .pcapng

3 years agoFix two invalid tests
Francois-Xavier Le Bail [Tue, 8 Mar 2022 09:28:35 +0000 (10:28 +0100)] 
Fix two invalid tests

Fix these cppcheck warnings:
addrtoname.c:1288:11: warning: Checking if unsigned expression 'num'
is less than zero. [unsignedLessThanZero]
 if (num  <= 0) {
          ^
addrtoname.c:1308:11: warning: Checking if unsigned expression 'num'
is less than zero. [unsignedLessThanZero]
 if (num  <= 0) {
          ^

3 years agoPPP: Change the pointer to packet data
Francois-Xavier Le Bail [Mon, 7 Mar 2022 14:09:43 +0000 (15:09 +0100)] 
PPP: Change the pointer to packet data

Thus it can be used for debugging.

3 years agoRESP: Remove an unnecessary test
Francois-Xavier Le Bail [Sun, 6 Mar 2022 08:53:28 +0000 (09:53 +0100)] 
RESP: Remove an unnecessary test

Moreover:
Remove an unneeded variable.

3 years agoRevert "Clean a bunch of fuzzed files not to fuzz the container."
Guy Harris [Sat, 5 Mar 2022 02:03:41 +0000 (18:03 -0800)] 
Revert "Clean a bunch of fuzzed files not to fuzz the container."

This reverts commit a02c2faeec982d233a32b6db4df20ce817dd1563.

That zeroed out bits in the non-reserved portion of the field; the
reserved portion was already zero.

3 years agoClean a bunch of fuzzed files not to fuzz the container.
Guy Harris [Sat, 5 Mar 2022 00:01:01 +0000 (16:01 -0800)] 
Clean a bunch of fuzzed files not to fuzz the container.

For some reason pcap fuzzers just *love* to fuzz the "link-layer type
plus other stuff" part of the pcap file header.  That can produce a file
that has non-zero values in reserved fields, which means it can get
rejected well before being handed to anything for dissection.

Clear out one of the reserved parts of that field, as we'll be changing
libpcap to check for non-zero values and reporting an error.

3 years agoAdd a const qualifier
Francois-Xavier Le Bail [Fri, 4 Mar 2022 13:21:44 +0000 (14:21 +0100)] 
Add a const qualifier

3 years agoASCII/hex: Rename a variable
Francois-Xavier Le Bail [Fri, 4 Mar 2022 09:23:59 +0000 (10:23 +0100)] 
ASCII/hex: Rename a variable

s/oset/offset/

Moreover:
Fix indentation.

3 years agoRESP: Fix an invalid check
Francois-Xavier Le Bail [Wed, 2 Mar 2022 20:48:43 +0000 (21:48 +0100)] 
RESP: Fix an invalid check

Fix this cppcheck warning:
print-resp.c:215:22: warning: Checking if unsigned expression 'length'
is less than zero. [unsignedLessThanZero]
    if(!bp || length <= 0)
                     ^

3 years agoRX: Add a const qualifier
Francois-Xavier Le Bail [Wed, 2 Mar 2022 20:13:13 +0000 (21:13 +0100)] 
RX: Add a const qualifier

3 years agoTCP: Fix an invalid check
Francois-Xavier Le Bail [Wed, 2 Mar 2022 16:46:27 +0000 (17:46 +0100)] 
TCP: Fix an invalid check

Fix this cppcheck warning:
print-tcp.c:711:20: warning: Checking if unsigned expression 'length'
is less than zero. [unsignedLessThanZero]
        if (length <= 0)
                   ^

3 years agoESP: Add a const qualifier
Francois-Xavier Le Bail [Wed, 2 Mar 2022 16:07:30 +0000 (17:07 +0100)] 
ESP: Add a const qualifier

3 years agoinstrument functions: Reduce the scope of a variable
Francois-Xavier Le Bail [Wed, 2 Mar 2022 13:55:27 +0000 (14:55 +0100)] 
instrument functions: Reduce the scope of a variable

3 years agoUpdate config.{guess,sub}, timestamps 2022-01-09,2022-01-03
Francois-Xavier Le Bail [Tue, 22 Feb 2022 18:28:19 +0000 (19:28 +0100)] 
Update config.{guess,sub}, timestamps 2022-01-09,2022-01-03

From repository git://git.savannah.gnu.org/config.git

3 years agoRADIUS: Remove a no more used label 'trunc'
Francois-Xavier Le Bail [Sun, 20 Feb 2022 11:58:32 +0000 (12:58 +0100)] 
RADIUS: Remove a no more used label 'trunc'

Fix the previous commit.

3 years agoRADIUS: Use GET_U_1() to replace a direct dereference
Francois-Xavier Le Bail [Sun, 20 Feb 2022 10:44:03 +0000 (11:44 +0100)] 
RADIUS: Use GET_U_1() to replace a direct dereference

Remove some now unnecessary ND_TCHECK_*().

3 years agoISAKMP: Use GET_U_1() to replace a direct dereference
Francois-Xavier Le Bail [Fri, 18 Feb 2022 22:32:10 +0000 (23:32 +0100)] 
ISAKMP: Use GET_U_1() to replace a direct dereference

Moreover:
Remove an unnecessary cast and an & operator.

3 years agoOSPF: Remove two unnecessary dereferences
Francois-Xavier Le Bail [Fri, 18 Feb 2022 19:34:18 +0000 (20:34 +0100)] 
OSPF: Remove two unnecessary dereferences

Remove also two unnecessary ND_TCHECK_SIZE().

3 years agoOSPFv3: Remove two unnecessary dereferences
Francois-Xavier Le Bail [Fri, 18 Feb 2022 18:55:41 +0000 (19:55 +0100)] 
OSPFv3: Remove two unnecessary dereferences

Remove also two unnecessary ND_TCHECK_SIZE().

Moreover:
Remove an unnecessary cast.

3 years agoman: Put commit 4a904f4 right. [skip ci]
Denis Ovsienko [Sun, 13 Feb 2022 10:39:46 +0000 (10:39 +0000)] 
man: Put commit 4a904f4 right. [skip ci]

3 years agoBGP: Refine the previous commit.
Denis Ovsienko [Sat, 12 Feb 2022 17:46:03 +0000 (17:46 +0000)] 
BGP: Refine the previous commit.

Fix references in some comments, reduce scope of a couple variables,
lose an excess ND_TCHECK_LEN() before nd_printjn() and update the change
log.

3 years agobgp: Shutdown message can be up to 255 bytes length according to rfc9003
Donatas Abraitis [Wed, 2 Feb 2022 12:28:21 +0000 (14:28 +0200)] 
bgp: Shutdown message can be up to 255 bytes length according to rfc9003

Signed-off-by: Donatas Abraitis <[email protected]>
3 years agoZephyr: Fix the ZEPHYR_PRINT() macro
Francois-Xavier Le Bail [Wed, 9 Feb 2022 18:12:26 +0000 (19:12 +0100)] 
Zephyr: Fix the ZEPHYR_PRINT() macro

A block is needed.

3 years agoBGP: Fix parsing the AIGP attribute
Francois-Xavier Le Bail [Wed, 9 Feb 2022 13:01:40 +0000 (14:01 +0100)] 
BGP: Fix parsing the AIGP attribute

There was an invalid ND_TCHECK_LEN(), thus the AIGP metric attribute
at the end of an update message was incorrectly shown as truncated.

Remove it because the data fetching is secured by GET_BE_U_8 and
print_unknown_data.

Add a test file with AIGP attribute at the end of an update message.

This should fix GitHub issue #975.

Remark:
This code need more updates on length checks to change some 'truncated'
process to 'invalid' process.

3 years agoZephyr: Avoid printing non-ASCII characters
Francois-Xavier Le Bail [Mon, 7 Feb 2022 22:14:52 +0000 (23:14 +0100)] 
Zephyr: Avoid printing non-ASCII characters

The "%s" format is a risk (no non-ASCII filtering), thus use
the fn_print_str() function via the ZEPHYR_PRINT() macro.

3 years agoZephyr: Fix indentation
Francois-Xavier Le Bail [Mon, 7 Feb 2022 21:39:34 +0000 (22:39 +0100)] 
Zephyr: Fix indentation

Replace 19 instances of 8 spaces at beginning of a line by <tab>
like in all other cases (109).

3 years agoICMP: Avoid printing non-ASCII characters in Interface Name
Francois-Xavier Le Bail [Mon, 7 Feb 2022 17:57:12 +0000 (18:57 +0100)] 
ICMP: Avoid printing non-ASCII characters in Interface Name

The "%.*s" format is a risk (no non-ASCII filtering), thus use
the nd_printjnp() function.

3 years agoICMP: Fix printing the Interface Name Sub-Object
Francois-Xavier Le Bail [Mon, 7 Feb 2022 14:51:36 +0000 (15:51 +0100)] 
ICMP: Fix printing the Interface Name Sub-Object

RFC 5837 - 4.3.  Interface Name Sub-Object
"The Interface Name Sub-Object MUST have a length that is a multiple
 of 4 octets and MUST NOT exceed 64 octets.

 The Length field represents the length of the Interface Name Sub-
 Object, including the length and the interface name in octets."

The length of the interface name to print is: (Length field) - 1.
The offset is only: Length field

Add sanity checks: Multiple of 4 octets, <= 64 octets.

Fix the icmp-rfc5837.pcap test.
The interface name length in octets is 63, thus the length field must be 64.
Update also the ICMP Multi-Part Extensions checksum.

Keep an invalid length field in icmp-cksum-oobr-2.pcap.

Update the output of two tests accordingly.

3 years agoICMP: Print the length field of the Interface Name Sub-Object
Francois-Xavier Le Bail [Mon, 7 Feb 2022 13:25:16 +0000 (14:25 +0100)] 
ICMP: Print the length field of the Interface Name Sub-Object

Update the output of two tests accordingly.

Moreover:
Fix indentation.

3 years agoDo not list CVE-2018-16301 twice in CHANGES. [skip ci]
Denis Ovsienko [Mon, 7 Feb 2022 15:52:44 +0000 (15:52 +0000)] 
Do not list CVE-2018-16301 twice in CHANGES. [skip ci]

Remove the earlier incorrect entry: at the time of tcpdump release 4.9.3
the problem was not fixed, and it was not related to libpcap.

3 years agoICMP: Fix indentation in parsing multi-part message extensions code
Francois-Xavier Le Bail [Mon, 7 Feb 2022 12:27:07 +0000 (13:27 +0100)] 
ICMP: Fix indentation in parsing multi-part message extensions code

Use spaces like in other lines in this part of the code.

Moreover:
Remove some blank lines.

3 years agoAdd CVE-2018-16301 to CHANGES. [skip ci]
Denis Ovsienko [Mon, 7 Feb 2022 12:36:46 +0000 (12:36 +0000)] 
Add CVE-2018-16301 to CHANGES. [skip ci]

One of the effects of commit faf8fb7 was fixing a buffer overflow that
was discovered and reported by Include Security (case reference "F2").
Their work was sponsored by Mozilla under the Secure Open Source
program.  The vulnerability was assigned CVE-2018-16301 on 2018-09-01
(MITRE request reference "scr562827"), but was not properly documented
afterwards.  Add a line to the change log section for 4.99.0, which at
the time of this writing is the first release to incorporate the fix.

See also https://github.com/the-tcpdump-group/libpcap/issues/855

3 years agoICMPv6: Remove an unused macro and extra blank lines
Francois-Xavier Le Bail [Mon, 7 Feb 2022 10:12:35 +0000 (11:12 +0100)] 
ICMPv6: Remove an unused macro and extra blank lines

[skip ci]

3 years agoICMPv6: Add a comment about "don't use GET_IP6ADDR_STRING()"
Francois-Xavier Le Bail [Sun, 6 Feb 2022 19:54:50 +0000 (20:54 +0100)] 
ICMPv6: Add a comment about "don't use GET_IP6ADDR_STRING()"

[skip ci]

3 years agoICMPv6: Modernize RPL DAO-ACK parsing
Francois-Xavier Le Bail [Sun, 6 Feb 2022 19:49:41 +0000 (20:49 +0100)] 
ICMPv6: Modernize RPL DAO-ACK parsing

Use GET_IP6ADDR_STRING(), ND_ICHECK_U() and nd_print_invalid().
Remove the redundant ND_TCHECK*() instances and the trunc label.
Fix indentation.

3 years agoICMPv6: Modernize RPL DAO parsing
Francois-Xavier Le Bail [Sun, 6 Feb 2022 19:36:37 +0000 (20:36 +0100)] 
ICMPv6: Modernize RPL DAO parsing

Use GET_IP6ADDR_STRING(), ND_ICHECK_U() and nd_print_invalid().
Remove the redundant ND_TCHECK*() instances and the trunc label.
Fix indentation.

3 years agoICMPv6: Update the output to show a RPL DAO field name
Francois-Xavier Le Bail [Sun, 6 Feb 2022 13:12:20 +0000 (14:12 +0100)] 
ICMPv6: Update the output to show a RPL DAO field name

3 years agoICMPv6: Add a length check in the rpl_dio_print() function
Francois-Xavier Le Bail [Sun, 6 Feb 2022 08:59:58 +0000 (09:59 +0100)] 
ICMPv6: Add a length check in the rpl_dio_print() function

3 years agoICMPv6: Use GET_IP6ADDR_STRING() in the rpl_dio_print() function
Francois-Xavier Le Bail [Sat, 5 Feb 2022 20:43:39 +0000 (21:43 +0100)] 
ICMPv6: Use GET_IP6ADDR_STRING() in the rpl_dio_print() function

Remove a redundant ND_TCHECK_SIZE().
Remove the trunc label.
Remove an unnecessary variable.
Fix indentation.

3 years agoHNCP: Add a comment about "don't use GET_IPADDR_STRING()"
Francois-Xavier Le Bail [Sat, 5 Feb 2022 18:01:52 +0000 (19:01 +0100)] 
HNCP: Add a comment about "don't use GET_IPADDR_STRING()"

3 years agoRADIUS: Add a comment about "don't use GET_IP6ADDR_STRING()"
Francois-Xavier Le Bail [Sat, 5 Feb 2022 17:28:20 +0000 (18:28 +0100)] 
RADIUS: Add a comment about "don't use GET_IP6ADDR_STRING()"

3 years agoEGP: Add two comments about "don't use GET_IPADDR_STRING()"
Francois-Xavier Le Bail [Sat, 5 Feb 2022 13:40:18 +0000 (14:40 +0100)] 
EGP: Add two comments about "don't use GET_IPADDR_STRING()"

3 years agoUse more S_SUCCESS and S_ERR_HOST_PROGRAM in main()
Francois-Xavier Le Bail [Fri, 4 Feb 2022 10:13:25 +0000 (11:13 +0100)] 
Use more S_SUCCESS and S_ERR_HOST_PROGRAM in main()

3 years agoinstrument functions: Remove tcpdump_ prefix from flag files
Francois-Xavier Le Bail [Wed, 2 Feb 2022 10:52:05 +0000 (11:52 +0100)] 
instrument functions: Remove tcpdump_ prefix from flag files

This make easier to use instrument-functions.c in other projects.

3 years agobgp: Parse rfc9072 (Extended Optional Parameters Length for BGP OPEN Message)
Donatas Abraitis [Wed, 2 Feb 2022 09:32:51 +0000 (11:32 +0200)] 
bgp: Parse rfc9072 (Extended Optional Parameters Length for BGP OPEN Message)

Signed-off-by: Donatas Abraitis <[email protected]>
3 years agopflog: use BSD socket AF numbers, not RFC 1700 AF numbers.
Guy Harris [Mon, 31 Jan 2022 02:13:48 +0000 (18:13 -0800)] 
pflog: use BSD socket AF numbers, not RFC 1700 AF numbers.

3 years agoFix names for action values.
Guy Harris [Sun, 30 Jan 2022 20:34:43 +0000 (12:34 -0800)] 
Fix names for action values.

3 years agoRun the test that fails on OpenBSD only if we're not on OpenBSD.
Guy Harris [Sun, 30 Jan 2022 08:00:33 +0000 (00:00 -0800)] 
Run the test that fails on OpenBSD only if we're not on OpenBSD.

Don't test whether we have net/if_pflog.h, test whether we're on
OpenBSD; we no longer check for net/if_pflog.h in the configure script,
and that's not a valid "is this OpenBSD?" check in any case, as other
*BSDs have it as well.

3 years agoHandle DLT_PFLOG on all OSes.
Guy Harris [Sun, 30 Jan 2022 06:30:33 +0000 (22:30 -0800)] 
Handle DLT_PFLOG on all OSes.

Don't pad the pflog header with BPF_WORDALIGN(); round up to a multiple
of 4, instead, as that's what all but FreeBSD do, and FreeBSD used to do
that and should go back to doing so (kern/261566).

Don't rely on the OS's pflog include files to define direction types,
reason types, action types, or the layout of the header; instead, define
them ourselves in a header of our own, with #ifs to select the ones that
are only on some platforms.  That way, it'll handle some fields and
field values (the ones common to all OSes with pflog) on all OSes, even
ones without pflog.

That also expands the set of direction, reason, and action codes to what
various *BSDs and Darwin support.

Also, handle all the different AF_INET6 values in various *BSDs and
Darwin.

3 years agoinstrument functions: Enhance the output
Francois-Xavier Le Bail [Mon, 24 Jan 2022 08:56:21 +0000 (09:56 +0100)] 
instrument functions: Enhance the output

If entering in a function, print also the calling function name with
file name and line number. There may be a small shift in the line number.

In some cases, with Clang 11, the file number is unknown (printed '??')
or the line number is unknown (printed '?'). In this case, use GCC.

To print nothing, like with no instrumentation:
$ make instrument_off

As before, the following commands are available:
To configure the printing of only the global functions names:
$ make instrument_global

To go back to print all the functions names:
$ make instrument_all

The library libbfd is used, therefore the binutils-dev package is required.

3 years agorealtek: redo the checks for different protocols.
Guy Harris [Wed, 26 Jan 2022 07:43:57 +0000 (23:43 -0800)] 
realtek: redo the checks for different protocols.

Do it iwth an if chain, which is somewhat the equivalent of what
Wireshark does (it uses heuristic dissectors; our ifs do the same checks
that Wireshark's heuristic dissectors do).

That makes it a bit more obvious that the necessary tests are somewhat
weird, thanks to Realtek not just deciding to make the first octet a
protocol discriminator *even for switch tags*.

We also treat a first octet of 0x23 as meanin RLDP, just as Wireshark
does, as some switch chips use 0x23 for loop detection packets.

Shuffle some comments while we're at it (and epand the one for RLDP to
match all the stuff going on with various RLDP packets).

3 years agoRename two pcapng test files to .pcapng
Francois-Xavier Le Bail [Sun, 23 Jan 2022 11:27:31 +0000 (12:27 +0100)] 
Rename two pcapng test files to .pcapng

3 years agoinstrument functions: Remove a now useless #include
Francois-Xavier Le Bail [Sun, 23 Jan 2022 10:13:03 +0000 (11:13 +0100)] 
instrument functions: Remove a now useless #include

Remove: #include <dlfcn.h>
No more use of dladdr().

This is a follow-up to 6d854639ea6702adc7fcb077361ae00d2229f875.

3 years agobgp: Print enhanced route refresh message subtype
Donatas Abraitis [Sun, 31 Oct 2021 19:56:11 +0000 (21:56 +0200)] 
bgp: Print enhanced route refresh message subtype

Add a test to check if we print subtype for enhanced route refresh msg.

Signed-off-by: Donatas Abraitis <[email protected]>
3 years agobgp: Check if Enhanced route-refresh capability is printed properly
Donatas Abraitis [Sun, 31 Oct 2021 19:37:54 +0000 (21:37 +0200)] 
bgp: Check if Enhanced route-refresh capability is printed properly

Signed-off-by: Donatas Abraitis <[email protected]>
3 years agobgp: Print Enhanced route refresh capability
Donatas Abraitis [Sun, 31 Oct 2021 19:32:45 +0000 (21:32 +0200)] 
bgp: Print Enhanced route refresh capability

No need for a decoder here.

The Capability Length field of this capability is zero.

Update the output of a test accordingly.

Signed-off-by: Donatas Abraitis <[email protected]>
3 years agoRename print-rrcp.c to print-realtek.c.
Guy Harris [Sun, 23 Jan 2022 09:46:20 +0000 (01:46 -0800)] 
Rename print-rrcp.c to print-realtek.c.

It handles more than just RRCP, so rename it appropriately.

3 years agoSupport more Realtek protocols than RRCP.
Guy Harris [Sun, 23 Jan 2022 09:44:16 +0000 (01:44 -0800)] 
Support more Realtek protocols than RRCP.

The Ethertype 0x8899 is used by Realtek for several over-the-wire
protocols, as well as for supplying tag information to a host CPU from a
Realtek chip.  Add code to handle protocols other than RRCP, although we
don't fully dissect all of them.

3 years agoFix indentation and remove a blank line
Francois-Xavier Le Bail [Sat, 22 Jan 2022 17:39:52 +0000 (18:39 +0100)] 
Fix indentation and remove a blank line

[skip ci]

3 years agoMakefile.in: Ignore build errors with nm command in Solaris
Francois-Xavier Le Bail [Sat, 22 Jan 2022 13:31:38 +0000 (14:31 +0100)] 
Makefile.in: Ignore build errors with nm command in Solaris

The default output format is different and the grep don't find anything.

To be fixed later.

3 years agoautoconf: Enhance the --enable-instrument-functions result output
Francois-Xavier Le Bail [Thu, 20 Jan 2022 18:26:22 +0000 (19:26 +0100)] 
autoconf: Enhance the --enable-instrument-functions result output

It prints now, by default, also the static functions names.

To configure the printing of only the global functions names, as before:
$ make instrument_global

To go back to print all the functions names:
$ make instrument_all

In case of truncation, the indentation level is reset to its previous
level in pretty_print_packet().

[skip ci]

3 years agoCirrus CI: Use GCC 11 for FreeBSD. [skip appveyor]
Denis Ovsienko [Thu, 20 Jan 2022 15:23:53 +0000 (15:23 +0000)] 
Cirrus CI: Use GCC 11 for FreeBSD. [skip appveyor]

3 years agoman: Refer to pcap-filter(7) early. [skip ci]
Denis Ovsienko [Thu, 20 Jan 2022 15:22:21 +0000 (15:22 +0000)] 
man: Refer to pcap-filter(7) early. [skip ci]

3 years agoReplace some 'if(' with 'if (' (style)
Francois-Xavier Le Bail [Thu, 20 Jan 2022 13:37:33 +0000 (14:37 +0100)] 
Replace some 'if(' with 'if (' (style)

[skip ci]

3 years agoGet rid of the Windows ether_ntohost().
Guy Harris [Wed, 19 Jan 2022 22:38:39 +0000 (14:38 -0800)] 
Get rid of the Windows ether_ntohost().

We don't use it, and there's no Windows tradition of an "ethers file"
that I know of, so I'm not sure there's a reason to use it.

Fixes GitHub issue #971.

3 years agoESP: Put static and int on the same line (style)
Francois-Xavier Le Bail [Wed, 19 Jan 2022 10:58:36 +0000 (11:58 +0100)] 
ESP: Put static and int on the same line (style)

[skip ci]

3 years agoUpdate tok2strbuf() to a static function
Francois-Xavier Le Bail [Tue, 18 Jan 2022 10:09:38 +0000 (11:09 +0100)] 
Update tok2strbuf() to a static function

It is only used in util-print.c.

3 years agoRename a pcapng test file to .pcapng
Francois-Xavier Le Bail [Mon, 17 Jan 2022 21:56:44 +0000 (22:56 +0100)] 
Rename a pcapng test file to .pcapng

3 years agoautoconf: Add the option to print functions names (entry and exit)
Francois-Xavier Le Bail [Mon, 10 Jan 2022 15:37:07 +0000 (16:37 +0100)] 
autoconf: Add the option to print functions names (entry and exit)

This should help some debugging processes.

Usage:
./configure --enable-instrument-functions

Generate instrumentation calls for entry and exit to functions.
Just after function entry and just before function exit, these
profiling functions are called and print the function names with
indentation and call level.

To instument a static function, remove temporarily the static specifier.

In case of truncation, the indentation level is reset currently to 1 in
pretty_print_packet(), main is level 0.

3 years agoAdd --print-sampling option to print every Nth packet
Nathan O'Sullivan [Mon, 17 Jan 2022 00:05:15 +0000 (10:05 +1000)] 
Add --print-sampling option to print every Nth packet

New option `--print-sampling=NTH` will parse and print every NTH packet,
with all other packets producing no output. This option enables
`--print` and `-S` flags.

Print sampling is useful for real-time inspection of an interface with
a high packet rate, or initial inspection of large capture files.

3 years agoMakefile.in: Sort the files in EXTRA_DIST
Francois-Xavier Le Bail [Mon, 17 Jan 2022 15:14:46 +0000 (16:14 +0100)] 
Makefile.in: Sort the files in EXTRA_DIST

3 years agoMemory allocator: Update nd_add_alloc_list() to a static function
Francois-Xavier Le Bail [Mon, 17 Jan 2022 14:31:53 +0000 (15:31 +0100)] 
Memory allocator: Update nd_add_alloc_list() to a static function

3 years agoautoconf: Use AS_HELP_STRING macro instead of AC_HELP_STRING
Francois-Xavier Le Bail [Mon, 17 Jan 2022 11:11:21 +0000 (12:11 +0100)] 
autoconf: Use AS_HELP_STRING macro instead of AC_HELP_STRING

Avoid the warning: The macro `AC_HELP_STRING' is obsolete.

3 years agolibsmi: Use AS_HELP_STRING macro in configure.ac
Francois-Xavier Le Bail [Mon, 17 Jan 2022 10:33:40 +0000 (11:33 +0100)] 
libsmi: Use AS_HELP_STRING macro in configure.ac

Update the help message: State that the default is yes *if available*.

3 years agoSMB: Use AS_HELP_STRING macro in configure.ac
Francois-Xavier Le Bail [Mon, 17 Jan 2022 09:52:51 +0000 (10:52 +0100)] 
SMB: Use AS_HELP_STRING macro in configure.ac

3 years agoIPv6: Remove an obsolete code in an always-false #if wrapper
Francois-Xavier Le Bail [Sat, 15 Jan 2022 13:47:15 +0000 (14:47 +0100)] 
IPv6: Remove an obsolete code in an always-false #if wrapper

RFC 1883 is obsolete.

Moreover:
Fix indentation.

3 years agoDCCP: Modernize packet parsing
Francois-Xavier Le Bail [Sat, 1 Jan 2022 11:40:59 +0000 (12:40 +0100)] 
DCCP: Modernize packet parsing

Enable ND_LONGJMP_FROM_TCHECK.
Use ND_ICHECK*() for length checks.
Fix some length checks.
Add and use standard "invalid" sections.
Remove the redundant ND_TCHECK*() instances.
Add a ND_TCHECK_1().
Factorize some codes.
Update default format for tok2str() calls.
Indicate better invalid packet types, invalid option types,
invalid reset codes and invalid features.
Fix process for DCCP_OPTION_CHANGE_L/DCCP_OPTION_CHANGE_R, not the
same that DCCP_OPTION_CONFIRM_L/DCCP_OPTION_CONFIRM_R process.
Remove spaces in some dccp_feature_num_str[] strings.
Update the output of a test accordingly.

3 years agoDCCP: Rename a variable
Francois-Xavier Le Bail [Thu, 30 Dec 2021 19:56:38 +0000 (20:56 +0100)] 
DCCP: Rename a variable

s/len/length/
This change allows to have a better error message in a next commit
with ND_ICHECK_U().

3 years agoDCCP: Factorize some code
Francois-Xavier Le Bail [Fri, 14 Jan 2022 16:19:24 +0000 (17:19 +0100)] 
DCCP: Factorize some code

All the code is in verbose mode.

3 years agoDCCP: Get rid of trailing commas in lists
Francois-Xavier Le Bail [Fri, 14 Jan 2022 14:02:52 +0000 (15:02 +0100)] 
DCCP: Get rid of trailing commas in lists

3 years agoWHOIS: Add its own printer source file and printer function
Francois-Xavier Le Bail [Fri, 14 Jan 2022 12:23:28 +0000 (13:23 +0100)] 
WHOIS: Add its own printer source file and printer function

Like all other text protocols.

This is a follow-up to 185b7ce04b182d2d7e490f23a3f0c7b9ea5916e4.

3 years agoENC: Lose an unused variable after commit 1de5051.
Denis Ovsienko [Thu, 13 Jan 2022 18:08:00 +0000 (18:08 +0000)] 
ENC: Lose an unused variable after commit 1de5051.

NetBSD 9.2/AArch64
clang version 13.0.0

./print-enc.c:103:8: error: variable 'caplen' set but not used
 [-Werror,-Wunused-but-set-variable]

3 years agobgp: Deprecate DPA, ADVERTISER and RCID_PATH path attributes
Donatas Abraitis [Sun, 9 Jan 2022 19:02:59 +0000 (21:02 +0200)] 
bgp: Deprecate DPA, ADVERTISER and RCID_PATH path attributes

rfc6938

Signed-off-by: Donatas Abraitis <[email protected]>
3 years agoThe new home of Npcap is npcap.com, not npcap.org.
Guy Harris [Thu, 6 Jan 2022 23:53:02 +0000 (15:53 -0800)] 
The new home of Npcap is npcap.com, not npcap.org.

(npcap.org redirects there.)

[skip ci]

3 years agoappveyor CI: update Npcap site, update to 1.12 SDK
Guy Harris [Thu, 6 Jan 2022 23:05:07 +0000 (15:05 -0800)] 
appveyor CI: update Npcap site, update to 1.12 SDK

As per the comments on https://github.com/nmap/npcap/issues/576, we
should go to npcap.com for Npcap-related stuff.

The current SDK is 1.12; use that.

[skip cirrus] [skip buildbot]

3 years agoDCCP: Rename a function parameter and simplify code
Francois-Xavier Le Bail [Thu, 6 Jan 2022 20:08:17 +0000 (21:08 +0100)] 
DCCP: Rename a function parameter and simplify code

s/option/bp/
Use new 'option' variable to store the option value.

Moreover:
Better indentation.

3 years agoOpenFlow: Refine more length checks.
Denis Ovsienko [Wed, 5 Jan 2022 22:57:45 +0000 (22:57 +0000)] 
OpenFlow: Refine more length checks.

In print-openflow-1.0.c and print-openflow-1.3.c replace the remaining
"goto invalid" checks with ND_ICHECK_U() and ND_ICHECKMSG_U().  Redo the
changes from commit 1ce16ea: use the same order of arguments and the
same comparison operators as before the change and lose the unsigned
compensation, which is no longer required.  Add another test case using
a malformed packet from Francois-Xavier.

3 years agoUse unified diff by default. [skip ci]
Denis Ovsienko [Tue, 4 Jan 2022 21:53:00 +0000 (21:53 +0000)] 
Use unified diff by default. [skip ci]

GNU/Linux (specifically, the GNU part), FreeBSD, NetBSD, OpenBSD,
illumos and even Solaris 9 and AIX 7.1 all have a diff that supports
"-u" for unified output format.  Let that be the default to make test
failures more intelligible for humans.  The old behaviour is available
with "DIFF_FLAGS= make check".

3 years agoCI: Disable shellcheck SC2006 in the Makefile. [skip ci]
Denis Ovsienko [Tue, 4 Jan 2022 12:24:52 +0000 (12:24 +0000)] 
CI: Disable shellcheck SC2006 in the Makefile. [skip ci]

Same as in tcpslice and libpcap.

3 years agoSCTP: Use ND_ICHECKMSG_U() and ND_ICHECKMSG_ZU()
Francois-Xavier Le Bail [Sat, 1 Jan 2022 13:09:43 +0000 (14:09 +0100)] 
SCTP: Use ND_ICHECKMSG_U() and ND_ICHECKMSG_ZU()

Moreover:
Update a comment.

3 years agoPut a space between type and '*' in pointer declarators (style)
Francois-Xavier Le Bail [Thu, 30 Dec 2021 19:07:18 +0000 (20:07 +0100)] 
Put a space between type and '*' in pointer declarators (style)

3 years agoCHANGES: Update macros names prefix from ND_LCHECK to ND_ICHECK
Francois-Xavier Le Bail [Thu, 30 Dec 2021 12:48:26 +0000 (13:48 +0100)] 
CHANGES: Update macros names prefix from ND_LCHECK to ND_ICHECK

3 years agoOpenFlow 1.0: Improve handling of some lengths.
Denis Ovsienko [Wed, 29 Dec 2021 21:06:25 +0000 (21:06 +0000)] 
OpenFlow 1.0: Improve handling of some lengths.

For OFPT_PACKET_OUT print "actions_len", as it is a part of the message
and should appear in its decoding (in other message types it is derived
from the message length).

ND_ICHECK_*() in of10_actions_print(), of10_flow_stats_reply_print() and
of10_packet_out_print() after printing at least some of the output.
This, compared to just "(invalid) (invalid)", makes it much easier to
understand  where and why the packet data was not fully decoded.  Define
OF_ACTION_MINLEN unsigned to squelch the induced compiler warnings.  A
number of similar checks still remain to be converted the same way.

3 years agoUpdate the ND_LCHECK*() macros to ND_ICHECK*() macros
Francois-Xavier Le Bail [Wed, 29 Dec 2021 13:38:08 +0000 (14:38 +0100)] 
Update the ND_LCHECK*() macros to ND_ICHECK*() macros

ICHECK like Invalid-Check.
Reminder: If the checked expression is true an error message is printed
and a 'goto invalid' is executed.

This change adds the parameter 'operator'.

Before this change, '<' comparison was hard coded.
We can do now:
ND_ICHECK_U(length, <, HEADER_LEN);
ND_ICHECK_U(length, ==, 24);
ND_ICHECK_U(length, !=, 8);
ND_ICHECK_ZU(length, <, sizeof(struct my_struct));
ND_ICHECKMSG_U("message length", msg_tlen, <, 4);
...
(Any comparison operator)

Remark: The change of names from ND_LCHECK*() to ND_ICHECK*() is
because something else than a length(L) can be checked.

Moreover:
Place the 'message' parameter at the beginning of ND_ICHECKMSG_U()
and ND_ICHECKMSG_ZU() paramaters lists.

3 years agoCirrus CI: Use the current FreeBSD releases. [skip appveyor]
Denis Ovsienko [Mon, 27 Dec 2021 17:15:10 +0000 (17:15 +0000)] 
Cirrus CI: Use the current FreeBSD releases. [skip appveyor]

Same as in tcpslice and libpcap.

3 years agoJuniper: Report invalid packets as invalid, not truncated
Francois-Xavier Le Bail [Mon, 27 Dec 2021 14:40:13 +0000 (15:40 +0100)] 
Juniper: Report invalid packets as invalid, not truncated

Update the output of a test accordingly.