rust-lang / rust-lang/rust

`UdpSocket` lacks methods to operate on wildcard sockets

Open
#128,704 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

T-libs
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

UdpSocket allows binding to wildcard IPs like IpAddr::V6(Ipv6Addr::UNSPECIFIED) which means it can accept packets targeted to multiple IPs. However the send method does not allow specifying the source IP which means any reply packets may be send from the wrong interface. The recv method also doesn't allow getting the target IP which would need to be passed to send.

This is a bit of a trap which isn't warned against in the documentation either.

Similar issue for tokio which mirrors the APIs: https://github.com/tokio-rs/tokio/issues/6737

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

Start by reading the UdpSocket send and recv APIs and the wildcard-IP behavior described in this issue. Compare the related Tokio issue to understand the API gap; done means wildcard sockets can identify the target IP and select the source IP for replies, with documentation warning about the current trap.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
networking
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.