removed sequence_number and replaced with version - fixing global repair functionality
This commit is contained in:
parent
fec0e8df69
commit
f069320ca9
@ -32,7 +32,7 @@
|
|||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* $Id: rpl-dag.c,v 1.12 2010/06/01 22:30:02 joxe Exp $
|
* $Id: rpl-dag.c,v 1.13 2010/06/02 11:59:51 joxe Exp $
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* \file
|
* \file
|
||||||
@ -416,7 +416,7 @@ join_dag(uip_ipaddr_t *from, rpl_dio_t *dio)
|
|||||||
dag->instance_id = dio->instance_id;
|
dag->instance_id = dio->instance_id;
|
||||||
dag->rank = dag->of->increment_rank(dio->dag_rank, p);
|
dag->rank = dag->of->increment_rank(dio->dag_rank, p);
|
||||||
dag->min_rank = dag->rank; /* So far this is the lowest rank we know */
|
dag->min_rank = dag->rank; /* So far this is the lowest rank we know */
|
||||||
dag->sequence_number = dio->sequence_number;
|
dag->version = dio->version;
|
||||||
dag->dio_intdoubl = dio->dag_intdoubl;
|
dag->dio_intdoubl = dio->dag_intdoubl;
|
||||||
dag->dio_intmin = dio->dag_intmin;
|
dag->dio_intmin = dio->dag_intmin;
|
||||||
dag->dio_redundancy = dio->dag_redund;
|
dag->dio_redundancy = dio->dag_redund;
|
||||||
@ -451,7 +451,7 @@ global_repair(uip_ipaddr_t *from, rpl_dag_t *dag, rpl_dio_t *dio)
|
|||||||
rpl_parent_t *p;
|
rpl_parent_t *p;
|
||||||
|
|
||||||
poison_routes(dag, NULL);
|
poison_routes(dag, NULL);
|
||||||
dag->sequence_number = dio->sequence_number;
|
dag->version = dio->version;
|
||||||
if((p = rpl_add_parent(dag, from)) == NULL) {
|
if((p = rpl_add_parent(dag, from)) == NULL) {
|
||||||
PRINTF("RPL: Failed to add a parent during the global repair\n");
|
PRINTF("RPL: Failed to add a parent during the global repair\n");
|
||||||
dag->rank = INFINITE_RANK;
|
dag->rank = INFINITE_RANK;
|
||||||
@ -461,8 +461,8 @@ global_repair(uip_ipaddr_t *from, rpl_dag_t *dag, rpl_dio_t *dio)
|
|||||||
dag->rank = dag->of->increment_rank(dio->dag_rank, p);
|
dag->rank = dag->of->increment_rank(dio->dag_rank, p);
|
||||||
rpl_reset_dio_timer(dag, 1);
|
rpl_reset_dio_timer(dag, 1);
|
||||||
}
|
}
|
||||||
PRINTF("RPL: Participating in a global DAG repair. New DAG sequence number: %u, new rank: %hu\n",
|
PRINTF("RPL: Participating in a global DAG repair. New DAG version number: %u, new rank: %hu\n",
|
||||||
dag->sequence_number, dag->rank);
|
dag->version, dag->rank);
|
||||||
|
|
||||||
}
|
}
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
@ -470,7 +470,7 @@ int
|
|||||||
rpl_repair_dag(rpl_dag_t *dag)
|
rpl_repair_dag(rpl_dag_t *dag)
|
||||||
{
|
{
|
||||||
if(dag->rank == ROOT_RANK) {
|
if(dag->rank == ROOT_RANK) {
|
||||||
dag->sequence_number++;
|
dag->version++;
|
||||||
rpl_reset_dio_timer(dag, 1);
|
rpl_reset_dio_timer(dag, 1);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -509,10 +509,10 @@ rpl_process_dio(uip_ipaddr_t *from, rpl_dio_t *dio)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(dio->sequence_number > dag->sequence_number) {
|
if(dio->version > dag->version) {
|
||||||
if(dag->rank == ROOT_RANK) {
|
if(dag->rank == ROOT_RANK) {
|
||||||
PRINTF("RPL: Root received inconsistent DIO sequence number\n");
|
PRINTF("RPL: Root received inconsistent DIO version number\n");
|
||||||
dag->sequence_number = dio->sequence_number + 1;
|
dag->version = dio->version + 1;
|
||||||
rpl_reset_dio_timer(dag, 1);
|
rpl_reset_dio_timer(dag, 1);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* $Id: rpl-icmp6.c,v 1.13 2010/06/01 22:30:02 joxe Exp $
|
* $Id: rpl-icmp6.c,v 1.14 2010/06/02 11:59:51 joxe Exp $
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* \file
|
* \file
|
||||||
@ -324,7 +324,7 @@ dio_output(rpl_dag_t *dag, uip_ipaddr_t *uc_addr)
|
|||||||
|
|
||||||
buffer = UIP_ICMP_PAYLOAD;
|
buffer = UIP_ICMP_PAYLOAD;
|
||||||
buffer[pos++] = dag->instance_id;
|
buffer[pos++] = dag->instance_id;
|
||||||
buffer[pos++] = 0; /* version */
|
buffer[pos++] = dag->version;
|
||||||
buffer[pos++] = dag->rank >> 8;
|
buffer[pos++] = dag->rank >> 8;
|
||||||
buffer[pos++] = dag->rank & 0xff;
|
buffer[pos++] = dag->rank & 0xff;
|
||||||
|
|
||||||
@ -334,7 +334,6 @@ dio_output(rpl_dag_t *dag, uip_ipaddr_t *uc_addr)
|
|||||||
/* Set dst_adv_trigger and dst_adv_supported. */
|
/* Set dst_adv_trigger and dst_adv_supported. */
|
||||||
buffer[pos] |= RPL_DIO_DEST_ADV_SUPPORTED | RPL_DIO_DEST_ADV_TRIGGER;
|
buffer[pos] |= RPL_DIO_DEST_ADV_SUPPORTED | RPL_DIO_DEST_ADV_TRIGGER;
|
||||||
pos++;
|
pos++;
|
||||||
/* buffer[pos++] = dag->sequence_number; */
|
|
||||||
buffer[pos++] = dag->dtsn;
|
buffer[pos++] = dag->dtsn;
|
||||||
/* reserved 2 bytes */
|
/* reserved 2 bytes */
|
||||||
pos += 2;
|
pos += 2;
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
*
|
*
|
||||||
* Author: Joakim Eriksson, Nicolas Tsiftes
|
* Author: Joakim Eriksson, Nicolas Tsiftes
|
||||||
*
|
*
|
||||||
* $Id: rpl.h,v 1.7 2010/06/01 22:30:02 joxe Exp $
|
* $Id: rpl.h,v 1.8 2010/06/02 11:59:52 joxe Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef RPL_H
|
#ifndef RPL_H
|
||||||
@ -192,7 +192,6 @@ struct rpl_dio {
|
|||||||
uint8_t dst_adv_supported;
|
uint8_t dst_adv_supported;
|
||||||
uint8_t preference;
|
uint8_t preference;
|
||||||
uint8_t version;
|
uint8_t version;
|
||||||
uint8_t sequence_number;
|
|
||||||
uint8_t instance_id;
|
uint8_t instance_id;
|
||||||
uint8_t dtsn;
|
uint8_t dtsn;
|
||||||
uint8_t dag_intdoubl;
|
uint8_t dag_intdoubl;
|
||||||
@ -217,7 +216,7 @@ struct rpl_dag {
|
|||||||
rpl_rank_t min_rank; /* should be reset per DODAG iteration! */
|
rpl_rank_t min_rank; /* should be reset per DODAG iteration! */
|
||||||
uint8_t dtsn;
|
uint8_t dtsn;
|
||||||
uint8_t instance_id;
|
uint8_t instance_id;
|
||||||
uint8_t sequence_number;
|
uint8_t version;
|
||||||
uint8_t preference;
|
uint8_t preference;
|
||||||
uint8_t grounded;
|
uint8_t grounded;
|
||||||
uint8_t dio_intdoubl;
|
uint8_t dio_intdoubl;
|
||||||
|
Loading…
Reference in New Issue
Block a user