network extension case network disruption

I am using NETransparentProxyProvider to transparently proxy port 80 443

Normal processing within the initial period of time

  • (BOOL) handleNewFlow: (NEAppProxyFlow *) fw

However, after running for a period of time, this callback will not be triggered again, and the system's network will be disconnected

Stop network extension and the system's network returns to normal

OS 11.4 M1 OS 12.1 Intel

What does this look like from the ‘client’ side? That is, if you make a tiny test project that uses, say, BSD Sockets to make an outgoing connection, what happens there? Does your connection go through? Or does it fail? Or perhaps it just stalls?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

I have written a simple [BSD sockets] test program and have undergone repeated testing,

As a result, when I was browsing the web using Safari for a period of time, there was an outbound network outage, but I was able to connect to the computer using vnc。

This means that there is a problem with the outbound network, but the inbound network is normal。

I guess this may be related to my network proxy scheme

This is my transparent proxy setting:

NETransparentProxyNetworkSettings *settings = [[[NETransparentProxyNetworkSettings alloc]initWithTunnelRemoteAddress:@"127.0.0.1"] autorelease];
        NSMutableArray *rules = [NSMutableArray array];
        NSArray *ports = @[@80,@443];
        for(NSNumber *port in ports){
            NENetworkRule *rule4 = [[[NENetworkRule alloc]initWithRemoteNetwork:[NWHostEndpoint endpointWithHostname:@"0.0.0.0" port:[port description]]
                                                                   remotePrefix:0 localNetwork:0 localPrefix:0
                                                                       protocol:NENetworkRuleProtocolTCP
                                                                      direction:NETrafficDirectionOutbound] autorelease];
            NENetworkRule *rule6 = [[[NENetworkRule alloc]initWithRemoteNetwork:[NWHostEndpoint endpointWithHostname:@"::" port:[port description]]
                                                                   remotePrefix:0 localNetwork:0 localPrefix:0
                                                                       protocol:NENetworkRuleProtocolTCP
                                                                      direction:NETrafficDirectionOutbound] autorelease];
            [rules addObject:rule4];
            [rules addObject:rule6];
        }
        settings.includedNetworkRules = rules;
        [self setTunnelNetworkSettings:settings completionHandler:^(NSError * _Nullable error) {
            //my handle
        }];

I debugged the network extension and found that the network extension did not have any state transitions. but - [NETransparentProxyProvider handleNewFlow: (NEAppProxyFlow *) fw] is not being triggered.

The outgoing BSD socket connection already established at this time When there is no data exchange, it normally closes and exits.

When I upgraded OS 11.4 M1 to OS 13, the same test program did not reproduce the problem of network outages.

I can provide the information you need as much as possible。

My problem is, even if the way I set up outgoing BSD socket connection is incorrect, Why is the

    • [NETransparentProxyProvider handleNewFlow: (NEAppProxyFlow *) fw]

callback not being triggered

When I upgraded OS 11.4 M1 to OS 13, the same test program did not reproduce the problem of network outages.

So, to confirm, this is is broken on 11.4 but works on 13.0? Have you tried it on some variant of macOS 12?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Sorry, I upgraded directly to 13 (M1) . I reproduced this issue on the 12.1 (Intel). There are issues on both platforms M1、intel .

So, working on macOS 13 but failing on macOS 11 and 12?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Not all of it,Working very well on my system macOS12.5.1 (21G83) INTEL。

I found a similar problem :https://developer.apple.com/forums/thread/700065

But I used the same method to cat the networkextension log and didn't find any problems

network extension case network disruption
 
 
Q