@@ -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;
}
@@ -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);
@@ -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);
@@ -70,6 +70,7 @@ enum neighbor_interface_type {
NEIGH_IFACE_BRIDGE,
NEIGH_IFACE_VXLAN,
NEIGH_IFACE_LOOPBACK,
+ NEIGH_IFACE_UNSPECIFIED,
};
struct neighbor_interface_monitor {
@@ -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(¬ifier->msgs, &change->neighbor);
}
}
@@ -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.
@@ -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) {
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 <amusil@redhat.com> --- 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(-)