diff mbox series

[ovs-dev] northd: Fix issues for Forwarding_Group

Message ID tencent_311AC3C9F89407806F85EF8C73389249DD06@qq.com
State Handled Elsewhere
Headers show
Series [ovs-dev] northd: Fix issues for Forwarding_Group | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/github-robot-_ovn-kubernetes success github build: passed

Commit Message

patchwork-bot+netdevbpf--- via dev July 12, 2024, 8:01 a.m. UTC
From 805422a85cf839bdff5330cd173f3ae55861efe9 Mon Sep 17 00:00:00 2001
From: zhangqiang45 <zhangqiang45@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 <zhangqiang45@lenovo.com>
---
 northd/northd.c | 7 +++++--
 tests/ovn.at    | 7 +++++++
 2 files changed, 12 insertions(+), 2 deletions(-)

Comments

Numan Siddique July 22, 2024, 4:58 p.m. UTC | #1
On Fri, Jul 12, 2024 at 6:34 AM 1130911995--- via dev
<ovs-dev@openvswitch.org> wrote:
>
> From 805422a85cf839bdff5330cd173f3ae55861efe9 Mon Sep 17 00:00:00 2001
> From: zhangqiang45 <zhangqiang45@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 <zhangqiang45@lenovo.com>

Thanks.  I applied this patch to the main.  I'll backport to other branches.

Numan



> ---
>  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
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
diff mbox series

Patch

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