summaryrefslogtreecommitdiffstats
path: root/plugins/anonmask
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/anonmask')
-rw-r--r--plugins/anonmask/Makefile.am3
-rw-r--r--plugins/anonmask/Makefile.in16
-rw-r--r--plugins/anonmask/anonmask.c53
-rw-r--r--plugins/anonmask/test1.gold246
-rwxr-xr-xplugins/anonmask/test1.sh5
-rwxr-xr-xplugins/anonmask/test2.sh8
6 files changed, 310 insertions, 21 deletions
diff --git a/plugins/anonmask/Makefile.am b/plugins/anonmask/Makefile.am
index 48f5a10..1ddf13d 100644
--- a/plugins/anonmask/Makefile.am
+++ b/plugins/anonmask/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 = anonmask.la
diff --git a/plugins/anonmask/Makefile.in b/plugins/anonmask/Makefile.in
index 0541793..788611f 100644
--- a/plugins/anonmask/Makefile.in
+++ b/plugins/anonmask/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,10 +518,11 @@ 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
+CLEANFILES = *.gcda *.gcno *.gcov *.pcap-dist test1.out test2.out
AM_CFLAGS = -I$(srcdir) \
-I$(top_srcdir)/src \
-I$(top_srcdir)/isc \
+ -I$(top_srcdir)/plugins/shared \
$(SECCOMPFLAGS)
pkglib_LTLIBRARIES = anonmask.la
@@ -803,7 +806,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"; \
@@ -872,7 +875,6 @@ test3.sh.log: test3.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/anonmask/anonmask.c b/plugins/anonmask/anonmask.c
index 444f5df..8e17a79 100644
--- a/plugins/anonmask/anonmask.c
+++ b/plugins/anonmask/anonmask.c
@@ -43,10 +43,12 @@
#include "dnscap_common.h"
+#include "edns0_ecs.c"
+
static set_iaddr_t anonmask_set_iaddr = 0;
static logerr_t* logerr;
-static int only_clients = 0, only_servers = 0, mask_port = 53, mask_v4 = 24, mask_v6 = 48;
+static int only_clients = 0, only_servers = 0, mask_port = 53, mask_v4 = 24, mask_v6 = 48, edns = 0;
static struct in_addr in4 = { INADDR_ANY };
static struct in6_addr in6 = IN6ADDR_ANY_INIT;
static uint32_t* in6p = (uint32_t*)&in6;
@@ -71,7 +73,9 @@ void anonmask_usage()
"\t-s Only mask servers (port == 53)\n"
"\t-p <port> Set port for -c/-s masking, default 53\n"
"\t-4 <netmask> The /mask for IPv4 addresses, default /24\n"
- "\t-6 <netmask> The /mask for IPv6 addresses, default /48\n");
+ "\t-6 <netmask> The /mask for IPv6 addresses, default /48\n"
+ "\t-e Also mask EDNS(0) Client Subnet\n"
+ "\t-E ONLY mask EDNS(0) Client Subnet, not IP addresses\n");
}
void anonmask_extension(int ext, void* arg)
@@ -89,7 +93,7 @@ void anonmask_getopt(int* argc, char** argv[])
unsigned long ul;
char* p;
- while ((c = getopt(*argc, *argv, "?csp:4:6:")) != EOF) {
+ while ((c = getopt(*argc, *argv, "?csp:4:6:eE")) != EOF) {
switch (c) {
case 'c':
only_clients = 1;
@@ -115,6 +119,13 @@ void anonmask_getopt(int* argc, char** argv[])
usage("IPv6 mask must be an integer 0..127");
mask_v6 = (unsigned)ul;
break;
+ case 'e':
+ if (!edns)
+ edns = 1;
+ break;
+ case 'E':
+ edns = -1;
+ break;
case '?':
anonmask_usage();
if (!optopt || optopt == '?') {
@@ -173,11 +184,43 @@ int anonmask_close(my_bpftimeval ts)
return 0;
}
+void ecs_callback(int family, u_char* buf, size_t len)
+{
+ u_char* mask;
+
+ switch (family) {
+ case 1: // IPv4
+ if (len > sizeof(struct in_addr))
+ break;
+ mask = (u_char*)&in4;
+ while (len--) {
+ *buf++ &= *mask++;
+ }
+ break;
+ case 2: // IPv6
+ if (len > sizeof(struct in6_addr))
+ break;
+ mask = (u_char*)&in6;
+ while (len--) {
+ *buf++ &= *mask++;
+ }
+ break;
+ default:
+ break;
+ }
+}
+
int anonmask_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, unsigned olen,
+ u_char* payload, 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;
+ }
+
uint32_t* p6;
for (;;) {
diff --git a/plugins/anonmask/test1.gold b/plugins/anonmask/test1.gold
index d6dde5a..bdf740a 100644
--- a/plugins/anonmask/test1.gold
+++ b/plugins/anonmask/test1.gold
@@ -2855,3 +2855,249 @@
ns3.google.com.,IN,A,157794,216.239.36.10 \
ns4.google.com.,IN,A,157794,216.239.38.10
anonmask.so usage error: -c and -s options are mutually exclusive
+[64] 2023-07-05 07:21:38.669836 [#0 edns.pcap-dist 4095] \
+ [172.0.0.0].58541 [172.0.0.0].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.0.0.0].58541 [172.0.0.0].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.0.0.0].53 [172.0.0.0].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.0.0.0].53 [172.0.0.0].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.0.0.0].33737 [198.0.0.0].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.0.0.0].53 [172.0.0.0].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.0.0.0].53174 [172.0.0.0].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.0.0.0].53174 [172.0.0.0].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.0.0.0].53 [172.0.0.0].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.0.0.0].53 [172.0.0.0].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.0.0.0].50901 [192.0.0.0].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.0.0.0],edns0opt[code=10,codelen=8]
+[895] 2023-07-05 07:21:42.836816 [#11 edns.pcap-dist 4095] \
+ [192.0.0.0].53 [172.0.0.0].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.0.0.0]
+[86] 2023-07-05 07:21:46.511502 [#12 edns.pcap-dist 4095] \
+ [172.0.0.0].35191 [1.0.0.0].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.0.0.0].53 [172.0.0.0].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.0.0.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.0.0.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/anonmask/test1.sh b/plugins/anonmask/test1.sh
index a15a9bb..341a9cc 100755
--- a/plugins/anonmask/test1.sh
+++ b/plugins/anonmask/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" -s 2>>test1.out
! ../../src/dnscap -r dns.pcap-dist -g -P "$plugin" -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 8 -e 2>>test1.out
+../../src/dnscap -r edns.pcap-dist -g -P "$plugin" -4 8 -E 2>>test1.out
+
osrel=`uname -s`
if [ "$osrel" = "OpenBSD" ]; then
mv test1.out test1.out.old
diff --git a/plugins/anonmask/test2.sh b/plugins/anonmask/test2.sh
index 7a155c5..dbfba51 100755
--- a/plugins/anonmask/test2.sh
+++ b/plugins/anonmask/test2.sh
@@ -23,12 +23,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"