ipn/ipnlocal, types: plumb tailnet display name cap through to network profile (#17045)

Updates tailscale/corp#30456

Signed-off-by: Nick O'Neill <nick@tailscale.com>
This commit is contained in:
Nick O'Neill
2025-09-09 09:03:01 -07:00
committed by GitHub
parent f1ded84454
commit 77250a301a
4 changed files with 26 additions and 0 deletions
+8
View File
@@ -1650,12 +1650,18 @@ func (b *LocalBackend) SetControlClientStatus(c controlclient.Client, st control
prefsChanged = true
}
// If the tailnet's display name has changed, update prefs.
if st.NetMap != nil && st.NetMap.TailnetDisplayName() != b.pm.CurrentProfile().NetworkProfile().DisplayName {
prefsChanged = true
}
// Perform all mutations of prefs based on the netmap here.
if prefsChanged {
// Prefs will be written out if stale; this is not safe unless locked or cloned.
if err := b.pm.SetPrefs(prefs.View(), ipn.NetworkProfile{
MagicDNSName: curNetMap.MagicDNSSuffix(),
DomainName: curNetMap.DomainName(),
DisplayName: curNetMap.TailnetDisplayName(),
}); err != nil {
b.logf("Failed to save new controlclient state: %v", err)
}
@@ -1716,6 +1722,7 @@ func (b *LocalBackend) SetControlClientStatus(c controlclient.Client, st control
if err := b.pm.SetPrefs(p, ipn.NetworkProfile{
MagicDNSName: st.NetMap.MagicDNSSuffix(),
DomainName: st.NetMap.DomainName(),
DisplayName: st.NetMap.TailnetDisplayName(),
}); err != nil {
b.logf("Failed to save new controlclient state: %v", err)
}
@@ -6185,6 +6192,7 @@ func (b *LocalBackend) resolveExitNode() (changed bool) {
if err := b.pm.SetPrefs(prefs.View(), ipn.NetworkProfile{
MagicDNSName: nm.MagicDNSSuffix(),
DomainName: nm.DomainName(),
DisplayName: nm.TailnetDisplayName(),
}); err != nil {
b.logf("failed to save exit node changes: %v", err)
}
+1
View File
@@ -168,6 +168,7 @@ func (nb *nodeBackend) NetworkProfile() ipn.NetworkProfile {
// These are ok to call with nil netMap.
MagicDNSName: nb.netMap.MagicDNSSuffix(),
DomainName: nb.netMap.DomainName(),
DisplayName: nb.netMap.TailnetDisplayName(),
}
}
+1
View File
@@ -988,6 +988,7 @@ type WindowsUserID string
type NetworkProfile struct {
MagicDNSName string
DomainName string
DisplayName string
}
// RequiresBackfill returns whether this object does not have all the data