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.
This commit is contained in:
Martine Lenders 2018-02-14 19:09:01 +01:00
parent 8c8b6f9494
commit e11550042c
2 changed files with 5 additions and 12 deletions

View File

@ -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
*/

View File

@ -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: