From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id 2782A5A026F for ; Thu, 14 Mar 2024 03:20:40 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202312; t=1710382836; bh=84hIVNcwFjqZEpXMQHykFSUJcXliuW2EgfATOfWs9m4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=AW6Z0iF1cU3STgzGNms4ngtTNhvsZ+NfMmxlBy0xPPbSYOGrxrQRE+71uD8xt8brm Wl84Tk0dP+wvTGQGw9smrR0bM/2Gmq+Ob6MN7YWN5hsFsqUdrwxP6n/t5WQSPZ9fmr xGVIUXAM7Z9xpu4TatOPBnggkESBoOLrmEHhyUkDCUh2UBfufQMheWoRyyEIULMP45 bQUM8hlL56L9ZB1o/bdwyZ10MHaHaOMc2b2V9JYUpJemsn/9eONCO3Q07gMy6DwPv/ pDUhDoPbp0eYHA44lToCfZZzy/IvwDrc3sRK4+Yth5v9UHFOy7UyT/9cYdGzFZpt8O +j13JovY9DDcA== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4TwB1c4JnZz4wc8; Thu, 14 Mar 2024 13:20:36 +1100 (AEDT) Date: Thu, 14 Mar 2024 13:20:25 +1100 From: David Gibson To: Stefano Brivio Subject: Re: [PATCH] conf: Warn if we can't advertise any nameserver via DHCP, NDP, or DHCPv6 Message-ID: References: <20240312182110.510581-1-sbrivio@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="hmg1bpKe7UiYr9wU" Content-Disposition: inline In-Reply-To: <20240312182110.510581-1-sbrivio@redhat.com> Message-ID-Hash: QZ2D2O7MS2HJZ3XHENPOUBGK6VDXVFY3 X-Message-ID-Hash: QZ2D2O7MS2HJZ3XHENPOUBGK6VDXVFY3 X-MailFrom: dgibson@gandalf.ozlabs.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: passt-dev@passt.top X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: --hmg1bpKe7UiYr9wU Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Mar 12, 2024 at 07:21:10PM +0100, Stefano Brivio wrote: > 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. >=20 > Suggested-by: David Gibson > Signed-off-by: Stefano Brivio Reviewed-by: David Gibson > --- > conf.c | 17 +++++++++++++++-- > 1 file changed, 15 insertions(+), 2 deletions(-) >=20 > 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); > =20 > 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"); > + } > } > =20 > /** --=20 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --hmg1bpKe7UiYr9wU Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmXyXtkACgkQzQJF27ox 2GebOg/+PsztPWYe3OFqcGeM7KyjBoV+gzCU8foUrsbiC2d/H0VgutblM1aZTJio G4gCfgxIcY4AeWRlqx78jqz4Fxt4TfYTlxHEQ4x9y8jp6GjuRZ1neFRgFuoVDNPH xm0TwoosAN/1cIdAC3wYve/V4Cj53i4ZHL0zQB+eCWX3FW1RUBy476gnF2J2jpTr sNXHU0xG6fK2WMYmPc0wwh2fEa4NNP0impaWlGXcFSuSUpH4jJRtQXRPEkcx371E MCC6nzHErQllbI3xdTgOEFuSfgJpZq4oB9+w2Rrko+oElNHJwCgAeeOMYMcHuTfi JztJyZiFPvuhKYx5+9+v1uabR3SXF/ulrx4CUc+Co5C7fGPU4gCKIacAgy6Oup+d YN9utk8/OVauBAGmZQujjwd66BOwnt5TkW8IK9++E1AslY7h2k73uhwZwhTamszU PDoilBCK36PN3by4pFPe2pPPSGC+VDIm4DZxXBft1ieJuFP4OHq6be79YmzRUVHx iIi+qn49PcTtUEQAf/pA1nBWye4HSxhtdGZ0Q/gFksI5pdltY7IljrcRujPRUe9k UYqZ3BL/tKsHRorRgWt5g+zQzXat83V2y0eYKO5PUzpy03XdzNfOmrJ/wvuT8r2o AvqOpm1lYMi9tBw5JSHI7mPric/vlshGAXl/enizCr30Y6yD5Rc= =lcQz -----END PGP SIGNATURE----- --hmg1bpKe7UiYr9wU--