[ovs-dev] [PATCH ovn] ovn-northd: Add localnet ports to Multicast_Groups created by IGMP_Group.

Dumitru Ceara dceara at redhat.com
Thu Oct 8 13:48:07 UTC 2020


In case a logical switch is a "bridged logical switch", i.e., it has a
localnet port, add the localnet port to all multicast groups generated
from IGMP_Groups.  This is needed because multicast packets are never
tunneled between hypervisors.

Note: There still exists an issue regarding IP Multicast Relay (routing)
when traffic is received on bridged logical switches connected to
logical routers with mcast_relay=true.  That issue is not addressed
yet but an item is added to TODO.rst to track it.

Reported-at: https://bugzilla.redhat.com/1886103
Fixes: 5d1527b11e94 ("ovn-northd: Add IGMP Relay support")
Signed-off-by: Dumitru Ceara <dceara at redhat.com>
---
 TODO.rst            |  8 ++++++++
 northd/ovn-northd.c |  7 +++++++
 tests/ovn.at        | 40 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 55 insertions(+)

diff --git a/TODO.rst b/TODO.rst
index 4321630..c158155 100644
--- a/TODO.rst
+++ b/TODO.rst
@@ -152,3 +152,11 @@ OVN To-do List
   <Logical_Datapath.tunnel_key_NB-Port_Group.name>. This causes an additional
   hashtable lookup in parse_port_group() which can be avoided when we are sure
   that the Southbound DB uses the new format.
+
+* IP Multicast Relay
+
+  * When connecting bridged logical switches (localnet) to logical routers
+    with IP Multicast Relay enabled packets might get duplicated. We need
+    to find a way of determining if routing has already been executed (on a
+    different hypervisor) for the IP multicast packet being processed locally
+    in the router pipeline.
diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c
index afc9b4e..8bab9b0 100644
--- a/northd/ovn-northd.c
+++ b/northd/ovn-northd.c
@@ -4134,6 +4134,13 @@ ovn_igmp_group_aggregate_ports(struct ovn_igmp_group *igmp_group,
         ovn_igmp_group_destroy_entry(entry);
         free(entry);
     }
+
+    if (igmp_group->datapath->n_localnet_ports) {
+        ovn_multicast_add_ports(mcast_groups, igmp_group->datapath,
+                                &igmp_group->mcgroup,
+                                igmp_group->datapath->localnet_ports,
+                                igmp_group->datapath->n_localnet_ports);
+    }
 }
 
 static void
diff --git a/tests/ovn.at b/tests/ovn.at
index 08395fd..e3f3153 100644
--- a/tests/ovn.at
+++ b/tests/ovn.at
@@ -16668,6 +16668,7 @@ ovn_start
 #   - subnet 30.0.0.0/8
 #   - 1 port bound on hv1 (sw3-p1)
 #   - 1 port bound on hv2 (sw3-p2)
+#   - 1 localnet port (sw3-ln)
 
 reset_pcap_file() {
     local iface=$1
@@ -16794,6 +16795,9 @@ ovn-nbctl lsp-add sw2 sw2-p1
 ovn-nbctl lsp-add sw2 sw2-p2
 ovn-nbctl lsp-add sw3 sw3-p1
 ovn-nbctl lsp-add sw3 sw3-p2
+ovn-nbctl lsp-add sw3 sw3-ln                    \
+    -- lsp-set-type sw3-ln localnet             \
+    -- lsp-set-options sw3-ln network_name=phys
 
 ovn-nbctl lr-add rtr
 ovn-nbctl lrp-add rtr rtr-sw1 00:00:00:00:01:00 10.0.0.254/24
@@ -16838,6 +16842,7 @@ ovs-vsctl -- add-port br-int hv1-vif4 -- \
     options:tx_pcap=hv1/vif4-tx.pcap \
     options:rxq_pcap=hv1/vif4-rx.pcap \
     ofport-request=1
+ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys
 
 sim_add hv2
 as hv2
@@ -16863,6 +16868,7 @@ ovs-vsctl -- add-port br-int hv2-vif4 -- \
     options:tx_pcap=hv2/vif4-tx.pcap \
     options:rxq_pcap=hv2/vif4-rx.pcap \
     ofport-request=1
+ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys
 
 OVN_POPULATE_ARP
 
@@ -17146,6 +17152,18 @@ store_ip_multicast_pkt \
     $(ip_to_hex 10 0 0 42) $(ip_to_hex 239 0 1 68) 1e 20 ca70 11 \
     e518e518000a3b3a0000 expected_switched
 
+# TODO: IGMP Relay duplicates IP multicast packets in some conditions, for
+# more details see TODO.rst, section "IP Multicast Relay". Once that issue is
+# fixed the duplicated packets should not appear anymore.
+store_ip_multicast_pkt \
+    000000000100 01005e000144 \
+    $(ip_to_hex 10 0 0 42) $(ip_to_hex 239 0 1 68) 1e 1f cb70 11 \
+    e518e518000a3b3a0000 expected_routed_sw1
+store_ip_multicast_pkt \
+    000000000200 01005e000144 \
+    $(ip_to_hex 10 0 0 42) $(ip_to_hex 239 0 1 68) 1e 1f cb70 11 \
+    e518e518000a3b3a0000 expected_routed_sw2
+
 OVN_CHECK_PACKETS([hv1/vif1-tx.pcap], [expected_routed_sw1])
 OVN_CHECK_PACKETS([hv2/vif3-tx.pcap], [expected_routed_sw2])
 OVN_CHECK_PACKETS([hv1/vif4-tx.pcap], [expected_switched])
@@ -17293,6 +17311,7 @@ ovn_start
 #   - subnet 30::/64
 #   - 1 port bound on hv1 (sw3-p1)
 #   - 1 port bound on hv2 (sw3-p2)
+#   - 1 localnet port (sw3-ln)
 
 reset_pcap_file() {
     local iface=$1
@@ -17418,6 +17437,9 @@ ovn-nbctl lsp-add sw2 sw2-p1
 ovn-nbctl lsp-add sw2 sw2-p2
 ovn-nbctl lsp-add sw3 sw3-p1
 ovn-nbctl lsp-add sw3 sw3-p2
+ovn-nbctl lsp-add sw3 sw3-ln                    \
+    -- lsp-set-type sw3-ln localnet             \
+    -- lsp-set-options sw3-ln network_name=phys
 
 ovn-nbctl lr-add rtr
 ovn-nbctl lrp-add rtr rtr-sw1 00:00:00:00:01:00 10::fe/64
@@ -17477,6 +17499,7 @@ ovs-vsctl -- add-port br-int hv1-vif4 -- \
     options:tx_pcap=hv1/vif4-tx.pcap \
     options:rxq_pcap=hv1/vif4-rx.pcap \
     ofport-request=1
+ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys
 
 sim_add hv2
 as hv2
@@ -17502,6 +17525,7 @@ ovs-vsctl -- add-port br-int hv2-vif4 -- \
     options:tx_pcap=hv2/vif4-tx.pcap \
     options:rxq_pcap=hv2/vif4-rx.pcap \
     ofport-request=1
+ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys
 
 OVN_POPULATE_ARP
 
@@ -17812,6 +17836,22 @@ store_ip_multicast_pkt \
     93407a69000e1b5e61736461640a \
     expected_switched
 
+# TODO: MLD Relay duplicates IP multicast packets in some conditions, for
+# more details see TODO.rst, section "IP Multicast Relay". Once that issue is
+# fixed the duplicated packets should not appear anymore.
+store_ip_multicast_pkt \
+    000000000100 333300000001 \
+    10000000000000000000000000000042 ff0adeadbeef00000000000000000001 \
+    000e 01 11 \
+    93407a69000e1b5e61736461640a \
+    expected_routed_sw1
+store_ip_multicast_pkt \
+    000000000200 333300000001 \
+    10000000000000000000000000000042 ff0adeadbeef00000000000000000001 \
+    000e 01 11 \
+    93407a69000e1b5e61736461640a \
+    expected_routed_sw2
+
 OVN_CHECK_PACKETS([hv1/vif1-tx.pcap], [expected_routed_sw1])
 OVN_CHECK_PACKETS([hv2/vif3-tx.pcap], [expected_routed_sw2])
 OVN_CHECK_PACKETS([hv1/vif4-tx.pcap], [expected_switched])
-- 
1.8.3.1



More information about the dev mailing list