RPL: print links at root periodically
This commit is contained in:
parent
bc9934ee5a
commit
59e8d059c2
@ -42,12 +42,35 @@
|
||||
|
||||
#include "net/routing/rpl-lite/rpl.h"
|
||||
#include "net/ipv6/uip-ds6-route.h"
|
||||
#include "net/ipv6/uip-sr.h"
|
||||
|
||||
/* Log configuration */
|
||||
#include "sys/log.h"
|
||||
#define LOG_MODULE "RPL"
|
||||
#define LOG_LEVEL LOG_LEVEL_RPL
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
rpl_dag_root_print_links(const char *str)
|
||||
{
|
||||
if(rpl_dag_root_is_root()) {
|
||||
if(uip_sr_num_nodes() > 0) {
|
||||
uip_sr_node_t *link;
|
||||
/* Our routing links */
|
||||
LOG_INFO("links: %u routing links in total (%s)\n", uip_sr_num_nodes(), str);
|
||||
link = uip_sr_node_head();
|
||||
while(link != NULL) {
|
||||
char buf[100];
|
||||
uip_sr_link_snprint(buf, sizeof(buf), link);
|
||||
LOG_INFO("links: %s\n", buf);
|
||||
link = uip_sr_node_next(link);
|
||||
}
|
||||
LOG_INFO("links: end of list\n");
|
||||
} else {
|
||||
LOG_INFO("No routing links\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
set_global_address(uip_ipaddr_t *prefix, uip_ipaddr_t *iid)
|
||||
|
@ -63,6 +63,12 @@ int rpl_dag_root_start(void);
|
||||
* \return 1 if we are dag root, 0 otherwise
|
||||
*/
|
||||
int rpl_dag_root_is_root(void);
|
||||
/**
|
||||
* Prints a summary of all routing links
|
||||
*
|
||||
* \param str A descriptive text on the caller
|
||||
*/
|
||||
void rpl_dag_root_print_links(const char *str);
|
||||
|
||||
/** @} */
|
||||
|
||||
|
@ -521,6 +521,7 @@ handle_periodic_timer(void *ptr)
|
||||
|
||||
if(LOG_INFO_ENABLED) {
|
||||
rpl_neighbor_print_list("Periodic");
|
||||
rpl_dag_root_print_links("Periodic");
|
||||
}
|
||||
|
||||
ctimer_reset(&periodic_timer);
|
||||
|
Loading…
Reference in New Issue
Block a user