From: Jon Maloy <jmaloy@redhat.com>
To: David Gibson <david@gibson.dropbear.id.au>
Cc: sbrivio@redhat.com, dgibson@redhat.com, passt-dev@passt.top
Subject: Re: [PATCH v9 9/9] arp/ndp: send gratuitous ARP / unsolicitated NA when MAC cache entry added
Date: Fri, 26 Sep 2025 18:59:40 -0400 [thread overview]
Message-ID: <c3874193-2126-4c18-a8c8-fc7c60d91861@redhat.com> (raw)
In-Reply-To: <aNXik3CtafNgTQ2i@zatzit>
On 2025-09-25 20:47, David Gibson wrote:
> On Thu, Sep 25, 2025 at 08:48:51AM -0400, Jon Maloy wrote:
>>
>>
>> On 2025-09-25 02:38, David Gibson wrote:
>>> On Wed, Sep 24, 2025 at 07:32:43PM -0400, Jon Maloy wrote:
>>>>
>>>>
>>>> On 2025-09-24 18:18, Jon Maloy wrote:
>>>>>
>>>>>
>>>>> On 2025-09-23 23:22, David Gibson wrote:
>>>>>> On Tue, Sep 23, 2025 at 09:13:30PM -0400, Jon Maloy wrote:
>>>>
>>>> [...]
>>>>
>>>>>>> --- a/fwd.c
>>>>>>> +++ b/fwd.c
>>>>>>> @@ -26,6 +26,8 @@
>>>>>>> #include "passt.h"
>>>>>>> #include "lineread.h"
>>>>>>> #include "flow_table.h"
>>>>>>> +#include "arp.h"
>>>>>>> +#include "ndp.h"
>>>>>>> /* Empheral port range: values from RFC 6335 */
>>>>>>> static in_port_t fwd_ephemeral_min = (1 << 15) + (1 << 14);
>>>>>>> @@ -129,6 +131,15 @@ void fwd_neigh_mac_cache_alloc(const struct ctx *c,
>>>>>>> memcpy(&e->addr, addr, sizeof(*addr));
>>>>>>> memcpy(e->mac, mac, ETH_ALEN);
>>>>>>> +
>>>>>>> + /* Send gratuitous ARP / unsolicited NA for the new mapping */
>>>>>>
>>>>>> AFAICT this doesn't actually implement what the commit message
>>>>>> describes - it seems to always send an ARP/NA when the neighbour table
>>>>>> is updated.
>>>>
>>>> No. Check the code again.
>>>
>>> Still not seeing it, I'm going to need a more specific pointer to what
>>> I've missed.
>>>
>> Look in fwd_neigh_mac_cache_alloc().
>> If the entry already exists, the function updates the mac address just to be
>> on the safe side, but then returns without sending any ARP/NA.
>
> 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():
>
> memcpy(&e->addr, addr, sizeof(*addr));
> memcpy(e->mac, mac, ETH_ALEN);
>
> /* Send gratuitous ARP / unsolicited NA for the new mapping */
> if (inany_v4(addr)) {
> struct in_addr ip4 = *inany_v4(addr);
>
> arp_send_gratuitous(c, ip4, e->mac);
> } else {
> ndp_send_unsolicited_na(c, &addr->a6);
> }
>
> If it updates, it ARPs. Do you have something in your tree that
> didn't make it into the published patches?
>
This was introduced already in patch #1, not #9.
The final function looks like this:
void fwd_neigh_mac_cache_alloc(const struct ctx *c,
const union inany_addr *addr,
uint8_t *mac)
{
struct mac_cache_table *t = &mac_cache;
struct mac_cache_entry *e;
ssize_t idx;
/* MAC address might change sometimes */
e = fwd_mac_cache_find(c, addr);
if (e) {
memcpy(e->mac, mac, ETH_ALEN);
====> return;
}
e = t->free;
if (!e)
return;
t->free = e->next;
idx = fwd_mac_cache_slot_idx(c, addr);
e->next = t->slots[idx];
t->slots[idx] = e;
memcpy(&e->addr, addr, sizeof(*addr));
memcpy(e->mac, mac, ETH_ALEN);
/* Send gratuitous ARP / unsolicited NA for the new mapping */
if (inany_v4(addr)) {
struct in_addr ip4 = *inany_v4(addr);
arp_send_gratuitous(c, ip4, e->mac);
} else {
ndp_send_unsolicited_na(c, &addr->a6);
}
}
next prev parent reply other threads:[~2025-09-26 22:59 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-24 1:13 [PATCH v9 0/9] Use true MAC address of LAN local remote hosts Jon Maloy
2025-09-24 1:13 ` [PATCH v9 1/9] netlink: add subsciption on changes in NDP/ARP table Jon Maloy
2025-09-24 2:47 ` David Gibson
2025-09-24 3:34 ` David Gibson
2025-09-24 18:40 ` Jon Maloy
2025-09-25 6:42 ` David Gibson
2025-09-24 1:13 ` [PATCH v9 2/9] fwd: Add cache table for ARP/NDP contents Jon Maloy
2025-09-24 3:03 ` David Gibson
2025-09-24 18:54 ` Jon Maloy
2025-09-24 1:13 ` [PATCH v9 3/9] arp/ndp: respond with true MAC address of LAN local remote hosts Jon Maloy
2025-09-24 1:13 ` [PATCH v9 4/9] flow: add MAC address of LAN local remote hosts to flow Jon Maloy
2025-09-24 1:13 ` [PATCH v9 5/9] udp: forward external source MAC address through tap interface Jon Maloy
2025-09-24 1:13 ` [PATCH v9 6/9] tcp: " Jon Maloy
2025-09-24 1:13 ` [PATCH v9 7/9] tap: change signature of function tap_push_l2h() Jon Maloy
2025-09-24 1:13 ` [PATCH v9 8/9] icmp: let icmp use mac address from flowside structure Jon Maloy
2025-09-24 1:13 ` [PATCH v9 9/9] arp/ndp: send gratuitous ARP / unsolicitated NA when MAC cache entry added Jon Maloy
2025-09-24 3:22 ` David Gibson
2025-09-24 22:18 ` Jon Maloy
2025-09-24 23:32 ` Jon Maloy
2025-09-25 6:38 ` David Gibson
2025-09-25 12:48 ` Jon Maloy
2025-09-26 0:47 ` David Gibson
2025-09-26 22:59 ` Jon Maloy [this message]
2025-09-29 4:03 ` David Gibson
2025-09-25 6:36 ` David Gibson
2025-09-25 13:14 ` Jon Maloy
2025-09-26 0:55 ` David Gibson
2025-09-26 23:05 ` Jon Maloy
2025-09-29 4:04 ` David Gibson
2025-09-26 23:25 ` Jon Maloy
2025-09-27 19:32 ` Jon Maloy
2025-09-29 4:08 ` David Gibson
2025-09-29 22:23 ` Stefano Brivio
2025-09-30 0:15 ` David Gibson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c3874193-2126-4c18-a8c8-fc7c60d91861@redhat.com \
--to=jmaloy@redhat.com \
--cc=david@gibson.dropbear.id.au \
--cc=dgibson@redhat.com \
--cc=passt-dev@passt.top \
--cc=sbrivio@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://passt.top/passt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).