diff mbox series

[ovs-dev,v1] Fix Segmentation Fault when LR requests duplicate requested-tnl-key

Message ID 20210511202309.214064-1-svc.eng.git-mail@nutanix.com
State Accepted
Headers show
Series [ovs-dev,v1] Fix Segmentation Fault when LR requests duplicate requested-tnl-key | expand

Commit Message

svc.eng.git-mail May 11, 2021, 8:23 p.m. UTC
From: Karthik Chandrashekar <karthik.c@nutanix.com>

Fixes: b6c349a271363faf277041b230f2244489c7e7a3

Signed-off-by: Karthik Chandrashekar <karthik.c@nutanix.com>
---
 northd/ovn-northd.c |  4 ++--
 tests/ovn-northd.at | 18 ++++++++++++++++++
 2 files changed, 20 insertions(+), 2 deletions(-)

Comments

Mark Michelson May 17, 2021, 8:21 p.m. UTC | #1
Thanks Karthik,

I applied this to master, branch-21.03, and branch-20.12.

On 5/11/21 4:23 PM, svc.eng.git-mail@nutanix.com wrote:
> From: Karthik Chandrashekar <karthik.c@nutanix.com>
> 
> Fixes: b6c349a271363faf277041b230f2244489c7e7a3
> 
> Signed-off-by: Karthik Chandrashekar <karthik.c@nutanix.com>
> ---
>   northd/ovn-northd.c |  4 ++--
>   tests/ovn-northd.at | 18 ++++++++++++++++++
>   2 files changed, 20 insertions(+), 2 deletions(-)
> 
> diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c
> index dec6e4efb..36cec10f3 100644
> --- a/northd/ovn-northd.c
> +++ b/northd/ovn-northd.c
> @@ -1281,8 +1281,8 @@ ovn_datapath_assign_requested_tnl_id(struct hmap *dp_tnlids,
>               static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 1);
>               VLOG_WARN_RL(&rl, "Logical %s %s requests same tunnel key "
>                            "%"PRIu32" as another logical switch or router",
> -                         od->nbs ? "switch" : "router", od->nbs->name,
> -                         tunnel_key);
> +                         od->nbs ? "switch" : "router",
> +                         od->nbs ? od->nbs->name : od->nbr->name, tunnel_key);
>           }
>       }
>   }
> diff --git a/tests/ovn-northd.at b/tests/ovn-northd.at
> index 48de8aabe..a7eebc826 100644
> --- a/tests/ovn-northd.at
> +++ b/tests/ovn-northd.at
> @@ -2223,6 +2223,24 @@ AT_CHECK([test $ls2 = 3])
>   AT_CLEANUP
>   ])
>   
> +AT_SETUP([ovn -- LR requested-tnl-key])
> +ovn_start
> +
> +ovn-nbctl --wait=sb lr-add lr0
> +AT_CHECK([test 1 = $(ovn-sbctl get datapath_binding lr0 tunnel_key)])
> +
> +ovn-nbctl --wait=sb lr-add lr1
> +AT_CHECK([test 2 = $(ovn-sbctl get datapath_binding lr1 tunnel_key)])
> +
> +AT_CHECK(
> +  [ovn-nbctl --wait=sb set logical-router lr0 options:requested-tnl-key=100])
> +AT_CHECK([test 100 = $(ovn-sbctl get datapath_binding lr0 tunnel_key)])
> +
> +AT_CHECK(
> +  [ovn-nbctl --wait=sb set logical-router lr1 options:requested-tnl-key=100])
> +
> +AT_CLEANUP
> +
>   OVN_FOR_EACH_NORTHD([
>   AT_SETUP([port requested-tnl-key])
>   AT_KEYWORDS([requested tnl tunnel key keys])
>
diff mbox series

Patch

diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c
index dec6e4efb..36cec10f3 100644
--- a/northd/ovn-northd.c
+++ b/northd/ovn-northd.c
@@ -1281,8 +1281,8 @@  ovn_datapath_assign_requested_tnl_id(struct hmap *dp_tnlids,
             static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 1);
             VLOG_WARN_RL(&rl, "Logical %s %s requests same tunnel key "
                          "%"PRIu32" as another logical switch or router",
-                         od->nbs ? "switch" : "router", od->nbs->name,
-                         tunnel_key);
+                         od->nbs ? "switch" : "router",
+                         od->nbs ? od->nbs->name : od->nbr->name, tunnel_key);
         }
     }
 }
diff --git a/tests/ovn-northd.at b/tests/ovn-northd.at
index 48de8aabe..a7eebc826 100644
--- a/tests/ovn-northd.at
+++ b/tests/ovn-northd.at
@@ -2223,6 +2223,24 @@  AT_CHECK([test $ls2 = 3])
 AT_CLEANUP
 ])
 
+AT_SETUP([ovn -- LR requested-tnl-key])
+ovn_start
+
+ovn-nbctl --wait=sb lr-add lr0
+AT_CHECK([test 1 = $(ovn-sbctl get datapath_binding lr0 tunnel_key)])
+
+ovn-nbctl --wait=sb lr-add lr1
+AT_CHECK([test 2 = $(ovn-sbctl get datapath_binding lr1 tunnel_key)])
+
+AT_CHECK(
+  [ovn-nbctl --wait=sb set logical-router lr0 options:requested-tnl-key=100])
+AT_CHECK([test 100 = $(ovn-sbctl get datapath_binding lr0 tunnel_key)])
+
+AT_CHECK(
+  [ovn-nbctl --wait=sb set logical-router lr1 options:requested-tnl-key=100])
+
+AT_CLEANUP
+
 OVN_FOR_EACH_NORTHD([
 AT_SETUP([port requested-tnl-key])
 AT_KEYWORDS([requested tnl tunnel key keys])