You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tailscale/wgengine/wgcfg
Josh Bleecher Snyder 69cdc30c6d wgengine/wgcfg: remove Config.ListenPort
We don't use the port that wireguard-go passes to us (via magicsock.connBind.Open).
We ignore it entirely and use the port we selected.

When we tell wireguard-go that we're changing the listen_port,
it calls connBind.Close and then connBind.Open.
And in the meantime, it stops calling the receive functions,
which means that we stop receiving and processing UDP and DERP packets.
And that is Very Bad.

That was never a problem prior to b3ceca1dd7,
because we passed the SkipBindUpdate flag to our wireguard-go fork,
which told wireguard-go not to re-bind on listen_port changes.
That commit eliminated the SkipBindUpdate flag.

We could write a bunch of code to work around the gap.
We could add background readers that process UDP and DERP packets when wireguard-go isn't.
But it's simpler to never create the conditions in which wireguard-go rebinds.

The other scenario in which wireguard-go re-binds is device.Down.
Conveniently, we never call device.Down. We go from device.Up to device.Close,
and the latter only when we're shutting down a magicsock.Conn completely.

Rubber-ducked-by: Avery Pennarun <apenwarr@tailscale.com>
Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
4 years ago
..
nmcfg wgengine/wgcfg: remove Config.ListenPort 4 years ago
config.go wgengine/wgcfg: remove Config.ListenPort 4 years ago
device.go all: move wgcfg from wireguard-go 4 years ago
device_test.go wgengine/...: split into multiple receive functions 4 years ago
key.go all: move wgcfg from wireguard-go 4 years ago
key_test.go all: move wgcfg from wireguard-go 4 years ago
parser.go wgengine/wgcfg: remove Config.ListenPort 4 years ago
parser_test.go wgengine/wgcfg: fix validateEndpoints of empty string 4 years ago
writer.go wgengine/wgcfg: remove Config.ListenPort 4 years ago