Skip to content

UnixListener support completely broken with kernel 6.12.9+ #323

Open
@decathorpe

Description

@decathorpe

With Linux 6.12.9+, there is an explicit check whether "reuse port" is a valid option for a socket, and it's apparently not a valid option for Unix domain sockets: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/diff/net/core/sock.c?id=v6.12.9&id2=v6.12.8

However, the Socket::bind_internal function in this crate unconditionally sets reuse_port(true) on all created sockets. For Unix domain sockets, this is invalid, and now just always fails - bubbles up an IO error.

This is a minimal reproducer:

use tokio_uring::net::UnixListener;

fn main() {
    let sock_file = "/tmp/tokio-uring-unix-test.sock";
    UnixListener::bind(sock_file).unwrap();
}

It looks like sys_listener.set_reuse_port(true) should only be called in Socket::bind_internal if the socket type is NOT a Unix socket.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions