diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-09-04 09:27:04 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-09-04 09:27:04 +0000 |
commit | 81fa0bc63909a67cdd6d321617a2e5648a6a94a2 (patch) | |
tree | 2b0a2eae7aed22e3c6f707283d7617d8c02b3fbe /plugins/anonaes128 | |
parent | Adding upstream version 2.1.3. (diff) | |
download | dnscap-81fa0bc63909a67cdd6d321617a2e5648a6a94a2.tar.xz dnscap-81fa0bc63909a67cdd6d321617a2e5648a6a94a2.zip |
Adding upstream version 2.2.0.upstream/2.2.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'plugins/anonaes128')
-rw-r--r-- | plugins/anonaes128/Makefile.am | 3 | ||||
-rw-r--r-- | plugins/anonaes128/Makefile.in | 18 | ||||
-rw-r--r-- | plugins/anonaes128/anonaes128.c | 75 | ||||
-rw-r--r-- | plugins/anonaes128/test1.gold | 246 | ||||
-rwxr-xr-x | plugins/anonaes128/test1.sh | 5 | ||||
-rwxr-xr-x | plugins/anonaes128/test2.sh | 8 | ||||
-rwxr-xr-x | plugins/anonaes128/test3.sh | 8 |
7 files changed, 333 insertions, 30 deletions
diff --git a/plugins/anonaes128/Makefile.am b/plugins/anonaes128/Makefile.am index 2e9df57..ec4206a 100644 --- a/plugins/anonaes128/Makefile.am +++ b/plugins/anonaes128/Makefile.am @@ -1,9 +1,10 @@ MAINTAINERCLEANFILES = $(srcdir)/Makefile.in -CLEANFILES = *.gcda *.gcno *.gcov +CLEANFILES = *.gcda *.gcno *.gcov *.pcap-dist AM_CFLAGS = -I$(srcdir) \ -I$(top_srcdir)/src \ -I$(top_srcdir)/isc \ + -I$(top_srcdir)/plugins/shared \ $(SECCOMPFLAGS) $(libcrypto_CFLAGS) pkglib_LTLIBRARIES = anonaes128.la diff --git a/plugins/anonaes128/Makefile.in b/plugins/anonaes128/Makefile.in index c3463cb..2fc9d86 100644 --- a/plugins/anonaes128/Makefile.in +++ b/plugins/anonaes128/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.1 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2018 Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -205,8 +205,6 @@ am__define_uniq_tagged_files = \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags am__tty_colors_dummy = \ mgn= red= grn= lgn= blu= brg= std=; \ am__color_tests=no @@ -362,6 +360,7 @@ am__set_TESTS_bases = \ bases='$(TEST_LOGS)'; \ bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ bases=`echo $$bases` +AM_TESTSUITE_SUMMARY_HEADER = ' for $(PACKAGE_STRING)' RECHECK_LOGS = $(TEST_LOGS) AM_RECURSIVE_TARGETS = check recheck TEST_SUITE_LOG = test-suite.log @@ -400,6 +399,8 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -410,6 +411,7 @@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ +ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ @@ -516,11 +518,12 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ MAINTAINERCLEANFILES = $(srcdir)/Makefile.in -CLEANFILES = *.gcda *.gcno *.gcov test1.out test2.out test3.out \ - test3.pcap.20181127.155200.414188 test4.tmp +CLEANFILES = *.gcda *.gcno *.gcov *.pcap-dist test1.out test2.out \ + test3.out test3.pcap.20181127.155200.414188 test4.tmp AM_CFLAGS = -I$(srcdir) \ -I$(top_srcdir)/src \ -I$(top_srcdir)/isc \ + -I$(top_srcdir)/plugins/shared \ $(SECCOMPFLAGS) $(libcrypto_CFLAGS) pkglib_LTLIBRARIES = anonaes128.la @@ -804,7 +807,7 @@ $(TEST_SUITE_LOG): $(TEST_LOGS) test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ fi; \ echo "$${col}$$br$${std}"; \ - echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \ + echo "$${col}Testsuite summary"$(AM_TESTSUITE_SUMMARY_HEADER)"$${std}"; \ echo "$${col}$$br$${std}"; \ create_testsuite_report --maybe-color; \ echo "$$col$$br$$std"; \ @@ -880,7 +883,6 @@ test4.sh.log: test4.sh @am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ @am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ @am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) - distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am diff --git a/plugins/anonaes128/anonaes128.c b/plugins/anonaes128/anonaes128.c index b2d8dbd..0c86911 100644 --- a/plugins/anonaes128/anonaes128.c +++ b/plugins/anonaes128/anonaes128.c @@ -42,6 +42,7 @@ #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> +#include <netinet/in.h> #include "dnscap_common.h" @@ -50,12 +51,13 @@ #include <openssl/evp.h> #include <openssl/err.h> #define USE_OPENSSL 1 +#include "edns0_ecs.c" #endif static set_iaddr_t anonaes128_set_iaddr = 0; static logerr_t* logerr; -static int only_clients = 0, only_servers = 0, dns_port = 53, encrypt_v4 = 0, decrypt = 0; +static int only_clients = 0, only_servers = 0, dns_port = 53, encrypt_v4 = 0, decrypt = 0, edns = 0; static unsigned char key[16]; static unsigned char iv[16]; #ifdef USE_OPENSSL @@ -86,7 +88,9 @@ void anonaes128_usage() "\t-c Only en/de-crypt clients (port != 53)\n" "\t-s Only en/de-crypt servers (port == 53)\n" "\t-p <port> Set port for -c/-s, default 53\n" - "\t-4 Encrypt IPv4 addresses, not default or recommended\n"); + "\t-4 Encrypt IPv4 addresses, not default or recommended\n" + "\t-e Also en/de-crypt EDNS(0) Client Subnet\n" + "\t-E ONLY en/de-crypt EDNS(0) Client Subnet, not IP addresses\n"); } void anonaes128_extension(int ext, void* arg) @@ -104,7 +108,7 @@ void anonaes128_getopt(int* argc, char** argv[]) unsigned long ul; char* p; - while ((c = getopt(*argc, *argv, "?k:K:i:I:Dcsp:4")) != EOF) { + while ((c = getopt(*argc, *argv, "?k:K:i:I:Dcsp:4eE")) != EOF) { switch (c) { case 'k': if (strlen(optarg) != 16) { @@ -174,6 +178,13 @@ void anonaes128_getopt(int* argc, char** argv[]) case '4': encrypt_v4 = 1; break; + case 'e': + if (!edns) + edns = 1; + break; + case 'E': + edns = -1; + break; case '?': anonaes128_usage(); if (!optopt || optopt == '?') { @@ -242,12 +253,66 @@ int anonaes128_close(my_bpftimeval ts) return 0; } +#ifdef USE_OPENSSL +void ecs_callback(int family, u_char* buf, size_t len) +{ + unsigned char outbuf[16 + EVP_MAX_BLOCK_LENGTH] = { 0 }; + int outlen = 0; + + struct in6_addr in6 = IN6ADDR_ANY_INIT; + + switch (family) { + case 1: // IPv4 + if (len > sizeof(struct in_addr)) + break; + if (encrypt_v4) { + memcpy(&in6, buf, len); + memcpy(((uint8_t*)&in6) + 4, &in6, 4); + memcpy(((uint8_t*)&in6) + 8, &in6, 4); + memcpy(((uint8_t*)&in6) + 12, &in6, 4); + if (!EVP_CipherUpdate(ctx, outbuf, &outlen, (void*)&in6, 16)) { + logerr("anonaes128.so: error en/de-crypting IP address: %s", ERR_reason_error_string(ERR_get_error())); + exit(1); + } + if (outlen != 16) { + logerr("anonaes128.so: error en/de-crypted output is not 16 bytes"); + exit(1); + } + memcpy(buf, outbuf, len); + } + break; + case 2: // IPv6 + if (len > sizeof(struct in6_addr)) + break; + memcpy(&in6, buf, len); + if (!EVP_CipherUpdate(ctx, outbuf, &outlen, (void*)&in6, 16)) { + logerr("anonaes128.so: error en/de-crypting IP address: %s", ERR_reason_error_string(ERR_get_error())); + exit(1); + } + if (outlen != 16) { + logerr("anonaes128.so: error en/de-crypted output is not 16 bytes"); + exit(1); + } + memcpy(buf, outbuf, len); + break; + default: + break; + } +} +#endif + int anonaes128_filter(const char* descr, iaddr* from, iaddr* to, uint8_t proto, unsigned flags, unsigned sport, unsigned dport, my_bpftimeval ts, - const u_char* pkt_copy, const unsigned olen, - const u_char* payload, const unsigned payloadlen) + u_char* pkt_copy, const unsigned olen, + u_char* payload, const unsigned payloadlen) { #ifdef USE_OPENSSL + if (edns && flags & DNSCAP_OUTPUT_ISDNS && payload && payloadlen > DNS_MSG_HDR_SZ) { + parse_for_edns0_ecs(payload, payloadlen, ecs_callback); + if (edns < 0) + return 0; + } + unsigned char outbuf[16 + EVP_MAX_BLOCK_LENGTH]; int outlen = 0; diff --git a/plugins/anonaes128/test1.gold b/plugins/anonaes128/test1.gold index 8bd4844..a76a0b3 100644 --- a/plugins/anonaes128/test1.gold +++ b/plugins/anonaes128/test1.gold @@ -2144,3 +2144,249 @@ anonaes128.so usage error: must have key (-k/-K) and IV (-i/-I) ns3.google.com.,IN,A,157794,216.239.36.10 \ ns4.google.com.,IN,A,157794,216.239.38.10 anonaes128.so usage error: -c and -s options are mutually exclusive +[64] 2023-07-05 07:21:38.669836 [#0 edns.pcap-dist 4095] \ + [123.118.213.76].58541 [29.178.88.193].53 \ + dns QUERY,NOERROR,31428,rd \ + 1 h.root-servers.net.,IN,A 0 0 0 +[64] 2023-07-05 07:21:38.669891 [#1 edns.pcap-dist 4095] \ + [123.118.213.76].58541 [29.178.88.193].53 \ + dns QUERY,NOERROR,5824,rd \ + 1 h.root-servers.net.,IN,AAAA 0 0 0 +[80] 2023-07-05 07:21:38.669977 [#2 edns.pcap-dist 4095] \ + [29.178.88.193].53 [123.118.213.76].58541 \ + dns QUERY,NOERROR,31428,qr|rd|ra \ + 1 h.root-servers.net.,IN,A \ + 1 h.root-servers.net.,IN,A,85098,198.97.190.53 0 0 +[92] 2023-07-05 07:21:38.670010 [#3 edns.pcap-dist 4095] \ + [29.178.88.193].53 [123.118.213.76].58541 \ + dns QUERY,NOERROR,5824,qr|rd|ra \ + 1 h.root-servers.net.,IN,AAAA \ + 1 h.root-servers.net.,IN,AAAA,85098,2001:500:1::53 0 0 +[88] 2023-07-05 07:21:38.670793 [#4 edns.pcap-dist 4095] \ + [123.118.213.76].33737 [248.188.142.6].53 \ + dns QUERY,NOERROR,56979,rd|ad \ + 1 ns1.dns.nic.aaa.,IN,NS 0 0 \ + 1 .,4096,4096,0,edns0[len=16,UDP=4096,ver=0,rcode=0,DO=0,z=0],edns0opt[code=3,codelen=0],edns0opt[code=10,codelen=8] +[464] 2023-07-05 07:21:38.698303 [#5 edns.pcap-dist 4095] \ + [248.188.142.6].53 [123.118.213.76].33737 \ + dns QUERY,NOERROR,56979,qr|rd \ + 1 ns1.dns.nic.aaa.,IN,NS 0 \ + 6 aaa.,IN,NS,172800,a.nic.aaa. \ + aaa.,IN,NS,172800,b.nic.aaa. \ + aaa.,IN,NS,172800,c.nic.aaa. \ + aaa.,IN,NS,172800,ns1.dns.nic.aaa. \ + aaa.,IN,NS,172800,ns2.dns.nic.aaa. \ + aaa.,IN,NS,172800,ns3.dns.nic.aaa. \ + 13 a.nic.aaa.,IN,A,172800,37.209.192.9 \ + b.nic.aaa.,IN,A,172800,37.209.194.9 \ + c.nic.aaa.,IN,A,172800,37.209.196.9 \ + ns1.dns.nic.aaa.,IN,A,172800,156.154.144.2 \ + ns2.dns.nic.aaa.,IN,A,172800,156.154.145.2 \ + ns3.dns.nic.aaa.,IN,A,172800,156.154.159.2 \ + a.nic.aaa.,IN,AAAA,172800,2001:dcd:1::9 \ + b.nic.aaa.,IN,AAAA,172800,2001:dcd:2::9 \ + c.nic.aaa.,IN,AAAA,172800,2001:dcd:3::9 \ + ns1.dns.nic.aaa.,IN,AAAA,172800,2610:a1:1071::2 \ + ns2.dns.nic.aaa.,IN,AAAA,172800,2610:a1:1072::2 \ + ns3.dns.nic.aaa.,IN,AAAA,172800,2610:a1:1073::2 \ + .,1232,1232,0,edns0[len=30,UDP=1232,ver=0,rcode=0,DO=0,z=0],edns0opt[code=3,codelen=26] +[64] 2023-07-05 07:21:42.739334 [#6 edns.pcap-dist 4095] \ + [123.118.213.76].53174 [29.178.88.193].53 \ + dns QUERY,NOERROR,48648,rd \ + 1 g.root-servers.net.,IN,A 0 0 0 +[64] 2023-07-05 07:21:42.739396 [#7 edns.pcap-dist 4095] \ + [123.118.213.76].53174 [29.178.88.193].53 \ + dns QUERY,NOERROR,48141,rd \ + 1 g.root-servers.net.,IN,AAAA 0 0 0 +[80] 2023-07-05 07:21:42.739525 [#8 edns.pcap-dist 4095] \ + [29.178.88.193].53 [123.118.213.76].53174 \ + dns QUERY,NOERROR,48648,qr|rd|ra \ + 1 g.root-servers.net.,IN,A \ + 1 g.root-servers.net.,IN,A,85094,192.112.36.4 0 0 +[92] 2023-07-05 07:21:42.739558 [#9 edns.pcap-dist 4095] \ + [29.178.88.193].53 [123.118.213.76].53174 \ + dns QUERY,NOERROR,48141,qr|rd|ra \ + 1 g.root-servers.net.,IN,AAAA \ + 1 g.root-servers.net.,IN,AAAA,85094,2001:500:12::d0d 0 0 +[83] 2023-07-05 07:21:42.740590 [#10 edns.pcap-dist 4095] \ + [123.118.213.76].50901 [67.192.17.119].53 \ + dns QUERY,NOERROR,35713,rd|ad \ + 1 net.,IN,A 0 0 \ + 1 .,4096,4096,0,edns0[len=23,UDP=4096,ver=0,rcode=0,DO=0,z=0],edns0opt[ECS,family=1,source=24,scope=0,addr=34.29.83.0],edns0opt[code=10,codelen=8] +[895] 2023-07-05 07:21:42.836816 [#11 edns.pcap-dist 4095] \ + [67.192.17.119].53 [123.118.213.76].50901 \ + dns QUERY,NOERROR,35713,qr|rd \ + 1 net.,IN,A 0 \ + 13 net.,IN,NS,172800,j.gtld-servers.net. \ + net.,IN,NS,172800,b.gtld-servers.net. \ + net.,IN,NS,172800,a.gtld-servers.net. \ + net.,IN,NS,172800,h.gtld-servers.net. \ + net.,IN,NS,172800,d.gtld-servers.net. \ + net.,IN,NS,172800,c.gtld-servers.net. \ + net.,IN,NS,172800,i.gtld-servers.net. \ + net.,IN,NS,172800,e.gtld-servers.net. \ + net.,IN,NS,172800,m.gtld-servers.net. \ + net.,IN,NS,172800,f.gtld-servers.net. \ + net.,IN,NS,172800,k.gtld-servers.net. \ + net.,IN,NS,172800,l.gtld-servers.net. \ + net.,IN,NS,172800,g.gtld-servers.net. \ + 27 m.gtld-servers.net.,IN,A,172800,192.55.83.30 \ + l.gtld-servers.net.,IN,A,172800,192.41.162.30 \ + k.gtld-servers.net.,IN,A,172800,192.52.178.30 \ + j.gtld-servers.net.,IN,A,172800,192.48.79.30 \ + i.gtld-servers.net.,IN,A,172800,192.43.172.30 \ + h.gtld-servers.net.,IN,A,172800,192.54.112.30 \ + g.gtld-servers.net.,IN,A,172800,192.42.93.30 \ + f.gtld-servers.net.,IN,A,172800,192.35.51.30 \ + e.gtld-servers.net.,IN,A,172800,192.12.94.30 \ + d.gtld-servers.net.,IN,A,172800,192.31.80.30 \ + c.gtld-servers.net.,IN,A,172800,192.26.92.30 \ + b.gtld-servers.net.,IN,A,172800,192.33.14.30 \ + a.gtld-servers.net.,IN,A,172800,192.5.6.30 \ + m.gtld-servers.net.,IN,AAAA,172800,2001:501:b1f9::30 \ + l.gtld-servers.net.,IN,AAAA,172800,2001:500:d937::30 \ + k.gtld-servers.net.,IN,AAAA,172800,2001:503:d2d::30 \ + j.gtld-servers.net.,IN,AAAA,172800,2001:502:7094::30 \ + i.gtld-servers.net.,IN,AAAA,172800,2001:503:39c1::30 \ + h.gtld-servers.net.,IN,AAAA,172800,2001:502:8cc::30 \ + g.gtld-servers.net.,IN,AAAA,172800,2001:503:eea3::30 \ + f.gtld-servers.net.,IN,AAAA,172800,2001:503:d414::30 \ + e.gtld-servers.net.,IN,AAAA,172800,2001:502:1ca1::30 \ + d.gtld-servers.net.,IN,AAAA,172800,2001:500:856e::30 \ + c.gtld-servers.net.,IN,AAAA,172800,2001:503:83eb::30 \ + b.gtld-servers.net.,IN,AAAA,172800,2001:503:231d::2:30 \ + a.gtld-servers.net.,IN,AAAA,172800,2001:503:a83e::2:30 \ + .,1232,1232,0,edns0[len=39,UDP=1232,ver=0,rcode=0,DO=0,z=0],edns0opt[code=10,codelen=24],edns0opt[ECS,family=1,source=24,scope=0,addr=34.29.83.0] +[86] 2023-07-05 07:21:46.511502 [#12 edns.pcap-dist 4095] \ + [123.118.213.76].35191 [99.195.235.60].53 \ + dns QUERY,NOERROR,960,rd|ad \ + 1 dnssec-failed.org.,IN,A 0 0 \ + 1 .,4096,4096,0,edns0[len=12,UDP=4096,ver=0,rcode=0,DO=0,z=0],edns0opt[code=10,codelen=8] +[131] 2023-07-05 07:21:46.518500 [#13 edns.pcap-dist 4095] \ + [99.195.235.60].53 [123.118.213.76].35191 \ + dns QUERY,SERVFAIL,960,qr|rd|ra \ + 1 dnssec-failed.org.,IN,A 0 0 \ + 1 .,1232,1232,0,edns0[len=57,UDP=1232,ver=0,rcode=0,DO=0,z=0],edns0opt[code=15,codelen=53] +[64] 2023-07-05 07:21:38.669836 [#0 edns.pcap-dist 4095] \ + [172.17.0.6].58541 [172.17.0.1].53 \ + dns QUERY,NOERROR,31428,rd \ + 1 h.root-servers.net.,IN,A 0 0 0 +[64] 2023-07-05 07:21:38.669891 [#1 edns.pcap-dist 4095] \ + [172.17.0.6].58541 [172.17.0.1].53 \ + dns QUERY,NOERROR,5824,rd \ + 1 h.root-servers.net.,IN,AAAA 0 0 0 +[80] 2023-07-05 07:21:38.669977 [#2 edns.pcap-dist 4095] \ + [172.17.0.1].53 [172.17.0.6].58541 \ + dns QUERY,NOERROR,31428,qr|rd|ra \ + 1 h.root-servers.net.,IN,A \ + 1 h.root-servers.net.,IN,A,85098,198.97.190.53 0 0 +[92] 2023-07-05 07:21:38.670010 [#3 edns.pcap-dist 4095] \ + [172.17.0.1].53 [172.17.0.6].58541 \ + dns QUERY,NOERROR,5824,qr|rd|ra \ + 1 h.root-servers.net.,IN,AAAA \ + 1 h.root-servers.net.,IN,AAAA,85098,2001:500:1::53 0 0 +[88] 2023-07-05 07:21:38.670793 [#4 edns.pcap-dist 4095] \ + [172.17.0.6].33737 [198.97.190.53].53 \ + dns QUERY,NOERROR,56979,rd|ad \ + 1 ns1.dns.nic.aaa.,IN,NS 0 0 \ + 1 .,4096,4096,0,edns0[len=16,UDP=4096,ver=0,rcode=0,DO=0,z=0],edns0opt[code=3,codelen=0],edns0opt[code=10,codelen=8] +[464] 2023-07-05 07:21:38.698303 [#5 edns.pcap-dist 4095] \ + [198.97.190.53].53 [172.17.0.6].33737 \ + dns QUERY,NOERROR,56979,qr|rd \ + 1 ns1.dns.nic.aaa.,IN,NS 0 \ + 6 aaa.,IN,NS,172800,a.nic.aaa. \ + aaa.,IN,NS,172800,b.nic.aaa. \ + aaa.,IN,NS,172800,c.nic.aaa. \ + aaa.,IN,NS,172800,ns1.dns.nic.aaa. \ + aaa.,IN,NS,172800,ns2.dns.nic.aaa. \ + aaa.,IN,NS,172800,ns3.dns.nic.aaa. \ + 13 a.nic.aaa.,IN,A,172800,37.209.192.9 \ + b.nic.aaa.,IN,A,172800,37.209.194.9 \ + c.nic.aaa.,IN,A,172800,37.209.196.9 \ + ns1.dns.nic.aaa.,IN,A,172800,156.154.144.2 \ + ns2.dns.nic.aaa.,IN,A,172800,156.154.145.2 \ + ns3.dns.nic.aaa.,IN,A,172800,156.154.159.2 \ + a.nic.aaa.,IN,AAAA,172800,2001:dcd:1::9 \ + b.nic.aaa.,IN,AAAA,172800,2001:dcd:2::9 \ + c.nic.aaa.,IN,AAAA,172800,2001:dcd:3::9 \ + ns1.dns.nic.aaa.,IN,AAAA,172800,2610:a1:1071::2 \ + ns2.dns.nic.aaa.,IN,AAAA,172800,2610:a1:1072::2 \ + ns3.dns.nic.aaa.,IN,AAAA,172800,2610:a1:1073::2 \ + .,1232,1232,0,edns0[len=30,UDP=1232,ver=0,rcode=0,DO=0,z=0],edns0opt[code=3,codelen=26] +[64] 2023-07-05 07:21:42.739334 [#6 edns.pcap-dist 4095] \ + [172.17.0.6].53174 [172.17.0.1].53 \ + dns QUERY,NOERROR,48648,rd \ + 1 g.root-servers.net.,IN,A 0 0 0 +[64] 2023-07-05 07:21:42.739396 [#7 edns.pcap-dist 4095] \ + [172.17.0.6].53174 [172.17.0.1].53 \ + dns QUERY,NOERROR,48141,rd \ + 1 g.root-servers.net.,IN,AAAA 0 0 0 +[80] 2023-07-05 07:21:42.739525 [#8 edns.pcap-dist 4095] \ + [172.17.0.1].53 [172.17.0.6].53174 \ + dns QUERY,NOERROR,48648,qr|rd|ra \ + 1 g.root-servers.net.,IN,A \ + 1 g.root-servers.net.,IN,A,85094,192.112.36.4 0 0 +[92] 2023-07-05 07:21:42.739558 [#9 edns.pcap-dist 4095] \ + [172.17.0.1].53 [172.17.0.6].53174 \ + dns QUERY,NOERROR,48141,qr|rd|ra \ + 1 g.root-servers.net.,IN,AAAA \ + 1 g.root-servers.net.,IN,AAAA,85094,2001:500:12::d0d 0 0 +[83] 2023-07-05 07:21:42.740590 [#10 edns.pcap-dist 4095] \ + [172.17.0.6].50901 [192.112.36.4].53 \ + dns QUERY,NOERROR,35713,rd|ad \ + 1 net.,IN,A 0 0 \ + 1 .,4096,4096,0,edns0[len=23,UDP=4096,ver=0,rcode=0,DO=0,z=0],edns0opt[ECS,family=1,source=24,scope=0,addr=34.29.83.0],edns0opt[code=10,codelen=8] +[895] 2023-07-05 07:21:42.836816 [#11 edns.pcap-dist 4095] \ + [192.112.36.4].53 [172.17.0.6].50901 \ + dns QUERY,NOERROR,35713,qr|rd \ + 1 net.,IN,A 0 \ + 13 net.,IN,NS,172800,j.gtld-servers.net. \ + net.,IN,NS,172800,b.gtld-servers.net. \ + net.,IN,NS,172800,a.gtld-servers.net. \ + net.,IN,NS,172800,h.gtld-servers.net. \ + net.,IN,NS,172800,d.gtld-servers.net. \ + net.,IN,NS,172800,c.gtld-servers.net. \ + net.,IN,NS,172800,i.gtld-servers.net. \ + net.,IN,NS,172800,e.gtld-servers.net. \ + net.,IN,NS,172800,m.gtld-servers.net. \ + net.,IN,NS,172800,f.gtld-servers.net. \ + net.,IN,NS,172800,k.gtld-servers.net. \ + net.,IN,NS,172800,l.gtld-servers.net. \ + net.,IN,NS,172800,g.gtld-servers.net. \ + 27 m.gtld-servers.net.,IN,A,172800,192.55.83.30 \ + l.gtld-servers.net.,IN,A,172800,192.41.162.30 \ + k.gtld-servers.net.,IN,A,172800,192.52.178.30 \ + j.gtld-servers.net.,IN,A,172800,192.48.79.30 \ + i.gtld-servers.net.,IN,A,172800,192.43.172.30 \ + h.gtld-servers.net.,IN,A,172800,192.54.112.30 \ + g.gtld-servers.net.,IN,A,172800,192.42.93.30 \ + f.gtld-servers.net.,IN,A,172800,192.35.51.30 \ + e.gtld-servers.net.,IN,A,172800,192.12.94.30 \ + d.gtld-servers.net.,IN,A,172800,192.31.80.30 \ + c.gtld-servers.net.,IN,A,172800,192.26.92.30 \ + b.gtld-servers.net.,IN,A,172800,192.33.14.30 \ + a.gtld-servers.net.,IN,A,172800,192.5.6.30 \ + m.gtld-servers.net.,IN,AAAA,172800,2001:501:b1f9::30 \ + l.gtld-servers.net.,IN,AAAA,172800,2001:500:d937::30 \ + k.gtld-servers.net.,IN,AAAA,172800,2001:503:d2d::30 \ + j.gtld-servers.net.,IN,AAAA,172800,2001:502:7094::30 \ + i.gtld-servers.net.,IN,AAAA,172800,2001:503:39c1::30 \ + h.gtld-servers.net.,IN,AAAA,172800,2001:502:8cc::30 \ + g.gtld-servers.net.,IN,AAAA,172800,2001:503:eea3::30 \ + f.gtld-servers.net.,IN,AAAA,172800,2001:503:d414::30 \ + e.gtld-servers.net.,IN,AAAA,172800,2001:502:1ca1::30 \ + d.gtld-servers.net.,IN,AAAA,172800,2001:500:856e::30 \ + c.gtld-servers.net.,IN,AAAA,172800,2001:503:83eb::30 \ + b.gtld-servers.net.,IN,AAAA,172800,2001:503:231d::2:30 \ + a.gtld-servers.net.,IN,AAAA,172800,2001:503:a83e::2:30 \ + .,1232,1232,0,edns0[len=39,UDP=1232,ver=0,rcode=0,DO=0,z=0],edns0opt[code=10,codelen=24],edns0opt[ECS,family=1,source=24,scope=0,addr=34.29.83.0] +[86] 2023-07-05 07:21:46.511502 [#12 edns.pcap-dist 4095] \ + [172.17.0.6].35191 [1.1.1.1].53 \ + dns QUERY,NOERROR,960,rd|ad \ + 1 dnssec-failed.org.,IN,A 0 0 \ + 1 .,4096,4096,0,edns0[len=12,UDP=4096,ver=0,rcode=0,DO=0,z=0],edns0opt[code=10,codelen=8] +[131] 2023-07-05 07:21:46.518500 [#13 edns.pcap-dist 4095] \ + [1.1.1.1].53 [172.17.0.6].35191 \ + dns QUERY,SERVFAIL,960,qr|rd|ra \ + 1 dnssec-failed.org.,IN,A 0 0 \ + 1 .,1232,1232,0,edns0[len=57,UDP=1232,ver=0,rcode=0,DO=0,z=0],edns0opt[code=15,codelen=53] diff --git a/plugins/anonaes128/test1.sh b/plugins/anonaes128/test1.sh index 296bcd5..3338e42 100755 --- a/plugins/anonaes128/test1.sh +++ b/plugins/anonaes128/test1.sh @@ -16,6 +16,11 @@ ln -fs "$srcdir/../../src/test/dns.pcap" dns.pcap-dist ../../src/dnscap -r dns.pcap-dist -g -P "$plugin" -4 -k "some 16-byte key" -i "some 16-byte key" -s 2>>test1.out ! ../../src/dnscap -r dns.pcap-dist -g -P "$plugin" -4 -k "some 16-byte key" -i "some 16-byte key" -c -s 2>>test1.out +ln -fs "$srcdir/../../src/test/edns.pcap" edns.pcap-dist + +../../src/dnscap -r edns.pcap-dist -g -P "$plugin" -4 -k "some 16-byte key" -i "some 16-byte key" -e 2>>test1.out +../../src/dnscap -r edns.pcap-dist -g -P "$plugin" -4 -k "some 16-byte key" -i "some 16-byte key" -E 2>>test1.out + osrel=`uname -s` if [ "$osrel" = "OpenBSD" ]; then mv test1.out test1.out.old diff --git a/plugins/anonaes128/test2.sh b/plugins/anonaes128/test2.sh index ff21327..ab10f4a 100755 --- a/plugins/anonaes128/test2.sh +++ b/plugins/anonaes128/test2.sh @@ -19,12 +19,4 @@ if [ "$osrel" = "OpenBSD" ]; then rm test2.out.old fi -# TODO: Remove when #133 is fixed -cat test2.out | \ - sed 's%,CLASS4096,OPT,%,4096,4096,%' | \ - sed 's%,CLASS512,OPT,%,512,512,%' | \ - sed 's%,41,41,0,edns0\[len=0,UDP=4096,%,4096,4096,0,edns0[len=0,UDP=4096,%' | \ - sed 's%,41,41,0,edns0\[len=0,UDP=512,%,512,512,0,edns0[len=0,UDP=512,%' >test2.new -mv test2.new test2.out - diff test2.out "$srcdir/test2.gold" diff --git a/plugins/anonaes128/test3.sh b/plugins/anonaes128/test3.sh index 09fb116..4edab93 100755 --- a/plugins/anonaes128/test3.sh +++ b/plugins/anonaes128/test3.sh @@ -18,12 +18,4 @@ if [ "$osrel" = "OpenBSD" ]; then rm test3.out.old fi -# TODO: Remove when #133 is fixed -cat test3.out | \ - sed 's%,CLASS4096,OPT,%,4096,4096,%' | \ - sed 's%,CLASS512,OPT,%,512,512,%' | \ - sed 's%,41,41,0,edns0\[len=0,UDP=4096,%,4096,4096,0,edns0[len=0,UDP=4096,%' | \ - sed 's%,41,41,0,edns0\[len=0,UDP=512,%,512,512,0,edns0[len=0,UDP=512,%' >test3.new -mv test3.new test3.out - diff test3.out "$srcdir/test3.gold" |