I took the help of claude code and come to a conclusion like this
Summary: IPv4 ARP cache invisible via PF_ROUTE sysctl on macOS 27 — bundled apps only; cause unknown
TL;DR: On macOS 27, querying the IPv4 ARP cache via
sysctl(CTL_NET, PF_ROUTE, 0, AF_INET, NET_RT_FLAGS, RTF_LLINFO) returns an
empty result (needed == 0) inside our built .app bundle, with or
without the App Sandbox entitlement. The identical query with AF_INET6
returns real data in the same app. arp -a (system binary) shows IPv4 entries
fine. Crucially, the identical sysctl code run as a bare, unbundled
swift repro.swift script also returns real IPv4 data — so this is not
about code-signing or sandboxing in general, it's specific to being a
launched, bundled GUI app. We suspected the Local Network privacy permission
next (the app had never appeared in System Settings → Privacy & Security →
Local Network), added NSLocalNetworkUsageDescription/NSBonjourServices,
forced the permission prompt via an NWBrowser Bonjour browse, and granted
it — the sysctl result was unchanged. Local Network permission is ruled
out too. The unbundled script also has no Local Network grant, yet works
fine, confirming that permission isn't the differentiator either way.
The actual cause is still unknown. Worked correctly, unchanged, on
macOS 26. Full write-up: macos27_arp_sandbox_bug_report.md.
Minimal repro
Save as repro.swift and run with swift repro.swift:
From Terminal (unbundled script): returns real IPv4 + IPv6 data — bug
does not reproduce.
Built into the actual .app bundle and run from Finder/LaunchServices:
AF_INET returns needed=0; AF_INET6 still works — bug reproduces, with
or without the App Sandbox entitlement.
import Darwin
func probe(_ family: Int32, label: String) {
var mib: [Int32] = [CTL_NET, PF_ROUTE, 0, family, NET_RT_FLAGS, Int32(RTF_LLINFO)]
var needed = 0
let rc = sysctl(&mib, 6, nil, &needed, nil, 0)
print("\(label): rc=\(rc) errno=\(errno) needed=\(needed)")
}
probe(AF_INET, label: "AF_INET (expect IPv4 ARP entries)")
probe(AF_INET6, label: "AF_INET6 (IPv6 neighbor entries)")
Run as swift repro.swift from Terminal — bug does NOT reproduce
AF_INET (expect IPv4 ARP entries): rc=0 errno=0 needed=7324
AF_INET6 (IPv6 neighbor entries): rc=0 errno=0 needed=15464
Both calls succeed with real, non-empty data — exactly as expected, matching
macOS 26 behavior.
Same code, built into and run as our app bundle on macOS 27 — bug reproduces
AF_INET (expect IPv4 ARP entries): rc=0 errno=2 needed=0
AF_INET6 (IPv6 neighbor entries): rc=0 errno=0 needed=<nonzero>
rc == 0 means the call succeeded — it's not an error, just an empty result
for AF_INET specifically, and only inside the app bundle. arp -a run at
the same time in Terminal also lists IPv4 entries normally. Reproduces with
the App Sandbox entitlement present and with it removed — sandboxing is not
the differentiator. The differentiator is bundled-app-vs-bare-script.