aboutgitcodebugslistschat
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2024-03-12 19:13:46 +0100
committerStefano Brivio <sbrivio@redhat.com>2024-03-14 08:17:37 +0100
commit4d05ba2c58cd6e314f07fbb569c1d05efb12ba46 (patch)
tree56afe48ce20b5f3aa0bc437bae673c75ae7bd4b2
parent43881636c29f98076a0a0740aeb2079d103b4fe6 (diff)
downloadpasst-4d05ba2c58cd6e314f07fbb569c1d05efb12ba46.tar
passt-4d05ba2c58cd6e314f07fbb569c1d05efb12ba46.tar.gz
passt-4d05ba2c58cd6e314f07fbb569c1d05efb12ba46.tar.bz2
passt-4d05ba2c58cd6e314f07fbb569c1d05efb12ba46.tar.lz
passt-4d05ba2c58cd6e314f07fbb569c1d05efb12ba46.tar.xz
passt-4d05ba2c58cd6e314f07fbb569c1d05efb12ba46.tar.zst
passt-4d05ba2c58cd6e314f07fbb569c1d05efb12ba46.zip
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>
-rw-r--r--conf.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/conf.c b/conf.c
index 17c667a..ac9fb34 100644
--- a/conf.c
+++ b/conf.c
@@ -464,8 +464,21 @@ static void get_dns(struct ctx *c)
close(fd);
out:
- if (!dns_set && !added)
- warn("Couldn't get any nameserver address");
+ 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");
+ }
}
/**