mirror of
https://github.com/tailscale/tailscale.git
synced 2025-12-14 03:31:22 +00:00
control/controlclient: print disco keys NetworkMap diffs (debug change only)
NetworkMap text diffs being empty were currently used to short-circuit calling magicsock's SetNetworkMap (via Engine.SetNetworkMap), but that went away inc7582dc2(0.100.0-230) Prior toc7582dc2(notably, in 0.100.0-225 and below, down to 0.100.0), a change in only disco key (as when a node restarts) but without endpoint changes (as would happen for a client not behind a NAT with random ports) could result in a "netmap diff: (none)" being printed, as well as Engine.SetNetworkMap being skipped, leading to broken discovery endpoints.c7582dc2fixed the Engine.SetNetworkMap skippage. This change fixes the "netmap diff: (none)" print so we'll actually see when a peer restarts with identical endpoints but a new discovery key.
This commit is contained in:
@@ -132,12 +132,18 @@ func printPeerConcise(buf *strings.Builder, p *tailcfg.Node) {
|
||||
if strings.HasPrefix(derp, derpPrefix) {
|
||||
derp = "D" + derp[len(derpPrefix):]
|
||||
}
|
||||
var discoShort string
|
||||
if !p.DiscoKey.IsZero() {
|
||||
discoShort = p.DiscoKey.ShortString() + " "
|
||||
}
|
||||
|
||||
// Most of the time, aip is just one element, so format the
|
||||
// table to look good in that case. This will also make multi-
|
||||
// subnet nodes stand out visually.
|
||||
fmt.Fprintf(buf, " %v %-2v %-15v : %v\n",
|
||||
p.Key.ShortString(), derp,
|
||||
fmt.Fprintf(buf, " %v %s%-2v %-15v : %v\n",
|
||||
p.Key.ShortString(),
|
||||
discoShort,
|
||||
derp,
|
||||
strings.Join(aip, " "),
|
||||
strings.Join(ep, " "))
|
||||
}
|
||||
@@ -146,6 +152,7 @@ func printPeerConcise(buf *strings.Builder, p *tailcfg.Node) {
|
||||
func nodeConciseEqual(a, b *tailcfg.Node) bool {
|
||||
return a.Key == b.Key &&
|
||||
a.DERP == b.DERP &&
|
||||
a.DiscoKey == b.DiscoKey &&
|
||||
eqCIDRsIgnoreNil(a.AllowedIPs, b.AllowedIPs) &&
|
||||
eqStringsIgnoreNil(a.Endpoints, b.Endpoints)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user