Skip to content

Add support for SO_ERROR#728

Open
CvvT wants to merge 6 commits intomainfrom
weiteng/so_error
Open

Add support for SO_ERROR#728
CvvT wants to merge 6 commits intomainfrom
weiteng/so_error

Conversation

@CvvT
Copy link
Contributor

@CvvT CvvT commented Mar 14, 2026

This PR adds support for SO_ERROR option (not complete) and improves TCP connection error reporting.

smoltcp does not report errors when IP lookup fails; it silently discards packets. Thus, we can only return ETIMEDOUT instead of ENETUNREACHED.

Previously timeout in TCP is treated as `ECONNREFUSED'. We can distinguish it by checking the elapsed time.

@github-actions
Copy link

🤖 SemverChecks 🤖 ⚠️ Potential breaking API changes detected ⚠️

Click for details
--- failure copy_impl_added: type now implements Copy ---

Description:
A public type now implements Copy, causing non-move closures to capture it by reference instead of moving it.
        ref: https://github.com/rust-lang/rust/issues/100905
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.47.0/src/lints/copy_impl_added.ron

Failed in:
  litebox::net::local_ports::LocalPortAllocationError in /home/runner/work/litebox/litebox/litebox/src/net/local_ports.rs:134
  litebox::net::errors::ConnectError in /home/runner/work/litebox/litebox/litebox/src/net/errors.rs:39

--- failure enum_variant_added: enum variant added on exhaustive enum ---

Description:
A publicly-visible enum without #[non_exhaustive] has a new variant.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#enum-variant-new
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.47.0/src/lints/enum_variant_added.ron

Failed in:
  variant SocketOption:ERROR in /home/runner/work/litebox/litebox/litebox_common_linux/src/lib.rs:701

@CvvT
Copy link
Contributor Author

CvvT commented Mar 14, 2026

On my local env, I can run curl but it failed on CI (see https://github.com/microsoft/litebox/actions/runs/23078368851/job/67042868399). Will fix it in a separate PR.

@CvvT CvvT marked this pull request as ready for review March 14, 2026 03:06
@CvvT CvvT requested a review from wdcui March 14, 2026 03:06
Copy link
Member

@wdcui wdcui left a comment

Choose a reason for hiding this comment

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

Thank you for the fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants