WebAssembly / WebAssembly/WASI

UDP: Local address should be regularly available

Open
#733 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

P-sockets S-inactive
Dominant language
Rust
Stars
5.8k
Forks
333
Avg merge
2d 13h
Merged PRs (30d)
3

Description

Many UDP based protocols (eg. CoAP and QUIC) require the application to have control over the local address -- running a server at :: (or 0.0.0.0) means that a datagram comes in, and the server needs to take extra steps to reply with the same address (otherwise it violates the protocol, and the peer won't process the response).

While this is supported in POSIX sockets, it means that rather than doing the simple thing, implementers need to set the IPV6_RECVPKTINFO option, do recvmsg instead of recvfrom and pick the address out of there (which only in IPv6 is well specified).

WASI has the opportunity to make this straightforward, please use it. An example API that provides both addresses is the Rust embedded-nal abstraction for UDP (and the PR introducing it contains ample references and discussion on why this is necessary and good, which I'm happy to reiterate here in case this request is contentious).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review the WASI UDP/socket API alongside the linked Rust embedded-nal async UnconnectedUdp abstraction. Compare the current address information available through recvfrom with the local and peer addresses required for wildcard-bound UDP servers. Done should be a settled API design that supports replying from the received local address.

Written by the indexing model from the issue text.

Assessment

Domain
api, networking
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.