Hi Matt,
Along with old rule I tried to add the new NENetworkRule rules matching any port on localhost (127.0.0.1 ) but still didn't see handleNewFlow() called for localhost connection requests. Following is the rule written
let loNetworkRules1 = NENetworkRule(
remoteNetwork: nil,
remotePrefix: 0,
localNetwork: NWHostEndpoint(hostname: "127.0.0.1", port: "0"),
localPrefix: 0,
protocol: .any,
direction: .any
)
let loFilterRule1 = NEFilterRule(networkRule: loNetworkRules1, action: .filterData)
let loNetworkRules2 = NENetworkRule(
remoteNetwork: NWHostEndpoint(hostname: "127.0.0.1", port: "0"),
remotePrefix: 0,
localNetwork: nil,
localPrefix: 0,
protocol: .any,
direction: .any
)
let loFilterRule2 = NEFilterRule(networkRule: loNetworkRules2, action: .filterData)
let loFilterSettings = NEFilterSettings(rules: [loFilterRule1,loFilterRule2], defaultAction: .allow)
apply(loFilterSettings) { error in
if let applyError = error {
netopsLog(level: LOGLEVEL_ERROR, format: "Failed to apply localhost filter settings: %@", applyError.localizedDescription)
}
completionHandler(error)
}
Topic:
App & System Services
SubTopic:
Networking
Tags: