clear default route when neighbour is removed

This commit is contained in:
joxe 2010-09-20 15:30:12 +00:00
parent 110bc0242e
commit 63ab1ffce0

View file

@ -32,7 +32,7 @@
* *
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
* $Id: rpl.c,v 1.8 2010/06/14 18:35:04 nvt-se Exp $ * $Id: rpl.c,v 1.9 2010/09/20 15:30:12 joxe Exp $
*/ */
/** /**
* \file * \file
@ -170,8 +170,19 @@ rpl_ipv6_neighbor_callback(uip_ds6_nbr_t *nbr)
rpl_dag_t *dag; rpl_dag_t *dag;
rpl_parent_t *p; rpl_parent_t *p;
/* This only handles one DODAG - if multiple we need to check all */
dag = rpl_get_dag(RPL_ANY_INSTANCE); dag = rpl_get_dag(RPL_ANY_INSTANCE);
if(!nbr->isused && dag) { if(dag == NULL) {
return;
}
/* if this is our default route then clean the dag->def_route state */
if(dag->def_route != NULL &&
uip_ipaddr_cmp(&dag->def_route->ipaddr, &nbr->ipaddr)) {
dag->def_route = NULL;
}
if(!nbr->isused) {
PRINTF("RPL: Removing neighbor "); PRINTF("RPL: Removing neighbor ");
PRINT6ADDR(&nbr->ipaddr); PRINT6ADDR(&nbr->ipaddr);
PRINTF("\n"); PRINTF("\n");