From patchwork Mon Feb 28 21:06:40 2022
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Dumitru Ceara
+ This table also has priority-120 flows that punt all IGMP/MLD packets to
+ ovn-controller
if the switch is an interconnect switch
+ with multicast snooping enabled.
+
This table also has a priority-110 flow with the match
eth.dst == E
for all logical switch
@@ -2385,6 +2391,15 @@ icmp6_error {
+ L3 admission control: Priority-120 flows allows IGMP and MLD packets
+ if the router has logical ports that have
+
+ :mcast_flood='true'
.
+
L3 admission control: A priority-100 flow drops packets that match @@ -3449,14 +3464,23 @@ output;
- Priority-550 flow that drops IPv6 Router Solicitation/Advertisement + Priority-10550 flow that drops IPv6 Router Solicitation/Advertisement packets that were not processed in previous tables.
- Priority-500 flows that match IP multicast traffic destined to + Priority-10550 flows that drop IGMP and MLD packets with source MAC + address owned by the router. These are used to prevent looping + statically forwarded IGMP and MLD packets for which TTL is not + decremented (it is always 1). +
+
+ Priority-10500 flows that match IP multicast traffic destined to
groups registered on any of the attached switches and sets
outport
to the associated multicast group that will
eventually flood the traffic to all interested attached logical
@@ -3466,10 +3490,22 @@ output;
- Priority-450 flow that matches unregistered IP multicast traffic
- and sets outport
to the MC_STATIC
- multicast group, which ovn-northd
populates with the
- logical ports that have
+ Priority-10460 flows that match IGMP and MLD control packets,
+ set outport
to the MC_STATIC
+ multicast group, which ovn-northd
+ populates with the logical ports that have
+
+ :mcast_flood='true'
. If no router ports are configured
+ to flood multicast traffic the packets are dropped.
+
+ Priority-10450 flow that matches unregistered IP multicast traffic
+ decrements TTL and sets outport
to the
+ MC_STATIC
multicast group, which ovn-northd
+ populates with the logical ports that have
:mcast_flood='true'
. If no router ports are configured
to flood multicast traffic the packets are dropped.
diff --git a/tests/ovn-northd.at b/tests/ovn-northd.at
index fe27869737..72c6d44f60 100644
--- a/tests/ovn-northd.at
+++ b/tests/ovn-northd.at
@@ -6249,3 +6249,46 @@ check_log_flows_count 0 in
AT_CLEANUP
])
+
+OVN_FOR_EACH_NORTHD([
+AT_SETUP([Static IP multicast report forwarding])
+
+ovn_start
+
+check ovn-nbctl lr-add lr
+check ovn-nbctl lrp-add lr lrp1 00:00:00:00:00:01 10.10.10.1/24 1010::1/64
+check ovn-nbctl lrp-add lr lrp2 00:00:00:00:00:02 20.20.20.1/24 2020::1/64
+check ovn-nbctl set logical_router lr options:mcast_relay="true"
+check ovn-nbctl set logical_router_port lrp1 options:mcast_flood="true"
+check ovn-nbctl set logical_router_port lrp2 options:mcast_flood="true"
+
+check ovn-nbctl --wait=sb sync
+
+ovn-sbctl dump-flows lr > lrflows
+AT_CAPTURE_FILE([lrflows])
+
+dnl Flows to skip TTL == {0, 1} check for IGMP and MLD packets.
+AT_CHECK([grep -e 'lr_in_ip_input ' lrflows | grep -e 'ip.proto == 2' -e 'mld' -e 'ip.ttl == {0, 1}' | sed 's/table=../table=??/'], [0], [dnl
+ table=??(lr_in_ip_input ), priority=120 , match=(ip4 && ip.proto == 2 && ip.ttl == 1), action=(next;)
+ table=??(lr_in_ip_input ), priority=120 , match=(ip6 && (mldv1 || mldv2) && ip.ttl == 1), action=(next;)
+ table=??(lr_in_ip_input ), priority=100 , match=(inport == "lrp1" && ip4 && ip.ttl == {0, 1} && !ip.later_frag), action=(icmp4 {eth.dst <-> eth.src; icmp4.type = 11; /* Time exceeded */ icmp4.code = 0; /* TTL exceeded in transit */ ip4.dst = ip4.src; ip4.src = 10.10.10.1 ; ip.ttl = 254; outport = "lrp1"; flags.loopback = 1; output; };)
+ table=??(lr_in_ip_input ), priority=100 , match=(inport == "lrp1" && ip6 && ip6.src == 1010::/64 && ip.ttl == {0, 1} && !ip.later_frag), action=(icmp6 {eth.dst <-> eth.src; ip6.dst = ip6.src; ip6.src = 1010::1 ; ip.ttl = 254; icmp6.type = 3; /* Time exceeded */ icmp6.code = 0; /* TTL exceeded in transit */ outport = "lrp1"; flags.loopback = 1; output; };)
+ table=??(lr_in_ip_input ), priority=100 , match=(inport == "lrp2" && ip4 && ip.ttl == {0, 1} && !ip.later_frag), action=(icmp4 {eth.dst <-> eth.src; icmp4.type = 11; /* Time exceeded */ icmp4.code = 0; /* TTL exceeded in transit */ ip4.dst = ip4.src; ip4.src = 20.20.20.1 ; ip.ttl = 254; outport = "lrp2"; flags.loopback = 1; output; };)
+ table=??(lr_in_ip_input ), priority=100 , match=(inport == "lrp2" && ip6 && ip6.src == 2020::/64 && ip.ttl == {0, 1} && !ip.later_frag), action=(icmp6 {eth.dst <-> eth.src; ip6.dst = ip6.src; ip6.src = 2020::1 ; ip.ttl = 254; icmp6.type = 3; /* Time exceeded */ icmp6.code = 0; /* TTL exceeded in transit */ outport = "lrp2"; flags.loopback = 1; output; };)
+ table=??(lr_in_ip_input ), priority=30 , match=(ip4 && ip.ttl == {0, 1}), action=(drop;)
+])
+
+dnl Flows to "route" (statically forward) without decrementing TTL for
+dnl IGMP and MLD packets. Also, flows to drop potentially looping IGMP/MLD
+dnl packets.
+AT_CHECK([grep -e 'lr_in_ip_routing ' lrflows | grep -e 'ip.proto == 2' -e 'mld' | sed 's/table=../table=??/'], [0], [dnl
+ table=??(lr_in_ip_routing ), priority=10550, match=(eth.src == 00:00:00:00:00:01 && (mldv1 || mldv2)), action=(drop;)
+ table=??(lr_in_ip_routing ), priority=10550, match=(eth.src == 00:00:00:00:00:01 && ip4 && ip.proto == 2), action=(drop;)
+ table=??(lr_in_ip_routing ), priority=10550, match=(eth.src == 00:00:00:00:00:02 && (mldv1 || mldv2)), action=(drop;)
+ table=??(lr_in_ip_routing ), priority=10550, match=(eth.src == 00:00:00:00:00:02 && ip4 && ip.proto == 2), action=(drop;)
+ table=??(lr_in_ip_routing ), priority=10460, match=(ip4 && ip.proto == 2), action=(clone { outport = "_MC_static"; next; };)
+ table=??(lr_in_ip_routing ), priority=10460, match=(mldv1 || mldv2), action=(clone { outport = "_MC_static"; next; };)
+])
+
+AT_CLEANUP
+])
diff --git a/tests/ovn.at b/tests/ovn.at
index 69270601ab..d7ae7d917b 100644
--- a/tests/ovn.at
+++ b/tests/ovn.at
@@ -22906,6 +22906,232 @@ OVS_WAIT_UNTIL(
AT_CLEANUP
])
+OVN_FOR_EACH_NORTHD([
+AT_SETUP([interconnection - IGMP/MLD multicast])
+
+# Logical network:
+#
+# AZ1 | AZ2
+# ---------------------------------------------------------------------
+# |
+# | +-- LR2 --- LS2 --- LSP2 (sender)
+# | /
+# LSP1 --- LS1 --- LR1 --- TS ---
+# (receiver) | \
+# | +-- LR3 --- LS3 --- LSP3 (receiver)
+#
+# LS1, LS2, LS3, TS configured to snoop IP multicast.
+# LR1, LR2, LR3 configured to relay IP multicast.
+# LR1-TS configured to flood IP multicast traffic unconditionally.
+# LR2-TS configured to flood IP multicast traffic unconditionally.
+# LR3-TS configured to flood IP multicast traffic unconditionally.
+
+AT_CAPTURE_FILE([exp])
+AT_CAPTURE_FILE([rcv])
+check_packets() {
+ > exp
+ > rcv
+ if test "$1" = --uniq; then
+ sort="sort -u"; shift
+ else
+ sort=sort
+ fi
+ for tuple in "$@"; do
+ set $tuple; pcap=$1 type=$2
+ echo "--- $pcap" | tee -a exp >> rcv
+ $sort "$type" >> exp
+ $PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" $pcap | $sort >> rcv
+ echo | tee -a exp >> rcv
+ done
+
+ $at_diff exp rcv >/dev/null
+}
+
+ovn_init_ic_db
+ovn_start az1
+ovn_start az2
+
+net_add n1
+
+sim_add hv1
+as hv1
+check ovs-vsctl add-br br-phys
+ovn_az_attach az1 n1 br-phys 192.168.1.1 16
+check ovs-vsctl -- add-port br-int hv1-vif1 \
+ -- set interface hv1-vif1 external-ids:iface-id=lsp1 \
+ options:tx_pcap=hv1/vif1-tx.pcap \
+ options:rxq_pcap=hv1/vif1-rx.pcap
+check ovs-vsctl set open . external-ids:ovn-is-interconn=true
+
+sim_add hv2
+as hv2
+check ovs-vsctl add-br br-phys
+ovn_az_attach az2 n1 br-phys 192.168.2.1 16
+check ovs-vsctl -- add-port br-int hv2-vif1 \
+ -- set interface hv2-vif1 external-ids:iface-id=lsp2 \
+ options:tx_pcap=hv2/vif1-tx.pcap \
+ options:rxq_pcap=hv2/vif1-rx.pcap
+check ovs-vsctl -- add-port br-int hv2-vif2 \
+ -- set interface hv2-vif2 external-ids:iface-id=lsp3 \
+ options:tx_pcap=hv2/vif2-tx.pcap \
+ options:rxq_pcap=hv2/vif2-rx.pcap
+check ovs-vsctl set open . external-ids:ovn-is-interconn=true
+
+AT_CHECK([ovn-ic-nbctl create Transit_Switch name=ts], [0], [ignore])
+check ovn_as az1 ovn-nbctl wait-until logical_switch ts
+check ovn_as az2 ovn-nbctl wait-until logical_switch ts
+
+ovn_as az1
+check ovn-nbctl lr-add lr1 \
+ -- lrp-add lr1 lr1-ts 00:00:00:01:00:01 42.42.42.1/24 4242::1/64 \
+ -- lrp-add lr1 lr1-ls1 00:00:00:01:01:00 43.43.43.1/24 4343::1/64\
+ -- lrp-set-gateway-chassis lr1-ts hv1
+check ovn-nbctl ls-add ls1 \
+ -- lsp-add ls1 ls1-lr1 \
+ -- lsp-set-addresses ls1-lr1 router \
+ -- lsp-set-type ls1-lr1 router \
+ -- lsp-set-options ls1-lr1 router-port=lr1-ls1 \
+ -- lsp-add ls1 lsp1
+check ovn-nbctl lsp-add ts ts-lr1 \
+ -- lsp-set-addresses ts-lr1 router \
+ -- lsp-set-type ts-lr1 router \
+ -- lsp-set-options ts-lr1 router-port=lr1-ts
+wait_for_ports_up
+
+ovn_as az2
+check ovn-nbctl lr-add lr2 \
+ -- lrp-add lr2 lr2-ts 00:00:00:02:00:01 42.42.42.2/24 4242::2/64 \
+ -- lrp-add lr2 lr2-ls2 00:00:00:02:01:00 44.44.44.1/24 4444::1/64 \
+ -- lrp-set-gateway-chassis lr2-ts hv2
+check ovn-nbctl ls-add ls2 \
+ -- lsp-add ls2 ls2-lr2 \
+ -- lsp-set-addresses ls2-lr2 router \
+ -- lsp-set-type ls2-lr2 router \
+ -- lsp-set-options ls2-lr2 router-port=lr2-ls2 \
+ -- lsp-add ls2 lsp2
+check ovn-nbctl lsp-add ts ts-lr2 \
+ -- lsp-set-addresses ts-lr2 router \
+ -- lsp-set-type ts-lr2 router \
+ -- lsp-set-options ts-lr2 router-port=lr2-ts
+
+check ovn-nbctl lr-add lr3 \
+ -- lrp-add lr3 lr3-ts 00:00:00:02:00:02 42.42.42.3/24 4242::3/64 \
+ -- lrp-add lr3 lr3-ls3 00:00:00:02:02:00 44.44.45.1/24 4445::1/64 \
+ -- lrp-set-gateway-chassis lr3-ts hv2
+check ovn-nbctl ls-add ls3 \
+ -- lsp-add ls3 ls3-lr3 \
+ -- lsp-set-addresses ls3-lr3 router \
+ -- lsp-set-type ls3-lr3 router \
+ -- lsp-set-options ls3-lr3 router-port=lr3-ls3 \
+ -- lsp-add ls3 lsp3
+check ovn-nbctl lsp-add ts ts-lr3 \
+ -- lsp-set-addresses ts-lr3 router \
+ -- lsp-set-type ts-lr3 router \
+ -- lsp-set-options ts-lr3 router-port=lr3-ts
+
+wait_for_ports_up
+
+dnl Enable IP multicast snooping and IP multicast relay. Reports are
+dnl forwarded statically.
+ovn_as az1
+check ovn-nbctl set logical_switch ls1 other_config:mcast_snoop="true"
+check ovn-nbctl set Logical_Switch_Port ls1-lr1 options:mcast_flood_reports="true"
+check ovn-nbctl set logical_router lr1 options:mcast_relay="true"
+check ovn-nbctl set logical_router_port lr1-ts options:mcast_flood="true"
+check ovn-nbctl set logical_switch ts other_config:mcast_snoop="true"
+check ovn-nbctl set logical_switch_port ts-lr1 options:mcast_flood_reports="true"
+check ovn-nbctl set logical_switch_port ts-lr2 options:mcast_flood_reports="true"
+check ovn-nbctl set logical_switch_port ts-lr3 options:mcast_flood_reports="true"
+
+ovn_as az2
+check ovn-nbctl set logical_switch ls2 other_config:mcast_snoop="true"
+check ovn-nbctl set Logical_Switch_Port ls2-lr2 options:mcast_flood_reports="true"
+check ovn-nbctl set logical_router lr2 options:mcast_relay="true"
+check ovn-nbctl set logical_router_port lr2-ts options:mcast_flood="true"
+check ovn-nbctl set logical_switch ls3 other_config:mcast_snoop="true"
+check ovn-nbctl set Logical_Switch_Port ls3-lr3 options:mcast_flood_reports="true"
+check ovn-nbctl set logical_router lr3 options:mcast_relay="true"
+check ovn-nbctl set logical_router_port lr3-ts options:mcast_flood="true"
+check ovn-nbctl set logical_switch ts other_config:mcast_snoop="true"
+check ovn-nbctl set logical_switch_port ts-lr1 options:mcast_flood_reports="true"
+check ovn-nbctl set logical_switch_port ts-lr2 options:mcast_flood_reports="true"
+check ovn-nbctl set logical_switch_port ts-lr3 options:mcast_flood_reports="true"
+
+check ovn_as az1 ovn-nbctl --wait=hv sync
+check ovn_as az2 ovn-nbctl --wait=hv sync
+
+# Pre-populate the hypervisors' ARP tables so that we don't lose any
+# packets for ARP resolution (native tunneling doesn't queue packets
+# for ARP resolution).
+OVN_POPULATE_ARP
+
+# Inject IGMP Join for 239.0.1.68 on LSP1.
+send_igmp_v3_report hv1-vif1 hv1 \
+ 000000000001 $(ip_to_hex 10 0 0 1) f9f8 \
+ $(ip_to_hex 239 0 1 68) 04 e9b9 \
+ /dev/null
+
+# Inject MLD Join for ff0a:dead:beef::1 on LSP1.
+send_mld_v2_report hv1-vif1 hv1 \
+ 000000000001 10000000000000000000000000000001 \
+ ff0adeadbeef00000000000000000001 04 c0e4 \
+ /dev/null
+
+# Inject IGMP Join for 239.0.1.68 on LSP3.
+send_igmp_v3_report hv2-vif2 hv2 \
+ 000000000001 $(ip_to_hex 10 0 0 1) f9f8 \
+ $(ip_to_hex 239 0 1 68) 04 e9b9 \
+ /dev/null
+
+# Inject MLD Join for ff0a:dead:beef::1 on LSP3.
+send_mld_v2_report hv2-vif2 hv2 \
+ 000000000001 10000000000000000000000000000001 \
+ ff0adeadbeef00000000000000000001 04 c0e4 \
+ /dev/null
+
+# Send an IP multicast packet from LSP2, it should be forwarded
+# to lsp1 and lsp3.
+> expected_az1
+> expected_az2
+send_ip_multicast_pkt hv2-vif1 hv2 \
+ 000000000001 01005e000144 \
+ $(ip_to_hex 44 44 44 2) $(ip_to_hex 239 0 1 68) 1e 20 7c6b 11 \
+ e518e518000aed350000
+store_ip_multicast_pkt \
+ 000000010100 01005e000144 \
+ $(ip_to_hex 44 44 44 2) $(ip_to_hex 239 0 1 68) 1e 1e 7e6b 11 \
+ e518e518000aed350000 expected_az1
+store_ip_multicast_pkt \
+ 000000020200 01005e000144 \
+ $(ip_to_hex 44 44 44 2) $(ip_to_hex 239 0 1 68) 1e 1e 7e6b 11 \
+ e518e518000aed350000 expected_az2
+
+send_ip6_multicast_pkt hv2-vif1 hv2 \
+ 000000000001 333300000001 \
+ 00100000000000000000000000000042 ff0adeadbeef00000000000000000001 \
+ 000e 40 11 \
+ 93407a69000e2b4e61736461640a
+store_ip6_multicast_pkt \
+ 000000010100 333300000001 \
+ 00100000000000000000000000000042 ff0adeadbeef00000000000000000001 \
+ 000e 3e 11 \
+ 93407a69000e2b4e61736461640a \
+ expected_az1
+store_ip6_multicast_pkt \
+ 000000020200 333300000001 \
+ 00100000000000000000000000000042 ff0adeadbeef00000000000000000001 \
+ 000e 3e 11 \
+ 93407a69000e2b4e61736461640a \
+ expected_az2
+
+OVS_WAIT_UNTIL(
+ [check_packets 'hv1/vif1-tx.pcap expected_az1' \
+ 'hv2/vif2-tx.pcap expected_az2'],
+ [$at_diff -F'^---' exp rcv])
+
+AT_CLEANUP
+])
+
OVN_FOR_EACH_NORTHD([
AT_SETUP([ECMP static routes])
ovn_start