When we migrate entries from one chassis to another the destination
could have the same entry populated by FRR on vxlan as ext_learned.
If FRR doesn't remove it before we attempt to add the local one
on loopback interface it will carry over the ext_learned flag to
loopback as the change is viewed as move from one interface to
another. This causes issues as ovn-controller will not remove
that particular entry when it's supposed to be gone due to the
filtering.

To prevent that consider even ext_learned static entries on
the loopback to be ovn owned. This will ensure that we remove
the entry properly if needed.

Reported-at: 
https://mail.openvswitch.org/pipermail/ovs-discuss/2026-October/054057.html
Fixes: ad3a0a55b551 ("controller: Support monitoring/updating neighbor entries 
through Netlink.")
Signed-off-by: Ales Musil <[email protected]>
---
 controller/neighbor-exchange-netlink.c | 12 +++++++++---
 controller/neighbor-exchange-netlink.h |  5 ++++-
 controller/neighbor-exchange.c         |  6 ++++--
 controller/neighbor.h                  |  1 +
 controller/ovn-netlink-notifier.c      |  2 +-
 tests/system-ovn.at                    |  8 ++++++++
 tests/test-ovn-netlink.c               |  4 ++--
 7 files changed, 29 insertions(+), 9 deletions(-)

diff --git a/controller/neighbor-exchange-netlink.c 
b/controller/neighbor-exchange-netlink.c
index c6b21e7a2..942dee147 100644
--- a/controller/neighbor-exchange-netlink.c
+++ b/controller/neighbor-exchange-netlink.c
@@ -64,6 +64,9 @@ struct ne_msg_handle_data {
 
     /* Stores 'struct advertise_neighbor_entry'. */
     const struct hmap *neighbors;
+
+    /* Interface type. */
+    enum neighbor_interface_type type;
 };
 
 static void handle_ne_msg(const struct ne_table_msg *, void *data);
@@ -91,6 +94,7 @@ static int ne_nl_del_neigh(int32_t if_index, uint8_t family,
  * Returns 0 on success, errno on failure. */
 int
 ne_nl_sync_neigh(uint8_t family, int32_t if_index,
+                 enum neighbor_interface_type type,
                  const struct hmap *neighbors,
                  struct vector *learned_neighbors)
 {
@@ -110,6 +114,7 @@ ne_nl_sync_neigh(uint8_t family, int32_t if_index,
         .learned_neighbors = learned_neighbors,
         .stale_neighbors = &stale_neighbors,
         .neighbors = neighbors,
+        .type = type,
     };
     ne_table_dump_one_ifindex(family, if_index, handle_ne_msg, &data);
 
@@ -171,10 +176,11 @@ ne_nl_sync_neigh(uint8_t family, int32_t if_index,
 /* OVN expects all static entries added on this ifindex to be OVN-owned.
  * Everything else must be learnt. */
 bool
-ne_is_ovn_owned(const struct ne_nl_received_neigh *nd)
+ne_is_ovn_owned(const struct ne_nl_received_neigh *nd,
+                enum neighbor_interface_type type)
 {
     return !(nd->state & NUD_PERMANENT) && (nd->state & NUD_NOARP)
-           && !(nd->flags & NTF_EXT_LEARNED);
+           && (type == NEIGH_IFACE_LOOPBACK || !(nd->flags & NTF_EXT_LEARNED));
 }
 
 /* OVN expects that the VTEP entry either:
@@ -380,7 +386,7 @@ handle_ne_msg(const struct ne_table_msg *msg, void *data)
         return;
     }
 
-    if (!ne_is_ovn_owned(nd)) {
+    if (!ne_is_ovn_owned(nd, handle_data->type)) {
         if (!handle_data->learned_neighbors) {
             return;
         }
diff --git a/controller/neighbor-exchange-netlink.h 
b/controller/neighbor-exchange-netlink.h
index 659fe72d8..0b2dd4199 100644
--- a/controller/neighbor-exchange-netlink.h
+++ b/controller/neighbor-exchange-netlink.h
@@ -22,6 +22,7 @@
 #include "openvswitch/hmap.h"
 #include "openvswitch/ofpbuf.h"
 
+#include "neighbor.h"
 #include "vec.h"
 
 struct ne_nl_received_neigh {
@@ -51,10 +52,12 @@ struct ne_table_msg {
 };
 
 int ne_nl_sync_neigh(uint8_t family, int32_t if_index,
+                     enum neighbor_interface_type type,
                      const struct hmap *neighbors,
                      struct vector *learned_neighbors);
 
-bool ne_is_ovn_owned(const struct ne_nl_received_neigh *nd);
+bool ne_is_ovn_owned(const struct ne_nl_received_neigh *nd,
+                     enum neighbor_interface_type type);
 bool ne_is_valid_remote_vtep(struct ne_nl_received_neigh *ne);
 bool ne_is_valid_static_fdb(struct ne_nl_received_neigh *ne);
 bool ne_is_valid_static_arp(struct ne_nl_received_neigh *ne);
diff --git a/controller/neighbor-exchange.c b/controller/neighbor-exchange.c
index 43626cc21..df54969fb 100644
--- a/controller/neighbor-exchange.c
+++ b/controller/neighbor-exchange.c
@@ -89,8 +89,8 @@ neighbor_exchange_run(const struct neighbor_exchange_ctx_in 
*n_ctx_in,
         struct vector received_neighbors =
             VECTOR_EMPTY_INITIALIZER(struct ne_nl_received_neigh);
         SET_NEIGHBOR_EXCHANGE_NL_STATUS(
-            ne_nl_sync_neigh(nim->family, if_index, &nim->announced_neighbors,
-                             &received_neighbors)
+            ne_nl_sync_neigh(nim->family, if_index, nim->type,
+                             &nim->announced_neighbors, &received_neighbors)
         );
 
         struct ne_nl_received_neigh *ne;
@@ -133,6 +133,8 @@ neighbor_exchange_run(const struct neighbor_exchange_ctx_in 
*n_ctx_in,
         case NEIGH_IFACE_LOOPBACK:
             /* No learning from the loopback interface required. */
             break;
+        case NEIGH_IFACE_UNSPECIFIED:
+            OVS_NOT_REACHED();
         }
 
         vector_push(n_ctx_out->neighbor_table_watches, &if_index);
diff --git a/controller/neighbor.h b/controller/neighbor.h
index cd158a0f1..6243a9e31 100644
--- a/controller/neighbor.h
+++ b/controller/neighbor.h
@@ -70,6 +70,7 @@ enum neighbor_interface_type {
     NEIGH_IFACE_BRIDGE,
     NEIGH_IFACE_VXLAN,
     NEIGH_IFACE_LOOPBACK,
+    NEIGH_IFACE_UNSPECIFIED,
 };
 
 struct neighbor_interface_monitor {
diff --git a/controller/ovn-netlink-notifier.c 
b/controller/ovn-netlink-notifier.c
index c772bdb7c..9e0ba129a 100644
--- a/controller/ovn-netlink-notifier.c
+++ b/controller/ovn-netlink-notifier.c
@@ -169,7 +169,7 @@ ovn_netlink_neighbor_change_handler(const void *change_, 
void *aux)
 
     const union ovn_notifier_msg_change *change = change_;
 
-    if (!ne_is_ovn_owned(&change->neighbor.nd)) {
+    if (!ne_is_ovn_owned(&change->neighbor.nd, NEIGH_IFACE_UNSPECIFIED)) {
         vector_push(&notifier->msgs, &change->neighbor);
     }
 }
diff --git a/tests/system-ovn.at b/tests/system-ovn.at
index 3cb4b858a..82e99b3d0 100644
--- a/tests/system-ovn.at
+++ b/tests/system-ovn.at
@@ -18490,6 +18490,14 @@ f0:00:0f:16:01:20 dev $LO_NAME master $BR_NAME static
 f0:00:0f:16:01:20 dev $LO_NAME vlan 1 master $BR_NAME static
 ])
 
+# Simulate workload externally added workload to lo.
+check bridge fdb add f0:00:ef:16:10:10 dev $LO_NAME master static
+check bridge fdb add f0:00:ef:16:10:20 dev $LO_NAME master extern_learn
+check bridge fdb replace f0:00:ef:16:10:20 dev $LO_NAME master static
+
+OVS_WAIT_FOR_OUTPUT_UNQUOTED([bridge fdb show | grep $LO_NAME | grep 
"f0:00:ef:16:10:" | sort], [0], [dnl
+])
+
 AS_BOX([L2 EVPN learned FDB advertising])
 
 # Add a port with "unknown" addresses and FDB learning enabled.
diff --git a/tests/test-ovn-netlink.c b/tests/test-ovn-netlink.c
index f75a6f295..b944a5184 100644
--- a/tests/test-ovn-netlink.c
+++ b/tests/test-ovn-netlink.c
@@ -88,8 +88,8 @@ test_neighbor_sync(struct ovs_cmdl_context *ctx)
                     advertise_neigh_hash(&ane->lladdr, &ane->addr));
     }
 
-    ovs_assert(ne_nl_sync_neigh(family, if_index, &neighbors_to_add,
-                                &received_neighbors) == 0);
+    ovs_assert(ne_nl_sync_neigh(family, if_index, NEIGH_IFACE_UNSPECIFIED,
+                                &neighbors_to_add, &received_neighbors) == 0);
 
     struct ne_nl_received_neigh *ne;
     VECTOR_FOR_EACH_PTR (&received_neighbors, ne) {
-- 
2.56.0

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to