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.") Tested-by: Phillip Dale <[email protected]> Signed-off-by: Ales Musil <[email protected]> Signed-off-by: Dumitru Ceara <[email protected]> (cherry picked from commit 8e43eac0b392246081ddbda669b2ff5349849812) --- controller/neighbor-exchange-netlink.c | 12 +++++++++--- controller/neighbor-exchange-netlink.h | 5 ++++- controller/neighbor-exchange.c | 6 ++++-- controller/neighbor-table-notify.c | 2 +- controller/neighbor.h | 1 + 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 812c146f4..ba6d1bd4a 100644 --- a/controller/neighbor-exchange-netlink.c +++ b/controller/neighbor-exchange-netlink.c @@ -58,6 +58,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); @@ -85,6 +88,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) { @@ -104,6 +108,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); @@ -165,10 +170,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: @@ -365,7 +371,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 6d907938e..fb1219e52 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 { @@ -50,10 +51,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 e40f39e24..c6a875d03 100644 --- a/controller/neighbor-exchange.c +++ b/controller/neighbor-exchange.c @@ -90,8 +90,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; @@ -134,6 +134,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(); } neighbor_table_add_watch_request(&n_ctx_out->neighbor_table_watches, diff --git a/controller/neighbor-table-notify.c b/controller/neighbor-table-notify.c index a0571ba05..931e780c3 100644 --- a/controller/neighbor-table-notify.c +++ b/controller/neighbor-table-notify.c @@ -244,7 +244,7 @@ neighbor_table_change(const void *change_, void *aux OVS_UNUSED) return; } - if (!ne_is_ovn_owned(&change->nd)) { + if (!ne_is_ovn_owned(&change->nd, NEIGH_IFACE_UNSPECIFIED)) { if (find_watch_entry_by_if_index(change->nd.if_index)) { any_neighbor_table_changed = true; } 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/tests/system-ovn.at b/tests/system-ovn.at index d4d9eed66..5363ed925 100644 --- a/tests/system-ovn.at +++ b/tests/system-ovn.at @@ -18607,6 +18607,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 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 d795061ef..c5b8ec202 100644 --- a/tests/test-ovn-netlink.c +++ b/tests/test-ovn-netlink.c @@ -87,8 +87,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
