diff options
| author | David Lönnhager <david.l@mullvad.net> | 2024-08-19 13:58:17 +0200 |
|---|---|---|
| committer | David Lönnhager <david.l@mullvad.net> | 2024-08-20 12:03:05 +0200 |
| commit | fd1737992bf048f7e5307eabf23f8d2daeab41ec (patch) | |
| tree | a032b874475a1d1061de8438f3f02ab00a0a5a8a /talpid-core/src | |
| parent | 440efe9212f584826566fbce3f75a297dfa3d5c5 (diff) | |
| download | mullvadvpn-fd1737992bf048f7e5307eabf23f8d2daeab41ec.tar.xz mullvadvpn-fd1737992bf048f7e5307eabf23f8d2daeab41ec.zip | |
Set pcap direction when supported (due to better performance)
Diffstat (limited to 'talpid-core/src')
| -rw-r--r-- | talpid-core/src/split_tunnel/macos/tun.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/talpid-core/src/split_tunnel/macos/tun.rs b/talpid-core/src/split_tunnel/macos/tun.rs index db078a389b..f5cc588786 100644 --- a/talpid-core/src/split_tunnel/macos/tun.rs +++ b/talpid-core/src/split_tunnel/macos/tun.rs @@ -811,10 +811,12 @@ fn capture_outbound_packets( .open() .map_err(Error::CaptureSplitTunnelDevice)?; - // TODO: This is unsupported on macOS 13 and lower, so we determine the direction using the - // pktap header flags. Once macOS 13 is no longer supported, this can be uncommented. - // cap.direction(pcap::Direction::Out) - // .map_err(Error::SetDirection)?; + // TODO: `Capture::direction` is unsupported on macOS 13 and lower, so we determine the + // direction using the pktap header as well. Once macOS 13 is no longer supported, + // this can be assumed to work. Filtering here appears to be a lot faster. + if let Err(error) = cap.direction(pcap::Direction::Out) { + log::debug!("Failed to set capture direction. Might be on macOS 13: {error}"); + } let cap = cap.setnonblock().map_err(Error::EnableNonblock)?; let stream = cap |
