summaryrefslogtreecommitdiff
path: root/src/sys
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-07-07 00:12:35 +0000
committerGitHub <noreply@github.com>2020-07-07 00:12:35 +0000
commit4b6b14a0c2fabb0cdedf415aa0eece2752adc47e (patch)
tree090e5e5caa8ce15f1433204c3f82732da5d5f75b /src/sys
parent2542f81237be13e920d570b4a5c122916ac21814 (diff)
parent0a97376ec2dc69c2efc49f7962db00004e59c2e1 (diff)
downloadnix-4b6b14a0c2fabb0cdedf415aa0eece2752adc47e.zip
Merge #1265
1265: Expose IP_PKTINFO Control Message on Android and iOS r=asomers a=bltavares The commit https://github.com/nix-rust/nix/pull/1222 added the very useful Ipv4PktInfo to allow `sendmsg` to define the origin of the ip. Unfortunattely, it didn't add the struct to Android target devices as well. This commit adds the `target_os = "android"` and `target_os =" ios"` checks on the same place to allow the compilation to work for the following archs tested: - `cross build --target aarch64-linux-android` - `cross build --target x86_64-linux-android` - `cross build --target armv7-linux-androideabi` - `cross build --target aarch64-apple-ios` - `cross build --target x86_64-apple-ios` Co-authored-by: Bruno Tavares <connect+github@bltavares.com>
Diffstat (limited to 'src/sys')
-rw-r--r--src/sys/socket/mod.rs32
1 files changed, 22 insertions, 10 deletions
diff --git a/src/sys/socket/mod.rs b/src/sys/socket/mod.rs
index aafa849c..0328319f 100644
--- a/src/sys/socket/mod.rs
+++ b/src/sys/socket/mod.rs
@@ -730,7 +730,9 @@ pub enum ControlMessage<'a> {
/// [`ip(7)`](http://man7.org/linux/man-pages/man7/ip.7.html) man page.
#[cfg(any(target_os = "linux",
target_os = "macos",
- target_os = "netbsd"))]
+ target_os = "netbsd",
+ target_os = "android",
+ target_os = "ios",))]
Ipv4PacketInfo(&'a libc::in_pktinfo),
/// Configure the sending addressing and interface for v6
@@ -740,7 +742,9 @@ pub enum ControlMessage<'a> {
#[cfg(any(target_os = "linux",
target_os = "macos",
target_os = "netbsd",
- target_os = "freebsd"))]
+ target_os = "freebsd",
+ target_os = "android",
+ target_os = "ios",))]
Ipv6PacketInfo(&'a libc::in6_pktinfo),
}
@@ -824,10 +828,12 @@ impl<'a> ControlMessage<'a> {
gso_size as *const _ as *const u8
},
#[cfg(any(target_os = "linux", target_os = "macos",
- target_os = "netbsd"))]
+ target_os = "netbsd", target_os = "android",
+ target_os = "ios",))]
ControlMessage::Ipv4PacketInfo(info) => info as *const _ as *const u8,
#[cfg(any(target_os = "linux", target_os = "macos",
- target_os = "netbsd", target_os = "freebsd"))]
+ target_os = "netbsd", target_os = "freebsd",
+ target_os = "android", target_os = "ios",))]
ControlMessage::Ipv6PacketInfo(info) => info as *const _ as *const u8,
};
unsafe {
@@ -870,10 +876,12 @@ impl<'a> ControlMessage<'a> {
mem::size_of_val(gso_size)
},
#[cfg(any(target_os = "linux", target_os = "macos",
- target_os = "netbsd"))]
+ target_os = "netbsd", target_os = "android",
+ target_os = "ios",))]
ControlMessage::Ipv4PacketInfo(info) => mem::size_of_val(info),
#[cfg(any(target_os = "linux", target_os = "macos",
- target_os = "netbsd", target_os = "freebsd"))]
+ target_os = "netbsd", target_os = "freebsd",
+ target_os = "android", target_os = "ios",))]
ControlMessage::Ipv6PacketInfo(info) => mem::size_of_val(info),
}
}
@@ -892,10 +900,12 @@ impl<'a> ControlMessage<'a> {
#[cfg(target_os = "linux")]
ControlMessage::UdpGsoSegments(_) => libc::SOL_UDP,
#[cfg(any(target_os = "linux", target_os = "macos",
- target_os = "netbsd"))]
+ target_os = "netbsd", target_os = "android",
+ target_os = "ios",))]
ControlMessage::Ipv4PacketInfo(_) => libc::IPPROTO_IP,
#[cfg(any(target_os = "linux", target_os = "macos",
- target_os = "netbsd", target_os = "freebsd"))]
+ target_os = "netbsd", target_os = "freebsd",
+ target_os = "android", target_os = "ios",))]
ControlMessage::Ipv6PacketInfo(_) => libc::IPPROTO_IPV6,
}
}
@@ -925,10 +935,12 @@ impl<'a> ControlMessage<'a> {
libc::UDP_SEGMENT
},
#[cfg(any(target_os = "linux", target_os = "macos",
- target_os = "netbsd"))]
+ target_os = "netbsd", target_os = "android",
+ target_os = "ios",))]
ControlMessage::Ipv4PacketInfo(_) => libc::IP_PKTINFO,
#[cfg(any(target_os = "linux", target_os = "macos",
- target_os = "netbsd", target_os = "freebsd"))]
+ target_os = "netbsd", target_os = "freebsd",
+ target_os = "android", target_os = "ios",))]
ControlMessage::Ipv6PacketInfo(_) => libc::IPV6_PKTINFO,
}
}