The hmap could be NULL under one circumstance, node depending
on the northd data would run before the northd node right
after the start. Make sure we won't crash in that case.
Fixes: 6919992d8781 ("Datapath_Binding: Separate type column and sync NB.UUID
to SB.")
Reported-at: https://issues.redhat.com/browse/FDP-2757
Signed-off-by: Ales Musil <[email protected]>
---
northd/northd.c | 4 ++++
tests/ovn-northd.at | 29 +++++++++++++++++++++++++++++
2 files changed, 33 insertions(+)
diff --git a/northd/northd.c b/northd/northd.c
index ec219a0c7..3bd1f6849 100644
--- a/northd/northd.c
+++ b/northd/northd.c
@@ -647,6 +647,10 @@ ovn_datapath_from_sbrec(const struct hmap *ls_datapaths,
return NULL;
}
+ if (!dps) {
+ return NULL;
+ }
+
struct ovn_datapath *od = ovn_datapath_find_(dps, &key);
if (od && (od->sdp->sb_dp == sb)) {
return od;
diff --git a/tests/ovn-northd.at b/tests/ovn-northd.at
index 380c9ff80..0bc2808ac 100644
--- a/tests/ovn-northd.at
+++ b/tests/ovn-northd.at
@@ -18885,3 +18885,32 @@ AT_CHECK([ovn-sbctl lflow-list ls1 | grep
ls_in_apply_port_sec | ovn_strip_lflow
AT_CLEANUP
])
+
+OVN_FOR_EACH_NORTHD_NO_HV([
+AT_SETUP([IGMP northd crash])
+ovn_start
+
+check ovn-nbctl lr-add lr
+check ovn-sbctl chassis-add hv1 geneve 127.0.0.1
+
+# Kill northd and start it paused this time.
+as northd
+OVS_APP_EXIT_AND_WAIT([ovn-northd])
+ovn_start_northd --paused
+
+# Create IGMP Group for lr datapath.
+check_uuid ovn-sbctl create IGMP_Group address=mrouters \
+ datapath=$(fetch_column Datapath_Binding _uuid external_ids:name=lr) \
+ chassis=$(fetch_column Chassis _uuid name=hv1) \
+ chassis_name=hv1
+wait_row_count Igmp_Group 1 address=mrouters
+
+# Unpause northd and check if we didn't crash.
+as northd ovn-appctl -t ovn-northd resume
+check ovn-nbctl --wait=sb sync
+
+wait_row_count Igmp_Group 0 address=mrouters
+
+OVN_CLEANUP_NORTHD
+AT_CLEANUP
+])
--
2.51.1
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev