Stream: git-wasmtime

Topic: wasmtime / issue #12475 p3: Inconsistent behavior in sock...


view this post on Zulip Wasmtime GitHub notifications bot (Jan 29 2026 at 22:19):

saulecabrera opened issue #12475:

Test Case

With the latest Wasmtime dev version, the following test:

async fn test_wrong_address_family(family: IpAddressFamily) {
    let sock = UdpSocket::create(family).unwrap();

    let addr = match family {
        IpAddressFamily::Ipv4 => IpSocketAddress::localhost(IpAddressFamily::Ipv6, 0),
        IpAddressFamily::Ipv6 => IpSocketAddress::localhost(IpAddressFamily::Ipv4, 0),
    };

    let result = sock.send(vec![0; 1], Some(addr)).await;
    assert!(matches!(result, Err(ErrorCode::InvalidArgument)));
}

Passes on macOS, but fails on Ubuntu/Windows.

According to the spec: invalid-argument should be returned if the remote-address has the wrong address family. (EAFNOSUPPORT)

view this post on Zulip Wasmtime GitHub notifications bot (Jan 29 2026 at 22:19):

saulecabrera added the bug label to Issue #12475.

view this post on Zulip Wasmtime GitHub notifications bot (Jan 29 2026 at 22:19):

saulecabrera added the wasi label to Issue #12475.

view this post on Zulip Wasmtime GitHub notifications bot (Jan 29 2026 at 22:20):

saulecabrera edited issue #12475:

With the latest Wasmtime dev version, the following test:

async fn test_wrong_address_family(family: IpAddressFamily) {
    let sock = UdpSocket::create(family).unwrap();

    let addr = match family {
        IpAddressFamily::Ipv4 => IpSocketAddress::localhost(IpAddressFamily::Ipv6, 0),
        IpAddressFamily::Ipv6 => IpSocketAddress::localhost(IpAddressFamily::Ipv4, 0),
    };

    let result = sock.send(vec![0; 1], Some(addr)).await;
    assert!(matches!(result, Err(ErrorCode::InvalidArgument)));
}

Passes on macOS, but fails on Ubuntu/Windows.

According to the spec: invalid-argument should be returned if the remote-address has the wrong address family. (EAFNOSUPPORT)

view this post on Zulip Wasmtime GitHub notifications bot (Jan 29 2026 at 22:38):

saulecabrera commented on issue #12475:

For completeness, this is the error on Ubuntu:

[src/bin/sockets-udp-send.rs:21:5] &result = Err(
    ErrorCode {
        code: 2,
        name: "not-supported",
        message: "The operation is not supported.\n\n          POSIX equivalent: EOPNOTSUPP",
    },
)

view this post on Zulip Wasmtime GitHub notifications bot (Jan 30 2026 at 19:24):

alexcrichton commented on issue #12475:

Should this perhaps be a case where the spec is changed to allow more error codes for this situation? I never quite know how to best thread the needle but translating a native EAFNOSUPPORT to not-supported here doesn't seem entirely unreasonable to me

view this post on Zulip Wasmtime GitHub notifications bot (Jan 30 2026 at 19:38):

bjorn3 commented on issue #12475:

I believe on macOS an ipv6 socket can actually connect to ipv4 addresses (and by default listening on an ipv6 socket will also listen on ipv4) The IPV6_V6ONLY option disables this behavior.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 04 2026 at 16:05):

rvolosatovs commented on issue #12475:

I believe on macOS an ipv6 socket can actually connect to ipv4 addresses (and by default listening on an ipv6 socket will also listen on ipv4) The IPV6_V6ONLY option disables this behavior.

IPV6_V6ONLY behavior is actually the spec requirement: https://github.com/WebAssembly/WASI/blob/a1fc383d01eabaf3fac01de03c0ab1a01bfdd099/proposals/sockets/wit-0.3.0-draft/types.wit#L178-L180

   /// Similar to `socket(AF_INET or AF_INET6, SOCK_STREAM, IPPROTO_TCP)`
   /// in POSIX. On IPv6 sockets, IPV6_V6ONLY is enabled by default and
   /// can't be configured otherwise.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 04 2026 at 16:11):

bjorn3 commented on issue #12475:

That was added a month after my comment in https://github.com/WebAssembly/WASI/pull/884.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 09 2026 at 19:08):

alexcrichton closed issue #12475:

With the latest Wasmtime dev version, the following test:

async fn test_wrong_address_family(family: IpAddressFamily) {
    let sock = UdpSocket::create(family).unwrap();

    let addr = match family {
        IpAddressFamily::Ipv4 => IpSocketAddress::localhost(IpAddressFamily::Ipv6, 0),
        IpAddressFamily::Ipv6 => IpSocketAddress::localhost(IpAddressFamily::Ipv4, 0),
    };

    let result = sock.send(vec![0; 1], Some(addr)).await;
    assert!(matches!(result, Err(ErrorCode::InvalidArgument)));
}

Passes on macOS, but fails on Ubuntu/Windows.

According to the spec: invalid-argument should be returned if the remote-address has the wrong address family. (EAFNOSUPPORT)

view this post on Zulip Wasmtime GitHub notifications bot (Jun 13 2026 at 08:35):

badeend commented on issue #12475:

That was added a month after my comment WebAssembly/WASI#884.

FWIW, the IPV6_V6ONLY requirement was already part of the spec before that. That PR only reformats the documentation.


The reason why the OP's issue surfaces now is for the same reason as https://github.com/bytecodealliance/wasmtime/issues/12568; the validation was missing in the P3 implementation. And the validation was hiding the fact that we didn't set IPV6_V6ONLY correctly.


Last updated: Jul 29 2026 at 05:03 UTC