aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSadaf Ebrahimi <sadafebrahimi@google.com>2023-07-13 00:32:41 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2023-07-13 00:32:41 +0000
commitdf81e44a42d3d7dec61edbc3e0342662733131e8 (patch)
tree459101553d2b7814467ff205890774b31912033c
parentecbde7e0a073a51a5b6d3403d36b265b37eaf444 (diff)
parent86a2c2f7a53c67bc6cbbadd03d25cf3a79a60ed2 (diff)
downloadtcpdump-df81e44a42d3d7dec61edbc3e0342662733131e8.tar.gz
Merge "Upgrade tcpdump to tcpdump-4.99.4" into main am: d231da0df5 am: 79017393c7 am: 86a2c2f7a5
Original change: https://android-review.googlesource.com/c/platform/external/tcpdump/+/2655820 Change-Id: I3ee398ca8adb4e53e10705ee2f78973e6bf698b7 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--CHANGES23
-rw-r--r--CMakeLists.txt1
-rw-r--r--METADATA14
-rw-r--r--Makefile.in12
-rw-r--r--README.md2
-rw-r--r--VERSION2
-rw-r--r--addrtostr.c4
-rw-r--r--atime.awk2
-rw-r--r--chdlc.h2
-rw-r--r--cmakeconfig.h.in5
-rwxr-xr-xconfig.guess12
-rw-r--r--config.h4
-rw-r--r--config.h.in3
-rwxr-xr-xconfig.sub33
-rwxr-xr-xconfigure20
-rw-r--r--configure.ac4
-rw-r--r--ethertype.h8
-rw-r--r--ip6.h4
-rw-r--r--ipproto.h2
-rw-r--r--missing/getopt_long.c2
-rw-r--r--missing/strlcat.c2
-rw-r--r--missing/strlcpy.c2
-rwxr-xr-xmkdep2
-rw-r--r--nameser.h30
-rw-r--r--netdissect.h3
-rw-r--r--nfs.h6
-rw-r--r--ntp.c23
-rw-r--r--print-802_11.c6
-rw-r--r--print-802_15_4.c74
-rw-r--r--print-ahcp.c12
-rw-r--r--print-arista.c13
-rw-r--r--print-ascii.c2
-rw-r--r--print-bgp.c4
-rw-r--r--print-bootp.c8
-rw-r--r--print-domain.c72
-rw-r--r--print-eap.c28
-rw-r--r--print-eigrp.c2
-rw-r--r--print-forces.c24
-rw-r--r--print-icmp6.c24
-rw-r--r--print-krb.c2
-rw-r--r--print-l2tp.c12
-rw-r--r--print-lldp.c10
-rw-r--r--print-lspping.c3
-rw-r--r--print-lwres.c2
-rw-r--r--print-mpls.c2
-rw-r--r--print-ntp.c10
-rw-r--r--print-realtek.c2
-rw-r--r--print-ripng.c5
-rw-r--r--print-rx.c30
-rw-r--r--print-sflow.c32
-rw-r--r--print-sunrpc.c8
-rw-r--r--print-telnet.c8
-rw-r--r--print-udp.c18
-rw-r--r--print-vqp.c2
-rw-r--r--print-zep.c9
-rw-r--r--smbutil.c18
-rw-r--r--stime.awk2
-rw-r--r--tcpdump.1.in15
-rw-r--r--tcpdump.c22
-rw-r--r--tests/TESTLIST8
-rw-r--r--tests/hoobr_ripng_print.out2
-rw-r--r--tests/ieee802.11_parse_elements_oobr.out (renamed from tests/oobr_parse_elements.out)0
-rw-r--r--tests/ieee802.11_parse_elements_oobr.pcap (renamed from tests/oobr_parse_elements.pcap)bin295 -> 295 bytes
-rw-r--r--tests/rpl-14-daovvv.out2
-rw-r--r--tests/rpl-19-pickdag.out2
-rw-r--r--tests/rpl-19-pickdagvvv.out2
-rw-r--r--tests/rpl-dao-oobr.out2
-rw-r--r--udp.h2
-rw-r--r--util-print.c36
69 files changed, 432 insertions, 332 deletions
diff --git a/CHANGES b/CHANGES
index 410b0332..33ced66d 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,20 @@
+Friday, April 7, 2023 / The Tcpdump Group
+ Summary for 4.99.4 tcpdump release
+ Source code:
+ Fix spaces before tabs in indentation.
+ Updated printers:
+ LSP ping: Fix "Unused value" warnings from Coverity.
+ CVE-2023-1801: Fix an out-of-bounds write in the SMB printer.
+ DNS: sync resource types with IANA.
+ ICMPv6: Update the output to show a RPL DAO field name.
+ Geneve: Fix the Geneve UDP port test.
+ Building and testing:
+ Require at least autoconf 2.69.
+ Don't check for strftime(), as it's in C90 and beyond.
+ Update config.{guess,sub}, timestamps 2023-01-01,2023-01-21.
+ Documentation:
+ man: Document TCP flag names better.
+
Thursday, January 12, 2023 / The Tcpdump Group
Summary for 4.99.3 tcpdump release
Updated printers:
@@ -858,7 +875,7 @@ Mon. September 10, 2007. ken@xelerance.com. Summary for 3.9.8 tcpdump relea
Wed. July 23, 2007. mcr@xelerance.com. Summary for 3.9.7 libpcap release
- NFS: Print unsigned values as such.
+ NFS: Print unsigned values as such.
RX: parse safely.
BGP: fixes for IPv6-less builds.
801.1ag: use standard codepoint.
@@ -930,7 +947,7 @@ Tue. September 19, 2006. ken@xelerance.com. Summary for 3.9.5 tcpdump release
Lots of minor cosmetic changes to output printers
-Mon. September 19, 2005. ken@xelerance.com. Summary for 3.9.4 tcpdump release
+Mon. September 19, 2005. ken@xelerance.com. Summary for 3.9.4 tcpdump release
Decoder support for more Juniper link-layer types
Fix a potential buffer overflow (although it can't occur in
practice).
@@ -949,7 +966,7 @@ Mon. September 19, 2005. ken@xelerance.com. Summary for 3.9.4 tcpdump release
those TLVs as system IDs, not as node IDs.
Support for DCCP.
-Tue. July 5, 2005. ken@xelerance.com. Summary for 3.9.3 tcpdump release
+Tue. July 5, 2005. ken@xelerance.com. Summary for 3.9.3 tcpdump release
Option to chroot() when dropping privs
Fixes for compiling on nearly every platform,
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 73f32eaa..9495b5d4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -411,7 +411,6 @@ if(NOT HAVE_SNPRINTF)
endif()
check_function_exists(getopt_long HAVE_GETOPT_LONG)
-check_function_exists(strftime HAVE_STRFTIME)
check_function_exists(setlinebuf HAVE_SETLINEBUF)
#
# For Windows, don't need to waste time checking for fork() or vfork().
diff --git a/METADATA b/METADATA
index 63caf89d..d5009108 100644
--- a/METADATA
+++ b/METADATA
@@ -1,6 +1,6 @@
# This project was upgraded with external_updater.
# Usage: tools/external_updater/updater.sh update tcpdump
-# For more info, check https://cs.android.com/android/platform/superproject/+/master:tools/external_updater/README.md
+# For more info, check https://cs.android.com/android/platform/superproject/+/main:tools/external_updater/README.md
name: "tcpdump"
description: "the TCPdump network dissector"
@@ -13,14 +13,14 @@ third_party {
type: GIT
value: "https://github.com/the-tcpdump-group/tcpdump.git"
}
- version: "tcpdump-4.99.3"
+ version: "tcpdump-4.99.4"
license_type: NOTICE
+ security {
+ tag: "NVD-CPE2.3:cpe:/a:tcpdump:tcpdump:4.9.3"
+ }
last_upgrade_date {
year: 2023
- month: 1
- day: 24
- }
- security {
- tag: "NVD-CPE2.3:cpe:/a:tcpdump:tcpdump:4.9.3"
+ month: 7
+ day: 12
}
}
diff --git a/Makefile.in b/Makefile.in
index ad513ec7..1bdeb514 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,5 +1,5 @@
# Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
-# The Regents of the University of California. All rights reserved.
+# The Regents of the University of California. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that: (1) source code distributions
@@ -327,9 +327,9 @@ TAGHDR = \
/usr/include/netinet/in.h
TAGFILES = $(SRC) $(HDR) $(TAGHDR) $(LIBNETDISSECT_SRC) \
- print-pflog.c print-smb.c smbutil.c
+ print-smb.c smbutil.c
-CLEANFILES = $(PROG) $(OBJ) $(LIBNETDISSECT_OBJ)
+CLEANFILES = $(PROG) $(OBJ) $(LIBNETDISSECT_OBJ) print-smb.o smbutil.o
EXTRA_DIST = \
CHANGES \
@@ -378,7 +378,6 @@ EXTRA_DIST = \
missing/strsep.c \
mkdep \
packetdat.awk \
- print-pflog.c \
print-smb.c \
send-ack.awk \
smbutil.c \
@@ -524,6 +523,11 @@ whitespacecheck:
echo 'Error: Trailing tabs(s).'; \
exit 1; \
fi
+ @# space(s) before tab(s)?
+ @if git grep -I -n '[ ][ ]' $$(git ls-files|grep -v '^tests/'); then \
+ echo 'Error: space(s) before tab(s).'; \
+ exit 1; \
+ fi
testlist:
echo $(TEST_DIST)
diff --git a/README.md b/README.md
index a1f2ee6c..566b7b7a 100644
--- a/README.md
+++ b/README.md
@@ -58,7 +58,7 @@ LBL. To insure that there would be no vestige of proprietary code in
tcpdump, Steve wrote these pieces from the specification given by the
manual entry, with no access to the source of tcpdump or etherfind.
```text
-formerly from Lawrence Berkeley National Laboratory
+formerly from Lawrence Berkeley National Laboratory
Network Research Group <tcpdump@ee.lbl.gov>
ftp://ftp.ee.lbl.gov/old/tcpdump.tar.Z (3.4)
```
diff --git a/VERSION b/VERSION
index d7ba2fe7..9609202b 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-4.99.3
+4.99.4
diff --git a/addrtostr.c b/addrtostr.c
index 62cc298a..c3bdb8af 100644
--- a/addrtostr.c
+++ b/addrtostr.c
@@ -71,7 +71,7 @@ addrtostr (const void *src, char *dst, size_t size)
return NULL;
}
for (i = 0; i < 4; ++i) {
- int n = *srcaddr++;
+ int n = *srcaddr++;
int non_zerop = 0;
if (non_zerop || n / 100 > 0) {
@@ -167,7 +167,7 @@ addrtostr6 (const void *src, char *dst, size_t size)
if (best.base != -1 && i >= best.base && i < (best.base + best.len))
{
if (i == best.base)
- APPEND_CHAR(':');
+ APPEND_CHAR(':');
continue;
}
diff --git a/atime.awk b/atime.awk
index b42dec24..fa1c7a18 100644
--- a/atime.awk
+++ b/atime.awk
@@ -1,4 +1,4 @@
-$6 ~ /^ack/ && $5 !~ /[SFR]/ {
+$6 ~ /^ack/ && $5 !~ /[SFR]/ {
# given a tcpdump ftp trace, output one line for each ack
# in the form
# <ack time> <seq no>
diff --git a/chdlc.h b/chdlc.h
index d5a2d915..14bdb258 100644
--- a/chdlc.h
+++ b/chdlc.h
@@ -19,7 +19,7 @@
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#define CHDLC_HDRLEN 4
+#define CHDLC_HDRLEN 4
#define CHDLC_UNICAST 0x0f
#define CHDLC_BCAST 0x8f
#define CHDLC_TYPE_SLARP 0x8035
diff --git a/cmakeconfig.h.in b/cmakeconfig.h.in
index 370d3962..02a4a352 100644
--- a/cmakeconfig.h.in
+++ b/cmakeconfig.h.in
@@ -102,7 +102,7 @@
/* Define to 1 if you have the `pcap_dump_flush' function. */
#cmakedefine HAVE_PCAP_DUMP_FLUSH 1
-/* define if libpcap has pcap_dump_ftell() */
+/* Define to 1 if you have the `pcap_dump_ftell' function. */
#cmakedefine HAVE_PCAP_DUMP_FTELL 1
/* Define to 1 if you have the `pcap_dump_ftell64' function. */
@@ -180,9 +180,6 @@
/* Define to 1 if you have the `strdup' function. */
#cmakedefine HAVE_STRDUP 1
-/* Define to 1 if you have the `strftime' function. */
-#cmakedefine HAVE_STRFTIME 1
-
/* Define to 1 if you have the <strings.h> header file. */
#cmakedefine HAVE_STRINGS_H 1
diff --git a/config.guess b/config.guess
index a419d864..69188da7 100755
--- a/config.guess
+++ b/config.guess
@@ -1,10 +1,10 @@
#! /bin/sh
# Attempt to guess a canonical system name.
-# Copyright 1992-2022 Free Software Foundation, Inc.
+# Copyright 1992-2023 Free Software Foundation, Inc.
# shellcheck disable=SC2006,SC2268 # see below for rationale
-timestamp='2022-08-01'
+timestamp='2023-01-01'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@@ -60,7 +60,7 @@ version="\
GNU config.guess ($timestamp)
Originally written by Per Bothner.
-Copyright 1992-2022 Free Software Foundation, Inc.
+Copyright 1992-2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -966,6 +966,12 @@ EOF
GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC
;;
+ x86_64:[Mm]anagarm:*:*|i?86:[Mm]anagarm:*:*)
+ GUESS="$UNAME_MACHINE-pc-managarm-mlibc"
+ ;;
+ *:[Mm]anagarm:*:*)
+ GUESS="$UNAME_MACHINE-unknown-managarm-mlibc"
+ ;;
*:Minix:*:*)
GUESS=$UNAME_MACHINE-unknown-minix
;;
diff --git a/config.h b/config.h
index 414bfffe..38f1835d 100644
--- a/config.h
+++ b/config.h
@@ -236,7 +236,7 @@
#define PACKAGE_NAME "tcpdump"
/* Define to the full name and version of this package. */
-#define PACKAGE_STRING "tcpdump 4.99.3"
+#define PACKAGE_STRING "tcpdump 4.99.4"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "tcpdump"
@@ -245,7 +245,7 @@
#define PACKAGE_URL ""
/* Define to the version of this package. */
-#define PACKAGE_VERSION "4.99.3"
+#define PACKAGE_VERSION "4.99.4"
/* The size of `void *', as computed by sizeof. */
/* #undef SIZEOF_VOID_P */
diff --git a/config.h.in b/config.h.in
index 439038a6..59bc6120 100644
--- a/config.h.in
+++ b/config.h.in
@@ -180,9 +180,6 @@
/* Define to 1 if you have the `strdup' function. */
#undef HAVE_STRDUP
-/* Define to 1 if you have the `strftime' function. */
-#undef HAVE_STRFTIME
-
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
diff --git a/config.sub b/config.sub
index fbaa37f2..de4259e4 100755
--- a/config.sub
+++ b/config.sub
@@ -1,10 +1,10 @@
#! /bin/sh
# Configuration validation subroutine script.
-# Copyright 1992-2022 Free Software Foundation, Inc.
+# Copyright 1992-2023 Free Software Foundation, Inc.
# shellcheck disable=SC2006,SC2268 # see below for rationale
-timestamp='2022-08-01'
+timestamp='2023-01-21'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@@ -76,7 +76,7 @@ Report bugs and patches to <config-patches@gnu.org>."
version="\
GNU config.sub ($timestamp)
-Copyright 1992-2022 Free Software Foundation, Inc.
+Copyright 1992-2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -145,7 +145,7 @@ case $1 in
nto-qnx* | linux-* | uclinux-uclibc* \
| uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \
| netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \
- | storm-chaos* | os2-emx* | rtmk-nova*)
+ | storm-chaos* | os2-emx* | rtmk-nova* | managarm-*)
basic_machine=$field1
basic_os=$maybe_os
;;
@@ -1075,7 +1075,7 @@ case $cpu-$vendor in
pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
cpu=i586
;;
- pentiumpro-* | p6-* | 6x86-* | athlon-* | athalon_*-*)
+ pentiumpro-* | p6-* | 6x86-* | athlon-* | athlon_*-*)
cpu=i686
;;
pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
@@ -1341,6 +1341,10 @@ EOF
kernel=linux
os=`echo "$basic_os" | sed -e 's|linux|gnu|'`
;;
+ managarm*)
+ kernel=managarm
+ os=`echo "$basic_os" | sed -e 's|managarm|mlibc|'`
+ ;;
*)
kernel=
os=$basic_os
@@ -1754,7 +1758,7 @@ case $os in
| onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \
| midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \
| nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr* \
- | fiwix* )
+ | fiwix* | mlibc* )
;;
# This one is extra strict with allowed versions
sco3.2v2 | sco3.2v[4-9]* | sco5v6*)
@@ -1762,6 +1766,9 @@ case $os in
;;
none)
;;
+ kernel* )
+ # Restricted further below
+ ;;
*)
echo Invalid configuration \`"$1"\': OS \`"$os"\' not recognized 1>&2
exit 1
@@ -1772,16 +1779,26 @@ esac
# (given a valid OS), if there is a kernel.
case $kernel-$os in
linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* \
- | linux-musl* | linux-relibc* | linux-uclibc* )
+ | linux-musl* | linux-relibc* | linux-uclibc* | linux-mlibc* )
;;
uclinux-uclibc* )
;;
- -dietlibc* | -newlib* | -musl* | -relibc* | -uclibc* )
+ managarm-mlibc* | managarm-kernel* )
+ ;;
+ -dietlibc* | -newlib* | -musl* | -relibc* | -uclibc* | -mlibc* )
# These are just libc implementations, not actual OSes, and thus
# require a kernel.
echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2
exit 1
;;
+ -kernel* )
+ echo "Invalid configuration \`$1': \`$os' needs explicit kernel." 1>&2
+ exit 1
+ ;;
+ *-kernel* )
+ echo "Invalid configuration \`$1': \`$kernel' does not support \`$os'." 1>&2
+ exit 1
+ ;;
kfreebsd*-gnu* | kopensolaris*-gnu*)
;;
vxworks-simlinux | vxworks-simwindows | vxworks-spe)
diff --git a/configure b/configure
index 20854a47..53c62d5e 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for tcpdump 4.99.3.
+# Generated by GNU Autoconf 2.69 for tcpdump 4.99.4.
#
#
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -577,8 +577,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='tcpdump'
PACKAGE_TARNAME='tcpdump'
-PACKAGE_VERSION='4.99.3'
-PACKAGE_STRING='tcpdump 4.99.3'
+PACKAGE_VERSION='4.99.4'
+PACKAGE_STRING='tcpdump 4.99.4'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''
@@ -1258,7 +1258,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures tcpdump 4.99.3 to adapt to many kinds of systems.
+\`configure' configures tcpdump 4.99.4 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1323,7 +1323,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of tcpdump 4.99.3:";;
+ short | recursive ) echo "Configuration of tcpdump 4.99.4:";;
esac
cat <<\_ACEOF
@@ -1426,7 +1426,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-tcpdump configure 4.99.3
+tcpdump configure 4.99.4
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2074,7 +2074,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by tcpdump $as_me 4.99.3, which was
+It was created by tcpdump $as_me 4.99.4, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -5107,7 +5107,7 @@ esac
fi
-for ac_func in fork vfork strftime
+for ac_func in fork vfork
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
@@ -8883,7 +8883,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by tcpdump $as_me 4.99.3, which was
+This file was extended by tcpdump $as_me 4.99.4, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -8949,7 +8949,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-tcpdump config.status 4.99.3
+tcpdump config.status 4.99.4
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
diff --git a/configure.ac b/configure.ac
index fddc6ed2..18d59b6d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -13,7 +13,7 @@ dnl
# config.sub.
#
-AC_PREREQ(2.64)
+AC_PREREQ(2.69)
AC_INIT(tcpdump, m4_esyscmd_s([cat VERSION]))
AC_CONFIG_SRCDIR(tcpdump.c)
@@ -380,7 +380,7 @@ if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
fi
AC_REPLACE_FUNCS(strlcat strlcpy strdup strsep getservent getopt_long)
-AC_CHECK_FUNCS(fork vfork strftime)
+AC_CHECK_FUNCS(fork vfork)
AC_CHECK_FUNCS(setlinebuf)
#
diff --git a/ethertype.h b/ethertype.h
index 8f8acff0..8b71b302 100644
--- a/ethertype.h
+++ b/ethertype.h
@@ -174,16 +174,16 @@
#define ETHERTYPE_LLDP 0x88cc
#endif
#ifndef ETHERTYPE_EAPOL
-#define ETHERTYPE_EAPOL 0x888e
+#define ETHERTYPE_EAPOL 0x888e
#endif
#ifndef ETHERTYPE_REALTEK
-#define ETHERTYPE_REALTEK 0x8899 /* Realtek layer 2 protocols and switch tags */
+#define ETHERTYPE_REALTEK 0x8899 /* Realtek layer 2 protocols and switch tags */
#endif
#ifndef ETHERTYPE_AOE
-#define ETHERTYPE_AOE 0x88a2
+#define ETHERTYPE_AOE 0x88a2
#endif
#ifndef ETHERTYPE_PTP
-#define ETHERTYPE_PTP 0x88f7
+#define ETHERTYPE_PTP 0x88f7
#endif
#ifndef ETHERTYPE_LOOPBACK
#define ETHERTYPE_LOOPBACK 0x9000
diff --git a/ip6.h b/ip6.h
index 28725d05..f927d204 100644
--- a/ip6.h
+++ b/ip6.h
@@ -1,4 +1,4 @@
-/* NetBSD: ip6.h,v 1.9 2000/07/13 05:34:21 itojun Exp */
+/* NetBSD: ip6.h,v 1.9 2000/07/13 05:34:21 itojun Exp */
/* $KAME: ip6.h,v 1.9 2000/07/02 21:01:32 itojun Exp $ */
/*
@@ -136,7 +136,7 @@ struct ip6_dest {
#define IP6OPT_RTALERT_LEN 4
#define IP6OPT_RTALERT_MLD 0 /* Datagram contains an MLD message */
#define IP6OPT_RTALERT_RSVP 1 /* Datagram contains an RSVP message */
-#define IP6OPT_RTALERT_ACTNET 2 /* contains an Active Networks msg */
+#define IP6OPT_RTALERT_ACTNET 2 /* contains an Active Networks msg */
#define IP6OPT_MINLEN 2
#define IP6OPT_QUICK_START 0x26 /* 00 1 00110 */
diff --git a/ipproto.h b/ipproto.h
index baec4bdc..30be911e 100644
--- a/ipproto.h
+++ b/ipproto.h
@@ -78,7 +78,7 @@ extern const char *netdb_protoname (const uint8_t);
#define IPPROTO_FRAGMENT 44 /* IPv6 fragmentation header */
#endif
#ifndef IPPROTO_RSVP
-#define IPPROTO_RSVP 46 /* resource reservation */
+#define IPPROTO_RSVP 46 /* resource reservation */
#endif
#ifndef IPPROTO_GRE
#define IPPROTO_GRE 47 /* General Routing Encap. */
diff --git a/missing/getopt_long.c b/missing/getopt_long.c
index 927028ff..ece00062 100644
--- a/missing/getopt_long.c
+++ b/missing/getopt_long.c
@@ -70,7 +70,7 @@
/* return values */
#define BADCH (int)'?'
#define BADARG ((*options == ':') ? (int)':' : (int)'?')
-#define INORDER (int)1
+#define INORDER (int)1
#define EMSG ""
diff --git a/missing/strlcat.c b/missing/strlcat.c
index f41207be..fab7d04f 100644
--- a/missing/strlcat.c
+++ b/missing/strlcat.c
@@ -1,5 +1,5 @@
/* $NetBSD: strlcat.c,v 1.5 1999/09/20 04:39:47 lukem Exp $ */
-/* from OpenBSD: strlcat.c,v 1.2 1999/06/17 16:28:58 millert Exp */
+/* from OpenBSD: strlcat.c,v 1.2 1999/06/17 16:28:58 millert Exp */
/*
* Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
diff --git a/missing/strlcpy.c b/missing/strlcpy.c
index 2dc51b96..9a0b6e6a 100644
--- a/missing/strlcpy.c
+++ b/missing/strlcpy.c
@@ -1,5 +1,5 @@
/* $NetBSD: strlcpy.c,v 1.5 1999/09/20 04:39:47 lukem Exp $ */
-/* from OpenBSD: strlcpy.c,v 1.4 1999/05/01 18:56:41 millert Exp */
+/* from OpenBSD: strlcpy.c,v 1.4 1999/05/01 18:56:41 millert Exp */
/*
* Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
diff --git a/mkdep b/mkdep
index 6496b831..caf547e2 100755
--- a/mkdep
+++ b/mkdep
@@ -87,7 +87,7 @@ _EOF_
# hack can't deal with anything that requires a search path, and doesn't
# even try for anything using bracket (<>) syntax.
#
-# egrep '^#include[ ]*".*"' /dev/null $* |
+# grep -E '^#include[[:blank:]]*".*"' /dev/null $* |
# sed -e 's/:[^"]*"\([^"]*\)".*/: \1/' -e 's/\.c/.o/' |
#
diff --git a/nameser.h b/nameser.h
index 526c60ca..2a1854fd 100644
--- a/nameser.h
+++ b/nameser.h
@@ -169,13 +169,35 @@
#define T_RRSIG 46 /* new security signature */
#define T_NSEC 47 /* provable insecure information */
#define T_DNSKEY 48 /* new security key */
+#define T_DHCID 49 /* DHCP IDentifier */
+#define T_NSEC3 50 /* Next SECure record v3 */
+#define T_NSEC3PARAM 51 /* NSEC3 PARAMeter */
+#define T_TLSA 52 /* TLS Authentication */
+#define T_SMIMEA 53 /* S/MIME Authentication */
+/* Unassigned */
+#define T_HIP 55 /* Host Identity Protocol */
+#define T_NINFO 56 /* zone status information */
+#define T_RKEY 57 /* Record encryption KEY */
+#define T_TALINK 58 /* Trust Anchor LINK */
+#define T_CDS 59 /* Child Delegation Signer */
+#define T_CDNSKEY 60 /* Child DNSKEY */
+#define T_OPENPGPKEY 61 /* OpenPGP KEY */
+#define T_CSYNC 62 /* Child to parent SYNCronization */
+#define T_ZONEMD 63 /* ZONE data Message Digest */
+#define T_SVCB 64 /* SerViCe Binding */
+#define T_HTTPS 65 /* HTTPS binding */
/* non standard */
#define T_SPF 99 /* sender policy framework */
#define T_UINFO 100 /* user (finger) information */
#define T_UID 101 /* user ID */
#define T_GID 102 /* group ID */
#define T_UNSPEC 103 /* Unspecified format (binary data) */
-#define T_UNSPECA 104 /* "unspecified ASCII". Ugly MIT hack */
+#define T_NID 104 /* Node IDentifier */
+#define T_L32 105 /* Locator 32-bit */
+#define T_L64 106 /* Locator 64-bit */
+#define T_LP 107 /* Locator Pointer */
+#define T_EUI48 108 /* an EUI-48 address */
+#define T_EUI64 109 /* an EUI-64 address */
/* Query type values which do not appear in resource records */
#define T_TKEY 249 /* Transaction Key [RFC2930] */
#define T_TSIG 250 /* Transaction Signature [RFC2845] */
@@ -185,6 +207,12 @@
#define T_MAILA 254 /* transfer mail agent records */
#define T_ANY 255 /* wildcard match */
#define T_URI 256 /* uri records [RFC7553] */
+#define T_CAA 257 /* Certification Authority Authorization */
+#define T_AVC 258 /* Application Visibility and Control */
+#define T_DOA 259 /* Digital Object Architecture */
+#define T_AMTRELAY 260 /* Automatic Multicast Tunneling RELAY */
+#define T_TA 32768 /* DNSSEC Trust Authorities */
+#define T_DLV 32769 /* DNSSEC Lookaside Validation */
/*
* Values for class field
diff --git a/netdissect.h b/netdissect.h
index 5c16be66..b1074ef7 100644
--- a/netdissect.h
+++ b/netdissect.h
@@ -423,6 +423,9 @@ extern void ts_print(netdissect_options *, const struct timeval *);
extern void signed_relts_print(netdissect_options *, int32_t);
extern void unsigned_relts_print(netdissect_options *, uint32_t);
+extern const char *nd_format_time(char *buf, size_t bufsize,
+ const char *format, const struct tm *timeptr);
+
extern void fn_print_char(netdissect_options *, u_char);
extern void fn_print_str(netdissect_options *, const u_char *);
extern u_int nd_printztn(netdissect_options *, const u_char *, u_int, const u_char *);
diff --git a/nfs.h b/nfs.h
index 76747f18..87ba1a71 100644
--- a/nfs.h
+++ b/nfs.h
@@ -1,4 +1,4 @@
-/* NetBSD: nfs.h,v 1.1 1996/05/23 22:49:53 fvdl Exp */
+/* NetBSD: nfs.h,v 1.1 1996/05/23 22:49:53 fvdl Exp */
/*
* Copyright (c) 1989, 1993
@@ -120,8 +120,8 @@
#define NFSX_V3SATTR 60 /* max. all fields filled in */
#define NFSX_V3POSTOPATTR (NFSX_V3FATTR + NFSX_UNSIGNED)
#define NFSX_V3WCCDATA (NFSX_V3POSTOPATTR + 8 * NFSX_UNSIGNED)
-#define NFSX_V3COOKIEVERF 8
-#define NFSX_V3WRITEVERF 8
+#define NFSX_V3COOKIEVERF 8
+#define NFSX_V3WRITEVERF 8
#define NFSX_V3CREATEVERF 8
#define NFSX_V3STATFS 52
#define NFSX_V3FSINFO 48
diff --git a/ntp.c b/ntp.c
index 4d17932f..ec8f659a 100644
--- a/ntp.c
+++ b/ntp.c
@@ -48,15 +48,14 @@ p_ntp_time(netdissect_options *ndo,
f = (uint32_t)(ff * 1000000000.0); /* treat fraction as parts per billion */
ND_PRINT("%u.%09u", i, f);
-#ifdef HAVE_STRFTIME
/*
* print the UTC time in human-readable format.
*/
if (i) {
int64_t seconds_64bit = (int64_t)i - JAN_1970;
time_t seconds;
- struct tm *tm;
char time_buf[128];
+ const char *time_string;
seconds = (time_t)seconds_64bit;
if (seconds != seconds_64bit) {
@@ -64,22 +63,12 @@ p_ntp_time(netdissect_options *ndo,
* It doesn't fit into a time_t, so we can't hand it
* to gmtime.
*/
- ND_PRINT(" (unrepresentable)");
+ time_string = "[Time is too large to fit into a time_t]";
} else {
- tm = gmtime(&seconds);
- if (tm == NULL) {
- /*
- * gmtime() can't handle it.
- * (Yes, that might happen with some version of
- * Microsoft's C library.)
- */
- ND_PRINT(" (unrepresentable)");
- } else {
- /* use ISO 8601 (RFC3339) format */
- strftime(time_buf, sizeof (time_buf), "%Y-%m-%dT%H:%M:%SZ", tm);
- ND_PRINT(" (%s)", time_buf);
- }
+ /* use ISO 8601 (RFC3339) format */
+ time_string = nd_format_time(time_buf, sizeof (time_buf),
+ "%Y-%m-%dT%H:%M:%SZ", gmtime(&seconds));
}
+ ND_PRINT(" (%s)", time_string);
}
-#endif
}
diff --git a/print-802_11.c b/print-802_11.c
index dc8953a9..62cc9a58 100644
--- a/print-802_11.c
+++ b/print-802_11.c
@@ -949,8 +949,8 @@ static const char *status_text[] = {
"Reserved", /* 69 */
"Reserved", /* 70 */
"Reserved", /* 71 */
- "Invalid contents of RSNE", /* 72 */
- "U-APSD coexistence is not supported", /* 73 */
+ "Invalid contents of RSNE", /* 72 */
+ "U-APSD coexistence is not supported", /* 73 */
"Requested U-APSD coexistence mode is not supported", /* 74 */
"Requested Interval/Duration value cannot be "
"supported with U-APSD coexistence", /* 75 */
@@ -997,7 +997,7 @@ static const char *status_text[] = {
"Spectrum Management field is unacceptable", /* 103 */
"Association denied because the requesting STA "
"does not support VHT features", /* 104 */
- "Enablement denied", /* 105 */
+ "Enablement denied", /* 105 */
"Enablement denied due to restriction from an "
"authorized GDB", /* 106 */
"Authorization deenabled", /* 107 */
diff --git a/print-802_15_4.c b/print-802_15_4.c
index 1895be7c..fd75b159 100644
--- a/print-802_15_4.c
+++ b/print-802_15_4.c
@@ -1,7 +1,7 @@
/*
* Copyright (c) 2009
- * Siemens AG, All rights reserved.
- * Dmitry Eremin-Solenikov (dbaryshkov@gmail.com)
+ * Siemens AG, All rights reserved.
+ * Dmitry Eremin-Solenikov (dbaryshkov@gmail.com)
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that: (1) source code distributions
@@ -41,13 +41,13 @@
/* Frame types from Table 7-1 of 802.15.4-2015 */
static const char *ftypes[] = {
"Beacon", /* 0 */
- "Data", /* 1 */
+ "Data", /* 1 */
"ACK", /* 2 */
"Command", /* 3 */
"Reserved", /* 4 */
"Multipurpose", /* 5 */
"Fragment", /* 6 */
- "Extended" /* 7 */
+ "Extended" /* 7 */
};
/* Element IDs for Header IEs from Table 7-7 of 802.15.4-2015 */
@@ -87,15 +87,15 @@ static const char *h_ie_names[] = {
"Reserved 0x20", /* 0x20 */
"Extended DSME PAN descriptor IE", /* 0x21 */
"Fragment Sequence Context Description IE", /* 0x22 */
- "Simplified Superframe Specification IE", /* 0x23 */
- "Simplified GTS Specification IE", /* 0x24 */
- "LECIM Capabilities IE", /* 0x25 */
- "TRLE Descriptor IE", /* 0x26 */
- "RCC Capabilities IE", /* 0x27 */
- "RCCN Descriptor IE", /* 0x28 */
- "Global Time IE", /* 0x29 */
- "Omnibus Header IE", /* 0x2a */
- "DA IE", /* 0x2b */
+ "Simplified Superframe Specification IE", /* 0x23 */
+ "Simplified GTS Specification IE", /* 0x24 */
+ "LECIM Capabilities IE", /* 0x25 */
+ "TRLE Descriptor IE", /* 0x26 */
+ "RCC Capabilities IE", /* 0x27 */
+ "RCCN Descriptor IE", /* 0x28 */
+ "Global Time IE", /* 0x29 */
+ "Omnibus Header IE", /* 0x2a */
+ "DA IE", /* 0x2b */
"Reserved 0x2c", /* 0x2c */
"Reserved 0x2d", /* 0x2d */
"Reserved 0x2e", /* 0x2e */
@@ -179,7 +179,7 @@ static const char *h_ie_names[] = {
"Reserved 0x7c", /* 0x7c */
"Reserved 0x7d", /* 0x7d */
"Header Termination 1 IE", /* 0x7e */
- "Header Termination 2 IE" /* 0x7f */
+ "Header Termination 2 IE" /* 0x7f */
};
/* Payload IE Group IDs from Table 7-15 of 802.15.4-2015 */
@@ -199,7 +199,7 @@ static const char *p_ie_names[] = {
"Reserved 0x0c", /* 0x0c */
"Reserved 0x0d", /* 0x0d */
"Reserved 0x0e", /* 0x0e */
- "List termination" /* 0x0f */
+ "List termination" /* 0x0f */
};
/* Sub-ID for short format from Table 7-16 of 802.15.4-2015 */
@@ -239,15 +239,15 @@ static const char *p_mlme_short_names[] = {
"All MAC Metrics IE", /* 0x20 */
"Coexistence Specification IE", /* 0x21 */
"SUN Device Capabilities IE", /* 0x22 */
- "SUN FSK Generic PHY IE", /* 0x23 */
- "Mode Switch Parameter IE", /* 0x24 */
- "PHY Parameter Change IE", /* 0x25 */
- "O-QPSK PHY Mode IE", /* 0x26 */
- "PCA Allocation IE", /* 0x27 */
- "LECIM DSSS Operating Mode IE", /* 0x28 */
- "LECIM FSK Operating Mode IE", /* 0x29 */
- "Reserved 0x2a", /* 0x2a */
- "TVWS PHY Operating Mode Description IE", /* 0x2b */
+ "SUN FSK Generic PHY IE", /* 0x23 */
+ "Mode Switch Parameter IE", /* 0x24 */
+ "PHY Parameter Change IE", /* 0x25 */
+ "O-QPSK PHY Mode IE", /* 0x26 */
+ "PCA Allocation IE", /* 0x27 */
+ "LECIM DSSS Operating Mode IE", /* 0x28 */
+ "LECIM FSK Operating Mode IE", /* 0x29 */
+ "Reserved 0x2a", /* 0x2a */
+ "TVWS PHY Operating Mode Description IE", /* 0x2b */
"TVWS Device Capabilities IE", /* 0x2c */
"TVWS Device Category IE", /* 0x2d */
"TVWS Device Identiication IE", /* 0x2e */
@@ -331,7 +331,7 @@ static const char *p_mlme_short_names[] = {
"Reserved 0x7c", /* 0x7c */
"Reserved 0x7d", /* 0x7d */
"Reserved 0x7e", /* 0x7e */
- "Reserved 0x7f" /* 0x7f */
+ "Reserved 0x7f" /* 0x7f */
};
/* Sub-ID for long format from Table 7-17 of 802.15.4-2015 */
@@ -351,7 +351,7 @@ static const char *p_mlme_long_names[] = {
"Reserved 0x0c", /* 0x0c */
"Reserved 0x0d", /* 0x0d */
"Reserved 0x0e", /* 0x0e */
- "Reserved 0x0f" /* 0x0f */
+ "Reserved 0x0f" /* 0x0f */
};
/* MAC commands from Table 7-49 of 802.15.4-2015 */
@@ -390,20 +390,20 @@ static const char *mac_c_names[] = {
"Reserved 0x1f", /* 0x1f */
"RIT Data Request command", /* 0x20 */
"DBS Request command", /* 0x21 */
- "DBS Response command", /* 0x22 */
- "RIT Data Response command", /* 0x23 */
- "Vendor Specific command", /* 0x24 */
- "Reserved 0x25", /* 0x25 */
- "Reserved 0x26", /* 0x26 */
- "Reserved 0x27", /* 0x27 */
- "Reserved 0x28", /* 0x28 */
- "Reserved 0x29", /* 0x29 */
- "Reserved 0x2a", /* 0x2a */
- "Reserved 0x2b", /* 0x2b */
+ "DBS Response command", /* 0x22 */
+ "RIT Data Response command", /* 0x23 */
+ "Vendor Specific command", /* 0x24 */
+ "Reserved 0x25", /* 0x25 */
+ "Reserved 0x26", /* 0x26 */
+ "Reserved 0x27", /* 0x27 */
+ "Reserved 0x28", /* 0x28 */
+ "Reserved 0x29", /* 0x29 */
+ "Reserved 0x2a", /* 0x2a */
+ "Reserved 0x2b", /* 0x2b */
"Reserved 0x2c", /* 0x2c */
"Reserved 0x2d", /* 0x2d */
"Reserved 0x2e", /* 0x2e */
- "Reserved 0x2f" /* 0x2f */
+ "Reserved 0x2f" /* 0x2f */
};
/*
diff --git a/print-ahcp.c b/print-ahcp.c
index 9859f760..d57edda9 100644
--- a/print-ahcp.c
+++ b/print-ahcp.c
@@ -102,18 +102,14 @@ ahcp_time_print(netdissect_options *ndo,
const u_char *cp, uint8_t len)
{
time_t t;
- struct tm *tm;
- char buf[BUFSIZE];
+ char buf[sizeof("-yyyyyyyyyy-mm-dd hh:mm:ss UTC")];
if (len != 4)
goto invalid;
t = GET_BE_U_4(cp);
- if (NULL == (tm = gmtime(&t)))
- ND_PRINT(": gmtime() error");
- else if (0 == strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", tm))
- ND_PRINT(": strftime() error");
- else
- ND_PRINT(": %s UTC", buf);
+ ND_PRINT(": %s",
+ nd_format_time(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S UTC",
+ gmtime(&t)));
return;
invalid:
diff --git a/print-arista.c b/print-arista.c
index 039a1ffd..079ad684 100644
--- a/print-arista.c
+++ b/print-arista.c
@@ -10,7 +10,6 @@
#include "netdissect.h"
#include "extract.h"
-#include "addrtoname.h"
/*
@@ -93,17 +92,13 @@ arista_print_date_hms_time(netdissect_options *ndo, uint32_t seconds,
uint32_t nanoseconds)
{
time_t ts;
- struct tm *tm;
- char buf[BUFSIZE];
+ char buf[sizeof("-yyyyyyyyyy-mm-dd hh:mm:ss")];
ts = seconds + (nanoseconds / 1000000000);
nanoseconds %= 1000000000;
- if (NULL == (tm = gmtime(&ts)))
- ND_PRINT("gmtime() error");
- else if (0 == strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", tm))
- ND_PRINT("strftime() error");
- else
- ND_PRINT("%s.%09u", buf, nanoseconds);
+ ND_PRINT("%s.%09u",
+ nd_format_time(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S",
+ gmtime(&ts)), nanoseconds);
}
int
diff --git a/print-ascii.c b/print-ascii.c
index 2f5fe854..a1dc4eb1 100644
--- a/print-ascii.c
+++ b/print-ascii.c
@@ -1,4 +1,4 @@
-/* $NetBSD: print-ascii.c,v 1.1 1999/09/30 14:49:12 sjg Exp $ */
+/* $NetBSD: print-ascii.c,v 1.1 1999/09/30 14:49:12 sjg Exp $ */
/*-
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
diff --git a/print-bgp.c b/print-bgp.c
index e13fdd91..efeaea45 100644
--- a/print-bgp.c
+++ b/print-bgp.c
@@ -2215,8 +2215,8 @@ bgp_attr_print(netdissect_options *ndo,
ND_PRINT("\n\t %u SNPA", snpa);
for (/*nothing*/; snpa != 0; snpa--) {
uint8_t snpalen;
- if (tlen < 1)
- goto trunc;
+ if (tlen < 1)
+ goto trunc;
snpalen = GET_U_1(tptr);
ND_PRINT("\n\t %u bytes", snpalen);
tptr++;
diff --git a/print-bootp.c b/print-bootp.c
index f84b77ca..d230a24c 100644
--- a/print-bootp.c
+++ b/print-bootp.c
@@ -210,8 +210,8 @@ struct bootp {
#define TAG_CLIENT_GUID ((uint8_t) 97)
#define TAG_LDAP_URL ((uint8_t) 95)
/* RFC 4833, TZ codes */
-#define TAG_TZ_PCODE ((uint8_t) 100)
-#define TAG_TZ_TCODE ((uint8_t) 101)
+#define TAG_TZ_PCODE ((uint8_t) 100)
+#define TAG_TZ_TCODE ((uint8_t) 101)
#define TAG_NETINFO_PARENT ((uint8_t) 112)
#define TAG_NETINFO_PARENT_TAG ((uint8_t) 113)
#define TAG_URL ((uint8_t) 114)
@@ -515,8 +515,8 @@ static const struct tok tag2str[] = {
{ TAG_CLIENT_NDI, "bNDI" }, /* XXX 'b' */
{ TAG_CLIENT_GUID, "bGUID" }, /* XXX 'b' */
{ TAG_LDAP_URL, "aLDAP" },
- { TAG_TZ_PCODE, "aPOSIX-TZ" },
- { TAG_TZ_TCODE, "aTZ-Name" },
+ { TAG_TZ_PCODE, "aPOSIX-TZ" },
+ { TAG_TZ_TCODE, "aTZ-Name" },
{ TAG_NETINFO_PARENT, "iNI" },
{ TAG_NETINFO_PARENT_TAG, "aNITAG" },
{ TAG_URL, "aURL" },
diff --git a/print-domain.c b/print-domain.c
index c3c6fd8f..d2275a5e 100644
--- a/print-domain.c
+++ b/print-domain.c
@@ -495,51 +495,78 @@ const struct tok ns_type2str[] = {
{ T_MX, "MX" }, /* RFC 1035 */
{ T_TXT, "TXT" }, /* RFC 1035 */
{ T_RP, "RP" }, /* RFC 1183 */
- { T_AFSDB, "AFSDB" }, /* RFC 1183 */
+ { T_AFSDB, "AFSDB" }, /* RFC 5864 */
{ T_X25, "X25" }, /* RFC 1183 */
{ T_ISDN, "ISDN" }, /* RFC 1183 */
{ T_RT, "RT" }, /* RFC 1183 */
{ T_NSAP, "NSAP" }, /* RFC 1706 */
- { T_NSAP_PTR, "NSAP_PTR" },
- { T_SIG, "SIG" }, /* RFC 2535 */
- { T_KEY, "KEY" }, /* RFC 2535 */
+ { T_NSAP_PTR, "NSAP_PTR" }, /* RFC 1706 */
+ { T_SIG, "SIG" }, /* RFC 3008 */
+ { T_KEY, "KEY" }, /* RFC 3110 */
{ T_PX, "PX" }, /* RFC 2163 */
{ T_GPOS, "GPOS" }, /* RFC 1712 */
- { T_AAAA, "AAAA" }, /* RFC 1886 */
+ { T_AAAA, "AAAA" }, /* RFC 3596 */
{ T_LOC, "LOC" }, /* RFC 1876 */
- { T_NXT, "NXT" }, /* RFC 2535 */
+ { T_NXT, "NXT" }, /* RFC 3755 */
{ T_EID, "EID" }, /* Nimrod */
{ T_NIMLOC, "NIMLOC" }, /* Nimrod */
{ T_SRV, "SRV" }, /* RFC 2782 */
{ T_ATMA, "ATMA" }, /* ATM Forum */
- { T_NAPTR, "NAPTR" }, /* RFC 2168, RFC 2915 */
+ { T_NAPTR, "NAPTR" }, /* RFC 3403 */
{ T_KX, "KX" }, /* RFC 2230 */
- { T_CERT, "CERT" }, /* RFC 2538 */
- { T_A6, "A6" }, /* RFC 2874 */
- { T_DNAME, "DNAME" }, /* RFC 2672 */
- { T_SINK, "SINK" },
- { T_OPT, "OPT" }, /* RFC 2671 */
- { T_APL, "APL" }, /* RFC 3123 */
+ { T_CERT, "CERT" }, /* RFC 4398 */
+ { T_A6, "A6" }, /* RFC 6563 */
+ { T_DNAME, "DNAME" }, /* RFC 6672 */
+ { T_SINK, "SINK" },
+ { T_OPT, "OPT" }, /* RFC 6891 */
+ { T_APL, "APL" }, /* RFC 3123 */
{ T_DS, "DS" }, /* RFC 4034 */
{ T_SSHFP, "SSHFP" }, /* RFC 4255 */
{ T_IPSECKEY, "IPSECKEY" }, /* RFC 4025 */
- { T_RRSIG, "RRSIG" }, /* RFC 4034 */
+ { T_RRSIG, "RRSIG" }, /* RFC 4034 */
{ T_NSEC, "NSEC" }, /* RFC 4034 */
{ T_DNSKEY, "DNSKEY" }, /* RFC 4034 */
- { T_SPF, "SPF" }, /* RFC-schlitt-spf-classic-02.txt */
+ { T_DHCID, "DHCID" }, /* RFC 4071 */
+ { T_NSEC3, "NSEC3" }, /* RFC 5155 */
+ { T_NSEC3PARAM, "NSEC3PARAM" }, /* RFC 5155 */
+ { T_TLSA, "TLSA" }, /* RFC 6698 */
+ { T_SMIMEA, "SMIMEA" }, /* RFC 8162 */
+ { T_HIP, "HIP" }, /* RFC 8005 */
+ { T_NINFO, "NINFO" },
+ { T_RKEY, "RKEY" },
+ { T_TALINK, "TALINK" },
+ { T_CDS, "CDS" }, /* RFC 7344 */
+ { T_CDNSKEY, "CDNSKEY" }, /* RFC 7344 */
+ { T_OPENPGPKEY, "OPENPGPKEY" }, /* RFC 7929 */
+ { T_CSYNC, "CSYNC" }, /* RFC 7477 */
+ { T_ZONEMD, "ZONEMD" }, /* RFC 8976 */
+ { T_SVCB, "SVCB" },
+ { T_HTTPS, "HTTPS" },
+ { T_SPF, "SPF" }, /* RFC 7208 */
{ T_UINFO, "UINFO" },
{ T_UID, "UID" },
{ T_GID, "GID" },
{ T_UNSPEC, "UNSPEC" },
- { T_UNSPECA, "UNSPECA" },
+ { T_NID, "NID" }, /* RFC 6742 */
+ { T_L32, "L32" }, /* RFC 6742 */
+ { T_L64, "L64" }, /* RFC 6742 */
+ { T_LP, "LP" }, /* RFC 6742 */
+ { T_EUI48, "EUI48" }, /* RFC 7043 */
+ { T_EUI64, "EUI64" }, /* RFC 7043 */
{ T_TKEY, "TKEY" }, /* RFC 2930 */
- { T_TSIG, "TSIG" }, /* RFC 2845 */
+ { T_TSIG, "TSIG" }, /* RFC 8945 */
{ T_IXFR, "IXFR" }, /* RFC 1995 */
- { T_AXFR, "AXFR" }, /* RFC 1035 */
+ { T_AXFR, "AXFR" }, /* RFC 5936 */
{ T_MAILB, "MAILB" }, /* RFC 1035 */
{ T_MAILA, "MAILA" }, /* RFC 1035 */
- { T_ANY, "ANY" },
+ { T_ANY, "ANY" }, /* RFC 8482 */
{ T_URI, "URI" }, /* RFC 7553 */
+ { T_CAA, "CAA" }, /* RFC 8659 */
+ { T_AVC, "AVC" },
+ { T_DOA, "DOA" },
+ { T_AMTRELAY, "AMTRELAY" }, /* RFC 8777 */
+ { T_TA, "TA" },
+ { T_DLV, "DLV" }, /* RFC 8749 */
{ 0, NULL }
};
@@ -834,13 +861,6 @@ ns_rprint(netdissect_options *ndo,
}
break;
- case T_UNSPECA: /* One long string */
- if (!ND_TTEST_LEN(cp, len))
- return(NULL);
- if (nd_printn(ndo, cp, len, ndo->ndo_snapend))
- return(NULL);
- break;
-
case T_TSIG:
{
if (cp + len > ndo->ndo_snapend)
diff --git a/print-eap.c b/print-eap.c
index e154165a..78439b71 100644
--- a/print-eap.c
+++ b/print-eap.c
@@ -42,11 +42,11 @@ struct eap_frame_t {
};
static const struct tok eap_frame_type_values[] = {
- { EAP_FRAME_TYPE_PACKET, "EAP packet" },
- { EAP_FRAME_TYPE_START, "EAPOL start" },
- { EAP_FRAME_TYPE_LOGOFF, "EAPOL logoff" },
- { EAP_FRAME_TYPE_KEY, "EAPOL key" },
- { EAP_FRAME_TYPE_ENCAP_ASF_ALERT, "Encapsulated ASF alert" },
+ { EAP_FRAME_TYPE_PACKET, "EAP packet" },
+ { EAP_FRAME_TYPE_START, "EAPOL start" },
+ { EAP_FRAME_TYPE_LOGOFF, "EAPOL logoff" },
+ { EAP_FRAME_TYPE_KEY, "EAPOL key" },
+ { EAP_FRAME_TYPE_ENCAP_ASF_ALERT, "Encapsulated ASF alert" },
{ 0, NULL}
};
@@ -89,21 +89,21 @@ static const struct tok eap_type_values[] = {
{ EAP_TYPE_NO_PROPOSED, "No proposed" },
{ EAP_TYPE_IDENTITY, "Identity" },
{ EAP_TYPE_NOTIFICATION, "Notification" },
- { EAP_TYPE_NAK, "Nak" },
+ { EAP_TYPE_NAK, "Nak" },
{ EAP_TYPE_MD5_CHALLENGE, "MD5-challenge" },
- { EAP_TYPE_OTP, "OTP" },
- { EAP_TYPE_GTC, "GTC" },
- { EAP_TYPE_TLS, "TLS" },
- { EAP_TYPE_SIM, "SIM" },
- { EAP_TYPE_TTLS, "TTLS" },
- { EAP_TYPE_AKA, "AKA" },
- { EAP_TYPE_FAST, "FAST" },
+ { EAP_TYPE_OTP, "OTP" },
+ { EAP_TYPE_GTC, "GTC" },
+ { EAP_TYPE_TLS, "TLS" },
+ { EAP_TYPE_SIM, "SIM" },
+ { EAP_TYPE_TTLS, "TTLS" },
+ { EAP_TYPE_AKA, "AKA" },
+ { EAP_TYPE_FAST, "FAST" },
{ EAP_TYPE_EXPANDED_TYPES, "Expanded types" },
{ EAP_TYPE_EXPERIMENTAL, "Experimental" },
{ 0, NULL}
};
-#define EAP_TLS_EXTRACT_BIT_L(x) (((x)&0x80)>>7)
+#define EAP_TLS_EXTRACT_BIT_L(x) (((x)&0x80)>>7)
/* RFC 5216 - EAP TLS bits */
#define EAP_TLS_FLAGS_LEN_INCLUDED (1 << 7)
diff --git a/print-eigrp.c b/print-eigrp.c
index 1bcdf179..2702beb2 100644
--- a/print-eigrp.c
+++ b/print-eigrp.c
@@ -318,7 +318,7 @@ eigrp_print(netdissect_options *ndo, const u_char *pptr, u_int len)
tlv_ptr.eigrp_tlv_general_parm = (const struct eigrp_tlv_general_parm_t *)tlv_tptr;
if (tlv_tlen < sizeof(*tlv_ptr.eigrp_tlv_general_parm)) {
ND_PRINT(" (too short, < %zu)",
- sizeof(struct eigrp_tlv_header) + sizeof(*tlv_ptr.eigrp_tlv_general_parm));
+ sizeof(struct eigrp_tlv_header) + sizeof(*tlv_ptr.eigrp_tlv_general_parm));
break;
}
diff --git a/print-forces.c b/print-forces.c
index e6b52d6b..1c7beb6a 100644
--- a/print-forces.c
+++ b/print-forces.c
@@ -34,17 +34,17 @@
#define TLV_HDRL 4
#define ILV_HDRL 8
-#define TOM_RSVD 0x0
-#define TOM_ASSNSETUP 0x1
-#define TOM_ASSNTEARD 0x2
-#define TOM_CONFIG 0x3
-#define TOM_QUERY 0x4
-#define TOM_EVENTNOT 0x5
-#define TOM_PKTREDIR 0x6
-#define TOM_HEARTBT 0x0F
-#define TOM_ASSNSETREP 0x11
-#define TOM_CONFIGREP 0x13
-#define TOM_QUERYREP 0x14
+#define TOM_RSVD 0x0
+#define TOM_ASSNSETUP 0x1
+#define TOM_ASSNTEARD 0x2
+#define TOM_CONFIG 0x3
+#define TOM_QUERY 0x4
+#define TOM_EVENTNOT 0x5
+#define TOM_PKTREDIR 0x6
+#define TOM_HEARTBT 0x0F
+#define TOM_ASSNSETREP 0x11
+#define TOM_CONFIGREP 0x13
+#define TOM_QUERYREP 0x14
/*
* tom_h Flags: resv1(8b):maxtlvs(4b):resv2(2b):mintlv(2b)
@@ -249,7 +249,7 @@ struct pathdata_h {
};
#define B_FULLD 0x1
-#define B_SPARD 0x2
+#define B_SPARD 0x2
#define B_RESTV 0x4
#define B_KEYIN 0x8
#define B_APPND 0x10
diff --git a/print-icmp6.c b/print-icmp6.c
index 47690f5a..4738e77a 100644
--- a/print-icmp6.c
+++ b/print-icmp6.c
@@ -41,7 +41,7 @@
#include "udp.h"
#include "ah.h"
-/* NetBSD: icmp6.h,v 1.13 2000/08/03 16:30:37 itojun Exp */
+/* NetBSD: icmp6.h,v 1.13 2000/08/03 16:30:37 itojun Exp */
/* $KAME: icmp6.h,v 1.22 2000/08/03 15:25:16 jinmei Exp $ */
/*
@@ -103,7 +103,7 @@ struct icmp6_hdr {
#define ICMP6_ECHO_REQUEST 128 /* echo service */
#define ICMP6_ECHO_REPLY 129 /* echo reply */
#define ICMP6_MEMBERSHIP_QUERY 130 /* group membership query */
-#define MLD6_LISTENER_QUERY 130 /* multicast listener query */
+#define MLD6_LISTENER_QUERY 130 /* multicast listener query */
#define ICMP6_MEMBERSHIP_REPORT 131 /* group membership report */
#define MLD6_LISTENER_REPORT 131 /* multicast listener report */
#define ICMP6_MEMBERSHIP_REDUCTION 132 /* group membership termination */
@@ -145,10 +145,10 @@ struct icmp6_hdr {
#define ICMP6_DST_UNREACH_ADDR 3 /* address unreachable */
#define ICMP6_DST_UNREACH_NOPORT 4 /* port unreachable */
-#define ICMP6_TIME_EXCEED_TRANSIT 0 /* ttl==0 in transit */
+#define ICMP6_TIME_EXCEED_TRANSIT 0 /* ttl==0 in transit */
#define ICMP6_TIME_EXCEED_REASSEMBLY 1 /* ttl==0 in reass */
-#define ICMP6_PARAMPROB_HEADER 0 /* erroneous header field */
+#define ICMP6_PARAMPROB_HEADER 0 /* erroneous header field */
#define ICMP6_PARAMPROB_NEXTHEADER 1 /* unrecognized next header */
#define ICMP6_PARAMPROB_OPTION 2 /* unrecognized option */
#define ICMP6_PARAMPROB_FRAGHDRCHAIN 3 /* incomplete header chain */
@@ -193,7 +193,7 @@ struct mld6_hdr {
*/
struct nd_router_solicit { /* router solicitation */
- struct icmp6_hdr nd_rs_hdr;
+ struct icmp6_hdr nd_rs_hdr;
/* could be followed by options */
};
@@ -427,7 +427,7 @@ struct icmp6_router_renum { /* router renumbering header */
#define rr_type rr_hdr.icmp6_type
#define rr_code rr_hdr.icmp6_code
#define rr_cksum rr_hdr.icmp6_cksum
-#define rr_seqnum rr_hdr.icmp6_data32[0]
+#define rr_seqnum rr_hdr.icmp6_data32[0]
struct rr_pco_match { /* match prefix part */
nd_uint8_t rpm_code;
@@ -811,15 +811,15 @@ rpl_printopts(netdissect_options *ndo, const uint8_t *opts, u_int length)
optlen = 1;
ND_PRINT(" opt:pad1");
} else {
- if (length < RPL_GENOPTION_LEN)
- goto trunc;
+ if (length < RPL_GENOPTION_LEN)
+ goto trunc;
optlen = GET_U_1(opt->rpl_dio_len)+RPL_GENOPTION_LEN;
ND_PRINT(" opt:%s len:%u ",
tok2str(rpl_subopt_values, "subopt:%u", dio_type),
optlen);
ND_TCHECK_LEN(opt, optlen);
if (length < optlen)
- goto trunc;
+ goto trunc;
if (ndo->ndo_vflag > 2) {
hex_print(ndo,
" ",
@@ -879,13 +879,13 @@ rpl_dao_print(netdissect_options *ndo,
if(RPL_DAO_D(rpl_flags)) {
ND_TCHECK_LEN(dao->rpl_dagid, DAGID_LEN);
if (length < DAGID_LEN)
- goto tooshort;
+ goto tooshort;
dagid_str = ip6addr_string (ndo, dao->rpl_dagid);
bp += DAGID_LEN;
length -= DAGID_LEN;
}
- ND_PRINT(" [dagid:%s,seq:%u,instance:%u%s%s,%02x]",
+ ND_PRINT(" [dagid:%s,seq:%u,instance:%u%s%s,flags:%02x]",
dagid_str,
GET_U_1(dao->rpl_daoseq),
GET_U_1(dao->rpl_instanceid),
@@ -922,7 +922,7 @@ rpl_daoack_print(netdissect_options *ndo,
if(RPL_DAOACK_D(GET_U_1(daoack->rpl_flags))) {
ND_TCHECK_LEN(daoack->rpl_dagid, DAGID_LEN);
if (length < DAGID_LEN)
- goto tooshort;
+ goto tooshort;
dagid_str = ip6addr_string (ndo, daoack->rpl_dagid);
bp += DAGID_LEN;
length -= DAGID_LEN;
diff --git a/print-krb.c b/print-krb.c
index b4c0fadf..959b555c 100644
--- a/print-krb.c
+++ b/print-krb.c
@@ -207,7 +207,7 @@ krb4_print(netdissect_options *ndo,
case AUTH_MSG_ERR_REPLY:
if ((cp = krb4_print_hdr(ndo, cp)) == NULL)
return;
- cp += 4; /* timestamp */
+ cp += 4; /* timestamp */
ND_PRINT(" %s ", tok2str(kerr2str, NULL, KTOHSP(kp, cp)));
cp += 4;
PRINT;
diff --git a/print-l2tp.c b/print-l2tp.c
index 940aa2b6..895efd21 100644
--- a/print-l2tp.c
+++ b/print-l2tp.c
@@ -87,7 +87,7 @@
#define L2TP_MSGTYPE_SLI 16 /* Set-Link-Info */
static const struct tok l2tp_msgtype2str[] = {
- { L2TP_MSGTYPE_SCCRQ, "SCCRQ" },
+ { L2TP_MSGTYPE_SCCRQ, "SCCRQ" },
{ L2TP_MSGTYPE_SCCRP, "SCCRP" },
{ L2TP_MSGTYPE_SCCCN, "SCCCN" },
{ L2TP_MSGTYPE_STOPCCN, "StopCCN" },
@@ -113,17 +113,17 @@ static const struct tok l2tp_msgtype2str[] = {
#define L2TP_AVP_FIRM_VER 6 /* Firmware Revision */
#define L2TP_AVP_HOST_NAME 7 /* Host Name */
#define L2TP_AVP_VENDOR_NAME 8 /* Vendor Name */
-#define L2TP_AVP_ASSND_TUN_ID 9 /* Assigned Tunnel ID */
+#define L2TP_AVP_ASSND_TUN_ID 9 /* Assigned Tunnel ID */
#define L2TP_AVP_RECV_WIN_SIZE 10 /* Receive Window Size */
#define L2TP_AVP_CHALLENGE 11 /* Challenge */
#define L2TP_AVP_Q931_CC 12 /* Q.931 Cause Code */
#define L2TP_AVP_CHALLENGE_RESP 13 /* Challenge Response */
-#define L2TP_AVP_ASSND_SESS_ID 14 /* Assigned Session ID */
-#define L2TP_AVP_CALL_SER_NUM 15 /* Call Serial Number */
+#define L2TP_AVP_ASSND_SESS_ID 14 /* Assigned Session ID */
+#define L2TP_AVP_CALL_SER_NUM 15 /* Call Serial Number */
#define L2TP_AVP_MINIMUM_BPS 16 /* Minimum BPS */
#define L2TP_AVP_MAXIMUM_BPS 17 /* Maximum BPS */
#define L2TP_AVP_BEARER_TYPE 18 /* Bearer Type */
-#define L2TP_AVP_FRAMING_TYPE 19 /* Framing Type */
+#define L2TP_AVP_FRAMING_TYPE 19 /* Framing Type */
#define L2TP_AVP_PACKET_PROC_DELAY 20 /* Packet Processing Delay (OBSOLETE) */
#define L2TP_AVP_CALLED_NUMBER 21 /* Called Number */
#define L2TP_AVP_CALLING_NUMBER 22 /* Calling Number */
@@ -143,7 +143,7 @@ static const struct tok l2tp_msgtype2str[] = {
#define L2TP_AVP_RANDOM_VECTOR 36 /* Random Vector */
#define L2TP_AVP_PRIVATE_GRP_ID 37 /* Private Group ID */
#define L2TP_AVP_RX_CONN_SPEED 38 /* (Rx) Connect Speed */
-#define L2TP_AVP_SEQ_REQUIRED 39 /* Sequencing Required */
+#define L2TP_AVP_SEQ_REQUIRED 39 /* Sequencing Required */
#define L2TP_AVP_PPP_DISCON_CC 46 /* PPP Disconnect Cause Code - RFC 3145 */
static const struct tok l2tp_avp2str[] = {
diff --git a/print-lldp.c b/print-lldp.c
index a0cd9ba4..f0e5f60c 100644
--- a/print-lldp.c
+++ b/print-lldp.c
@@ -143,7 +143,7 @@ static const struct tok lldp_cap_values[] = {
#define LLDP_PRIVATE_8021_SUBTYPE_PFC_CONFIGURATION 11
#define LLDP_PRIVATE_8021_SUBTYPE_APPLICATION_PRIORITY 12
#define LLDP_PRIVATE_8021_SUBTYPE_EVB 13
-#define LLDP_PRIVATE_8021_SUBTYPE_CDCP 14
+#define LLDP_PRIVATE_8021_SUBTYPE_CDCP 14
static const struct tok lldp_8021_subtype_values[] = {
{ LLDP_PRIVATE_8021_SUBTYPE_PORT_VLAN_ID, "Port VLAN Id"},
@@ -511,10 +511,10 @@ static const struct tok lldp_pmd_capability_values[] = {
#define LLDP_MDI_PAIR_CONTROL_ABILITY (1 << 3)
static const struct tok lldp_mdi_values[] = {
- { LLDP_MDI_PORT_CLASS, "PSE"},
- { LLDP_MDI_POWER_SUPPORT, "supported"},
- { LLDP_MDI_POWER_STATE, "enabled"},
- { LLDP_MDI_PAIR_CONTROL_ABILITY, "can be controlled"},
+ { LLDP_MDI_PORT_CLASS, "PSE"},
+ { LLDP_MDI_POWER_SUPPORT, "supported"},
+ { LLDP_MDI_POWER_STATE, "enabled"},
+ { LLDP_MDI_PAIR_CONTROL_ABILITY, "can be controlled"},
{ 0, NULL}
};
diff --git a/print-lspping.c b/print-lspping.c
index 4c5fc4e8..f3183cb2 100644
--- a/print-lspping.c
+++ b/print-lspping.c
@@ -1007,9 +1007,6 @@ lspping_print(netdissect_options *ndo,
/* FIXME add hash-key type, depth limit, multipath processing */
- tlv_tptr+=sizeof(struct lspping_tlv_downstream_map_info_t);
- tlv_tlen-=sizeof(struct lspping_tlv_downstream_map_info_t);
-
/* FIXME print downstream labels */
tlv_hexdump=TRUE; /* dump the TLV until code complete */
diff --git a/print-lwres.c b/print-lwres.c
index b8fc6234..97f176cb 100644
--- a/print-lwres.c
+++ b/print-lwres.c
@@ -182,7 +182,7 @@ static const struct tok opcode[] = {
{ LWRES_OPCODE_GETADDRSBYNAME, "getaddrsbyname", },
{ LWRES_OPCODE_GETNAMEBYADDR, "getnamebyaddr", },
{ LWRES_OPCODE_GETRDATABYNAME, "getrdatabyname", },
- { 0, NULL, },
+ { 0, NULL, },
};
/* print-domain.c */
diff --git a/print-mpls.c b/print-mpls.c
index 43ea1511..c9be4964 100644
--- a/print-mpls.c
+++ b/print-mpls.c
@@ -75,7 +75,7 @@ mpls_print(netdissect_options *ndo, const u_char *bp, u_int length)
label_entry = GET_BE_U_4(p);
ND_PRINT("%s(label %u",
(label_stack_depth && ndo->ndo_vflag) ? "\n\t" : " ",
- MPLS_LABEL(label_entry));
+ MPLS_LABEL(label_entry));
label_stack_depth++;
if (ndo->ndo_vflag &&
MPLS_LABEL(label_entry) < sizeof(mpls_labelname) / sizeof(mpls_labelname[0]))
diff --git a/print-ntp.c b/print-ntp.c
index 99c08963..537975cc 100644
--- a/print-ntp.c
+++ b/print-ntp.c
@@ -38,9 +38,7 @@
#include "netdissect-stdinc.h"
-#ifdef HAVE_STRFTIME
#include <time.h>
-#endif
#include "netdissect.h"
#include "addrtoname.h"
@@ -180,7 +178,7 @@ static const struct tok ntp_leapind_values[] = {
static const struct tok ntp_stratum_values[] = {
{ UNSPECIFIED, "unspecified" },
- { PRIM_REF, "primary reference" },
+ { PRIM_REF, "primary reference" },
{ 0, NULL }
};
@@ -308,9 +306,9 @@ ntp_time_print(netdissect_options *ndo,
p_ntp_delta(ndo, &(bp->org_timestamp), &(bp->xmt_timestamp));
/* FIXME: this code is not aware of any extension fields */
- if (length == NTP_TIMEMSG_MINLEN + 4) { /* Optional: key-id (crypto-NAK) */
+ if (length == NTP_TIMEMSG_MINLEN + 4) { /* Optional: key-id (crypto-NAK) */
ND_PRINT("\n\tKey id: %u", GET_BE_U_4(bp->key_id));
- } else if (length == NTP_TIMEMSG_MINLEN + 4 + 16) { /* Optional: key-id + 128-bit digest */
+ } else if (length == NTP_TIMEMSG_MINLEN + 4 + 16) { /* Optional: key-id + 128-bit digest */
ND_PRINT("\n\tKey id: %u", GET_BE_U_4(bp->key_id));
ND_TCHECK_LEN(bp->message_digest, 16);
ND_PRINT("\n\tAuthentication: %08x%08x%08x%08x",
@@ -318,7 +316,7 @@ ntp_time_print(netdissect_options *ndo,
GET_BE_U_4(bp->message_digest + 4),
GET_BE_U_4(bp->message_digest + 8),
GET_BE_U_4(bp->message_digest + 12));
- } else if (length == NTP_TIMEMSG_MINLEN + 4 + 20) { /* Optional: key-id + 160-bit digest */
+ } else if (length == NTP_TIMEMSG_MINLEN + 4 + 20) { /* Optional: key-id + 160-bit digest */
ND_PRINT("\n\tKey id: %u", GET_BE_U_4(bp->key_id));
ND_TCHECK_LEN(bp->message_digest, 20);
ND_PRINT("\n\tAuthentication: %08x%08x%08x%08x%08x",
diff --git a/print-realtek.c b/print-realtek.c
index 2aae3fe4..3105bf7f 100644
--- a/print-realtek.c
+++ b/print-realtek.c
@@ -117,7 +117,7 @@ rrcp_print(netdissect_options *ndo,
tok2str(opcode_values,"unknown opcode (0x%02x)",rrcp_opcode));
if (rrcp_opcode==RRCP_OPCODE_GET_CONFIGURATION ||
rrcp_opcode==RRCP_OPCODE_SET_CONFIGURATION){
- ND_PRINT(" addr=0x%04x, data=0x%08x",
+ ND_PRINT(" addr=0x%04x, data=0x%08x",
GET_LE_U_2(cp + RRCP_REG_ADDR_OFFSET),
GET_LE_U_4(cp + RRCP_REG_DATA_OFFSET));
}
diff --git a/print-ripng.c b/print-ripng.c
index c4f4ea3a..94ebf1bc 100644
--- a/print-ripng.c
+++ b/print-ripng.c
@@ -117,7 +117,8 @@ ripng_print(netdissect_options *ndo, const u_char *dat, unsigned int length)
ndo->ndo_protocol = "ripng";
vers = GET_U_1(rp->rip6_vers);
if (vers != RIP6_VERSION) {
- ND_PRINT(" [vers %u]", vers);
+ nd_print_protocol(ndo);
+ ND_PRINT(" [version %u, must be %u]", vers, RIP6_VERSION);
goto invalid;
}
cmd = GET_U_1(rp->rip6_cmd);
@@ -128,7 +129,7 @@ ripng_print(netdissect_options *ndo, const u_char *dat, unsigned int length)
if (length_left < (sizeof(struct rip6) - sizeof(struct netinfo6)))
goto invalid;
length_left -= (sizeof(struct rip6) - sizeof(struct netinfo6));
- j = length_left / sizeof(*ni);
+ j = length_left / sizeof(*ni);
if (j == 1) {
if (GET_U_1(rp->rip6_nets->rip6_metric) == HOPCNT_INFINITY6
&& ND_IN6_IS_ADDR_UNSPECIFIED(&rp->rip6_nets->rip6_dest)) {
diff --git a/print-rx.c b/print-rx.c
index 3f7589ea..0a1a8d12 100644
--- a/print-rx.c
+++ b/print-rx.c
@@ -441,17 +441,17 @@ static const char *voltype[] = { "read-write", "read-only", "backup" };
static const struct tok afs_fs_errors[] = {
{ 101, "salvage volume" },
- { 102, "no such vnode" },
- { 103, "no such volume" },
- { 104, "volume exist" },
- { 105, "no service" },
- { 106, "volume offline" },
- { 107, "voline online" },
- { 108, "diskfull" },
- { 109, "diskquota exceeded" },
- { 110, "volume busy" },
- { 111, "volume moved" },
- { 112, "AFS IO error" },
+ { 102, "no such vnode" },
+ { 103, "no such volume" },
+ { 104, "volume exist" },
+ { 105, "no service" },
+ { 106, "volume offline" },
+ { 107, "voline online" },
+ { 108, "diskfull" },
+ { 109, "diskquota exceeded" },
+ { 110, "volume busy" },
+ { 111, "volume moved" },
+ { 112, "AFS IO error" },
{ 0xffffff9c, "restarting fileserver" }, /* -100, sic! */
{ 0, NULL }
};
@@ -794,12 +794,12 @@ rx_cache_find(netdissect_options *ndo, const struct rx_header *rxh,
ND_PRINT(" %" PRIu64, _i); \
}
-#define DATEOUT() { time_t _t; struct tm *tm; char str[256]; \
+#define DATEOUT() { time_t _t; char str[256]; \
_t = (time_t) GET_BE_S_4(bp); \
bp += sizeof(int32_t); \
- tm = localtime(&_t); \
- strftime(str, 256, "%Y/%m/%d %H:%M:%S", tm); \
- ND_PRINT(" %s", str); \
+ ND_PRINT(" %s", \
+ nd_format_time(str, sizeof(str), \
+ "%Y/%m/%d %H:%M:%S", localtime(&_t))); \
}
#define STOREATTROUT() { uint32_t mask, _i; \
diff --git a/print-sflow.c b/print-sflow.c
index 530219e1..f508ccc4 100644
--- a/print-sflow.c
+++ b/print-sflow.c
@@ -120,22 +120,22 @@ struct sflow_expanded_flow_sample_t {
nd_uint32_t records;
};
-#define SFLOW_FLOW_RAW_PACKET 1
-#define SFLOW_FLOW_ETHERNET_FRAME 2
-#define SFLOW_FLOW_IPV4_DATA 3
-#define SFLOW_FLOW_IPV6_DATA 4
-#define SFLOW_FLOW_EXTENDED_SWITCH_DATA 1001
-#define SFLOW_FLOW_EXTENDED_ROUTER_DATA 1002
-#define SFLOW_FLOW_EXTENDED_GATEWAY_DATA 1003
-#define SFLOW_FLOW_EXTENDED_USER_DATA 1004
-#define SFLOW_FLOW_EXTENDED_URL_DATA 1005
-#define SFLOW_FLOW_EXTENDED_MPLS_DATA 1006
-#define SFLOW_FLOW_EXTENDED_NAT_DATA 1007
-#define SFLOW_FLOW_EXTENDED_MPLS_TUNNEL 1008
-#define SFLOW_FLOW_EXTENDED_MPLS_VC 1009
-#define SFLOW_FLOW_EXTENDED_MPLS_FEC 1010
-#define SFLOW_FLOW_EXTENDED_MPLS_LVP_FEC 1011
-#define SFLOW_FLOW_EXTENDED_VLAN_TUNNEL 1012
+#define SFLOW_FLOW_RAW_PACKET 1
+#define SFLOW_FLOW_ETHERNET_FRAME 2
+#define SFLOW_FLOW_IPV4_DATA 3
+#define SFLOW_FLOW_IPV6_DATA 4
+#define SFLOW_FLOW_EXTENDED_SWITCH_DATA 1001
+#define SFLOW_FLOW_EXTENDED_ROUTER_DATA 1002
+#define SFLOW_FLOW_EXTENDED_GATEWAY_DATA 1003
+#define SFLOW_FLOW_EXTENDED_USER_DATA 1004
+#define SFLOW_FLOW_EXTENDED_URL_DATA 1005
+#define SFLOW_FLOW_EXTENDED_MPLS_DATA 1006
+#define SFLOW_FLOW_EXTENDED_NAT_DATA 1007
+#define SFLOW_FLOW_EXTENDED_MPLS_TUNNEL 1008
+#define SFLOW_FLOW_EXTENDED_MPLS_VC 1009
+#define SFLOW_FLOW_EXTENDED_MPLS_FEC 1010
+#define SFLOW_FLOW_EXTENDED_MPLS_LVP_FEC 1011
+#define SFLOW_FLOW_EXTENDED_VLAN_TUNNEL 1012
static const struct tok sflow_flow_type_values[] = {
{ SFLOW_FLOW_RAW_PACKET, "Raw packet"},
diff --git a/print-sunrpc.c b/print-sunrpc.c
index 82bfd8a9..7eeb42dc 100644
--- a/print-sunrpc.c
+++ b/print-sunrpc.c
@@ -105,10 +105,10 @@
* The following procedures are supported by the protocol:
*
* PMAPPROC_NULL() returns ()
- * takes nothing, returns nothing
+ * takes nothing, returns nothing
*
* PMAPPROC_SET(struct pmap) returns (bool_t)
- * TRUE is success, FALSE is failure. Registers the tuple
+ * TRUE is success, FALSE is failure. Registers the tuple
* [prog, vers, prot, port].
*
* PMAPPROC_UNSET(struct pmap) returns (bool_t)
@@ -122,9 +122,9 @@
* PMAPPROC_DUMP() RETURNS (struct pmaplist *)
*
* PMAPPROC_CALLIT(unsigned, unsigned, unsigned, string<>)
- * RETURNS (port, string<>);
+ * RETURNS (port, string<>);
* usage: encapsulatedresults = PMAPPROC_CALLIT(prog, vers, proc, encapsulatedargs);
- * Calls the procedure on the local machine. If it is not registered,
+ * Calls the procedure on the local machine. If it is not registered,
* this procedure is quite; ie it does not return error information!!!
* This procedure only is supported on rpc/udp and calls via
* rpc/udp. This routine only passes null authentication parameters.
diff --git a/print-telnet.c b/print-telnet.c
index b0283f20..ea7464f0 100644
--- a/print-telnet.c
+++ b/print-telnet.c
@@ -1,4 +1,4 @@
-/* $NetBSD: print-telnet.c,v 1.2 1999/10/11 12:40:12 sjg Exp $ */
+/* $NetBSD: print-telnet.c,v 1.2 1999/10/11 12:40:12 sjg Exp $ */
/*-
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
#include "extract.h"
-/* NetBSD: telnet.h,v 1.9 2001/06/11 01:50:50 wiz Exp */
+/* NetBSD: telnet.h,v 1.9 2001/06/11 01:50:50 wiz Exp */
/*
* Definitions for the TELNET protocol.
@@ -108,8 +108,8 @@ static const char *telcmds[] = {
#define TELOPT_STATUS 5 /* give status */
#define TELOPT_TM 6 /* timing mark */
#define TELOPT_RCTE 7 /* remote controlled transmission and echo */
-#define TELOPT_NAOL 8 /* negotiate about output line width */
-#define TELOPT_NAOP 9 /* negotiate about output page size */
+#define TELOPT_NAOL 8 /* negotiate about output line width */
+#define TELOPT_NAOP 9 /* negotiate about output page size */
#define TELOPT_NAOCRD 10 /* negotiate about CR disposition */
#define TELOPT_NAOHTS 11 /* negotiate about horizontal tabstops */
#define TELOPT_NAOHTD 12 /* negotiate about horizontal tab disposition */
diff --git a/print-udp.c b/print-udp.c
index 0efb0f1e..769cbe41 100644
--- a/print-udp.c
+++ b/print-udp.c
@@ -81,14 +81,14 @@ struct rtcp_rr {
#define RTCP_PT_SR 200
#define RTCP_PT_RR 201
#define RTCP_PT_SDES 202
-#define RTCP_SDES_CNAME 1
-#define RTCP_SDES_NAME 2
-#define RTCP_SDES_EMAIL 3
-#define RTCP_SDES_PHONE 4
-#define RTCP_SDES_LOC 5
-#define RTCP_SDES_TOOL 6
-#define RTCP_SDES_NOTE 7
-#define RTCP_SDES_PRIV 8
+#define RTCP_SDES_CNAME 1
+#define RTCP_SDES_NAME 2
+#define RTCP_SDES_EMAIL 3
+#define RTCP_SDES_PHONE 4
+#define RTCP_SDES_LOC 5
+#define RTCP_SDES_TOOL 6
+#define RTCP_SDES_NOTE 7
+#define RTCP_SDES_PRIV 8
#define RTCP_PT_BYE 203
#define RTCP_PT_APP 204
@@ -701,7 +701,7 @@ udp_print(netdissect_options *ndo, const u_char *bp, u_int length,
otv_print(ndo, cp, length);
else if (IS_SRC_OR_DST_PORT(VXLAN_PORT))
vxlan_print(ndo, cp, length);
- else if (IS_SRC_OR_DST_PORT(GENEVE_PORT))
+ else if (dport == GENEVE_PORT)
geneve_print(ndo, cp, length);
else if (IS_SRC_OR_DST_PORT(LISP_CONTROL_PORT))
lisp_print(ndo, cp, length);
diff --git a/print-vqp.c b/print-vqp.c
index a26cd0e3..1b2f6bfe 100644
--- a/print-vqp.c
+++ b/print-vqp.c
@@ -28,7 +28,7 @@
#include "extract.h"
#include "addrtoname.h"
-#define VQP_VERSION 1
+#define VQP_VERSION 1
/*
* VQP common header
diff --git a/print-zep.c b/print-zep.c
index fd74368c..52901e78 100644
--- a/print-zep.c
+++ b/print-zep.c
@@ -77,20 +77,17 @@ static void zep_print_ts(netdissect_options *ndo, const u_char *p)
billion */
ND_PRINT("%u.%09d", i, f);
-#ifdef HAVE_STRFTIME
/*
* print the time in human-readable format.
*/
if (i) {
time_t seconds = i - JAN_1970;
- struct tm *tm;
char time_buf[128];
- tm = localtime(&seconds);
- strftime(time_buf, sizeof (time_buf), "%Y/%m/%d %H:%M:%S", tm);
- ND_PRINT(" (%s)", time_buf);
+ ND_PRINT(" (%s)",
+ nd_format_time(time_buf, sizeof (time_buf), "%Y/%m/%d %H:%M:%S",
+ localtime(&seconds)));
}
-#endif
}
/*
diff --git a/smbutil.c b/smbutil.c
index 7f609f7f..97217a8d 100644
--- a/smbutil.c
+++ b/smbutil.c
@@ -388,7 +388,7 @@ unistr(netdissect_options *ndo, char (*buf)[MAX_UNISTR_SIZE+1],
}
}
if (!use_unicode) {
- while (strsize != 0) {
+ while (strsize != 0) {
c = GET_U_1(s);
s++;
strsize--;
@@ -768,9 +768,8 @@ smb_fdata1(netdissect_options *ndo,
case 'T':
{
time_t t;
- struct tm *lt;
const char *tstring;
- char buffer[sizeof("Www Mmm dd hh:mm:ss yyyy\n")];
+ char buffer[sizeof("Www Mmm dd hh:mm:ss yyyyy")];
uint32_t x;
switch (atoi(fmt + 1)) {
@@ -800,16 +799,11 @@ smb_fdata1(netdissect_options *ndo,
break;
}
if (t != 0) {
- lt = localtime(&t);
- if (lt != NULL) {
- strftime(buffer, sizeof(buffer), "%a %b %e %T %Y%n", lt);
- tstring = buffer;
- }
- else
- tstring = "(Can't convert time)\n";
+ tstring = nd_format_time(buffer, sizeof(buffer), "%a %b %e %T %Y",
+ localtime(&t));
} else
- tstring = "NULL\n";
- ND_PRINT("%s", tstring);
+ tstring = "NULL";
+ ND_PRINT("%s\n", tstring);
fmt++;
while (ND_ASCII_ISDIGIT(*fmt))
fmt++;
diff --git a/stime.awk b/stime.awk
index 61891f24..429cf012 100644
--- a/stime.awk
+++ b/stime.awk
@@ -1,4 +1,4 @@
-$6 !~ /^ack/ && $5 !~ /[SFR]/ {
+$6 !~ /^ack/ && $5 !~ /[SFR]/ {
# given a tcpdump ftp trace, output one line for each send
# in the form
# <send time> <seq no>
diff --git a/tcpdump.1.in b/tcpdump.1.in
index 92f1e28b..87e0fbb8 100644
--- a/tcpdump.1.in
+++ b/tcpdump.1.in
@@ -20,7 +20,7 @@
.\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
.\"
-.TH TCPDUMP 1 "30 July 2022"
+.TH TCPDUMP 1 "12 March 2023"
.SH NAME
tcpdump \- dump traffic on a network
.SH SYNOPSIS
@@ -1299,7 +1299,7 @@ The general format of a TCP protocol line is:
\fISrc\fP and \fIdst\fP are the source and destination IP
addresses and ports.
\fITcpflags\fP are some combination of S (SYN),
-F (FIN), P (PUSH), R (RST), U (URG), W (ECN CWR), E (ECN-Echo) or
+F (FIN), P (PSH), R (RST), U (URG), W (CWR), E (ECE) or
`.' (ACK), or `none' if no flags are set.
\fIData-seqno\fP describes the portion of sequence space covered
by the data in this packet (see example below).
@@ -1366,7 +1366,7 @@ feature, causing the original sequence numbers to be output.
.LP
On the 6th line, rtsg sends csam 19 bytes of data (bytes 2 through 20
in the rtsg \(-> csam side of the conversation).
-The PUSH flag is set in the packet.
+The PSH flag is set in the packet.
On the 7th line, csam says it's received data sent by rtsg up to
but not including byte 21.
Most of this data is apparently sitting in the
@@ -1579,7 +1579,7 @@ Some offsets and field values may be expressed as names
rather than as numeric values. For example tcp[13] may
be replaced with tcp[tcpflags]. The following TCP flag
field values are also available: tcp-fin, tcp-syn, tcp-rst,
-tcp-push, tcp-ack, tcp-urg.
+tcp-push, tcp-ack, tcp-urg, tcp-ece and tcp-cwr.
.PP
This can be demonstrated as:
.RS
@@ -1987,6 +1987,13 @@ jssmag.209 initiates the next request.
The `*' on the request
indicates that XO (`exactly once') was \fInot\fP set.
+.SH BACKWARD COMPATIBILITY
+The TCP flag names
+.B tcp-ece
+and
+.B tcp-cwr
+became available when linking with libpcap 1.9.0 or later.
+
.SH "SEE ALSO"
.BR stty (1),
.BR pcap (3PCAP),
diff --git a/tcpdump.c b/tcpdump.c
index 78d0871a..0b654158 100644
--- a/tcpdump.c
+++ b/tcpdump.c
@@ -843,6 +843,8 @@ MakeFilename(char *buffer, char *orig_name, int cnt, int max_chars)
char *filename = malloc(PATH_MAX + 1);
if (filename == NULL)
error("%s: malloc", __func__);
+ if (strlen(orig_name) == 0)
+ error("an empty string is not a valid file name");
/* Process with strftime if Gflag is set. */
if (Gflag != 0) {
@@ -854,9 +856,25 @@ MakeFilename(char *buffer, char *orig_name, int cnt, int max_chars)
}
/* There's no good way to detect an error in strftime since a return
- * value of 0 isn't necessarily failure.
+ * value of 0 isn't necessarily failure; if orig_name is an empty
+ * string, the formatted string will be empty.
+ *
+ * However, the C90 standard says that, if there *is* a
+ * buffer overflow, the content of the buffer is undefined,
+ * so we must check for a buffer overflow.
+ *
+ * So we check above for an empty orig_name, and only call
+ * strftime() if it's non-empty, in which case the return
+ * value will only be 0 if the formatted date doesn't fit
+ * in the buffer.
+ *
+ * (We check above because, even if we don't use -G, we
+ * want a better error message than "tcpdump: : No such
+ * file or directory" for this case.)
*/
- strftime(filename, PATH_MAX, orig_name, local_tm);
+ if (strftime(filename, PATH_MAX, orig_name, local_tm) == 0) {
+ error("%s: strftime", __func__);
+ }
} else {
strncpy(filename, orig_name, PATH_MAX);
}
diff --git a/tests/TESTLIST b/tests/TESTLIST
index fcbcedb0..e6a64468 100644
--- a/tests/TESTLIST
+++ b/tests/TESTLIST
@@ -100,7 +100,7 @@ mpls-over-udp-v mpls-over-udp.pcap mpls-over-udp-v.out -v
# ospf3_mp-vv
# ospf3_nbma-vv
# ospf2-seg-fault-1-v (fuzzed pcap)
-ospf3_auth-vv ospf3_auth.pcapng ospf3_auth-vv.out -v -v
+ospf3_auth-vv ospf3_auth.pcapng ospf3_auth-vv.out -v -v
# IKEv2 tests
ikev2four ikev2four.pcap ikev2four.out -v
@@ -299,9 +299,9 @@ dns_udp_8053-T dns_udp_8053.pcap dns_udp_8053-T.out -vv -T domain
dnssec-vv dnssec.pcap dnssec-vv.out -vv
#IPv6 tests
-ipv6-bad-version ipv6-bad-version.pcap ipv6-bad-version.out
+ipv6-bad-version ipv6-bad-version.pcap ipv6-bad-version.out
ipv6-routing-header ipv6-routing-header.pcap ipv6-routing-header.out -v
-ipv6-srh-ext-header ipv6-srh-ext-header.pcap ipv6-srh-ext-header.out -v
+ipv6-srh-ext-header ipv6-srh-ext-header.pcap ipv6-srh-ext-header.out -v
ipv6-srh-insert-cksum ipv6-srh-insert-cksum.pcap ipv6-srh-insert-cksum.out -v
ipv6-srh-ipproto-ether-v ipv6-srh-ipproto-ether.pcap ipv6-srh-ipproto-ether-v.out -v
ipv6-srh-ipproto-ether-ev ipv6-srh-ipproto-ether.pcap ipv6-srh-ipproto-ether-ev.out -ev
@@ -559,7 +559,7 @@ isakmp-rfc3948-oobr isakmp-rfc3948-oobr.pcap isakmp-rfc3948-oobr.out
isoclns-oobr isoclns-oobr.pcap isoclns-oobr.out
nfs-attr-oobr nfs-attr-oobr.pcap nfs-attr-oobr.out
decnet-oobr decnet-oobr.pcap decnet-oobr.out
-oobr_parse_elements oobr_parse_elements.pcap oobr_parse_elements.out
+ieee802.11_parse_elements_oobr ieee802.11_parse_elements_oobr.pcap ieee802.11_parse_elements_oobr.out
hoobr_ripng_print hoobr_ripng_print.pcap hoobr_ripng_print.out
hoobr_juniper hoobr_juniper.pcap hoobr_juniper.out
hoobr_juniper2 hoobr_juniper2.pcap hoobr_juniper2.out
diff --git a/tests/hoobr_ripng_print.out b/tests/hoobr_ripng_print.out
index 309cf8c9..b58cf8b2 100644
--- a/tests/hoobr_ripng_print.out
+++ b/tests/hoobr_ripng_print.out
@@ -1 +1 @@
- 1 05:27:12.808464432 IP 48.48.48.48.521 > 48.48.48.48.12336: [vers 48] (invalid)
+ 1 05:27:12.808464432 IP 48.48.48.48.521 > 48.48.48.48.12336: ripng [version 48, must be 1] (invalid)
diff --git a/tests/oobr_parse_elements.out b/tests/ieee802.11_parse_elements_oobr.out
index 1f4d2ce2..1f4d2ce2 100644
--- a/tests/oobr_parse_elements.out
+++ b/tests/ieee802.11_parse_elements_oobr.out
diff --git a/tests/oobr_parse_elements.pcap b/tests/ieee802.11_parse_elements_oobr.pcap
index 560317ed..560317ed 100644
--- a/tests/oobr_parse_elements.pcap
+++ b/tests/ieee802.11_parse_elements_oobr.pcap
Binary files differ
diff --git a/tests/rpl-14-daovvv.out b/tests/rpl-14-daovvv.out
index 3ab7bda0..4a9d7fac 100644
--- a/tests/rpl-14-daovvv.out
+++ b/tests/rpl-14-daovvv.out
@@ -1 +1 @@
- 1 16:04:20.568260 IP6 (hlim 64, next-header ICMPv6 (58) payload length: 24) fe80::216:3eff:fe11:3424 > ff02::1: [icmp6 sum ok] ICMP6, RPL, (CLR)Destination Advertisement Object [dagid:7061:6e64:6f72:6120:6973:2066:756e:a6c,seq:1,instance:1,Dagid,40]
+ 1 16:04:20.568260 IP6 (hlim 64, next-header ICMPv6 (58) payload length: 24) fe80::216:3eff:fe11:3424 > ff02::1: [icmp6 sum ok] ICMP6, RPL, (CLR)Destination Advertisement Object [dagid:7061:6e64:6f72:6120:6973:2066:756e:a6c,seq:1,instance:1,Dagid,flags:40]
diff --git a/tests/rpl-19-pickdag.out b/tests/rpl-19-pickdag.out
index f1d70149..5afbb8c4 100644
--- a/tests/rpl-19-pickdag.out
+++ b/tests/rpl-19-pickdag.out
@@ -1 +1 @@
- 1 03:38:11.851768 IP6 (hlim 64, next-header ICMPv6 (58) payload length: 56) fe80::216:3eff:fe11:3424 > fe80::216:3eff:fe11:3424: [icmp6 sum ok] ICMP6, RPL, (CLR)Destination Advertisement Object [dagid:5431::,seq:10,instance:42,Dagid,40] opt:rpltarget len:25 opt:pad1 opt:pad1 opt:pad1 opt:pad1 opt:pad1 opt:pad1 opt:pad1
+ 1 03:38:11.851768 IP6 (hlim 64, next-header ICMPv6 (58) payload length: 56) fe80::216:3eff:fe11:3424 > fe80::216:3eff:fe11:3424: [icmp6 sum ok] ICMP6, RPL, (CLR)Destination Advertisement Object [dagid:5431::,seq:10,instance:42,Dagid,flags:40] opt:rpltarget len:25 opt:pad1 opt:pad1 opt:pad1 opt:pad1 opt:pad1 opt:pad1 opt:pad1
diff --git a/tests/rpl-19-pickdagvvv.out b/tests/rpl-19-pickdagvvv.out
index e42a36ef..41a1ba32 100644
--- a/tests/rpl-19-pickdagvvv.out
+++ b/tests/rpl-19-pickdagvvv.out
@@ -1 +1 @@
- 1 03:38:11.851768 IP6 (hlim 64, next-header ICMPv6 (58) payload length: 56) fe80::216:3eff:fe11:3424 > fe80::216:3eff:fe11:3424: [icmp6 sum ok] ICMP6, RPL, (CLR)Destination Advertisement Object [dagid:5431::,seq:10,instance:42,Dagid,40] opt:rpltarget len:25 0x0000: 0080 2001 0db8 0001 0000 0216 3eff fe11 0x0010: 3424 0000 0000 00 opt:pad1 opt:pad1 opt:pad1 opt:pad1 opt:pad1 opt:pad1 opt:pad1
+ 1 03:38:11.851768 IP6 (hlim 64, next-header ICMPv6 (58) payload length: 56) fe80::216:3eff:fe11:3424 > fe80::216:3eff:fe11:3424: [icmp6 sum ok] ICMP6, RPL, (CLR)Destination Advertisement Object [dagid:5431::,seq:10,instance:42,Dagid,flags:40] opt:rpltarget len:25 0x0000: 0080 2001 0db8 0001 0000 0216 3eff fe11 0x0010: 3424 0000 0000 00 opt:pad1 opt:pad1 opt:pad1 opt:pad1 opt:pad1 opt:pad1 opt:pad1
diff --git a/tests/rpl-dao-oobr.out b/tests/rpl-dao-oobr.out
index c123a6db..232ee772 100644
--- a/tests/rpl-dao-oobr.out
+++ b/tests/rpl-dao-oobr.out
@@ -1 +1 @@
- 1 00:04:16.851768 IP6 (hlim 64, next-header ICMPv6 (58) payload length: 56) fe80::216:3eff:fe11:3424 > fe80::216:3eff:fe11:3424: ICMP6, RPL, (CLR)Destination Advertisement Object [dagid:<elided>,seq:0,instance:42,00] opt:subopt:13 len:2 opt:subopt:128 len:15 opt:subopt:13 len:15 [|icmp6]
+ 1 00:04:16.851768 IP6 (hlim 64, next-header ICMPv6 (58) payload length: 56) fe80::216:3eff:fe11:3424 > fe80::216:3eff:fe11:3424: ICMP6, RPL, (CLR)Destination Advertisement Object [dagid:<elided>,seq:0,instance:42,flags:00] opt:subopt:13 len:2 opt:subopt:128 len:15 opt:subopt:13 len:15 [|icmp6]
diff --git a/udp.h b/udp.h
index 70d3315a..e714180f 100644
--- a/udp.h
+++ b/udp.h
@@ -78,7 +78,7 @@ struct udphdr {
#define SNMPTRAP_PORT 162 /*XXX*/
#endif
#ifndef PTP_EVENT_PORT
-#define PTP_EVENT_PORT 319 /* IANA */
+#define PTP_EVENT_PORT 319 /* IANA */
#endif
#ifndef PTP_GENERAL_PORT
#define PTP_GENERAL_PORT 320 /* IANA */
diff --git a/util-print.c b/util-print.c
index 8b206497..05483378 100644
--- a/util-print.c
+++ b/util-print.c
@@ -230,7 +230,8 @@ ts_date_hmsfrac_print(netdissect_options *ndo, long sec, long usec,
{
time_t Time = sec;
struct tm *tm;
- char timestr[32];
+ char timebuf[32];
+ const char *timestr;
if ((unsigned)sec & 0x80000000) {
ND_PRINT("[Error converting time]");
@@ -242,14 +243,13 @@ ts_date_hmsfrac_print(netdissect_options *ndo, long sec, long usec,
else
tm = gmtime(&Time);
- if (!tm) {
- ND_PRINT("[Error converting time]");
- return;
+ if (date_flag == WITH_DATE) {
+ timestr = nd_format_time(timebuf, sizeof(timebuf),
+ "%Y-%m-%d %H:%M:%S", tm);
+ } else {
+ timestr = nd_format_time(timebuf, sizeof(timebuf),
+ "%H:%M:%S", tm);
}
- if (date_flag == WITH_DATE)
- strftime(timestr, sizeof(timestr), "%Y-%m-%d %H:%M:%S", tm);
- else
- strftime(timestr, sizeof(timestr), "%H:%M:%S", tm);
ND_PRINT("%s", timestr);
ts_frac_print(ndo, usec);
@@ -405,6 +405,26 @@ signed_relts_print(netdissect_options *ndo,
unsigned_relts_print(ndo, secs);
}
+/*
+ * Format a struct tm with strftime().
+ * If the pointer to the struct tm is null, that means that the
+ * routine to convert a time_t to a struct tm failed; the localtime()
+ * and gmtime() in the Microsoft Visual Studio C library will fail,
+ * returning null, if the value is before the UNIX Epoch.
+ */
+const char *
+nd_format_time(char *buf, size_t bufsize, const char *format,
+ const struct tm *timeptr)
+{
+ if (timeptr != NULL) {
+ if (strftime(buf, bufsize, format, timeptr) != 0)
+ return (buf);
+ else
+ return ("[nd_format_time() buffer is too small]");
+ } else
+ return ("[localtime() or gmtime() couldn't convert the date and time]");
+}
+
/* Print the truncated string */
void nd_print_trunc(netdissect_options *ndo)
{