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/ipcrypt | |
parent | Adding upstream version 2.1.3. (diff) | |
download | dnscap-upstream/2.2.0.tar.xz dnscap-upstream/2.2.0.zip |
Adding upstream version 2.2.0.upstream/2.2.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | plugins/ipcrypt/Makefile.am | 3 | ||||
-rw-r--r-- | plugins/ipcrypt/Makefile.in | 18 | ||||
-rw-r--r-- | plugins/ipcrypt/ipcrypt.c | 66 | ||||
-rw-r--r-- | plugins/ipcrypt/test1.gold | 246 | ||||
-rwxr-xr-x | plugins/ipcrypt/test1.sh | 5 | ||||
-rwxr-xr-x | plugins/ipcrypt/test2.sh | 8 | ||||
-rwxr-xr-x | plugins/ipcrypt/test3.sh | 8 |
7 files changed, 324 insertions, 30 deletions
diff --git a/plugins/ipcrypt/Makefile.am b/plugins/ipcrypt/Makefile.am index 64effb7..13327eb 100644 --- a/plugins/ipcrypt/Makefile.am +++ b/plugins/ipcrypt/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) pkglib_LTLIBRARIES = ipcrypt.la diff --git a/plugins/ipcrypt/Makefile.in b/plugins/ipcrypt/Makefile.in index 955a9c9..72140ac 100644 --- a/plugins/ipcrypt/Makefile.in +++ b/plugins/ipcrypt/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 test4.tmp AM_CFLAGS = -I$(srcdir) \ -I$(top_srcdir)/src \ -I$(top_srcdir)/isc \ + -I$(top_srcdir)/plugins/shared \ $(SECCOMPFLAGS) pkglib_LTLIBRARIES = ipcrypt.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/ipcrypt/ipcrypt.c b/plugins/ipcrypt/ipcrypt.c index f8908a6..e9a1f58 100644 --- a/plugins/ipcrypt/ipcrypt.c +++ b/plugins/ipcrypt/ipcrypt.c @@ -42,13 +42,16 @@ #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> +#include <netinet/in.h> #include "dnscap_common.h" +#include "edns0_ecs.c" + static set_iaddr_t ipcrypt_set_iaddr = 0; static logerr_t* logerr; -static int only_clients = 0, only_servers = 0, dns_port = 53, iterations = 1, encrypt_v6 = 0, decrypt = 0; +static int only_clients = 0, only_servers = 0, dns_port = 53, iterations = 1, encrypt_v6 = 0, decrypt = 0, edns = 0; static uint8_t key[16]; /* @@ -157,7 +160,9 @@ void ipcrypt_usage() "\t-s Only en/de-crypt servers (port == 53)\n" "\t-p <port> Set port for -c/-s, default 53\n" "\t-i <num> Number of en/de-cryption iterations, default 1\n" - "\t-6 En/de-crypt IPv6 addresses, not default or recommended\n"); + "\t-6 En/de-crypt IPv6 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 ipcrypt_extension(int ext, void* arg) @@ -175,7 +180,7 @@ void ipcrypt_getopt(int* argc, char** argv[]) unsigned long ul; char* p; - while ((c = getopt(*argc, *argv, "?k:f:Dcsp:i:6")) != EOF) { + while ((c = getopt(*argc, *argv, "?k:f:Dcsp:i:6eE")) != EOF) { switch (c) { case 'k': if (strlen(optarg) != 16) { @@ -226,6 +231,13 @@ void ipcrypt_getopt(int* argc, char** argv[]) case '6': encrypt_v6 = 1; break; + case 'e': + if (!edns) + edns = 1; + break; + case 'E': + edns = -1; + break; case '?': ipcrypt_usage(); if (!optopt || optopt == '?') { @@ -266,11 +278,55 @@ int ipcrypt_close(my_bpftimeval ts) return 0; } +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); + decrypt ? _decrypt((uint8_t*)&in) : _encrypt((uint8_t*)&in); + memcpy(buf, &in, len); + break; + } + case 2: // IPv6 + if (len > sizeof(struct in6_addr)) + break; + if (encrypt_v6) { + struct in6_addr in = IN6ADDR_ANY_INIT; + memcpy(&in, buf, len); + if (decrypt) { + _decrypt((uint8_t*)&in); + _decrypt(((uint8_t*)&in) + 4); + _decrypt(((uint8_t*)&in) + 8); + _decrypt(((uint8_t*)&in) + 12); + } else { + _encrypt((uint8_t*)&in); + _encrypt(((uint8_t*)&in) + 4); + _encrypt(((uint8_t*)&in) + 8); + _encrypt(((uint8_t*)&in) + 12); + } + memcpy(buf, &in, len); + } + break; + default: + break; + } +} + int ipcrypt_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) { + 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/ipcrypt/test1.gold b/plugins/ipcrypt/test1.gold index 040d875..99dc62e 100644 --- a/plugins/ipcrypt/test1.gold +++ b/plugins/ipcrypt/test1.gold @@ -2142,3 +2142,249 @@ ipcrypt.so usage error: must have -k <key> or -f <file> ns3.google.com.,IN,A,157794,216.239.36.10 \ ns4.google.com.,IN,A,157794,216.239.38.10 ipcrypt.so usage error: -c and -s options are mutually exclusive +[64] 2023-07-05 07:21:38.669836 [#0 edns.pcap-dist 4095] \ + [122.143.39.9].58541 [132.72.37.15].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] \ + [122.143.39.9].58541 [132.72.37.15].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] \ + [132.72.37.15].53 [122.143.39.9].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] \ + [132.72.37.15].53 [122.143.39.9].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] \ + [122.143.39.9].33737 [225.150.52.100].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] \ + [225.150.52.100].53 [122.143.39.9].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] \ + [122.143.39.9].53174 [132.72.37.15].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] \ + [122.143.39.9].53174 [132.72.37.15].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] \ + [132.72.37.15].53 [122.143.39.9].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] \ + [132.72.37.15].53 [122.143.39.9].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] \ + [122.143.39.9].50901 [255.236.91.80].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=250.154.229.0],edns0opt[code=10,codelen=8] +[895] 2023-07-05 07:21:42.836816 [#11 edns.pcap-dist 4095] \ + [255.236.91.80].53 [122.143.39.9].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=250.154.229.0] +[86] 2023-07-05 07:21:46.511502 [#12 edns.pcap-dist 4095] \ + [122.143.39.9].35191 [214.180.194.165].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] \ + [214.180.194.165].53 [122.143.39.9].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=250.154.229.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=250.154.229.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/ipcrypt/test1.sh b/plugins/ipcrypt/test1.sh index 3be7107..4156d95 100755 --- a/plugins/ipcrypt/test1.sh +++ b/plugins/ipcrypt/test1.sh @@ -14,6 +14,11 @@ ln -fs "$srcdir/../../src/test/dns.pcap" dns.pcap-dist ../../src/dnscap -r dns.pcap-dist -g -P "$plugin" -k "some 16-byte key" -s 2>>test1.out ! ../../src/dnscap -r dns.pcap-dist -g -P "$plugin" -k "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" -k "some 16-byte key" -e 2>>test1.out +../../src/dnscap -r edns.pcap-dist -g -P "$plugin" -k "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/ipcrypt/test2.sh b/plugins/ipcrypt/test2.sh index 7b99122..2c97bba 100755 --- a/plugins/ipcrypt/test2.sh +++ b/plugins/ipcrypt/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/ipcrypt/test3.sh b/plugins/ipcrypt/test3.sh index 860f272..1eb21f3 100755 --- a/plugins/ipcrypt/test3.sh +++ b/plugins/ipcrypt/test3.sh @@ -21,12 +21,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" |