diff --git a/core/net/rpl/rpl-dag.c b/core/net/rpl/rpl-dag.c index 379461a0b..826c7152b 100644 --- a/core/net/rpl/rpl-dag.c +++ b/core/net/rpl/rpl-dag.c @@ -95,6 +95,17 @@ rpl_get_parent_rank(uip_lladdr_t *addr) } } /*---------------------------------------------------------------------------*/ +uint16_t +rpl_get_parent_link_metric(uip_lladdr_t *addr) +{ + rpl_parent_t *p = nbr_table_get_from_lladdr(rpl_parents, (rimeaddr_t *)addr); + if(p != NULL) { + return p->link_metric; + } else { + return 0; + } +} +/*---------------------------------------------------------------------------*/ uip_ipaddr_t * rpl_get_parent_ipaddr(rpl_parent_t *p) { diff --git a/core/net/rpl/rpl.h b/core/net/rpl/rpl.h index 6109874ef..689e2063b 100644 --- a/core/net/rpl/rpl.h +++ b/core/net/rpl/rpl.h @@ -244,6 +244,7 @@ void rpl_remove_header(void); uint8_t rpl_invert_header(void); uip_ipaddr_t *rpl_get_parent_ipaddr(rpl_parent_t *nbr); rpl_rank_t rpl_get_parent_rank(uip_lladdr_t *addr); -void rpl_dag_init(); +uint16_t rpl_get_parent_link_metric(uip_lladdr_t *addr); +void rpl_dag_init(void); /*---------------------------------------------------------------------------*/ #endif /* RPL_H */