quinn-rs / quinn

Async-friendly QUIC implementation in Rust
Apache License 2.0
3.76k stars 380 forks source link

Protocol not available (os error 42) #1624

Closed jieliangma closed 1 year ago

jieliangma commented 1 year ago

version: 0.10.2 device: iPhone SE2, iOS 13.6.1 quinn::Endpoint::client("0.0.0.0:0".parse()?)? got an error: Protocol not available (os error 42)

djc commented 1 year ago

That's pretty strange. Can you dig into the code inside Endpoint::client() and see which call is failing? Is it the UdpSocket::bind(), something in quinn_udp::unix::init() (called by wrap_with_socket())? We have had people use the library on iOS before so it should work but maybe the version you have is too old. Have you tried earlier versions?

djc commented 1 year ago

Hmm, we specifically called out older macOS compatibility in https://github.com/quinn-rs/quinn/pull/1547, so that might be relevant here -- the feature we used there was added in Big Sur (v11, released in 2020) whereas iOS 13 is from 2019.

Happy to review a PR to enable compatibility here.

jieliangma commented 1 year ago

in file quinn-udp/src/unix.rs

    #[cfg(any(target_os = "freebsd", target_os = "macos", target_os = "ios"))]
    {
        if is_ipv4 {
            set_socket_option(&*io, libc::IPPROTO_IP, libc::IP_DONTFRAG, OPTION_ON)?; //  this line failing
        }
    }

quinn version 0.8 works fine, version 0.10 failed

djc commented 1 year ago

Yup, that's it. So we'll probably want to ignore this particular error value here, at least for macOS?