1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

6lowpan nd: join all routers multicast group

A 6LR should join the all routers multicast group as soon as it turns
into a router which is indicated by setting the router advertisement
flag.
This commit is contained in:
Oleg Hahm 2015-09-16 23:53:08 +02:00
parent 1b94b0366e
commit 596ef55641
2 changed files with 16 additions and 9 deletions

View File

@ -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] netif An IPv6 interface. Must not be NULL.
* @param[in] enable Status for the GNRC_IPV6_NETIF_FLAGS_RTR_ADV flag. * @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) 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;
}
}
/** /**
* @brief Get's the border router for this router. * @brief Get's the border router for this router.

View File

@ -56,6 +56,21 @@ void gnrc_sixlowpan_nd_init(gnrc_ipv6_netif_t *iface)
gnrc_ndp_internal_send_rtr_sol(iface->pid, NULL); 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) void gnrc_sixlowpan_nd_mc_rtr_sol(gnrc_ipv6_netif_t *iface)
{ {
uint32_t interval; uint32_t interval;