Fix/Allow internal underscores in static DHCP hostnames - #3853
Conversation
Thanks for pointing that out. My intention here was specifically to address the behavior described in #3814: these names appear to work for static DHCP assignments, while the Web UI rejects them. That's also why I kept the existing strict hostname validation unchanged for DNS-related uses and scoped this change only to static DHCP entries. If Pi-hole intentionally wants to enforce RFC-compliant hostnames for static DHCP entries as well, then I agree this change shouldn't relax the validation. Could you confirm whether that's the intended policy here? |
|
We had some internal discussion around this and lean towards the allowing underscores as well. In contrast to RFC 952 and RFC 1123 there is also RFC2181 which states in section 11
I suggest to allow underscores, but do not create a new function for validating DHCP hostnames, but to loose requirements in I'd like to get some input from @rdwebdesign and @DL6ER because the have been part of the internal discussion |
|
Agreed on relaxing Not On the underscore itself, FTL has already answered twice: I would therefore relax |
|
@RMA1313 could you fold this into /^[a-zA-Z0-9][\w.-]*$/uThat is dnsmasq's own rule for a DHCP host name ( |
Signed-off-by: RMA1313 <75065599+RMA1313@users.noreply.github.com>
330b042 to
2aa0831
Compare
Updated as suggested. I removed the DHCP-specific validator and relaxed the shared /^[a-zA-Z0-9][\w.-]*$/uStatic DHCP now uses the shared validator again, and I left I also updated the inline DHCP help text to match the new accepted format.
|
Thank you for your contribution to the Pi-hole Community!
Please read the comments below to help us consider your Pull Request.
We are all volunteers and completing the process outlined will help us review your commits quicker.
Please make sure you
What does this PR aim to accomplish?:
Fixes #3814.
Static DHCP hostnames containing internal underscores, such as
TPLinkCam_6FAC, are currently highlighted as invalid and rejected on save by the Web interface.This PR allows internal underscores in static DHCP hostnames while keeping the existing validation behavior for other hostname formats.
How does this PR accomplish the above?:
npm test, which completes successfully with the repository's existing warnings.Link documentation PRs if any are needed to support this PR:
No documentation changes are required. The relevant inline help text in the Web interface has been updated as part of this PR.
By submitting this pull request, I confirm the following:
[git rebase](http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html))