From f36a44d72d0cca8b24ee72032fda0a2d123fac6c Mon Sep 17 00:00:00 2001 From: infosec-it-init Date: Thu, 17 Mar 2022 10:33:30 +0100 Subject: [PATCH 1/2] fix: reset dedicated resolvers for next query --- src/main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main.c b/src/main.c index 42cd180..9de664c 100644 --- a/src/main.c +++ b/src/main.c @@ -1089,6 +1089,7 @@ void can_send() while (hashmapSize(context.map) < min(context.cmd_args.hashmap_size, concurrency_state.current_concurrency) && context.state <= STATE_QUERYING) { + dedicated_resolvers = NULL; if(!next_query(&qname, &dedicated_resolvers, &rtype)) { if(hashmapSize(context.map) <= 0) From a4b702ee8f88dc1187bc34b98a235adf4342a768 Mon Sep 17 00:00:00 2001 From: infosec-it-init Date: Thu, 17 Mar 2022 13:50:54 +0100 Subject: [PATCH 2/2] add dedicated resolvers test case --- tests/multi-lookup-A-ipv4-dedicated-resolver/expected | 3 +++ tests/multi-lookup-A-ipv4-dedicated-resolver/google-dns.txt | 1 + tests/multi-lookup-A-ipv4-dedicated-resolver/names.txt | 3 +++ tests/multi-lookup-A-ipv4-dedicated-resolver/run.sh | 5 +++++ 4 files changed, 12 insertions(+) create mode 100644 tests/multi-lookup-A-ipv4-dedicated-resolver/expected create mode 100644 tests/multi-lookup-A-ipv4-dedicated-resolver/google-dns.txt create mode 100644 tests/multi-lookup-A-ipv4-dedicated-resolver/names.txt create mode 100755 tests/multi-lookup-A-ipv4-dedicated-resolver/run.sh diff --git a/tests/multi-lookup-A-ipv4-dedicated-resolver/expected b/tests/multi-lookup-A-ipv4-dedicated-resolver/expected new file mode 100644 index 0000000..ae1e7ed --- /dev/null +++ b/tests/multi-lookup-A-ipv4-dedicated-resolver/expected @@ -0,0 +1,3 @@ +google-public-dns-a.google.com. 8.8.4.4:53 +google-public-dns-b.google.com. 1.1.1.1:53 +one.one.one.one. 8.8.8.8:53 \ No newline at end of file diff --git a/tests/multi-lookup-A-ipv4-dedicated-resolver/google-dns.txt b/tests/multi-lookup-A-ipv4-dedicated-resolver/google-dns.txt new file mode 100644 index 0000000..701e77e --- /dev/null +++ b/tests/multi-lookup-A-ipv4-dedicated-resolver/google-dns.txt @@ -0,0 +1 @@ +8.8.8.8 diff --git a/tests/multi-lookup-A-ipv4-dedicated-resolver/names.txt b/tests/multi-lookup-A-ipv4-dedicated-resolver/names.txt new file mode 100644 index 0000000..40e3c72 --- /dev/null +++ b/tests/multi-lookup-A-ipv4-dedicated-resolver/names.txt @@ -0,0 +1,3 @@ +one.one.one.one +google-public-dns-a.google.com 0.0.0.0 0.0.0.0 8.8.4.4 +google-public-dns-b.google.com 0.0.0.0 0.0.0.0 1.1.1.1 diff --git a/tests/multi-lookup-A-ipv4-dedicated-resolver/run.sh b/tests/multi-lookup-A-ipv4-dedicated-resolver/run.sh new file mode 100755 index 0000000..1ebd1d7 --- /dev/null +++ b/tests/multi-lookup-A-ipv4-dedicated-resolver/run.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +DIR=$(dirname "$0") + +"$DIR"/../../bin/massdns --extended-input -c 50 -r "$DIR"/google-dns.txt --quiet -o J "$DIR"/names.txt | jq -r '(.name + " " + .resolver)' | sort | grep -E -q "`cat $DIR/expected`"