-
Notifications
You must be signed in to change notification settings - Fork 7.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
esp_netif_get_hostname/esp_netif_set_hostname bugs (IDFGH-2663) #4737
Comments
Add @david-cermak |
@AxelLin Thanks for the report, going to fix the issues! As of now, I might suggest these workarounds:
|
@david-cermak Can you please give me a short code example, how to set the hostname? i have build some sensor boards with ESP32. in the past each sensor board has its own hostname hardcoded in software and the server gives them a specific IP based on their hostname.
but recently i upgraded the ESP-IDF (ESP-IDF v4.2-dev-408-g132cc67c0-dirty) and now those functions are marked as deprecated.
so all my updated sensor boards gets another IP from the server as they got before, because the don't send the expected hostnames anymore. |
it looks like there is not always "client provides name: ..." available from the ESP. here the log on the server:
in contrast to a raspberrypi, there is at each stage a "client provides name: ..." available:
|
Hi @beta-tester I believe that what you're seeing is another issue, related to the DHCP discover packets. Please subscribe to that issue to get notified when it gets resolved. As for the usage example, please refer to the test case added to check the fixed issue: https://github.com/espressif/esp-idf/blob/master/components/esp_netif/test/test_esp_netif.c#L248 |
@david-cermak , thank you for your hint... |
my issue is fixed now... thank you |
On startup of the common interface (ethernet, wifi), the lwip netif hostname was assigned to confg value . Fixed to assign to esp-netif hostname if it exists Closes #4737
Is there a solution for this? Trying to use esp_netif_t *sta_netif = esp_netif_create_default_wifi_sta();
ESP_ERROR_CHECK(esp_netif_set_hostname(sta_netif, "custom")); and it's not working. Using ESP-IDF v5.3.2 |
This should work normally, see the test code here: esp-idf/components/esp_netif/test_apps/test_app_esp_netif/main/esp_netif_test_lwip.c Lines 424 to 427 in b5ac4fb
Does the |
Sorry, my mistake, seems to be working, DHCP client list on my AP was cached and wasn’t updating correctly. |
IDF version: v4.1-dev-2184-g577abc44728c
My test configuration is disable ESP_NETIF_TCPIP_ADAPTER_COMPATIBLE_LAYER.
The bugs
Before calling esp_wifi_start()
p_netif->hostname is NULL
The esp_netif_get_hostname() only checks if (p_netif != NULL) but p_netif->hostname can also be NULL.
Need to test p_netif->hostname as well.
Otherwise the user may call printf to show the NULL hostname (because the error code is 0) and got
Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled.
Before calling esp_wifi_start():
It looks fine above.
But after calling esp_wifi_start().
esp_netif_get_hostname() returns "expressif".
Check the DHCP client list on my AP, it also shows the client hostname is "expressif".
i.e. the previous esp_netif_set_hostname() does not work at all.
Then I calling esp_netif_set_hostname again and set hostname to "MYTEST3"
esp_netif_get_hostname() returns MYTEST3 but the DHCP client list on my AP is still "expressif".
i.e. esp_netif_set_hostname() has no effect.
This issue is also reported on https://www.esp32.com/viewtopic.php?f=13&t=14160
The text was updated successfully, but these errors were encountered: