Skip to content

Commit 482729f

Browse files
committed
Don't use SO_REUSEPORT with UNIX sockets
It's invalid, useless, and will generate an error from 6.12.9 onwards: https://lore.kernel.org/all/[email protected]/ Fixes: #250 Suggested-by: Janne Grunau <[email protected]> Signed-off-by: Sergio Lopez <[email protected]>
1 parent 4367d85 commit 482729f

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

src/devices/src/virtio/net/gvproxy.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ impl Gvproxy {
5050
Err(e) => error!("couldn't obtain fd flags id={}, err={}", fd, e),
5151
};
5252

53-
setsockopt(fd, sockopt::ReusePort, &true).unwrap();
5453
#[cfg(target_os = "macos")]
5554
{
5655
// nix doesn't provide an abstraction for SO_NOSIGPIPE, fall back to libc.

src/devices/src/virtio/vsock/unix.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ use super::{
55

66
use nix::fcntl::{fcntl, FcntlArg, OFlag};
77
use nix::sys::socket::{
8-
accept, bind, connect, listen, recv, send, setsockopt, shutdown, socket, sockopt,
9-
AddressFamily, MsgFlags, Shutdown, SockFlag, SockType, UnixAddr,
8+
accept, bind, connect, listen, recv, send, shutdown, socket, AddressFamily, MsgFlags, Shutdown,
9+
SockFlag, SockType, UnixAddr,
1010
};
1111
use nix::unistd::close;
1212
use std::collections::HashMap;
@@ -68,7 +68,6 @@ fn proxy_fd_create(id: u64) -> Result<RawFd, ProxyError> {
6868
Err(e) => error!("couldn't obtain fd flags id={}, err={}", id, e),
6969
};
7070

71-
setsockopt(fd, sockopt::ReusePort, &true).map_err(ProxyError::SettingReusePort)?;
7271
#[cfg(target_os = "macos")]
7372
{
7473
// nix doesn't provide an abstraction for SO_NOSIGPIPE, fall back to libc.

0 commit comments

Comments
 (0)