Skip to content

Commit

Permalink
gnrc_netif: always join solicited-node multicast group if 6LN
Browse files Browse the repository at this point in the history
A border router will send a neighbor solicitation to the
solicited-node multicasts if it encounters a packet from a global address
that is not registered with the border router.

This happens when the border router is restarted while some nodes were
online.

As the nodes were not in the solicited-node multicast group, they would
drop the neighbor solicitation which resulted in them not being able to
route any packets through the border router until they would reboot themself
(or their prefix expired).

To fix this, always join the solicited-node multicast address as a 6LN.
This allows to have a connection across BR restarts.
  • Loading branch information
benpicco committed Oct 14, 2021
1 parent f49ca58 commit bed34da
Showing 1 changed file with 17 additions and 19 deletions.
36 changes: 17 additions & 19 deletions sys/net/gnrc/netif/gnrc_netif.c
Original file line number Diff line number Diff line change
Expand Up @@ -585,32 +585,30 @@ int gnrc_netif_ipv6_addr_add_internal(gnrc_netif_t *netif,
gnrc_netif_release(netif);
return -ENOMEM;
}
#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ARSM)
ipv6_addr_t sol_nodes;
int res;

/* TODO: SHOULD delay join between 0 and MAX_RTR_SOLICITATION_DELAY
* for SLAAC */
ipv6_addr_set_solicited_nodes(&sol_nodes, addr);
res = gnrc_netif_ipv6_group_join_internal(netif, &sol_nodes);
if (res < 0) {
DEBUG("gnrc_netif: Can't join solicited-nodes of %s on interface %"
PRIkernel_pid "\n",
ipv6_addr_to_str(addr_str, addr, sizeof(addr_str)),
netif->pid);
gnrc_netif_release(netif);
return res;
}
#else /* CONFIG_GNRC_IPV6_NIB_ARSM */
if (!gnrc_netif_is_6ln(netif)) {
if (IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ARSM) || gnrc_netif_is_6ln(netif)) {
ipv6_addr_t sol_nodes;
int res;

/* TODO: SHOULD delay join between 0 and MAX_RTR_SOLICITATION_DELAY
* for SLAAC */
ipv6_addr_set_solicited_nodes(&sol_nodes, addr);
res = gnrc_netif_ipv6_group_join_internal(netif, &sol_nodes);
if (res < 0) {
DEBUG("gnrc_netif: Can't join solicited-nodes of %s on interface %"
PRIkernel_pid "\n",
ipv6_addr_to_str(addr_str, addr, sizeof(addr_str)),
netif->pid);
gnrc_netif_release(netif);
return res;
}
} else {
LOG_WARNING("Address-resolution state-machine not activated. Neighbors "
"from interface %u\nwill not be able to resolve address "
"%s\n"
" Use CONFIG_GNRC_IPV6_NIB_ARSM=1 to activate.\n",
netif->pid, ipv6_addr_to_str(addr_str, addr,
sizeof(addr_str)));
}
#endif /* CONFIG_GNRC_IPV6_NIB_ARSM */
netif->ipv6.addrs_flags[idx] = flags;
memcpy(&netif->ipv6.addrs[idx], addr, sizeof(netif->ipv6.addrs[idx]));
#ifdef MODULE_GNRC_IPV6_NIB
Expand Down

0 comments on commit bed34da

Please sign in to comment.