Skip to content

(0.15.x backport) Hostname creation cleanup, avoid that default DNS name ESP-xxxxx gets used#5436

Open
softhack007 wants to merge 2 commits into0_15_xfrom
backport_DNS-fix
Open

(0.15.x backport) Hostname creation cleanup, avoid that default DNS name ESP-xxxxx gets used#5436
softhack007 wants to merge 2 commits into0_15_xfrom
backport_DNS-fix

Conversation

@softhack007
Copy link
Member

@softhack007 softhack007 commented Mar 21, 2026

Bug Fixes

  • Improved hostname sanitization and buffer-size safeguards to prevent truncation and ensure DNS-compliant names.
  • Hostname is now applied earlier during network setup and on reconnects (ESP32), improving connectivity and ensuring settings take effect.
  • Solves the problem that ESP32 boards show as "ESP-xxxxxx" on the network, no matter if DNS name is defined or not

New Features

  • Added a length-aware hostname retrieval API with an mDNS-preference option and robust fallback behavior.
  • Preserved legacy compatibility by providing a length-aware alias for legacy hostname preparation.

Limitations

  • mDNS name is not sanitized when registering the mDNS endpoint, to avoid breaking previous functionality
  • hostnames with double WLED- prefix, like wled-WLED-kitchen still allowed, to prevent breaking legacy behaviour

Summary by CodeRabbit

  • Bug Fixes
    • Enhanced hostname validation and generation to improve reliability.
    • Improved network initialization with safer hostname assignment across WiFi and Ethernet interfaces.

… used (#5424)

Bug Fixes
* Improved hostname sanitization and buffer-size safeguards to prevent truncation and ensure DNS-compliant names.
* Hostname is now applied earlier during network setup and on reconnects (ESP32), improving connectivity and ensuring settings take effect.
* Solves the problem that ESP32 boards show as "ESP-xxxxxx" on the network, no matter if DNS name is defined or not
* (breaking fix) prevent hostnames with double ``WLED-`` prefix, like ``wled-WLED-kitchen``

New Features
* Added a length-aware hostname retrieval API with an mDNS-preference option and robust fallback behavior.
* Preserved legacy compatibility by providing a length-aware alias for legacy hostname preparation.

Open Ends
* mDNS name is not sanitized when registering the mDNS endpoint, to avoid breaking previous functionality
* preserve old method for device name creation, allowing double names like WLED-wled-Kitchen
* only prefer mDNS name at startup (fixes #5424)
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 21, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 403e129f-916b-4049-9ff9-c2e00e0b3b88

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • ✅ Review completed - (🔄 Check again to review again)
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch backport_DNS-fix

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot]

This comment was marked as resolved.

@softhack007 softhack007 requested review from DedeHai and netmindz March 22, 2026 00:27
@DedeHai DedeHai added this to the 0.15.5 milestone Mar 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants