tailscale/wgengine
James Tucker 672c2c8de8 wgengine/magicsock: add filter to ignore disco to old/other ports
Incoming disco packets are now dropped unless they match one of the
current bound ports, or have a zero port*.

The BPF filter passes all packets with a disco header to the raw packet
sockets regardless of destination port (in order to avoid needing to
reconfigure BPF on rebind).

If a BPF enabled node has just rebound, due to restart or rebind, it may
receive and reply to disco ping packets destined for ports other than
those which are presently bound. If the pong is accepted, the pinging
node will now assume that it can send WireGuard traffic to the pinged
port - such traffic will not reach the node as it is not destined for a
bound port.

*The zero port is ignored, if received. This is a speculative defense
and would indicate a problem in the receive path, or the BPF filter.
This condition is allowed to pass as it may enable traffic to flow,
however it will also enable problems with the same symptoms this patch
otherwise fixes.

Fixes #5536

Signed-off-by: James Tucker <james@tailscale.com>
2022-09-06 12:25:04 -07:00
..
bench all: convert more code to use net/netip directly 2022-07-25 21:53:49 -07:00
filter all: migrate more code code to net/netip directly 2022-08-02 13:59:57 -07:00
magicsock wgengine/magicsock: add filter to ignore disco to old/other ports 2022-09-06 12:25:04 -07:00
monitor go.mod: bump wireguard/windows, which moves to using net/netip 2022-08-31 08:36:56 -07:00
netstack all: use syncs.AtomicValue 2022-08-04 11:52:16 -07:00
router go.mod: bump wireguard/windows, which moves to using net/netip 2022-08-31 08:36:56 -07:00
wgcfg wgengine/wgcfg: only write peer headers if necessary (#5449) 2022-08-29 20:47:52 -04:00
wgint go.mod, wgengine/wgint: bump wireguard-go 2022-09-06 11:34:30 -07:00
wglog all: use syncs.AtomicValue 2022-08-04 11:52:16 -07:00
winnet all: gofmt all 2022-04-29 13:06:04 -07:00
mem_ios.go go.mod: upgrade wireguard-windows, de-fork wireguard-go 2021-05-25 13:18:21 -07:00
pendopen.go wgengine: remove all peer status from open timeout diagnostics 2022-08-29 15:54:33 -07:00
userspace.go wgengine: fix race on endpoints in getStatus 2022-09-01 10:58:04 -07:00
userspace_ext_test.go go.mod: upgrade wireguard-windows, de-fork wireguard-go 2021-05-25 13:18:21 -07:00
userspace_test.go all: convert more code to use net/netip directly 2022-07-25 21:53:49 -07:00
watchdog.go wgengine: print in-flight operations on watchdog trigger (#5447) 2022-08-27 22:06:18 -04:00
watchdog_js.go wasm: drop pprof dependency 2022-06-07 12:16:16 -07:00
watchdog_test.go wgengine: remove all peer status from open timeout diagnostics 2022-08-29 15:54:33 -07:00
wgengine.go all: convert more code to use net/netip directly 2022-07-25 21:53:49 -07:00