From 1bc50ef389d40be9ee215e66b49cf66fcbdb9eeb Mon Sep 17 00:00:00 2001 From: Pravin B Shelar Date: Wed, 19 Nov 2014 22:12:21 -0800 Subject: [PATCH] dpctl: Fix crash. ovs-dpctl crashed due to uninitialized router classifier. To fix this issue move ovs router initialization to route table module. Reported-by: Madhu Challa Signed-off-by: Pravin B Shelar Acked-by: Jarno Rajahalme --- lib/dpif.c | 5 ++++- lib/netdev-vport.c | 2 -- lib/ovs-router.c | 2 +- lib/ovs-router.h | 2 +- lib/route-table.c | 1 + ofproto/ofproto-dpif.c | 1 - 6 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/dpif.c b/lib/dpif.c index d179d8a1b..33e32ef3f 100644 --- a/lib/dpif.c +++ b/lib/dpif.c @@ -38,6 +38,7 @@ #include "packet-dpif.h" #include "packets.h" #include "poll-loop.h" +#include "route-table.h" #include "shash.h" #include "sset.h" #include "timeval.h" @@ -115,9 +116,11 @@ dp_initialize(void) dp_register_provider(base_dpif_classes[i]); } dpctl_unixctl_register(); - ovsthread_once_done(&once); tnl_port_map_init(); tnl_arp_cache_init(); + route_table_register(); + + ovsthread_once_done(&once); } } diff --git a/lib/netdev-vport.c b/lib/netdev-vport.c index 167212e14..3825a0921 100644 --- a/lib/netdev-vport.c +++ b/lib/netdev-vport.c @@ -254,8 +254,6 @@ netdev_vport_construct(struct netdev *netdev_) dev->tnl_cfg.dst_port = htons(LISP_DST_PORT); } - route_table_register(); - return 0; } diff --git a/lib/ovs-router.c b/lib/ovs-router.c index 6b5ba00a3..e4f8a089e 100644 --- a/lib/ovs-router.c +++ b/lib/ovs-router.c @@ -281,7 +281,7 @@ ovs_router_flush(void) /* May not be called more than once. */ void -ovs_router_unixctl_register(void) +ovs_router_init(void) { classifier_init(&cls, NULL); unixctl_command_register("ovs/route/add", "ipv4_addr/prefix_len out_br_name gw", 2, 3, diff --git a/lib/ovs-router.h b/lib/ovs-router.h index 92d15c626..b0042ccc3 100644 --- a/lib/ovs-router.h +++ b/lib/ovs-router.h @@ -24,7 +24,7 @@ extern "C" { #endif bool ovs_router_lookup(ovs_be32 ip_dst, char out_dev[], ovs_be32 *gw); -void ovs_router_unixctl_register(void); +void ovs_router_init(void); #ifdef __cplusplus } #endif diff --git a/lib/route-table.c b/lib/route-table.c index 6261954a4..63a9bd363 100644 --- a/lib/route-table.c +++ b/lib/route-table.c @@ -96,6 +96,7 @@ route_table_register(void) ovs_assert(!nln); ovs_assert(!route_notifier); + ovs_router_init(); nln = nln_create(NETLINK_ROUTE, RTNLGRP_IPV4_ROUTE, (nln_parse_func *) route_table_parse, &rtmsg); diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index 3f8768dbf..c8e11c21e 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -1253,7 +1253,6 @@ construct(struct ofproto *ofproto_) guarded_list_init(&ofproto->pins); ofproto_unixctl_init(); - ovs_router_unixctl_register(); hmap_init(&ofproto->vlandev_map); hmap_init(&ofproto->realdev_vid_map); -- 2.20.1