mirror of
https://github.com/oliverschmidt/contiki.git
synced 2025-01-05 09:29:39 +00:00
avoid updating routes that already are correct
This commit is contained in:
parent
b8e2d33e06
commit
3aa8a62e41
@ -269,9 +269,16 @@ uip_ds6_route_add(uip_ipaddr_t *ipaddr, uint8_t length,
|
|||||||
one first. */
|
one first. */
|
||||||
r = uip_ds6_route_lookup(ipaddr);
|
r = uip_ds6_route_lookup(ipaddr);
|
||||||
if(r != NULL) {
|
if(r != NULL) {
|
||||||
|
uip_ipaddr_t *current_nexthop;
|
||||||
|
current_nexthop = uip_ds6_route_nexthop(r);
|
||||||
|
if(uip_ipaddr_cmp(nexthop, current_nexthop)) {
|
||||||
|
/* no need to update route - already correct! */
|
||||||
|
return r;
|
||||||
|
}
|
||||||
PRINTF("uip_ds6_route_add: old route for ");
|
PRINTF("uip_ds6_route_add: old route for ");
|
||||||
PRINT6ADDR(ipaddr);
|
PRINT6ADDR(ipaddr);
|
||||||
PRINTF(" found, deleting it\n");
|
PRINTF(" found, deleting it\n");
|
||||||
|
|
||||||
uip_ds6_route_rm(r);
|
uip_ds6_route_rm(r);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user