Added and updated debugging printouts and reformatted code to make it a little easier to read.
This commit is contained in:
parent
248301a041
commit
82e8eb420d
4 changed files with 39 additions and 5 deletions
|
@ -663,8 +663,13 @@ dao_input(void)
|
|||
rep = uip_ds6_route_lookup(&prefix);
|
||||
|
||||
if(lifetime == RPL_ZERO_LIFETIME) {
|
||||
PRINTF("RPL: No-Path DAO received\n");
|
||||
/* No-Path DAO received; invoke the route purging routine. */
|
||||
if(rep != NULL && rep->state.nopath_received == 0 && rep->length == prefixlen && uip_ipaddr_cmp(uip_ds6_route_nexthop(rep), &dao_sender_addr)) {
|
||||
if(rep != NULL &&
|
||||
rep->state.nopath_received == 0 &&
|
||||
rep->length == prefixlen &&
|
||||
uip_ds6_route_nexthop(rep) != NULL &&
|
||||
uip_ipaddr_cmp(uip_ds6_route_nexthop(rep), &dao_sender_addr)) {
|
||||
PRINTF("RPL: Setting expiration timer for prefix ");
|
||||
PRINT6ADDR(&prefix);
|
||||
PRINTF("\n");
|
||||
|
@ -677,12 +682,15 @@ dao_input(void)
|
|||
learned_from = uip_is_addr_mcast(&dao_sender_addr) ?
|
||||
RPL_ROUTE_FROM_MULTICAST_DAO : RPL_ROUTE_FROM_UNICAST_DAO;
|
||||
|
||||
PRINTF("RPL: DAO from %s\n",
|
||||
learned_from == RPL_ROUTE_FROM_UNICAST_DAO? "unicast": "multicast");
|
||||
if(learned_from == RPL_ROUTE_FROM_UNICAST_DAO) {
|
||||
/* Check whether this is a DAO forwarding loop. */
|
||||
p = rpl_find_parent(dag, &dao_sender_addr);
|
||||
/* check if this is a new DAO registration with an "illegal" rank */
|
||||
/* if we already route to this node it is likely */
|
||||
if(p != NULL && DAG_RANK(p->rank, instance) < DAG_RANK(dag->rank, instance)) {
|
||||
if(p != NULL &&
|
||||
DAG_RANK(p->rank, instance) < DAG_RANK(dag->rank, instance)) {
|
||||
PRINTF("RPL: Loop detected when receiving a unicast DAO from a node with a lower rank! (%u < %u)\n",
|
||||
DAG_RANK(p->rank, instance), DAG_RANK(dag->rank, instance));
|
||||
p->rank = INFINITE_RANK;
|
||||
|
@ -691,6 +699,7 @@ dao_input(void)
|
|||
}
|
||||
}
|
||||
|
||||
PRINTF("RPL: adding DAO route\n");
|
||||
rep = rpl_add_route(dag, &prefix, prefixlen, &dao_sender_addr);
|
||||
if(rep == NULL) {
|
||||
RPL_STAT(rpl_stats.mem_overflows++);
|
||||
|
@ -704,7 +713,7 @@ dao_input(void)
|
|||
if(learned_from == RPL_ROUTE_FROM_UNICAST_DAO) {
|
||||
if(dag->preferred_parent) {
|
||||
PRINTF("RPL: Forwarding DAO to parent ");
|
||||
PRINT6ADDR(&dag->preferred_parent->addr);
|
||||
PRINT6ADDR(rpl_get_parent_ipaddr(dag->preferred_parent));
|
||||
PRINTF("\n");
|
||||
uip_icmp6_send(rpl_get_parent_ipaddr(dag->preferred_parent),
|
||||
ICMP6_RPL, RPL_CODE_DAO, buffer_length);
|
||||
|
@ -789,7 +798,7 @@ dao_output_target(rpl_parent_t *parent, uip_ipaddr_t *prefix, uint8_t lifetime)
|
|||
PRINTF("RPL: Sending DAO with prefix ");
|
||||
PRINT6ADDR(prefix);
|
||||
PRINTF(" to ");
|
||||
PRINT6ADDR(&parent->addr);
|
||||
PRINT6ADDR(rpl_get_parent_ipaddr(parent));
|
||||
PRINTF("\n");
|
||||
|
||||
uip_icmp6_send(rpl_get_parent_ipaddr(parent), ICMP6_RPL, RPL_CODE_DAO, pos);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue