Skip to content

Commit 797bc4b

Browse files
committed
rename disable_routing to enable_routing
1 parent 049fa5a commit 797bc4b

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "tun"
3-
version = "0.7.12"
3+
version = "0.7.13"
44
edition = "2021"
55
authors = ["meh. <[email protected]>", "@ssrlive"]
66
license = "WTFPL"

src/platform/macos/device.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ impl Device {
172172
config
173173
.netmask
174174
.unwrap_or(IpAddr::V4(Ipv4Addr::new(255, 255, 255, 0))),
175-
config.platform_config.disable_routing,
175+
config.platform_config.enable_routing,
176176
)?;
177177

178178
Ok(device)
@@ -198,7 +198,7 @@ impl Device {
198198
addr: IpAddr,
199199
broadaddr: IpAddr,
200200
mask: IpAddr,
201-
disable_routing: bool,
201+
enable_routing: bool,
202202
) -> Result<()> {
203203
let IpAddr::V4(addr) = addr else {
204204
unimplemented!("do not support IPv6 yet")
@@ -226,7 +226,7 @@ impl Device {
226226
if let Err(err) = siocaifaddr(ctl.as_raw_fd(), &req) {
227227
return Err(std::io::Error::from(err).into());
228228
}
229-
if !disable_routing {
229+
if enable_routing {
230230
let route = Route {
231231
addr,
232232
netmask: mask,

src/platform/macos/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ use crate::error::Result;
2626
#[derive(Copy, Clone, Debug)]
2727
pub struct PlatformConfig {
2828
pub(crate) packet_information: bool,
29-
pub(crate) disable_routing: bool,
29+
pub(crate) enable_routing: bool,
3030
}
3131

3232
impl Default for PlatformConfig {
3333
fn default() -> Self {
3434
PlatformConfig {
3535
packet_information: true, // default is true in macOS
36-
disable_routing: false,
36+
enable_routing: true,
3737
}
3838
}
3939
}
@@ -59,9 +59,9 @@ impl PlatformConfig {
5959
self
6060
}
6161

62-
/// Do not setup route for utun interface automatically
63-
pub fn disable_routing(&mut self, value: bool) -> &mut Self {
64-
self.disable_routing = value;
62+
/// Do set or not setup route for utun interface automatically
63+
pub fn enable_routing(&mut self, value: bool) -> &mut Self {
64+
self.enable_routing = value;
6565
self
6666
}
6767
}

0 commit comments

Comments
 (0)