]> git.ipfire.org Git - thirdparty/wireguard-go.git/commit
conn: fix StdNetBind fallback on Windows
authorJordan Whited <jordan@tailscale.com>
Mon, 6 Mar 2023 23:58:32 +0000 (15:58 -0800)
committerJason A. Donenfeld <Jason@zx2c4.com>
Fri, 10 Mar 2023 13:52:24 +0000 (14:52 +0100)
commit2fcdaf979915be4702bf8aba4a90ac3c3ae0796b
tree5850a80bb1c6e49fdcd36f6d29e0b15f3a27eb0e
parentdbd949307e75bbd72d86e53aa57b74b20daab04d
conn: fix StdNetBind fallback on Windows

If RIO is unavailable, NewWinRingBind() falls back to StdNetBind.
StdNetBind uses x/net/ipv{4,6}.PacketConn for sending and receiving
datagrams, specifically via the {Read,Write}Batch methods.
These methods are unimplemented on Windows and will return runtime
errors as a result. Additionally, only Linux benefits from these
x/net types for reading and writing, so we update StdNetBind to fall
back to the standard library net package for all platforms other than
Linux.

Reviewed-by: James Tucker <james@tailscale.com>
Signed-off-by: Jordan Whited <jordan@tailscale.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
conn/bind_std.go
conn/bind_std_test.go [new file with mode: 0644]