From 58403089e29c4fb97d1e1eca9f6f691dc4e948c3 Mon Sep 17 00:00:00 2001 From: Darius Maitia Date: Thu, 14 Mar 2024 14:34:25 +0100 Subject: [PATCH] Expand TCP / UDP binding interface to android. --- commons/zenoh-util/src/std_only/net/mod.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/commons/zenoh-util/src/std_only/net/mod.rs b/commons/zenoh-util/src/std_only/net/mod.rs index 8658e24bbc..24b76d6332 100644 --- a/commons/zenoh-util/src/std_only/net/mod.rs +++ b/commons/zenoh-util/src/std_only/net/mod.rs @@ -492,7 +492,7 @@ pub fn get_ipv6_ipaddrs(interface: Option<&str>) -> Vec { .collect() } -#[cfg(target_os = "linux")] +#[cfg(any(target_os = "linux", target_os = "android"))] fn set_bind_to_device(socket: std::os::raw::c_int, iface: Option<&str>) { if let Some(iface) = iface { // @TODO: switch to bind_device after tokio porting @@ -509,19 +509,19 @@ fn set_bind_to_device(socket: std::os::raw::c_int, iface: Option<&str>) { } } -#[cfg(target_os = "linux")] +#[cfg(any(target_os = "linux", target_os = "android"))] pub fn set_bind_to_device_tcp_listener(socket: &TcpListener, iface: Option<&str>) { use std::os::fd::AsRawFd; set_bind_to_device(socket.as_raw_fd(), iface); } -#[cfg(target_os = "linux")] +#[cfg(any(target_os = "linux", target_os = "android"))] pub fn set_bind_to_device_tcp_stream(socket: &TcpStream, iface: Option<&str>) { use std::os::fd::AsRawFd; set_bind_to_device(socket.as_raw_fd(), iface); } -#[cfg(target_os = "linux")] +#[cfg(any(target_os = "linux", target_os = "android"))] pub fn set_bind_to_device_udp_socket(socket: &UdpSocket, iface: Option<&str>) { use std::os::fd::AsRawFd; set_bind_to_device(socket.as_raw_fd(), iface);