summaryrefslogtreecommitdiffstats
path: root/plugins/cryptopan
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/cryptopan')
-rw-r--r--plugins/cryptopan/Makefile.am3
-rw-r--r--plugins/cryptopan/Makefile.in18
-rw-r--r--plugins/cryptopan/cryptopan.c100
-rw-r--r--plugins/cryptopan/test1.gold246
-rwxr-xr-xplugins/cryptopan/test1.sh5
-rwxr-xr-xplugins/cryptopan/test2.sh8
-rwxr-xr-xplugins/cryptopan/test3.sh8
7 files changed, 342 insertions, 46 deletions
diff --git a/plugins/cryptopan/Makefile.am b/plugins/cryptopan/Makefile.am
index 0215742..6504a61 100644
--- a/plugins/cryptopan/Makefile.am
+++ b/plugins/cryptopan/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 = cryptopan.la
diff --git a/plugins/cryptopan/Makefile.in b/plugins/cryptopan/Makefile.in
index f108e81..0ff66b2 100644
--- a/plugins/cryptopan/Makefile.in
+++ b/plugins/cryptopan/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) $(libcrypto_CFLAGS)
pkglib_LTLIBRARIES = cryptopan.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/cryptopan/cryptopan.c b/plugins/cryptopan/cryptopan.c
index 5eb54c7..6274c3d 100644
--- a/plugins/cryptopan/cryptopan.c
+++ b/plugins/cryptopan/cryptopan.c
@@ -47,6 +47,10 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
+#include <netinet/in.h>
+#ifndef s6_addr32
+#define s6_addr32 __u6_addr.__u6_addr32
+#endif
#include "dnscap_common.h"
@@ -55,12 +59,13 @@
#include <openssl/evp.h>
#include <openssl/err.h>
#define USE_OPENSSL 1
+#include "edns0_ecs.c"
#endif
static set_iaddr_t cryptopan_set_iaddr = 0;
static logerr_t* logerr;
-static int only_clients = 0, only_servers = 0, dns_port = 53, encrypt_v6 = 0, decrypt = 0;
+static int only_clients = 0, only_servers = 0, dns_port = 53, encrypt_v6 = 0, decrypt = 0, edns = 0;
static unsigned char key[16];
static unsigned char iv[16];
static unsigned char pad[16];
@@ -94,7 +99,9 @@ void cryptopan_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-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 cryptopan_extension(int ext, void* arg)
@@ -112,7 +119,7 @@ void cryptopan_getopt(int* argc, char** argv[])
unsigned long ul;
char* p;
- while ((c = getopt(*argc, *argv, "?k:K:i:I:a:A:Dcsp:6")) != EOF) {
+ while ((c = getopt(*argc, *argv, "?k:K:i:I:a:A:Dcsp:6eE")) != EOF) {
switch (c) {
case 'k':
if (strlen(optarg) != 16) {
@@ -207,6 +214,13 @@ void cryptopan_getopt(int* argc, char** argv[])
case '6':
encrypt_v6 = 1;
break;
+ case 'e':
+ if (!edns)
+ edns = 1;
+ break;
+ case 'E':
+ edns = -1;
+ break;
case '?':
cryptopan_usage();
if (!optopt || optopt == '?') {
@@ -396,12 +410,56 @@ static inline void _decrypt(uint32_t* in)
}
#endif
+#ifdef USE_OPENSSL
+void ecs_callback(int family, u_char* buf, size_t len)
+{
+ struct in6_addr in6 = IN6ADDR_ANY_INIT;
+
+ switch (family) {
+ case 1: // IPv4
+ if (len > sizeof(struct in_addr))
+ break;
+ memcpy(&in6, buf, len);
+ decrypt ? _decrypt((uint32_t*)&in6) : _encrypt((uint32_t*)&in6);
+ memcpy(buf, &in6, len);
+ break;
+ case 2: // IPv6
+ if (len > sizeof(struct in6_addr))
+ break;
+ if (encrypt_v6) {
+ memcpy(&in6, buf, len);
+ if (decrypt) {
+ _decrypt(&in6.s6_addr32[0]);
+ _decrypt(&in6.s6_addr32[1]);
+ _decrypt(&in6.s6_addr32[2]);
+ _decrypt(&in6.s6_addr32[3]);
+ } else {
+ _encrypt(&in6.s6_addr32[0]);
+ _encrypt(&in6.s6_addr32[1]);
+ _encrypt(&in6.s6_addr32[2]);
+ _encrypt(&in6.s6_addr32[3]);
+ }
+ memcpy(buf, &in6, len);
+ }
+ break;
+ default:
+ break;
+ }
+}
+#endif
+
int cryptopan_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;
+ }
+
for (;;) {
if (only_clients && sport == dns_port) {
if (sport != dport) {
@@ -421,15 +479,15 @@ int cryptopan_filter(const char* descr, iaddr* from, iaddr* to, uint8_t proto, u
case AF_INET6:
if (encrypt_v6) {
if (decrypt) {
- _decrypt((uint32_t*)&from->u.a6);
- _decrypt(((uint32_t*)&from->u.a6) + 1); // lgtm [cpp/suspicious-pointer-scaling]
- _decrypt(((uint32_t*)&from->u.a6) + 2); // lgtm [cpp/suspicious-pointer-scaling]
- _decrypt(((uint32_t*)&from->u.a6) + 3); // lgtm [cpp/suspicious-pointer-scaling]
+ _decrypt(&from->u.a6.s6_addr32[0]);
+ _decrypt(&from->u.a6.s6_addr32[1]);
+ _decrypt(&from->u.a6.s6_addr32[2]);
+ _decrypt(&from->u.a6.s6_addr32[3]);
} else {
- _encrypt((uint32_t*)&from->u.a6);
- _encrypt(((uint32_t*)&from->u.a6) + 1); // lgtm [cpp/suspicious-pointer-scaling]
- _encrypt(((uint32_t*)&from->u.a6) + 2); // lgtm [cpp/suspicious-pointer-scaling]
- _encrypt(((uint32_t*)&from->u.a6) + 3); // lgtm [cpp/suspicious-pointer-scaling]
+ _encrypt(&from->u.a6.s6_addr32[0]);
+ _encrypt(&from->u.a6.s6_addr32[1]);
+ _encrypt(&from->u.a6.s6_addr32[2]);
+ _encrypt(&from->u.a6.s6_addr32[3]);
}
break;
}
@@ -459,15 +517,15 @@ int cryptopan_filter(const char* descr, iaddr* from, iaddr* to, uint8_t proto, u
case AF_INET6:
if (encrypt_v6) {
if (decrypt) {
- _decrypt((uint32_t*)&to->u.a6);
- _decrypt(((uint32_t*)&to->u.a6) + 1); // lgtm [cpp/suspicious-pointer-scaling]
- _decrypt(((uint32_t*)&to->u.a6) + 2); // lgtm [cpp/suspicious-pointer-scaling]
- _decrypt(((uint32_t*)&to->u.a6) + 3); // lgtm [cpp/suspicious-pointer-scaling]
+ _decrypt(&to->u.a6.s6_addr32[0]);
+ _decrypt(&to->u.a6.s6_addr32[1]);
+ _decrypt(&to->u.a6.s6_addr32[2]);
+ _decrypt(&to->u.a6.s6_addr32[3]);
} else {
- _encrypt((uint32_t*)&to->u.a6);
- _encrypt(((uint32_t*)&to->u.a6) + 1); // lgtm [cpp/suspicious-pointer-scaling]
- _encrypt(((uint32_t*)&to->u.a6) + 2); // lgtm [cpp/suspicious-pointer-scaling]
- _encrypt(((uint32_t*)&to->u.a6) + 3); // lgtm [cpp/suspicious-pointer-scaling]
+ _encrypt(&to->u.a6.s6_addr32[0]);
+ _encrypt(&to->u.a6.s6_addr32[1]);
+ _encrypt(&to->u.a6.s6_addr32[2]);
+ _encrypt(&to->u.a6.s6_addr32[3]);
}
break;
}
diff --git a/plugins/cryptopan/test1.gold b/plugins/cryptopan/test1.gold
index 71bbba1..4f1b903 100644
--- a/plugins/cryptopan/test1.gold
+++ b/plugins/cryptopan/test1.gold
@@ -2145,3 +2145,249 @@ cryptopan.so usage error: must have key (-k/-K), IV (-i/-I) and padding (-a/-A)
ns3.google.com.,IN,A,157794,216.239.36.10 \
ns4.google.com.,IN,A,157794,216.239.38.10
cryptopan.so usage error: -c and -s options are mutually exclusive
+[64] 2023-07-05 07:21:38.669836 [#0 edns.pcap-dist 4095] \
+ [137.205.188.240].58541 [137.205.188.246].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] \
+ [137.205.188.240].58541 [137.205.188.246].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] \
+ [137.205.188.246].53 [137.205.188.240].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] \
+ [137.205.188.246].53 [137.205.188.240].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] \
+ [137.205.188.240].33737 [242.191.199.152].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] \
+ [242.191.199.152].53 [137.205.188.240].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] \
+ [137.205.188.240].53174 [137.205.188.246].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] \
+ [137.205.188.240].53174 [137.205.188.246].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] \
+ [137.205.188.246].53 [137.205.188.240].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] \
+ [137.205.188.246].53 [137.205.188.240].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] \
+ [137.205.188.240].50901 [245.202.0.100].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=137.205.188.0],edns0opt[code=10,codelen=8]
+[895] 2023-07-05 07:21:42.836816 [#11 edns.pcap-dist 4095] \
+ [245.202.0.100].53 [137.205.188.240].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=137.205.188.0]
+[86] 2023-07-05 07:21:46.511502 [#12 edns.pcap-dist 4095] \
+ [137.205.188.240].35191 [39.174.37.237].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] \
+ [39.174.37.237].53 [137.205.188.240].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=137.205.188.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=137.205.188.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/cryptopan/test1.sh b/plugins/cryptopan/test1.sh
index b499f12..943ab2f 100755
--- a/plugins/cryptopan/test1.sh
+++ b/plugins/cryptopan/test1.sh
@@ -17,6 +17,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" -i "some 16-byte key" -a "some 16-byte key" -s 2>>test1.out
! ../../src/dnscap -r dns.pcap-dist -g -P "$plugin" -k "some 16-byte key" -i "some 16-byte key" -a "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" -i "some 16-byte key" -a "some 16-byte key" -e 2>>test1.out
+../../src/dnscap -r edns.pcap-dist -g -P "$plugin" -k "some 16-byte key" -i "some 16-byte key" -a "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/cryptopan/test2.sh b/plugins/cryptopan/test2.sh
index 3f41fc4..3e92b53 100755
--- a/plugins/cryptopan/test2.sh
+++ b/plugins/cryptopan/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/cryptopan/test3.sh b/plugins/cryptopan/test3.sh
index 48dc90f..61110f7 100755
--- a/plugins/cryptopan/test3.sh
+++ b/plugins/cryptopan/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"