diff options
| -rw-r--r-- | talpid-core/src/firewall/macos.rs | 30 |
1 files changed, 8 insertions, 22 deletions
diff --git a/talpid-core/src/firewall/macos.rs b/talpid-core/src/firewall/macos.rs index 462a2b4fc7..111bc66bc8 100644 --- a/talpid-core/src/firewall/macos.rs +++ b/talpid-core/src/firewall/macos.rs @@ -113,18 +113,11 @@ impl Firewall { .quick(true) .interface(&tunnel.interface) .proto(pfctl::Proto::Tcp) + .keep_state(pfctl::StatePolicy::Keep) + .tcp_flags(Self::get_tcp_flags()) .to(pfctl::Endpoint::new(tunnel.ipv4_gateway, 53)) .build()?; rules.push(allow_tcp_dns_to_relay_rule); - let allow_tcp_dns_from_relay_rule = self - .create_rule_builder(FilterRuleAction::Pass) - .direction(pfctl::Direction::In) - .quick(true) - .interface(&tunnel.interface) - .proto(pfctl::Proto::Tcp) - .from(pfctl::Endpoint::new(tunnel.ipv4_gateway, 53)) - .build()?; - rules.push(allow_tcp_dns_from_relay_rule); let allow_udp_dns_to_relay_rule = self .create_rule_builder(FilterRuleAction::Pass) .direction(pfctl::Direction::Out) @@ -136,25 +129,18 @@ impl Firewall { rules.push(allow_udp_dns_to_relay_rule); if let Some(ipv6_gateway) = tunnel.ipv6_gateway { - let allow_tcp_dns6_to_relay_rule = self + let v6_dns_rule_tcp = self .create_rule_builder(FilterRuleAction::Pass) .direction(pfctl::Direction::Out) .quick(true) .interface(&tunnel.interface) .proto(pfctl::Proto::Tcp) + .keep_state(pfctl::StatePolicy::Keep) + .tcp_flags(Self::get_tcp_flags()) .to(pfctl::Endpoint::new(ipv6_gateway, 53)) .build()?; - rules.push(allow_tcp_dns6_to_relay_rule); - let allow_tcp_dns6_from_relay_rule = self - .create_rule_builder(FilterRuleAction::Pass) - .direction(pfctl::Direction::In) - .quick(true) - .interface(&tunnel.interface) - .proto(pfctl::Proto::Tcp) - .from(pfctl::Endpoint::new(ipv6_gateway, 53)) - .build()?; - rules.push(allow_tcp_dns6_from_relay_rule); - let allow_udp_dns6_to_relay_rule = self + rules.push(v6_dns_rule_tcp); + let v6_dns_rule_udp = self .create_rule_builder(FilterRuleAction::Pass) .direction(pfctl::Direction::Out) .quick(true) @@ -162,7 +148,7 @@ impl Firewall { .proto(pfctl::Proto::Udp) .to(pfctl::Endpoint::new(ipv6_gateway, 53)) .build()?; - rules.push(allow_udp_dns6_to_relay_rule); + rules.push(v6_dns_rule_udp); } rules.push(self.get_allow_relay_rule(peer_endpoint)?); |
