From 5dee80a253d4aa09d265f4ce95cc316b98364101 Mon Sep 17 00:00:00 2001 From: Joakim Eriksson Date: Wed, 26 Aug 2015 18:23:06 +0200 Subject: [PATCH] added locking of nexthop for routes to avoid the risk of nexthop removal --- core/net/ipv6/uip-ds6-route.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/net/ipv6/uip-ds6-route.c b/core/net/ipv6/uip-ds6-route.c index 49e3d3588..a5c00d384 100644 --- a/core/net/ipv6/uip-ds6-route.c +++ b/core/net/ipv6/uip-ds6-route.c @@ -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); }