hscontrol: rewrite hostname logic to match Tailscale SaaS#3202
Merged
Conversation
kradalby
commented
Apr 17, 2026
kradalby
commented
Apr 17, 2026
kradalby
commented
Apr 17, 2026
d3fabed to
85c45be
Compare
759bda6 to
86edc5d
Compare
NodeStore's writer goroutine now resolves GivenName collisions inside applyBatch: on PutNode/UpdateNode the landing label gets -N appended until unique, matching Tailscale SaaS. Empty labels fall back to the literal "node". SetGivenName exposes the admin-rename path: validates via dnsname.ValidLabel and rejects on collision with ErrGivenNameTaken, so renames do not silently rewrite behind the caller. Updates juanfont#3188 Updates juanfont#2926 Updates juanfont#2343 Updates juanfont#2762
Ingest (registration and MapRequest updates) now calls dnsname.SanitizeHostname directly and lets NodeStore auto-bump on collision. Admin rename uses dnsname.ValidLabel + SetGivenName so conflicts are surfaced to the caller instead of silently mutated. Three duplicate invalidDNSRegex definitions, the old NormaliseHostname and ValidateHostname helpers, EnsureHostname, InvalidString, ApplyHostnameFromHostInfo, GivenNameHasBeenChanged, generateGivenName and EnsureUniqueGivenName are removed along with their tests. ValidateHostname's username half is retained as ValidateUsername for users.go. The SaaS-matching collision rule replaces the random "invalid-xxxxxx" fallback and the 8-character hash suffix; the empty-input fallback is the literal "node". TestUpdateHostnameFromClient now exercises the rewrite end-to-end with awkward macOS/Windows names. Fixes juanfont#3188 Fixes juanfont#2926 Fixes juanfont#2343 Fixes juanfont#2762 Fixes juanfont#2449 Updates juanfont#2177 Updates juanfont#2121 Updates juanfont#363
Summarise the ingest rewrite, the SaaS-matching collision rule, and the BREAKING change from random-suffix to numeric-suffix collision labels and from "invalid-<rand>" to the literal "node" fallback. Updates juanfont#3188
86edc5d to
62330ae
Compare
juanfont
approved these changes
Apr 18, 2026
|
are you guys going to cut a release soon on that? |
Collaborator
Author
|
Not for this particular, it will go into 0.29. I hope that we can start doing betas in less than a month. |
kradalby
added a commit
to kradalby/headscale
that referenced
this pull request
May 20, 2026
Move HA subnet router health probing into the feature description block above BREAKING so the layout matches the rest of the file. Drop the ad-hoc **User deletion**: / **Node Expiry**: topic prefixes — the #### subgroup heading already labels each bullet's topic. Fill missing PR refs on the hostname rewrite (juanfont#3202), sshTests + SSH rule validation (juanfont#3263), HA probe (juanfont#3194), randomize_client_port removal (juanfont#3251), and trusted_proxies (juanfont#3268). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
kradalby
added a commit
to kradalby/headscale
that referenced
this pull request
May 20, 2026
Move HA subnet router health probing above BREAKING so the layout matches every other release. Drop **User deletion**: / **Node Expiry**: bold prefixes redundant with the #### subgrouping. Fill missing PR refs: juanfont#3202 (hostname rewrite), juanfont#3263 (sshTests + SSH rule validation), juanfont#3194 (HA probe), juanfont#3251 (randomize_client_port removal), juanfont#3268 (trusted_proxies).
kradalby
added a commit
that referenced
this pull request
May 20, 2026
Move HA subnet router health probing above BREAKING so the layout matches every other release. Drop **User deletion**: / **Node Expiry**: bold prefixes redundant with the #### subgrouping. Fill missing PR refs: #3202 (hostname rewrite), #3263 (sshTests + SSH rule validation), #3194 (HA probe), #3251 (randomize_client_port removal), #3268 (trusted_proxies).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two disagreeing ingest paths, three duplicate regexes, and a
random-suffix collision fallback that drifted from Tailscale SaaS.
Apostrophes, spaces, dots,
@, and non-ASCII were alternatelyrejected or stored as
invalid-<rand>. Same class of bug has shippedsix times since 2022.
Replace custom sanitiser with
tailscale.com/util/dnsname.SanitizeHostnameand
ValidLabel. Collision bumping moves insideNodeStore.PutNode/UpdateNode— serialised through the single writer goroutine, soconcurrent registrations cannot duplicate. Admin rename uses the new
SetGivenName, which rejects collisions withErrGivenNameTakenrather than silently rewriting.
Empty-input fallback is now the literal
node. MagicDNS names changeon upgrade for nodes previously stored with a random suffix; raw
Hostnameis unchanged.If
dnsnamedrifts from SaaS later, the client has drifted too — fixis a tailscale version bump, not new code here.
Fixes #3188
Fixes #2926
Fixes #2343
Fixes #2762
Fixes #2449
Fixes #2177
Fixes #2121
Fixes #363
Updates #2803
Closes #2976
Closes #3189
Closes #3195