Skip to content

Use u_char for IP_MULTICAST_LOOP and IP_MULTICAST_TTL on OpenBSD, NetBSD, illumos and Solaris - #687

Open
kristof-mattei wants to merge 1 commit into
rust-lang:masterfrom
kristof-mattei:openbsd-ip-multicast-u8
Open

kristof-mattei wants to merge 1 commit into
rust-lang:masterfrom
kristof-mattei:openbsd-ip-multicast-u8

Conversation

@kristof-mattei

Copy link
Copy Markdown

getsockopt writes 1 byte on all four platforms. setsockopt requires a 1-byte value on OpenBSD and illumos. NetBSD's setsockopt also accepts a 4-byte value, but returns EINVAL for a TTL above 255, so a 1-byte value does not reduce the TTL range.

Also prevents set_multicast_ttl_v4(u32::MAX) from wrapping to -1 on Linux, which sets a TTL of 1 instead of returning an error.

…D, NetBSD, illumos and Solaris

`getsockopt` writes 1 byte on all four platforms. `setsockopt` requires a 1-byte
value on OpenBSD and illumos. NetBSD's `setsockopt` also accepts a 4-byte value,
but returns `EINVAL` for a TTL above 255, so a 1-byte value does not reduce the
TTL range.

Also prevents `set_multicast_ttl_v4(u32::MAX)` from wrapping to `-1` on Linux,
which sets a TTL of 1 instead of returning an error.
@kristof-mattei
kristof-mattei force-pushed the openbsd-ip-multicast-u8 branch from 27b8643 to d4d9be2 Compare November 8, 2026 02:06

This branch has not been deployed

No deployments
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.

1 participant