From 819a46bc3cc9ff977532a0395038d5f6db1d64b4 Mon Sep 17 00:00:00 2001 From: Joakim Hulthe Date: Fri, 13 Dec 2024 21:12:02 +0100 Subject: [PATCH] fixup --- talpid-core/src/firewall/macos.rs | 37 +++++++++++-------------------- 1 file changed, 13 insertions(+), 24 deletions(-) diff --git a/talpid-core/src/firewall/macos.rs b/talpid-core/src/firewall/macos.rs index ae7f153b6353..4bd405a4f2b9 100644 --- a/talpid-core/src/firewall/macos.rs +++ b/talpid-core/src/firewall/macos.rs @@ -323,30 +323,19 @@ impl Firewall { } // no nat to [vpn ip] - //let no_nat_to_vpn_server = pfctl::NatRuleBuilder::default() - // .action(pfctl::NatRuleAction::NoNat) - // .to(peer_endpoint.endpoint.address) - // .user(Uid::from(0)) - // .build()?; - //rules.push(no_nat_to_vpn_server); - - //for ip in &tunnel.ips { - // rules.push( - // pfctl::NatRuleBuilder::default() - // .action(pfctl::NatRuleAction::Nat { - // nat_to: pfctl::NatEndpoint::from(pfctl::Ip::from(*ip)), - // }) - // .to(peer_endpoint.endpoint.address.ip()) - // .build()?, - // ); - //} - - //// no nat on [tun interface] - //let no_nat_on_tun = pfctl::NatRuleBuilder::default() - // .action(pfctl::NatRuleAction::NoNat) - // .interface(&tunnel.interface) - // .build()?; - //rules.push(no_nat_on_tun); + let no_nat_to_vpn_server = pfctl::NatRuleBuilder::default() + .action(pfctl::NatRuleAction::NoNat) + .to(peer_endpoint.endpoint.address) + .user(Uid::from(0)) + .build()?; + rules.push(no_nat_to_vpn_server); + + // no nat on [tun interface] + let no_nat_on_tun = pfctl::NatRuleBuilder::default() + .action(pfctl::NatRuleAction::NoNat) + .interface(&tunnel.interface) + .build()?; + rules.push(no_nat_on_tun); // Masquerade other traffic via VPN utun for ip in &tunnel.ips {