Skip to content

Commit 3b32d6c

Browse files
committed
wgengine/magicsock, controlclient, net/dns: reduce some logspam
Updates #cleanup Change-Id: I78b0697a01e94baa33f3de474b591e616fa5e6af Signed-off-by: Brad Fitzpatrick <[email protected]>
1 parent 08302c0 commit 3b32d6c

File tree

4 files changed

+44
-5
lines changed

4 files changed

+44
-5
lines changed

control/controlclient/direct.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1501,7 +1501,7 @@ func (c *Direct) getNoiseClient() (*NoiseClient, error) {
15011501
if err != nil {
15021502
return nil, err
15031503
}
1504-
c.logf("creating new noise client")
1504+
c.logf("[v1] creating new noise client")
15051505
nc, err := NewNoiseClient(NoiseOpts{
15061506
PrivKey: k,
15071507
ServerPubKey: serverNoiseKey,

net/dns/manager.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,9 @@ func (m *Manager) Set(cfg Config) error {
9797
m.logf("Resolvercfg: %v", logger.ArgWriter(func(w *bufio.Writer) {
9898
rcfg.WriteToBufioWriter(w)
9999
}))
100-
m.logf("OScfg: %+v", ocfg)
100+
m.logf("OScfg: %v", logger.ArgWriter(func(w *bufio.Writer) {
101+
ocfg.WriteToBufioWriter(w)
102+
}))
101103

102104
if err := m.resolver.SetConfig(rcfg); err != nil {
103105
return err

net/dns/osconfig.go

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"errors"
99
"fmt"
1010
"net/netip"
11+
"strings"
1112

1213
"tailscale.com/types/logger"
1314
"tailscale.com/util/dnsname"
@@ -65,6 +66,42 @@ type OSConfig struct {
6566
MatchDomains []dnsname.FQDN
6667
}
6768

69+
func (o *OSConfig) WriteToBufioWriter(w *bufio.Writer) {
70+
if o == nil {
71+
w.WriteString("<nil>")
72+
return
73+
}
74+
w.WriteString("{")
75+
if len(o.Hosts) > 0 {
76+
fmt.Fprintf(w, "Hosts:%v ", o.Hosts)
77+
}
78+
if len(o.Nameservers) > 0 {
79+
fmt.Fprintf(w, "Nameservers:%v ", o.Nameservers)
80+
}
81+
if len(o.SearchDomains) > 0 {
82+
fmt.Fprintf(w, "SearchDomains:%v ", o.SearchDomains)
83+
}
84+
if len(o.MatchDomains) > 0 {
85+
w.WriteString("SearchDomains:[")
86+
sp := ""
87+
var numARPA int
88+
for _, s := range o.MatchDomains {
89+
if strings.HasSuffix(string(s), ".arpa.") {
90+
numARPA++
91+
continue
92+
}
93+
w.WriteString(sp)
94+
w.WriteString(string(s))
95+
sp = " "
96+
}
97+
w.WriteString("]")
98+
if numARPA > 0 {
99+
fmt.Fprintf(w, "+%darpa", numARPA)
100+
}
101+
}
102+
w.WriteString("}")
103+
}
104+
68105
func (o OSConfig) IsZero() bool {
69106
return len(o.Nameservers) == 0 && len(o.SearchDomains) == 0 && len(o.MatchDomains) == 0
70107
}

wgengine/magicsock/peermtu.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@ func (c *Conn) ShouldPMTUD() bool {
4848
return false // Until we feel confident PMTUD is solid.
4949
}
5050

51-
// PeerMTUEnabled returns true if this Conn is has peer path MTU discovery enabled.
51+
// PeerMTUEnabled reports whether peer path MTU discovery is enabled.
5252
func (c *Conn) PeerMTUEnabled() bool {
5353
return c.peerMTUEnabled.Load()
5454
}
5555

56-
// UpdatePMTUD configures underlying sockets of this Conn to enable or disable
56+
// UpdatePMTUD configures the underlying sockets of this Conn to enable or disable
5757
// peer path MTU discovery according to the current configuration.
5858
//
5959
// Enabling or disabling peer path MTU discovery requires setting the don't
@@ -84,7 +84,7 @@ func (c *Conn) UpdatePMTUD() {
8484

8585
enable := c.ShouldPMTUD()
8686
if c.peerMTUEnabled.Load() == enable {
87-
c.logf("magicsock: peermtu: peer MTU status is %v", enable)
87+
c.logf("[v1] magicsock: peermtu: peer MTU status is %v", enable)
8888
return
8989
}
9090

0 commit comments

Comments
 (0)