From 2d44b4705011a962453acc99af61fae938c1d3fd Mon Sep 17 00:00:00 2001 From: Yasuyuki Tanaka Date: Thu, 19 Jan 2017 14:22:20 +0100 Subject: [PATCH] Print an entry for the root node as well as other entries --- examples/ipv6/rpl-tsch/node.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/examples/ipv6/rpl-tsch/node.c b/examples/ipv6/rpl-tsch/node.c index 108308988..86c241e93 100644 --- a/examples/ipv6/rpl-tsch/node.c +++ b/examples/ipv6/rpl-tsch/node.c @@ -120,17 +120,20 @@ print_network_status(void) PRINTF("- Routing links (%u in total):\n", rpl_ns_num_nodes()); link = rpl_ns_node_head(); while(link != NULL) { - if(link->parent != NULL) { - uip_ipaddr_t child_ipaddr; - uip_ipaddr_t parent_ipaddr; - rpl_ns_get_node_global_addr(&child_ipaddr, link); - rpl_ns_get_node_global_addr(&parent_ipaddr, link->parent); - PRINTF("-- "); - PRINT6ADDR(&child_ipaddr); + uip_ipaddr_t child_ipaddr; + uip_ipaddr_t parent_ipaddr; + rpl_ns_get_node_global_addr(&child_ipaddr, link); + rpl_ns_get_node_global_addr(&parent_ipaddr, link->parent); + PRINTF("-- "); + PRINT6ADDR(&child_ipaddr); + if(link->parent == NULL) { + memset(&parent_ipaddr, 0, sizeof(parent_ipaddr)); + PRINTF(" --- DODAG root "); + } else { PRINTF(" to "); PRINT6ADDR(&parent_ipaddr); - PRINTF(" (lifetime: %lu seconds)\n", (unsigned long)link->lifetime); } + PRINTF(" (lifetime: %lu seconds)\n", (unsigned long)link->lifetime); link = rpl_ns_node_next(link); } #endif