diff options
author | Simon Kelley <simon@thekelleys.org.uk> | 2022-08-08 15:27:32 +0100 |
---|---|---|
committer | Simon Kelley <simon@thekelleys.org.uk> | 2022-08-08 15:27:32 +0100 |
commit | f4b281381853df6b275332d4cd0ec1d150bffa86 (patch) | |
tree | f9476464e35391bfc96059c81ca83b49b795b3b4 | |
parent | 5586934da01f1d802606459829235e87ab12aae0 (diff) | |
download | dnsmasq-f4b281381853df6b275332d4cd0ec1d150bffa86.tar.gz |
Fix bad interaction between --address=/#/<ip> and --server=/some.domain/#
This would return <ip> for queries in some.domain, rather than
forwarding the query via the default server(s) read from /etc/resolv.conf.
-rw-r--r-- | CHANGELOG | 9 | ||||
-rw-r--r-- | src/domain-match.c | 14 |
2 files changed, 17 insertions, 6 deletions
@@ -72,8 +72,15 @@ version 2.87 value if we're unable to return the answer. Thanks to Bertie Taylor for pointing out the problem and supplying the patch. + Fix problem with the configuration -version 2.86 + --server=/some.domain/# --address=/#/<ip> --server=<server_ip> + + This would return <ip> for queries in some.domain, rather than + forwarding the query via the default server. + + + version 2.86 Handle DHCPREBIND requests in the DHCPv6 server code. Thanks to Aichun Li for spotting this omission, and the initial patch. diff --git a/src/domain-match.c b/src/domain-match.c index 3ec49b8..f7db0fe 100644 --- a/src/domain-match.c +++ b/src/domain-match.c @@ -213,9 +213,13 @@ int lookup_domain(char *domain, int flags, int *lowout, int *highout) to continue generalising */ { /* We've matched a setting which says to use servers without a domain. - Continue the search with empty query */ + Continue the search with empty query. We set the F_SERVER flag + so that --address=/#/... doesn't match. */ if (daemon->serverarray[nlow]->flags & SERV_USE_RESOLV) - crop_query = qlen; + { + crop_query = qlen; + flags |= F_SERVER; + } else break; } @@ -299,7 +303,7 @@ int filter_servers(int seed, int flags, int *lowout, int *highout) for (i = nlow; i < nhigh && (daemon->serverarray[i]->flags & SERV_6ADDR); i++); - if (i != nlow && (flags & F_IPV6)) + if (!(flags & F_SERVER) && i != nlow && (flags & F_IPV6)) nhigh = i; else { @@ -307,7 +311,7 @@ int filter_servers(int seed, int flags, int *lowout, int *highout) for (i = nlow; i < nhigh && (daemon->serverarray[i]->flags & SERV_4ADDR); i++); - if (i != nlow && (flags & F_IPV4)) + if (!(flags & F_SERVER) && i != nlow && (flags & F_IPV4)) nhigh = i; else { @@ -315,7 +319,7 @@ int filter_servers(int seed, int flags, int *lowout, int *highout) for (i = nlow; i < nhigh && (daemon->serverarray[i]->flags & SERV_ALL_ZEROS); i++); - if (i != nlow && (flags & (F_IPV4 | F_IPV6))) + if (!(flags & F_SERVER) && i != nlow && (flags & (F_IPV4 | F_IPV6))) nhigh = i; else { |