Commit Graph

6797 Commits

Author SHA1 Message Date
Guy Harris
50dfa7eceb EAP: add some more length checks.
Check to make sure we don't go past the length value in the header.

Note that the string in an Identity message is optional (so we just
don't bother printing it if it's zero-length), but the string in a
notification message isn't (so report an error if it's zero-length).
2021-11-13 18:50:02 -08:00
Guy Harris
cac8a3cd04 EAP: label length mismatch as a possible EAP fragment.
In some cases, EAP fragmentation/reassembly is done at a layer above
EAP, e.g. when EAP messages are contained within a RADIUS message and
are broken up into multiple TLVs in the message.  In those cases, the
length handed to eap_print() will be different from the length in the
first fragment's header, and the remaining fragments won't *have* a
header, so the "length" will be garbage and thus unlikely to be equal to
the length handed to us.
2021-11-13 18:44:57 -08:00
Guy Harris
6569fb7945 EAP: no need for the count variable to be signed.
Make it unsigned, and, while we're at it, make the loop a for loop.
2021-11-13 18:34:00 -08:00
Guy Harris
47b4131380 Update some comments with new RFC numbers. 2021-11-13 18:18:47 -08:00
Rui Paulo
b0b726f497 Add a test case for QUIC retry packets. 2021-11-10 12:29:31 +00:00
Francois-Xavier Le Bail
a3cfb6a87b QUIC: Fix getting packet type in Long Header
This change should fix the Coverity Scan issue CID 1493488:
178                             ND_PRINT(", handshake");
>>> CID 1493488:  Control flow issues  (DEADCODE)
>>> Execution cannot reach this statement: "if (packet_type == QUIC_LH_...".
179                     else if (packet_type == QUIC_LH_TYPE_RETRY)
2021-11-09 20:25:15 +01:00
Francois-Xavier Le Bail
17cd0305d4 Document "-T quic" 2021-11-09 10:15:23 +01:00
fxlb
7e9c5bfd4d
Merge pull request #943 from rpaulo/quic
Initial support to parse QUIC packets.
2021-11-09 08:21:25 +00:00
Rui Paulo
8ce37b54ed Initial support to parse QUIC packets. 2021-11-09 09:11:34 +01:00
Francois-Xavier Le Bail
58a4ab67fc EAP: Fix some undefined behaviors at runtime
The errors were like:
print-eap.c:179:25: runtime error: unsigned integer overflow:
  2 - 5 cannot be represented in type 'unsigned int'
print-eap.c:181:50: runtime error: unsigned integer overflow:
  2 - 5 cannot be represented in type 'unsigned int'
print-eap.c:186:25: runtime error: unsigned integer overflow:
  2 - 5 cannot be represented in type 'unsigned int'
print-eap.c:188:50: runtime error: unsigned integer overflow:
  2 - 5 cannot be represented in type 'unsigned int'
2021-11-04 22:58:40 +01:00
Denis Ovsienko
30df635e5d
Merge pull request #954 from jiladahe1997/master 2021-11-04 11:40:56 +00:00
Mingrui
cb0099044b [bugfix]configure: fix error when cross-compile
While cross-compile, ./configure --host=xxx will output:
"checking whether printf(3) supports the z length modifier...
configure: error: in `/${path_to_tcpdump}/tcpdump':"

That is casued by AC_RUN_IFELSE, as describe in
"https://www.gnu.org/software/autoconf/manual/autoconf-2.63/html_node/Runtime.html"
, if AC_RUN_IFELSE do not have cross-compile option, configure prints an error message and exits.

Signed-off-by: Mingrui Ren jiladahe1997@gmail.com
2021-11-04 09:07:23 +08:00
Francois-Xavier Le Bail
64a5c6c907 sFlow: Add a length check 2021-11-03 22:31:30 +01:00
Quentin Armitage
d3eb92550a VRRP: Add support for IPv6
Signed-off-by: Quentin Armitage <quentin@armitage.org.uk>
2021-11-02 09:30:21 +00:00
Francois-Xavier Le Bail
62ed947484 lwres: Update a variable type
This should address two AppVeyor/Visual Studio 2019/x64 warnings:
print-lwres.c(197,23): warning C4267: 'function': conversion from
 'size_t' to 'u_int', possible loss of data
print-lwres.c(201,14): warning C4267: 'return': conversion from
 'size_t' to 'unsigned int', possible loss of data
2021-11-02 09:48:50 +01:00
Francois-Xavier Le Bail
88ffe242bd Assign ndo->ndo_packetp in pretty_print_packet()
Thus it can be used for debugging.
2021-11-01 10:56:02 +01:00
Francois-Xavier Le Bail
bd1adc39f6 Use __func__ from C99 in two function calls 2021-10-31 13:27:20 +01:00
Francois-Xavier Le Bail
390c5b70aa Rename a pcapng test file to .pcapng 2021-10-27 22:16:11 +02:00
Francois-Xavier Le Bail
c855567d09 VRRP: Print the protocol name before any GET_()
This change will print the protocol name even if the first octet is
truncated.
Use nd_print_protocol_caps().
2021-10-21 16:40:06 +02:00
Denis Ovsienko
42ae99dd6c man: Fixup some formatting. [skip ci]
Use BSD style references and protect some refs from hyphenation.
2021-10-20 13:47:59 +01:00
Denis Ovsienko
72896d6377
Merge pull request #941. 2021-10-09 21:34:30 +01:00
Donatas Abraitis
c998848b4b tests: Add a pcap test for BGP link-bandwidth extended community
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-10-09 17:19:58 +01:00
Donatas Abraitis
31c9c8736b bgp: Decode BGP link-bandwidth extended community properly
First two bytes are reserved for AS.

Before:
```
	  Extended Community (16), length: 8, Flags [OT]:
	    link-BW (0x4004), Flags [non-transitive]: bandwidth: -308754489798474897524123005616128.000 Mbps
	    0x0000:  4004 fde8 47f4 2400
	  Updated routes:
	    192.168.10.0/23
```

After:
```
	  Extended Community (16), length: 8, Flags [OT]:
	    link-BW (0x4004), Flags [non-transitive]: bandwidth: 1.000 Mbps
	    0x0000:  4004 fde8 47f4 2400
	  Updated routes:
	    192.168.10.0/23
```

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-10-09 17:19:58 +01:00
Michael Richardson
010b971cea
Merge pull request #889 from westermo/dsa-vid
DSA: Correctly determine VID
2021-10-06 14:38:09 -04:00
Tobias Waldekranz
dde10e0366 DSA: Correctly determine VID
The 4 MSBs of the VID is stored in the lower nibble of the tag's third
byte.

Previously the priority bits where folded into the VID space, e.g. a
packet with VID=1 and priority 6 was printed as having a VID of
1537 (0x601).

Add DSA test PCAPs with packets containing a high VID and non-zero
FPri values to make sure we catch any future regressions.

Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
2021-10-05 22:52:00 +02:00
Denis Ovsienko
465a8f8737 Move the backported items to 4.99.2 in CHANGES. [skip ci] 2021-09-29 15:51:40 +01:00
Francois-Xavier Le Bail
fd409921d9 lwres: Fix a length check
This fix some inconsistent outputs clang versus gcc in 32 bits mode.

Add a test file.
2021-09-27 16:10:31 +02:00
Denis Ovsienko
7c6a734dff CI: Refine GCC identification. [skip appveyor]
Same as in libpcap.
2021-09-15 09:54:11 +01:00
Guy Harris
cdca504371
Merge pull request #926 from gokulkumar792/print_Block_Ack_TA_field
IEEE 802.11: include the "TA" field while printing Block Ack Control frame
2021-09-13 14:50:43 -07:00
a1346054
afb52045dd Remove last remaining trailing whitespace 2021-09-04 07:52:28 +00:00
Michael Richardson
e5db29f499
Merge pull request #924 from gokulkumar792/print_meshid
IEEE 802.11: include the "Mesh ID" field while printing management frames
2021-08-25 11:44:08 -04:00
Gokul Sivakumar
34f0181eed IEEE 802.11: Add a test to check the 802.11s Mesh ID in management frames
The newly added pcap file contains a Mesh Beacon frame, a Wildcard Probe
Request and a Mesh Probe Response. The test case checks if the "Mesh ID"
field is properly parsed by the IEEE 802.11 printer.
2021-08-22 11:08:57 +05:30
Gokul Sivakumar
2782351862 IEEE 802.11: include the "Mesh ID" field while printing management frames
In an 802.11s mesh network, on detecting that the Beacon and Probe Response
frames transmitted has a non-zero length "Mesh ID", print it.
2021-08-22 11:08:57 +05:30
Rui
dcae3b01d7 MPTCP: Add missing MP_CAPABLE Flags
Parse previous ignored flags from MP_CAPABLE option
2021-08-18 22:51:27 +01:00
Denis Ovsienko
4316f615c9 CI: Add MAKE_BIN to allow non-default makes. [skip ci]
This way parallel builds are simpler on Solaris and OpenIndiana.
2021-08-17 20:35:21 +01:00
Denis Ovsienko
4b3055b4bd Document some OpenIndiana particulars. [skip ci] 2021-08-17 17:39:47 +01:00
Denis Ovsienko
ed0175cdda CI: Clean in ../libpcap only if present. [skip ci]
./build_matrix.sh[89]: cd: /export/home/denis/libpcap: [No such file or
  directory]
2021-08-17 17:20:32 +01:00
Denis Ovsienko
4f1a63c4c3 Fixup commit 604cd4a for OpenIndiana.
SunOS openindiana 5.11 illumos-755ccbcfa2 i86pc i386 i86pc
gcc (OpenIndiana 10.3.0-oi-0) 10.3.0

As it turns out, in OpenIndiana 2021.04 ND_UNREACHABLE is one of the
neighbour discovery states in <net/if.h>:

In file included from ./extract.h:40,
                 from ./addrtoname.h:22,
                 from ./addrtoname.c:112:
./diag-control.h:181: warning: "ND_UNREACHABLE" redefined

In file included from ./addrtoname.c:87:
/usr/include/net/if.h:307: note: this is the location of the previous
  definition

In file included from ./extract.h:40,
                 from ./addrtoname.h:22,
                 from ./print-sll.c:36:
./diag-control.h:181: warning: "ND_UNREACHABLE" redefined

In file included from ./print-sll.c:29:
/usr/include/net/if.h:307: note: this is the location of the previous
  definition
2021-08-17 00:01:01 +01:00
Francois-Xavier Le Bail
b73d5ba212 Use more the ND_TCHECK_1() macro
This is a follow-up to 7b7b84716e.
2021-08-15 13:04:42 +02:00
Francois-Xavier Le Bail
f1c7ca5a7d Use more the ND_TCHECK_1() macro
This is a follow-up to 880b867ee7.
2021-08-15 13:01:54 +02:00
Denis Ovsienko
604cd4aa60 Use __builtin_unreachable(). [skip ci]
Same as in libpcap.
2021-08-15 11:12:00 +01:00
Guy Harris
dadde06adb Remove the space I added to provoke a rebuild.
(This should also provoke a rebuild; the NetBSD libpcap build should no
longer have the issue that caused tcpdump to fail when built with it.)
2021-08-11 16:37:34 -07:00
Guy Harris
9545306cc5 Add a space at the end of the first line, to provoke a build.
(There doesn't appear to be an obvious way to force a rebuild, and a
change to libpcap doesn't force a rebuild of programs such as tcpdump
for which the CI build includes a build with the tip of the main branch
of libpcap.)
2021-08-11 03:18:54 -07:00
Guy Harris
2d5a570bc9 Consistenly use "XYZZY compiler M.N and later". [skip ci]
Use that rather than "... or later".
2021-08-11 01:50:47 -07:00
Guy Harris
bc4a4543f8 Get rid of duplicate definition of __has_attribute.
compiler-tests.h already checks whether __has_attribute and, if not,
defines it as a macro that always returns 0 (so that we use the "what
version of the compiler is this?" fallback checks for a given
attribute).  We include compiler-tests.h before we define
__has_attribute ourselves, so we don't need to do it ourselves.
2021-08-11 01:44:51 -07:00
Guy Harris
b3626b4c72 Fix a comment. [skip ci] 2021-08-11 01:28:42 -07:00
Guy Harris
1912902e96 Make the tests a bit easier to read.
Add comments and indentation.

Handle XL C a bit more like the other compilers.  Make the first test be
"is this someting that's not XL C", as is the case for other compilers;
that test is done as "are both __xlC__ and __ibmxl__ undefined".  If
either of them are defined, use __ibmxl_version__ if __ibmxl__ is
defined, and use __xlC__ otherwise.
2021-08-11 01:05:52 -07:00
Denis Ovsienko
f139f17ba9 Do not define __EXTENSIONS__ if already defined. [skip ci]
SunOS solaris11-amd64 5.11 11.4.0.15.0 i86pc i386 i86pc
clang version 6.0.0 (tags/RELEASE_600/final)

Every .c file that included netdissect-stdinc.h generated a warning:

In file included from ./netdissect-stdinc.h:42:
./ftmacros.h:48:11: warning: '__EXTENSIONS__' macro redefined
      [-Wmacro-redefined]
<built-in>:345:9: note: previous definition is here
2021-08-10 10:18:19 +01:00
Guy Harris
3834579486 Tell CMake not to check for a C++ compiler.
We only need a C compiler, and if either

1) the C and C++ compilers don't match (e.g., a defaults-to-64-bit GCC
and a defaults-to-32-bit Oracle Studio C++)

or

2) you set CFLAGS in the environment to force a 64-bit build but don't
also set CXXFLAGS

CMake will get confused and think it's doing a 32-bit build even though
we'll be doing a 64-bit build, and all sorts of weirdness will occur.

Just say "C" in the project() command.
2021-08-08 11:54:17 -07:00
Guy Harris
c39d40a767 On Solaris, for 64-bit builds, use the 64-bit pcap-config.
There are two versions of pcap-config supplied on Solaris (or, at least,
on 64-bit Solaris) - a version that has the right --libs output to find
the 32-bit libraries and a version that has the right --libs output to
find the 64-bit libraries.

Try to figure out whether we're doing a 32-bit or 64-bit build (based on
the pointer size) and, for 64-bit builds, run the 64-bit version of
pcap-config.
2021-08-08 00:36:42 -07:00