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.
This commit is contained in:
Simon Kelley
2022-08-08 15:27:32 +01:00
parent 5586934da0
commit f4b2813818
2 changed files with 17 additions and 6 deletions

View File

@@ -72,8 +72,15 @@ version 2.87
value if we're unable to return the answer. Thanks to Bertie value if we're unable to return the answer. Thanks to Bertie
Taylor for pointing out the problem and supplying the patch. 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. Handle DHCPREBIND requests in the DHCPv6 server code.
Thanks to Aichun Li for spotting this omission, and the initial Thanks to Aichun Li for spotting this omission, and the initial
patch. patch.

View File

@@ -213,9 +213,13 @@ int lookup_domain(char *domain, int flags, int *lowout, int *highout)
to continue generalising */ to continue generalising */
{ {
/* We've matched a setting which says to use servers without a domain. /* 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) if (daemon->serverarray[nlow]->flags & SERV_USE_RESOLV)
crop_query = qlen; {
crop_query = qlen;
flags |= F_SERVER;
}
else else
break; 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++); 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; nhigh = i;
else 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++); 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; nhigh = i;
else 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++); 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; nhigh = i;
else else
{ {