Make the distinction between incoming and outgoing DTSN clear.

This commit is contained in:
nvt-se 2010-06-08 16:21:54 +00:00
parent b8848f29eb
commit 4a08f545c9
3 changed files with 9 additions and 13 deletions

View file

@ -32,7 +32,7 @@
*
* This file is part of the Contiki operating system.
*
* $Id: rpl-dag.c,v 1.23 2010/06/08 15:40:50 nvt-se Exp $
* $Id: rpl-dag.c,v 1.24 2010/06/08 16:21:54 nvt-se Exp $
*/
/**
* \file
@ -164,7 +164,7 @@ rpl_set_root(uip_ipaddr_t *dag_id)
dag->rank = ROOT_RANK;
dag->of = rpl_find_of(RPL_DEFAULT_OCP);
dag->best_parent = NULL;
dag->dtsn = 1; /* Trigger DAOs from the beginning. */
dag->dtsn_out = 1; /* Trigger DAOs from the beginning. */
memcpy(&dag->dag_id, dag_id, sizeof(dag->dag_id));
@ -438,7 +438,6 @@ join_dag(uip_ipaddr_t *from, rpl_dio_t *dio)
dag->min_rank = dag->rank; /* So far this is the lowest rank we know */
dag->version = dio->version;
dag->best_parent = p;
dag->dtsn = dio->dtsn;
dag->dio_intdoubl = dio->dag_intdoubl;
dag->dio_intmin = dio->dag_intmin;
@ -474,7 +473,7 @@ global_repair(uip_ipaddr_t *from, rpl_dag_t *dag, rpl_dio_t *dio)
remove_parents(dag, NULL, !POISON_ROUTES);
dag->version = dio->version;
dag->dtsn = 0;
dag->dtsn_out = 1;
dag->of->reset(dag);
if((p = rpl_add_parent(dag, dio, from)) == NULL) {
PRINTF("RPL: Failed to add a parent during the global repair\n");
@ -497,7 +496,7 @@ rpl_repair_dag(rpl_dag_t *dag)
{
if(dag->rank == ROOT_RANK) {
dag->version++;
dag->dtsn = 1;
dag->dtsn_out = 1;
rpl_reset_dio_timer(dag, 1);
return 1;
}
@ -553,10 +552,6 @@ rpl_process_dio(uip_ipaddr_t *from, rpl_dio_t *dio)
return;
}
if(dag->rank != ROOT_RANK && (dag->dtsn < dio->dtsn || dag->dtsn == (uint8_t)~0)) {
dag->dtsn = dio->dtsn;
}
/* This DIO pertains to a DAG that we are already part of. */
p = rpl_find_parent(dag, from);
if(p != NULL) {

View file

@ -33,7 +33,7 @@
*
* This file is part of the Contiki operating system.
*
* $Id: rpl-icmp6.c,v 1.18 2010/06/06 21:42:50 nvt-se Exp $
* $Id: rpl-icmp6.c,v 1.19 2010/06/08 16:21:54 nvt-se Exp $
*/
/**
* \file
@ -323,7 +323,8 @@ 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->dtsn;
buffer[pos++] = ++dag->dtsn_out;
/* reserved 2 bytes */
pos += 2;

View file

@ -30,7 +30,7 @@
*
* Author: Joakim Eriksson, Nicolas Tsiftes
*
* $Id: rpl.h,v 1.14 2010/06/06 21:48:15 nvt-se Exp $
* $Id: rpl.h,v 1.15 2010/06/08 16:21:54 nvt-se Exp $
*/
#ifndef RPL_H
@ -225,7 +225,7 @@ struct rpl_dag {
uip_ds6_defrt_t *def_route;
rpl_rank_t rank;
rpl_rank_t min_rank; /* should be reset per DODAG iteration! */
uint8_t dtsn;
uint8_t dtsn_out;
uint8_t instance_id;
uint8_t version;
uint8_t preference;