]> git.puffer.fish Git - mirror/frr.git/commitdiff
ospf6d: fix ospf6d crash during sigterm/shutdown 1300/head
authorChirag Shah <chirag@cumulusnetworks.com>
Wed, 4 Oct 2017 21:31:35 +0000 (14:31 -0700)
committerChirag Shah <chirag@cumulusnetworks.com>
Fri, 6 Oct 2017 17:01:46 +0000 (10:01 -0700)
During signterm (shutdown) ospf6_clean calls route_remove
for brouter_table, during route_remove brouter_table remove
hook function is invoked which in turns calls router_remove
is any of the LSA has max age or cost is infinity,
which leads to stack corruption trying to delete same
route node.
Similar to 'no router ospf6' or 'no area ..' command
where lsdb is cleanedup then brouter route table
clean up is called.

Clean some of route trace to have route related fields.

Ticket:CM-17932

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
ospf6d/ospf6_main.c
ospf6d/ospf6_route.c

index e582737f940e9f16c1ca2a2b702b72e7352cf5f0..76c20fa81f5e9226eee52993247c9a48bea5cb30 100644 (file)
@@ -125,7 +125,6 @@ static void sigint(void)
 static void sigterm(void)
 {
        zlog_notice("Terminating on signal SIGTERM");
-       ospf6_clean();
        ospf6_exit(0);
 }
 
index 5b78dda688d8dfbdc710229a3f0eb55bbdc83291..3c77c483ea07ea18fb26b930da75db9faf2923fa 100644 (file)
@@ -683,9 +683,9 @@ struct ospf6_route *ospf6_route_add(struct ospf6_route *route,
 
        /* Else, this is the brand new route regarding to the prefix */
        if (IS_OSPF6_DEBUG_ROUTE(MEMORY))
-               zlog_debug("%s %p: route add %p: brand new route",
+               zlog_debug("%s %p: route add %p %s : brand new route",
                           ospf6_route_table_name(table), (void *)table,
-                          (void *)route);
+                          (void *)route, buf);
        else if (IS_OSPF6_DEBUG_ROUTE(TABLE))
                zlog_debug("%s: route add: brand new route",
                           ospf6_route_table_name(table));
@@ -760,9 +760,9 @@ void ospf6_route_remove(struct ospf6_route *route,
                prefix2str(&route->prefix, buf, sizeof(buf));
 
        if (IS_OSPF6_DEBUG_ROUTE(MEMORY))
-               zlog_debug("%s %p: route remove %p: %s rnode refcount %u",
+               zlog_debug("%s %p: route remove %p: %s refcount %u",
                           ospf6_route_table_name(table), (void *)table,
-                          (void *)route, buf, route->rnode->lock);
+                          (void *)route, buf, route->lock);
        else if (IS_OSPF6_DEBUG_ROUTE(TABLE))
                zlog_debug("%s: route remove: %s",
                           ospf6_route_table_name(table), buf);
@@ -801,6 +801,7 @@ void ospf6_route_remove(struct ospf6_route *route,
 
        SET_FLAG(route->flag, OSPF6_ROUTE_WAS_REMOVED);
 
+       /* Note hook_remove may call ospf6_route_remove */
        if (table->hook_remove)
                (*table->hook_remove)(route);