From e87e6bedca11d4b56f076a2c200d670e14f59773 Mon Sep 17 00:00:00 2001 From: Oleg Hahm Date: Thu, 6 Mar 2014 00:32:08 +0000 Subject: [PATCH 1/6] you can never have enough debugging in RPL --- sys/net/routing/rpl/rpl.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/net/routing/rpl/rpl.c b/sys/net/routing/rpl/rpl.c index f856aaecf5..d8edae741c 100644 --- a/sys/net/routing/rpl/rpl.c +++ b/sys/net/routing/rpl/rpl.c @@ -351,12 +351,11 @@ void send_DIS(ipv6_addr_t *destination) void send_DAO(ipv6_addr_t *destination, uint8_t lifetime, bool default_lifetime, uint8_t start_index) { - DEBUG("Send DAO\n"); - if (i_am_root) { return; } + DEBUG("%s, %d: Send DAO\n", __FILE__, __LINE__); mutex_lock(&rpl_send_mutex); rpl_dodag_t *my_dodag; @@ -456,7 +455,7 @@ void send_DAO(ipv6_addr_t *destination, uint8_t lifetime, bool default_lifetime, void send_DAO_ACK(ipv6_addr_t *destination) { - DEBUG("%s, %d: Send DAO ACK\n", __FILE__, __LINE__); + DEBUG("%s, %d: Send DAO ACK to %s\n", __FILE__, __LINE__, ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, destination)); rpl_dodag_t *my_dodag; my_dodag = rpl_get_my_dodag(); @@ -876,7 +875,7 @@ void recv_rpl_dao(void) /* route lifetime seconds = (DAO lifetime) * (Unit Lifetime) */ DEBUG("%s, %d: Adding routing information: Target: %s, Source: %s, Lifetime: %u\n", __FILE__, __LINE__, - ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, &ipv6_buf->srcaddr), + ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, &rpl_opt_target_buf->target), ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, &ipv6_buf->srcaddr), (rpl_opt_transit_buf->path_lifetime * my_dodag->lifetime_unit)); rpl_add_routing_entry(&rpl_opt_target_buf->target, &ipv6_buf->srcaddr, rpl_opt_transit_buf->path_lifetime * my_dodag->lifetime_unit); @@ -909,6 +908,7 @@ void recv_rpl_dao(void) void recv_rpl_dao_ack(void) { + DEBUG("%s, %d: DAO ACK received\n", __FILE__, __LINE__); rpl_dodag_t *my_dodag = rpl_get_my_dodag(); if (my_dodag == NULL) { From 4f62ef45478dc727c2d7518e6a1d8d6a364e0ff7 Mon Sep 17 00:00:00 2001 From: Oleg Hahm Date: Fri, 7 Mar 2014 14:34:09 +0000 Subject: [PATCH 2/6] some minor fixes and debugging --- sys/net/routing/rpl/rpl.c | 8 ++++---- sys/net/routing/rpl/rpl_structs.h | 3 +-- sys/transceiver/transceiver.c | 5 +++++ 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/sys/net/routing/rpl/rpl.c b/sys/net/routing/rpl/rpl.c index d8edae741c..af7a04c7d0 100644 --- a/sys/net/routing/rpl/rpl.c +++ b/sys/net/routing/rpl/rpl.c @@ -492,7 +492,7 @@ void rpl_process(void) /* differentiate packet types */ ipv6_buf = ipv6_get_buf(); memcpy(&rpl_buffer, ipv6_buf, NTOHS(ipv6_buf->length) + IPV6_HDR_LEN); - DEBUG("%s, %d: Reveived RPL information of type %04X\n", __FILE__, __LINE__, *code); + DEBUG("%s, %d: Reveived RPL information of type %04X and length %u\n", __FILE__, __LINE__, *code, NTOHS(ipv6_buf->length)); switch (*code) { case (ICMP_CODE_DIS): { @@ -968,7 +968,7 @@ void rpl_send(ipv6_addr_t *destination, uint8_t *payload, uint16_t p_len, uint8_ if (next_hop == NULL) { if (i_am_root) { - DEBUG("%s, %d: [Error] destination unknown\n", __FILE__, __LINE__); + DEBUG("%s, %d: [Error] destination unknown: %s\n", __FILE__, __LINE__, ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, &ipv6_send_buf->destaddr)); return; } else { @@ -1008,8 +1008,8 @@ void rpl_add_routing_entry(ipv6_addr_t *addr, ipv6_addr_t *next_hop, uint16_t li for (uint8_t i = 0; i < RPL_MAX_ROUTING_ENTRIES; i++) { if (!routing_table[i].used) { - routing_table[i].address = *addr; - routing_table[i].next_hop = *next_hop; + memcpy(&routing_table[i].address, addr, sizeof(ipv6_addr_t)); + memcpy(&routing_table[i].next_hop, next_hop, sizeof(ipv6_addr_t)); routing_table[i].lifetime = lifetime; routing_table[i].used = 1; break; diff --git a/sys/net/routing/rpl/rpl_structs.h b/sys/net/routing/rpl/rpl_structs.h index 127128187a..68b276152e 100644 --- a/sys/net/routing/rpl/rpl_structs.h +++ b/sys/net/routing/rpl/rpl_structs.h @@ -173,11 +173,10 @@ typedef struct rpl_of_t { } rpl_of_t; typedef struct { - uint8_t used; ipv6_addr_t address; ipv6_addr_t next_hop; uint16_t lifetime; - + uint8_t used; } rpl_routing_entry_t; #endif diff --git a/sys/transceiver/transceiver.c b/sys/transceiver/transceiver.c index 036580df2a..2ed1c0a1a3 100644 --- a/sys/transceiver/transceiver.c +++ b/sys/transceiver/transceiver.c @@ -698,6 +698,11 @@ static int8_t send_packet(transceiver_type_t t, void *pkt) #else radio_packet_t *p = (radio_packet_t *)pkt; DEBUG("transceiver: Send packet to %" PRIu16 "\n", p->dst); + for (size_t i = 0; i < p->length; i++) { + DEBUG("%02x ", p->data[i]); + } + + DEBUG("\n"); #endif #ifdef MODULE_CC110X_NG From e5e9d9e538112339a5bfef6799f4f0312c98f5e9 Mon Sep 17 00:00:00 2001 From: Oleg Hahm Date: Sun, 9 Mar 2014 09:30:22 +0000 Subject: [PATCH 3/6] set correct transceiver stack size for debugging --- sys/transceiver/transceiver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/transceiver/transceiver.c b/sys/transceiver/transceiver.c index 2ed1c0a1a3..656604e428 100644 --- a/sys/transceiver/transceiver.c +++ b/sys/transceiver/transceiver.c @@ -64,7 +64,7 @@ #if ENABLE_DEBUG #define DEBUG_ENABLED #undef TRANSCEIVER_STACK_SIZE -#define TRANSCEIVER_STACK_SIZE (KERNEL_CONF_STACKSIZE_PRINTF) +#define TRANSCEIVER_STACK_SIZE (KERNEL_CONF_STACKSIZE_MAIN) #endif #include "debug.h" From e165a08606415cdf78fde1c34b10936869fa2204 Mon Sep 17 00:00:00 2001 From: Oleg Hahm Date: Sun, 9 Mar 2014 09:30:41 +0000 Subject: [PATCH 4/6] fixed debugging for cc110x --- sys/transceiver/transceiver.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/transceiver/transceiver.c b/sys/transceiver/transceiver.c index 656604e428..c0fdc1bd41 100644 --- a/sys/transceiver/transceiver.c +++ b/sys/transceiver/transceiver.c @@ -532,6 +532,7 @@ void receive_cc1100_packet(radio_packet_t *trans_p) eINT(); trans_p->data = (uint8_t *) &(data_buffer[transceiver_buffer_pos * CC1100_MAX_DATA_LENGTH]); + DEBUG("transceiver: Packet %p (%p) was from %hu to %hu, size: %u\n", trans_p, trans_p->data, trans_p->src, trans_p->dst, trans_p->length); } #endif @@ -732,7 +733,7 @@ static int8_t send_packet(transceiver_type_t t, void *pkt) memcpy(cc1100_pkt, p->data, p->length); res = cc1100_send_csmaca(p->dst, 4, 0, (char *) cc1100_pkt, p->length); - DEBUG("transceiver: snd_ret (%u) = %i\n", p->length, snd_ret); + DEBUG("transceiver: snd_ret (%u) = %i\n", p->length, res); #else puts("Unknown transceiver"); #endif From fe788838ef4e994c3ecc9d7509697893dd663910 Mon Sep 17 00:00:00 2001 From: Oleg Hahm Date: Sun, 16 Mar 2014 20:51:29 +0100 Subject: [PATCH 5/6] net: IPv6: RPL: more debug output --- sys/net/network_layer/sixlowpan/icmp.c | 1 + sys/net/network_layer/sixlowpan/ip.c | 3 +++ sys/net/routing/rpl/rpl.c | 5 +++++ 3 files changed, 9 insertions(+) diff --git a/sys/net/network_layer/sixlowpan/icmp.c b/sys/net/network_layer/sixlowpan/icmp.c index 06a07a1ff6..7622a4fe5f 100644 --- a/sys/net/network_layer/sixlowpan/icmp.c +++ b/sys/net/network_layer/sixlowpan/icmp.c @@ -1521,6 +1521,7 @@ int ndp_addr_is_on_link(ipv6_addr_t *dest_addr) int if_id = -1; if ((nce = ndp_neighbor_cache_search(dest_addr))) { + DEBUG("INFO: %s is in nbr cache\n", ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, dest_addr)); return 1; } diff --git a/sys/net/network_layer/sixlowpan/ip.c b/sys/net/network_layer/sixlowpan/ip.c index 1c7d6928af..6a8a50646c 100644 --- a/sys/net/network_layer/sixlowpan/ip.c +++ b/sys/net/network_layer/sixlowpan/ip.c @@ -105,6 +105,7 @@ int ipv6_send_packet(ipv6_hdr_t *packet) return -1; } + DEBUG("Trying to find the next hop for %s\n", ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, &packet->destaddr)); ipv6_addr_t *dest = ip_get_next_hop(&packet->destaddr); if (dest == NULL) { @@ -402,11 +403,13 @@ void ipv6_process(void) } default: + DEBUG("INFO: Unknown next header\n"); break; } } /* destination is foreign address */ else { + DEBUG("That's not for me, destination is %s\n", ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, &ipv6_buf->destaddr)); packet_length = IPV6_HDR_LEN + NTOHS(ipv6_buf->length); ndp_neighbor_cache_t *nce; diff --git a/sys/net/routing/rpl/rpl.c b/sys/net/routing/rpl/rpl.c index af7a04c7d0..6c0f274eaf 100644 --- a/sys/net/routing/rpl/rpl.c +++ b/sys/net/routing/rpl/rpl.c @@ -988,8 +988,13 @@ void rpl_send(ipv6_addr_t *destination, uint8_t *payload, uint16_t p_len, uint8_ ipv6_addr_t *rpl_get_next_hop(ipv6_addr_t *addr) { + DEBUG("%s, %d: looking up the next hop to %s\n", __FILE__, __LINE__, ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, addr)); for (uint8_t i = 0; i < RPL_MAX_ROUTING_ENTRIES; i++) { + if (routing_table[i].used) { + DEBUG("%s, %d: checking %d: %s\n", __FILE__, __LINE__, i, ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, &routing_table[i].address)); + } if (routing_table[i].used && rpl_equal_id(&routing_table[i].address, addr)) { + DEBUG("%s, %d: found %d: %s\n", __FILE__, __LINE__, i, ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, &routing_table[i].next_hop)); return &routing_table[i].next_hop; } } From 4298918ba7d1511886b7dc9fc25ffbf3b1c4f78c Mon Sep 17 00:00:00 2001 From: Oleg Hahm Date: Wed, 9 Apr 2014 01:09:26 +0200 Subject: [PATCH 6/6] rpl: debug: use DEBUGF where necessary --- sys/net/routing/rpl/rpl.c | 85 ++++++++++++++++++++------------------- 1 file changed, 43 insertions(+), 42 deletions(-) diff --git a/sys/net/routing/rpl/rpl.c b/sys/net/routing/rpl/rpl.c index 6c0f274eaf..ad90b00ce3 100644 --- a/sys/net/routing/rpl/rpl.c +++ b/sys/net/routing/rpl/rpl.c @@ -220,7 +220,7 @@ uint8_t rpl_init(int if_id) /* initialize ETX-calculation if needed */ if (RPL_DEFAULT_OCP == 1) { - DEBUG("%s, %d: INIT ETX BEACONING\n", __FILE__, __LINE__); + DEBUGF("INIT ETX BEACONING\n"); etx_init_beaconing(&my_address); } @@ -235,7 +235,7 @@ void rpl_init_root(void) inst = rpl_new_instance(RPL_DEFAULT_INSTANCE); if (inst == NULL) { - DEBUG("%s, %d: Error - No memory for another RPL instance\n", __FILE__, __LINE__); + DEBUGF("Error - No memory for another RPL instance\n"); return; } @@ -265,20 +265,20 @@ void rpl_init_root(void) dodag->my_preferred_parent = NULL; } else { - DEBUG("%s, %d: Error - could not generate DODAG\n", __FILE__, __LINE__); + DEBUGF("Error - could not generate DODAG\n"); return; } i_am_root = 1; start_trickle(dodag->dio_min, dodag->dio_interval_doubling, dodag->dio_redundancy); - DEBUG("%s, %d: ROOT INIT FINISHED\n", __FILE__, __LINE__); + DEBUGF("ROOT INIT FINISHED\n"); } void send_DIO(ipv6_addr_t *destination) { - DEBUG("%s, %d: Send DIO\n", __FILE__, __LINE__); + DEBUGF("Send DIO\n"); mutex_lock(&rpl_send_mutex); rpl_dodag_t *mydodag; icmp_send_buf = get_rpl_send_icmpv6_buf(ipv6_ext_hdr_len); @@ -286,7 +286,7 @@ void send_DIO(ipv6_addr_t *destination) mydodag = rpl_get_my_dodag(); if (mydodag == NULL) { - DEBUG("%s, %d: Error - trying to send DIO without being part of a dodag.\n", __FILE__, __LINE__); + DEBUGF("Error - trying to send DIO without being part of a dodag.\n"); mutex_unlock(&rpl_send_mutex); return; } @@ -297,7 +297,7 @@ void send_DIO(ipv6_addr_t *destination) rpl_send_dio_buf = get_rpl_send_dio_buf(); memset(rpl_send_dio_buf, 0, sizeof(*rpl_send_dio_buf)); - DEBUG("%s, %d: Sending DIO with ", __FILE__, __LINE__); + DEBUGF("Sending DIO with "); rpl_send_dio_buf->rpl_instanceid = mydodag->instance->id; DEBUG("instance %02X ", rpl_send_dio_buf->rpl_instanceid); rpl_send_dio_buf->version_number = mydodag->version; @@ -334,7 +334,7 @@ void send_DIO(ipv6_addr_t *destination) void send_DIS(ipv6_addr_t *destination) { - DEBUG("%s, %d: Send DIS\n", __FILE__, __LINE__); + DEBUGF("Send DIS\n"); mutex_lock(&rpl_send_mutex); icmp_send_buf = get_rpl_send_icmpv6_buf(ipv6_ext_hdr_len); @@ -355,19 +355,19 @@ void send_DAO(ipv6_addr_t *destination, uint8_t lifetime, bool default_lifetime, return; } - DEBUG("%s, %d: Send DAO\n", __FILE__, __LINE__); + DEBUGF("Send DAO\n"); mutex_lock(&rpl_send_mutex); rpl_dodag_t *my_dodag; if ((my_dodag = rpl_get_my_dodag()) == NULL) { - DEBUG("%s, %d: send_DAO: I have no my_dodag\n", __FILE__, __LINE__); + DEBUGF("send_DAO: I have no my_dodag\n"); mutex_unlock(&rpl_send_mutex); return; } if (destination == NULL) { if (my_dodag->my_preferred_parent == NULL) { - DEBUG("%s, %d: send_DAO: my_dodag has no my_preferred_parent\n", __FILE__, __LINE__); + DEBUGF("send_DAO: my_dodag has no my_preferred_parent\n"); mutex_unlock(&rpl_send_mutex); return; } @@ -389,7 +389,7 @@ void send_DAO(ipv6_addr_t *destination, uint8_t lifetime, bool default_lifetime, rpl_send_dao_buf->rpl_instanceid = my_dodag->instance->id; rpl_send_dao_buf->k_d_flags = 0x00; rpl_send_dao_buf->dao_sequence = my_dodag->dao_seq; - DEBUG("%s, %d: Send DAO with instance %04X and sequence %04X to %s\n", + DEBUGF("Send DAO with instance %04X and sequence %04X to %s\n", __FILE__, __LINE__, rpl_send_dao_buf->rpl_instanceid, rpl_send_dao_buf->dao_sequence, ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, destination)); @@ -455,7 +455,7 @@ void send_DAO(ipv6_addr_t *destination, uint8_t lifetime, bool default_lifetime, void send_DAO_ACK(ipv6_addr_t *destination) { - DEBUG("%s, %d: Send DAO ACK to %s\n", __FILE__, __LINE__, ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, destination)); + DEBUGF("Send DAO ACK to %s\n", ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, destination)); rpl_dodag_t *my_dodag; my_dodag = rpl_get_my_dodag(); @@ -492,7 +492,7 @@ void rpl_process(void) /* differentiate packet types */ ipv6_buf = ipv6_get_buf(); memcpy(&rpl_buffer, ipv6_buf, NTOHS(ipv6_buf->length) + IPV6_HDR_LEN); - DEBUG("%s, %d: Reveived RPL information of type %04X and length %u\n", __FILE__, __LINE__, *code, NTOHS(ipv6_buf->length)); + DEBUGF("Reveived RPL information of type %04X and length %u\n", *code, NTOHS(ipv6_buf->length)); switch (*code) { case (ICMP_CODE_DIS): { @@ -529,7 +529,7 @@ void rpl_process(void) void recv_rpl_dio(void) { - DEBUG("%s, %d: Received DIO with ", __FILE__, __LINE__); + DEBUGF("Received DIO with "); ipv6_buf = get_rpl_ipv6_buf(); rpl_dio_buf = get_rpl_dio_buf(); @@ -543,19 +543,19 @@ void recv_rpl_dio(void) if (dio_inst == NULL) { if (my_inst != NULL) { /* already part of a DODAG -> impossible to join other instance */ - DEBUG("%s, %d: Not joining another DODAG!\n", __FILE__, __LINE__); + DEBUGF("Not joining another DODAG!\n"); return; } dio_inst = rpl_new_instance(rpl_dio_buf->rpl_instanceid); if (dio_inst == NULL) { - DEBUG("%s, %d: Failed to create a new RPL instance!\n", __FILE__, __LINE__); + DEBUGF("Failed to create a new RPL instance!\n"); return; } } else if (my_inst == NULL) { - DEBUG("%s, %d: Not joined an instance yet\n", __FILE__, __LINE__); + DEBUGF("Not joined an instance yet\n"); } else if (my_inst->id != dio_inst->id) { /* TODO: Add support support for several instances. */ @@ -564,7 +564,7 @@ void recv_rpl_dio(void) * the instance they join first. * Instances cannot be switched later on. */ - DEBUG("%s, %d: Ignoring instance - we are %d and got %d\n", __FILE__, __LINE__, my_inst->id, dio_inst->id); + DEBUGF("Ignoring instance - we are %d and got %d\n", my_inst->id, dio_inst->id); return; } @@ -586,7 +586,7 @@ void recv_rpl_dio(void) * icmpv6 header, so only ICMPV6_HDR_LEN remains to be * subtracted. */ while (len < (NTOHS(ipv6_buf->length) - ICMPV6_HDR_LEN)) { - DEBUG("%s, %d: parsing DIO options\n", __FILE__, __LINE__); + DEBUGF("parsing DIO options\n"); rpl_opt_buf = get_rpl_opt_buf(len); switch (rpl_opt_buf->type) { @@ -615,7 +615,7 @@ void recv_rpl_dio(void) has_dodag_conf_opt = 1; if (rpl_opt_buf->length != RPL_OPT_DODAG_CONF_LEN) { - DEBUG("%s, %d: DODAG configuration is malformed.\n", __FILE__, __LINE__); + DEBUGF("DODAG configuration is malformed.\n"); /* error malformed */ return; } @@ -644,7 +644,7 @@ void recv_rpl_dio(void) } default: - DEBUG("%s, %d: [Error] Unsupported DIO option\n", __FILE__, __LINE__); + DEBUGF("[Error] Unsupported DIO option\n"); return; } } @@ -654,28 +654,28 @@ void recv_rpl_dio(void) if (my_dodag == NULL) { if (!has_dodag_conf_opt) { - DEBUG("%s, %d: send DIS\n", __FILE__, __LINE__); + DEBUGF("send DIS\n"); send_DIS(&ipv6_buf->srcaddr); } if (rpl_dio_buf->rank < ROOT_RANK) { - DEBUG("%s, %d: DIO with Rank < ROOT_RANK\n", __FILE__, __LINE__); + DEBUGF("DIO with Rank < ROOT_RANK\n"); } if (dio_dodag.mop != RPL_DEFAULT_MOP) { - DEBUG("%s, %d: Required MOP not supported\n", __FILE__, __LINE__); + DEBUGF("Required MOP not supported\n"); } if (dio_dodag.of == NULL) { - DEBUG("%s, %d: Required objective function not supported\n", __FILE__, __LINE__); + DEBUGF("Required objective function not supported\n"); } if (rpl_dio_buf->rank != INFINITE_RANK) { - DEBUG("%s, %d: Will join DODAG\n", __FILE__, __LINE__); + DEBUGF("Will join DODAG\n"); rpl_join_dodag(&dio_dodag, &ipv6_buf->srcaddr, rpl_dio_buf->rank); } else { - DEBUG("%s, %d: Cannot access DODAG because of DIO with infinite rank\n", __FILE__, __LINE__); + DEBUGF("Cannot access DODAG because of DIO with infinite rank\n"); } return; @@ -685,12 +685,12 @@ void recv_rpl_dio(void) /* "our" DODAG */ if (RPL_COUNTER_GREATER_THAN(dio_dodag.version, my_dodag->version)) { if (my_dodag->my_rank == ROOT_RANK) { - DEBUG("%s, %d: [Warning] Inconsistent Dodag Version\n", __FILE__, __LINE__); + DEBUGF("[Warning] Inconsistent Dodag Version\n"); my_dodag->version = RPL_COUNTER_INCREMENT(dio_dodag.version); reset_trickletimer(); } else { - DEBUG("%s, %d: [Info] New Version of dodag %d\n", __FILE__, __LINE__, dio_dodag.version); + DEBUGF("[Info] New Version of dodag %d\n", dio_dodag.version); rpl_global_repair(&dio_dodag, &ipv6_buf->srcaddr, rpl_dio_buf->rank); } @@ -740,7 +740,7 @@ void recv_rpl_dio(void) rpl_parent_update(parent); if (my_dodag->my_preferred_parent == NULL) { - DEBUG("%s, %d: my dodag has no preferred_parent yet - seems to be odd since I have a parent...\n", __FILE__, __LINE__); + DEBUGF("my dodag has no preferred_parent yet - seems to be odd since I have a parent...\n"); } else if (rpl_equal_id(&parent->addr, &my_dodag->my_preferred_parent->addr) && (parent->dtsn != rpl_dio_buf->dtsn)) { delay_dao(); @@ -819,11 +819,11 @@ void recv_rpl_dis(void) void recv_rpl_dao(void) { - DEBUG("%s, %d: Received DAO with ", __FILE__, __LINE__); + DEBUGF("Received DAO with "); rpl_dodag_t *my_dodag = rpl_get_my_dodag(); if (my_dodag == NULL) { - DEBUG("%s, %d: [Error] got DAO although not a DODAG\n", __FILE__, __LINE__); + DEBUG("[Error] got DAO although not a DODAG\n"); return; } @@ -859,7 +859,7 @@ void recv_rpl_dao(void) rpl_opt_target_buf = get_rpl_opt_target_buf(len); if (rpl_opt_target_buf->prefix_length != RPL_DODAG_ID_LEN) { - DEBUG("%s, %d: prefixes are not supported yet", __FILE__, __LINE__); + DEBUGF("prefixes are not supported yet\n"); break; } @@ -867,13 +867,14 @@ void recv_rpl_dao(void) rpl_opt_transit_buf = get_rpl_opt_transit_buf(len); if (rpl_opt_transit_buf->type != RPL_OPT_TRANSIT) { - DEBUG("%s, %d: [Error] - no transit information for target option type = %d\n", __FILE__, __LINE__, rpl_opt_transit_buf->type); + DEBUGF("[Error] - no transit information for target option type = %d\n", rpl_opt_transit_buf->type); break; } len += rpl_opt_transit_buf->length + 2; /* route lifetime seconds = (DAO lifetime) * (Unit Lifetime) */ - DEBUG("%s, %d: Adding routing information: Target: %s, Source: %s, Lifetime: %u\n", + + DEBUGF("%s, %d: Adding routing information: Target: %s, Source: %s, Lifetime: %u\n", __FILE__, __LINE__, ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, &rpl_opt_target_buf->target), ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, &ipv6_buf->srcaddr), @@ -908,7 +909,7 @@ void recv_rpl_dao(void) void recv_rpl_dao_ack(void) { - DEBUG("%s, %d: DAO ACK received\n", __FILE__, __LINE__); + DEBUGF("DAO ACK received\n"); rpl_dodag_t *my_dodag = rpl_get_my_dodag(); if (my_dodag == NULL) { @@ -968,14 +969,14 @@ void rpl_send(ipv6_addr_t *destination, uint8_t *payload, uint16_t p_len, uint8_ if (next_hop == NULL) { if (i_am_root) { - DEBUG("%s, %d: [Error] destination unknown: %s\n", __FILE__, __LINE__, ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, &ipv6_send_buf->destaddr)); + DEBUGF("[Error] destination unknown: %s\n", ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, &ipv6_send_buf->destaddr)); return; } else { next_hop = rpl_get_my_preferred_parent(); if (next_hop == NULL) { - DEBUG("%s, %d: [Error] no preferred parent, dropping package\n", __FILE__, __LINE__); + DEBUGF("[Error] no preferred parent, dropping package\n"); return; } } @@ -988,13 +989,13 @@ void rpl_send(ipv6_addr_t *destination, uint8_t *payload, uint16_t p_len, uint8_ ipv6_addr_t *rpl_get_next_hop(ipv6_addr_t *addr) { - DEBUG("%s, %d: looking up the next hop to %s\n", __FILE__, __LINE__, ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, addr)); + DEBUGF("looking up the next hop to %s\n", ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, addr)); for (uint8_t i = 0; i < RPL_MAX_ROUTING_ENTRIES; i++) { if (routing_table[i].used) { - DEBUG("%s, %d: checking %d: %s\n", __FILE__, __LINE__, i, ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, &routing_table[i].address)); + DEBUGF("checking %d: %s\n", i, ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, &routing_table[i].address)); } if (routing_table[i].used && rpl_equal_id(&routing_table[i].address, addr)) { - DEBUG("%s, %d: found %d: %s\n", __FILE__, __LINE__, i, ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, &routing_table[i].next_hop)); + DEBUGF("found %d: %s\n", i, ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, &routing_table[i].next_hop)); return &routing_table[i].next_hop; } }