[ovs-dev] [PATCH] ovn-trace: Temporary fix for segment fault

Ben Pfaff blp at ovn.org
Wed Sep 14 23:59:29 UTC 2016


On Fri, Sep 09, 2016 at 02:05:14PM -0700, Han Zhou wrote:
> ovn-trace crashes when there are dhcp flows, which makes the tool
> unusable. This patch is to fix the crash with a dummy dhcp_opts,
> until dhcp_opts is completely supported by ovn-trace.
> 
> Signed-off-by: Han Zhou <zhouhan at gmail.com>

It doesn't fix the similar problem for DHCPv6 options.

How about this instead?  I have not tested it.

--8<--------------------------cut here-------------------------->8--

From: Ben Pfaff <blp at ovn.org>
Date: Wed, 14 Sep 2016 16:58:44 -0700
Subject: [PATCH] ovn-trace: Avoid segfault for DHCP options flows.

It would be better if ovn-trace fully supported DHCP options, but this at
least should avoid the segmentation fault.

Reported-by: Han Zhou <zhouhan at gmail.com>
Signed-off-by: Ben Pfaff <blp at ovn.org>
---
 ovn/lib/actions.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ovn/lib/actions.c b/ovn/lib/actions.c
index 03dba8f..59131dd 100644
--- a/ovn/lib/actions.c
+++ b/ovn/lib/actions.c
@@ -1321,7 +1321,7 @@ parse_dhcp_opt(struct action_context *ctx, struct ovnact_dhcp_option *o,
 
     const char *name = v6 ? "DHCPv6" : "DHCPv4";
     const struct hmap *map = v6 ? ctx->pp->dhcpv6_opts : ctx->pp->dhcp_opts;
-    o->option = dhcp_opts_find(map, ctx->lexer->token.s);
+    o->option = map ? dhcp_opts_find(map, ctx->lexer->token.s) : NULL;
     if (!o->option) {
         lexer_syntax_error(ctx->lexer, "expecting %s option name", name);
         return;
-- 
2.1.3




More information about the dev mailing list