conf: Warn if we can't advertise any nameserver via DHCP, NDP, or DHCPv6
We might have read from resolv.conf, or from the command line, a resolver that's reachable via loopback address, but that doesn't mean we can offer that via DHCP, NDP or DHCPv6: warn if there are no resolvers we can offer for a given IP version. Suggested-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
43881636c2
commit
4d05ba2c58
1 changed files with 15 additions and 2 deletions
15
conf.c
15
conf.c
|
@ -464,8 +464,21 @@ static void get_dns(struct ctx *c)
|
|||
close(fd);
|
||||
|
||||
out:
|
||||
if (!dns_set && !added)
|
||||
if (!dns_set) {
|
||||
if (!added)
|
||||
warn("Couldn't get any nameserver address");
|
||||
|
||||
if (c->no_dhcp_dns)
|
||||
return;
|
||||
|
||||
if (c->ifi4 && !c->no_dhcp &&
|
||||
IN4_IS_ADDR_UNSPECIFIED(&c->ip4.dns[0]))
|
||||
warn("No IPv4 nameserver available for DHCP");
|
||||
|
||||
if (c->ifi6 && ((!c->no_ndp && !c->no_ra) || !c->no_dhcpv6) &&
|
||||
IN6_IS_ADDR_UNSPECIFIED(&c->ip6.dns[0]))
|
||||
warn("No IPv6 nameserver available for NDP/DHCPv6");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue