mirror of
https://github.com/tailscale/tailscale.git
synced 2025-07-29 15:23:45 +00:00
ipnlocal: log when client reports new peerAPI ports (#15463)
Updates tailscale/tailscale#14393 Signed-off-by: kari-ts <kari@tailscale.com>
This commit is contained in:
parent
1da78d8718
commit
5c562116fc
@ -4844,9 +4844,34 @@ func (b *LocalBackend) doSetHostinfoFilterServices() {
|
||||
c := len(hi.Services)
|
||||
hi.Services = append(hi.Services[:c:c], peerAPIServices...)
|
||||
hi.PushDeviceToken = b.pushDeviceToken.Load()
|
||||
|
||||
// Compare the expected ports from peerAPIServices to the actual ports in hi.Services.
|
||||
expectedPorts := extractPeerAPIPorts(peerAPIServices)
|
||||
actualPorts := extractPeerAPIPorts(hi.Services)
|
||||
if expectedPorts != actualPorts {
|
||||
b.logf("Hostinfo peerAPI ports changed: expected %v, got %v", expectedPorts, actualPorts)
|
||||
}
|
||||
|
||||
cc.SetHostinfo(&hi)
|
||||
}
|
||||
|
||||
type portPair struct {
|
||||
v4, v6 uint16
|
||||
}
|
||||
|
||||
func extractPeerAPIPorts(services []tailcfg.Service) portPair {
|
||||
var p portPair
|
||||
for _, s := range services {
|
||||
switch s.Proto {
|
||||
case "peerapi4":
|
||||
p.v4 = s.Port
|
||||
case "peerapi6":
|
||||
p.v6 = s.Port
|
||||
}
|
||||
}
|
||||
return p
|
||||
}
|
||||
|
||||
// NetMap returns the latest cached network map received from
|
||||
// controlclient, or nil if no network map was received yet.
|
||||
func (b *LocalBackend) NetMap() *netmap.NetworkMap {
|
||||
|
Loading…
x
Reference in New Issue
Block a user