[ovs-dev] [PATCH ovn] ovn-nbctl: fix sigsegv when nexthop arg is missing

Moshe Levi moshele at mellanox.com
Sat Jan 2 22:30:01 UTC 2021


From: Moshe Levi <moshele at nvidia.com>

running the following command will result core dump

$ ovn-nbctl lr-policy-add lr0 2000 ip4.src==192.168.0.15 reroute
Segmentation fault (core dumped)

This commit add the missing return when the nexthop is missing

with the fix running the same comand will result the currect output
$ ovn-nbctl lr-policy-add lr0 2000 ip4.src==192.168.0.15 reroute
ovn-nbctl: Nexthop is required when action is reroute.

Signed-off-by: Moshe Levi <moshele at nvidia.com>
---
 utilities/ovn-nbctl.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/utilities/ovn-nbctl.c b/utilities/ovn-nbctl.c
index 94e7eedeb..d67f5c456 100644
--- a/utilities/ovn-nbctl.c
+++ b/utilities/ovn-nbctl.c
@@ -3648,6 +3648,7 @@ nbctl_lr_policy_add(struct ctl_context *ctx)
     if (!strcmp(action, "reroute")) {
         if (ctx->argc < 6) {
             ctl_error(ctx, "Nexthop is required when action is reroute.");
+            return;
         }
         reroute = true;
     }
-- 
2.30.0.windows.1



More information about the dev mailing list