Skip to content

[wasi-sockets] Inconsistency in udp/send with unspecified remote address #12568

Closed

Description

@saulecabrera

Consider

async fn test_unspecified_remote_addr(family: IpAddressFamily) {
    let sock = UdpSocket::create(family).unwrap();
    let unspec = IpSocketAddress::unspecified(family, PORT);
    let result = sock.send(vec![0; 1], Some(unspec)).await;
   
    assert!(matches!(result, Err(ErrorCode::InvalidArgument)));
}

The test above fails.

According to the spec:

invalid-argument: The IP address in remote-address is set to INADDR_ANY (0.0.0.0 / ::).

The current implementation returns remote-unreachable instead. The behavior is consistent on macOS, Windows and Linux.

Activity

  1. added
    bug
    wasi
    on Feb 11, 2026
  2. alexcrichton commented on Feb 12, 2026

    @alexcrichton
    Member
  3. alexcrichton commented on Jun 9, 2026

    @alexcrichton
    Member

    @badeend if you don't mind me pinging you again on this, I was wondering if you had thoughts on this issue/test? On Linux at least this is returning Ok(()) instead of an error. On macOS I get ErrorCode::RemoteUnreachable as Saul mentions.

  4. badeend commented on Jun 13, 2026

    @badeend
    Member

    Hmm, never got a notification for that first ping. Anyhow..


    Yes, good catch @saulecabrera. I think this got lost somewhere during the p2->p3 conversion. The P2 implementation does have this check:

    if !is_valid_remote_address(addr) || !is_valid_address_family(addr.ip(), stream.family)
    {
    return Err(ErrorCode::InvalidArgument.into());
    }

    I've opened a PR to do the same thing in P3: #13631

  5. moved this from Backlog to Done in Ship WASIp3on Jun 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugwasi

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions