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>
2021-04-03 10:32:51 -07:00
..
nmcfg wgengine/wgcfg: remove Config.ListenPort 2021-04-03 10:32:51 -07:00
config.go wgengine/wgcfg: remove Config.ListenPort 2021-04-03 10:32:51 -07:00
device.go all: move wgcfg from wireguard-go 2021-01-29 12:52:56 -08:00
device_test.go wgengine/...: split into multiple receive functions 2021-04-02 12:18:54 -07:00
key.go all: move wgcfg from wireguard-go 2021-01-29 12:52:56 -08:00
key_test.go all: move wgcfg from wireguard-go 2021-01-29 12:52:56 -08:00
parser.go wgengine/wgcfg: remove Config.ListenPort 2021-04-03 10:32:51 -07:00
parser_test.go wgengine/wgcfg: fix validateEndpoints of empty string 2021-01-30 11:17:55 -08:00
writer.go wgengine/wgcfg: remove Config.ListenPort 2021-04-03 10:32:51 -07:00