1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-26 06:53:52 +01:00

Merge pull request #9226 from miri64/gnrc_netif/enh/error-on-multicast-space

gnrc_netif: fail IPv6 address addition if no space for solicited nodes
This commit is contained in:
Koen Zandberg 2018-05-29 20:30:26 +02:00 committed by GitHub
commit 5be4b7f5c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 4 deletions

View File

@ -70,6 +70,10 @@ extern "C" {
/**
* @brief Maximum number of unicast and anycast addresses per interface
*
* @note If you change this, please make sure that
* @ref GNRC_NETIF_IPV6_GROUPS_NUMOF is also large enough to fit the
* addresses' solicited nodes multicast addresses.
*
* Default: 2 (link-local + corresponding global address)
*/
#ifndef GNRC_NETIF_IPV6_ADDRS_NUMOF

View File

@ -87,7 +87,8 @@ void gnrc_netif_release(gnrc_netif_t *netif);
* @note Only available with @ref net_gnrc_ipv6 "gnrc_ipv6".
*
* @return >= 0, on success
* @return -ENOMEM, when no space for new addresses is left on the interface
* @return -ENOMEM, when no space for new addresses (or its solicited nodes
* multicast address) is left on the interface
*/
int gnrc_netif_ipv6_addr_add_internal(gnrc_netif_t *netif,
const ipv6_addr_t *addr,

View File

@ -555,9 +555,6 @@ int gnrc_netif_ipv6_addr_add_internal(gnrc_netif_t *netif,
gnrc_netif_release(netif);
return -ENOMEM;
}
netif->ipv6.addrs_flags[idx] = flags;
memcpy(&netif->ipv6.addrs[idx], addr, sizeof(netif->ipv6.addrs[idx]));
#ifdef MODULE_GNRC_IPV6_NIB
#if GNRC_IPV6_NIB_CONF_ARSM
ipv6_addr_t sol_nodes;
int res;
@ -570,8 +567,12 @@ int gnrc_netif_ipv6_addr_add_internal(gnrc_netif_t *netif,
DEBUG("nib: Can't join solicited-nodes of %s on interface %u\n",
ipv6_addr_to_str(addr_str, addr, sizeof(addr_str)),
netif->pid);
return res;
}
#endif /* GNRC_IPV6_NIB_CONF_ARSM */
netif->ipv6.addrs_flags[idx] = flags;
memcpy(&netif->ipv6.addrs[idx], addr, sizeof(netif->ipv6.addrs[idx]));
#ifdef MODULE_GNRC_IPV6_NIB
if (_get_state(netif, idx) == GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_VALID) {
void *state = NULL;
gnrc_ipv6_nib_pl_t ple;