Adding upstream version 2.3.1.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-04-24 14:04:11 +02:00
parent 27bed00e23
commit 8834686035
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
12 changed files with 206 additions and 42 deletions

168
configure vendored
View file

@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.71 for dnscap 2.3.0.
# Generated by GNU Autoconf 2.71 for dnscap 2.3.1.
#
# Report bugs to <dnscap-users@dns-oarc.net>.
#
@ -621,8 +621,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='dnscap'
PACKAGE_TARNAME='dnscap'
PACKAGE_VERSION='2.3.0'
PACKAGE_STRING='dnscap 2.3.0'
PACKAGE_VERSION='2.3.1'
PACKAGE_STRING='dnscap 2.3.1'
PACKAGE_BUGREPORT='dnscap-users@dns-oarc.net'
PACKAGE_URL='https://github.com/DNS-OARC/dnscap/issues'
@ -1382,7 +1382,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 dnscap 2.3.0 to adapt to many kinds of systems.
\`configure' configures dnscap 2.3.1 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@ -1453,7 +1453,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of dnscap 2.3.0:";;
short | recursive ) echo "Configuration of dnscap 2.3.1:";;
esac
cat <<\_ACEOF
@ -1586,7 +1586,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
dnscap configure 2.3.0
dnscap configure 2.3.1
generated by GNU Autoconf 2.71
Copyright (C) 2021 Free Software Foundation, Inc.
@ -1875,6 +1875,58 @@ printf "%s\n" "$ac_res" >&6; }
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_c_check_type
# ac_fn_check_decl LINENO SYMBOL VAR INCLUDES EXTRA-OPTIONS FLAG-VAR
# ------------------------------------------------------------------
# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR
# accordingly. Pass EXTRA-OPTIONS to the compiler, using FLAG-VAR.
ac_fn_check_decl ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
as_decl_name=`echo $2|sed 's/ *(.*//'`
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5
printf %s "checking whether $as_decl_name is declared... " >&6; }
if eval test \${$3+y}
then :
printf %s "(cached) " >&6
else $as_nop
as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'`
eval ac_save_FLAGS=\$$6
as_fn_append $6 " $5"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$4
int
main (void)
{
#ifndef $as_decl_name
#ifdef __cplusplus
(void) $as_decl_use;
#else
(void) $as_decl_name;
#endif
#endif
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
eval "$3=yes"
else $as_nop
eval "$3=no"
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
eval $6=\$ac_save_FLAGS
fi
eval ac_res=\$$3
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
printf "%s\n" "$ac_res" >&6; }
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_check_decl
ac_configure_args_raw=
for ac_arg
do
@ -1899,7 +1951,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 dnscap $as_me 2.3.0, which was
It was created by dnscap $as_me 2.3.1, which was
generated by GNU Autoconf 2.71. Invocation command line was
$ $0$ac_configure_args_raw
@ -3169,7 +3221,7 @@ fi
# Define the identity of the package.
PACKAGE='dnscap'
VERSION='2.3.0'
VERSION='2.3.1'
printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h
@ -13151,6 +13203,86 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC options needed to detect all undeclared functions" >&5
printf %s "checking for $CC options needed to detect all undeclared functions... " >&6; }
if test ${ac_cv_c_undeclared_builtin_options+y}
then :
printf %s "(cached) " >&6
else $as_nop
ac_save_CFLAGS=$CFLAGS
ac_cv_c_undeclared_builtin_options='cannot detect'
for ac_arg in '' -fno-builtin; do
CFLAGS="$ac_save_CFLAGS $ac_arg"
# This test program should *not* compile successfully.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main (void)
{
(void) strchr;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
else $as_nop
# This test program should compile successfully.
# No library function is consistently available on
# freestanding implementations, so test against a dummy
# declaration. Include always-available headers on the
# off chance that they somehow elicit warnings.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <float.h>
#include <limits.h>
#include <stdarg.h>
#include <stddef.h>
extern void ac_decl (int, char *);
int
main (void)
{
(void) ac_decl (0, (char *) 0);
(void) ac_decl;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
if test x"$ac_arg" = x
then :
ac_cv_c_undeclared_builtin_options='none needed'
else $as_nop
ac_cv_c_undeclared_builtin_options=$ac_arg
fi
break
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
done
CFLAGS=$ac_save_CFLAGS
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_undeclared_builtin_options" >&5
printf "%s\n" "$ac_cv_c_undeclared_builtin_options" >&6; }
case $ac_cv_c_undeclared_builtin_options in #(
'cannot detect') :
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "cannot make $CC report undeclared builtins
See \`config.log' for more details" "$LINENO" 5; } ;; #(
'none needed') :
ac_c_undeclared_builtin_options='' ;; #(
*) :
ac_c_undeclared_builtin_options=$ac_cv_c_undeclared_builtin_options ;;
esac
# Check whether --enable-threads was given.
if test ${enable_threads+y}
then :
@ -13974,6 +14106,14 @@ printf "%s\n" "#define HAVE_PCAP_DIRECTION_T 1" >>confdefs.h
fi
ac_fn_check_decl "$LINENO" "DLT_LINUX_SLL2" "ac_cv_have_decl_DLT_LINUX_SLL2" "#include <pcap/pcap.h>
" "$ac_c_undeclared_builtin_options" "CFLAGS"
if test "x$ac_cv_have_decl_DLT_LINUX_SLL2" = xyes
then :
else $as_nop
as_fn_error $? "link-type DLT_LINUX_SLL2 not found, libpcap >= 1.10.0 required" "$LINENO" 5
fi
else $as_nop
@ -14126,6 +14266,14 @@ printf "%s\n" "#define HAVE_PCAP_DIRECTION_T 1" >>confdefs.h
fi
ac_fn_check_decl "$LINENO" "DLT_LINUX_SLL2" "ac_cv_have_decl_DLT_LINUX_SLL2" "#include <pcap/pcap.h>
" "$ac_c_undeclared_builtin_options" "CFLAGS"
if test "x$ac_cv_have_decl_DLT_LINUX_SLL2" = xyes
then :
else $as_nop
as_fn_error $? "link-type DLT_LINUX_SLL2 not found, libpcap >= 1.10.0 required" "$LINENO" 5
fi
fi
@ -15964,7 +16112,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 dnscap $as_me 2.3.0, which was
This file was extended by dnscap $as_me 2.3.1, which was
generated by GNU Autoconf 2.71. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@ -16033,7 +16181,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config='$ac_cs_config_escaped'
ac_cs_version="\\
dnscap config.status 2.3.0
dnscap config.status 2.3.1
configured by $0, generated by GNU Autoconf 2.71,
with options \\"\$ac_cs_config\\"

View file

@ -33,7 +33,7 @@
# POSSIBILITY OF SUCH DAMAGE.
AC_PREREQ(2.61)
AC_INIT([dnscap], [2.3.0], [dnscap-users@dns-oarc.net], [dnscap], [https://github.com/DNS-OARC/dnscap/issues])
AC_INIT([dnscap], [2.3.1], [dnscap-users@dns-oarc.net], [dnscap], [https://github.com/DNS-OARC/dnscap/issues])
AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects])
AC_CONFIG_SRCDIR([src/dnscap.c])
AC_CONFIG_HEADER([src/config.h])

View file

@ -175,10 +175,10 @@ int pcapdump_open(my_bpftimeval ts)
ts.tv_sec++;
ts.tv_usec -= MILLION;
}
gmtime_r((time_t*)&ts.tv_sec, &tm);
gmtime_r(&ts.tv_sec, &tm);
strftime(sbuf, 64, "%Y%m%d.%H%M%S", &tm);
if (asprintf(&dumpname, "%s.%s.%06lu",
dump_base, sbuf, (u_long)ts.tv_usec)
if (asprintf(&dumpname, "%s.%s.%06" PRI_tv_usec,
dump_base, sbuf, ts.tv_usec)
< 0
|| asprintf(&dumpnamepart, "%s.part", dumpname) < 0) {
logerr("asprintf: %s", strerror(errno));

View file

@ -286,7 +286,7 @@ void rssm_save_counts(const char* sbuf)
FILE* fp;
int i;
char* tbuf = 0;
i = asprintf(&tbuf, "%s.%s.%06lu", counts_prefix ? counts_prefix : COUNTS_PREFIX_DEFAULT, sbuf, (u_long)open_ts.tv_usec);
i = asprintf(&tbuf, "%s.%s.%06" PRI_tv_usec, counts_prefix ? counts_prefix : COUNTS_PREFIX_DEFAULT, sbuf, open_ts.tv_usec);
if (i < 1 || !tbuf) {
logerr("asprintf: out of memory");
return;
@ -302,7 +302,7 @@ void rssm_save_counts(const char* sbuf)
char tz[21];
struct tm tm;
gmtime_r((time_t*)&open_ts.tv_sec, &tm);
gmtime_r(&open_ts.tv_sec, &tm);
if (!strftime(tz, sizeof(tz), "%Y-%m-%dT%H:%M:%SZ", &tm)) {
logerr("rssm: strftime failed");
fclose(fp);
@ -443,8 +443,8 @@ void rssm_save_counts(const char* sbuf)
}
}
} else {
fprintf(fp, "first-packet-time %ld\n", (long)open_ts.tv_sec);
fprintf(fp, "last-packet-time %ld\n", (long)close_ts.tv_sec);
fprintf(fp, "first-packet-time %" PRI_tv_sec "\n", open_ts.tv_sec);
fprintf(fp, "last-packet-time %" PRI_tv_sec "\n", close_ts.tv_sec);
fprintf(fp, "dns-udp-queries-received-ipv4 %" PRIu64 "\n", counts.dns_udp_queries_received_ipv4);
fprintf(fp, "dns-udp-queries-received-ipv6 %" PRIu64 "\n", counts.dns_udp_queries_received_ipv6);
fprintf(fp, "dns-tcp-queries-received-ipv4 %" PRIu64 "\n", counts.dns_tcp_queries_received_ipv4);
@ -510,7 +510,7 @@ void rssm_save_sources(const char* sbuf)
FILE* fp;
char* tbuf = 0;
int i;
i = asprintf(&tbuf, "%s.%s.%06lu", sources_prefix, sbuf, (u_long)open_ts.tv_usec);
i = asprintf(&tbuf, "%s.%s.%06" PRI_tv_usec, sources_prefix, sbuf, open_ts.tv_usec);
if (i < 1 || !tbuf) {
logerr("asprintf: out of memory");
return;
@ -535,7 +535,7 @@ void rssm_save_aggregated(const char* sbuf)
FILE* fp;
char* tbuf = 0;
int i;
i = asprintf(&tbuf, "%s.%s.%06lu", aggregated_prefix, sbuf, (u_long)open_ts.tv_usec);
i = asprintf(&tbuf, "%s.%s.%06" PRI_tv_usec, aggregated_prefix, sbuf, open_ts.tv_usec);
if (i < 1 || !tbuf) {
logerr("asprintf: out of memory");
return;
@ -566,7 +566,7 @@ int rssm_close(my_bpftimeval ts)
struct tm tm;
if (dont_fork_on_close) {
gmtime_r((time_t*)&open_ts.tv_sec, &tm);
gmtime_r(&open_ts.tv_sec, &tm);
strftime(sbuf, sizeof(sbuf), "%Y%m%d.%H%M%S", &tm);
close_ts = ts;
rssm_save_counts(sbuf);
@ -596,7 +596,7 @@ int rssm_close(my_bpftimeval ts)
exit(0);
}
/* grandchild (2nd gen) continues */
gmtime_r((time_t*)&open_ts.tv_sec, &tm);
gmtime_r(&open_ts.tv_sec, &tm);
strftime(sbuf, sizeof(sbuf), "%Y%m%d.%H%M%S", &tm);
close_ts = ts;
rssm_save_counts(sbuf);

View file

@ -290,8 +290,8 @@ void rzkeychange_submit_counts(void)
double elapsed = (double)clos_ts.tv_sec - (double)open_ts.tv_sec + 0.000001 * clos_ts.tv_usec - 0.000001 * open_ts.tv_usec; // NOSONAR
int k;
k = snprintf(qname, sizeof(qname), "%lu-%u-%" PRIu64 "-%" PRIu64 "-%" PRIu64 "-%" PRIu64 "-%" PRIu64 "-%" PRIu64 "-%" PRIu64 ".%s.%s.%s",
(u_long)open_ts.tv_sec,
k = snprintf(qname, sizeof(qname), "%" PRI_tv_sec "-%u-%" PRIu64 "-%" PRIu64 "-%" PRIu64 "-%" PRIu64 "-%" PRIu64 "-%" PRIu64 "-%" PRIu64 ".%s.%s.%s",
open_ts.tv_sec,
(unsigned int)(elapsed + 0.5),
counts.total,
counts.dnskey,
@ -330,8 +330,8 @@ void rzkeychange_submit_counts(void)
if (*t == '.' || *t == ':')
*t = '-';
k = snprintf(qname, sizeof(qname), "%lu.%s.%hhx.%s.%s.%s.%s",
(u_long)open_ts.tv_sec,
k = snprintf(qname, sizeof(qname), "%" PRI_tv_sec ".%s.%hhx.%s.%s.%s.%s",
open_ts.tv_sec,
s,
key_tag_signals[i].flags,
key_tag_signals[i].signal,

View file

@ -220,7 +220,7 @@ void txtout_output(const char* descr, iaddr from, iaddr to, uint8_t proto, unsig
/*
* IP Stuff
*/
fprintf(out, "%10ld.%06ld", (long)ts.tv_sec, (long)ts.tv_usec);
fprintf(out, "%10" PRI_tv_sec ".%06" PRI_tv_usec, ts.tv_sec, ts.tv_usec);
fprintf(out, " %s %u", ia_str(from), sport);
fprintf(out, " %s %u", ia_str(to), dport);
fprintf(out, " %hhu", proto);

View file

@ -143,8 +143,8 @@ int main(int argc, char* argv[])
struct tm tm;
gmtime_r(&start_time, &tm);
strftime(when, sizeof when, "%F %T", &tm);
fprintf(stderr, "Sleeping for %d seconds until %s UTC\n",
(int)(start_time - now.tv_sec), when);
fprintf(stderr, "Sleeping for %" PRI_tv_sec " seconds until %s UTC\n",
start_time - now.tv_sec, when);
sleep(start_time - now.tv_sec);
fprintf(stderr, "Awake.\n");
}

View file

@ -49,6 +49,21 @@
#endif
#endif
/* Macros for printing timeval */
#include <inttypes.h>
#if _TIME_BITS == 64
#define PRI_tv_sec PRId64
#define PRI_tv_usec PRId64
#else
#ifdef __OpenBSD__
#define PRI_tv_sec PRId64
#define PRI_tv_usec "ld"
#else
#define PRI_tv_sec "ld"
#define PRI_tv_usec "ld"
#endif
#endif
/*
* setup MY_BPFTIMEVAL as the timeval structure that bpf packets
* will be assoicated with packets from libpcap

View file

@ -198,7 +198,7 @@ int dumper_open(my_bpftimeval ts)
gmtime_r((time_t*)&ts.tv_sec, &tm);
strftime(sbuf, 64, "%Y%m%d.%H%M%S", &tm);
if (asprintf(&dumpname, "%s.%s.%06ld%s",
if (asprintf(&dumpname, "%s.%s.%06" PRI_tv_usec "%s",
dump_base, sbuf,
ts.tv_usec, dump_suffix ? dump_suffix : "")
< 0

View file

@ -192,7 +192,7 @@ void layer_pkt(u_char* user, const pcap_thread_packet_t* packet, const u_char* p
break;
}
t = (time_t)firstpkt->pkthdr.ts.tv_sec;
t = firstpkt->pkthdr.ts.tv_sec;
gmtime_r(&t, &tm);
strftime(when, sizeof(when), "%Y-%m-%d %T", &tm);
@ -207,7 +207,7 @@ void layer_pkt(u_char* user, const pcap_thread_packet_t* packet, const u_char* p
}
if (vlan != MAX_VLAN) {
snprintf(descr, sizeof(descr), "[%zu] %s.%06ld [#%zd %s (vlan %u) %u] \\\n",
snprintf(descr, sizeof(descr), "[%zu] %s.%06" PRI_tv_usec " [#%zd %s (vlan %u) %u] \\\n",
len,
when,
firstpkt->pkthdr.ts.tv_usec,
@ -216,7 +216,7 @@ void layer_pkt(u_char* user, const pcap_thread_packet_t* packet, const u_char* p
vlan,
vlan);
} else {
snprintf(descr, sizeof(descr), "[%zu] %s.%06ld [#%zd %s %u] \\\n",
snprintf(descr, sizeof(descr), "[%zu] %s.%06" PRI_tv_usec " [#%zd %s %u] \\\n",
len,
when,
firstpkt->pkthdr.ts.tv_usec,
@ -426,7 +426,7 @@ void dl_pkt(u_char* user, const struct pcap_pkthdr* hdr, const u_char* pkt, cons
struct tm tm;
time_t t;
t = (time_t)hdr->ts.tv_sec;
t = hdr->ts.tv_sec;
gmtime_r(&t, &tm);
strftime(when, sizeof when, "%Y-%m-%d %T", &tm);
if (vlan != MAX_VLAN) {
@ -437,7 +437,7 @@ void dl_pkt(u_char* user, const struct pcap_pkthdr* hdr, const u_char* pkt, cons
} else {
viap = "\"some interface\"";
}
snprintf(descr, sizeof(descr), "[%zu] %s.%06ld [#%zu %s %u] \\\n",
snprintf(descr, sizeof(descr), "[%zu] %s.%06" PRI_tv_usec " [#%zu %s %u] \\\n",
len, when, hdr->ts.tv_usec, msgcount, viap, vlan);
} else {
descr[0] = '\0';
@ -725,9 +725,9 @@ void network_pkt2(const char* descr, my_bpftimeval ts, const pcap_thread_packet_
tcpstate = tcpstate_find(from, to, sport, dport, ts.tv_sec);
if (dumptrace >= 3) {
fprintf(stderr, "%s: tcp pkt: %" PRIdMAX ".%06ld [%4zu] %15s -> ",
fprintf(stderr, "%s: tcp pkt: %" PRI_tv_sec ".%06" PRI_tv_usec " [%4zu] %15s -> ",
ProgramName,
(intmax_t)ts.tv_sec,
ts.tv_sec,
ts.tv_usec,
len,
ia_str(from));
@ -1327,8 +1327,8 @@ void network_pkt(const char* descr, my_bpftimeval ts, unsigned pf,
tcpstate = tcpstate_find(from, to, sport, dport, ts.tv_sec);
if (dumptrace >= 3) {
fprintf(stderr, "%s: tcp pkt: %" PRIdMAX ".%06ld [%4zu] ", ProgramName,
(intmax_t)ts.tv_sec, ts.tv_usec, len);
fprintf(stderr, "%s: tcp pkt: %" PRI_tv_sec ".%06" PRI_tv_usec " [%4zu] ", ProgramName,
ts.tv_sec, ts.tv_usec, len);
fprintf(stderr, "%15s -> ", ia_str(from));
fprintf(stderr, "%15s; ", ia_str(to));
if (tcpstate)

View file

@ -1,12 +1,13 @@
AC_DEFUN([AX_PCAP_THREAD_PCAP], [
AC_HEADER_TIME
AC_CHECK_LIB([pcap], [pcap_open_live], [], AC_MSG_ERROR([libpcap not found]))
AC_CHECK_LIB([pcap], [pcap_open_live], [], [AC_MSG_ERROR([libpcap not found])])
AC_CHECK_HEADER([pcap/pcap.h], [], [AC_MSG_ERROR([libpcap header not found])])
AC_CHECK_HEADERS([endian.h sys/endian.h machine/endian.h sys/time.h])
AC_CHECK_FUNCS([pcap_create pcap_set_tstamp_precision pcap_set_immediate_mode])
AC_CHECK_FUNCS([pcap_set_tstamp_type pcap_setdirection sched_yield])
AC_CHECK_FUNCS([pcap_open_offline_with_tstamp_precision pcap_activate])
AC_CHECK_TYPES([pcap_direction_t], [], [], [[#include <pcap/pcap.h>]])
AC_CHECK_DECL([DLT_LINUX_SLL2], [], [AC_MSG_ERROR([link-type DLT_LINUX_SLL2 not found, libpcap >= 1.10.0 required])], [[#include <pcap/pcap.h>]])
])
AC_DEFUN([AX_PCAP_THREAD], [

View file

@ -105,10 +105,10 @@ extern "C" {
/* clang-format off */
#define PCAP_THREAD_VERSION_STR "4.1.0"
#define PCAP_THREAD_VERSION_STR "4.1.1"
#define PCAP_THREAD_VERSION_MAJOR 4
#define PCAP_THREAD_VERSION_MINOR 1
#define PCAP_THREAD_VERSION_PATCH 0
#define PCAP_THREAD_VERSION_PATCH 1
#define PCAP_THREAD_DEFAULT_TIMEOUT 1000
#define PCAP_THREAD_DEFAULT_QUEUE_SIZE 64