removed sequence_number and replaced with version - fixing global repair functionality

This commit is contained in:
joxe 2010-06-02 11:59:51 +00:00
parent fec0e8df69
commit f069320ca9
3 changed files with 13 additions and 15 deletions

View file

@ -32,7 +32,7 @@
*
* 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
@ -416,7 +416,7 @@ join_dag(uip_ipaddr_t *from, rpl_dio_t *dio)
dag->instance_id = dio->instance_id;
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->sequence_number = dio->sequence_number;
dag->version = dio->version;
dag->dio_intdoubl = dio->dag_intdoubl;
dag->dio_intmin = dio->dag_intmin;
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;
poison_routes(dag, NULL);
dag->sequence_number = dio->sequence_number;
dag->version = dio->version;
if((p = rpl_add_parent(dag, from)) == NULL) {
PRINTF("RPL: Failed to add a parent during the global repair\n");
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);
rpl_reset_dio_timer(dag, 1);
}
PRINTF("RPL: Participating in a global DAG repair. New DAG sequence number: %u, new rank: %hu\n",
dag->sequence_number, dag->rank);
PRINTF("RPL: Participating in a global DAG repair. New DAG version number: %u, new rank: %hu\n",
dag->version, dag->rank);
}
/************************************************************************/
@ -470,7 +470,7 @@ int
rpl_repair_dag(rpl_dag_t *dag)
{
if(dag->rank == ROOT_RANK) {
dag->sequence_number++;
dag->version++;
rpl_reset_dio_timer(dag, 1);
return 1;
}
@ -509,10 +509,10 @@ rpl_process_dio(uip_ipaddr_t *from, rpl_dio_t *dio)
return;
}
if(dio->sequence_number > dag->sequence_number) {
if(dio->version > dag->version) {
if(dag->rank == ROOT_RANK) {
PRINTF("RPL: Root received inconsistent DIO sequence number\n");
dag->sequence_number = dio->sequence_number + 1;
PRINTF("RPL: Root received inconsistent DIO version number\n");
dag->version = dio->version + 1;
rpl_reset_dio_timer(dag, 1);
return;
} else {

View file

@ -33,7 +33,7 @@
*
* 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
@ -324,7 +324,7 @@ dio_output(rpl_dag_t *dag, uip_ipaddr_t *uc_addr)
buffer = UIP_ICMP_PAYLOAD;
buffer[pos++] = dag->instance_id;
buffer[pos++] = 0; /* version */
buffer[pos++] = dag->version;
buffer[pos++] = dag->rank >> 8;
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. */
buffer[pos] |= RPL_DIO_DEST_ADV_SUPPORTED | RPL_DIO_DEST_ADV_TRIGGER;
pos++;
/* buffer[pos++] = dag->sequence_number; */
buffer[pos++] = dag->dtsn;
/* reserved 2 bytes */
pos += 2;

View file

@ -30,7 +30,7 @@
*
* 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
@ -192,7 +192,6 @@ struct rpl_dio {
uint8_t dst_adv_supported;
uint8_t preference;
uint8_t version;
uint8_t sequence_number;
uint8_t instance_id;
uint8_t dtsn;
uint8_t dag_intdoubl;
@ -217,7 +216,7 @@ struct rpl_dag {
rpl_rank_t min_rank; /* should be reset per DODAG iteration! */
uint8_t dtsn;
uint8_t instance_id;
uint8_t sequence_number;
uint8_t version;
uint8_t preference;
uint8_t grounded;
uint8_t dio_intdoubl;