From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: passt.top; dkim=pass (2048-bit key; secure) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.a=rsa-sha256 header.s=202606 header.b=GSPxOaRf; dkim-atps=neutral Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id CB17F5A0265 for ; Thu, 23 Jul 2026 05:37:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202606; t=1784777824; bh=+8wa8Q+18q79PyE4fNTX6FpCfH3y2c0yWyOCQCSGH4c=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=GSPxOaRfRhK1zdsYNyyFZKVxuTEGAhQ20TKiWf5jZKIkYO7v/1OL12rcLBcwN22i4 sqb+uFxLHSl6vs008cRTWw8dvOQ+fZB26PdSe9WQJc7UC31BbX31nFsMXXLvlFT87W szRzGdfX3xJDWUvsuSV0at+CesiJDP595lkc/TAXoP4BzwYzw57CrUGvFzrnwgNF4d Jxd7gCLdr9PD0KZqggpgHGREPqu+yd4kN2OaOxR+28Puh9Vv8aCqj4ywJN/FYoa2y/ 2K7K1ayqLDP0DuSZlxxmCw1ubIgvyF/AzRJDS3PbAwP6Cu5mZUotjcU+fOSrym1lHf cIxrwcoiQllFw== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4h5GyS2cx3z4wCH; Thu, 23 Jul 2026 13:37:04 +1000 (AEST) Date: Thu, 23 Jul 2026 13:26:25 +1000 From: David Gibson To: Stefano Brivio Subject: Re: [PATCH 1/2] conf: Honour --address, --gateway, --netmask in local mode as well Message-ID: References: <20260722232639.1105561-1-sbrivio@redhat.com> <20260722232639.1105561-2-sbrivio@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="O1oAbsCRMFhSr3bn" Content-Disposition: inline In-Reply-To: <20260722232639.1105561-2-sbrivio@redhat.com> Message-ID-Hash: Y5DTZM2HLDHLG3PH7LOQ6AJKIY5RCFIF X-Message-ID-Hash: Y5DTZM2HLDHLG3PH7LOQ6AJKIY5RCFIF 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, Jan =?iso-8859-1?Q?Rod=E1k?= , 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: --O1oAbsCRMFhSr3bn Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jul 23, 2026 at 01:26:38AM +0200, Stefano Brivio wrote: > When I implemented local mode in 14b84a7f077e ("treewide: Introduce > 'local mode' for disconnected setups"), I didn't consider the > possibility that, also in that case, the user might want to override > addresses, default gateway or netmask, even though I expressly > mentioned this in the man page: >=20 > In this case, **unless configured otherwise**, they will assign the > IPv4 link-local address 169.254.2.1 to the guest or target > namespace, and no IPv6 address. >=20 > Fix this by checking if an address, gateway, or netmask length was > explicitly set by the user, before overriding them with the default > parameters for local mode. >=20 > This might lead to invalid configurations where we won't be able to > set the default gateway passed by the user, but we print a warning > message, and we assume users know what they're doing in that case. >=20 > Link: https://bugs.passt.top/show_bug.cgi?id=3D217 > Fixes: 14b84a7f077e ("treewide: Introduce 'local mode' for disconnected s= etups") > Signed-off-by: Stefano Brivio Reviewed-by: David Gibson > --- > conf.c | 21 +++++++++++++++++---- > 1 file changed, 17 insertions(+), 4 deletions(-) >=20 > diff --git a/conf.c b/conf.c > index 0fcba5c..7908123 100644 > --- a/conf.c > +++ b/conf.c > @@ -435,9 +435,16 @@ static unsigned int conf_ip4(unsigned int ifi, struc= t ip4_ctx *ip4) > */ > static void conf_ip4_local(struct ip4_ctx *ip4) > { > - ip4->addr_seen =3D ip4->addr =3D IP4_LL_GUEST_ADDR; > - ip4->our_tap_addr =3D ip4->guest_gw =3D IP4_LL_GUEST_GW; > - ip4->prefix_len =3D IP4_LL_PREFIX_LEN; > + if (IN4_IS_ADDR_UNSPECIFIED(&ip4->addr)) > + ip4->addr =3D IP4_LL_GUEST_ADDR; > + ip4->addr_seen =3D ip4->addr; > + > + if (IN4_IS_ADDR_UNSPECIFIED(&ip4->guest_gw)) > + ip4->guest_gw =3D IP4_LL_GUEST_GW; > + ip4->our_tap_addr =3D ip4->guest_gw; > + > + if (!ip4->prefix_len) > + ip4->prefix_len =3D IP4_LL_PREFIX_LEN; > =20 > ip4->no_copy_addrs =3D ip4->no_copy_routes =3D true; > } > @@ -497,7 +504,13 @@ static unsigned int conf_ip6(unsigned int ifi, struc= t ip6_ctx *ip6) > */ > static void conf_ip6_local(struct ip6_ctx *ip6) > { > - ip6->our_tap_ll =3D ip6->guest_gw =3D IP6_LL_GUEST_GW; > + if (IN6_IS_ADDR_UNSPECIFIED(&ip6->guest_gw)) > + ip6->guest_gw =3D IP6_LL_GUEST_GW; > + > + if (IN6_IS_ADDR_LINKLOCAL(&ip6->guest_gw)) > + ip6->our_tap_ll =3D ip6->guest_gw; > + else > + ip6->our_tap_ll =3D IP6_LL_GUEST_GW; > =20 > ip6->no_copy_addrs =3D ip6->no_copy_routes =3D true; > } > --=20 > 2.43.0 >=20 --=20 David Gibson (he or they) | 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 --O1oAbsCRMFhSr3bn Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmphidwACgkQzQJF27ox 2GcpBw/8C5W9ek4P5aGRsrHQrqME3f07UukshmOkXxDEGX2NtF+QdPsz3P/IC6FO aJrkbdlKLE4jK2Ow7ix9EhKzfEzO3erLM55nkatlMh/zdIGcnWcIvPh9BoNXTPFK wpFd/65Lfddykxh1CXY60qs9apxmsIwPG6rkv5mjhoL7SFEvEfCuxbg/KueoNiB6 epAdNG/dY4EAcmdHaZwWZZu/i1Ki6l5Pm4+Rg5fM2t+odbE/tAh0O4yiwYWYocJu OM224eYciB8hQXr01gNK69acWErXBfxASuEf/M+5RgzFqsW6w6a66WFRv+xIG7Fh YHMICTeI8PU7y6dXYOlZHuv0XnD+EbZbuwJ3zJgfer7aEBVDVhluZtbLY6VPD3VV yG7EtiyVDlxCmtgQ2MkCx91glUNydtazmKe1LLNkjysLJAXXDlf413tjV1Y33iae NjS9rjw5JtNmeu2Q+NooeoA0r+GlFe2aO8YuycGyhQTDoB9aRJXgAHDNZ9KdDSh/ z5dSWr1N+Zcofmo7YzADMvizsTnX7WRz9b5ZvNaHtGMRftb7ncyo+wm6OAa769px Ravr5qB2XIumq7gY2nAhvvNi6xgt3BmpOrWti+Fs93xmnGfbi7NZiFz1KOou0DVT Wx6qffe/zrkwViGlLBVVCib/DrOLEuhwCAeNSIXRfw3YZ6sv5CI= =wnDA -----END PGP SIGNATURE----- --O1oAbsCRMFhSr3bn--