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=202508 header.b=N84rB/Oh; dkim-atps=neutral Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id 3D30E5A0272 for ; Tue, 30 Sep 2025 02:56:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202508; t=1759193804; bh=xzrY+RmgqUfL1tqAIbozMoeA90P9mjlEGQEAl/BJVpY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=N84rB/Oha33zYoTr7LRAjL2Rb/zOa10gP6BGnGoRHRlYy11BAsAZCS2YbApEjcYrk oeKqREYm55SLL0ML7HWHn5DTeCeAq1fUDoYtVj0/hXHxMwyqFi+U8ZBaoJQygeZyVs 4C0LM40MPBz1GRu9Tp5EmhNPWsh1AZdckhqcyaGc9I52f4PLSgkhhl7u198+fcxHVG KUB6X66FYv+0HymU4A8yUrIZH+7RSWQhGfukUd2beaFmm67CfaIoAbwaySrDD94gD2 FbhfYVKkB13Z/YFnq0snF53E4cBdur3XMx1Kkam3Fe/jEJe1wZYLqnk/8hbz/ZMmO1 rldbG7jFlQkGQ== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4cbKQ45tp6z4w2S; Tue, 30 Sep 2025 10:56:44 +1000 (AEST) Date: Tue, 30 Sep 2025 10:52:53 +1000 From: David Gibson To: Stefano Brivio Subject: Re: [PATCH v11 2/9] fwd: Add cache table for ARP/NDP contents Message-ID: References: <20250927192522.3024554-1-jmaloy@redhat.com> <20250927192522.3024554-3-jmaloy@redhat.com> <20250930015842.68341327@elisabeth> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="7k6H5kJNEybrvjQ/" Content-Disposition: inline In-Reply-To: <20250930015842.68341327@elisabeth> Message-ID-Hash: 3OJAZSQWTBCGBQIA7J4SNCHOBLYTJIPI X-Message-ID-Hash: 3OJAZSQWTBCGBQIA7J4SNCHOBLYTJIPI 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: Jon Maloy , 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: --7k6H5kJNEybrvjQ/ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Sep 30, 2025 at 01:58:42AM +0200, Stefano Brivio wrote: > Almost entirely nitpicks here: >=20 > On Sat, 27 Sep 2025 15:25:15 -0400 > Jon Maloy wrote: >=20 > > We add a cache table to keep track of the contents of the kernel ARP > > and NDP tables. The table is fed from the just introduced netlink based > > neigbour subscription function. The new table eliminates the need for > > explicit netlink calls to find a host's MAC address. > >=20 > > Signed-off-by: Jon Maloy [snip] > > + const union inany_addr *key) > > +{ > > + struct siphash_state st =3D SIPHASH_INIT(c->hash_secret); > > + uint32_t i; > > + > > + inany_siphash_feed(&st, key); > > + i =3D siphash_final(&st, sizeof(*key), 0); > > + > > + return ((size_t)i) & (NEIGH_TABLE_SIZE - 1); > > +} > > + > > +/** > > + * fwd_neigh_table_find() - Find a MAC table entry >=20 > Strictly speaking, it's a MAC address table -- MAC refers to the access > control itself. I mean, it's both. The entries are our neighbours and the contents of each entry is the MAC address. [snip] > > +void fwd_neigh_table_free(const struct ctx *c, const union inany_addr = *addr) > > +{ > > + ssize_t slot =3D neigh_table_slot(c, addr); > > + struct neigh_table *t =3D &neigh_table; > > + struct neigh_table_entry *e, **prev; > > + > > + prev =3D &t->slots[slot]; > > + e =3D t->slots[slot]; > > + while (e && !inany_equals(&e->addr, addr)) { > > + prev =3D &e->next; > > + e =3D e->next; > > + } > > + if (!e) > > + return; > > + > > + *prev =3D e->next; > > + e->next =3D t->free; > > + t->free =3D e; > > + memset(&e->addr, 0, sizeof(*addr)); > > + memset(e->mac, 0, ETH_ALEN); >=20 > Do we care about zeroing them? If we do because we might find those > entries, note that both all-zero MAC address and IP addresses are > valid. In the case of IP addresses, while all-zero is valid in certain contexts, I'd argue it's never a valid address for a neighbour ("this host on this network" is frustratingly vague, but pretty clearly not a neighbour). 255.255.255.255 would also make a reasonable placeholder if we must have one. For MAC addresses, ff:ff:ff:ff:ff:ff would probably make a better placeholder, if we must have one. --=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 --7k6H5kJNEybrvjQ/ Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmjbKeQACgkQzQJF27ox 2Gd05w/+McBwOnNuheDBsnjm0kqQlqxwIMep8YNjA8RhdkSIJm7F0+OvlwwotDt9 +CvrMezi/v4W3A+QCtJ2PN3+ikaVhkOuWSywTi0B3XzFbsmiZeF6I2C3uU4PUAWF plUxDq3prMd0EclG71Dpqod6E7gzS/z6Z2cjfp9QkLRhP3DZD6XaARJt6fyoaqku mvQaDCNnu38O7OdtJUiycoVrtvRKbKncNVO8ZRl/FKUfBQE8X5UCiVcL4VMxOw/n ngAnT7PwnzehSaVMLKhvKQPPHo8O0GeKEThwp1n1ANqqIubqumNOonhROYwEiU7L ZDjcUJjeAEeln9XuLQIddfxh+Al2uzRWuEIMS9Z9YG9NLd9l+GdYQDLsqeIsRLR0 2eNy6t0wbZbsiC2DPWrug7LWeMRdsltB162KKO5CqWeoi5xLpN1bUecYmlFSnVpb SCmScWJ1r/5/fkPeFsgksrzFCSYiPtUQ2cWTAqrseHpwj2o7FSXIwr+jiPOmn554 bZY5h8f4hFXtTDb7YGSLOaoy68oTpQrcBY/Ih9rZ8rbno9vjBJxR0IFiObcB46oY +QYdvVNxGyoVKC6rwabhxMmj97K43wdw5pXrV4Xn+IeYEb8txJVteq2Qd75NXJW4 M95NfMrf/hktVRbuomrn+7Z/LuwIV4926ZH5zmAOutaZfVGunrA= =ZFp4 -----END PGP SIGNATURE----- --7k6H5kJNEybrvjQ/--