ipn/ipnlocal: Update hostinfo to control on service config change (#16146)

This commit fixes the bug that c2n requests are skiped when updating vipServices in serveConfig. This then resulted
netmap update being skipped which caused inaccuracy of Capmap info on client side. After this fix, client always
inform control about it's vipServices config changes.

Fixes tailscale/corp#29219

Signed-off-by: KevinLiang10 <37811973+KevinLiang10@users.noreply.github.com>
This commit is contained in:
KevinLiang10
2025-06-06 15:20:23 -04:00
committed by GitHub
parent 66ae8737f4
commit 7b06532ea1
2 changed files with 76 additions and 8 deletions
+10 -5
View File
@@ -6194,17 +6194,17 @@ func (b *LocalBackend) setTCPPortsInterceptedFromNetmapAndPrefsLocked(prefs ipn.
}
}
// Update funnel info in hostinfo and kick off control update if needed.
b.updateIngressLocked()
// Update funnel and service hash info in hostinfo and kick off control update if needed.
b.updateIngressAndServiceHashLocked(prefs)
b.setTCPPortsIntercepted(handlePorts)
b.setVIPServicesTCPPortsInterceptedLocked(vipServicesPorts)
}
// updateIngressLocked updates the hostinfo.WireIngress and hostinfo.IngressEnabled fields and kicks off a Hostinfo
// update if the values have changed.
// updateIngressAndServiceHashLocked updates the hostinfo.ServicesHash, hostinfo.WireIngress and
// hostinfo.IngressEnabled fields and kicks off a Hostinfo update if the values have changed.
//
// b.mu must be held.
func (b *LocalBackend) updateIngressLocked() {
func (b *LocalBackend) updateIngressAndServiceHashLocked(prefs ipn.PrefsView) {
if b.hostinfo == nil {
return
}
@@ -6219,6 +6219,11 @@ func (b *LocalBackend) updateIngressLocked() {
b.hostinfo.WireIngress = wire
hostInfoChanged = true
}
latestHash := b.vipServiceHash(b.vipServicesFromPrefsLocked(prefs))
if b.hostinfo.ServicesHash != latestHash {
b.hostinfo.ServicesHash = latestHash
hostInfoChanged = true
}
// Kick off a Hostinfo update to control if ingress status has changed.
if hostInfoChanged {
b.goTracker.Go(b.doSetHostinfoFilterServices)