dpctl: Fix crash.
authorPravin B Shelar <pshelar@nicira.com>
Thu, 20 Nov 2014 06:12:21 +0000 (22:12 -0800)
committerPravin B Shelar <pshelar@nicira.com>
Fri, 21 Nov 2014 23:51:40 +0000 (15:51 -0800)
ovs-dpctl crashed due to uninitialized router classifier. To
fix this issue move ovs router initialization to route table
module.

Reported-by: Madhu Challa <challa@noironetworks.com>
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
lib/dpif.c
lib/netdev-vport.c
lib/ovs-router.c
lib/ovs-router.h
lib/route-table.c
ofproto/ofproto-dpif.c

index d179d8a..33e32ef 100644 (file)
@@ -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);
     }
 }
 
index 167212e..3825a09 100644 (file)
@@ -254,8 +254,6 @@ netdev_vport_construct(struct netdev *netdev_)
         dev->tnl_cfg.dst_port = htons(LISP_DST_PORT);
     }
 
-    route_table_register();
-
     return 0;
 }
 
index 6b5ba00..e4f8a08 100644 (file)
@@ -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,
index 92d15c6..b0042cc 100644 (file)
@@ -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
index 6261954..63a9bd3 100644 (file)
@@ -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);
 
index 3f8768d..c8e11c2 100644 (file)
@@ -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);