diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-09-11 12:02:40 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-09-11 12:02:40 +0000 |
commit | 4e0143a3bd62defb458342444822a445d8513107 (patch) | |
tree | 4b8ea3f51cf497c3e8539be41a16242c19054be1 /src | |
parent | Adding upstream version 2.2.0. (diff) | |
download | dnscap-upstream/2.2.1.tar.xz dnscap-upstream/2.2.1.zip |
Adding upstream version 2.2.1.upstream/2.2.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src')
48 files changed, 89 insertions, 53 deletions
@@ -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 @@ -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 diff --git a/src/assert.c b/src/assert.c index 4c86762..796db9c 100644 --- a/src/assert.c +++ b/src/assert.c @@ -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 @@ -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"); @@ -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 diff --git a/src/daemon.c b/src/daemon.c index 83e614c..819bbab 100644 --- a/src/daemon.c +++ b/src/daemon.c @@ -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 diff --git a/src/daemon.h b/src/daemon.h index e120eaf..a8e248a 100644 --- a/src/daemon.h +++ b/src/daemon.h @@ -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 diff --git a/src/dnscap.1.in b/src/dnscap.1.in index 55289cb..9ee0f66 100644 --- a/src/dnscap.1.in +++ b/src/dnscap.1.in @@ -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 diff --git a/src/dnscap.c b/src/dnscap.c index a3e2ba1..038ec61 100644 --- a/src/dnscap.c +++ b/src/dnscap.c @@ -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 diff --git a/src/dnscap.h b/src/dnscap.h index e079ec9..2a8acf2 100644 --- a/src/dnscap.h +++ b/src/dnscap.h @@ -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 diff --git a/src/dnscap_common.h b/src/dnscap_common.h index a1f05d9..eff2603 100644 --- a/src/dnscap_common.h +++ b/src/dnscap_common.h @@ -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 diff --git a/src/dump_cbor.c b/src/dump_cbor.c index 89cf5be..c287330 100644 --- a/src/dump_cbor.c +++ b/src/dump_cbor.c @@ -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 diff --git a/src/dump_cbor.h b/src/dump_cbor.h index a032cd8..6cdb1ec 100644 --- a/src/dump_cbor.h +++ b/src/dump_cbor.h @@ -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 diff --git a/src/dump_cds.c b/src/dump_cds.c index 3f680b5..64cfd24 100644 --- a/src/dump_cds.c +++ b/src/dump_cds.c @@ -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 diff --git a/src/dump_cds.h b/src/dump_cds.h index 3eb2818..124dbbe 100644 --- a/src/dump_cds.h +++ b/src/dump_cds.h @@ -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 diff --git a/src/dump_dns.c b/src/dump_dns.c index 121a97e..a71145f 100644 --- a/src/dump_dns.c +++ b/src/dump_dns.c @@ -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 diff --git a/src/dump_dns.h b/src/dump_dns.h index e3394f3..194233f 100644 --- a/src/dump_dns.h +++ b/src/dump_dns.h @@ -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 diff --git a/src/dumper.c b/src/dumper.c index 88d83fd..1c57784 100644 --- a/src/dumper.c +++ b/src/dumper.c @@ -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); } diff --git a/src/dumper.h b/src/dumper.h index ffef7cd..5671c90 100644 --- a/src/dumper.h +++ b/src/dumper.h @@ -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 diff --git a/src/endian_compat.h b/src/endian_compat.h index b7b89c1..37752de 100644 --- a/src/endian_compat.h +++ b/src/endian_compat.h @@ -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 diff --git a/src/endpoint.c b/src/endpoint.c index a2b848f..3de077f 100644 --- a/src/endpoint.c +++ b/src/endpoint.c @@ -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 diff --git a/src/endpoint.h b/src/endpoint.h index 2ad2cf3..cf224e2 100644 --- a/src/endpoint.h +++ b/src/endpoint.h @@ -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 diff --git a/src/hashtbl.c b/src/hashtbl.c index c497b78..f788838 100644 --- a/src/hashtbl.c +++ b/src/hashtbl.c @@ -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 diff --git a/src/hashtbl.h b/src/hashtbl.h index d049ca5..283353b 100644 --- a/src/hashtbl.h +++ b/src/hashtbl.h @@ -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 diff --git a/src/iaddr.c b/src/iaddr.c index bbe47be..67c0fc8 100644 --- a/src/iaddr.c +++ b/src/iaddr.c @@ -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 diff --git a/src/iaddr.h b/src/iaddr.h index 452ca14..7f4fbde 100644 --- a/src/iaddr.h +++ b/src/iaddr.h @@ -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 @@ -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 @@ -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 diff --git a/src/memzero.c b/src/memzero.c index 6b983a4..99dad49 100644 --- a/src/memzero.c +++ b/src/memzero.c @@ -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 diff --git a/src/memzero.h b/src/memzero.h index 02ede71..8e73470 100644 --- a/src/memzero.h +++ b/src/memzero.h @@ -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 diff --git a/src/network.c b/src/network.c index 9fc1f00..0258739 100644 --- a/src/network.c +++ b/src/network.c @@ -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 diff --git a/src/network.h b/src/network.h index 0d1bb5f..440262f 100644 --- a/src/network.h +++ b/src/network.h @@ -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 diff --git a/src/options.c b/src/options.c index ce0c047..1dab3e2 100644 --- a/src/options.c +++ b/src/options.c @@ -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 diff --git a/src/options.h b/src/options.h index ce601e1..96b1a8c 100644 --- a/src/options.h +++ b/src/options.h @@ -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 diff --git a/src/pcaps.c b/src/pcaps.c index f89b9bb..501f094 100644 --- a/src/pcaps.c +++ b/src/pcaps.c @@ -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 diff --git a/src/pcaps.h b/src/pcaps.h index 554b8b8..e1a59a7 100644 --- a/src/pcaps.h +++ b/src/pcaps.h @@ -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 @@ -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 @@ -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 diff --git a/src/tcpreasm.c b/src/tcpreasm.c index 7dc82fa..8c49c8d 100644 --- a/src/tcpreasm.c +++ b/src/tcpreasm.c @@ -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 diff --git a/src/tcpreasm.h b/src/tcpreasm.h index 37260e0..34ddef3 100644 --- a/src/tcpreasm.h +++ b/src/tcpreasm.h @@ -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 diff --git a/src/tcpstate.c b/src/tcpstate.c index b11c701..eb73056 100644 --- a/src/tcpstate.c +++ b/src/tcpstate.c @@ -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 diff --git a/src/tcpstate.h b/src/tcpstate.h index 2f77ddb..e5dd08a 100644 --- a/src/tcpstate.h +++ b/src/tcpstate.h @@ -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 diff --git a/src/test/Makefile.am b/src/test/Makefile.am index 1918400..91d11a5 100644 --- a/src/test/Makefile.am +++ b/src/test/Makefile.am @@ -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 diff --git a/src/test/Makefile.in b/src/test/Makefile.in index 1aff4ee..5c51d7c 100644 --- a/src/test/Makefile.in +++ b/src/test/Makefile.in @@ -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); \ diff --git a/src/test/gen_icmp.py b/src/test/gen_icmp.py new file mode 100644 index 0000000..afee206 --- /dev/null +++ b/src/test/gen_icmp.py @@ -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)
\ No newline at end of file diff --git a/src/test/icmp.gold b/src/test/icmp.gold new file mode 100644 index 0000000..8c05b66 --- /dev/null +++ b/src/test/icmp.gold @@ -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 diff --git a/src/test/icmp.pcap b/src/test/icmp.pcap Binary files differnew file mode 100644 index 0000000..2aba75d --- /dev/null +++ b/src/test/icmp.pcap diff --git a/src/test/test_icmp.sh b/src/test/test_icmp.sh new file mode 100755 index 0000000..43f44e8 --- /dev/null +++ b/src/test/test_icmp.sh @@ -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" |