but I was hit by the 5th point when the coding that says kSCNetworkProtocolTypePPP and there is no such thing ...
There is no need to extract the PPP protocol, you can apply the settings directly to the created interface. If you created such an interface:
interface = SCNetworkInterfaceCreateWithInterface(bottomInterface, kSCNetworkInterfaceTypePPP);
you can directly apply PPP options using:
SCNetworkInterfaceSetConfiguration(interface, myOptions)
You need to apply a shared secret using
SCNetworkInterfaceSetExtendedConfiguration(interface, CFSTR("IPSec"), myOptions)
And if you want to enable βSend all traffic via VPNβ, you need to apply these settings by first extracting the IPv4 protocol:
SCNetworkProtocolRef protocol = SCNetworkServiceCopyProtocol(service, kSCNetworkProtocolTypeIPv4); SCNetworkProtocolSetConfiguration(protocol, myOptions)
The source code mentioned in this answer was extracted from https://github.com/halo/macosvpn/blob/master/macosvpn/Classes/VPNController.m , where you can find it in its entirety.
user3883413
source share