diff options
| author | Andrej Mihajlov <and@mullvad.net> | 2020-03-06 10:36:03 +0100 |
|---|---|---|
| committer | Andrej Mihajlov <and@mullvad.net> | 2020-03-06 10:36:37 +0100 |
| commit | 3c375dcfd8a37ad7d1b49510f90e4359f9478ff9 (patch) | |
| tree | ff91116ddd3f1b0f6ffe23acb1432e39d8b3cd34 | |
| parent | 46f7a0cfff15188d01d934880b3e012ffd6f6f6f (diff) | |
| download | mullvadvpn-3c375dcfd8a37ad7d1b49510f90e4359f9478ff9.tar.xz mullvadvpn-3c375dcfd8a37ad7d1b49510f90e4359f9478ff9.zip | |
Add contra rules instead of keep_state
| -rw-r--r-- | talpid-core/src/firewall/macos.rs | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/talpid-core/src/firewall/macos.rs b/talpid-core/src/firewall/macos.rs index 111bc66bc8..462a2b4fc7 100644 --- a/talpid-core/src/firewall/macos.rs +++ b/talpid-core/src/firewall/macos.rs @@ -113,11 +113,18 @@ 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) @@ -129,18 +136,25 @@ impl Firewall { rules.push(allow_udp_dns_to_relay_rule); if let Some(ipv6_gateway) = tunnel.ipv6_gateway { - let v6_dns_rule_tcp = self + let allow_tcp_dns6_to_relay_rule = 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(v6_dns_rule_tcp); - let v6_dns_rule_udp = self + 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 .create_rule_builder(FilterRuleAction::Pass) .direction(pfctl::Direction::Out) .quick(true) @@ -148,7 +162,7 @@ impl Firewall { .proto(pfctl::Proto::Udp) .to(pfctl::Endpoint::new(ipv6_gateway, 53)) .build()?; - rules.push(v6_dns_rule_udp); + rules.push(allow_udp_dns6_to_relay_rule); } rules.push(self.get_allow_relay_rule(peer_endpoint)?); |
