From e11550042c07e436b20133f2d2795f09b276ccd8 Mon Sep 17 00:00:00 2001 From: Martine Lenders Date: Wed, 14 Feb 2018 19:09:01 +0100 Subject: [PATCH] gnrc_ipv6_nib_6ln: only register addresses not VALID yet With the previous fix, we only have to register addresses that are not VALID yet on reception of router advertisements. This removes the need for the hacky `GNRC_NETIF_FLAGS_6LO_ADDRS_REG` flag that was only introduced to prevent unnecessary re-registration. --- sys/include/net/gnrc/netif/flags.h | 6 ------ sys/net/gnrc/network_layer/ipv6/nib/nib.c | 11 +++++------ 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/sys/include/net/gnrc/netif/flags.h b/sys/include/net/gnrc/netif/flags.h index f8a9660278..64b9faff17 100644 --- a/sys/include/net/gnrc/netif/flags.h +++ b/sys/include/net/gnrc/netif/flags.h @@ -118,12 +118,6 @@ enum { */ #define GNRC_NETIF_FLAGS_6LO_BACKBONE (0x00000800U) -/** - * @brief Marks if the addresses of the interface were already registered - * to an interface or not - */ -#define GNRC_NETIF_FLAGS_6LO_ADDRS_REG (0x00001000U) - /** * @brief Mask for @ref gnrc_mac_tx_feedback_t */ diff --git a/sys/net/gnrc/network_layer/ipv6/nib/nib.c b/sys/net/gnrc/network_layer/ipv6/nib/nib.c index 476569e7bb..9de382b8a4 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/nib.c +++ b/sys/net/gnrc/network_layer/ipv6/nib/nib.c @@ -647,15 +647,14 @@ static void _handle_rtr_adv(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6, } #if GNRC_IPV6_NIB_CONF_6LN if ((dr != NULL) && gnrc_netif_is_6ln(netif) && - !gnrc_netif_is_6lbr(netif) && - !(netif->flags & GNRC_NETIF_FLAGS_6LO_ADDRS_REG)) { - /* (register addresses already assigned)*/ + !gnrc_netif_is_6lbr(netif)) { + /* (register addresses already assigned but not valid yet)*/ for (int i = 0; i < GNRC_NETIF_IPV6_ADDRS_NUMOF; i++) { - if ((netif->ipv6.addrs_flags[i] != 0)) { + if ((netif->ipv6.addrs_flags[i] != 0) && + (netif->ipv6.addrs_flags[i] != GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_VALID)) { _handle_rereg_address(&netif->ipv6.addrs[i]); } } - netif->flags |= GNRC_NETIF_FLAGS_6LO_ADDRS_REG; } #endif /* GNRC_IPV6_NIB_CONF_6LN */ tmp_len = icmpv6_len - sizeof(ndp_rtr_adv_t); @@ -1322,7 +1321,7 @@ static void _auto_configure_addr(gnrc_netif_t *netif, const ipv6_addr_t *pfx, #endif /* GNRC_IPV6_NIB_CONF_6LN */ } -if GNRC_IPV6_NIB_CONF_6LN +#if GNRC_IPV6_NIB_CONF_6LN /* mark link-local addresses as valid on 6LN */ if (gnrc_netif_is_6ln(netif) && ipv6_addr_is_link_local(pfx)) { /* don't do this beforehand or risk a deadlock: