diff options
Diffstat (limited to 'contrib/try-all-ns')
-rwxr-xr-x | contrib/try-all-ns/README | 19 | ||||
-rwxr-xr-x | contrib/try-all-ns/README-2.47 | 11 | ||||
-rwxr-xr-x | contrib/try-all-ns/dnsmasq-2.35-try-all-ns.patch | 61 | ||||
-rwxr-xr-x | contrib/try-all-ns/dnsmasq-2.47_no_nxdomain_until_end.patch | 17 |
4 files changed, 108 insertions, 0 deletions
diff --git a/contrib/try-all-ns/README b/contrib/try-all-ns/README new file mode 100755 index 0000000..224d554 --- /dev/null +++ b/contrib/try-all-ns/README @@ -0,0 +1,19 @@ +Date: Thu, 07 Dec 2006 00:41:43 -0500 +From: Bob Carroll <bob.carroll@rit.edu> +Subject: dnsmasq suggestion +To: simon@thekelleys.org.uk + + +Hello, + +I recently needed a feature in dnsmasq for a very bizarre situation. I +placed a list of name servers in a special resolve file and told dnsmasq +to use that. But I wanted it to try requests in order and treat NXDOMAIN +requests as a failed tcp connection. I wrote the feature into dnsmasq +and it seems to work. I prepared a patch in the event that others might +find it useful as well. + +Thanks and keep up the good work. + +--Bob + diff --git a/contrib/try-all-ns/README-2.47 b/contrib/try-all-ns/README-2.47 new file mode 100755 index 0000000..3ebec65 --- /dev/null +++ b/contrib/try-all-ns/README-2.47 @@ -0,0 +1,11 @@ +A remake of patch Bob Carroll had posted to dnsmasq, +now compatible with version 2.47. Hopefully he doesn't +mind (sending a copy of this mail to him too). + +Maybe the patch in question is not acceptible +as it doesn't add new switch, rather it binds itself to "strict-order". + +What it does is: if you have strict-order in the +dnsmasq config file and query a domain that would result +in NXDOMAIN, it iterates the whole given nameserver list +until the last one says NXDOMAIN. diff --git a/contrib/try-all-ns/dnsmasq-2.35-try-all-ns.patch b/contrib/try-all-ns/dnsmasq-2.35-try-all-ns.patch new file mode 100755 index 0000000..ec3f3e0 --- /dev/null +++ b/contrib/try-all-ns/dnsmasq-2.35-try-all-ns.patch @@ -0,0 +1,61 @@ +diff -Nau dnsmasq-2.35/src/dnsmasq.h dnsmasq/src/dnsmasq.h +--- dnsmasq-2.35/src/dnsmasq.h 2006-10-18 16:24:50.000000000 -0400 ++++ dnsmasq/src/dnsmasq.h 2006-11-16 22:06:31.000000000 -0500 +@@ -112,6 +112,7 @@ + #define OPT_NO_PING 2097152 + #define OPT_LEASE_RO 4194304 + #define OPT_RELOAD 8388608 ++#define OPT_TRY_ALL_NS 16777216 + + struct all_addr { + union { +diff -Nau dnsmasq-2.35/src/forward.c dnsmasq/src/forward.c +--- dnsmasq-2.35/src/forward.c 2006-10-18 16:24:50.000000000 -0400 ++++ dnsmasq/src/forward.c 2006-11-16 22:08:19.000000000 -0500 +@@ -445,6 +445,10 @@ + { + struct server *server = forward->sentto; + ++ // If strict-order and try-all-ns are set, treat NXDOMAIN as a failed request ++ if( (daemon->options & OPT_ORDER) && (daemon->options && OPT_TRY_ALL_NS) ++ && header->rcode == NXDOMAIN ) header->rcode = SERVFAIL; ++ + if ((header->rcode == SERVFAIL || header->rcode == REFUSED) && forward->forwardall == 0) + /* for broken servers, attempt to send to another one. */ + { +diff -Nau dnsmasq-2.35/src/option.c dnsmasq/src/option.c +--- dnsmasq-2.35/src/option.c 2006-10-18 16:24:50.000000000 -0400 ++++ dnsmasq/src/option.c 2006-11-16 22:10:36.000000000 -0500 +@@ -28,7 +28,7 @@ + + /* options which don't have a one-char version */ + #define LOPT_RELOAD 256 +- ++#define LOPT_TRY_ALL_NS 257 + + #ifdef HAVE_GETOPT_LONG + static const struct option opts[] = +@@ -102,6 +102,7 @@ + {"leasefile-ro", 0, 0, '9'}, + {"dns-forward-max", 1, 0, '0'}, + {"clear-on-reload", 0, 0, LOPT_RELOAD }, ++ {"try-all-ns", 0, 0, LOPT_TRY_ALL_NS }, + { NULL, 0, 0, 0 } + }; + +@@ -134,6 +135,7 @@ + { '5', OPT_NO_PING }, + { '9', OPT_LEASE_RO }, + { LOPT_RELOAD, OPT_RELOAD }, ++ { LOPT_TRY_ALL_NS,OPT_TRY_ALL_NS }, + { 'v', 0}, + { 'w', 0}, + { 0, 0 } +@@ -208,6 +210,7 @@ + { "-9, --leasefile-ro", gettext_noop("Read leases at startup, but never write the lease file."), NULL }, + { "-0, --dns-forward-max=<queries>", gettext_noop("Maximum number of concurrent DNS queries. (defaults to %s)"), "!" }, + { " --clear-on-reload", gettext_noop("Clear DNS cache when reloading %s."), RESOLVFILE }, ++ { " --try-all-ns", gettext_noop("Try all name servers in tandem on NXDOMAIN replies (use with strict-order)."), NULL }, + { NULL, NULL, NULL } + }; + diff --git a/contrib/try-all-ns/dnsmasq-2.47_no_nxdomain_until_end.patch b/contrib/try-all-ns/dnsmasq-2.47_no_nxdomain_until_end.patch new file mode 100755 index 0000000..7586003 --- /dev/null +++ b/contrib/try-all-ns/dnsmasq-2.47_no_nxdomain_until_end.patch @@ -0,0 +1,17 @@ +diff -ur dnsmasq-2.47/src/forward.c dnsmasq-2.47-patched/src/forward.c +--- dnsmasq-2.47/src/forward.c 2009-02-01 17:59:48.000000000 +0200 ++++ dnsmasq-2.47-patched/src/forward.c 2009-03-18 19:10:22.000000000 +0200 +@@ -488,9 +488,12 @@ + return; + + server = forward->sentto; ++ ++ if ( (header->rcode == NXDOMAIN) && ((daemon->options & OPT_ORDER) != 0) && (server->next != NULL) ) ++ header->rcode = SERVFAIL; + + if ((header->rcode == SERVFAIL || header->rcode == REFUSED) && +- !(daemon->options & OPT_ORDER) && ++ ((daemon->options & OPT_ORDER) != 0) && + forward->forwardall == 0) + /* for broken servers, attempt to send to another one. */ + { |