[ovs-dev] [PATCH v2] dpctl: Fix crash.

Pravin B Shelar pshelar at nicira.com
Thu Nov 20 06:12:21 UTC 2014


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 at noironetworks.com>
Signed-off-by: Pravin B Shelar <pshelar at nicira.com>
---
v1-v2:
Initialize route-table from dpif init.
---
 lib/dpif.c             |    1 +
 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, 4 insertions(+), 5 deletions(-)

diff --git a/lib/dpif.c b/lib/dpif.c
index d179d8a..844f869 100644
--- a/lib/dpif.c
+++ b/lib/dpif.c
@@ -118,6 +118,7 @@ dp_initialize(void)
         ovsthread_once_done(&once);
         tnl_port_map_init();
         tnl_arp_cache_init();
+        route_table_register();
     }
 }
 
diff --git a/lib/netdev-vport.c b/lib/netdev-vport.c
index 167212e..3825a09 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 6b5ba00..e4f8a08 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 92d15c6..b0042cc 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 6261954..63a9bd3 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 3f8768d..c8e11c2 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);
-- 
1.7.1




More information about the dev mailing list