Source code upload
[framework/connectivity/dnsmasq.git] / contrib / try-all-ns / dnsmasq-2.35-try-all-ns.patch
1 diff -Nau dnsmasq-2.35/src/dnsmasq.h dnsmasq/src/dnsmasq.h
2 --- dnsmasq-2.35/src/dnsmasq.h  2006-10-18 16:24:50.000000000 -0400
3 +++ dnsmasq/src/dnsmasq.h       2006-11-16 22:06:31.000000000 -0500
4 @@ -112,6 +112,7 @@
5  #define OPT_NO_PING        2097152
6  #define OPT_LEASE_RO       4194304
7  #define OPT_RELOAD         8388608
8 +#define OPT_TRY_ALL_NS     16777216
9  
10  struct all_addr {
11    union {
12 diff -Nau dnsmasq-2.35/src/forward.c dnsmasq/src/forward.c
13 --- dnsmasq-2.35/src/forward.c  2006-10-18 16:24:50.000000000 -0400
14 +++ dnsmasq/src/forward.c       2006-11-16 22:08:19.000000000 -0500
15 @@ -445,6 +445,10 @@
16      {
17         struct server *server = forward->sentto;
18         
19 +       // If strict-order and try-all-ns are set, treat NXDOMAIN as a failed request
20 +       if( (daemon->options & OPT_ORDER) && (daemon->options && OPT_TRY_ALL_NS)
21 +           && header->rcode == NXDOMAIN ) header->rcode = SERVFAIL;
22 +
23         if ((header->rcode == SERVFAIL || header->rcode == REFUSED) && forward->forwardall == 0)
24          /* for broken servers, attempt to send to another one. */
25          {
26 diff -Nau dnsmasq-2.35/src/option.c dnsmasq/src/option.c
27 --- dnsmasq-2.35/src/option.c   2006-10-18 16:24:50.000000000 -0400
28 +++ dnsmasq/src/option.c        2006-11-16 22:10:36.000000000 -0500
29 @@ -28,7 +28,7 @@
30  
31  /* options which don't have a one-char version */
32  #define LOPT_RELOAD 256
33 -
34 +#define LOPT_TRY_ALL_NS 257
35  
36  #ifdef HAVE_GETOPT_LONG
37  static const struct option opts[] =  
38 @@ -102,6 +102,7 @@
39      {"leasefile-ro", 0, 0, '9'},
40      {"dns-forward-max", 1, 0, '0'},
41      {"clear-on-reload", 0, 0, LOPT_RELOAD },
42 +    {"try-all-ns", 0, 0, LOPT_TRY_ALL_NS },
43      { NULL, 0, 0, 0 }
44    };
45  
46 @@ -134,6 +135,7 @@
47    { '5',            OPT_NO_PING },
48    { '9',            OPT_LEASE_RO },
49    { LOPT_RELOAD,    OPT_RELOAD },
50 +  { LOPT_TRY_ALL_NS,OPT_TRY_ALL_NS },
51    { 'v',            0},
52    { 'w',            0},
53    { 0, 0 }
54 @@ -208,6 +210,7 @@
55    { "-9, --leasefile-ro", gettext_noop("Read leases at startup, but never write the lease file."), NULL },
56    { "-0, --dns-forward-max=<queries>", gettext_noop("Maximum number of concurrent DNS queries. (defaults to %s)"), "!" }, 
57    { "    --clear-on-reload", gettext_noop("Clear DNS cache when reloading %s."), RESOLVFILE },
58 +  { "    --try-all-ns", gettext_noop("Try all name servers in tandem on NXDOMAIN replies (use with strict-order)."), NULL },
59    { NULL, NULL, NULL }
60  }; 
61