wgengine/magicsock: remove some log spam

Fixes tailscale/corp#3070

Change-Id: Ie50031800ec8669e0596ad6d59d1e329a5c88516
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick 2021-11-18 10:51:34 -08:00 committed by Brad Fitzpatrick
parent 61d0435ed9
commit 8ec44d0d5f

View File

@ -2319,29 +2319,31 @@ func (c *Conn) SetNetworkMap(nm *netmap.NetworkMap) {
} }
ep.wgEndpoint = n.Key.UntypedHexString() ep.wgEndpoint = n.Key.UntypedHexString()
ep.initFakeUDPAddr() ep.initFakeUDPAddr()
c.logf("magicsock: created endpoint key=%s: disco=%s; %v", n.Key.ShortString(), n.DiscoKey.ShortString(), logger.ArgWriter(func(w *bufio.Writer) { if debugDisco { // rather than making a new knob
const derpPrefix = "127.3.3.40:" c.logf("magicsock: created endpoint key=%s: disco=%s; %v", n.Key.ShortString(), n.DiscoKey.ShortString(), logger.ArgWriter(func(w *bufio.Writer) {
if strings.HasPrefix(n.DERP, derpPrefix) { const derpPrefix = "127.3.3.40:"
ipp, _ := netaddr.ParseIPPort(n.DERP) if strings.HasPrefix(n.DERP, derpPrefix) {
regionID := int(ipp.Port()) ipp, _ := netaddr.ParseIPPort(n.DERP)
code := c.derpRegionCodeLocked(regionID) regionID := int(ipp.Port())
if code != "" { code := c.derpRegionCodeLocked(regionID)
code = "(" + code + ")" if code != "" {
code = "(" + code + ")"
}
fmt.Fprintf(w, "derp=%v%s ", regionID, code)
} }
fmt.Fprintf(w, "derp=%v%s ", regionID, code)
}
for _, a := range n.AllowedIPs { for _, a := range n.AllowedIPs {
if a.IsSingleIP() { if a.IsSingleIP() {
fmt.Fprintf(w, "aip=%v ", a.IP()) fmt.Fprintf(w, "aip=%v ", a.IP())
} else { } else {
fmt.Fprintf(w, "aip=%v ", a) fmt.Fprintf(w, "aip=%v ", a)
}
} }
} for _, ep := range n.Endpoints {
for _, ep := range n.Endpoints { fmt.Fprintf(w, "ep=%v ", ep)
fmt.Fprintf(w, "ep=%v ", ep) }
} }))
})) }
ep.updateFromNode(n) ep.updateFromNode(n)
c.peerMap.upsertEndpoint(ep, key.DiscoPublic{}) c.peerMap.upsertEndpoint(ep, key.DiscoPublic{})
} }