I removed the filter.
Outbound UDP flows are all seen.
The inbound UDP flow in the test scenario is never seen.
Some other inbound UDP flows are seen.
Here's the modified source I used for the FilterDataProvider:
// MARK: Properties
// The TCP port which the filter is interested in.
// MARK: NEFilterDataProvider
override func startFilter(completionHandler: @escaping (Error?) -> Void) {
completionHandler(nil)
}
override func stopFilter(with reason: NEProviderStopReason, completionHandler: @escaping () -> Void) {
completionHandler()
}
override func handleNewFlow(_ flow: NEFilterFlow) -> NEFilterNewFlowVerdict {
guard let socketFlow = flow as? NEFilterSocketFlow,
let remoteEndpoint = socketFlow.remoteEndpoint as? NWHostEndpoint else {
os_log("Early return")
return .allow()
}
os_log("Got a new flow (socket protocol: %d direction: %d) with remote endpoint %{public}@", socketFlow.socketProtocol, socketFlow.direction.rawValue, remoteEndpoint)
os_log("Got a new flow with remote port %{public}@", remoteEndpoint.port)
return .allow()
}
}