You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Ethernet DHCP hostname intermittently advertised as tasmota after upgrade to WLED 16.x #5831
After upgrading from WLED 0.15 to 16.0.1, one of my WLED devices using Ethernet intermittently advertises the hostname "tasmota" via DHCP instead of its configured WLED hostname.
This does not happen on another WLED device using Wi-Fi.
The result is that OPNsense registers the device as "tasmota" in local DNS, which breaks bookmarks and other hostname-based access to the device.
To Reproduce Bug
Run WLED 16.0.1 on an ESP32 device using Ethernet.
Configure a hostname for the WLED device.
Use DHCP and observe the hostname supplied by the device to the DHCP server.
Expected Behavior
The reported to DHCP server hostname being the one from "mDNS address" setting.
Which microcontroller/board are you seeing the problem on?
ESP32 with ethernet
Relevant log/trace output
Anything else?
I don't know if it is relevant, but the problem happens with the Olimex ESP32-POE.
It does not appear to be the intentional behavior from #5542 since the hostname changed to "tasmota" instead of "wled-abcd".
@softhack007, verification is incomplete because the second repository inspection failed. Please retry the source-access step.
The available source gives this preliminary result:
I found no literal "tasmota" match in the indexed source of either requested Tasmota framework repository.
I could not verify the effective value of CONFIG_LWIP_LOCAL_HOSTNAME. That value can be the fallback hostname in ESP-IDF.
ESP-IDF documents that esp_netif_set_hostname() changes made after an interface starts or connects take effect only after the interface restarts or reconnects.
WLED 16.x calls ETH.begin() first. The Arduino-ESP32 implementation starts Ethernet in that call.
WLED calls ETH.setHostname(hostname) only in ARDUINO_EVENT_ETH_CONNECTED.
Therefore, WLED sets the Ethernet hostname after the interface has connected. This order does not meet the ESP-IDF hostname timing constraint. The first DHCP exchange can use the pre-existing hostname.
I cannot yet confirm that the pre-existing hostname is "tasmota". The missing configuration inspection is required for that conclusion.
ESP-IDF documents that esp_netif_set_hostname() changes made after an interface starts or connects take effect only after the interface restarts or reconnects.
WLED 16.x calls ETH.begin() first. The Arduino-ESP32 implementation starts Ethernet in that call.
WLED calls ETH.setHostname(hostname) only in ARDUINO_EVENT_ETH_CONNECTED.
Therefore, WLED sets the Ethernet hostname after the interface has connected. This order does not meet the ESP-IDF hostname timing constraint. The first DHCP exchange can use the pre-existing hostname.
🤔 reminds of a similar problem with the WiFi interface, that required the hostname to be set before initiating a connection (PR #5424 - setHostname() must be called BEFORE Wi-Fi is started with WiFi.begin()). The ETH path was not changed in that PR, Maybe we need to also set the ETH hostname earlier,
#!/bin/bashset -euo pipefail
wled_repo='wled/WLED'
wled_ref='fdea5f0b4d610b71d0941e4d455c9958087d1b06'raw() {
local repo="$1" ref="$2" path="$3"
gh api -H 'Accept: application/vnd.github.raw+json' \
"repos/$repo/contents/$path?ref=$ref"
}
echo'=== WLED commit and platform/framework pins ==='
gh api "repos/$wled_repo/commits/$wled_ref" --jq '{sha: .sha, parents: [.parents[].sha], message: .commit.message}'
raw "$wled_repo""$wled_ref"'platformio.ini' \
| rg -n -C 3 '(tasmota|arduino-esp32|platform_packages|framework)'echo'=== WLED Ethernet initialization and hostname call sites ==='
raw "$wled_repo""$wled_ref"'wled00/network.cpp'> /tmp/wled-network.cpp
rg -n -C 20 '(initEthernet\s*\(|ETH\.begin\s*\(|ETH\.setHostname\s*\(|ARDUINO_EVENT_ETH_)' /tmp/wled-network.cpp
echo'=== Arduino-ESP32 ETH API implementation at Tasmota release/v2.x ==='
raw 'tasmota/arduino-esp32''release/v2.x''libraries/Ethernet/src/ETH.cpp'> /tmp/ETH.cpp
raw 'tasmota/arduino-esp32''release/v2.x''libraries/Ethernet/src/ETH.h'> /tmp/ETH.h
rg -n -C 18 '(ETHClass::begin|ETHClass::setHostname|setHostname\s*\(|esp_netif_set_hostname|esp_netif_create_default|esp_eth_start)' /tmp/ETH.cpp /tmp/ETH.h
echo'=== ESP-IDF hostname API contract ==='
raw 'tasmota/esp-idf''v4.4.8.240628''components/esp_netif/include/esp_netif.h' \
| rg -n -C 12 '(esp_netif_set_hostname|hostname.*start|start.*hostname|DHCP)'
Length of output: 41743
@softhack007, I agree that the Ethernet path needs a change.
However, ETH.setHostname() cannot move directly before ETH.begin() in WLED. In the Tasmota Arduino-ESP32 framework, ETH.begin() creates the Ethernet esp_netif_t. ETH.setHostname() sets the hostname on that interface. Before ETH.begin(), the Ethernet interface does not exist.
The current location is incorrect. ARDUINO_EVENT_ETH_CONNECTED also triggers the default ESP-IDF handler that starts DHCP. Therefore, ETH.setHostname(hostname) can occur after DHCP has started.
The practical WLED-only fix is:
Generate the hostname before Ethernet initialization.
Call ETH.setHostname(hostname) from ARDUINO_EVENT_ETH_START.
Do not set the hostname in ARDUINO_EVENT_ETH_CONNECTED.
ARDUINO_EVENT_ETH_START occurs before physical link connection and before the ETH_CONNECTED DHCP-start path. This should prevent the first DHCP exchange from using the fallback hostname.
There is one limitation. ESP-IDF documents that hostname changes after an interface starts are applied after restart or reconnect. ETH.begin() calls esp_eth_start() before it returns, so ARDUINO_EVENT_ETH_START is not strictly before interface start. The fully compliant fix requires a framework change: create the Ethernet netif, set its hostname, and only then call esp_eth_start().
I recommend the ETH_START change as the low-risk WLED fix. A framework-level change is the robust long-term fix.
Also, the ESP-IDF header for this framework specifies a maximum hostname length of 32 bytes. WLED allocates 64 bytes for the FQDN label. The Ethernet hostname should be constrained to the framework limit before calling ETH.setHostname().
wled00/network.cpp: In function 'void WiFiEvent(arduino_event_id_t)':
wled00/network.cpp:484:10: error: jump to case label [-fpermissive]
case ARDUINO_EVENT_ETH_CONNECTED:
^~~~~~~~~~~~~~~~~~~~~~~~~~~
wled00/network.cpp:480:12: note: crosses initialization of 'char ethHostname [64]'
char ethHostname[64] = {'\0'};
^~~~~~~~~~~
Activity
softhack007 commentedon Sep 11, 2026
@coderabbitai the hostname "tasmota" looks like a built-in default. Please check the framework source code https://github.com/tasmota/arduino-esp32/tree/release/v2.x and tasmota esp-idf source code https://github.com/tasmota/esp-idf/tree/v4.4.8.240628 and verify if such a default value does exist, and note any constraints in the Ethernet initialization order that might be relevant. Check if the Ethernet initialization path in WLED 16.0.1 (https://github.com/wled/WLED/tree/16_x) does initialize the hostname at the right time.
coderabbitai commentedon Sep 11, 2026
🧩 Analysis chain
🏁 Script executed:
Length of output: 16707
🏁 Script executed:
Length of output: 103108
🏁 Script executed:
Length of output: 1904
@softhack007, verification is incomplete because the second repository inspection failed. Please retry the source-access step.The available source gives this preliminary result:
"tasmota"match in the indexed source of either requested Tasmota framework repository.CONFIG_LWIP_LOCAL_HOSTNAME. That value can be the fallback hostname in ESP-IDF.esp_netif_set_hostname()changes made after an interface starts or connects take effect only after the interface restarts or reconnects.ETH.begin()first. The Arduino-ESP32 implementation starts Ethernet in that call.ETH.setHostname(hostname)only inARDUINO_EVENT_ETH_CONNECTED.I cannot yet confirm that the pre-existing hostname is
"tasmota". The missing configuration inspection is required for that conclusion.You are interacting with an AI system.
softhack007 commentedon Sep 11, 2026
🤔 reminds of a similar problem with the WiFi interface, that required the hostname to be set before initiating a connection (PR #5424 - setHostname() must be called BEFORE Wi-Fi is started with WiFi.begin()). The ETH path was not changed in that PR, Maybe we need to also set the ETH hostname earlier,
WLED/wled00/network.cpp
Lines 482 to 492 in fdea5f0
@coderabbitai what do you think?
coderabbitai commentedon Sep 11, 2026
🧩 Analysis chain
🏁 Script executed:
Length of output: 41743
@softhack007, I agree that the Ethernet path needs a change.However,
ETH.setHostname()cannot move directly beforeETH.begin()in WLED. In the Tasmota Arduino-ESP32 framework,ETH.begin()creates the Ethernetesp_netif_t.ETH.setHostname()sets the hostname on that interface. BeforeETH.begin(), the Ethernet interface does not exist.The current location is incorrect.
ARDUINO_EVENT_ETH_CONNECTEDalso triggers the default ESP-IDF handler that starts DHCP. Therefore,ETH.setHostname(hostname)can occur after DHCP has started.The practical WLED-only fix is:
ETH.setHostname(hostname)fromARDUINO_EVENT_ETH_START.ARDUINO_EVENT_ETH_CONNECTED.ARDUINO_EVENT_ETH_STARToccurs before physical link connection and before theETH_CONNECTEDDHCP-start path. This should prevent the first DHCP exchange from using the fallback hostname.There is one limitation. ESP-IDF documents that hostname changes after an interface starts are applied after restart or reconnect.
ETH.begin()callsesp_eth_start()before it returns, soARDUINO_EVENT_ETH_STARTis not strictly before interface start. The fully compliant fix requires a framework change: create the Ethernet netif, set its hostname, and only then callesp_eth_start().I recommend the
ETH_STARTchange as the low-risk WLED fix. A framework-level change is the robust long-term fix.Also, the ESP-IDF header for this framework specifies a maximum hostname length of 32 bytes. WLED allocates 64 bytes for the FQDN label. The Ethernet hostname should be constrained to the framework limit before calling
ETH.setHostname().🐇🔍
You are interacting with an AI system.
softhack007 commentedon Sep 11, 2026
@alex-gh Unfortunately I don't have any ethernet hardware to test the AI's suggestion.
For a simple test, you'd need to re-compile WLED with a small addition in wled00/network.cpp
WLED/wled00/network.cpp
Lines 479 to 480 in fdea5f0
WLED/wled00/network.cpp
Lines 481 to 482 in fdea5f0
alex-gh commentedon Sep 11, 2026
@softhack007
Looks like it is fixed. I had to put the case in braces though:
otherwise I would get:
Ethernet: register hostname before DNS starts (fixes #5831)
hostname and mDNS robustness improvements (solves #5831 and #5999) (#…
hostname and mDNS robustness improvements (solves wled#5831 and wled#…