juanfont / headscale

An open source, self-hosted implementation of the Tailscale control server
BSD 3-Clause "New" or "Revised" License
22.47k stars 1.24k forks source link

[Bug] Hostname changes are not reflected #2140

Open Proxymiity opened 1 week ago

Proxymiity commented 1 week ago

Is this a support request?

Is there an existing issue for this?

Current Behavior

Changing the hostname of a node is not reflected on headscale.

Using tailscale set --hostname hello still keeps the hostname that the node originally came with.

Expected Behavior

Changing the hostname of a node on the node itself should reflect it on the node list in headscale. This is the current behavior with 0.22.3.

Steps To Reproduce

  1. Start 0.23.0 (either upgraded from 0.22.3 or a fresh install)
  2. Register a new node on the server
  3. Note its hostname
  4. Change the hostname. On desktop, tailscale set --hostname something. On mobile, it is located in the settings of the app.
  5. Note that the hostname stayed the same

Environment

- OS: Docker 27.0.3 (Host: Debian 12.6)
- Headscale version: 0.23.0
- Tailscale version: 1.74.1 (ccd6bf2f4ee6421c23789b64e6e63c2ccbe87e08)
- Tailscale version (phone): iOS 18.0 // TS 1.74.0 (TestFlight beta 101.74.0)

Runtime environment

Anything else?

No response

msarsha commented 6 days ago

Having the same issue. restarting both node and server does not help. @kradalby want to point me to where this should be implemented? I could have a look and check if do-able for me.

kradalby commented 5 days ago

@msarsha It would probably be in this function: https://github.com/juanfont/headscale/blob/main/hscontrol/poll.go#L454

You probably want to look at the logic in Rename node to ensure there is no collision, I have not had too much time to think about this yet, but will look closer if you post a PR.

If you dont have time, let me know and I'll look at it later.