Post

Replies

Boosts

Views

Activity

Reply to NetworkExtension framework problems
I think we're focusing on the wrong point. The error message 'NEAppProxyFlowErrorDomain Code=1 "The operation could not be completed because the flow is not connected"' is just a symptom. My concern is that the machine has no network connectivity at all, even though the Wi-Fi connection appears normal. When the problem occurs, the handleNewFlow method doesn't receive any new traffic either.
2w
Reply to NetworkExtension framework problems
The code to restart the Network Extension is as follows: public func stopTunnel(_ manager: NETransparentProxyManager? = nil) async throws -> Bool { LogInfo("start stopTunnel") let proxyManager: NETransparentProxyManager if let manager = manager { proxyManager = manager } else { proxyManager = try await getManager() } let session = proxyManager.connection as? NETunnelProviderSession session?.stopTunnel() let isRunning = try await queryStatus(manager) LogInfo("finished stopTunnel") return !isRunning } public func getManager() async throws -> NETransparentProxyManager { let managers = try await NETransparentProxyManager.loadAllFromPreferences() if managers.count <= 0 { //New installation scenario LogInfo("config no NETransparentProxyManager, new installation scenario") } let appManager = managers.first ?? NETransparentProxyManager() return appManager } public func startTunnel(_ manager: NETransparentProxyManager? = nil, options: [String: Any]? = nil) async throws -> Bool { LogInfo("start startTunnel") let proxyManager: NETransparentProxyManager if let manager = manager { proxyManager = manager } else { proxyManager = try await getManager() } try await proxyManager.loadFromPreferences() let session = proxyManager.connection as? NETunnelProviderSession try session?.startTunnel(options: options) LogInfo("finished startTunnel") return true } Restart the Network Extension by calling the stopTunnel function followed by the startTunnel function. Regarding the second issue you mentioned, I understand it refers to the scenario:“You have an existing flow object that’s successfully run through the above sequence. Then, without an obvious cause, your -writeXyz calls start failing with the above-mentioned error (NEAppProxyErrorDomain / 1)
2w
Reply to NetworkExtension framework problems
Yes, this is macOS. This is not a regression. It has occurred across multiple macOS versions. It hasn't been tested on macOS 26.3 yet. There's no clear pattern for reproducing it. Based on experience, it mostly occurs in laptop sleep/wake scenarios. Once it occurs, it doesn't recover automatically. The computer loses all network connectivity. Restarting the network extension restores it immediately. Restarting the computer also restores it.
2w