]> git.ipfire.org Git - thirdparty/wireguard-go.git/commit
tun: NetlinkListener: don't send EventDown before sending EventUp
authorAvery Pennarun <apenwarr@tailscale.com>
Wed, 6 Nov 2019 08:28:02 +0000 (00:28 -0800)
committerDavid Crawshaw <david@zentus.com>
Thu, 2 Apr 2020 03:40:52 +0000 (14:40 +1100)
commit98b3828351a135e6a1e9cf51501e704c8a5e1d6e
treea99c7fd49d95db30913c0925a94325d02ed572a3
parent369be60ceb6a0f6dbbb2fd618e990a6025ea6302
tun: NetlinkListener: don't send EventDown before sending EventUp

This works around a startup race condition when competing with
HackListener, which is trying to do the same job. If HackListener
detects that the tundev is running while there is still an event in the
netlink queue that says it isn't running, then the device receives a
string of events like
EventUp (HackListener)
EventDown (NetlinkListener)
EventUp (NetlinkListener)
Unfortunately, after the first EventDown, the device stops itself,
thinking incorrectly that the administrator has downed its tundev.

The device is ignoring the initial EventDown anyway, so just don't emit
it.

Signed-off-by: Avery Pennarun <apenwarr@tailscale.com>
tun/tun_linux.go