Fix/ttl dscp portable sockopt constants - #16
Open
kristapssk wants to merge 2 commits into
Open
Conversation
kristapssk
marked this pull request as ready for review
August 11, 2026 15:49
kristapssk
force-pushed
the
fix/ttl-dscp-portable-sockopt-constants
branch
from
August 11, 2026 15:53
da4ddab to
131a843
Compare
Hardcoded Linux values (2, 33) caused ENOPROTOOPT on macOS/BSD where they are 4 and 10; libc constants resolve correctly per-platform. Signed-off-by: Kristaps Skujiņš <kristaps.skujins@gmail.com>
Hardcoded IP_TOS=1 (Linux) returned ENOPROTOOPT on macOS/BSD where it is 3; libc::IP_TOS resolves correctly per-platform. Signed-off-by: Kristaps Skujiņš <kristaps.skujins@gmail.com>
kristapssk
force-pushed
the
fix/ttl-dscp-portable-sockopt-constants
branch
from
August 11, 2026 15:56
131a843 to
fcecd95
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Two IP-level socket options in
crates/hdds/src/transport/used hardcodedLinux numeric constants that are different on macOS/BSD, causing runtime
failure with
IoError(Os { code: 42, kind: Uncategorized, message: "Protocol not available" })(ENOPROTOOPT) whenever a Participant tried to configure IP TTL, multicast TTL,
or DSCP on Apple platforms.
Fix: replace the hardcoded numbers with the corresponding
libc::*constantsso the correct per-platform value is resolved at compile time.
IP_MULTICAST_TTLlibc::IP_MULTICAST_TTLIP_TTLlibc::IP_TTLIP_TOSlibc::IP_TOSIPPROTO_IPlibc::IPPROTO_IPLinux behavior is byte-for-byte unchanged (the
libc::*values resolve tothe same numeric constants). Windows paths already went through
socket2and are untouched.
Files:
crates/hdds/src/transport/ttl.rscrates/hdds/src/transport/dscp.rsRelated Issue
N/A — no upstream issue was open. Discovered while building a downstream
TransportMode::UdpMulticastpublisher on macOS 15 (Apple Silicon).Type of Change
Checklist
cargo fmt --all -- --checkpasses)// SAFETY:blocks preserved verbatim)cargo clippyon touched files is clean)Signed-off-by:trailer on every commit)Testing
Linux (containerized
rust:latest, aarch64):