Skip to content

Commit 72e1c7d

Browse files
committed
Merge changes for tcpdump-4.99.6
1 parent e428e03 commit 72e1c7d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1158
-1386
lines changed

external/bsd/tcpdump/bin/Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $NetBSD: Makefile,v 1.30 2025/12/24 18:19:12 thorpej Exp $
1+
# $NetBSD: Makefile,v 1.31 2026/03/19 00:05:12 christos Exp $
22

33
WARNS?= 1 # XXX: need to cleanup later
44

@@ -118,7 +118,6 @@ print-openflow-1.0.c \
118118
print-openflow-1.3.c \
119119
print-openflow.c \
120120
print-ospf.c \
121-
print-otv.c \
122121
print-pflog.c \
123122
print-pfsync.c \
124123
print-pgm.c \

external/bsd/tcpdump/dist/addrtostr.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
#include <sys/cdefs.h>
4040
#ifndef lint
41-
__RCSID("$NetBSD: addrtostr.c,v 1.6 2024/09/02 16:15:29 christos Exp $");
41+
__RCSID("$NetBSD: addrtostr.c,v 1.7 2026/03/19 00:05:13 christos Exp $");
4242
#endif
4343

4444
#include <config.h>
@@ -132,9 +132,11 @@ addrtostr6 (const void *src, char *dst, size_t size)
132132
cur.base = -1;
133133
for (i = 0; i < (IN6ADDRSZ / INT16SZ); i++) {
134134
if (words[i] == 0) {
135-
if (cur.base == -1)
136-
cur.base = i, cur.len = 1;
137-
else cur.len++;
135+
if (cur.base == -1) {
136+
cur.base = i;
137+
cur.len = 1;
138+
} else
139+
cur.len++;
138140
} else if (cur.base != -1) {
139141
if (best.base == -1 || cur.len > best.len)
140142
best = cur;

external/bsd/tcpdump/dist/checksum.c

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
#include <sys/cdefs.h>
2121
#ifndef lint
22-
__RCSID("$NetBSD: checksum.c,v 1.9 2024/09/02 16:15:29 christos Exp $");
22+
__RCSID("$NetBSD: checksum.c,v 1.10 2026/03/19 00:05:13 christos Exp $");
2323
#endif
2424

2525
#include <config.h>
@@ -111,9 +111,9 @@ create_osi_cksum (const uint8_t *pptr, int checksum_offset, int length)
111111

112112
int x;
113113
int y;
114-
uint32_t mul;
114+
int32_t mul;
115115
uint32_t c0;
116-
uint32_t c1;
116+
uint64_t c1;
117117
uint16_t checksum;
118118
int idx;
119119

@@ -139,21 +139,23 @@ create_osi_cksum (const uint8_t *pptr, int checksum_offset, int length)
139139

140140
mul = (length - checksum_offset)*(c0);
141141

142-
x = mul - c0 - c1;
143-
y = c1 - mul - 1;
144-
145-
if ( y >= 0 ) y++;
146-
if ( x < 0 ) x--;
142+
/*
143+
* Casting c0 and c1 here is guaranteed to be safe, because we know
144+
* they have values between 0 and 254 inclusive. These casts are
145+
* done to ensure that all of the arithmetic operations are
146+
* well-defined (i.e., not mixing signed and unsigned integers).
147+
*/
148+
x = mul - (int)c0 - (int)c1;
149+
y = (int)c1 - mul;
147150

148151
x %= 255;
149152
y %= 255;
150153

151-
152-
if (x == 0) x = 255;
153-
if (y == 0) y = 255;
154+
if (x <= 0) x += 255;
155+
if (y <= 0) y += 255;
154156

155157
y &= 0x00FF;
156-
checksum = ((x << 8) | y);
158+
checksum = (uint16_t)((x << 8) | y);
157159

158160
return checksum;
159161
}

external/bsd/tcpdump/dist/configure

Lines changed: 105 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#! /bin/sh
22
# Guess values for system-dependent variables and create Makefiles.
3-
# Generated by GNU Autoconf 2.71 for tcpdump 4.99.5.
3+
# Generated by GNU Autoconf 2.71 for tcpdump 4.99.6.
44
#
55
#
66
# Copyright (C) 1992-1996, 1998-2017, 2020-2021 Free Software Foundation,
@@ -608,8 +608,8 @@ MAKEFLAGS=
608608
# Identity of this package.
609609
PACKAGE_NAME='tcpdump'
610610
PACKAGE_TARNAME='tcpdump'
611-
PACKAGE_VERSION='4.99.5'
612-
PACKAGE_STRING='tcpdump 4.99.5'
611+
PACKAGE_VERSION='4.99.6'
612+
PACKAGE_STRING='tcpdump 4.99.6'
613613
PACKAGE_BUGREPORT=''
614614
PACKAGE_URL=''
615615

@@ -1306,7 +1306,7 @@ if test "$ac_init_help" = "long"; then
13061306
# Omit some internal or obsolete options to make the list less imposing.
13071307
# This message is too long to be a string in the A/UX 3.1 sh.
13081308
cat <<_ACEOF
1309-
\`configure' configures tcpdump 4.99.5 to adapt to many kinds of systems.
1309+
\`configure' configures tcpdump 4.99.6 to adapt to many kinds of systems.
13101310
13111311
Usage: $0 [OPTION]... [VAR=VALUE]...
13121312
@@ -1372,7 +1372,7 @@ fi
13721372

13731373
if test -n "$ac_init_help"; then
13741374
case $ac_init_help in
1375-
short | recursive ) echo "Configuration of tcpdump 4.99.5:";;
1375+
short | recursive ) echo "Configuration of tcpdump 4.99.6:";;
13761376
esac
13771377
cat <<\_ACEOF
13781378
@@ -1489,7 +1489,7 @@ fi
14891489
test -n "$ac_init_help" && exit $ac_status
14901490
if $ac_init_version; then
14911491
cat <<\_ACEOF
1492-
tcpdump configure 4.99.5
1492+
tcpdump configure 4.99.6
14931493
generated by GNU Autoconf 2.71
14941494
14951495
Copyright (C) 2021 Free Software Foundation, Inc.
@@ -2086,7 +2086,7 @@ cat >config.log <<_ACEOF
20862086
This file contains any messages produced by compilers while
20872087
running configure, to aid debugging if configure makes a mistake.
20882088
2089-
It was created by tcpdump $as_me 4.99.5, which was
2089+
It was created by tcpdump $as_me 4.99.6, which was
20902090
generated by GNU Autoconf 2.71. Invocation command line was
20912091
20922092
$ $0$ac_configure_args_raw
@@ -4248,6 +4248,11 @@ then :
42484248

42494249
fi
42504250

4251+
4252+
# On Linux, if Autoconf version >= 2.72 and GNU C Library version >= 2.34,
4253+
# uncomment AC_SYS_YEAR2038_RECOMMENDED to ensure time_t is Y2038-safe.
4254+
# (Can be done by autogen.sh)
4255+
# AC_SYS_YEAR2038_RECOMMENDED
42514256
#
42524257
# Get the size of a void *, to know whether this is a 32-bit or 64-bit build.
42534258
#
@@ -5838,18 +5843,6 @@ then :
58385843
fi
58395844

58405845

5841-
#
5842-
# Make sure we have snprintf(); we require it.
5843-
#
5844-
ac_fn_c_check_func "$LINENO" "snprintf" "ac_cv_func_snprintf"
5845-
if test "x$ac_cv_func_snprintf" = xyes
5846-
then :
5847-
5848-
else $as_nop
5849-
as_fn_error $? "snprintf() is required but wasn't found" "$LINENO" 5
5850-
fi
5851-
5852-
58535846
#
58545847
# It became apparent at some point that using a suitable C99 compiler does not
58555848
# automatically mean snprintf(3) implementation in the libc supports all the
@@ -5883,32 +5876,50 @@ else $as_nop
58835876
#include <inttypes.h>
58845877
#include <sys/types.h>
58855878
5879+
#if defined(_WIN32) && !defined(_SSIZE_T_DEFINED)
5880+
/*
5881+
* On UN*Xes, this is a signed integer type of the same size as size_t.
5882+
*
5883+
* It's not defined by Visual Studio; we assume that ptrdiff_t will
5884+
* be a type that is a signed integer type of the same size as size_t.
5885+
*/
5886+
typedef ptrdiff_t ssize_t;
5887+
#endif
5888+
5889+
/*
5890+
* Avoid trying to cast negative values to unsigned types, or doing
5891+
* shifts of signed types, in order not to have the test program fail
5892+
* if we're building with undefined-behavior sanitizers enabled.
5893+
*/
58865894
int main()
58875895
{
58885896
char buf[100];
5889-
uint64_t t = (uint64_t)1 << 32;
5897+
unsigned int ui = sizeof(buf);
5898+
int i = sizeof(buf);
5899+
int64_t i64 = INT64_C(0x100000000);
5900+
uint64_t ui64 = UINT64_C(0x100000000);
58905901
5891-
snprintf(buf, sizeof(buf), "%zu", sizeof(buf));
5902+
snprintf(buf, sizeof(buf), "%zu", (size_t)ui);
58925903
if (strncmp(buf, "100", sizeof(buf)))
58935904
return 1;
58945905
5895-
snprintf(buf, sizeof(buf), "%zd", -sizeof(buf));
5906+
snprintf(buf, sizeof(buf), "%zd", (ssize_t)(-i));
58965907
if (strncmp(buf, "-100", sizeof(buf)))
58975908
return 2;
58985909
5899-
snprintf(buf, sizeof(buf), "%" PRId64, -t);
5910+
snprintf(buf, sizeof(buf), "%" PRId64, -i64);
59005911
if (strncmp(buf, "-4294967296", sizeof(buf)))
59015912
return 3;
59025913
5903-
snprintf(buf, sizeof(buf), "0o%" PRIo64, t);
5914+
snprintf(buf, sizeof(buf), "0o%" PRIo64, ui64);
59045915
if (strncmp(buf, "0o40000000000", sizeof(buf)))
59055916
return 4;
59065917
5907-
snprintf(buf, sizeof(buf), "0x%" PRIx64, t);
5918+
snprintf(buf, sizeof(buf), "0x%" PRIx64, ui64);
59085919
if (strncmp(buf, "0x100000000", sizeof(buf)))
59095920
return 5;
59105921
5911-
snprintf(buf, sizeof(buf), "%" PRIu64, t);
5922+
snprintf(buf, sizeof(buf), "%" PRIu64, ui64);
59125923
if (strncmp(buf, "4294967296", sizeof(buf)))
59135924
return 6;
59145925
@@ -7845,6 +7856,11 @@ fi
78457856

78467857

78477858
rm -f os-proto.h
7859+
#
7860+
# MKDEP defaults to no-op (":") if we don't test whether the compiler
7861+
# supports generating dependencies
7862+
#
7863+
MKDEP=:
78487864
if test "${LBL_CFLAGS+set}" = set; then
78497865
V_CCOPT="$V_CCOPT ${LBL_CFLAGS}"
78507866
fi
@@ -8066,6 +8082,59 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
80668082
ac_c_werror_flag="$save_ac_c_werror_flag"
80678083

80688084

8085+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the -Wcomma option" >&5
8086+
printf %s "checking whether the compiler supports the -Wcomma option... " >&6; }
8087+
save_CFLAGS="$CFLAGS"
8088+
CFLAGS="$CFLAGS -Wcomma"
8089+
#
8090+
# XXX - yes, this depends on the way AC_LANG_WERROR works,
8091+
# but no mechanism is provided to turn AC_LANG_WERROR on
8092+
# *and then turn it back off*, so that we *only* do it when
8093+
# testing compiler options - 15 years after somebody asked
8094+
# for it:
8095+
#
8096+
# https://autoconf.gnu.narkive.com/gTAVmfKD/how-to-cancel-flags-set-by-ac-lang-werror
8097+
#
8098+
save_ac_c_werror_flag="$ac_c_werror_flag"
8099+
ac_c_werror_flag=yes
8100+
#
8101+
# We use AC_LANG_SOURCE() so that we can control the complete
8102+
# content of the program being compiled. We do not, for example,
8103+
# want the default "int main()" that AC_LANG_PROGRAM() generates,
8104+
# as it will generate a warning with -Wold-style-definition, meaning
8105+
# that we would treat it as not working, as the test will fail if
8106+
# *any* error output, including a warning due to the flag we're
8107+
# testing, is generated; see
8108+
#
8109+
# https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
8110+
# https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
8111+
#
8112+
# This may, as per those two messages, be fixed in autoconf 2.70,
8113+
# but we only require 2.69 or newer for now.
8114+
#
8115+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
8116+
/* end confdefs.h. */
8117+
int main(void) { return 0; }
8118+
_ACEOF
8119+
if ac_fn_c_try_compile "$LINENO"
8120+
then :
8121+
8122+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
8123+
printf "%s\n" "yes" >&6; }
8124+
CFLAGS="$save_CFLAGS"
8125+
V_CCOPT="$V_CCOPT -Wcomma"
8126+
8127+
else $as_nop
8128+
8129+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
8130+
printf "%s\n" "no" >&6; }
8131+
CFLAGS="$save_CFLAGS"
8132+
8133+
fi
8134+
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
8135+
ac_c_werror_flag="$save_ac_c_werror_flag"
8136+
8137+
80698138
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the -Wmissing-prototypes option" >&5
80708139
printf %s "checking whether the compiler supports the -Wmissing-prototypes option... " >&6; }
80718140
save_CFLAGS="$CFLAGS"
@@ -9024,16 +9093,20 @@ printf "%s\n" "no" >&6; }
90249093
# .devel file; why should the ABI for which we produce code
90259094
# depend on .devel?
90269095
#
9096+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to use an os-proto.h header" >&5
9097+
printf %s "checking whether to use an os-proto.h header... " >&6; }
90279098
os=`echo $host_os | sed -e 's/\([0-9][0-9]*\)[^0-9].*$/\1/'`
90289099
name="lbl/os-$os.h"
90299100
if test -f $name ; then
9101+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes, at \"$name\"" >&5
9102+
printf "%s\n" "yes, at \"$name\"" >&6; }
90309103
ln -s $name os-proto.h
90319104

90329105
printf "%s\n" "#define HAVE_OS_PROTO_H 1" >>confdefs.h
90339106

90349107
else
9035-
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: can't find $name" >&5
9036-
printf "%s\n" "$as_me: WARNING: can't find $name" >&2;}
9108+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
9109+
printf "%s\n" "no" >&6; }
90379110
fi
90389111
fi
90399112

@@ -9689,6 +9762,8 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
96899762
ac_config_headers="$ac_config_headers config.h"
96909763

96919764

9765+
9766+
96929767
ac_config_commands="$ac_config_commands .devel"
96939768

96949769
ac_config_files="$ac_config_files Makefile tcpdump.1"
@@ -10192,7 +10267,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
1019210267
# report actual input values of CONFIG_FILES etc. instead of their
1019310268
# values after options handling.
1019410269
ac_log="
10195-
This file was extended by tcpdump $as_me 4.99.5, which was
10270+
This file was extended by tcpdump $as_me 4.99.6, which was
1019610271
generated by GNU Autoconf 2.71. Invocation command line was
1019710272
1019810273
CONFIG_FILES = $CONFIG_FILES
@@ -10260,7 +10335,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
1026010335
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
1026110336
ac_cs_config='$ac_cs_config_escaped'
1026210337
ac_cs_version="\\
10263-
tcpdump config.status 4.99.5
10338+
tcpdump config.status 4.99.6
1026410339
configured by $0, generated by GNU Autoconf 2.71,
1026510340
with options \\"\$ac_cs_config\\"
1026610341
@@ -10990,4 +11065,3 @@ printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2
1099011065
fi
1099111066
1099211067
exit 0
10993-

external/bsd/tcpdump/dist/extract.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ EXTRACT_IPV4_TO_NETWORK_ORDER(const void *p)
415415
((uint64_t)(*((const uint8_t *)(p) + 2)) << 16) | \
416416
((uint64_t)(*((const uint8_t *)(p) + 3)) << 8) | \
417417
((uint64_t)(*((const uint8_t *)(p) + 4)) << 0))) : \
418-
((int64_t)(INT64_T_CONSTANT(0xFFFFFF0000000000U) | \
418+
((int64_t)(UINT64_C(0xFFFFFF0000000000) | \
419419
((uint64_t)(*((const uint8_t *)(p) + 0)) << 32) | \
420420
((uint64_t)(*((const uint8_t *)(p) + 1)) << 24) | \
421421
((uint64_t)(*((const uint8_t *)(p) + 2)) << 16) | \
@@ -438,7 +438,7 @@ EXTRACT_IPV4_TO_NETWORK_ORDER(const void *p)
438438
((uint64_t)(*((const uint8_t *)(p) + 3)) << 16) | \
439439
((uint64_t)(*((const uint8_t *)(p) + 4)) << 8) | \
440440
((uint64_t)(*((const uint8_t *)(p) + 5)) << 0))) : \
441-
((int64_t)(INT64_T_CONSTANT(0xFFFFFFFF00000000U) | \
441+
((int64_t)(UINT64_C(0xFFFFFFFF00000000) | \
442442
((uint64_t)(*((const uint8_t *)(p) + 0)) << 40) | \
443443
((uint64_t)(*((const uint8_t *)(p) + 1)) << 32) | \
444444
((uint64_t)(*((const uint8_t *)(p) + 2)) << 24) | \
@@ -464,7 +464,7 @@ EXTRACT_IPV4_TO_NETWORK_ORDER(const void *p)
464464
((uint64_t)(*((const uint8_t *)(p) + 4)) << 16) | \
465465
((uint64_t)(*((const uint8_t *)(p) + 5)) << 8) | \
466466
((uint64_t)(*((const uint8_t *)(p) + 6)) << 0))) : \
467-
((int64_t)(INT64_T_CONSTANT(0xFFFFFFFFFF000000U) | \
467+
((int64_t)(UINT64_C(0xFFFFFFFFFF000000) | \
468468
((uint64_t)(*((const uint8_t *)(p) + 0)) << 48) | \
469469
((uint64_t)(*((const uint8_t *)(p) + 1)) << 40) | \
470470
((uint64_t)(*((const uint8_t *)(p) + 2)) << 32) | \

0 commit comments

Comments
 (0)