With ovn-monitor-all enabled, all ovn-controllers get updates about all
SB records. This means that an ovn-controller might receive updates about
IGMP_Groups inserted by other chassis on datapaths that are not local to
the local chassis. These entries are valid and are not owned by the local
chassis and should not be flushed.

Fixes: 70ff8243040f ("OVN: Add IGMP SB definitions and ovn-controller support")
Signed-off-by: Dumitru Ceara <[email protected]>
---
 controller/pinctrl.c |   10 ++++++++++
 tests/ovn.at         |   43 ++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 52 insertions(+), 1 deletion(-)

diff --git a/controller/pinctrl.c b/controller/pinctrl.c
index e37f210..f72ab70 100644
--- a/controller/pinctrl.c
+++ b/controller/pinctrl.c
@@ -4561,7 +4561,17 @@ ip_mcast_sync(struct ovsdb_idl_txn *ovnsb_idl_txn,
             continue;
         }
 
+        /* Skip non-local records. */
+        if (sbrec_igmp->chassis != chassis) {
+            continue;
+        }
+
+        /* Skip non-local datapaths. */
         int64_t dp_key = sbrec_igmp->datapath->tunnel_key;
+        if (!get_local_datapath(local_datapaths, dp_key)) {
+            continue;
+        }
+
         struct ip_mcast_snoop *ip_ms = ip_mcast_snoop_find(dp_key);
 
         /* If the datapath doesn't exist anymore or IGMP snooping was disabled
diff --git a/tests/ovn.at b/tests/ovn.at
index 2235a19..d641075 100644
--- a/tests/ovn.at
+++ b/tests/ovn.at
@@ -16997,7 +16997,48 @@ OVN_CHECK_PACKETS([hv2/vif2-tx.pcap], [expected_empty])
 OVN_CHECK_PACKETS([hv2/vif3-tx.pcap], [expected_empty])
 OVN_CHECK_PACKETS([hv2/vif4-tx.pcap], [expected_empty])
 
-OVN_CLEANUP([hv1], [hv2])
+# With ovn-monitor-all=true, make sure ovn-controllers don't delete each
+# other's IGMP_Group records.
+
+# Add a new chassis with no local datapaths.
+net_add n3
+sim_add hv3
+as hv3
+ovs-vsctl add-br br-phys
+ovn_attach n3 br-phys 192.168.0.3
+
+# Enable ovn-monitor-all on all chassis.
+as hv1 ovs-vsctl set open . external_ids:ovn-monitor-all=true
+as hv2 ovs-vsctl set open . external_ids:ovn-monitor-all=true
+as hv3 ovs-vsctl set open . external_ids:ovn-monitor-all=true
+
+# Wait until ovn-monitor-all is processed by ovn-controller.
+OVS_WAIT_UNTIL([
+    test $(ovn-sbctl get chassis hv1 other_config:ovn-monitor-all) = '"true"'
+])
+OVS_WAIT_UNTIL([
+    test $(ovn-sbctl get chassis hv2 other_config:ovn-monitor-all) = '"true"'
+])
+OVS_WAIT_UNTIL([
+    test $(ovn-sbctl get chassis hv3 other_config:ovn-monitor-all) = '"true"'
+])
+
+# Inject a fake IGMP_Group entry.
+dp=$(ovn-sbctl --bare --columns _uuid list Datapath_Binding sw3)
+ch=$(ovn-sbctl --bare --columns _uuid list Chassis hv3)
+ovn-sbctl create IGMP_Group address="239.0.1.42" datapath=$dp chassis=$ch
+
+ovn-nbctl --wait=hv sync
+OVS_WAIT_UNTIL([
+    total_entries=`ovn-sbctl find IGMP_Group | grep "239.0.1.68" -c`
+    test "${total_entries}" = "1"
+])
+OVS_WAIT_UNTIL([
+    total_entries=`ovn-sbctl find IGMP_Group | grep "239.0.1.42" -c`
+    test "${total_entries}" = "1"
+])
+
+OVN_CLEANUP([hv1], [hv2], [hv3])
 AT_CLEANUP
 
 AT_SETUP([ovn -- MLD snoop/querier/relay])

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

Reply via email to