cmd/tailscale: if first notification, set hostname even if prefs is nil (#111)

Currently, if the notification (ipn.Notify) has a nil Prefs, the hostname defaults to localhost

Fixes #7875

Signed-off-by: kari-ts <kari@tailscale.com>
pull/112/head
kari-ts 11 months ago committed by GitHub
parent f44692addd
commit 04b79a2206
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -351,13 +351,14 @@ func (a *App) runBackend() error {
case n := <-notifications:
exitWasOnline := state.ExitStatus == ExitOnline
if p := n.Prefs; p != nil && n.Prefs.Valid() {
first := state.Prefs == nil
state.Prefs = p.AsStruct()
state.updateExitNodes()
if first {
state.Prefs.Hostname = a.hostname()
go b.backend.SetPrefs(state.Prefs)
}
a.setPrefs(state.Prefs)
}
first := state.Prefs == nil
if first {
state.Prefs = &ipn.Prefs{Hostname: a.hostname()}
go b.backend.SetPrefs(state.Prefs)
a.setPrefs(state.Prefs)
}
if s := n.State; s != nil {

Loading…
Cancel
Save