Can't get or set hostname on netif

rpoelvogels
Posts: 6
Joined: Wed Jan 30, 2019 9:35 am

Can't get or set hostname on netif

Postby rpoelvogels » Fri Oct 06, 2023 8:40 am

Hi,

I'm trying to set the hostname for the ethernet interface.
But `esp_netif_set_hostname()` always returns `ESP_ERR_ESP_NETIF_IF_NOT_READY`.
`esp_netif_get_hostname()` also always only returns `ESP_ERR_ESP_NETIF_IF_NOT_READY`.

I've checked the source code of these functions and they look like:

Code: Select all

#if LWIP_NETIF_HOSTNAME
//Useful code
#else
    return ESP_ERR_ESP_NETIF_IF_NOT_READY;
#endif
`LWIP_NETIF_HOSTNAME` is defined as '0', so the useful code is removed.

How and where can I make sure that `LWIP_NETIF_HOSTNAME` is properly defined?

I'm using ESP-IDF 4.4.

Thanks in advance.

Kind regards,

Remco Poelstra

chegewara
Posts: 2240
Joined: Wed Jun 14, 2017 9:00 pm

Re: Can't get or set hostname on netif

Postby chegewara » Tue Mar 19, 2024 4:17 pm

When you init ethernet netif with this or similar API:

Code: Select all

ethernetif_init()
you can use thi API w/o issues

Code: Select all

esp_netif_set_hostname(esp_netif, name)

Who is online

Users browsing this forum: No registered users and 221 guests