Netdev List
 help / color / mirror / Atom feed
From: Ido Schimmel <idosch@nvidia.com>
To: Daniel Borkmann <daniel@iogearbox.net>
Cc: netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org,
	pabeni@redhat.com, edumazet@google.com, horms@kernel.org,
	donald.hunter@gmail.com, petrm@nvidia.com, razor@blackwall.org
Subject: Re: [PATCH net-next 1/2] neighbor: Add NTF_EXT_VALIDATED flag for externally validated entries
Date: Tue, 17 Jun 2025 17:09:38 +0300	[thread overview]
Message-ID: <aFF3IkVNCPANpSM7@shredder> (raw)
In-Reply-To: <08c51b7a-0e6d-45b4-81a3-cb3062eb855d@iogearbox.net>

On Fri, Jun 13, 2025 at 10:23:26AM +0200, Daniel Borkmann wrote:
> Hi Ido,

Hi Daniel,

> On 6/11/25 4:15 PM, Ido Schimmel wrote:
> > In the above scheme, when the control plane (e.g., FRR) advertises a
> > neighbor entry with a proxy indication, it expects the corresponding
> > entry in the data plane (i.e., the kernel) to remain valid and not be
> > removed due to garbage collection. The control plane also expects the
> > kernel to notify it if the entry was learned locally (i.e., became
> > "reachable") so that it will remove the proxy indication from the EVPN
> > MAC/IP advertisement route. That is why these entries cannot be
> > programmed with dummy states such as "permanent" or "noarp".
> 
> Meaning, in contrast to "permanent" the initial user-provided lladdr
> can still be updated by the kernel if it learned that there was a
> migration, right?

Yes. In addition, user space will be notified when the kernel locally
learns the entry. FRR installs such entries as "stale" and a
notification will be emitted when they transition to "reachable".

> > Instead, add a new neighbor flag ("extern_valid") which indicates that
> > the entry was learned and determined to be valid externally and should
> > not be removed or invalidated by the kernel. The kernel can probe the
> > entry and notify user space when it becomes "reachable". However, if the
> > kernel does not receive a confirmation, have it return the entry to the
> > "stale" state instead of the "failed" state.
> > 
> > In other words, an entry marked with the "extern_valid" flag behaves
> > like any other dynamically learned entry other than the fact that the
> > kernel cannot remove or invalidate it.
> 
> How is the expected neigh_flush_dev() behavior? I presume in that case if
> the neigh entry is in use and was NUD_STALE then we go into NUD_NONE state
> right? (Asking as NUD_PERMANENT skips all that and whether that should be
> similar or not for NTF_EXT_VALIDATED?)

Currently, unlike "permanent" entries, such entries will be flushed when
the interface loses its carrier. Given the description of "[...] behaves
like any other dynamically learned entry other than the fact that the
kernel cannot remove or invalidate it" I think it makes sense to not
flush such entries when the carrier goes down.

Like "permanent" entries, such entries will be flushed when the
interface is put administratively down or when its MAC changes, both of
which are user initiated actions.

IOW, I will squash the following diff and add test cases.

 static void neigh_flush_dev(struct neigh_table *tbl, struct net_device *dev,
-                           bool skip_perm)
+                           bool skip_perm_ext_valid)
 {
        struct hlist_head *dev_head;
        struct hlist_node *tmp;
@@ -378,7 +388,9 @@ static void neigh_flush_dev(struct neigh_table *tbl, struct net_device *dev,
        dev_head = neigh_get_dev_table(dev, tbl->family);
 
        hlist_for_each_entry_safe(n, tmp, dev_head, dev_list) {
-               if (skip_perm && n->nud_state & NUD_PERMANENT)
+               if (skip_perm_ext_valid &&
+                   (n->nud_state & NUD_PERMANENT ||
+                    n->flags & NTF_EXT_VALIDATED))
                        continue;
 
                hlist_del_rcu(&n->hash);
@@ -419,10 +431,10 @@ void neigh_changeaddr(struct neigh_table *tbl, struct net_device *dev)
 EXPORT_SYMBOL(neigh_changeaddr);
 
 static int __neigh_ifdown(struct neigh_table *tbl, struct net_device *dev,
-                         bool skip_perm)
+                         bool skip_perm_ext_valid)
 {
        write_lock_bh(&tbl->lock);
-       neigh_flush_dev(tbl, dev, skip_perm);
+       neigh_flush_dev(tbl, dev, skip_perm_ext_valid);
        pneigh_ifdown_and_unlock(tbl, dev);
        pneigh_queue_purge(&tbl->proxy_queue, dev ? dev_net(dev) : NULL,
                           tbl->family);

  reply	other threads:[~2025-06-17 14:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-11 14:15 [PATCH net-next 0/2] Add support for externally validated neighbor entries Ido Schimmel
2025-06-11 14:15 ` [PATCH net-next 1/2] neighbor: Add NTF_EXT_VALIDATED flag for externally validated entries Ido Schimmel
2025-06-12 10:26   ` Nikolay Aleksandrov
2025-06-13  8:23   ` Daniel Borkmann
2025-06-17 14:09     ` Ido Schimmel [this message]
2025-06-17 14:21       ` Daniel Borkmann
2025-06-14 17:13   ` Simon Horman
2025-06-11 14:15 ` [PATCH net-next 2/2] selftests: net: Add a selftest for externally validated neighbor entries Ido Schimmel
2025-06-12 10:26   ` Nikolay Aleksandrov
2025-06-14 17:11   ` Simon Horman

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=aFF3IkVNCPANpSM7@shredder \
    --to=idosch@nvidia.com \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=donald.hunter@gmail.com \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=petrm@nvidia.com \
    --cc=razor@blackwall.org \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox