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=202504 header.b=cdzTwAjn; dkim-atps=neutral Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id 8080B5A0008 for ; Mon, 14 Apr 2025 06:23:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202504; t=1744604603; bh=Xq67gpV6+maqxRwYE3iOOebOGq8hxYInSrPK8XK4F+w=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=cdzTwAjnn7Jeh6gT47J4THu0+63j5VaJHTBpQAYSS7xlk8wPBu/oaWooDWYNuZojF z8RZaF0oPuRxqDIbysEfmyHx9/5Z8VfXB+bvsDWz+0uEw8Y5oDV8vvP1teeusYP1ht 1siP5aAUVJ9ge/5l8Eyz7v0B46rZjrejByS+dTY1Bfeg8ANNdfECd++SxMa6ULFp9U IJdVO6S+4LjVF0z8uM/e3UThFBozZ3EsveTxMdEvD3ykOSYmk83tRaIZWGlD+zTiJY jDhiEtc3i2ux/EbtTQM+1uZ1lehN6GbjjgInHS3kX38EXB/rns4YTLhvLEOOuWTdE0 9rrWmFSsgYM9Q== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4ZbZ0W3Fgyz4wcx; Mon, 14 Apr 2025 14:23:23 +1000 (AEST) Date: Mon, 14 Apr 2025 14:12:36 +1000 From: David Gibson To: Laurent Vivier Subject: Re: [PATCH v2 15/20] dhcpv6: Convert to iov_tail Message-ID: References: <20250411131031.1398006-1-lvivier@redhat.com> <20250411131031.1398006-16-lvivier@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="CKAYhNwfj9ZipfxJ" Content-Disposition: inline In-Reply-To: <20250411131031.1398006-16-lvivier@redhat.com> Message-ID-Hash: JCJSV6T4CVDXWSASFYZCCW3MUNZ62AMA X-Message-ID-Hash: JCJSV6T4CVDXWSASFYZCCW3MUNZ62AMA 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 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: --CKAYhNwfj9ZipfxJ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Apr 11, 2025 at 03:10:25PM +0200, Laurent Vivier wrote: > Use packet_base() and extract headers using IOV_REMOVE_HEADER() > and IOV_PEEK_HEADER() rather than packet_get(). >=20 > Signed-off-by: Laurent Vivier Reviewed-by: David Gibson > --- > dhcpv6.c | 11 +++++++++-- > 1 file changed, 9 insertions(+), 2 deletions(-) >=20 > diff --git a/dhcpv6.c b/dhcpv6.c > index 549ddbbea735..cf5c77d5af72 100644 > --- a/dhcpv6.c > +++ b/dhcpv6.c > @@ -534,9 +534,15 @@ int dhcpv6(struct ctx *c, const struct pool *p, > const struct msg_hdr *mh; > const struct udphdr *uh; > struct opt_hdr *bad_ia; > + struct iov_tail data; > + struct msg_hdr mhc; > + struct udphdr uhc; > size_t mlen, n; > =20 > - uh =3D packet_get(p, 0, 0, sizeof(*uh), &mlen); > + if (!packet_base(p, 0, &data)) > + return -1; > + > + uh =3D IOV_REMOVE_HEADER(&data, uhc); > if (!uh) > return -1; > =20 > @@ -549,6 +555,7 @@ int dhcpv6(struct ctx *c, const struct pool *p, > if (!IN6_IS_ADDR_MULTICAST(daddr)) > return -1; > =20 > + mlen =3D iov_tail_size(&data); > if (mlen + sizeof(*uh) !=3D ntohs(uh->len) || mlen < sizeof(*mh)) > return -1; > =20 > @@ -556,7 +563,7 @@ int dhcpv6(struct ctx *c, const struct pool *p, > =20 > src =3D &c->ip6.our_tap_ll; > =20 > - mh =3D packet_get(p, 0, sizeof(*uh), sizeof(*mh), NULL); > + mh =3D IOV_PEEK_HEADER(&data, mhc); > if (!mh) > return -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 --CKAYhNwfj9ZipfxJ Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmf8izMACgkQzQJF27ox 2Gdtjg/9EbXUzf9LZuMxTAgQidxlt/Wa6SNFoO8lU5qyTeP7rwQryzJ8hN8dydOi ZE7TROKPmOEEqjij3wWxwRo2D48KXQJtzz281dLCL7YnT9y847vMZgnJ4zzlhW1n QFjf8d8y14BP/ovMe04ELsd90vZyy3h48P82EiUoiZokUNCI5ndydeq8TtxVAOO2 hjFToOTEo2xI2CZ7hCUughRZD/bhgUPIJd62GleXDHwZd7zb1/hNcTRy7DcCvpZp pC0EGK2PDTvmUNNOw8EKgI98lO1/ebfTngzqlXpJ+N3b91/K73PSqPj3d2OZH9Ju jMgHRL/0jpLNDGU8Nftu/dfD8LRINAIhHby4JkOdL3Z4duIJp+IMA15Aulw5ZkFY UL0lO7lAWSZZn6E9KC/xeNLmTTkO/qBIx+JYMiozK88eXsX8b65hva2axAIvnTHY FxqFf+lZ/pV082uPxwLXQirmSLWuecWoXBup+HxcDsVZXmoc192csI9mpFqwlCAP XDwfgpsGHdCJeYsTJ30C1EM3Ab2CU8IyAwMTPYBlQXVOmy4WE2dqbAiUo19rW3jF 9zt0D9FsgGRp5k5iqpbMnjScWJhqKvhiBEFxV4Pvo3eDphFEioaso+eIZHB3GUQa w2ZtKpIzCbdr5vhXTXa1gmMjSsPyPpk6bLCGEe2fu7qL/Fz5QxY= =Y02V -----END PGP SIGNATURE----- --CKAYhNwfj9ZipfxJ--