diff options
Diffstat (limited to '')
-rw-r--r-- | plugins/cryptopant/Makefile.am | 3 | ||||
-rw-r--r-- | plugins/cryptopant/Makefile.in | 18 | ||||
-rw-r--r-- | plugins/cryptopant/cryptopant.c | 57 | ||||
-rw-r--r-- | plugins/cryptopant/test1.gold | 246 | ||||
-rwxr-xr-x | plugins/cryptopant/test1.sh | 5 | ||||
-rwxr-xr-x | plugins/cryptopant/test2.sh | 8 | ||||
-rwxr-xr-x | plugins/cryptopant/test3.sh | 8 |
7 files changed, 315 insertions, 30 deletions
diff --git a/plugins/cryptopant/Makefile.am b/plugins/cryptopant/Makefile.am index 3aaa44a..765a522 100644 --- a/plugins/cryptopant/Makefile.am +++ b/plugins/cryptopant/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 = cryptopant.la diff --git a/plugins/cryptopant/Makefile.in b/plugins/cryptopant/Makefile.in index 8f716bf..7389fe2 100644 --- a/plugins/cryptopant/Makefile.in +++ b/plugins/cryptopant/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,12 +518,13 @@ 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.20161020.152301.075993 \ +CLEANFILES = *.gcda *.gcno *.gcov *.pcap-dist test1.out test2.out \ + test3.out test3.pcap.20161020.152301.075993 \ test3.pcap.20181127.155200.414188 AM_CFLAGS = -I$(srcdir) \ -I$(top_srcdir)/src \ -I$(top_srcdir)/isc \ + -I$(top_srcdir)/plugins/shared \ $(SECCOMPFLAGS) $(libcrypto_CFLAGS) pkglib_LTLIBRARIES = cryptopant.la @@ -805,7 +808,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"; \ @@ -881,7 +884,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/cryptopant/cryptopant.c b/plugins/cryptopant/cryptopant.c index 7fca715..e6d8f04 100644 --- a/plugins/cryptopant/cryptopant.c +++ b/plugins/cryptopant/cryptopant.c @@ -39,18 +39,20 @@ #include <unistd.h> #include <string.h> #include <sys/socket.h> +#include <netinet/in.h> #include "dnscap_common.h" #if defined(HAVE_LIBCRYPTOPANT) && defined(HAVE_CRYPTOPANT_H) #include <cryptopANT.h> #define USE_CRYPTOPANT 1 +#include "edns0_ecs.c" #endif static set_iaddr_t cryptopant_set_iaddr = 0; static logerr_t* logerr; -static int only_clients = 0, only_servers = 0, dns_port = 53, pass4 = 0, pass6 = 0, decrypt = 0; +static int only_clients = 0, only_servers = 0, dns_port = 53, pass4 = 0, pass6 = 0, decrypt = 0, edns = 0; enum plugin_type cryptopant_type() { @@ -74,7 +76,9 @@ void cryptopant_usage() "\t-D Decrypt IP addresses\n" "\t-c Only encrypt clients (port != 53)\n" "\t-s Only encrypt servers (port == 53)\n" - "\t-p <port> Set port for -c/-s, default 53\n"); + "\t-p <port> Set port for -c/-s, default 53\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 cryptopant_extension(int ext, void* arg) @@ -92,7 +96,7 @@ void cryptopant_getopt(int* argc, char** argv[]) unsigned long ul; char * p, *keyfile = 0; - while ((c = getopt(*argc, *argv, "?k:4:6:Dcsp:")) != EOF) { + while ((c = getopt(*argc, *argv, "?k:4:6:Dcsp:eE")) != EOF) { switch (c) { case 'k': if (keyfile) { @@ -127,6 +131,13 @@ void cryptopant_getopt(int* argc, char** argv[]) usage("port must be an integer 1..65535"); dns_port = (unsigned)ul; break; + case 'e': + if (!edns) + edns = 1; + break; + case 'E': + edns = -1; + break; case '?': cryptopant_usage(); if (!optopt || optopt == '?') { @@ -179,12 +190,48 @@ int cryptopant_close(my_bpftimeval ts) return 0; } +#ifdef USE_CRYPTOPANT +void ecs_callback(int family, u_char* buf, size_t len) +{ + switch (family) { + case 1: // IPv4 + { + if (len > sizeof(struct in_addr)) + break; + struct in_addr in = { INADDR_ANY }; + memcpy(&in, buf, len); + in.s_addr = decrypt ? unscramble_ip4(in.s_addr, pass4) : scramble_ip4(in.s_addr, pass4); + memcpy(buf, &in, len); + break; + } + case 2: // IPv6 + { + if (len > sizeof(struct in6_addr)) + break; + struct in6_addr in = IN6ADDR_ANY_INIT; + memcpy(&in, buf, len); + decrypt ? unscramble_ip6(&in, pass6) : scramble_ip6(&in, pass6); + memcpy(buf, &in, len); + break; + } + default: + break; + } +} +#endif + int cryptopant_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_CRYPTOPANT + 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; + } + for (;;) { if (only_clients && sport == dns_port) { if (sport != dport) { diff --git a/plugins/cryptopant/test1.gold b/plugins/cryptopant/test1.gold index 2201d4f..5b93845 100644 --- a/plugins/cryptopant/test1.gold +++ b/plugins/cryptopant/test1.gold @@ -2856,3 +2856,249 @@ cryptopant.so usage error: must have a -k keyfile ns3.google.com.,IN,A,157794,216.239.36.10 \ ns4.google.com.,IN,A,157794,216.239.38.10 cryptopant.so usage error: -c and -s options are mutually exclusive +[64] 2023-07-05 07:21:38.669836 [#0 edns.pcap-dist 4095] \ + [172.24.244.221].58541 [172.24.244.218].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.24.244.221].58541 [172.24.244.218].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.24.244.218].53 [172.24.244.221].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.24.244.218].53 [172.24.244.221].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.24.244.221].33737 [198.221.87.229].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.221.87.229].53 [172.24.244.221].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.24.244.221].53174 [172.24.244.218].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.24.244.221].53174 [172.24.244.218].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.24.244.218].53 [172.24.244.221].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.24.244.218].53 [172.24.244.221].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.24.244.221].50901 [192.37.47.233].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=172.24.244.0],edns0opt[code=10,codelen=8] +[895] 2023-07-05 07:21:42.836816 [#11 edns.pcap-dist 4095] \ + [192.37.47.233].53 [172.24.244.221].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=172.24.244.0] +[86] 2023-07-05 07:21:46.511502 [#12 edns.pcap-dist 4095] \ + [172.24.244.221].35191 [1.183.102.77].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.183.102.77].53 [172.24.244.221].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=172.24.244.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=172.24.244.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/cryptopant/test1.sh b/plugins/cryptopant/test1.sh index cb632cf..9e4182a 100755 --- a/plugins/cryptopant/test1.sh +++ b/plugins/cryptopant/test1.sh @@ -21,6 +21,11 @@ fi ../../src/dnscap -r dns.pcap-dist -g -P "$plugin" -k "$srcdir/keyfile" -s 2>>test1.out ! ../../src/dnscap -r dns.pcap-dist -g -P "$plugin" -k "$srcdir/keyfile" -c -s 2>>test1.out +ln -fs "$srcdir/../../src/test/edns.pcap" edns.pcap-dist + +../../src/dnscap -r edns.pcap-dist -g -P "$plugin" -k "$srcdir/keyfile" -4 8 -e 2>>test1.out +../../src/dnscap -r edns.pcap-dist -g -P "$plugin" -k "$srcdir/keyfile" -4 8 -E 2>>test1.out + osrel=`uname -s` if [ "$osrel" = "OpenBSD" ]; then mv test1.out test1.out.old diff --git a/plugins/cryptopant/test2.sh b/plugins/cryptopant/test2.sh index 9d50269..7e6b1cf 100755 --- a/plugins/cryptopant/test2.sh +++ b/plugins/cryptopant/test2.sh @@ -26,12 +26,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/cryptopant/test3.sh b/plugins/cryptopant/test3.sh index 1ebb524..a30a7f0 100755 --- a/plugins/cryptopant/test3.sh +++ b/plugins/cryptopant/test3.sh @@ -27,12 +27,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" |