Skip to content

Commit cc8a192

Browse files
committed
fixup! Upgrade Tailscale to fix conn hangs
1 parent 1a7c108 commit cc8a192

File tree

4 files changed

+15
-11
lines changed

4 files changed

+15
-11
lines changed

coderd/healthcheck/derp.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ func (r *DERPReport) Run(ctx context.Context, opts *DERPReportOptions) {
112112
r.mu.Unlock()
113113
}
114114
nc := &netcheck.Client{
115-
PortMapper: portmapper.NewClient(tslogger.WithPrefix(ncLogf, "portmap: "), nil, nil),
115+
PortMapper: portmapper.NewClient(tslogger.WithPrefix(ncLogf, "portmap: "), nil, nil, nil),
116116
Logf: tslogger.WithPrefix(ncLogf, "netcheck: "),
117117
}
118118
r.Netcheck, r.NetcheckErr = nc.GetReport(ctx, opts.DERPMap)

go.mod

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ replace github.com/dlclark/regexp2 => github.com/dlclark/regexp2 v1.7.0
3636

3737
// There are a few minor changes we make to Tailscale that we're slowly upstreaming. Compare here:
3838
// https://github.com/tailscale/tailscale/compare/main...coder:tailscale:main
39-
replace tailscale.com => github.com/coder/tailscale v1.1.1-0.20230509173035-f4cdcfb4826e
39+
// replace tailscale.com => github.com/coder/tailscale v1.1.1-0.20230509173035-f4cdcfb4826e
40+
replace tailscale.com => /home/coder/tailscale
4041

4142
// Switch to our fork that imports fixes from http://github.com/tailscale/ssh.
4243
// See: https://github.com/coder/coder/issues/3371
@@ -171,7 +172,7 @@ require (
171172
gvisor.dev/gvisor v0.0.0-20230328175328-162ed5ef888d
172173
nhooyr.io/websocket v1.8.7
173174
storj.io/drpc v0.0.33-0.20230420154621-9716137f6037
174-
tailscale.com v1.38.4
175+
tailscale.com v1.40.0
175176
)
176177

177178
require (

go.sum

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,8 +364,6 @@ github.com/coder/retry v1.3.1-0.20230210155434-e90a2e1e091d h1:09JG37IgTB6n3ouX9
364364
github.com/coder/retry v1.3.1-0.20230210155434-e90a2e1e091d/go.mod h1:r+1J5i/989wt6CUeNSuvFKKA9hHuKKPMxdzDbTuvwwk=
365365
github.com/coder/ssh v0.0.0-20230421140225-04bb837133e1 h1:LBw76rEDuhNJyohve11mbvYv5CmCLmcuUQGiz7Guk50=
366366
github.com/coder/ssh v0.0.0-20230421140225-04bb837133e1/go.mod h1:ZSS+CUoKHDrqVakTfTWUlKSr9MtMFkC4UvtQKD7O914=
367-
github.com/coder/tailscale v1.1.1-0.20230509173035-f4cdcfb4826e h1:ifnmZW4slkQpk6s2QBbpvkXgcHRwhdAz2pui36TETno=
368-
github.com/coder/tailscale v1.1.1-0.20230509173035-f4cdcfb4826e/go.mod h1:j5vekUD4eLhLpHl/tNBps25strCOBXyiKUsdR1HhMq8=
369367
github.com/coder/terraform-provider-coder v0.6.23 h1:O2Rcj0umez4DfVdGnKZi63z1Xzxd0IQOn9VQDB8YU8g=
370368
github.com/coder/terraform-provider-coder v0.6.23/go.mod h1:UIfU3bYNeSzJJvHyJ30tEKjD6Z9utloI+HUM/7n94CY=
371369
github.com/coder/wgtunnel v0.1.5 h1:WP3sCj/3iJ34eKvpMQEp1oJHvm24RYh0NHbj1kfUKfs=

tailnet/conn.go

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
"tailscale.com/ipn/ipnstate"
2222
"tailscale.com/net/connstats"
2323
"tailscale.com/net/dns"
24+
"tailscale.com/net/netmon"
2425
"tailscale.com/net/netns"
2526
"tailscale.com/net/tsdial"
2627
"tailscale.com/net/tstun"
@@ -33,7 +34,6 @@ import (
3334
"tailscale.com/wgengine"
3435
"tailscale.com/wgengine/filter"
3536
"tailscale.com/wgengine/magicsock"
36-
"tailscale.com/wgengine/monitor"
3737
"tailscale.com/wgengine/netstack"
3838
"tailscale.com/wgengine/router"
3939
"tailscale.com/wgengine/wgcfg/nmcfg"
@@ -127,7 +127,7 @@ func NewConn(options *Options) (conn *Conn, err error) {
127127
AllowedIPs: options.Addresses,
128128
}
129129

130-
wireguardMonitor, err := monitor.New(Logger(options.Logger.Named("wgmonitor")))
130+
wireguardMonitor, err := netmon.New(Logger(options.Logger.Named("wgmonitor")))
131131
if err != nil {
132132
return nil, xerrors.Errorf("create wireguard link monitor: %w", err)
133133
}
@@ -141,9 +141,9 @@ func NewConn(options *Options) (conn *Conn, err error) {
141141
Logf: Logger(options.Logger.Named("tsdial")),
142142
}
143143
wireguardEngine, err := wgengine.NewUserspaceEngine(Logger(options.Logger.Named("wgengine")), wgengine.Config{
144-
LinkMonitor: wireguardMonitor,
145-
Dialer: dialer,
146-
ListenPort: options.ListenPort,
144+
NetMon: wireguardMonitor,
145+
Dialer: dialer,
146+
ListenPort: options.ListenPort,
147147
})
148148
if err != nil {
149149
return nil, xerrors.Errorf("create wgengine: %w", err)
@@ -312,7 +312,7 @@ type Conn struct {
312312
netMap *netmap.NetworkMap
313313
netStack *netstack.Impl
314314
magicConn *magicsock.Conn
315-
wireguardMonitor *monitor.Mon
315+
wireguardMonitor *netmon.Monitor
316316
wireguardRouter *router.Config
317317
wireguardEngine wgengine.Engine
318318
listeners map[listenKey]*listener
@@ -389,6 +389,11 @@ func (c *Conn) RemoveAllPeers() error {
389389
func (c *Conn) UpdateNodes(nodes []*Node, replacePeers bool) error {
390390
c.mutex.Lock()
391391
defer c.mutex.Unlock()
392+
393+
if c.isClosed() {
394+
return xerrors.New("connection closed")
395+
}
396+
392397
status := c.Status()
393398
if replacePeers {
394399
c.netMap.Peers = []*tailcfg.Node{}

0 commit comments

Comments
 (0)