Improved RPL debug logs

This commit is contained in:
Simon Duquennoy 2015-11-23 13:38:48 +01:00 committed by Joakim Eriksson
parent 6fa3479aa8
commit 19b04098d5

View File

@ -671,11 +671,6 @@ dao_input(void)
uip_ipaddr_copy(&dao_sender_addr, &UIP_IP_BUF->srcipaddr); uip_ipaddr_copy(&dao_sender_addr, &UIP_IP_BUF->srcipaddr);
/* Destination Advertisement Object */
PRINTF("RPL: Received a DAO from ");
PRINT6ADDR(&dao_sender_addr);
PRINTF("\n");
buffer = UIP_ICMP_PAYLOAD; buffer = UIP_ICMP_PAYLOAD;
buffer_length = uip_len - uip_l3_icmp_hdr_len; buffer_length = uip_len - uip_l3_icmp_hdr_len;
@ -711,8 +706,12 @@ dao_input(void)
learned_from = uip_is_addr_mcast(&dao_sender_addr) ? learned_from = uip_is_addr_mcast(&dao_sender_addr) ?
RPL_ROUTE_FROM_MULTICAST_DAO : RPL_ROUTE_FROM_UNICAST_DAO; RPL_ROUTE_FROM_MULTICAST_DAO : RPL_ROUTE_FROM_UNICAST_DAO;
PRINTF("RPL: DAO from %s\n", /* Destination Advertisement Object */
learned_from == RPL_ROUTE_FROM_UNICAST_DAO? "unicast": "multicast"); PRINTF("RPL: Received a (%s) DAO with sequence number %u from ",
learned_from == RPL_ROUTE_FROM_UNICAST_DAO? "unicast": "multicast", sequence);
PRINT6ADDR(&dao_sender_addr);
PRINTF("\n");
if(learned_from == RPL_ROUTE_FROM_UNICAST_DAO) { if(learned_from == RPL_ROUTE_FROM_UNICAST_DAO) {
/* Check whether this is a DAO forwarding loop. */ /* Check whether this is a DAO forwarding loop. */
parent = rpl_find_parent(dag, &dao_sender_addr); parent = rpl_find_parent(dag, &dao_sender_addr);
@ -822,7 +821,7 @@ dao_input(void)
goto discard; goto discard;
} }
PRINTF("RPL: adding DAO route\n"); PRINTF("RPL: Adding DAO route\n");
/* Update and add neighbor - if no room - fail. */ /* Update and add neighbor - if no room - fail. */
if((nbr = rpl_icmp6_update_nbr_table(&dao_sender_addr, NBR_TABLE_REASON_RPL_DAO, instance)) == NULL) { if((nbr = rpl_icmp6_update_nbr_table(&dao_sender_addr, NBR_TABLE_REASON_RPL_DAO, instance)) == NULL) {
@ -897,7 +896,7 @@ fwd_dao:
} }
if(should_ack) { if(should_ack) {
PRINTF("RPL: sending DAO ACK\n"); PRINTF("RPL: Sending DAO ACK\n");
dao_ack_output(instance, &dao_sender_addr, sequence, dao_ack_output(instance, &dao_sender_addr, sequence,
RPL_DAO_ACK_UNCONDITIONAL_ACCEPT); RPL_DAO_ACK_UNCONDITIONAL_ACCEPT);
} }
@ -1081,7 +1080,8 @@ dao_output_target_seq(rpl_parent_t *parent, uip_ipaddr_t *prefix,
buffer[pos++] = 0; /* path seq - ignored */ buffer[pos++] = 0; /* path seq - ignored */
buffer[pos++] = lifetime; buffer[pos++] = lifetime;
PRINTF("RPL: Sending %sDAO with prefix ", lifetime == RPL_ZERO_LIFETIME ? "No-Path " : ""); PRINTF("RPL: Sending a %sDAO with sequence number %u, lifetime %u, prefix ",
lifetime == RPL_ZERO_LIFETIME ? "No-Path " : "", seq_no, lifetime);
PRINT6ADDR(prefix); PRINT6ADDR(prefix);
PRINTF(" to "); PRINTF(" to ");
PRINT6ADDR(rpl_get_parent_ipaddr(parent)); PRINT6ADDR(rpl_get_parent_ipaddr(parent));
@ -1125,14 +1125,13 @@ dao_ack_input(void)
return; return;
} }
PRINTF("RPL: Received a DAO ACK with sequence number %d (%d) and status %d from ", PRINTF("RPL: Received a DAO %s with sequence number %d (%d) and status %d from ",
status < 128 ? "ACK" : "NACK",
sequence, instance->my_dao_seqno, status); sequence, instance->my_dao_seqno, status);
PRINT6ADDR(&UIP_IP_BUF->srcipaddr); PRINT6ADDR(&UIP_IP_BUF->srcipaddr);
PRINTF("\n"); PRINTF("\n");
if(sequence == instance->my_dao_seqno) { if(sequence == instance->my_dao_seqno) {
PRINTF("RPL: DAO %s for me!\n", status < 128 ? "ACK" : "NACK");
rpl_set_downward_link(status < 128); rpl_set_downward_link(status < 128);
/* always stop the retransmit timer when the ACK arrived */ /* always stop the retransmit timer when the ACK arrived */
@ -1152,7 +1151,7 @@ dao_ack_input(void)
#endif #endif
} else { } else {
/* this DAO should be forwarded to another recently registered route */ /* this DAO ACK should be forwarded to another recently registered route */
uip_ds6_route_t *re; uip_ds6_route_t *re;
uip_ipaddr_t *nexthop; uip_ipaddr_t *nexthop;
if((re = find_route_entry_by_dao_ack(sequence)) != NULL) { if((re = find_route_entry_by_dao_ack(sequence)) != NULL) {
@ -1162,9 +1161,9 @@ dao_ack_input(void)
nexthop = uip_ds6_route_nexthop(re); nexthop = uip_ds6_route_nexthop(re);
if(nexthop == NULL) { if(nexthop == NULL) {
PRINTF("No next hop to fwd DAO ACK to\n"); PRINTF("RPL: No next hop to fwd DAO ACK to\n");
} else { } else {
PRINTF("Fwd DAO ACK to:"); PRINTF("RPL: Fwd DAO ACK to:");
PRINT6ADDR(nexthop); PRINT6ADDR(nexthop);
PRINTF("\n"); PRINTF("\n");
buffer[2] = re->state.dao_seqno_in; buffer[2] = re->state.dao_seqno_in;
@ -1176,7 +1175,7 @@ dao_ack_input(void)
uip_ds6_route_rm(re); uip_ds6_route_rm(re);
} }
} else { } else {
PRINTF("No route entry to fwd DAO ACK to\n"); PRINTF("RPL: No route entry to fwd DAO ACK to\n");
} }
} }
#endif /* RPL_WITH_DAO_ACK */ #endif /* RPL_WITH_DAO_ACK */
@ -1190,7 +1189,7 @@ dao_ack_output(rpl_instance_t *instance, uip_ipaddr_t *dest, uint8_t sequence,
#if RPL_WITH_DAO_ACK #if RPL_WITH_DAO_ACK
unsigned char *buffer; unsigned char *buffer;
PRINTF("RPL: Sending a DAO ACK with sequence number %d to ", sequence); PRINTF("RPL: Sending a DAO %s with sequence number %d to ", status < 128 ? "ACK" : "NACK", sequence);
PRINT6ADDR(dest); PRINT6ADDR(dest);
PRINTF(" with status %d\n", status); PRINTF(" with status %d\n", status);