From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id 925D55A0271 for ; Thu, 14 Mar 2024 03:17:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202312; t=1710382641; bh=WZXt7YoCEvSsEmMmNfy1sRtxvqwql4vi5nyexr0ffcA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=KRAp+If3awIWcTT81GDv0X+HwBHCTFYLJrTkigrQvnAGbFjQUMB0j6erZh1gOPOHi 8jCPVbEH+DxzRGoAkqJwzgbfgO8tFqvqxGhmJAtQEFEmrPmHqhX3i3VPcyHNIsgb+/ v3XSpQeNSsXA2xoy3hc8ENiuZ6x+iFME87d+NbmG0KoJKi1uHgNWnQaM+tIO0lB6+p 2/15H++uq4Oi+l2cdPlBHj5FR2kgAGbBdbifA+wwxeDvyo3xEyBTb9sHxQ6pCFyzgs MLCE5VI9WKmmIJzMR0f0OCMVjnP/Cj2rR7CNERQFaWr/K2n/dK636n+848v8jjsqE2 s425DdlQth29Q== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4Tw9xs5yYmz4wcs; Thu, 14 Mar 2024 13:17:21 +1100 (AEDT) Date: Thu, 14 Mar 2024 13:17:02 +1100 From: David Gibson To: Stefano Brivio Subject: Re: [PATCH] conf: Handle addresses passed via --dns just like the ones from resolv.conf Message-ID: References: <20240312072136.225197-1-sbrivio@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="lxA36FU4WAyy5M2E" Content-Disposition: inline In-Reply-To: <20240312072136.225197-1-sbrivio@redhat.com> Message-ID-Hash: ESYGGEPSP3LMZ7KEIA5JWW2W24NIDZMT X-Message-ID-Hash: ESYGGEPSP3LMZ7KEIA5JWW2W24NIDZMT 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, Paul Holzinger 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: --lxA36FU4WAyy5M2E Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Mar 12, 2024 at 08:21:36AM +0100, Stefano Brivio wrote: > ...that is, call add_dns4() and add_dns6() instead of simply adding > those to the list of servers we advertise. >=20 > Most importantly, this will set the 'dns_host' field for the matching > IP version, so that, as mentioned in the man page, servers passed via > --dns are used for DNS mapping as well, if used in combination with > --dns-forward. >=20 > Reported-by: Paul Holzinger > Link: https://bugs.passt.top/show_bug.cgi?id=3D82 > Fixes: 89678c515755 ("conf, udp: Introduce basic DNS forwarding") > Signed-off-by: Stefano Brivio Reviewed-by: David Gibson This does subtly change semantics: addresses given to --dns are now host addresses, rather than guest addresses. I think the new meaning is less cryptic, though. > --- > conf.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) >=20 > diff --git a/conf.c b/conf.c > index c50c039..17c667a 100644 > --- a/conf.c > +++ b/conf.c > @@ -1164,11 +1164,11 @@ void conf(struct ctx *c, int argc, char **argv) > }; > char userns[PATH_MAX] =3D { 0 }, netns[PATH_MAX] =3D { 0 }; > bool copy_addrs_opt =3D false, copy_routes_opt =3D false; > + struct in6_addr *dns6 =3D c->ip6.dns, dns6_tmp; > + struct in_addr *dns4 =3D c->ip4.dns, dns4_tmp; > enum fwd_ports_mode fwd_default =3D FWD_NONE; > bool v4_only =3D false, v6_only =3D false; > - struct in6_addr *dns6 =3D c->ip6.dns; > struct fqdn *dnss =3D c->dns_search; > - struct in_addr *dns4 =3D c->ip4.dns; > unsigned int ifi4 =3D 0, ifi6 =3D 0; > const char *logfile =3D NULL; > const char *optstring; > @@ -1554,14 +1554,14 @@ void conf(struct ctx *c, int argc, char **argv) > die("Conflicting DNS options"); > =20 > if (dns4 - &c->ip4.dns[0] < ARRAY_SIZE(c->ip4.dns) && > - inet_pton(AF_INET, optarg, dns4)) { > - dns4++; > + inet_pton(AF_INET, optarg, &dns4_tmp)) { > + add_dns4(c, &dns4_tmp, &dns4); > break; > } > =20 > if (dns6 - &c->ip6.dns[0] < ARRAY_SIZE(c->ip6.dns) && > - inet_pton(AF_INET6, optarg, dns6)) { > - dns6++; > + inet_pton(AF_INET6, optarg, &dns6_tmp)) { > + add_dns6(c, &dns6_tmp, &dns6); > break; > } > =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 --lxA36FU4WAyy5M2E Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmXyXg8ACgkQzQJF27ox 2GdO3A/8Cx738PPFbKKbCf/cmuEXHjsDKUN/YPac5upfbJsXN3IDWqD+VFbuTcfB ALR8RB/DUbj0nWCa0mJ/Lz/ubNews/BmTg2MWTFtjMKMCiRbY54x2uLfS7W7ShkQ xeR/bSvqO76QT/AUGOm7pa7+j9Dtl+RMMCToh+zXL6zdu9MWWWmeiOEr278XUAMP oD0Lr3aZhB1ojDd4JLjLA7ZZeu31iX4IVbpjgDGPWpfsBswIWaKQK5frO980zlmI 1VYEYbo8U1hI1I7kkkE4qOvxxCmHvx202jcgSZanAaP2RpRPwTPIUMuXpk1nUEEx 7c8p0cBp4CT+hn2GrjYJ4otKjXWUnXkuhiU1cRL09/DrNqBkifsEpjww5T5c488b F9QPsR4kl/tZwdBDBn3I4zU164GtZQUIw423stX+opT/Xxa5rWz+wEL1hzV7Qmwp FFBs74RyNBYE5JVYRK68MPgBac5l5iwoaQcTdZ/XZeSPRbvlLcf4LFDbwP7tAI2t MHfulhvmcPxpaf3G8WW8jazMqs12NhOu7Dwte43z/dUHM+IAexiAf/MAI5+9kKXm k38yWzy93pkfTWQhjHuSb/chaZe3wBbwKUibi2hG3CFw0PXxD0HjRcKNH7CAUmdN eZh0oWdjFRC+hDnh2+EoAm25m+EBT+/pIGlwN0B8p4uwMFxaiyY= =/hTU -----END PGP SIGNATURE----- --lxA36FU4WAyy5M2E--