diff --git a/sys/include/net/gnrc/sixlowpan/nd/router.h b/sys/include/net/gnrc/sixlowpan/nd/router.h index 296e7a270277..f2a50dd40355 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/ndp/internal/gnrc_ndp_internal.c b/sys/net/gnrc/network_layer/ndp/internal/gnrc_ndp_internal.c index 4a3158a2cd0d..8661d6d43d7a 100644 --- a/sys/net/gnrc/network_layer/ndp/internal/gnrc_ndp_internal.c +++ b/sys/net/gnrc/network_layer/ndp/internal/gnrc_ndp_internal.c @@ -677,6 +677,9 @@ bool gnrc_ndp_internal_pi_opt_handle(kernel_pid_t iface, uint8_t icmpv6_type, DEBUG("ndp: could not add prefix to interface %d\n", iface); return false; } +#ifdef MODULE_GNRC_SIXLOWPAN_ND_ROUTER + gnrc_sixlowpan_nd_router_set_rtr_adv(gnrc_ipv6_netif_get(iface), true); +#endif } netif_addr = gnrc_ipv6_netif_addr_get(prefix); if (pi_opt->valid_ltime.u32 == 0) { 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 2b0d97acce5c..ae05fc805699 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;