Chapter 2. API Reference
This function behaves differently if DHCP server or client is enabled
If DHCP client is enabled, main and backup DNS servers will be updated automatically from the DHCP lease
if the relevant DHCP options are set. Fallback DNS Server is never updated from the DHCP lease and is
designed to be set via this API. If DHCP client is disabled, all DNS server types can be set via this API only.
If DHCP server is enabled, the Main DNS Server setting is used by the DHCP server to provide a DNS Server
option to DHCP clients (Wi-Fi stations).
• The default Main DNS server is typically the IP of the Wi-Fi AP interface itself.
• This function can override it by setting server type ESP_NETIF_DNS_MAIN.
• Other DNS Server types are not supported for the Wi-Fi AP interface.
Return
• ESP_OK on success
• ESP_ERR_ESP_NETIF_INVALID_PARAMS invalid params
Parameters
• [in] esp_netif: Handle to esp-netif instance
• [in] type: Type of DNS Server to set: ESP_NETIF_DNS_MAIN,
ESP_NETIF_DNS_BACKUP, ESP_NETIF_DNS_FALLBACK
• [in] dns: DNS Server address to set
esp_err_t esp_netif_get_dns_info(esp_netif_t *esp_netif, esp_netif_dns_type_t type,
esp_netif_dns_info_t *dns)
Get DNS Server information.
Return the currently configured DNS Server address for the specified interface and Server type.
This may be result of a previous call to esp_netif_set_dns_info(). If the interface’s DHCP client is enabled,
the Main or Backup DNS Server may be set by the current DHCP lease.
Return
• ESP_OK on success
• ESP_ERR_ESP_NETIF_INVALID_PARAMS invalid params
Parameters
• [in] esp_netif: Handle to esp-netif instance
• [in] type: Type of DNS Server to get: ESP_NETIF_DNS_MAIN,
ESP_NETIF_DNS_BACKUP, ESP_NETIF_DNS_FALLBACK
• [out] dns: DNS Server result is written here on success
esp_err_t esp_netif_create_ip6_linklocal(esp_netif_t *esp_netif)
Create interface link-local IPv6 address.
Cause the TCP/IP stack to create a link-local IPv6 address for the specified interface.
This function also registers a callback for the specified interface, so that if the link-local address becomes
verified as the preferred address then a SYSTEM_EVENT_GOT_IP6 event will be sent.
Return
• ESP_OK
• ESP_ERR_ESP_NETIF_INVALID_PARAMS
Parameters
• [in] esp_netif: Handle to esp-netif instance
esp_err_t esp_netif_get_ip6_linklocal(esp_netif_t *esp_netif, esp_ip6_addr_t *if_ip6)
Get interface link-local IPv6 address.
If the specified interface is up and a preferred link-local IPv6 address has been created for the interface, return
a copy of it.
Return
• ESP_OK
• ESP_FAIL If interface is down, does not have a link-local IPv6 address, or the link-local IPv6
address is not a preferred address.
Parameters
• [in] esp_netif: Handle to esp-netif instance
Espressif Systems 206
Submit Document Feedback
Release v4.4