Print an entry for the root node as well as other entries

This commit is contained in:
Yasuyuki Tanaka 2017-01-19 14:22:20 +01:00
parent 651147df57
commit 2d44b47050

View File

@ -120,17 +120,20 @@ print_network_status(void)
PRINTF("- Routing links (%u in total):\n", rpl_ns_num_nodes()); PRINTF("- Routing links (%u in total):\n", rpl_ns_num_nodes());
link = rpl_ns_node_head(); link = rpl_ns_node_head();
while(link != NULL) { while(link != NULL) {
if(link->parent != NULL) { uip_ipaddr_t child_ipaddr;
uip_ipaddr_t child_ipaddr; uip_ipaddr_t parent_ipaddr;
uip_ipaddr_t parent_ipaddr; rpl_ns_get_node_global_addr(&child_ipaddr, link);
rpl_ns_get_node_global_addr(&child_ipaddr, link); rpl_ns_get_node_global_addr(&parent_ipaddr, link->parent);
rpl_ns_get_node_global_addr(&parent_ipaddr, link->parent); PRINTF("-- ");
PRINTF("-- "); PRINT6ADDR(&child_ipaddr);
PRINT6ADDR(&child_ipaddr); if(link->parent == NULL) {
memset(&parent_ipaddr, 0, sizeof(parent_ipaddr));
PRINTF(" --- DODAG root ");
} else {
PRINTF(" to "); PRINTF(" to ");
PRINT6ADDR(&parent_ipaddr); 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); link = rpl_ns_node_next(link);
} }
#endif #endif