Skip to content

Commit 00a9f9e

Browse files
committed
fixup: some warnings
1 parent e5b9b56 commit 00a9f9e

File tree

5 files changed

+11
-26
lines changed

5 files changed

+11
-26
lines changed

mullvad-cli/src/cmds/split_tunnel/macos.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// TODO: add by paths
2-
31
use anyhow::Result;
42
use std::path::PathBuf;
53

talpid-core/src/split_tunnel/macos/bpf.rs

+1-6
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use libc::{
44
BIOCSHDRCMPLT, BIOCSSEESENT, BPF_ALIGNMENT, EBUSY, F_GETFL, F_SETFL, O_NONBLOCK,
55
};
66
use std::{
7-
ffi::{c_int, c_uint, CStr},
7+
ffi::{c_int, c_uint},
88
fs::File,
99
io::{self, Read, Write},
1010
mem,
@@ -263,11 +263,6 @@ pub struct BpfStream {
263263
}
264264

265265
impl BpfStream {
266-
pub fn from_bpf(bpf: Bpf) -> Result<Self, Error> {
267-
bpf.set_nonblocking(true)?;
268-
Self::from_file(bpf.file)
269-
}
270-
271266
pub fn from_read_half(reader: ReadHalf) -> Result<Self, Error> {
272267
Self::from_file(reader.0)
273268
}

talpid-core/src/split_tunnel/macos/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ use talpid_routing::RouteManagerHandle;
33

44
use self::process::ExclusionStatus;
55

6+
#[allow(non_camel_case_types)]
67
mod bindings;
78
mod bpf;
89
mod process;

talpid-core/src/split_tunnel/macos/process.rs

+2-10
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@ pub enum Error {
3232
FindProcessPath(#[error(source)] io::Error, u32),
3333
}
3434

35-
pub struct ProcessMonitor {
36-
states: ProcessStates,
37-
}
35+
pub struct ProcessMonitor(());
3836

3937
#[derive(Debug)]
4038
pub struct ProcessMonitorHandle {
@@ -45,9 +43,6 @@ pub struct ProcessMonitorHandle {
4543

4644
impl ProcessMonitor {
4745
pub async fn spawn() -> Result<ProcessMonitorHandle, Error> {
48-
// TODO: need handle that can add excluded procs, etc.
49-
// TODO: probably do need mutex
50-
5146
let states = ProcessStates::new()?;
5247

5348
let excluded_paths = vec![];
@@ -82,8 +77,6 @@ impl ProcessMonitor {
8277
let mut inner = states_clone.inner.lock().unwrap();
8378
inner.handle_message(val);
8479
}
85-
86-
// TODO: signal complete shutdown here?
8780
});
8881

8982
Ok(ProcessMonitorHandle {
@@ -173,7 +166,7 @@ impl ProcessStates {
173166
pub fn exclude_paths(&self, paths: Vec<PathBuf>) {
174167
let mut inner = self.inner.lock().unwrap();
175168

176-
for (pid, info) in &mut inner.processes {
169+
for (_pid, info) in &mut inner.processes {
177170
// Remove no-longer excluded paths from exclusion list
178171
let mut new_exclude_paths: Vec<_> = info
179172
.excluded_by_paths
@@ -391,7 +384,6 @@ struct ESAuditToken {
391384

392385
#[derive(Debug, Deserialize)]
393386
struct ESProcess {
394-
ppid: u32,
395387
audit_token: ESAuditToken,
396388
executable: ESExecutable,
397389
}

talpid-core/src/split_tunnel/macos/tun.rs

+7-8
Original file line numberDiff line numberDiff line change
@@ -113,13 +113,13 @@ pub enum RoutingDecision {
113113

114114
/// Interface name, addresses, and gateway
115115
#[derive(Debug, Clone)]
116-
pub struct DefaultInterface {
116+
struct DefaultInterface {
117117
/// Interface name
118-
pub name: String,
118+
name: String,
119119
/// MAC/Hardware address of the gateway
120-
pub v4_addrs: Option<DefaultInterfaceAddrs<Ipv4Addr>>,
120+
v4_addrs: Option<DefaultInterfaceAddrs<Ipv4Addr>>,
121121
/// MAC/Hardware address of the gateway
122-
pub v6_addrs: Option<DefaultInterfaceAddrs<Ipv6Addr>>,
122+
v6_addrs: Option<DefaultInterfaceAddrs<Ipv6Addr>>,
123123
}
124124

125125
/// Interface name, addresses, and gateway
@@ -461,7 +461,6 @@ async fn redirect_packets_for_pktap_stream(
461461
};
462462

463463
let vpn_v4 = vpn_interface.as_ref().and_then(|iface| iface.v4_address);
464-
let def_v4 = default_interface.v4_addrs.as_ref().unwrap().source_ip;
465464

466465
let ingress_task: tokio::task::JoinHandle<(
467466
tokio::io::ReadHalf<tun::AsyncDevice>,
@@ -598,17 +597,17 @@ async fn handle_incoming_data(
598597
vpn_v4: Option<Ipv4Addr>,
599598
) {
600599
let Some(mut frame) = MutableEthernetPacket::new(payload) else {
601-
log::debug!("default: Discarding non-Ethernet frame");
600+
log::trace!("discarding non-Ethernet frame");
602601
return;
603602
};
604603

605604
if frame.get_ethertype() != EtherTypes::Ipv4 {
606-
log::debug!("discarding non-ipv4");
605+
log::trace!("discarding non-IPv4 frame");
607606
return;
608607
}
609608

610609
let Some(mut ip) = MutableIpv4Packet::new(frame.payload_mut()) else {
611-
log::debug!("default: Discarding non-IPv4 packet");
610+
log::trace!("discarding non-IPv4 packet");
612611
return;
613612
};
614613

0 commit comments

Comments
 (0)