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=fail reason="key not found in DNS" header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.a=rsa-sha256 header.s=202312 header.b=lgkc2q9L; dkim-atps=neutral Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id 91EEA5A004E for ; Wed, 21 Aug 2024 04:51:17 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202312; t=1724208670; bh=EbiYzJuZ5YY0Ha1ADvsGpL9zVr+pBRTBIWcG7jZaYOw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=lgkc2q9LVa4e6PVlE1Trth+QsQwn1a/9/Sk+EqF00fUOJQh80Ta3fGZ+XbdvzT5rD 62EhHzqE4iBJZfxlw3fypKtN88NPrT76QL3fXzJrClm5RxsSO+jtCWrnIfSm7cxKx4 7xNhrTXkdJIFWkDwiwW1A5CdR8LkORV7Z74muw3wEteR1m1UOGDzUG15B3xKR9Hndq rYpVuC/yP9RrIM6HrFUtwS2+v2n3zcCK0Gadj2GK4ENXo/H9KQXfnrQq6tR/Jj0cjq Yx6exaeZN/NYOHLFjHsJccIMgKcisfIOmACpRL/ag8Ntcxgo8g6fFe+9xIKFKHYttJ aPKTeJRGhVjxQ== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4WpW721Q8bz4x8C; Wed, 21 Aug 2024 12:51:10 +1000 (AEST) Date: Wed, 21 Aug 2024 11:59:50 +1000 From: David Gibson To: Stefano Brivio Subject: Re: [PATCH 19/22] conf, fwd: Split notion of gateway/router from guest-visible host address Message-ID: References: <20240816054004.1335006-1-david@gibson.dropbear.id.au> <20240816054004.1335006-20-david@gibson.dropbear.id.au> <20240820215631.48f6cc6e@elisabeth> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="kqpSkWTjUae+0G/3" Content-Disposition: inline In-Reply-To: <20240820215631.48f6cc6e@elisabeth> Message-ID-Hash: IDIIH3SLYNRJJXSVR4H2U34VNYOYPFKU X-Message-ID-Hash: IDIIH3SLYNRJJXSVR4H2U34VNYOYPFKU 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: --kqpSkWTjUae+0G/3 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Aug 20, 2024 at 09:56:31PM +0200, Stefano Brivio wrote: > On Fri, 16 Aug 2024 15:40:00 +1000 > David Gibson wrote: >=20 > > The @gw fields in the ip4_ctx and ip6_ctx give the (host's) default > > gateway. We use this for two quite distinct things: advertising the > > gateway that the guest should use (via DHCP, NDP and/or --config-net) > > and for a limited form of NAT. So that the guest can access services > > on the host, we map the gateway address within the guest to the > > loopback address on the host. > >=20 > > Using the gateway address for this isn't necessarily the best choice > > for this purpose, certainly not for all circumstances. So, start off > > by splitting the notion of these into two different values: @guest_gw > > which is the gateway address the guest should use and @nat_host_loopbac= k, > > which is the guest visible address to remap to the host's loopback. > >=20 > > Usually nat_host_loopback will have the same value as guest_gw. However > > when --no-map-gw is specified we leave them unspecified instead. This > > means when we use nat_host_loopback, we don't need to separately check > > c->no_map_gw to see if it's relevant. > >=20 > > Signed-off-by: David Gibson > > --- > > conf.c | 60 +++++++++++++++++++++++++++++---------------------------- > > dhcp.c | 10 ++++++---- > > fwd.c | 4 ++-- > > passt.h | 16 +++++++++------ > > pasta.c | 6 ++++-- > > 5 files changed, 53 insertions(+), 43 deletions(-) > >=20 > > diff --git a/conf.c b/conf.c > > index b1c58d5b..26373584 100644 > > --- a/conf.c > > +++ b/conf.c > > @@ -410,12 +410,12 @@ static void add_dns_resolv(struct ctx *c, const c= har *nameserver, > > * redirect > > */ > > if (IN4_IS_ADDR_LOOPBACK(&ns4)) { > > - if (c->no_map_gw) > > + if (IN4_IS_ADDR_UNSPECIFIED(&c->ip4.nat_host_loopback)) >=20 > If you change the command-line option name to use "map", it would be > good to also change these names. Will do. --=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 --kqpSkWTjUae+0G/3 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmbFShUACgkQzQJF27ox 2Gdaew/+OAl6c+qM5P8UAkqlLh6LBj/6S5oIJNZtT9FlZCrxeqgEJyaLXY/DAdsV eyA4WZne9Qr6NlVErGIs5F1i2KNV/Xc2CdTPS5zZDUEI5sB+SbRTJs7qjg5QnHy8 NpZ68qlchWB8mU7MVQc2oZTj8/5U37VqRvInRjt7rSWuiCiTtZeqqGj1i3/yrhG1 AfSocusevCJFd2pFW9J2JVPe53j/pfe+3jMXrEo+wxbyqU8Ee+BwOfAvyJxVcE+6 xgySfyf5Tm9ssO6+Z09tg7vHa8m08e127pNELHwmYwNtUPw6bmlUrq7aH9yDNC79 TDIYz4zGJ7kAL1nS+JXnpj21ogGqFF4DLjApErlSY0/RQOlv09UF/fgWSwFBAyHO SZYUnAokU3NT35a4po30ODH61t1iD5CH87IAnLZnP1GwqFW7JNI/6BWcsXZ3jiEL U3HB45F/09pJ1YoHRSLdITCaf4EH70pdVFIPYAUhL2UU21MkQ6cfjADHofmfFqsS lSVGfE+zZmK59Kpm2baoJvml1Uhc9F6qW6YMkZ+cJ7X+tlifFYW8gc3e4albQQMZ 9WUt3EHfmsnkf9D6Ky+N5ayASVWa88ehgDwJFJgrHdTJRXDDDsxLMmjwWlq5mAvK Wvoa6wz7vTCYIAfVl8WsxcQzDGD7CrfnfMB2ceWdflFDkajnC5k= =znf4 -----END PGP SIGNATURE----- --kqpSkWTjUae+0G/3--