Skip to content

wgengine/router: send on closed channel panic in Windows NativeTun.ForceMTU #9555

@bradfitz

Description

@bradfitz

This panic has been reported a few times:

panic: send on closed channel
--
10:06:36 |  
10:06:36 | goroutine 11180 [running]:
10:06:36 | github.com/tailscale/wireguard-go/tun.(*NativeTun).ForceMTU(...)
10:06:36 | github.com/tailscale/[email protected]/tun/tun_windows.go:133
10:06:36 | tailscale.com/wgengine/router.monitorDefaultRoutes.func1()
10:06:36 | [email protected]/wgengine/router/ifconfig_windows.go:78 +0x155
10:06:36 | tailscale.com/wgengine/router.monitorDefaultRoutes.func2(0xa47e0?, 0xc0000a47e0?)
10:06:36 | [email protected]/wgengine/router/ifconfig_windows.go:106 +0x19
10:06:36 | golang.zx2c4.com/wireguard/windows/tunnel/winipcfg.routeChanged.func1(0xc000114468)
10:06:36 | golang.zx2c4.com/wireguard/[email protected]/tunnel/winipcfg/route_change_handler.go:82 +0x24
10:06:36 | created by golang.zx2c4.com/wireguard/windows/tunnel/winipcfg.routeChanged in goroutine 50
10:06:36 | golang.zx2c4.com/wireguard/[email protected]/tunnel/winipcfg/route_change_handler.go:81 +0xdc
10:06:36 | subprocess exited: exit status 2

Where that ForceMTU does:

// TODO: This is a temporary hack. We really need to be monitoring the interface in real time and adapting to MTU changes.
func (tun *NativeTun) ForceMTU(mtu int) {
	update := tun.forcedMTU != mtu
	tun.forcedMTU = mtu
	if update {
		tun.events <- EventMTUUpdate
	}
}

If that's happening in shutdown, perhaps we can avoid that ForceMTU call when the TUN is closed.

Or fix in wireguard-go.

/cc @raggi

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions