Skip to content

Commit

Permalink
Merge branch 'macos-flush-states-for-transitions'
Browse files Browse the repository at this point in the history
  • Loading branch information
dlon committed Apr 19, 2024
2 parents 774b760 + 511a6e5 commit d54dcc6
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ Line wrap the file at 100 chars. Th
#### macOS
- DNS was not properly restored in some cases when using custom DNS.

### Security
#### macOS
- Flush states on tunnel state changes. Previously, pre-existing connections could leak when
internet sharing was enabled on a device.


## [2024.2-beta1] - 2024-04-15
### Added
Expand Down
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion talpid-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ duct = "0.13"
[target.'cfg(target_os = "macos")'.dependencies]
async-trait = "0.1"
duct = "0.13"
pfctl = "0.4.4"
pfctl = "0.4.6"
subslice = "0.2"
system-configuration = "0.5.1"
hickory-proto = { git = "https://github.com/mullvad/hickory-dns", rev = "9e8f8c67fbcb6d2985503027362a3fb022529802" }
Expand Down
10 changes: 9 additions & 1 deletion talpid-core/src/firewall/macos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,15 @@ impl Firewall {
pub fn apply_policy(&mut self, policy: FirewallPolicy) -> Result<()> {
self.enable()?;
self.add_anchor()?;
self.set_rules(policy)
self.set_rules(policy)?;

// When entering a secured state, clear connection states
// Otherwise, an existing connection may be approved by some other anchor, and leak
if let Err(error) = self.pf.clear_interface_states(pfctl::Interface::Any) {
log::error!("Failed to clear source state tracking nodes: {error}");
}

Ok(())
}

pub fn reset_policy(&mut self) -> Result<()> {
Expand Down

0 comments on commit d54dcc6

Please sign in to comment.