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=202602 header.b=JNx6YklN; dkim-atps=neutral Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id 6DD005A004E for ; Mon, 02 Mar 2026 11:41:52 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202602; t=1772448109; bh=NtP0k8hpgZE7P0EC1SXO8kY5NsEW1wpP7BZ1HSoxsC0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=JNx6YklNfZSmDB5kXj3Ol0R0RTMAtbnAQJMrnpyKO0mCUKsMod4wiVBMbG+Ju0cgu ttlzLCRuXbfm+yW17gDoA6iZRfGlyk8ItiGziFcXtoogrI9YJgiXLmS8lULzCbqUM0 DWeq8Gu8SwFZzfRmKUQxdtm3BOALd2GSqxeXSmlcdWQPNdhk2/RFALP4Y31c707OdN tYpv3q2rZ8xGN9edraAZteKb3yNZq00Cuu+oT/n57yxMFyXqevHpK4ihval2ifAJ2m fVuXbrQkprbnHfYmPT6AaN3KDWgIMBvaYvDBhkINzw/27nKfa1AqjerJxhlcNRYvdj pYrsCZeWXSarQ== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4fPb8Y1bBPz4w8x; Mon, 02 Mar 2026 21:41:49 +1100 (AEDT) Date: Mon, 2 Mar 2026 21:41:42 +1100 From: David Gibson To: Jon Maloy Subject: Re: [PATCH v5 04/13] arp: Check all configured addresses in ARP filtering Message-ID: References: <20260222174445.743845-1-jmaloy@redhat.com> <20260222174445.743845-5-jmaloy@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="fKKzN38LY9O4HGnB" Content-Disposition: inline In-Reply-To: <20260222174445.743845-5-jmaloy@redhat.com> Message-ID-Hash: Y4WSYYJNK4LPBMYQJVPP47G7W6VQLABI X-Message-ID-Hash: Y4WSYYJNK4LPBMYQJVPP47G7W6VQLABI 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: --fKKzN38LY9O4HGnB Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Feb 22, 2026 at 12:44:36PM -0500, Jon Maloy wrote: > As a preparation for handling multiple addresses, we update ignore_arp() > to check against all addresses in the unified addrs[] array using the > for_each_addr() macro. >=20 > Signed-off-by: Jon Maloy > Reviewed-by: David Gibson The patch is correct, but it can be made slightly more elegant, see below. >=20 > --- > v3: Adapted to single-array changes earlier in this series > --- > arp.c | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) >=20 > diff --git a/arp.c b/arp.c > index 99a6a67..8beb2dd 100644 > --- a/arp.c > +++ b/arp.c > @@ -41,7 +41,7 @@ > static bool ignore_arp(const struct ctx *c, > const struct arphdr *ah, const struct arpmsg *am) > { > - struct inany_addr_entry *e =3D first_v4(c); > + const struct inany_addr_entry *e; > =20 > if (ah->ar_hrd !=3D htons(ARPHRD_ETHER) || > ah->ar_pro !=3D htons(ETH_P_IP) || > @@ -55,9 +55,10 @@ static bool ignore_arp(const struct ctx *c, > !memcmp(am->sip, am->tip, sizeof(am->sip))) > return true; > =20 > - /* Don't resolve the guest's assigned address, either. */ > - if (e && !memcmp(am->tip, inany_v4(&e->addr), sizeof(am->tip))) > - return true; > + /* Don't resolve any of the guest's addresses */ > + for_each_addr(e, c, AF_INET) > + if (!memcmp(am->tip, inany_v4(&e->addr), sizeof(am->tip))) > + return true; You can avoid the somewhat awkward for_each_addr(AF_INET) logic, by using inany_equals4() on *every* entry in the address array. The IPv6 addresses necessarily won't match. > return false; > } > --=20 > 2.52.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 --fKKzN38LY9O4HGnB Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmmlaWYACgkQzQJF27ox 2GfbrA/+JsbUBgvrgvZJeYtWVgMaeJsboZyuFRlXDH1KjTJDAx8maLBpxmDEOg0Q Tc70tO6OfZgpH6Qb29vWIvoqEepxfMTAC2x6+vOZoIY5aOTNRhjvPEeRxfcrIyBf nFAYxatx6lmQH4yOwgeiuiE0UzUmb+VuVc4PfHZXMOlChN4WkjOIVhCv7Srh8hsT rhE8KBvDREofIWufqOVA7svAvkZkkQb0hCVbSGUtk8PTlutBY8pMqiItDwIdGQBD eHoABB5JvR8YEwThBlS3pRZTAvOUXKG/Yq4Sq/22VWnFWtVh9GgRhElF5GEl8cwP d78zzYjFv3vxMbLwehjDRlhJ7DMj1SDQoHh9nAeHqgM49NUgDdq/hHn4iflonT5N eNq1ANuM0q/Gxwvxd5U8zY97ywuyRIagK419mWkrVhimm8AOJSLBb5VDfUOq8hPg UJCy3ehvkOewf2qJLAcwlPoaE3pWGmV9JYcFY1P4VgVPuC5J5NT7elJ7TyTnBWwV 3KzPxpAir/MGkk504EikM2VFCq5Bo8ISnQ0AjVzNpUk8r9PwBdnVvejzS1tPYsVN L6jXvAWdlZ1WyZAl+vmHXxgma3sgQPJQt3On8u4JG5CR+ebCauYIiA7FBt27+qeH wUCEn5cmcCt0SC0cEEG5Wt43owNrV2PxmEe+QJIEK7tsfg/nt+s= =NBNB -----END PGP SIGNATURE----- --fKKzN38LY9O4HGnB--