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=202510 header.b=hybWcpJE; dkim-atps=neutral Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id 339045A061D for ; Tue, 14 Oct 2025 07:04:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202510; t=1760418288; bh=To7zj4/tbBMvBqtONa1UjXeuHKZEvqEg6RpXKx53/jI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=hybWcpJEZwhYi/Uz3zj2yEVWEsMPXXISXHqKcMFfGanlkS+o2WLFZlzZWaalOEXPd UonI+Tf+S1N3cAoZVpMrFYLZPa2L3GdfBfUdBXrktDCEffxNS9Q0Ix69UyRYmnA6gw /9x3uXPiNuhhbmF/4tNoElzp91X0vianfIIpCJI0O/+pApm2vsVSm2Pjh1vpHpXxUa WoOFuhtMpoPC8PpXFh3lqXrEMdxHqdjB9OubRR5vZMvlyVHRn1kk2ydnwo/N4Bigxl vMWXZiXDeKXeLKGbWp5T6BMquW50pRxHGdQAg5y8mzNByxHl/i2ch7y0QwIriVesu9 0jXponQz8UqlQ== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4cm2Fr0qD5z4wCk; Tue, 14 Oct 2025 16:04:48 +1100 (AEDT) Date: Tue, 14 Oct 2025 15:42:09 +1100 From: David Gibson To: Jon Maloy Subject: Re: [PATCH v13 02/10] passt: add no_map_gw flag to struct ctx Message-ID: References: <20251012193337.616835-1-jmaloy@redhat.com> <20251012193337.616835-3-jmaloy@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="FTF6VHmqC6Ulrh+M" Content-Disposition: inline In-Reply-To: <20251012193337.616835-3-jmaloy@redhat.com> Message-ID-Hash: TM63FEK3I4UANOT5M5QUTVVFZZLV2WAG X-Message-ID-Hash: TM63FEK3I4UANOT5M5QUTVVFZZLV2WAG 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: sbrivio@redhat.com, dgibson@redhat.com, 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: --FTF6VHmqC6Ulrh+M Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Oct 12, 2025 at 03:33:29PM -0400, Jon Maloy wrote: > Later in this series we will introduce a new initialization function > which needs access to the 'no_map_gw' flag. This flag is currently > a local variable inside the conf() call, where it is too early to > call the new function. The new function needs both ctx->hash_secret > and a valid ctx->fd_tap to be set, neither of which are initialized > at that point. >=20 > We therefore add the 'no_map_flag' to struct ctx, so it can be carried > along and used by later functions. Nit 'no_map_gw', not 'no_map_flag'. >=20 > Signed-off-by: Jon Maloy Reviewed-by: David Gibson I'll have to revisit this with the flexible forwarding stuff, but this won't make it any harder. > --- > conf.c | 10 +++++----- > passt.h | 1 + > 2 files changed, 6 insertions(+), 5 deletions(-) >=20 > diff --git a/conf.c b/conf.c > index 66b9e63..6143b54 100644 > --- a/conf.c > +++ b/conf.c > @@ -1410,7 +1410,7 @@ fail: > */ > void conf(struct ctx *c, int argc, char **argv) > { > - int netns_only =3D 0, no_map_gw =3D 0; > + int netns_only =3D 0; > const struct option options[] =3D { > {"debug", no_argument, NULL, 'd' }, > {"quiet", no_argument, NULL, 'q' }, > @@ -1442,7 +1442,7 @@ void conf(struct ctx *c, int argc, char **argv) > {"no-ra", no_argument, &c->no_ra, 1 }, > {"no-splice", no_argument, &c->no_splice, 1 }, > {"freebind", no_argument, &c->freebind, 1 }, > - {"no-map-gw", no_argument, &no_map_gw, 1 }, > + {"no-map-gw", no_argument, &c->no_map_gw, 1 }, > {"ipv4-only", no_argument, NULL, '4' }, > {"ipv6-only", no_argument, NULL, '6' }, > {"one-off", no_argument, NULL, '1' }, > @@ -1656,7 +1656,7 @@ void conf(struct ctx *c, int argc, char **argv) > break; > case 21: > conf_nat(optarg, &c->ip4.map_host_loopback, > - &c->ip6.map_host_loopback, &no_map_gw); > + &c->ip6.map_host_loopback, &c->no_map_gw); > break; > case 22: > conf_nat(optarg, &c->ip4.map_guest_addr, > @@ -2005,11 +2005,11 @@ void conf(struct ctx *c, int argc, char **argv) > } > } > =20 > - if (c->ifi4 && !no_map_gw && > + if (c->ifi4 && !c->no_map_gw && > IN4_IS_ADDR_UNSPECIFIED(&c->ip4.map_host_loopback)) > c->ip4.map_host_loopback =3D c->ip4.guest_gw; > =20 > - if (c->ifi6 && !no_map_gw && > + if (c->ifi6 && !c->no_map_gw && > IN6_IS_ADDR_UNSPECIFIED(&c->ip6.map_host_loopback)) > c->ip6.map_host_loopback =3D c->ip6.guest_gw; > =20 > diff --git a/passt.h b/passt.h > index 0075eb4..830bc36 100644 > --- a/passt.h > +++ b/passt.h > @@ -310,6 +310,7 @@ struct ctx { > int no_ndp; > int no_ra; > int no_splice; > + int no_map_gw; > int host_lo_to_ns_lo; > int freebind; > =20 > --=20 > 2.50.1 >=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 --FTF6VHmqC6Ulrh+M Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmjt1KAACgkQzQJF27ox 2GdBDg//crRlSJZC7etTXpxUyWCLoMfk+E7y19NyBTvFN/5edrxwMIch7qwZVDp+ pstQFEkuyeIvAGBw2cGi8TH0G+k4a+n1mwd8vTatfsojMQPIJl8lNz4+0xJYNdtT l6tkwW+cByZ4js1iJWO6KFiffg1GMl/kAGpsZq+TLfwjjGASXCAmmp/o6yA3t7Jk csRluNZELuLDBGHqE8u9Qhz+dfnIaybvk9mXtlSqJSqS6SusmLF8VIYHinBD8ylY DMEhWjt5molTrW74qnu+Kn1/bYmlxg3hY7uVWIz4XPDa1ppmtGRxhewaJhlR6vbF ZI0UGm7OSJEz2sdVW9bE7ERhW0MFlApAA3KhgZv3IEUXg5Rj/Cda0JeLC78j6V8l DxAO+i4SoaztEele9/doyco4yqyVT22+RLu7nF7oo+UV4uGHDQx18V7FTfv9FG6B 9TKI8A1cmQ5vMFBYb7/1Qy37890Tw8SIubB5h93VPdyU4dhajcHB7Dryn92y3zPT BRNiorRwJNzcscbky1kziszG1NSrzCBnQaX2DwVGUtmKZ9eooAwsU2ezLlXeULc6 z9PO3AJXN4bk5Wb6xBF5LgEHxBO1KnbbRmPE5nezb4qiZ70sXj+0RwC7lsjtonHJ oSKddlMUaksFwJqMgiLFhHNsVX6SVBX/KBmyihkK0/EqQD1kUao= =dyeu -----END PGP SIGNATURE----- --FTF6VHmqC6Ulrh+M--