From 8b1a2b5e808305943f5f3222d429e079a98e1395 Mon Sep 17 00:00:00 2001 From: fanyang Date: Thu, 28 May 2026 23:34:52 +0800 Subject: [PATCH] fix(tunnel): silence macOS BPF unsafe warnings Make macOS BPF ioctl wrappers explicit about unsafe calls. - Wrap libc ioctl calls in unsafe blocks - Keep the existing error handling unchanged --- easytier/src/tunnel/fake_tcp/netfilter/macos_bpf.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/easytier/src/tunnel/fake_tcp/netfilter/macos_bpf.rs b/easytier/src/tunnel/fake_tcp/netfilter/macos_bpf.rs index afc11927..8574cc5a 100644 --- a/easytier/src/tunnel/fake_tcp/netfilter/macos_bpf.rs +++ b/easytier/src/tunnel/fake_tcp/netfilter/macos_bpf.rs @@ -232,7 +232,7 @@ fn iowr(group: u8, num: u8) -> libc::c_ulong { } unsafe fn ioctl_ptr(fd: libc::c_int, req: libc::c_ulong, arg: *mut T) -> io::Result<()> { - let ret = libc::ioctl(fd, req, arg); + let ret = unsafe { libc::ioctl(fd, req, arg) }; if ret < 0 { return Err(io::Error::last_os_error()); } @@ -240,7 +240,7 @@ unsafe fn ioctl_ptr(fd: libc::c_int, req: libc::c_ulong, arg: *mut T) -> io:: } unsafe fn ioctl_void(fd: libc::c_int, req: libc::c_ulong) -> io::Result<()> { - let ret = libc::ioctl(fd, req); + let ret = unsafe { libc::ioctl(fd, req) }; if ret < 0 { return Err(io::Error::last_os_error()); }