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

Merge pull request #3839 from OlegHahm/6lr_fixes

6lowpan nd: router fixes
This commit is contained in:
Oleg Hahm 2015-09-17 00:43:40 +02:00
commit af0ed51559
3 changed files with 19 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] 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.

View File

@ -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) {

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);
}
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;