1
0
mirror of https://git.zx2c4.com/wireguard-go synced 2024-11-15 09:15:14 +01:00

conn: do not SO_REUSEADDR on linux

SO_REUSEADDR does not make sense for unicast UDP sockets.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jason A. Donenfeld 2020-12-18 16:41:49 +01:00
parent ad73ee78e9
commit 890cc06ed5

View File

@ -326,15 +326,6 @@ func create4(port uint16) (int, uint16, error) {
// set sockopts and bind // set sockopts and bind
if err := func() error { if err := func() error {
if err := unix.SetsockoptInt(
fd,
unix.SOL_SOCKET,
unix.SO_REUSEADDR,
1,
); err != nil {
return err
}
if err := unix.SetsockoptInt( if err := unix.SetsockoptInt(
fd, fd,
unix.IPPROTO_IP, unix.IPPROTO_IP,
@ -379,16 +370,6 @@ func create6(port uint16) (int, uint16, error) {
} }
if err := func() error { if err := func() error {
if err := unix.SetsockoptInt(
fd,
unix.SOL_SOCKET,
unix.SO_REUSEADDR,
1,
); err != nil {
return err
}
if err := unix.SetsockoptInt( if err := unix.SetsockoptInt(
fd, fd,
unix.IPPROTO_IPV6, unix.IPPROTO_IPV6,