Skip to content

Ethernet DHCP hostname intermittently advertised as tasmota after upgrade to WLED 16.x #5831

Done

Description

@alex-gh

What happened?

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.

Install Method

Binary from WLED.me

What version of WLED?

WLED 16.0.1 (2606300) "ESP32_Ethernet" (Processor: ESP32-D0WD-V3)

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".

Code of Conduct

  • I agree to follow this project's Code of Conduct
Pinned by softhack007

Activity

  1. softhack007 commented on Sep 11, 2026

    @softhack007
    Member

    @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.

  2. added
    needs investigation
    on Sep 11, 2026
  3. coderabbitai commented on Sep 11, 2026

    @coderabbitai
    Contributor
    🧩 Analysis chain

    🏁 Script executed:

    #!/bin/bash
    set -euo pipefail
    
    echo '=== WLED issue 5831 ==='
    gh api repos/wled/WLED/issues/5831 --jq '{url: .html_url, title: .title, body: .body, state: .state}'
    gh api repos/wled/WLED/issues/5831/comments --paginate --jq '.[] | {user: .user.login, created_at: .created_at, body: .body}'
    
    echo '=== Locate relevant tracked files and literal tasmota in requested refs ==='
    for spec in \
      'tasmota/arduino-esp32 release/v2.x' \
      'tasmota/esp-idf v4.4.8.240628' \
      'wled/WLED 16_x'
    do
      set -- $spec
      repo="$1"
      ref="$2"
      echo "--- $repo @ $ref ---"
      sha="$(gh api "repos/$repo/commits/$ref" --jq .sha)"
      gh api "repos/$repo/git/trees/$sha?recursive=1" --paginate --jq '.tree[] | select(.type == "blob") | .path' \
        | rg -i '(eth|ethernet|network|wifi|hostname|esp_netif|tcpip_adapter)' \
        | head -n 160 || true
    done
    
    echo '=== GitHub code search: Tasmota Arduino-ESP32 ==='
    gh api -H 'Accept: application/vnd.github+json' \
      'search/code?q=%22tasmota%22+repo%3Atasmota%2Farduino-esp32+ref%3Arelease%2Fv2.x' \
      --jq '.items[] | {path: .path, url: .html_url}' || true
    
    echo '=== GitHub code search: Tasmota ESP-IDF ==='
    gh api -H 'Accept: application/vnd.github+json' \
      'search/code?q=%22tasmota%22+repo%3Atasmota%2Fesp-idf+ref%3Av4.4.8.240628' \
      --jq '.items[] | {path: .path, url: .html_url}' || true
    
    echo '=== GitHub code search: WLED Ethernet hostname APIs ==='
    gh api -H 'Accept: application/vnd.github+json' \
      'search/code?q=%28setHostname+OR+sethostname+OR+ETH.begin+OR+esp_netif_set_hostname%29+repo%3Awled%2FWLED+ref%3A16_x' \
      --jq '.items[] | {path: .path, url: .html_url}' || true

    Length of output: 16707


    🏁 Script executed:

    #!/bin/bash
    set -euo pipefail
    
    get_raw() {
      local repo="$1" ref="$2" path="$3"
      printf '\n===== %s @ %s : %s =====\n' "$repo" "$ref" "$path"
      gh api -H 'Accept: application/vnd.github.raw+json' \
        "repos/$repo/contents/$path?ref=$ref"
    }
    
    echo '=== Arduino-ESP32 Ethernet hostname implementation ==='
    get_raw tasmota/arduino-esp32 release/v2.x libraries/Ethernet/src/ETH.cpp
    get_raw tasmota/arduino-esp32 release/v2.x libraries/Ethernet/src/ETH.h
    get_raw tasmota/arduino-esp32 release/v2.x docs/source/api/ethernet.rst
    
    echo '=== ESP-IDF hostname API and DHCP interaction ==='
    get_raw tasmota/esp-idf v4.4.8.240628 components/esp_netif/include/esp_netif.h \
      | rg -n -C 12 '(set_hostname|get_hostname|hostname|dhcp|DHCP)'
    get_raw tasmota/esp-idf v4.4.8.240628 components/esp_netif/lwip/esp_netif_lwip.c \
      | rg -n -C 18 '(set_hostname|get_hostname|hostname|dhcp|DHCP)'
    get_raw tasmota/esp-idf v4.4.8.240628 components/esp_netif/esp_netif_defaults.c \
      | rg -n -C 12 '(hostname|dhcp|DHCP|ETH)'
    
    echo '=== WLED 16_x network and Ethernet initialization ==='
    get_raw wled/WLED 16_x wled00/network.cpp
    get_raw wled/WLED 16_x wled00/wled_ethernet.h
    get_raw wled/WLED 16_x wled00/src/dependencies/network/Network.cpp
    get_raw wled/WLED 16_x wled00/src/dependencies/network/Network.h

    Length of output: 103108


    🏁 Script executed:

    #!/bin/bash
    set -euo pipefail
    
    tree_paths() {
      local repo="$1" ref="$2" pattern="$3"
      local sha
      sha="$(gh api "repos/$repo/commits/$ref" --jq .sha)"
      gh api "repos/$repo/git/trees/$sha?recursive=1" --paginate --jq '.tree[] | select(.type == "blob") | .path' \
        | rg -i "$pattern" || true
    }
    
    get_raw() {
      local repo="$1" ref="$2" path="$3"
      printf '\n===== %s @ %s : %s =====\n' "$repo" "$ref" "$path"
      gh api -H 'Accept: application/vnd.github.raw+json' \
        "repos/$repo/contents/$path?ref=$ref"
    }
    
    echo '=== Candidate Tasmota framework configuration files ==='
    tree_paths tasmota/arduino-esp32 release/v2.x '(^|/)(sdkconfig|.*config.*|.*defconfig.*|Kconfig.*)$' | head -n 220
    tree_paths tasmota/esp-idf v4.4.8.240628 '(^|/)(sdkconfig|.*config.*|.*defconfig.*|Kconfig.*)$' | head -n 220
    
    echo '=== Find CONFIG_LWIP_LOCAL_HOSTNAME declarations and defaults ==='
    get_raw tasmota/esp-idf v4.4.8.240628 components/lwip/Kconfig \
      | rg -n -C 10 '(LOCAL_HOSTNAME|hostname)' || true
    get_raw tasmota/esp-idf v4.4.8.240628 components/lwip/port/esp32/include/lwipopts.h \
      | rg -n -C 6 '(LOCAL_HOSTNAME|HOSTNAME)' || true
    
    echo '=== WLED 16_x Ethernet startup and event registration call sites ==='
    sha="$(gh api repos/wled/WLED/commits/16_x --jq .sha)"
    gh api "repos/wled/WLED/git/trees/$sha?recursive=1" --paginate --jq '.tree[] | select(.type == "blob") | .path' \
      | while IFS= read -r path; do
          content="$(gh api -H 'Accept: application/vnd.github.raw+json' "repos/wled/WLED/contents/$path?ref=16_x" 2>/dev/null || true)"
          if printf '%s' "$content" | rg -q '(initEthernet\s*\(|WiFi\.onEvent\s*\(|WiFiEvent\s*\()'; then
            printf '\n===== wled/WLED @ 16_x : %s =====\n' "$path"
            printf '%s\n' "$content" | rg -n -C 14 '(initEthernet\s*\(|WiFi\.onEvent\s*\(|WiFiEvent\s*\()'
          fi
        done

    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:

    • 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.

    You are interacting with an AI system.

  4. softhack007 commented on Sep 11, 2026

    @softhack007
    Member
    • 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,

    WLED/wled00/network.cpp

    Lines 482 to 492 in fdea5f0

    case ARDUINO_EVENT_ETH_CONNECTED:
    {
    DEBUG_PRINTLN(F("ETH-E: Connected"));
    if (!apActive) {
    WiFi.disconnect(true); // disable WiFi entirely
    }
    char hostname[64] = {'\0'}; // any "hostname" within a Fully Qualified Domain Name (FQDN) must not exceed 63 characters
    getWLEDhostname(hostname, sizeof(hostname), true); // create DNS name based on mDNS name if set, or fall back to standard WLED server name
    ETH.setHostname(hostname);
    showWelcomePage = false;
    break;

    @coderabbitai what do you think?

  5. coderabbitai commented on Sep 11, 2026

    @coderabbitai
    Contributor
    🧩 Analysis chain

    🏁 Script executed:

    #!/bin/bash
    set -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:

    1. Generate the hostname before Ethernet initialization.
    2. Call ETH.setHostname(hostname) from ARDUINO_EVENT_ETH_START.
    3. 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().

    🐇🔍

    You are interacting with an AI system.

  6. softhack007 commented on Sep 11, 2026

    @softhack007
    Member

    @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

    • after

    WLED/wled00/network.cpp

    Lines 479 to 480 in fdea5f0

    case ARDUINO_EVENT_ETH_START:
    DEBUG_PRINTLN(F("ETH-E: Started"));

    • add
          char ethHostname[64] = {'\0'};
          getWLEDhostname(ethHostname, sizeof(ethHostname), true);
          ETH.setHostname(ethHostname);
    • double-check that these two lines are still there:

    WLED/wled00/network.cpp

    Lines 481 to 482 in fdea5f0

    break;
    case ARDUINO_EVENT_ETH_CONNECTED:

  7. alex-gh commented on Sep 11, 2026

    @alex-gh
    Author

    @softhack007

    Looks like it is fixed. I had to put the case in braces though:

    case ARDUINO_EVENT_ETH_START:
      {
      DEBUG_PRINTLN(F("ETH-E: Started"));
      char ethHostname[64] = {'\0'};
      getWLEDhostname(ethHostname, sizeof(ethHostname), true);
      ETH.setHostname(ethHostname);
      break;
      }

    otherwise I would get:

    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'};
                ^~~~~~~~~~~
    
  8. added
    connectivity
    on Sep 11, 2026
  9. added
    confirmed
    and removed
    needs investigation
    on Sep 11, 2026
  10. self-assigned this
    on Sep 17, 2026
  11. added a commit that references this issue on Dec 2, 2026
    64062a9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugconfirmedconnectivity

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions