From f069320ca985646aea53d10500352e1dd9e455ac Mon Sep 17 00:00:00 2001 From: joxe Date: Wed, 2 Jun 2010 11:59:51 +0000 Subject: [PATCH] removed sequence_number and replaced with version - fixing global repair functionality --- core/net/rpl/rpl-dag.c | 18 +++++++++--------- core/net/rpl/rpl-icmp6.c | 5 ++--- core/net/rpl/rpl.h | 5 ++--- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/core/net/rpl/rpl-dag.c b/core/net/rpl/rpl-dag.c index aa68d65a8..19ae1b69c 100644 --- a/core/net/rpl/rpl-dag.c +++ b/core/net/rpl/rpl-dag.c @@ -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 { diff --git a/core/net/rpl/rpl-icmp6.c b/core/net/rpl/rpl-icmp6.c index 649e9da00..1423fa507 100644 --- a/core/net/rpl/rpl-icmp6.c +++ b/core/net/rpl/rpl-icmp6.c @@ -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; diff --git a/core/net/rpl/rpl.h b/core/net/rpl/rpl.h index f203a3cc9..cbbd5eda2 100644 --- a/core/net/rpl/rpl.h +++ b/core/net/rpl/rpl.h @@ -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;