Skip to content

Commit

Permalink
Enable all Linux phy components for Android as well.
Browse files Browse the repository at this point in the history
Fixes #433.
  • Loading branch information
whitequark committed Mar 12, 2021
1 parent 8347da7 commit 29cc3a8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/phy/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ mod pcap_writer;
mod loopback;
#[cfg(all(feature = "phy-raw_socket", unix))]
mod raw_socket;
#[cfg(all(feature = "phy-tap_interface", target_os = "linux"))]
#[cfg(all(feature = "phy-tap_interface", any(target_os = "linux", target_os = "android")))]
mod tap_interface;

#[cfg(all(any(feature = "phy-raw_socket", feature = "phy-tap_interface"), unix))]
Expand All @@ -112,7 +112,7 @@ pub use self::pcap_writer::{PcapLinkType, PcapMode, PcapSink, PcapWriter};
pub use self::loopback::Loopback;
#[cfg(all(feature = "phy-raw_socket", unix))]
pub use self::raw_socket::RawSocket;
#[cfg(all(feature = "phy-tap_interface", target_os = "linux"))]
#[cfg(all(feature = "phy-tap_interface", any(target_os = "linux", target_os = "android")))]
pub use self::tap_interface::TapInterface;

#[cfg(feature = "ethernet")]
Expand Down
17 changes: 9 additions & 8 deletions src/phy/sys/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@ use std::{mem, ptr, io};
use std::os::unix::io::RawFd;
use crate::time::Duration;

#[cfg(target_os = "linux")]
#[cfg(any(target_os = "linux", target_os = "android"))]
#[path = "linux.rs"]
mod imp;

#[cfg(all(feature = "phy-raw_socket", target_os = "linux"))]
#[cfg(all(feature = "phy-raw_socket", any(target_os = "linux", target_os = "android")))]
pub mod raw_socket;
#[cfg(all(feature = "phy-raw_socket", not(target_os = "linux"), unix))]
#[cfg(all(feature = "phy-raw_socket", not(any(target_os = "linux", target_os = "android")), unix))]
pub mod bpf;
#[cfg(all(feature = "phy-tap_interface", target_os = "linux"))]
#[cfg(all(feature = "phy-tap_interface", any(target_os = "linux", target_os = "android")))]
pub mod tap_interface;

#[cfg(all(feature = "phy-raw_socket", target_os = "linux"))]
#[cfg(all(feature = "phy-raw_socket", any(target_os = "linux", target_os = "android")))]
pub use self::raw_socket::RawSocketDesc;
#[cfg(all(feature = "phy-raw_socket", not(target_os = "linux"), unix))]
#[cfg(all(feature = "phy-raw_socket", not(any(target_os = "linux", target_os = "android")), unix))]
pub use self::bpf::BpfDevice as RawSocketDesc;
#[cfg(all(feature = "phy-tap_interface", target_os = "linux"))]
#[cfg(all(feature = "phy-tap_interface", any(target_os = "linux", target_os = "android")))]
pub use self::tap_interface::TapInterfaceDesc;

/// Wait until given file descriptor becomes readable, but no longer than given timeout.
Expand Down Expand Up @@ -79,7 +79,8 @@ fn ifreq_for(name: &str) -> ifreq {
ifreq
}

#[cfg(all(target_os = "linux", any(feature = "phy-tap_interface", feature = "phy-raw_socket")))]
#[cfg(all(any(target_os = "linux", target_os = "android"),
any(feature = "phy-tap_interface", feature = "phy-raw_socket")))]
fn ifreq_ioctl(lower: libc::c_int, ifreq: &mut ifreq,
cmd: libc::c_ulong) -> io::Result<libc::c_int> {
unsafe {
Expand Down

0 comments on commit 29cc3a8

Please sign in to comment.