added locking of nexthop for routes to avoid the risk of nexthop removal
This commit is contained in:
parent
7c2bff0462
commit
5dee80a253
1 changed files with 4 additions and 1 deletions
|
@ -367,6 +367,9 @@ uip_ds6_route_add(uip_ipaddr_t *ipaddr, uint8_t length,
|
||||||
num_routes++;
|
num_routes++;
|
||||||
|
|
||||||
PRINTF("uip_ds6_route_add num %d\n", 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);
|
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);
|
list_remove(route->neighbor_routes->route_list, neighbor_route);
|
||||||
if(list_head(route->neighbor_routes->route_list) == NULL) {
|
if(list_head(route->neighbor_routes->route_list) == NULL) {
|
||||||
/* If this was the only route using this neighbor, remove the
|
/* 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");
|
PRINTF("uip_ds6_route_rm: removing neighbor too\n");
|
||||||
nbr_table_remove(nbr_routes, route->neighbor_routes->route_list);
|
nbr_table_remove(nbr_routes, route->neighbor_routes->route_list);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue