>From 805422a85cf839bdff5330cd173f3ae55861efe9 Mon Sep 17 00:00:00 2001
From: zhangqiang45 <zhangqian...@lenovo.com>
Date: Mon, 8 Jul 2024 14:25:04 +0800
Subject: [PATCH ovn] northd:Fix issues for Forwarding_Group The use of
 variables from the outer loop in the inner loop causes the outer loop to
 terminate prematurely. eg. LVS are three fwgs,
 fwg1(p1,p2,p3,p4),fwg2(p11,p22), fwg3(p31,p32),only fwg1 in logical_flows.
Submitted-at: https://github.com/ovn-org/ovn/pull/250

Signed-off-by: zhangqiang45 <zhangqian...@lenovo.com>
---
 northd/northd.c | 7 +++++--
 tests/ovn.at    | 7 +++++++
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/northd/northd.c b/northd/northd.c
index 6898daa00..be1a1e288 100644
--- a/northd/northd.c
+++ b/northd/northd.c
@@ -7929,6 +7929,9 @@ build_fwd_group_lflows(struct ovn_datapath *od, struct 
lflow_table *lflows,
             continue;
         }
 
+        ds_clear(&match);
+        ds_clear(&actions);
+
         /* ARP responder for the forwarding group's virtual IP */
         ds_put_format(&match, "arp.tpa == %s && arp.op == 1",
                       fwd_group->vip);
@@ -7959,9 +7962,9 @@ build_fwd_group_lflows(struct ovn_datapath *od, struct 
lflow_table *lflows,
             ds_put_cstr(&group_ports, "liveness=\"true\",");
         }
         ds_put_cstr(&group_ports, "childports=");
-        for (i = 0; i < (fwd_group->n_child_port - 1); ++i) {
+        for (size_t j = 0; j < (fwd_group->n_child_port - 1); ++j) {
             ds_put_format(&group_ports, "\"%s\",",
-                         fwd_group->child_port[i]);
+                         fwd_group->child_port[j]);
         }
         ds_put_format(&group_ports, "\"%s\"",
                       fwd_group->child_port[fwd_group->n_child_port - 1]);
diff --git a/tests/ovn.at b/tests/ovn.at
index 185ba4a21..b1fd8c69b 100644
--- a/tests/ovn.at
+++ b/tests/ovn.at
@@ -27054,7 +27054,14 @@ check ovs-vsctl add-port br-int vif3 -- set Interface 
vif3 external-ids:iface-id
 # Add a forwarding group on ls2 with lsp21 and lsp22 as child ports
 # virtual IP - 172.16.1.11, virtual MAC - 00:11:de:ad:be:ef
 check ovn-nbctl --wait=hv fwd-group-add fwd_grp1 ls2 172.16.1.11 
00:11:de:ad:be:ef lsp21 lsp22
+check ovn-nbctl --wait=hv fwd-group-add fwd_grp2 ls2 172.16.2.11 
00:22:de:ad:be:ef lsp21 lsp22
 
+# Check logical flow
+AT_CAPTURE_FILE([sbflows])
+ovn-sbctl dump-flows > sbflows
+AT_CHECK([grep ls_in_l2_lkup sbflows | grep fwd_group | wc -l], [0], [2
+])
+check ovn-nbctl --wait=hv fwd-group-del fwd_grp2
 # Check logical flow
 AT_CAPTURE_FILE([sbflows])
 ovn-sbctl dump-flows > sbflows
-- 
2.43.5

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to