From 885148d575cac3dd8473369271657fd425c3e300 Mon Sep 17 00:00:00 2001 From: Eliza Weisman Date: Wed, 26 Feb 2025 13:01:01 -0800 Subject: [PATCH] solarish: define `IP_BOUND_IF` and `IPV6_BOUND_IF` # Description These socket options are currently defined only on macOS and friends, but they exist on illumos and Solaris as well. This commit defines these socket options on solarish operating systems. # Sources On Solaris, see the man page [`ip(7P)`]. I'd like to provide a link to the illumos manual pages, but apparently https://illumos.org/man seems to be impacted by today's AWS outage. The constants are defined in `/usr/include/netinet/in.h`: ```console eliza@atrium ~ $ uname -a SunOS atrium 5.11 helios-2.0.22827 i86pc i386 i86pc eliza@atrium ~ $ rg 'IP(V6)?_BOUND_IF' /usr/include /usr/include/netinet/in.h 978:#define IP_BOUND_IF 0x41 /* bind socket to an ifindex */ 1311:#define IPV6_BOUND_IF 0x41 /* bind to an ifindex */ ``` [`ip(7P)`]: https://docs.oracle.com/cd/E86824_01/html/E54777/ip-7p.html # Checklist - [x] Relevant tests in `libc-test/semver` have been updated - [x] No placeholder or unstable values like `*LAST` or `*MAX` are included (see [#3131](https://github.com/rust-lang/libc/issues/3131)) - [x] Tested locally (`cd libc-test && cargo test --target mytarget`); especially relevant for platforms that may not be checked in CI --- libc-test/semver/solarish.txt | 2 ++ src/unix/solarish/mod.rs | 2 ++ 2 files changed, 4 insertions(+) diff --git a/libc-test/semver/solarish.txt b/libc-test/semver/solarish.txt index 809347c5c4e36..f2c0f4a11e3f6 100644 --- a/libc-test/semver/solarish.txt +++ b/libc-test/semver/solarish.txt @@ -1,10 +1,12 @@ AIO_ALLDONE AIO_CANCELED AIO_NOTCANCELED +IPV6_BOUND_IF IPV6_DONTFRAG IPV6_PKTINFO IPV6_RECVTCLASS IPV6_TCLASS +IP_BOUND_IF IP_DONTFRAG IP_PKTINFO IP_TOS diff --git a/src/unix/solarish/mod.rs b/src/unix/solarish/mod.rs index 7463545a9d865..3a50675592cb3 100644 --- a/src/unix/solarish/mod.rs +++ b/src/unix/solarish/mod.rs @@ -1148,6 +1148,7 @@ pub const IPV6_DONTFRAG: c_int = 0x21; pub const IPV6_SEC_OPT: c_int = 0x22; pub const IPV6_TCLASS: c_int = 0x26; pub const IPV6_V6ONLY: c_int = 0x27; +pub const IPV6_BOUND_IF: c_int = 0x41; cfg_if! { if #[cfg(target_pointer_width = "64")] { @@ -1691,6 +1692,7 @@ pub const IP_ADD_SOURCE_MEMBERSHIP: c_int = 23; pub const IP_DROP_SOURCE_MEMBERSHIP: c_int = 24; pub const IP_BLOCK_SOURCE: c_int = 21; pub const IP_UNBLOCK_SOURCE: c_int = 22; +pub const IP_BOUND_IF: c_int = 0x41; // These TCP socket options are common between illumos and Solaris, while higher // numbers have generally diverged: