Re-create a routing table entry if the next hop is changed.

The next-hop address did not get updated in the routing table
in case an entry for the destination already existed.

This patch resolves the issue by removing the entry and
having it re-created from scratch.

The issue causes a routing error triggering reconstruction of
the DODAG through version increase.

In case of somewhat frequent downward traffic in not (yet) stabilized DODAG
a vicious circle is formed: unstable topology means churn, downward
routing under churn causes reconstruction of DODAG. In this situation
the network does not have chance to stabilize.

We encountered a constant churn caused by this bug
in a network of 50 nodes and a periodic traffic (a packet every 5
seconds) generated at the root.

More info and a PCAP demonstrating the issue can be found here:
https://github.com/contiki-os/contiki/issues/496
This commit is contained in:
Timofei Istomin 2014-06-05 18:15:20 +02:00
parent 2e166a83c7
commit 65ef375bdb

View File

@ -262,14 +262,16 @@ uip_ds6_route_add(uip_ipaddr_t *ipaddr, uint8_t length,
} }
/* First make sure that we don't add a route twice. If we find an /* First make sure that we don't add a route twice. If we find an
existing route for our destination, we'll just update the old existing route for our destination, we'll delete the old
one. */ one first. */
r = uip_ds6_route_lookup(ipaddr); r = uip_ds6_route_lookup(ipaddr);
if(r != NULL) { if(r != NULL) {
PRINTF("uip_ds6_route_add: old route already found, updating this one instead: "); PRINTF("uip_ds6_route_add: old route for ");
PRINT6ADDR(ipaddr); PRINT6ADDR(ipaddr);
PRINTF("\n"); PRINTF(" found, deleting it\n");
} else { uip_ds6_route_rm(r);
}
{
struct uip_ds6_route_neighbor_routes *routes; struct uip_ds6_route_neighbor_routes *routes;
/* If there is no routing entry, create one. We first need to /* If there is no routing entry, create one. We first need to
check if we have room for this route. If not, we remove the check if we have room for this route. If not, we remove the