Skip to content

Commit 7cbd05c

Browse files
committed
Add target_os=android/fuchisa for (set_)ip_transparent
1 parent f5fc36d commit 7cbd05c

File tree

2 files changed

+26
-5
lines changed

2 files changed

+26
-5
lines changed

src/sys/unix.rs

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3103,8 +3103,17 @@ impl crate::Socket {
31033103
/// For more information about this option, see [`set_ip_transparent`].
31043104
///
31053105
/// [`set_ip_transparent`]: Socket::set_ip_transparent
3106-
#[cfg(all(feature = "all", target_os = "linux"))]
3107-
#[cfg_attr(docsrs, doc(cfg(all(feature = "all", target_os = "linux"))))]
3106+
#[cfg(all(
3107+
feature = "all",
3108+
any(target_os = "android", target_os = "linux", target_os = "fuchsia")
3109+
))]
3110+
#[cfg_attr(
3111+
docsrs,
3112+
doc(cfg(all(
3113+
feature = "all",
3114+
any(target_os = "android", target_os = "linux", target_os = "fuchsia")
3115+
)))
3116+
)]
31083117
pub fn ip_transparent(&self) -> io::Result<bool> {
31093118
unsafe {
31103119
getsockopt::<c_int>(self.as_raw(), libc::IPPROTO_IP, libc::IP_TRANSPARENT)
@@ -3127,8 +3136,17 @@ impl crate::Socket {
31273136
///
31283137
/// TProxy redirection with the iptables TPROXY target also
31293138
/// requires that this option be set on the redirected socket.
3130-
#[cfg(all(feature = "all", target_os = "linux"))]
3131-
#[cfg_attr(docsrs, doc(cfg(all(feature = "all", target_os = "linux"))))]
3139+
#[cfg(all(
3140+
feature = "all",
3141+
any(target_os = "android", target_os = "linux", target_os = "fuchsia")
3142+
))]
3143+
#[cfg_attr(
3144+
docsrs,
3145+
doc(cfg(all(
3146+
feature = "all",
3147+
any(target_os = "android", target_os = "linux", target_os = "fuchsia")
3148+
)))
3149+
)]
31323150
pub fn set_ip_transparent(&self, transparent: bool) -> io::Result<()> {
31333151
unsafe {
31343152
setsockopt(

tests/socket.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1363,7 +1363,10 @@ test!(
13631363
mss,
13641364
set_mss(256)
13651365
);
1366-
#[cfg(all(feature = "all", target_os = "linux"))]
1366+
#[cfg(all(
1367+
feature = "all",
1368+
any(target_os = "android", target_os = "linux", target_os = "fuchsia")
1369+
))]
13671370
test!(
13681371
#[ignore = "setting `IP_TRANSPARENT` requires the `CAP_NET_ADMIN` capability (works when running as root)"]
13691372
ip_transparent,

0 commit comments

Comments
 (0)