uip-ds6-nbr: introduce UIP_DS6_NBR_MAX_6ADDRS_PER_NBR

This commit is contained in:
Yasuyuki Tanaka 2018-08-29 17:28:13 +02:00
parent 17aa75f0cf
commit 319b70345a
2 changed files with 21 additions and 0 deletions

View File

@ -149,6 +149,19 @@ uip_ds6_nbr_add(const uip_ipaddr_t *ipaddr, const uip_lladdr_t *lladdr,
}
}
if(list_length(nbr_entry->uip_ds6_nbrs) < UIP_DS6_NBR_MAX_6ADDRS_PER_NBR) {
/* it has room to add another IPv6 address */
} else {
/*
* it's already had the maximum number of IPv6 addresses; cannot
* add another.
*/
LOG_ERR("%s: no room in nbr_entry for ", __func__);
LOG_ERR_LLADDR((const linkaddr_t *)lladdr);
LOG_ERR_("\n");
return NULL;
}
if((nbr = (uip_ds6_nbr_t *)memb_alloc(&uip_ds6_nbr_memb)) == NULL) {
LOG_ERR("%s: cannot allocate a new uip_ds6_nbr\n", __func__);
if(list_length(nbr_entry->uip_ds6_nbrs) == 0) {

View File

@ -75,6 +75,14 @@
#define UIP_DS6_NBR_MULTI_IPV6_ADDRS 0
#endif /* UIP_DS6_NBR_CONF_MULTI_IPV6_ADDRS */
/** \brief Set the maximum number of IPv6 addresses per link-layer
* address */
#ifdef UIP_DS6_NBR_CONF_MAX_6ADDRS_PER_NBR
#define UIP_DS6_NBR_MAX_6ADDRS_PER_NBR UIP_DS6_NBR_CONF_MAX_6ADDRS_PER_NBR
#else
#define UIP_DS6_NBR_MAX_6ADDRS_PER_NBR 2
#endif /* UIP_DS6_NBR_CONF_MAX_6ADDRS_PER_NBR */
/** \brief Set the maximum number of neighbor cache entries */
#ifdef UIP_DS6_NBR_CONF_MAX_NEIGHBOR_CACHES
#define UIP_DS6_NBR_MAX_NEIGHBOR_CACHES UIP_DS6_NBR_CONF_MAX_NEIGHBOR_CACHES