From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id 4B91F5A004E for ; Wed, 14 Aug 2024 06:40:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202312; t=1723610455; bh=k5QMdRudw8ASjJM3qI8/atW9PpsZdK/kdTn8IU2vST0=; h=Date:From:To:Subject:References:In-Reply-To:From; b=OAkB5KJ3FsMWmnpXbzI8Yd2+PyzQr4g8uZmAWYDr4rEboPjQDX8u8ZkJweBjzWgzf /aUFyC25a2leJZGekRz8So5r6hSU5yRDKFeBmyy1qzwOOi7zkUGvFpEGuknmmnyf55 7DUK0v8Qtz3rjOg985PlTtWYsFEyA5KSCTUnxO0L/704glGiacu6daOFhKBg1alVip KRmmvvD+ioum/z6iRXOqy8goJKS/UvATCuly5I0PppZx9Q1BYeMrewV7L9cwF1Sm9p RmAnBEctYlbOrA28CxhsCN3UUwE8wDP6nFSHAt3cyWS2s/qTnAyQ+hgBxJZy5T6/rw 2X6Sl8Z83cMFQ== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4WkFtv2Mljz4x3q; Wed, 14 Aug 2024 14:40:55 +1000 (AEST) Date: Wed, 14 Aug 2024 14:39:09 +1000 From: David Gibson To: passt-dev@passt.top, Stefano Brivio Subject: Re: [PATCH 16/16] Initialise our_tap_ll to ip6.gw when suitable Message-ID: References: <20240814043050.4177037-1-david@gibson.dropbear.id.au> <20240814043050.4177037-17-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="EI1D6naXXUrIYe/+" Content-Disposition: inline In-Reply-To: <20240814043050.4177037-17-david@gibson.dropbear.id.au> Message-ID-Hash: IWVD6YYMY6YSRRPPWXTXXDV7GOP7CV5C X-Message-ID-Hash: IWVD6YYMY6YSRRPPWXTXXDV7GOP7CV5C 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 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: --EI1D6naXXUrIYe/+ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Aug 14, 2024 at 02:30:50PM +1000, David Gibson wrote: > In every place we use our_tap_ll, we only use it as a fallback if the > IPv6 gateway address is not link-local. We can avoid that conditional at > use time by doing it at initialisation of our_tap_ll instead. >=20 > Signed-off-by: David Gibson Ugh, sorry. Please don't apply this one, I missed a case. > --- > conf.c | 3 +++ > dhcpv6.c | 5 +---- > ndp.c | 5 +---- > 3 files changed, 5 insertions(+), 8 deletions(-) >=20 > diff --git a/conf.c b/conf.c > index f1727ade..30769474 100644 > --- a/conf.c > +++ b/conf.c > @@ -721,6 +721,9 @@ static unsigned int conf_ip6(unsigned int ifi, > =20 > ip6->addr_seen =3D ip6->addr; > =20 > + if (IN6_IS_ADDR_LINKLOCAL(&ip6->gw)) > + ip6->our_tap_ll =3D ip6->gw; > + > if (MAC_IS_ZERO(mac)) { > rc =3D nl_link_get_mac(nl_sock, ifi, mac); > if (rc < 0) { > diff --git a/dhcpv6.c b/dhcpv6.c > index 44e954e7..69841abc 100644 > --- a/dhcpv6.c > +++ b/dhcpv6.c > @@ -453,10 +453,7 @@ int dhcpv6(struct ctx *c, const struct pool *p, > =20 > c->ip6.addr_ll_seen =3D *saddr; > =20 > - if (IN6_IS_ADDR_LINKLOCAL(&c->ip6.gw)) > - src =3D &c->ip6.gw; > - else > - src =3D &c->ip6.our_tap_ll; > + src =3D &c->ip6.our_tap_ll; > =20 > mh =3D packet_get(p, 0, sizeof(*uh), sizeof(*mh), NULL); > if (!mh) > diff --git a/ndp.c b/ndp.c > index 3a76b00a..a1ee8349 100644 > --- a/ndp.c > +++ b/ndp.c > @@ -341,10 +341,7 @@ dns_done: > else > c->ip6.addr_seen =3D *saddr; > =20 > - if (IN6_IS_ADDR_LINKLOCAL(&c->ip6.gw)) > - rsaddr =3D &c->ip6.gw; > - else > - rsaddr =3D &c->ip6.our_tap_ll; > + rsaddr =3D &c->ip6.our_tap_ll; > =20 > if (ih->icmp6_type =3D=3D NS) { > dlen =3D sizeof(struct ndp_na); --=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 --EI1D6naXXUrIYe/+ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAma8NOgACgkQzQJF27ox 2Ge3GhAAk4wUEAjj7jrWzpPQAi3+Dm1kXnh3ZSD57OxKKksri+Vp6T0NLgQqKuiE QZ1c2o7FcU+AbdwbKZbYyLhDcCvZ5LAmWKjzUuZrjpYGFYDQR5/prA2wRfGR0eIO ewMoZ9vA2DSFCZHnWLWlbMTNzVISdFki9Z2LNguwtkP4269gO+y4+Meb0sFqY1GG xwKJeVGW36L3+N3bKQf4xkaRSNNMzMUOYco8dDpiwrdZn1UqgGsUHJe0kv/EDr9X jd+e8pm1IMLO2f6H6hSJP8ZPX60d/jeXXiJbT/9lfJdaxFf/Q8UHlGiXOUk7V2o4 8lSqyG817heTYmkebYx4c/vhcBOA39ngF5rciflHiQyrg4HxMRSsGIgFRUpmGN8v RTmK8NR1a0xR3XZMyYhaLtj9dLw5ALwua3W3V63aZCXoPyFFzoogp/ZTXC8psNoQ ru93we1ALjB/S60iYV1YCh1Oy+G4Cc1H4TNkG9iJKsh+StRint5sybj1Bun0/uxi o2fMhGdPQ2wbFrJF1ijbtFGnT14COGp6LWrAuiwawdBghwpB3RKWtc1FtDaZPJKg 6oakWboQGWk+g3L+vtiYUyBldGjzkGHsKsofsZEVWIRcNhXLuY++iPyB16A4BBMe 3/SoFaiJw7ESBbMZ7JlJ0ERpm1n//gFXxoGaIfX3eaRmgFb6dRg= =RoEy -----END PGP SIGNATURE----- --EI1D6naXXUrIYe/+--