Merge pull request #2251 from arurke/RPL_debug_cleanup
Minor cleanup to RPL debug output
This commit is contained in:
commit
a08fc6a381
|
@ -99,13 +99,12 @@ create_dag_callback(void *ptr)
|
||||||
rpl_dag_t *dag;
|
rpl_dag_t *dag;
|
||||||
|
|
||||||
dag = rpl_get_any_dag();
|
dag = rpl_get_any_dag();
|
||||||
#if DEBUG
|
|
||||||
printf("Found a network we did not create\n");
|
PRINTF("RPL: Found a network we did not create\n");
|
||||||
printf("version %d grounded %d preference %d used %d joined %d rank %d\n",
|
PRINTF("RPL: version %d grounded %d preference %d used %d joined %d rank %d\n",
|
||||||
dag->version, dag->grounded,
|
dag->version, dag->grounded,
|
||||||
dag->preference, dag->used,
|
dag->preference, dag->used,
|
||||||
dag->joined, dag->rank);
|
dag->joined, dag->rank);
|
||||||
#endif /* DEBUG */
|
|
||||||
|
|
||||||
/* We found a RPL network that we did not create so we just join
|
/* We found a RPL network that we did not create so we just join
|
||||||
it without becoming root. But if the network has an infinite
|
it without becoming root. But if the network has an infinite
|
||||||
|
@ -223,14 +222,14 @@ rpl_dag_root_init_dag_immediately(void)
|
||||||
|
|
||||||
uip_ip6addr(&prefix, UIP_DS6_DEFAULT_PREFIX, 0, 0, 0, 0, 0, 0, 0);
|
uip_ip6addr(&prefix, UIP_DS6_DEFAULT_PREFIX, 0, 0, 0, 0, 0, 0, 0);
|
||||||
rpl_set_prefix(dag, &prefix, 64);
|
rpl_set_prefix(dag, &prefix, 64);
|
||||||
PRINTF("rpl_dag_root_init_dag: created a new RPL dag\n");
|
PRINTF("RPL: rpl_dag_root_init_dag: created a new RPL dag\n");
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
PRINTF("rpl_dag_root_init_dag: failed to create a new RPL DAG\n");
|
PRINTF("RPL: rpl_dag_root_init_dag: failed to create a new RPL DAG\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
PRINTF("rpl_dag_root_init_dag: failed to create a new RPL DAG, no preferred IP address found\n");
|
PRINTF("RPL: rpl_dag_root_init_dag: failed to create a new RPL DAG, no preferred IP address found\n");
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -525,10 +525,10 @@ rpl_set_prefix(rpl_dag_t *dag, uip_ipaddr_t *prefix, unsigned len)
|
||||||
/* Autoconfigure an address if this node does not already have an address
|
/* Autoconfigure an address if this node does not already have an address
|
||||||
with this prefix. Otherwise, update the prefix */
|
with this prefix. Otherwise, update the prefix */
|
||||||
if(last_len == 0) {
|
if(last_len == 0) {
|
||||||
PRINTF("rpl_set_prefix - prefix NULL\n");
|
PRINTF("RPL: rpl_set_prefix - prefix NULL\n");
|
||||||
check_prefix(NULL, &dag->prefix_info);
|
check_prefix(NULL, &dag->prefix_info);
|
||||||
} else {
|
} else {
|
||||||
PRINTF("rpl_set_prefix - prefix NON-NULL\n");
|
PRINTF("RPL: rpl_set_prefix - prefix NON-NULL\n");
|
||||||
check_prefix(&last_prefix, &dag->prefix_info);
|
check_prefix(&last_prefix, &dag->prefix_info);
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -983,7 +983,7 @@ rpl_move_parent(rpl_dag_t *dag_src, rpl_dag_t *dag_dst, rpl_parent_t *parent)
|
||||||
PRINTF("RPL: Removing default route ");
|
PRINTF("RPL: Removing default route ");
|
||||||
PRINT6ADDR(rpl_get_parent_ipaddr(parent));
|
PRINT6ADDR(rpl_get_parent_ipaddr(parent));
|
||||||
PRINTF("\n");
|
PRINTF("\n");
|
||||||
PRINTF("rpl_move_parent\n");
|
PRINTF("RPL: rpl_move_parent\n");
|
||||||
uip_ds6_defrt_rm(dag_src->instance->def_route);
|
uip_ds6_defrt_rm(dag_src->instance->def_route);
|
||||||
dag_src->instance->def_route = NULL;
|
dag_src->instance->def_route = NULL;
|
||||||
}
|
}
|
||||||
|
@ -1546,7 +1546,7 @@ rpl_process_dio(uip_ipaddr_t *from, rpl_dio_t *dio)
|
||||||
|
|
||||||
/* The DIO comes from a valid DAG, we can refresh its lifetime */
|
/* The DIO comes from a valid DAG, we can refresh its lifetime */
|
||||||
dag->lifetime = (1UL << (instance->dio_intmin + instance->dio_intdoubl)) * RPL_DAG_LIFETIME / 1000;
|
dag->lifetime = (1UL << (instance->dio_intmin + instance->dio_intdoubl)) * RPL_DAG_LIFETIME / 1000;
|
||||||
PRINTF("Set dag ");
|
PRINTF("RPL: Set dag ");
|
||||||
PRINT6ADDR(&dag->dag_id);
|
PRINT6ADDR(&dag->dag_id);
|
||||||
PRINTF(" lifetime to %ld\n", dag->lifetime);
|
PRINTF(" lifetime to %ld\n", dag->lifetime);
|
||||||
|
|
||||||
|
|
|
@ -507,10 +507,10 @@ update_hbh_header(void)
|
||||||
if((UIP_EXT_HDR_OPT_RPL_BUF->flags & RPL_HDR_OPT_DOWN)) {
|
if((UIP_EXT_HDR_OPT_RPL_BUF->flags & RPL_HDR_OPT_DOWN)) {
|
||||||
if(uip_ds6_route_lookup(&UIP_IP_BUF->destipaddr) == NULL) {
|
if(uip_ds6_route_lookup(&UIP_IP_BUF->destipaddr) == NULL) {
|
||||||
UIP_EXT_HDR_OPT_RPL_BUF->flags |= RPL_HDR_OPT_FWD_ERR;
|
UIP_EXT_HDR_OPT_RPL_BUF->flags |= RPL_HDR_OPT_FWD_ERR;
|
||||||
PRINTF("RPL forwarding error\n");
|
PRINTF("RPL: Forwarding error\n");
|
||||||
/* We should send back the packet to the originating parent,
|
/* We should send back the packet to the originating parent,
|
||||||
but it is not feasible yet, so we send a No-Path DAO instead */
|
but it is not feasible yet, so we send a No-Path DAO instead */
|
||||||
PRINTF("RPL generate No-Path DAO\n");
|
PRINTF("RPL: Generate No-Path DAO\n");
|
||||||
parent = rpl_get_parent((uip_lladdr_t *)packetbuf_addr(PACKETBUF_ADDR_SENDER));
|
parent = rpl_get_parent((uip_lladdr_t *)packetbuf_addr(PACKETBUF_ADDR_SENDER));
|
||||||
if(parent != NULL) {
|
if(parent != NULL) {
|
||||||
dao_output_target(parent, &UIP_IP_BUF->destipaddr, RPL_ZERO_LIFETIME);
|
dao_output_target(parent, &UIP_IP_BUF->destipaddr, RPL_ZERO_LIFETIME);
|
||||||
|
@ -526,11 +526,11 @@ update_hbh_header(void)
|
||||||
/* No route was found, so this packet will go towards the RPL
|
/* No route was found, so this packet will go towards the RPL
|
||||||
root. If so, we should not set the down flag. */
|
root. If so, we should not set the down flag. */
|
||||||
UIP_EXT_HDR_OPT_RPL_BUF->flags &= ~RPL_HDR_OPT_DOWN;
|
UIP_EXT_HDR_OPT_RPL_BUF->flags &= ~RPL_HDR_OPT_DOWN;
|
||||||
PRINTF("RPL option going up\n");
|
PRINTF("RPL: Option going up\n");
|
||||||
} else {
|
} else {
|
||||||
/* A DAO route was found so we set the down flag. */
|
/* A DAO route was found so we set the down flag. */
|
||||||
UIP_EXT_HDR_OPT_RPL_BUF->flags |= RPL_HDR_OPT_DOWN;
|
UIP_EXT_HDR_OPT_RPL_BUF->flags |= RPL_HDR_OPT_DOWN;
|
||||||
PRINTF("RPL option going down\n");
|
PRINTF("RPL: Option going down\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1151,30 +1151,30 @@ dao_output_target_seq(rpl_parent_t *parent, uip_ipaddr_t *prefix,
|
||||||
}
|
}
|
||||||
|
|
||||||
if(parent == NULL) {
|
if(parent == NULL) {
|
||||||
PRINTF("RPL dao_output_target error parent NULL\n");
|
PRINTF("RPL: dao_output_target error parent NULL\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
parent_ipaddr = rpl_get_parent_ipaddr(parent);
|
parent_ipaddr = rpl_get_parent_ipaddr(parent);
|
||||||
if(parent_ipaddr == NULL) {
|
if(parent_ipaddr == NULL) {
|
||||||
PRINTF("RPL dao_output_target error parent IP address NULL\n");
|
PRINTF("RPL: dao_output_target error parent IP address NULL\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
dag = parent->dag;
|
dag = parent->dag;
|
||||||
if(dag == NULL) {
|
if(dag == NULL) {
|
||||||
PRINTF("RPL dao_output_target error dag NULL\n");
|
PRINTF("RPL: dao_output_target error dag NULL\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
instance = dag->instance;
|
instance = dag->instance;
|
||||||
|
|
||||||
if(instance == NULL) {
|
if(instance == NULL) {
|
||||||
PRINTF("RPL dao_output_target error instance NULL\n");
|
PRINTF("RPL: dao_output_target error instance NULL\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(prefix == NULL) {
|
if(prefix == NULL) {
|
||||||
PRINTF("RPL dao_output_target error prefix NULL\n");
|
PRINTF("RPL: dao_output_target error prefix NULL\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#ifdef RPL_DEBUG_DAO_OUTPUT
|
#ifdef RPL_DEBUG_DAO_OUTPUT
|
||||||
|
|
|
@ -177,7 +177,7 @@ find_removable_dis(uip_ipaddr_t *from)
|
||||||
if(num_free > 0) {
|
if(num_free > 0) {
|
||||||
/* there are free entries (e.g. unsused by RPL and ND6) but since it is
|
/* there are free entries (e.g. unsused by RPL and ND6) but since it is
|
||||||
used by other modules we can not pick these entries for removal. */
|
used by other modules we can not pick these entries for removal. */
|
||||||
PRINTF("Num-free > 0 = %d - Other for RPL/ND6 unused NBR entry exists .",
|
PRINTF("NBR-POLICY: Num-free > 0 = %d - Other for RPL/ND6 unused NBR entry exists .",
|
||||||
num_free);
|
num_free);
|
||||||
}
|
}
|
||||||
if(num_children < MAX_CHILDREN) {
|
if(num_children < MAX_CHILDREN) {
|
||||||
|
@ -195,20 +195,20 @@ find_removable_dio(uip_ipaddr_t *from, rpl_dio_t *dio)
|
||||||
|
|
||||||
instance = rpl_get_instance(dio->instance_id);
|
instance = rpl_get_instance(dio->instance_id);
|
||||||
if(instance == NULL || instance->current_dag == NULL) {
|
if(instance == NULL || instance->current_dag == NULL) {
|
||||||
PRINTF("Did not find instance id: %d\n", dio->instance_id);
|
PRINTF("NBR-POLICY: Did not find instance id: %d\n", dio->instance_id);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add the new neighbor only if it is better than the worst parent. */
|
/* Add the new neighbor only if it is better than the worst parent. */
|
||||||
if(dio->rank + instance->min_hoprankinc < worst_rank - instance->min_hoprankinc / 2) {
|
if(dio->rank + instance->min_hoprankinc < worst_rank - instance->min_hoprankinc / 2) {
|
||||||
/* Found *great* neighbor - add! */
|
/* Found *great* neighbor - add! */
|
||||||
PRINTF("Found better neighbor %d < %d - add to cache...\n",
|
PRINTF("NBR-POLICY: Found better neighbor %d < %d - add to cache...\n",
|
||||||
dio->rank, worst_rank);
|
dio->rank, worst_rank);
|
||||||
|
|
||||||
return worst_rank_nbr;
|
return worst_rank_nbr;
|
||||||
}
|
}
|
||||||
|
|
||||||
PRINTF("Found worse neighbor with new %d and old %d - NOT add to cache.\n",
|
PRINTF("NBR-POLICY: Found worse neighbor with new %d and old %d - NOT add to cache.\n",
|
||||||
dio->rank, worst_rank);
|
dio->rank, worst_rank);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -229,7 +229,7 @@ find_removable_dao(uip_ipaddr_t *from, rpl_instance_t *instance)
|
||||||
/* Check if this DAO sender is not yet neighbor and there is already too
|
/* Check if this DAO sender is not yet neighbor and there is already too
|
||||||
many children. */
|
many children. */
|
||||||
if(num_children >= max) {
|
if(num_children >= max) {
|
||||||
PRINTF("Can not add another child - already at max.\n");
|
PRINTF("NBR-POLICY: Can not add another child - already at max.\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
/* remove the worst ranked nbr */
|
/* remove the worst ranked nbr */
|
||||||
|
|
|
@ -91,13 +91,13 @@ rpl_set_mode(enum rpl_mode m)
|
||||||
|
|
||||||
PRINTF("RPL: switching to feather mode\n");
|
PRINTF("RPL: switching to feather mode\n");
|
||||||
if(default_instance != NULL) {
|
if(default_instance != NULL) {
|
||||||
PRINTF("rpl_set_mode: RPL sending DAO with zero lifetime\n");
|
PRINTF("RPL: rpl_set_mode: RPL sending DAO with zero lifetime\n");
|
||||||
if(default_instance->current_dag != NULL) {
|
if(default_instance->current_dag != NULL) {
|
||||||
dao_output(default_instance->current_dag->preferred_parent, RPL_ZERO_LIFETIME);
|
dao_output(default_instance->current_dag->preferred_parent, RPL_ZERO_LIFETIME);
|
||||||
}
|
}
|
||||||
rpl_cancel_dao(default_instance);
|
rpl_cancel_dao(default_instance);
|
||||||
} else {
|
} else {
|
||||||
PRINTF("rpl_set_mode: no default instance\n");
|
PRINTF("RPL: rpl_set_mode: no default instance\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
mode = m;
|
mode = m;
|
||||||
|
@ -143,7 +143,7 @@ rpl_purge_routes(void)
|
||||||
uip_ipaddr_copy(&prefix, &r->ipaddr);
|
uip_ipaddr_copy(&prefix, &r->ipaddr);
|
||||||
uip_ds6_route_rm(r);
|
uip_ds6_route_rm(r);
|
||||||
r = uip_ds6_route_head();
|
r = uip_ds6_route_head();
|
||||||
PRINTF("No more routes to ");
|
PRINTF("RPL: No more routes to ");
|
||||||
PRINT6ADDR(&prefix);
|
PRINT6ADDR(&prefix);
|
||||||
dag = default_instance->current_dag;
|
dag = default_instance->current_dag;
|
||||||
/* Propagate this information with a No-Path DAO to preferred parent if we are not a RPL Root */
|
/* Propagate this information with a No-Path DAO to preferred parent if we are not a RPL Root */
|
||||||
|
@ -313,7 +313,7 @@ rpl_purge_dags(void)
|
||||||
if(instance->dag_table[i].used) {
|
if(instance->dag_table[i].used) {
|
||||||
if(instance->dag_table[i].lifetime == 0) {
|
if(instance->dag_table[i].lifetime == 0) {
|
||||||
if(!instance->dag_table[i].joined) {
|
if(!instance->dag_table[i].joined) {
|
||||||
PRINTF("Removing dag ");
|
PRINTF("RPL: Removing dag ");
|
||||||
PRINT6ADDR(&instance->dag_table[i].dag_id);
|
PRINT6ADDR(&instance->dag_table[i].dag_id);
|
||||||
PRINTF("\n");
|
PRINTF("\n");
|
||||||
rpl_free_dag(&instance->dag_table[i]);
|
rpl_free_dag(&instance->dag_table[i]);
|
||||||
|
@ -331,7 +331,7 @@ void
|
||||||
rpl_init(void)
|
rpl_init(void)
|
||||||
{
|
{
|
||||||
uip_ipaddr_t rplmaddr;
|
uip_ipaddr_t rplmaddr;
|
||||||
PRINTF("RPL started\n");
|
PRINTF("RPL: RPL started\n");
|
||||||
default_instance = NULL;
|
default_instance = NULL;
|
||||||
|
|
||||||
rpl_dag_init();
|
rpl_dag_init();
|
||||||
|
|
Loading…
Reference in a new issue