added function for checking downward route and added configuration for DAO NACK repair - default off

This commit is contained in:
Joakim Eriksson 2015-09-22 21:01:55 +02:00
parent ee65a3982c
commit 1fcef0f90d
5 changed files with 53 additions and 2 deletions

View File

@ -245,6 +245,17 @@
#define RPL_WITH_DAO_ACK 1
#endif /* RPL_CONF_WITH_DAO_ACK */
/*
* RPL REPAIR ON DAO NACK. When enabled, DAO NACK will trigger a local
* repair in order to quickly find a new parent to send DAO's to.
* NOTE: this is too agressive in some cases so use with care.
* */
#ifdef RPL_CONF_RPL_REPAIR_ON_DAO_NACK
#define RPL_REPAIR_ON_DAO_NACK RPL_CONF_RPL_REPAIR_ON_DAO_NACK
#else
#define RPL_REPAIR_ON_DAO_NACK 0
#endif /* RPL_CONF_RPL_REPAIR_ON_DAO_NACK */
/*
* Setting the DIO_REFRESH_DAO_ROUTES will make RPL always increase
* the DTSN (Destination Advertisement Trigger Sequence Number) when

View File

@ -1156,6 +1156,9 @@ global_repair(uip_ipaddr_t *from, rpl_dag_t *dag, rpl_dio_t *dio)
RPL_STAT(rpl_stats.global_repairs++);
}
void rpl_set_downward_link(uint8_t link);
/*---------------------------------------------------------------------------*/
void
rpl_local_repair(rpl_instance_t *instance)
@ -1174,6 +1177,9 @@ rpl_local_repair(rpl_instance_t *instance)
}
}
/* no downward link anymore */
rpl_set_downward_link(0);
rpl_reset_dio_timer(instance);
/* Request refresh of DAO registrations next DIO */
RPL_LOLLIPOP_INCREMENT(instance->dtsn_out);

View File

@ -89,6 +89,7 @@ void RPL_DEBUG_DAO_OUTPUT(rpl_parent_t *);
#endif
static uint8_t dao_sequence = RPL_LOLLIPOP_INIT;
static uint8_t downward = 0;
extern rpl_of_t RPL_OF;
@ -102,6 +103,19 @@ UIP_ICMP6_HANDLER(dio_handler, ICMP6_RPL, RPL_CODE_DIO, dio_input);
UIP_ICMP6_HANDLER(dao_handler, ICMP6_RPL, RPL_CODE_DAO, dao_input);
UIP_ICMP6_HANDLER(dao_ack_handler, ICMP6_RPL, RPL_CODE_DAO_ACK, dao_ack_input);
/*---------------------------------------------------------------------------*/
void
rpl_set_downward_link(uint8_t link)
{
downward = link;
}
int
rpl_has_downward_link()
{
return downward;
}
#if RPL_WITH_DAO_ACK
static uip_ds6_route_t *
find_route_entry_by_dao_ack(uint8_t seq)
@ -967,6 +981,13 @@ dao_output(rpl_parent_t *parent, uint8_t lifetime)
instance->my_dao_transmissions = 1;
ctimer_set(&instance->dao_retransmit_timer, RPL_DAO_RETRANSMISSION_TIMEOUT,
handle_dao_retransmission, parent);
if(lifetime == RPL_ZERO_LIFETIME) {
rpl_set_downward_link(0);
}
#else
/* We know that we have tried to register so now we are assuming
that we have a down-link - unless this is a zero lifetime one */
rpl_set_downward_link(lifetime != RPL_ZERO_LIFETIME);
#endif /* RPL_WITH_DAO_ACK */
}
/*---------------------------------------------------------------------------*/
@ -1107,6 +1128,8 @@ dao_ack_input(void)
if(sequence == instance->my_dao_seqno) {
PRINTF("RPL: DAO %s for me!\n", status < 128 ? "ACK" : "NACK");
rpl_set_downward_link(status < 128);
/* always stop the retransmit timer when the ACK arrived */
ctimer_stop(&instance->dao_retransmit_timer);
@ -1115,11 +1138,14 @@ dao_ack_input(void)
instance->of->dao_ack_callback(parent, status);
}
#if RPL_REPAIR_ON_DAO_NACK
if(status >= RPL_DAO_ACK_UNABLE_TO_ACCEPT) {
/* failed the DAO transmission - need to remove the default route. */
/* Trigger a local repair since we can not get our DAO in... */
rpl_local_repair(instance);
}
#endif
} else {
/* this DAO should be forwarded to another recently registered route */
uip_ds6_route_t *re;

View File

@ -49,7 +49,7 @@
#include "net/ipv6/uip-ds6-nbr.h"
#include "net/ipv6/uip-ds6-route.h"
#define DEBUG DEBUG_FULL
#define DEBUG DEBUG_NONE
#include "net/ip/uip-debug.h"
/*
@ -63,7 +63,7 @@
* neighbors and are not only MAC neighbors.
*/
#define MAX_CHILDREN (NBR_TABLE_MAX_NEIGHBORS - 3)
#define MAX_CHILDREN (NBR_TABLE_MAX_NEIGHBORS - 2)
#define UIP_IP_BUF ((struct uip_ip_hdr *)&uip_buf[UIP_LLH_LEN])
static int num_parents; /* any node that are possible parents */

View File

@ -300,5 +300,13 @@ enum rpl_mode rpl_set_mode(enum rpl_mode mode);
*/
enum rpl_mode rpl_get_mode(void);
/**
* Get the RPL's best guess on if we have downward link or not.
*
* \retval 1 if we have a downward link, 0 if not.
*/
int rpl_has_downward_link(void);
/*---------------------------------------------------------------------------*/
#endif /* RPL_H */