Skip to content

Commit 64ebd60

Browse files
authored
Merge branch 'the-tcpdump-group:master' into master
2 parents ed3b1df + 5c19156 commit 64ebd60

40 files changed

+655
-146
lines changed

.ci-coverity-scan-build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ if [ ! -d $TOOL_BASE ]; then
4646
fi
4747

4848
TOOL_DIR=$(find $TOOL_BASE -type d -name 'cov-analysis*')
49-
export PATH=$TOOL_DIR/bin:$PATH
49+
export PATH="$TOOL_DIR/bin:$PATH"
5050

5151
# Build
5252
printf "\033[33;1mRunning Coverity Scan Analysis Tool...\033[0m\n"

.cirrus.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ freebsd_task:
99
# FreeBSD fails to start with 1 GB. 8 CPUs max concurrency.
1010
# The number of CPU cores must be either 1 or a multiple of 2.
1111
matrix:
12-
- image_family: freebsd-12-4
12+
- image_family: freebsd-13-2
1313
cpu: 2
1414
memory: 2G
15-
- image_family: freebsd-13-2
15+
- image_family: freebsd-14-0
1616
cpu: 2
1717
memory: 2G
1818
env:

CHANGES

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,13 @@ DayOfTheWeek, Month DD, YYYY / The Tcpdump Group
2121
User interface:
2222
Add optional unit suffix on -C file size.
2323
Add --print-sampling to print every Nth packet instead of all.
24+
Add --lengths option to print the captured and original packet lengths.
2425
Source code:
2526
Use %zu when printing a sizeof to squelch compiler warnings
2627
Remove unused missing/snprintf.c.
2728
Remove unused missing/strdup.c.
2829
(FIXME: somebody please wrap the line below just before the release)
29-
AODV, AppleTalk, BOOTP, CHDLC, DCCP, EAP, EGP, EIGRP, ForCES, Geneve, GRE, Juniper, L2TP, mobile, NetFlow, NTP, OLSR, PGM, RADIUS, RIP, RSVP, SCTP, SNMP, TCP, UDP, vsock: Modernize packet parsing style
30+
AODV, AppleTalk, BOOTP, CHDLC, DCCP, EAP, EGP, EIGRP, ForCES, Geneve, GRE, ICMP, Juniper, L2TP, mobile, NetFlow, NTP, OLSR, PGM, RADIUS, RIP, RSVP, SCTP, SNMP, TCP, UDP, vsock: Modernize packet parsing style
3031
DCCP, EGP: Replace custom code with tok2str()
3132
UDP: Clean up address and port printing.
3233
AppleTalk: Declutter appletalk.h.
@@ -80,6 +81,7 @@ DayOfTheWeek, Month DD, YYYY / The Tcpdump Group
8081
User interface:
8182
Print the supported time stamp types (-J) to stdout instead of stderr.
8283
Print the list of data link types (-L) to stdout instead of stderr.
84+
Use symmetrical quotation characters in error messages.
8385
Source code:
8486
tcpdump: Fix a memory leak.
8587
child_cleanup: reap as many child processes as possible.
@@ -93,6 +95,7 @@ DayOfTheWeek, Month DD, YYYY / The Tcpdump Group
9395
Make nd_trunc_longjmp() not static inline.
9496
Include <time.h> from netdissect.h.
9597
Remove init_crc10_table() and the entourage.
98+
Initialize tzcode early.
9699
Building and testing:
97100
Add a configure option to help debugging (--enable-instrument-functions)
98101
At build time require a proof of suitable snprintf(3) implementation in
@@ -1794,7 +1797,7 @@ v2.0.1 Sun Jan 26 21:10:10 PDT
17941797
- Ultrix 4.0 is supported (also thanks to Jeff Mogul).
17951798

17961799
- IBM RT and Stanford Enetfilter support has been added by
1797-
Rayan Zachariassen <[email protected]>. Tcpdump has been tested under
1800+
Rayan Zachariassen <[email protected]>. tcpdump has been tested under
17981801
both the vanilla Enetfilter interface, and the extended interface
17991802
(#ifdef'd by IBMRTPC) present in the MERIT version of the Enetfilter.
18001803

CMakeLists.txt

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,22 @@ if(WIN32)
66
cmake_minimum_required(VERSION 3.12)
77
else(WIN32)
88
#
9-
# For now, require only 2.8.12, just in case somebody is
10-
# configuring with CMake on a "long-term support" version
11-
# of some OS and that version supplies an older version of
12-
# CMake.
9+
# For now:
1310
#
14-
# If this is ever updated to CMake 3.1 or later, remove the
15-
# stuff in cmake/Modules/FindPCAP.cmake that appends subdirectories
16-
# of directories from CMAKE_PREFIX_PATH to the PKG_CONFIG_PATH
17-
# environment variable when running pkg-config, to make sure
18-
# it finds any .pc file from there.
11+
# if this is a version of CMake less than 3.5, require only
12+
# 2.8.12, just in case somebody is configuring with CMake
13+
# on a "long-term support" version # of some OS and that
14+
# version supplies an older version of CMake;
1915
#
20-
cmake_minimum_required(VERSION 2.8.12)
16+
# otherwise, require 3.5, so we don't get messages warning
17+
# that support for versions of CMake lower than 3.5 is
18+
# deprecated.
19+
#
20+
if(CMAKE_VERSION VERSION_LESS "3.5")
21+
cmake_minimum_required(VERSION 2.8.12)
22+
else()
23+
cmake_minimum_required(VERSION 3.5)
24+
endif()
2125
endif(WIN32)
2226

2327
#
@@ -1393,7 +1397,7 @@ add_custom_target(uninstall
13931397
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
13941398

13951399
#
1396-
# Tcpdump tests
1400+
# tcpdump tests
13971401
# We try to find the Perl interpreter and, if we do, we have the check
13981402
# rule run tests/TESTrun with it, because just trying to run the TESTrun
13991403
# script as a command won't work on Windows.

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ and ask!
3939
1) Check that there isn't a pull request already opened for the changes you
4040
intend to make.
4141

42-
2) [Fork](https://help.github.com/articles/fork-a-repo/) the Tcpdump
42+
2) [Fork](https://help.github.com/articles/fork-a-repo/) the tcpdump
4343
[repository](https://github.com/the-tcpdump-group/tcpdump).
4444

4545
3) The easiest way to test your changes on multiple operating systems and

Makefile.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,4 +569,4 @@ depend:
569569
@$(MKDEP) -c "$(CC)" -m "$(DEPENDENCY_CFLAG)" -s "$(srcdir)" $(DEFS) $(INCLS) $(SRC) $(LIBNETDISSECT_SRC)
570570

571571
shellcheck:
572-
shellcheck -f gcc -e SC2006 build.sh build_matrix.sh build_common.sh
572+
shellcheck -f gcc -e SC2006 build.sh build_matrix.sh build_common.sh .ci-coverity-scan-build.sh

README.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,23 @@ tcpdump compiles and works on at least the following platforms:
3535
* {Mac} OS X / macOS
3636
* NetBSD
3737
* OpenBSD
38-
* OpenWrt
3938
* Solaris
4039
* Windows (requires WinPcap or Npcap, and Visual Studio with CMake)
4140

41+
In the past tcpdump certainly or likely worked on the following platforms:
42+
43+
* 4.3BSD
44+
* BSD/386, later BSD/OS
45+
* DEC OSF/1, later Digital UNIX, later Tru64 UNIX
46+
* DOS
47+
* IRIX
48+
* SINIX
49+
* SunOS
50+
* Ultrix
51+
* UnixWare
52+
4253
### Dependency on libpcap
43-
Tcpdump uses libpcap, a system-independent interface for user-level
54+
tcpdump uses libpcap, a system-independent interface for user-level
4455
packet capture. Before building tcpdump, you must first retrieve and
4556
build libpcap.
4657

build_matrix.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ build_tcpdump() {
4949
export CRYPTO
5050
for SMB in $MATRIX_SMB; do
5151
export SMB
52-
COUNT=`increment $COUNT`
53-
echo_magenta "===== SETUP $COUNT: BUILD_LIBPCAP=$BUILD_LIBPCAP REMOTE=${REMOTE:-?} CC=$CC CMAKE=$CMAKE CRYPTO=$CRYPTO SMB=$SMB =====" >&2
52+
COUNT=`increment "$COUNT"`
53+
echo_magenta "===== SETUP $COUNT: CC=$CC BUILD_LIBPCAP=$BUILD_LIBPCAP REMOTE=${REMOTE:-?} CMAKE=$CMAKE CRYPTO=$CRYPTO SMB=$SMB =====" >&2
5454
# Run one build with setup environment variables:
5555
# BUILD_LIBPCAP, REMOTE, CC, CMAKE, CRYPTO and SMB
5656
run_after_echo ./build.sh

diag-control.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,22 @@
132132
#define DIAG_ON_CAST_QUAL \
133133
DIAG_DO_PRAGMA(GCC diagnostic pop)
134134

135+
#if ND_IS_AT_LEAST_GNUC_VERSION(4,5)
136+
/*
137+
* GCC warns about unused return values if a function is marked as
138+
* "warn about ignoring this function's return value".
139+
*
140+
* Clang appears to let you ignore a result without a warning by
141+
* casting the function result to void, so we don't appear to
142+
* need this for Clang.
143+
*/
144+
#define DIAG_OFF_WARN_UNUSED_RESULT \
145+
DIAG_DO_PRAGMA(GCC diagnostic push) \
146+
DIAG_DO_PRAGMA(GCC diagnostic ignored "-Wunused-result")
147+
#define DIAG_ON_WARN_UNUSED_RESULT \
148+
DIAG_DO_PRAGMA(GCC diagnostic pop)
149+
#endif
150+
135151
/*
136152
* Suppress deprecation warnings.
137153
*/
@@ -172,6 +188,12 @@
172188
#ifndef DIAG_ON_CAST_QUAL
173189
#define DIAG_ON_CAST_QUAL
174190
#endif
191+
#ifndef DIAG_OFF_WARN_UNUSED_RESULT
192+
#define DIAG_OFF_WARN_UNUSED_RESULT
193+
#endif
194+
#ifndef DIAG_ON_WARN_UNUSED_RESULT
195+
#define DIAG_ON_WARN_UNUSED_RESULT
196+
#endif
175197
#ifndef DIAG_OFF_DEPRECATION
176198
#define DIAG_OFF_DEPRECATION
177199
#endif

doc/README.haiku.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
* Both system and local libpcap are suitable.
66
* Autoconf 2.71 works.
7-
* CMake 3.24.2 works.
8-
* GCC 11.2.0 works.
7+
* CMake 3.27.7 works.
8+
* GCC 13.2.0 works.
99
* Clang 12.0.1 works with the latest llvm12_clang-12.0.1-5 version.
1010

1111
The following command will install respective non-default packages:

doc/README.solaris.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
* Autoconf works everywhere.
44

5+
## OmniOS r151046/AMD64
6+
7+
* Both system and local libpcap are suitable.
8+
* CMake 3.26.4 works
9+
* GCC 12.2.0 and Clang 16.0.4 work.
10+
511
## OmniOS r151044/AMD64
612

713
* Both system and local libpcap are suitable.
@@ -52,6 +58,12 @@ ENDOFTEXT
5258
* CMake 3.14.3 works.
5359
* Sun C 5.13 and GCC 5.5.0 work.
5460

61+
## Solaris 10/SPARC
62+
63+
* Both system and local libpcap are suitable.
64+
* CMake 3.14.3 works.
65+
* Sun C 5.9 and GCC 5.5.0 work.
66+
5567
## Solaris 9
5668

5769
This version of this OS is not supported because the snprintf(3) implementation

netdissect.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ struct netdissect_options {
228228
jmp_buf ndo_early_end; /* jmp_buf for setjmp()/longjmp() */
229229
void *ndo_last_mem_p; /* pointer to the last allocated memory chunk */
230230
int ndo_packet_number; /* print a packet number in the beginning of line */
231+
int ndo_lengths; /* print packet header caplen and len */
231232
int ndo_print_sampling; /* print every Nth packet */
232233
int ndo_suppress_default_print; /* don't use default_print() for unknown packet types */
233234
int ndo_tstamp_precision; /* requested time stamp precision */
@@ -657,7 +658,7 @@ extern void hncp_print(netdissect_options *, const u_char *, u_int);
657658
extern void hsrp_print(netdissect_options *, const u_char *, u_int);
658659
extern void http_print(netdissect_options *, const u_char *, u_int);
659660
extern void icmp6_print(netdissect_options *, const u_char *, u_int, const u_char *, int);
660-
extern void icmp_print(netdissect_options *, const u_char *, u_int, const u_char *, int);
661+
extern void icmp_print(netdissect_options *, const u_char *, u_int, int);
661662
extern u_int ieee802_11_radio_print(netdissect_options *, const u_char *, u_int, u_int);
662663
extern u_int ieee802_15_4_print(netdissect_options *, const u_char *, u_int);
663664
extern void igmp_print(netdissect_options *, const u_char *, u_int);

ospf.h

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
#define LS_OPAQUE_TYPE_TE 1 /* rfc3630 */
7373
#define LS_OPAQUE_TYPE_GRACE 3 /* rfc3623 */
7474
#define LS_OPAQUE_TYPE_RI 4 /* draft-ietf-ospf-cap-03 */
75+
#define LS_OPAQUE_TYPE_EP 7 /* rfc7684 */
7576

7677
#define LS_OPAQUE_TE_TLV_ROUTER 1 /* rfc3630 */
7778
#define LS_OPAQUE_TE_TLV_LINK 2 /* rfc3630 */
@@ -94,6 +95,12 @@
9495
#define LS_OPAQUE_TE_LINK_SUBTLV_LINK_TYPE_PTP 1 /* rfc3630 */
9596
#define LS_OPAQUE_TE_LINK_SUBTLV_LINK_TYPE_MA 2 /* rfc3630 */
9697

98+
#define LS_OPAQUE_RI_SUBTLV_SID_LABEL 1 /* rfc8665 */
99+
100+
#define LS_OPAQUE_EP_EXTD_PREFIX_TLV 1 /* rfc7684 */
101+
#define LS_OPAQUE_EP_EXTD_PREFIX_RANGE_TLV 2 /* rfc8665 */
102+
#define LS_OPAQUE_EP_SUBTLV_PREFIX_SID 2 /* rfc8665 */
103+
97104
#define LS_OPAQUE_GRACE_TLV_PERIOD 1 /* rfc3623 */
98105
#define LS_OPAQUE_GRACE_TLV_REASON 2 /* rfc3623 */
99106
#define LS_OPAQUE_GRACE_TLV_INT_ADDRESS 3 /* rfc3623 */
@@ -104,7 +111,8 @@
104111
#define LS_OPAQUE_GRACE_TLV_REASON_CP_SWITCH 3 /* rfc3623 */
105112

106113
#define LS_OPAQUE_RI_TLV_CAP 1 /* draft-ietf-ospf-cap-03 */
107-
114+
#define LS_OPAQUE_RI_TLV_HOSTNAME 7 /* rfc5642 */
115+
#define LS_OPAQUE_RI_TLV_SID_LABEL_RANGE 9 /* rfc8665 */
108116

109117
/* rla_link.link_type */
110118
#define RLA_TYPE_ROUTER 1 /* point-to-point to another router */
@@ -247,6 +255,13 @@ struct lsa {
247255
nd_byte data[1]; /* may repeat */
248256
} un_ri_tlv[1]; /* may repeat */
249257

258+
/* Extended Prefix LSA */
259+
struct {
260+
nd_uint16_t type;
261+
nd_uint16_t length;
262+
nd_byte data[1]; /* may repeat */
263+
} un_ep_tlv[1]; /* may repeat */
264+
250265
/* Unknown LSA */
251266
struct unknown {
252267
nd_byte data[1]; /* may repeat */

print-brcmtag.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929

3030
#define ND_LONGJMP_FROM_TCHECK
3131
#include "netdissect.h"
32-
#include "ethertype.h"
3332
#include "addrtoname.h"
3433
#include "extract.h"
3534

print-dhcp6.c

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,6 @@ dhcp6opt_print(netdissect_options *ndo,
299299
uint8_t dh6_reconf_type;
300300
uint8_t dh6_lq_query_type;
301301
u_int first_list_value;
302-
uint16_t remainder_len;
303302

304303
if (cp == ep)
305304
return;
@@ -558,7 +557,9 @@ dhcp6opt_print(netdissect_options *ndo,
558557
ND_PRINT(" ");
559558
for (i = 0; i < optlen && i < 10; i++)
560559
ND_PRINT("%02x", GET_U_1(tp + i));
561-
ND_PRINT("...)");
560+
if (i < optlen)
561+
ND_PRINT("...");
562+
ND_PRINT(")");
562563
break;
563564
case DH6OPT_RECONF_MSG:
564565
if (optlen != 1) {
@@ -685,7 +686,9 @@ dhcp6opt_print(netdissect_options *ndo,
685686
*/
686687
for (i = 4; i < optlen && i < 14; i++)
687688
ND_PRINT("%02x", GET_U_1(tp + i));
688-
ND_PRINT("...)");
689+
if (i < optlen)
690+
ND_PRINT("...");
691+
ND_PRINT(")");
689692
break;
690693
case DH6OPT_LQ_QUERY:
691694
if (optlen < 17) {
@@ -732,7 +735,9 @@ dhcp6opt_print(netdissect_options *ndo,
732735
*/
733736
for (i = 16; i < optlen && i < 26; i++)
734737
ND_PRINT("%02x", GET_U_1(tp + i));
735-
ND_PRINT("...)");
738+
if (i < optlen)
739+
ND_PRINT("...");
740+
ND_PRINT(")");
736741
break;
737742
case DH6OPT_NTP_SERVER:
738743
if (optlen < 4) {
@@ -786,7 +791,7 @@ dhcp6opt_print(netdissect_options *ndo,
786791
nd_printjnp(ndo, tp, label_len);
787792
tp += label_len;
788793
remain_len -= (label_len + 1);
789-
if(GET_U_1(tp)) ND_PRINT(".");
794+
if (GET_U_1(tp)) ND_PRINT(".");
790795
} else {
791796
ND_PRINT(" ?");
792797
break;
@@ -819,24 +824,24 @@ dhcp6opt_print(netdissect_options *ndo,
819824
ND_PRINT(" ");
820825
tp = (const u_char *)(dh6o + 1);
821826
first_list_value = TRUE;
822-
remainder_len = optlen;
823-
while (remainder_len >= 2) {
827+
remain_len = optlen;
828+
while (remain_len >= 2) {
824829
if (first_list_value == FALSE) {
825830
ND_PRINT(",");
826831
}
827832
first_list_value = FALSE;
828833
subopt_len = GET_BE_U_2(tp);
829-
if (subopt_len > remainder_len-2) {
834+
if (subopt_len > remain_len - 2) {
835+
ND_PRINT(" ?");
830836
break;
831837
}
832838
tp += 2;
833839
nd_printjn(ndo, tp, subopt_len);
834840
tp += subopt_len;
835-
remainder_len -= (subopt_len+2);
841+
remain_len -= (subopt_len + 2);
836842
}
837-
if (remainder_len != 0 ) {
843+
if (remain_len != 0)
838844
ND_PRINT(" ?");
839-
}
840845
ND_PRINT(")");
841846
break;
842847

0 commit comments

Comments
 (0)