When deleting ports with BFD sessions without removing the BFD
northbound object northd will crash after recalculating because the
southbound BFD object does get removed when all ports are deleted.

Fix by checking for the southbound objects existence for stale BFD
entries before attempting to delete them.

Reported-at: https://redhat.atlassian.net/browse/FDP-4218
Fixes: 15c9c9f42 ("northd: Add bfd, static_routes, route_policies and bfd_sync 
nodes
  to I-P engine.")
Signed-off-by: Jacob Tanenbaum <[email protected]>

diff --git a/northd/northd.c b/northd/northd.c
index 8cd85a328..05eef9e4b 100644
--- a/northd/northd.c
+++ b/northd/northd.c
@@ -11872,7 +11872,7 @@ bfd_table_sync(struct ovsdb_idl_txn *ovnsb_txn,
     }
 
     HMAP_FOR_EACH_POP (bfd_e, hmap_node, &sync_bfd_connections) {
-        if (bfd_e->stale) {
+        if (bfd_e->stale && bfd_e->sb_bt) {
             sbrec_bfd_delete(bfd_e->sb_bt);
         }
         bfd_erase_entry(bfd_e);
diff --git a/tests/ovn-northd.at b/tests/ovn-northd.at
index 13400ff5e..57a6289d6 100644
--- a/tests/ovn-northd.at
+++ b/tests/ovn-northd.at
@@ -4459,6 +4459,12 @@ check as northd ovn-appctl -t ovn-northd 
inc-engine/clear-stats
 bfd_route_policy_uuid=$(fetch_column nb:bfd _uuid logical_port=r0-sw9)
 AT_CHECK([ovn-nbctl list logical_router_policy | sed s/,//g | grep -q 
"$bfd_route_policy_uuid"])
 
+# Check that the logical router port can be deleted and the bfd
+# calculation does not crash northd.
+check ovn-nbctl lrp-del r0-sw2
+check ovn-nbctl --wait=sb sync
+check ovn-nbctl --wait=sb sync
+
 OVN_CLEANUP_NORTHD
 AT_CLEANUP
 ])
-- 
2.55.0

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

Reply via email to