Raj Singh 2bf0759e58 controlclient: persist node key before sending RegisterRequest
The node key generated in doLogin was only written to persistent
storage after a successful HTTP response. If the process was killed
mid-request, the key was lost and a fresh one generated on restart,
causing each restart to look like a new node to the control server.

Add a PersistState callback on Direct.Options that writes the new
key directly to the state store before the HTTP POST. On restart
the existing key is reused, turning N restarts into N retries of
the same registration instead of N new registrations.

Fixes #19149

Signed-off-by: Raj Singh <raj@tailscale.com>
2026-03-28 10:33:49 -05:00
..