Native OS X tunnels
Running openvpn on Mac OS X has always been a bit cumbersome, on account of the lack of native tun/tap devices. A third-party kernel extension exists, but, in addition to being a barrier in itself, it can only be installed once, leading to a collection of mutually incompatible OS X apps competing to have their version installed. Also it occasionally gets broken by OS X upgrades. It's kind of a big hairball of despair.
As it happens, Apple quietly introduced native user tunnels (utun) for their own purposes in OS X 10.6. The APIs are public, although not what you would call documented. Thanks to some scraps on the wide Internet and a nudge from an Apple engineer at WWDC, I've been able to add utun support to openvpn. I have a fork on Github with a complete working implementation: https://github.com/bbits/openvpn/tree/utun.
What I would love now is to find some more intrepid OS X users to take it for a whirl. I've been testing it in the context of the OS X Cloak client without so much as a hiccup. Of course, that still leaves plenty of scenarios to test, especially covering IPv6 and non-default topologies. Use "--dev tunX --dev-impl-osx utun" to switch to the utun implementation.
In terms of the code, the only significant addition is a version of open_tun that creates a utun device. This is accomplished through a mystical socket incantation rather than opening a character device, but after that it's the same deal. Not surprisingly, read/write behavior matches the Free/OpenBSD implementations, so that code is the same. The only other addition is a new option to activate it; the default behavior is unchanged.
I've been working primarily on 10.8, but I'm also able to build and run on 10.7 and 10.6, which is as far back as my archive currently goes. The changes will definitely break the build on 10.5 and earlier. I don't know what your deprecation policy is, but if anyone cares about supporting such old systems, I'm sure utun support could be turned into a configure-time option.
Looking forward to feedback and next steps.
Thanks,
Peter
Founder, GetCloak.com
Am 15.06.13 23:13, schrieb Peter Sagerson:
[tun on OS X]
I have not looked at your patch yet but there is also a utun from patch from me, waiting for review:
http://thread.gmane.org/gmane.network.openvpn.devel/7464
Arne
Nice, glad to see I'm not the only one working on this. Apple has been pretty clear that they're aware of the kext conflicts but don't have much interest in addressing the situation. If we can get native tunnel support in one way or another, we can stop the insanity.
I toyed with the idea of various auto-detect or fallback modes, but I ended up opting for explicit behavior and backward compatibility. With the inherent uncertainties in a change like this, my inclination would be to start with a release that calls it an experimental feature, which users can turn on if they want to. Given the substantial benefits of not having to deal with kernel extensions, I think we would see both users and vendors promoting its use. If all goes well, the question of making it the default behavior probably belongs in the context of a major release.
Thanks
Quoted 10 lines · Arne Schwabe
Am 15.06.13 23:13, schrieb Peter Sagerson:
[tun on OS X]
I have not looked at your patch yet but there is also a utun from patch from me, waiting for review:
http://thread.gmane.org/gmane.network.openvpn.devel/7464
Arne
Am 16.06.13 01:41, schrieb Peter Sagerson:
Quoted 3 lines
Nice, glad to see I'm not the only one working on this. Apple has been pretty clear that they're aware of the kext conflicts but don't have much interest in addressing the situation. If we can get native tunnel support in one way or another, we can stop the insanity.
I toyed with the idea of various auto-detect or fallback modes, but I ended up opting for explicit behavior and backward compatibility. With the inherent uncertainties in a change like this, my inclination would be to start with a release that calls it an experimental feature, which users can turn on if they want to. Given the substantial benefits of not having to deal with kernel extensions, I think we would see both users and vendors promoting its use. If all goes well, the question of making it the default behavior probably belongs in the context of a major release.
I think using utun as default at least for -master and 2.4rc candidates is a good way to get the feature tested. I hope there is time in the next OpenVPN developer IRC meeting to decide if my or your patch should be included.
Arne
Defaulting to it in unreleased builds also sounds like a fine idea. I don't know how large your pre-release testing population is. The speed and directness of a utun migration is really a judgement call. Naturally I defer to those who are more involved in the project; it sounds like things are well in hand.
I'll leave my fork up for a while in case any part of my diff is helpful. I get the impression that 2.4 is not a date-driven release, so if it's not imminent, there's a possibility that we'll begin releasing the functionality in our own product before it's more widely available.
Thanks,
Peter
Quoted 9 lines · Arne Schwabe
Am 16.06.13 01:41, schrieb Peter Sagerson:
Quoted 3 lines
Nice, glad to see I'm not the only one working on this. Apple has been pretty clear that they're aware of the kext conflicts but don't have much interest in addressing the situation. If we can get native tunnel support in one way or another, we can stop the insanity.
I toyed with the idea of various auto-detect or fallback modes, but I ended up opting for explicit behavior and backward compatibility. With the inherent uncertainties in a change like this, my inclination would be to start with a release that calls it an experimental feature, which users can turn on if they want to. Given the substantial benefits of not having to deal with kernel extensions, I think we would see both users and vendors promoting its use. If all goes well, the question of making it the default behavior probably belongs in the context of a major release.
I think using utun as default at least for -master and 2.4rc candidates is a good way to get the feature tested. I hope there is time in the next OpenVPN developer IRC meeting to decide if my or your patch should be included.
Arne
Quoted 5 lines · Arne Schwabe
I think using utun as default at least for -master and 2.4rc candidates is a good way to get the feature tested. I hope there is time in the next OpenVPN developer IRC meeting to decide if my or your patch should be included.
I won't be in the IRC chat, so here are my comments on Arne's patch vs. Peter's patch from a feature perspective:
The behavior difference between the two patches seems to be that Arne's patch defaults to using utun, whereas Peter's patch defaults to tun.
From what I understand, utun seems to work and even works in some situations where the standard tuntaposx tun doesn't and is the Apple-supported standard. So I think users should transition to using it. To help them along, I think defaulting to utun is a good idea.
I intend to add 2.4rc builds to Tunnelblick when they are available and to support utun on 10.7+ systems. (Tunnelblick lets users choose which OpenVPN version they use; usually I allow two or three choices, so it's easy to add new versions of OpenVPN for testing.)
Whichever patch is included, I think Tunnelblick's default will be to use utun, and give the user a way to override that and use tun. It looks like I can easily use tun with Arne's patch by specifying "--dev-type tun" to revert to using tun, and easily use utun with Peter's patch by specifying "--dev-impl-osx
utun".
I have a slight preference forArne's patch, which doesn't introduce yet another new OpenVPN option.
I am not expressing an opinion on the code in the patches, but only on their default behaviors.
Hi,
Quoted 2 lines · Jonathan K. Bullard
I have a slight preference forArne's patch, which doesn't introduce yet another new OpenVPN option.
Without having compared the code itself, I second that argument. No more super-special-case options (which depend on #ifdef TARGET_XYZ), please.
Now it might be a good idea to find time to actually read both patches before Thursday and have a more educated opinion :-) *put on TODO list*
gert
Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
//www.muc.de/~gert/
Gert Doering - Munich, Germany [email protected]...
fax: +49-89-35655025 [email protected]...Just a recommendation, but I wouldn't necessarily consider the two proposals alternatives. The only interesting thing going on here is an implementation of open_tun that creates utun devices. The rest is just wiring. Even open_tun isn't really subtle or complex, merely a bit arcane. I suspect the key decisions are how aggressive to make the migration path and how discoverable to make the configuration--if any--at which point there is now more than enough raw material from which to assemble the feature.
Thanks
Quoted 28 lines · Gert Doering
Hi,
Quoted 2 lines · Jonathan K. Bullard
I have a slight preference forArne's patch, which doesn't introduce yet another new OpenVPN option.
Without having compared the code itself, I second that argument. No more super-special-case options (which depend on #ifdef
TARGET_XYZ), please.Now it might be a good idea to find time to actually read both patches before Thursday and have a more educated opinion :-) *put on TODO list*
gert
Signature · 13 lines
USENET is *not* the non-clickable part of WWW! //www.muc.de/~gert/ Gert Doering - Munich, Germany [email protected]... fax: +49-89-35655025 [email protected]... ------------------------------------------------------------------------------ This SF.net email is sponsored by Windows: Build for Windows Store. http://p.sf.net/sfu/windows-dev2dev_______________________________________________ Openvpn-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openvpn-devel
Hi,
Quoted 2 lines · Peter Sagerson
Just a recommendation, but I wouldn't necessarily consider the two proposals alternatives.
I agree - the basic functionality is the same, just some of the surrounding details are different. As I said, I need to closely look at both patches to form an educated opinion for the discussion on Thursday :-)
Still, anything that adds #ifdef to options.c is something I prefer to solve in different ways...
gert
Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
//www.muc.de/~gert/
Gert Doering - Munich, Germany [email protected]...
fax: +49-89-35655025 [email protected]...