rust-lang / rust-lang/socket2

Support `sockatmark()`-like functionality

Open
#450 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Rust
Stars
870
Forks
305
PR merge metrics
No merged PRs in 30d

Description

socket2 cannot currently handle the TCP urgent flag correctly according to specifications. Per https://www.rfc-editor.org/rfc/rfc1122#page-84 and https://www.rfc-editor.org/rfc/rfc6093#page-5, the intended standard method of handling the urgent flag in TCP is to notify the process out-of-band that there is an urgent mark, at which point the process moves into an "urgent mode" until reaching the urgent mark in-band. socket2 is currently missing the ability for the process to detect when it has reached the urgent mark.

While https://github.com/rust-lang/socket2/issues/296 suggests that polling is out-of-scope for socket2, this shouldn't be necessary for implementing this functionality. Using the POSIX socket API, a process can set SO_OOBINLINE as a socket option (to which set_out_of_band_inline() is equivalent) and use sockatmark() to detect when the urgent mark is reached, independent of polling mechanism.

The SIOCATMARK ioctl is the basis of sockatmark() and could be consumed by socket2 to provide this functionality. https://github.com/rust-lang/libc/pull/3275 intends to expose this for Unix-like systems and it is exposed in the WinSock Rust crate. A synchronous function is_at_urgent_mark(&self) -> bool or similar would address this gap.

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 with socket2's existing set_out_of_band_inline() option and review how platform-specific socket operations are exposed. Compare POSIX sockatmark(), the SIOCATMARK ioctl, and the referenced WinSock support; done means a synchronous API can report whether the socket has reached the urgent mark on supported systems.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
networking
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.