rpl-lite: reset DOI timer in case of a significant rank update
This commit is contained in:
parent
a0b0ddbbea
commit
7d2b9c5b63
@ -345,11 +345,17 @@
|
||||
#endif /* RPL_CONF_MIN_HOPRANKINC */
|
||||
|
||||
#ifndef RPL_CONF_MAX_RANKINC
|
||||
#define RPL_MAX_RANKINC (7 * RPL_MIN_HOPRANKINC)
|
||||
#define RPL_MAX_RANKINC (8 * RPL_MIN_HOPRANKINC)
|
||||
#else /* RPL_CONF_MAX_RANKINC */
|
||||
#define RPL_MAX_RANKINC RPL_CONF_MAX_RANKINC
|
||||
#endif /* RPL_CONF_MAX_RANKINC */
|
||||
|
||||
#ifndef RPL_CONF_SIGNIFICANT_CHANGE_THRESHOLD
|
||||
#define RPL_SIGNIFICANT_CHANGE_THRESHOLD (4 * RPL_MIN_HOPRANKINC)
|
||||
#else /* RPL_CONF_SIGNIFICANT_CHANGE_THRESHOLD */
|
||||
#define RPL_SIGNIFICANT_CHANGE_THRESHOLD RPL_CONF_SIGNIFICANT_CHANGE_THRESHOLD
|
||||
#endif /* RPL_CONF_SIGNIFICANT_CHANGE_THRESHOLD */
|
||||
|
||||
/* This value decides which DAG instance we should participate in by default. */
|
||||
#ifdef RPL_CONF_DEFAULT_INSTANCE
|
||||
#define RPL_DEFAULT_INSTANCE RPL_CONF_DEFAULT_INSTANCE
|
||||
|
@ -234,7 +234,7 @@ rpl_dag_update_state(void)
|
||||
if(old_rank != RPL_INFINITE_RANK) {
|
||||
/* Advertise that we are leaving, and leave after a delay */
|
||||
LOG_WARN("poisoning and leaving after a delay\n");
|
||||
rpl_timers_dio_reset("Poison");
|
||||
rpl_timers_dio_reset("Poison routes");
|
||||
rpl_timers_schedule_leaving();
|
||||
}
|
||||
} else {
|
||||
@ -266,6 +266,17 @@ rpl_dag_update_state(void)
|
||||
curr_instance.dag.lowest_rank = curr_instance.dag.rank;
|
||||
}
|
||||
|
||||
/* Reset DIO timer in case of significant rank update */
|
||||
if(curr_instance.dag.last_advertised_rank != RPL_INFINITE_RANK
|
||||
&& curr_instance.dag.rank != RPL_INFINITE_RANK
|
||||
&& ABS((int32_t)curr_instance.dag.rank - curr_instance.dag.last_advertised_rank) > RPL_SIGNIFICANT_CHANGE_THRESHOLD) {
|
||||
LOG_WARN("significant rank update %u->%u\n",
|
||||
curr_instance.dag.last_advertised_rank, curr_instance.dag.rank);
|
||||
/* Update already here to avoid multiple resets in a row */
|
||||
curr_instance.dag.last_advertised_rank = curr_instance.dag.rank;
|
||||
rpl_timers_dio_reset("Significant rank update");
|
||||
}
|
||||
|
||||
/* Parent switch */
|
||||
if(curr_instance.dag.preferred_parent != old_parent) {
|
||||
/* We just got a parent (was NULL), reset trickle timer to advertise this */
|
||||
@ -285,6 +296,7 @@ rpl_dag_update_state(void)
|
||||
/* We have no more parent, schedule DIS to get a chance to hear updated state */
|
||||
curr_instance.dag.state = DAG_INITIALIZED;
|
||||
LOG_WARN("no parent, scheduling periodic DIS, will leave if no parent is found\n");
|
||||
rpl_timers_dio_reset("Poison routes");
|
||||
rpl_timers_schedule_periodic_dis();
|
||||
rpl_timers_schedule_leaving();
|
||||
}
|
||||
@ -439,6 +451,7 @@ init_dag(uint8_t instance_id, uip_ipaddr_t *dag_id, rpl_ocp_t ocp,
|
||||
|
||||
/* DAG */
|
||||
curr_instance.dag.rank = RPL_INFINITE_RANK;
|
||||
curr_instance.dag.last_advertised_rank = RPL_INFINITE_RANK;
|
||||
curr_instance.dag.lowest_rank = RPL_INFINITE_RANK;
|
||||
curr_instance.dag.dao_last_seqno = RPL_LOLLIPOP_INIT;
|
||||
curr_instance.dag.dao_last_acked_seqno = RPL_LOLLIPOP_INIT;
|
||||
|
@ -181,6 +181,7 @@ handle_dio_timer(void *ptr)
|
||||
}
|
||||
}
|
||||
#endif /* RPL_TRICKLE_REFRESH_DAO_ROUTES */
|
||||
curr_instance.dag.last_advertised_rank = curr_instance.dag.rank;
|
||||
rpl_icmp6_dio_output(NULL);
|
||||
}
|
||||
curr_instance.dag.dio_send = 0;
|
||||
|
@ -185,6 +185,7 @@ struct rpl_dag {
|
||||
rpl_nbr_t *preferred_parent;
|
||||
rpl_rank_t lowest_rank; /* The lowest rank seen in the current version */
|
||||
rpl_rank_t rank; /* The current rank */
|
||||
rpl_rank_t last_advertised_rank; /* The last rank advertised in a multicast-DIO */
|
||||
uint32_t lifetime;
|
||||
uint8_t version;
|
||||
uint8_t grounded;
|
||||
|
Loading…
Reference in New Issue
Block a user