Merging upstream version 2.2.1.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-08 12:16:03 +01:00
parent 8a88aceccc
commit 7fadabf04f
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
66 changed files with 117 additions and 81 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2023, OARC, Inc.
* Copyright (c) 2016-2024 OARC, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2023, OARC, Inc.
* Copyright (c) 2016-2024 OARC, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2023, OARC, Inc.
* Copyright (c) 2016-2024 OARC, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2023, OARC, Inc.
* Copyright (c) 2016-2024 OARC, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -86,7 +86,7 @@ void prepare_bpft(void)
else
len += text_add(&bpfl, "("); /* ( transports ... */
if (wanticmp) {
len += text_add(&bpfl, " ( ip proto 1 or ip proto 58 ) or");
len += text_add(&bpfl, " ( icmp or icmp6 ) or");
}
if (wantfrags) {
len += text_add(&bpfl, " ( ip[6:2] & 0x1fff != 0 or ip6[6] = 44 ) or");

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2023, OARC, Inc.
* Copyright (c) 2016-2024 OARC, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2023, OARC, Inc.
* Copyright (c) 2016-2024 OARC, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2023, OARC, Inc.
* Copyright (c) 2016-2024 OARC, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View file

@ -1,4 +1,4 @@
.\" Copyright (c) 2016-2023, OARC, Inc.
.\" Copyright (c) 2016-2024 OARC, Inc.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
@ -226,8 +226,8 @@ This depends on the libpcap version.
If you want to make sure you're capturing on all interfaces then use the
special "any" or "all" (depends on system).
More than one interface may be selected which will cause output to be
interleaved from all selected interfaces.
Can be specified more than once to select multiple interfaces, this will
cause output to be interleaved from all selected interfaces.
.TP
.B \-p
Asks that the interface not be put into promiscuous mode.
@ -468,7 +468,7 @@ VLAN id 4095 can be used to specify all vlans.
.BI "\-L " vlan
Captures 802.1Q encapsulated packets matching the specified vlans AND
packets without VLAN tags.
Can be specified more than one to select multiple vlans.
Can be specified more than once to select multiple vlans.
VLAN id 4095 can be used to specify all vlans.
.TP
.BI "\-u " port

View file

@ -4,7 +4,7 @@
*/
/*
* Copyright (c) 2016-2023, OARC, Inc.
* Copyright (c) 2016-2024 OARC, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2023, OARC, Inc.
* Copyright (c) 2016-2024 OARC, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2023, OARC, Inc.
* Copyright (c) 2016-2024 OARC, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2023, OARC, Inc.
* Copyright (c) 2016-2024 OARC, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2023, OARC, Inc.
* Copyright (c) 2016-2024 OARC, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2023, OARC, Inc.
* Copyright (c) 2016-2024 OARC, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2023, OARC, Inc.
* Copyright (c) 2016-2024 OARC, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View file

@ -4,7 +4,7 @@
*/
/*
* Copyright (c) 2016-2023, OARC, Inc.
* Copyright (c) 2016-2024 OARC, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View file

@ -4,7 +4,7 @@
*/
/*
* Copyright (c) 2016-2023, OARC, Inc.
* Copyright (c) 2016-2024 OARC, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2023, OARC, Inc.
* Copyright (c) 2016-2024 OARC, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -325,7 +325,7 @@ int dumper_close(my_bpftimeval ts)
int x;
if (!p->close)
continue;
x = (*p->close)(ts);
x = (*p->close)();
if (x)
logerr("%s_close returned %d", p->name, x);
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2023, OARC, Inc.
* Copyright (c) 2016-2024 OARC, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2023, OARC, Inc.
* Copyright (c) 2016-2024 OARC, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2023, OARC, Inc.
* Copyright (c) 2016-2024 OARC, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2023, OARC, Inc.
* Copyright (c) 2016-2024 OARC, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2023, OARC, Inc.
* Copyright (c) 2016-2024 OARC, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2023, OARC, Inc.
* Copyright (c) 2016-2024 OARC, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2023, OARC, Inc.
* Copyright (c) 2016-2024 OARC, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2023, OARC, Inc.
* Copyright (c) 2016-2024 OARC, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2023, OARC, Inc.
* Copyright (c) 2016-2024 OARC, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2023, OARC, Inc.
* Copyright (c) 2016-2024 OARC, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2023, OARC, Inc.
* Copyright (c) 2016-2024 OARC, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2023, OARC, Inc.
* Copyright (c) 2016-2024 OARC, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2023, OARC, Inc.
* Copyright (c) 2016-2024 OARC, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2023, OARC, Inc.
* Copyright (c) 2016-2024 OARC, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2023, OARC, Inc.
* Copyright (c) 2016-2024 OARC, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2023, OARC, Inc.
* Copyright (c) 2016-2024 OARC, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2023, OARC, Inc.
* Copyright (c) 2016-2024 OARC, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2023, OARC, Inc.
* Copyright (c) 2016-2024 OARC, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2023, OARC, Inc.
* Copyright (c) 2016-2024 OARC, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2023, OARC, Inc.
* Copyright (c) 2016-2024 OARC, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018-2023, OARC, Inc.
* Copyright (c) 2018-2024 OARC, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018-2023, OARC, Inc.
* Copyright (c) 2018-2024 OARC, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018-2023, OARC, Inc.
* Copyright (c) 2018-2024 OARC, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018-2023, OARC, Inc.
* Copyright (c) 2018-2024 OARC, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View file

@ -16,11 +16,12 @@ CLEANFILES = test*.log test*.trs \
test13.out \
test14.out \
test_regex_match.out \
edns.out
edns.out \
test_icmp.out
TESTS = test1.sh test2.sh test3.sh test4.sh test5.sh test6.sh test7.sh \
test8.sh test9.sh test10.sh test11.sh test12.sh test13.sh test14.sh \
test_regex_match.sh test_edns.sh
test_regex_match.sh test_edns.sh test_icmp.sh
EXTRA_DIST = $(TESTS) \
dns.gold dns.pcap \
@ -36,4 +37,5 @@ EXTRA_DIST = $(TESTS) \
dns6.pcap test10.gold \
test14.gold \
test_regex_match.gold \
edns.pcap edns.gold
edns.pcap edns.gold \
gen_icmp.py icmp.pcap icmp.gold

View file

@ -481,11 +481,12 @@ CLEANFILES = test*.log test*.trs \
test13.out \
test14.out \
test_regex_match.out \
edns.out
edns.out \
test_icmp.out
TESTS = test1.sh test2.sh test3.sh test4.sh test5.sh test6.sh test7.sh \
test8.sh test9.sh test10.sh test11.sh test12.sh test13.sh test14.sh \
test_regex_match.sh test_edns.sh
test_regex_match.sh test_edns.sh test_icmp.sh
EXTRA_DIST = $(TESTS) \
dns.gold dns.pcap \
@ -501,7 +502,8 @@ EXTRA_DIST = $(TESTS) \
dns6.pcap test10.gold \
test14.gold \
test_regex_match.gold \
edns.pcap edns.gold
edns.pcap edns.gold \
gen_icmp.py icmp.pcap icmp.gold
all: all-am
@ -803,6 +805,13 @@ test_edns.sh.log: test_edns.sh
--log-file $$b.log --trs-file $$b.trs \
$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
"$$tst" $(AM_TESTS_FD_REDIRECT)
test_icmp.sh.log: test_icmp.sh
@p='test_icmp.sh'; \
b='test_icmp.sh'; \
$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
--log-file $$b.log --trs-file $$b.trs \
$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
"$$tst" $(AM_TESTS_FD_REDIRECT)
.test.log:
@p='$<'; \
$(am__set_b); \

10
src/test/gen_icmp.py Normal file
View file

@ -0,0 +1,10 @@
import sys
from scapy.all import *
pcap = sys.argv[1]
pkts = []
pkts.append(Ether()/IPv6(dst="2001:db8:dead::1")/ICMPv6DestUnreach())
pkts.append(Ether()/IP(dst="0.0.0.0")/ICMP(type=3))
wrpcap(pcap, pkts)

4
src/test/icmp.gold Normal file
View file

@ -0,0 +1,4 @@
[48] 2024-09-10 08:52:52.252793 [#0 icmp.pcap 4095] \
[fd00::242:ac11:9].0 [2001:db8:dead::1].0
[28] 2024-09-10 08:52:52.253461 [#1 icmp.pcap 4095] \
[172.17.0.9].0 [0.0.0.0].0

BIN
src/test/icmp.pcap Normal file

Binary file not shown.

11
src/test/test_icmp.sh Executable file
View file

@ -0,0 +1,11 @@
#!/bin/sh -xe
test -e icmp.pcap || ln -s "$srcdir/icmp.pcap" icmp.pcap
../dnscap -g -I -r icmp.pcap 2>test_icmp.out
mv test_icmp.out test_icmp.out.old
grep -v "^libgcov profiling error:" test_icmp.out.old > test_icmp.out
rm test_icmp.out.old
diff test_icmp.out "$srcdir/icmp.gold"