Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ipv6/nib: 6LBR should not send RS on their downstream interface #19335

Merged
merged 1 commit into from
May 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 19 additions & 8 deletions sys/net/gnrc/network_layer/ipv6/nib/nib.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,15 @@ static void _handle_rdnss_timeout(sock_udp_ep_t *dns_server);
#endif
/** @} */

static inline bool _should_search_rtr(const gnrc_netif_t *netif)
{
/* 6LBR interface does not send RS.
A non-advertising router sends RS or a 6LN that is advertising or not
has to refetch router information */
return !gnrc_netif_is_6lbr(netif) &&
(!gnrc_netif_is_rtr_adv(netif) || gnrc_netif_is_6ln(netif));
}

void gnrc_ipv6_nib_init(void)
{
evtimer_event_t *tmp;
Expand Down Expand Up @@ -137,8 +146,7 @@ void gnrc_ipv6_nib_iface_up(gnrc_netif_t *netif)
#endif /* CONFIG_GNRC_IPV6_NIB_6LN */
netif->ipv6.na_sent = 0;
_auto_configure_addr(netif, &ipv6_addr_link_local_prefix, 64U);
if (!(gnrc_netif_is_rtr_adv(netif)) ||
(gnrc_netif_is_6ln(netif) && !gnrc_netif_is_6lbr(netif))) {
if (_should_search_rtr(netif)) {
uint32_t next_rs_time = random_uint32_range(0, NDP_MAX_RS_MS_DELAY);

_evtimer_add(netif, GNRC_IPV6_NIB_SEARCH_RTR, &netif->ipv6.search_rtr,
Expand All @@ -160,8 +168,7 @@ void gnrc_ipv6_nib_iface_down(gnrc_netif_t *netif, bool send_final_ra)
gnrc_netif_acquire(netif);

_deinit_iface_arsm(netif);
if (!(gnrc_netif_is_rtr_adv(netif)) ||
(gnrc_netif_is_6ln(netif) && !gnrc_netif_is_6lbr(netif))) {
if (_should_search_rtr(netif)) {
_evtimer_del(&netif->ipv6.search_rtr);
}
#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_ROUTER)
Expand Down Expand Up @@ -482,8 +489,10 @@ void gnrc_ipv6_nib_change_rtr_adv_iface(gnrc_netif_t *netif, bool enable)
netif->flags &= ~GNRC_NETIF_FLAGS_IPV6_RTR_ADV;
/* send final router advertisements */
_handle_snd_mc_ra(netif);
_evtimer_add(netif, GNRC_IPV6_NIB_SEARCH_RTR, &netif->ipv6.search_rtr,
next_rs_time);
if (!gnrc_netif_is_6lbr(netif)) {
_evtimer_add(netif, GNRC_IPV6_NIB_SEARCH_RTR,
&netif->ipv6.search_rtr, next_rs_time);
}
}
gnrc_netif_release(netif);
}
Expand Down Expand Up @@ -858,7 +867,9 @@ static void _handle_rtr_adv(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6,

/* stop sending router solicitations
* see https://tools.ietf.org/html/rfc4861#section-6.3.7 */
evtimer_del(&_nib_evtimer, &netif->ipv6.search_rtr.event);
if (!gnrc_netif_is_6lbr(netif)) {
evtimer_del(&_nib_evtimer, &netif->ipv6.search_rtr.event);
}
#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LN)
if (gnrc_netif_is_6ln(netif) && !gnrc_netif_is_6lbr(netif)) {
if (IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C)) {
Expand Down Expand Up @@ -1461,7 +1472,7 @@ void _handle_search_rtr(gnrc_netif_t *netif)
{
#if !IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_NO_RTR_SOL)
gnrc_netif_acquire(netif);
if (!(gnrc_netif_is_rtr_adv(netif)) || gnrc_netif_is_6ln(netif)) {
if (_should_search_rtr(netif)) {
uint32_t next_rs = _evtimer_lookup(netif, GNRC_IPV6_NIB_SEARCH_RTR);
uint32_t interval = _get_next_rs_interval(netif);

Expand Down