Multiple Network Extensions Within One Application

Hello,

I'm creating a MacOS application that should contain two Network Extensions (DNS Proxy, Packet Tunnel). How should I go about doing this? Should I have a separate system extensions for each?

My current implementation is that I have one System Extension. Inside of Info.plist under NetworkExtension, I have:

Code Block
<dict>
<key>NEMachServiceName</key>
<string>$(TeamIdentifierPrefix)group.testapp.dns</string>
<key>NEProviderClasses</key>
<dict>
<key>com.apple.networkextension.dns-proxy</key>
<string>$(PRODUCT_MODULE_NAME).DNSProxyProvider</string>
<key>com.apple.networkextension.packet-tunnel</key>
<string>$(PRODUCT_MODULE_NAME).PacketTunnelProvider</string>
</dict>
</dict>


When my OSSystemExtensionRequest completes, I create a NETunnelProviderManager instance and use NEDNSProxyManager.shared(). Then I call saveToPreferences for each after I add configuration to both.

Inside of my DNSProxyProvider, startProxy is called as intended.

Inside of my PacketTunnelProvider, startTunnel is not called automatically. How can I start it programmatically? I'm able to manually start it through System Preferences -> Network.

I'm also seeing some errors after I load the system extension but before I click allow on the prompts to add VPN Configurations and DNS Proxy Configuration.

Code Block
... [] Failed to save configuration com.testapp.dns: Error Domain=NEConfigurationErrorDomain Code=11 "IPC failed" UserInfo={NSLocalizedDescription=IPC failed}
...-[NEDNSProxyManager saveToPreferencesWithCompletionHandler:]_block_invoke_3: failed to save the new configuration: Error Domain=NEConfigurationErrorDomain Code=11 "IPC failed" UserInfo={NSLocalizedDescription=IPC failed}

I do not get this error if i try to load and save preferences for only one Provider. Why am I failing to save my configuration? Also, is there a way to check all current preferences through Terminal or a GUI?





Multiple Network Extensions Within One Application
 
 
Q