I have a config file that completely describes how to connect to a VPN. I'd like to write a tool (C or Objective-C) to read in the file and then create a new VPN interface on the system. I'm guessing the answer will have something to do with SCNetworkServiceCreate and/or SCNetworkInterfaceCreateWithInterface. Both of these want to bind to another interface. What stumps me is that, in theory, the VPN connections should ride on top of any IP interface so I'm at a loss what to use for the base interface. Any help or pointers would be greatly appreciated.
A:
Answering this for completeness.
So, the answer is not well documented. However, there is a magical constant interface definition for any protocol that you want to ride on top of the currently connected IPv4 interface, kSCNetworkInterfaceIPv4.
Therefore the code to create a new VPN builds the VPN stack on top of that interface.
Jeremy
2010-07-29 19:21:41