feat(esp_netif): Added preferred flag to esp_netif_add_ip6_address

This commit is contained in:
Abhik Roy
2024-01-04 22:51:57 +11:00
parent 8809589cf7
commit f30d488458
5 changed files with 7 additions and 20 deletions

View File

@ -115,7 +115,7 @@ void esp_netif_action_add_ip6_address(void *esp_netif, esp_event_base_t base, in
{ {
ESP_LOGD(TAG, "esp_netif action add_ip6_address with netif%p from event_id=%" PRId32, esp_netif, event_id); ESP_LOGD(TAG, "esp_netif action add_ip6_address with netif%p from event_id=%" PRId32, esp_netif, event_id);
const ip_event_add_ip6_t *addr = (const ip_event_add_ip6_t *)data; const ip_event_add_ip6_t *addr = (const ip_event_add_ip6_t *)data;
esp_netif_add_ip6_address_priv(esp_netif, addr); esp_netif_add_ip6_address(esp_netif, addr->addr, addr->preferred);
} }
void esp_netif_action_remove_ip6_address(void *esp_netif, esp_event_base_t base, int32_t event_id, void *data) void esp_netif_action_remove_ip6_address(void *esp_netif, esp_event_base_t base, int32_t event_id, void *data)

View File

@ -827,6 +827,7 @@ int esp_netif_get_all_ip6(esp_netif_t *esp_netif, esp_ip6_addr_t if_ip6[]);
* *
* @param[in] esp_netif Handle to esp-netif instance * @param[in] esp_netif Handle to esp-netif instance
* @param[in] addr The address to be added * @param[in] addr The address to be added
* @param[in] preferred The preferred status of the address
* *
* @return * @return
* - ESP_OK * - ESP_OK
@ -834,7 +835,7 @@ int esp_netif_get_all_ip6(esp_netif_t *esp_netif, esp_ip6_addr_t if_ip6[]);
* - ESP_ERR_ESP_NETIF_IP6_ADDR_FAILED * - ESP_ERR_ESP_NETIF_IP6_ADDR_FAILED
* - ESP_ERR_NO_MEM * - ESP_ERR_NO_MEM
*/ */
esp_err_t esp_netif_add_ip6_address(esp_netif_t *esp_netif, const esp_ip6_addr_t addr); esp_err_t esp_netif_add_ip6_address(esp_netif_t *esp_netif, const esp_ip6_addr_t addr, bool preferred);
/** /**
* @brief Cause the TCP/IP stack to remove an IPv6 address from the interface * @brief Cause the TCP/IP stack to remove an IPv6 address from the interface

View File

@ -455,7 +455,7 @@ esp_err_t esp_netif_leave_ip6_multicast_group(esp_netif_t *esp_netif, const esp_
return ESP_ERR_NOT_SUPPORTED; return ESP_ERR_NOT_SUPPORTED;
} }
esp_err_t esp_netif_add_ip6_address_priv(esp_netif_t *esp_netif, const ip_event_add_ip6_t *addr) esp_err_t esp_netif_add_ip6_address(esp_netif_t *esp_netif, const esp_ip6_addr_t addr, bool preferred)
{ {
return ESP_ERR_NOT_SUPPORTED; return ESP_ERR_NOT_SUPPORTED;
} }

View File

@ -2623,12 +2623,12 @@ static esp_err_t esp_netif_add_ip6_address_api(esp_netif_api_msg_t *msg)
return error; return error;
} }
esp_err_t esp_netif_add_ip6_address_priv(esp_netif_t *esp_netif, const ip_event_add_ip6_t *addr) static esp_err_t esp_netif_add_ip6_address_priv(esp_netif_t *esp_netif, const ip_event_add_ip6_t *addr)
_RUN_IN_LWIP_TASK(esp_netif_add_ip6_address_api, esp_netif, addr) _RUN_IN_LWIP_TASK(esp_netif_add_ip6_address_api, esp_netif, addr)
esp_err_t esp_netif_add_ip6_address(esp_netif_t *esp_netif, const esp_ip6_addr_t addr) esp_err_t esp_netif_add_ip6_address(esp_netif_t *esp_netif, const esp_ip6_addr_t addr, bool preferred)
{ {
const ip_event_add_ip6_t addr_evt = {.addr = addr, .preferred = true}; const ip_event_add_ip6_t addr_evt = {.addr = addr, .preferred = preferred};
return esp_netif_add_ip6_address_priv(esp_netif, &addr_evt); return esp_netif_add_ip6_address_priv(esp_netif, &addr_evt);
} }

View File

@ -116,20 +116,6 @@ esp_err_t esp_netif_remove_from_list_unsafe(esp_netif_t* netif);
*/ */
bool esp_netif_is_netif_listed(esp_netif_t *esp_netif); bool esp_netif_is_netif_listed(esp_netif_t *esp_netif);
/**
* @brief Cause the TCP/IP stack to add an IPv6 address to the interface
*
* @param[in] esp_netif Handle to esp-netif instance
* @param[in] addr The address to be added
*
* @return
* - ESP_OK
* - ESP_ERR_ESP_NETIF_INVALID_PARAMS
* - ESP_ERR_ESP_NETIF_IP6_ADDR_FAILED
* - ESP_ERR_NO_MEM
*/
esp_err_t esp_netif_add_ip6_address_priv(esp_netif_t *esp_netif, const ip_event_add_ip6_t *addr);
/** /**
* @brief Get esp_netif handle based on the if_key * @brief Get esp_netif handle based on the if_key
* This doesn't lock the list nor TCPIP context * This doesn't lock the list nor TCPIP context