diff options
Diffstat (limited to 'conf.c')
| -rw-r--r-- | conf.c | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -352,11 +352,20 @@ static int conf_resolv_update(struct ctx *c) } close(fd); + /* If resolv.conf doesn't list a nameserver for an IP version anymore, + * forget the one we had, as if we started now: we don't redirect DNS + * queries for that IP version until a nameserver shows up again + */ if (c->ip4.dns_host_resolv && found4 && !IN4_ARE_ADDR_EQUAL(&ns4, &c->ip4.dns_host)) { c->ip4.dns_host = ns4; info("Forwarding DNS queries to new host nameserver %s", inet_ntop(AF_INET, &ns4, addr, sizeof(addr))); + } else if (c->ip4.dns_host_resolv && !found4 && + !IN4_IS_ADDR_UNSPECIFIED(&c->ip4.dns_host)) { + info("Stopped forwarding DNS queries to removed nameserver %s", + inet_ntop(AF_INET, &c->ip4.dns_host, addr, sizeof(addr))); + c->ip4.dns_host = in4addr_any; } if (c->ip6.dns_host_resolv && found6 && @@ -364,6 +373,11 @@ static int conf_resolv_update(struct ctx *c) c->ip6.dns_host = ns6; info("Forwarding DNS queries to new host nameserver %s", inet_ntop(AF_INET6, &ns6, addr, sizeof(addr))); + } else if (c->ip6.dns_host_resolv && !found6 && + !IN6_IS_ADDR_UNSPECIFIED(&c->ip6.dns_host)) { + info("Stopped forwarding DNS queries to removed nameserver %s", + inet_ntop(AF_INET6, &c->ip6.dns_host, addr, sizeof(addr))); + c->ip6.dns_host = in6addr_any; } return 0; |
