diff --git a/sys/include/net/gnrc/sixlowpan/nd/router.h b/sys/include/net/gnrc/sixlowpan/nd/router.h index 296e7a2702..f2a50dd403 100644 --- a/sys/include/net/gnrc/sixlowpan/nd/router.h +++ b/sys/include/net/gnrc/sixlowpan/nd/router.h @@ -118,15 +118,7 @@ static inline void gnrc_sixlowpan_nd_router_set_router(gnrc_ipv6_netif_t *netif, * @param[in] netif An IPv6 interface. Must not be NULL. * @param[in] enable Status for the GNRC_IPV6_NETIF_FLAGS_RTR_ADV flag. */ -static inline void gnrc_sixlowpan_nd_router_set_rtr_adv(gnrc_ipv6_netif_t *netif, bool enable) -{ - if (enable) { - netif->flags |= GNRC_IPV6_NETIF_FLAGS_RTR_ADV; - } - else { - netif->flags &= ~GNRC_IPV6_NETIF_FLAGS_RTR_ADV; - } -} +void gnrc_sixlowpan_nd_router_set_rtr_adv(gnrc_ipv6_netif_t *netif, bool enable); /** * @brief Get's the border router for this router. diff --git a/sys/net/gnrc/network_layer/sixlowpan/nd/gnrc_sixlowpan_nd.c b/sys/net/gnrc/network_layer/sixlowpan/nd/gnrc_sixlowpan_nd.c index 2b0d97acce..ae05fc8056 100644 --- a/sys/net/gnrc/network_layer/sixlowpan/nd/gnrc_sixlowpan_nd.c +++ b/sys/net/gnrc/network_layer/sixlowpan/nd/gnrc_sixlowpan_nd.c @@ -56,6 +56,21 @@ void gnrc_sixlowpan_nd_init(gnrc_ipv6_netif_t *iface) gnrc_ndp_internal_send_rtr_sol(iface->pid, NULL); } +void gnrc_sixlowpan_nd_router_set_rtr_adv(gnrc_ipv6_netif_t *netif, bool enable) +{ + ipv6_addr_t all_routers = IPV6_ADDR_ALL_ROUTERS_LINK_LOCAL; + + if (enable && (gnrc_ipv6_netif_add_addr(netif->pid, &all_routers, 128, + GNRC_IPV6_NETIF_ADDR_FLAGS_NON_UNICAST) != NULL)) { + netif->flags |= GNRC_IPV6_NETIF_FLAGS_RTR_ADV; + } + else { + netif->flags &= ~GNRC_IPV6_NETIF_FLAGS_RTR_ADV; + gnrc_ipv6_netif_remove_addr(netif->pid, &all_routers); + } +} + + void gnrc_sixlowpan_nd_mc_rtr_sol(gnrc_ipv6_netif_t *iface) { uint32_t interval;