Skip to content

Conversation

@po-nuvai
Copy link
Contributor

Previously SO_REUSEADDR was silently ignored (printing a FIXME message but returning success). This adds proper storage of the SO_REUSEADDR value through a member variable, making setsockopt/getsockopt work correctly.

The actual bind() behavior change to allow address reuse is not yet implemented, but this makes the option work correctly for applications that set and query the option.

Changes

  • Add m_reuse_address member variable to Socket class
  • Implement proper setsockopt handler for SO_REUSEADDR (validates size, stores value)
  • Update getsockopt to return the actual stored value instead of always 0

@github-actions github-actions bot added the 👀 pr-needs-review PR needs review from a maintainer or community member label Dec 29, 2025
@timschumi
Copy link
Member

Sockets effectively can't have reuseaddr enabled at the moment (in a meaningful way), I'd argue that if an application cares enough to read back the state then that should rightfully fail.

SO_REUSEADDR was silently ignored (printing a FIXME message but returning
success). Since the actual bind() behavior to allow address reuse is not
implemented, applications that set this option would be misled into
thinking it works.

Return ENOPROTOOPT instead to properly indicate the option is not
supported, matching the behavior of other unimplemented socket options.
@po-nuvai po-nuvai force-pushed the socket-reuseaddr-fix branch from b4a1e1c to 85a2ea9 Compare December 29, 2025 13:01
@BuggieBot
Copy link
Member

Hello!

One or more of the commit messages in this PR do not match the SerenityOS code submission policy, please check the lint_commits CI job for more details on which commits were flagged and why.
Please do not close this PR and open another, instead modify your commit message(s) with git commit --amend and force push those changes to update this PR.

@nico nico added ⏳ pr-waiting-for-author PR is blocked by feedback / code changes from the author and removed 👀 pr-needs-review PR needs review from a maintainer or community member labels Dec 29, 2025
Copy link
Member

@timschumi timschumi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now it's just at the state from before we added the options, which breaks all the applications that the accommodations were added for in the first place.

@stale
Copy link

stale bot commented Jan 19, 2026

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions!

@stale stale bot added the stale label Jan 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

⏳ pr-waiting-for-author PR is blocked by feedback / code changes from the author stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants