Hi all!

With some tweaking, I was able to get OpenVPN running on Mac OS X and use it happily with a Linux peer. Discussion and patches follow.

First of all, current versions of Mac OS X don't include a tun driver, although it is present in the source tree (publicly available via CVS). An independent port of the FreeBSD driver as a loadable module exists, but OpenVPN uncovered some bugs in it. I was able to fix those bugs and effectively took over maintenance of the driver. It is available from <http://chrisp.de/en/projects/tunnel.html>; OpenVPN requires at least version 1.1.0.

OpenVPN itself also needed some small patches, mostly due to Mac OS X's customized GCC and its outdated BSD headers. There are three main problems:

1. There is no in_addr_t and uint32_t is not automatically defined. Some research revealed that uint32_t is defined in <stdint.h>, which is not included explicitly. On Linux, it is included implicitly by <netinet/in.h>, but not so on Mac OS X. This is easily fixed in syshead.h.

2. Apple's precompiling version of cpp doesn't know about macros with variable arguments. Passing the "--no-cpp-precomp" command line option gets rid of this. I added a small check to configure to add it automatically.

3. There is no socklen_t. Coming up with a quick workaround was easy, but fixing it properly wasn't. I found a quite complete configure test for this in OpenSSH, it actually originated from curl. Unfortunately it only works with autoconf 2.50 or newer.

The attached patch is against the current CVS version (which identifies itself as 1.1.1.6). It compiles and runs fine on my Mac OS X box, although I haven't tested the new features yet.

Please let me know what you think.

Greetings,
chrisp

--
chrisp a.k.a. Christoph Pfisterer   "Any sufficiently advanced
c...@chrisp.de - http://chrisp.de      bug is indistinguishable
PGP key & geek code available        from a feature."

Attachment: %darwin-support.patch
Description: application/applefile

Attachment: darwin-support.patch
Description: Binary data

Reply via email to