third_party/lwip/repo/lwip/src/core/netif.c
/** 
 * This function allows for the easy addition of a new IPv6 address to an interface.
 * It takes care of finding an empty slot and then sets the address as tentative
 * (to make sure that all the subsequent processing happens).
 *
 * @param netif netif to add the address on
 * @param ip6addr address to add
 * @param chosen_idx if != NULL, the chosen IPv6 address index will be stored here
 */
This function allows for the easy addition of a new IPv6 address to an interface.
It takes care of finding an empty slot and then sets the address as tentative
(to make sure that all the subsequent processing happens).

@param netif netif to add the address on
@param ip6addr address to add
@param chosen_idx if != NULL, the chosen IPv6 address index will be stored here
This function allows for the easy addition of a new IPv6 address to an interface . It takes care of finding an empty slot and then sets the address as tentative ( to make sure that all the subsequent processing happens ) . @param netif netif to add the address on @param ip6addr address to add @param chosen_idx if ! = NULL the chosen IPv6 address index will be stored here
err_t
netif_add_ip6_address(struct netif *netif, ip6_addr_t *ip6addr, s8_t *chosen_idx)
{
  s8_t i;
  err_t retval;
  i = netif_matches_ip6_addr(netif, ip6addr);
  if (i >= 0) {
    retval = ERR_OK;
    goto exit;
  }
  for (i = 1; i < LWIP_IPV6_NUM_ADDRESSES; i++) {
    if (ip6_addr_isinvalid(netif->ip6_addr_state[i])) {
      ip6_addr_copy(netif->ip6_addr[i], *ip6addr);
      netif_ip6_addr_set_state(netif, i, IP6_ADDR_TENTATIVE);
      retval = ERR_OK;
      goto exit;
    }
  }
  i = -1;
  retval = ERR_VAL;
exit:
  if (chosen_idx != NULL) {
    *chosen_idx = i;
  }
  return retval;
}
err_t netif_add_ip6_address ( struct netif * netif , ip6_addr_t * ip6addr , s8_t * chosen_idx ) { s8_t i ; err_t retval ; i = netif_matches_ip6_addr ( netif , ip6addr ) ; if ( i >= 0 ) { retval = ERR_OK ; goto exit ; } for ( i = 1 ; i < LWIP_IPV6_NUM_ADDRESSES ; i ++ ) { if ( ip6_addr_isinvalid ( netif -> ip6_addr_state [ i ] ) ) { ip6_addr_copy ( netif -> ip6_addr [ i ] , * ip6addr ) ; netif_ip6_addr_set_state ( netif , i , IP6_ADDR_TENTATIVE ) ; retval = ERR_OK ; goto exit ; } } i = -1 ; retval = ERR_VAL ; exit : if ( chosen_idx != NULL ) { * chosen_idx = i ; } return retval ; }
This function allows for the easy addition of a new IPv6 address to an interface.
This function allows for the easy addition of a new IPv6 address to an interface .
/* Address already added */ /* Find a free slot -- musn't be the first one (reserved for link local) */ /* Set error values */