added locking of nexthop for routes to avoid the risk of nexthop removal

This commit is contained in:
Joakim Eriksson 2015-08-26 18:23:06 +02:00
parent 7c2bff0462
commit 5dee80a253

View file

@ -367,6 +367,9 @@ uip_ds6_route_add(uip_ipaddr_t *ipaddr, uint8_t length,
num_routes++;
PRINTF("uip_ds6_route_add num %d\n", num_routes);
/* lock this entry so that nexthop is not removed */
nbr_table_lock(nbr_routes, routes);
}
uip_ipaddr_copy(&(r->ipaddr), ipaddr);
@ -423,7 +426,7 @@ uip_ds6_route_rm(uip_ds6_route_t *route)
list_remove(route->neighbor_routes->route_list, neighbor_route);
if(list_head(route->neighbor_routes->route_list) == NULL) {
/* If this was the only route using this neighbor, remove the
neibhor from the table */
neighbor from the table - this implicitly unlocks nexthop */
PRINTF("uip_ds6_route_rm: removing neighbor too\n");
nbr_table_remove(nbr_routes, route->neighbor_routes->route_list);
}