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=GzoQT6WK; dkim-atps=neutral Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id 6D4545A0271 for ; Mon, 29 Sep 2025 06:08:38 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202508; t=1759118915; bh=fpbePCmUgpLkwPUzA4VdeAwiHBK9wIVM7s+PB//FD6Q=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=GzoQT6WKw1r4Xf6FflxM7BN5XM+qq3hbKOT9bMwPNP4Wp8dC/JYvy+2Pt/lRCAmqB Otvsw3/OmMIdYlDxN6XAuaNHLVvZ4M9K7gda4TNOKFdN06TU+rkL7xcefQsMbz+HJV u+276oZJPkKWISXTAz3D0gh0JHm+3kJZNzudZOnemkRSDsH+al0/VLx7sNhUZdcbPq AQSpk5K4ew1c2NZ0cGNod3PnAPJ8OjXevmr/5oWCSIkoQmVZBBqTSV9NXu3Bn1z2hz ukbHkO0E9BN5M8lvl+SGPCJiaGToNTLjp7puz1uxQ5i841l8srse1eYS1U3/ZB7AS3 6yOT7q2dHzwJw== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4cZnjv1vyZz4wC3; Mon, 29 Sep 2025 14:08:35 +1000 (AEST) Date: Mon, 29 Sep 2025 14:03:03 +1000 From: David Gibson To: Jon Maloy Subject: Re: [PATCH v9 9/9] arp/ndp: send gratuitous ARP / unsolicitated NA when MAC cache entry added Message-ID: References: <20250924011330.1168921-1-jmaloy@redhat.com> <20250924011330.1168921-10-jmaloy@redhat.com> <5dda48fc-d854-436d-acd1-734d461efd59@redhat.com> <702508a5-2853-4aad-b527-63d47b9f5988@redhat.com> <38e13c6a-36cf-40ae-bbad-0f2848b78147@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="Dwy2XUeTG516yEgW" Content-Disposition: inline In-Reply-To: Message-ID-Hash: IJJB26NCL27AXHD5Y67Y4W5LDEZHVCLF X-Message-ID-Hash: IJJB26NCL27AXHD5Y67Y4W5LDEZHVCLF 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: --Dwy2XUeTG516yEgW Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Sep 26, 2025 at 06:59:40PM -0400, Jon Maloy wrote: >=20 >=20 > On 2025-09-25 20:47, David Gibson wrote: > > On Thu, Sep 25, 2025 at 08:48:51AM -0400, Jon Maloy wrote: > > >=20 > > >=20 > > > On 2025-09-25 02:38, David Gibson wrote: > > > > On Wed, Sep 24, 2025 at 07:32:43PM -0400, Jon Maloy wrote: > > > > >=20 > > > > >=20 > > > > > On 2025-09-24 18:18, Jon Maloy wrote: > > > > > >=20 > > > > > >=20 > > > > > > On 2025-09-23 23:22, David Gibson wrote: > > > > > > > On Tue, Sep 23, 2025 at 09:13:30PM -0400, Jon Maloy wrote: > > > > >=20 > > > > > [...] > > > > >=20 > > > > > > > > --- a/fwd.c > > > > > > > > +++ b/fwd.c > > > > > > > > @@ -26,6 +26,8 @@ > > > > > > > > =A0 #include "passt.h" > > > > > > > > =A0 #include "lineread.h" > > > > > > > > =A0 #include "flow_table.h" > > > > > > > > +#include "arp.h" > > > > > > > > +#include "ndp.h" > > > > > > > > =A0 /* Empheral port range: values from RFC 6335 */ > > > > > > > > =A0 static in_port_t fwd_ephemeral_min =3D (1 << 15) + (1= << 14); > > > > > > > > @@ -129,6 +131,15 @@ void fwd_neigh_mac_cache_alloc(const s= truct ctx *c, > > > > > > > > =A0=A0=A0=A0=A0 memcpy(&e->addr, addr, sizeof(*addr)); > > > > > > > > =A0=A0=A0=A0=A0 memcpy(e->mac, mac, ETH_ALEN); > > > > > > > > + > > > > > > > > +=A0=A0=A0 /* Send gratuitous ARP / unsolicited NA for the = new mapping */ > > > > > > >=20 > > > > > > > AFAICT this doesn't actually implement what the commit message > > > > > > > describes - it seems to always send an ARP/NA when the neighb= our table > > > > > > > is updated. > > > > >=20 > > > > > No. Check the code again. > > > >=20 > > > > Still not seeing it, I'm going to need a more specific pointer to w= hat > > > > I've missed. > > > >=20 > > > Look in fwd_neigh_mac_cache_alloc(). > > > If the entry already exists, the function updates the mac address jus= t to be > > > on the safe side, but then returns without sending any ARP/NA. > >=20 > > Uh... no, no it doesn't. I applied all the patches on a branch and > > here's what I see in fwd_neigh_mac_cache_alloc(): > >=20 > > memcpy(&e->addr, addr, sizeof(*addr)); > > memcpy(e->mac, mac, ETH_ALEN); > >=20 > > /* Send gratuitous ARP / unsolicited NA for the new mapping */ > > if (inany_v4(addr)) { > > struct in_addr ip4 =3D *inany_v4(addr); > >=20 > > arp_send_gratuitous(c, ip4, e->mac); > > } else { > > ndp_send_unsolicited_na(c, &addr->a6); > > } > >=20 > > If it updates, it ARPs. Do you have something in your tree that > > didn't make it into the published patches? > >=20 >=20 > This was introduced already in patch #1, not #9. > The final function looks like this: >=20 > void fwd_neigh_mac_cache_alloc(const struct ctx *c, > const union inany_addr *addr, > uint8_t *mac) >=20 > { > struct mac_cache_table *t =3D &mac_cache; > struct mac_cache_entry *e; > ssize_t idx; >=20 > /* MAC address might change sometimes */ > e =3D fwd_mac_cache_find(c, addr); > if (e) { > memcpy(e->mac, mac, ETH_ALEN); > =3D=3D=3D=3D> return; Ah, yes, sorry. --=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 --Dwy2XUeTG516yEgW Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmjaBOcACgkQzQJF27ox 2GczXA//dRrzRjZoqy+uo0npEL7eZW5z8Sz6HDF1GD7qlROL9Pt4nr7t570jjnu7 F9QgcQ8jDbHVbEs83M7q5pMTryqxt9phXZxw8pjDaoixLhFKv5aDGMwvhLd87Ipg KXZ4OcbI9OzrqoJlAkQIT/x9p0sPrPwkYfmovfpgRyjDW1NmP1vQpah6F3vsEEVw xxGtHJ3U2cePkR33OaVDEtL3Pc6wxWgQ3qWQdDlQxOqaqs3TfWfh/FHcYTSG680h 1tRBhw8MPvPA6QLgZsP9dwXP8YqqnBPixo2pqfSnCaz9Bg1k/7DpYcOcNUwWfYEp 1hbJExbzX87WmDVJV4032mcXWO7c/jgTzvZ6S8aa0rs1KjKWa5iDef4vemeYWJ0O wU3C6JFnJVCLcYnDD0uQpjpZoFZJrUBfUI6a1VlhYl0PXLxo3mXV8pm2fK6VCJjG aZRyR9+Lr8BGiXJArmiQTTZgBUwwQSmD2y1T+ngknTeBsdbf5FTXTspyXXw5auu+ 9KbIso1JDzVRZgrAv7CuNUPHaAXX2i72NtPLDWty4SD8d/xQhIZooYrF47RtfBb7 iLAaiyqhUzSQmt3CbO/oZtRef1F5IYPOSoBg163MyJVdlC2AqlWFKSgHFCmLz/sK AV93HBhFMADYb7OBoqow72uy0zVbzWB75bjGWygcTaKQxydMh40= =fKUa -----END PGP SIGNATURE----- --Dwy2XUeTG516yEgW--