mirror of
https://github.com/oliverschmidt/contiki.git
synced 2024-09-09 23:54:32 +00:00
Added isinfinite to uip_ds6_defrt_t to handle infinite life time
This commit is contained in:
parent
808116ff56
commit
7aeb206840
@ -32,7 +32,7 @@
|
||||
*
|
||||
* This file is part of the Contiki operating system.
|
||||
*
|
||||
* $Id: rpl-dag.c,v 1.5 2010/05/10 11:16:35 joxe Exp $
|
||||
* $Id: rpl-dag.c,v 1.6 2010/05/10 13:46:35 nifi Exp $
|
||||
*/
|
||||
/**
|
||||
* \file
|
||||
@ -175,7 +175,11 @@ rpl_set_default_route(rpl_dag_t *dag, uip_ipaddr_t *from)
|
||||
PRINTF("RPL: Adding default route through ");
|
||||
PRINT6ADDR(from);
|
||||
PRINTF("\n");
|
||||
if(DEFAULT_ROUTE_LIFETIME == INFINITE_LIFETIME) {
|
||||
dag->def_route = uip_ds6_defrt_add(from, 0);
|
||||
} else {
|
||||
dag->def_route = uip_ds6_defrt_add(from, DEFAULT_ROUTE_LIFETIME);
|
||||
}
|
||||
if(dag->def_route == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -196,7 +196,8 @@ uip_ds6_periodic(void)
|
||||
/* Periodic processing on default routers */
|
||||
for(locdefrt = uip_ds6_defrt_list;
|
||||
locdefrt < uip_ds6_defrt_list + UIP_DS6_DEFRT_NB; locdefrt++) {
|
||||
if((locdefrt->isused) && (stimer_expired(&(locdefrt->lifetime)))) {
|
||||
if((locdefrt->isused) && (!locdefrt->isinfinite) &&
|
||||
(stimer_expired(&(locdefrt->lifetime)))) {
|
||||
uip_ds6_defrt_rm(locdefrt);
|
||||
}
|
||||
}
|
||||
@ -374,7 +375,12 @@ uip_ds6_defrt_add(uip_ipaddr_t *ipaddr, unsigned long interval)
|
||||
(uip_ds6_element_t **) & locdefrt) == FREESPACE) {
|
||||
locdefrt->isused = 1;
|
||||
uip_ipaddr_copy(&(locdefrt->ipaddr), ipaddr);
|
||||
if(interval != 0) {
|
||||
stimer_set(&(locdefrt->lifetime), interval);
|
||||
locdefrt->isinfinite = 0;
|
||||
} else {
|
||||
locdefrt->isinfinite = 1;
|
||||
}
|
||||
|
||||
PRINTF("Adding defrouter with ip addr");
|
||||
PRINT6ADDR(&locdefrt->ipaddr);
|
||||
|
@ -173,6 +173,7 @@ typedef struct uip_ds6_defrt {
|
||||
uint8_t isused;
|
||||
uip_ipaddr_t ipaddr;
|
||||
struct stimer lifetime;
|
||||
uint8_t isinfinite;
|
||||
} uip_ds6_defrt_t;
|
||||
|
||||
/** \brief A prefix list entry */
|
||||
|
Loading…
Reference in New Issue
Block a user