diff options
Diffstat (limited to '')
-rw-r--r-- | src/test/Makefile.am | 8 | ||||
-rw-r--r-- | src/test/Makefile.in | 15 | ||||
-rw-r--r-- | src/test/gen_icmp.py | 10 | ||||
-rw-r--r-- | src/test/icmp.gold | 4 | ||||
-rw-r--r-- | src/test/icmp.pcap | bin | 0 -> 160 bytes | |||
-rwxr-xr-x | src/test/test_icmp.sh | 11 |
6 files changed, 42 insertions, 6 deletions
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" |