mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-18 12:52:44 +01:00
gnrc_ipv6_nib: auto-configure link-local address on UP event
This commit is contained in:
parent
f34f296242
commit
ab32ad5030
@ -56,7 +56,10 @@ void _auto_configure_addr(gnrc_netif_t *netif, const ipv6_addr_t *pfx,
|
||||
#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LN)
|
||||
bool new_address = false;
|
||||
#endif /* CONFIG_GNRC_IPV6_NIB_6LN */
|
||||
gnrc_netif_ipv6_get_iid(netif, (eui64_t *)&addr.u64[1]);
|
||||
if (gnrc_netif_ipv6_get_iid(netif, (eui64_t *)&addr.u64[1]) < 0) {
|
||||
DEBUG("nib: Can't get IID on interface %u\n", netif->pid);
|
||||
return;
|
||||
}
|
||||
ipv6_addr_init_prefix(&addr, pfx, pfx_len);
|
||||
if ((idx = gnrc_netif_ipv6_addr_idx(netif, &addr)) < 0) {
|
||||
if ((idx = gnrc_netif_ipv6_addr_add_internal(netif, &addr, pfx_len,
|
||||
|
@ -136,6 +136,7 @@ void gnrc_ipv6_nib_iface_up(gnrc_netif_t *netif)
|
||||
netif->ipv6.rs_sent = 0;
|
||||
#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))) {
|
||||
uint32_t next_rs_time = random_uint32_range(0, NDP_MAX_RS_MS_DELAY);
|
||||
@ -175,6 +176,12 @@ void gnrc_ipv6_nib_iface_down(gnrc_netif_t *netif, bool send_final_ra)
|
||||
#else
|
||||
(void)send_final_ra;
|
||||
#endif
|
||||
for (unsigned i = 0; i < CONFIG_GNRC_NETIF_IPV6_ADDRS_NUMOF; i++) {
|
||||
if (ipv6_addr_is_link_local(&netif->ipv6.addrs[i])) {
|
||||
/* link-local address might change on reconnect */
|
||||
gnrc_netif_ipv6_addr_remove_internal(netif, &netif->ipv6.addrs[i]);
|
||||
}
|
||||
}
|
||||
|
||||
gnrc_netif_release(netif);
|
||||
}
|
||||
@ -201,7 +208,6 @@ void gnrc_ipv6_nib_init_iface(gnrc_netif_t *netif)
|
||||
return;
|
||||
}
|
||||
_add_static_lladdr(netif);
|
||||
_auto_configure_addr(netif, &ipv6_addr_link_local_prefix, 64U);
|
||||
|
||||
gnrc_netif_release(netif);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user