Skip to content

Commit

Permalink
PI issues (meh#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
ssrlive authored Mar 30, 2024
1 parent 736d769 commit 980f041
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 26 deletions.
2 changes: 1 addition & 1 deletion src/platform/android/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ impl Device {
let tun = Fd::new(fd).map_err(|_| std::io::Error::last_os_error())?;

Device {
tun: Tun::new(tun, mtu, config.platform_config.packet_information),
tun: Tun::new(tun, mtu, false),
}
};

Expand Down
13 changes: 1 addition & 12 deletions src/platform/android/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,8 @@ use crate::configuration::Configuration;
use crate::error::Result;

/// Android-only interface configuration.
/// on Android there no packet information exists, so Default is in derive list
#[derive(Copy, Clone, Default, Debug)]
pub struct PlatformConfig {
pub(crate) packet_information: bool,
}

impl PlatformConfig {
pub fn packet_information(&mut self, value: bool) -> &mut Self {
assert!(!value);
self.packet_information = value;
self
}
}
pub struct PlatformConfig;

/// Create a TUN device with the given name.
pub fn create(configuration: &Configuration) -> Result<Device> {
Expand Down
2 changes: 1 addition & 1 deletion src/platform/freebsd/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ impl Device {

Device {
tun_name,
tun: Tun::new(tun, mtu, config.platform_config.packet_information),
tun: Tun::new(tun, mtu, false),
ctl,
route: None,
}
Expand Down
13 changes: 1 addition & 12 deletions src/platform/freebsd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,8 @@ use crate::configuration::Configuration;
use crate::error::Result;

/// FreeBSD-only interface configuration.
/// packet information not exists in FreeBSD, so the `Default` is in `derive` list.
#[derive(Copy, Clone, Default, Debug)]
pub struct PlatformConfig {
pub(crate) packet_information: bool,
}

impl PlatformConfig {
pub fn packet_information(&mut self, value: bool) -> &mut Self {
assert!(!value);
self.packet_information = value;
self
}
}
pub struct PlatformConfig;

/// Create a TUN device with the given name.
pub fn create(configuration: &Configuration) -> Result<Device> {
Expand Down

0 comments on commit 980f041

Please sign in to comment.