From 67d348798cddef1d48f1249c9dfdc0b8d9693371 Mon Sep 17 00:00:00 2001 From: Dumitru Ceara Date: Thu, 1 Aug 2019 13:26:20 +0200 Subject: [PATCH 1/4] ovn-northd: Use HMAP_FOR_EACH when adding multicast lflows There's no need to use HMAP_FOR_EACH_SAFE when we add the logical flows that correspond to IGMP groups as we don't modify the hashmap in the loop. Also, we should reinitialize match and actions only if the flow will be added. Fixes: ddc64665b678 ("OVN: Add ovn-northd IGMP support") Signed-off-by: Dumitru Ceara Acked-by: Numan Siddique Signed-off-by: Mark Michelson --- ovn/northd/ovn-northd.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ovn/northd/ovn-northd.c b/ovn/northd/ovn-northd.c index eea9144d0..d81cfd893 100644 --- a/ovn/northd/ovn-northd.c +++ b/ovn/northd/ovn-northd.c @@ -5429,12 +5429,9 @@ build_lswitch_flows(struct hmap *datapaths, struct hmap *ports, /* Ingress table 17: Add IP multicast flows learnt from IGMP * (priority 90). */ - struct ovn_igmp_group *igmp_group, *next_igmp_group; - - HMAP_FOR_EACH_SAFE (igmp_group, next_igmp_group, hmap_node, igmp_groups) { - ds_clear(&match); - ds_clear(&actions); + struct ovn_igmp_group *igmp_group; + HMAP_FOR_EACH (igmp_group, hmap_node, igmp_groups) { if (!igmp_group->datapath) { continue; } @@ -5446,6 +5443,9 @@ build_lswitch_flows(struct hmap *datapaths, struct hmap *ports, } mcast_info->active_flows++; + ds_clear(&match); + ds_clear(&actions); + ds_put_format(&match, "eth.mcast && ip4 && ip4.dst == %s ", igmp_group->mcgroup.name); ds_put_format(&actions, "outport = \"%s\"; output; ", -- 2.21.0