tun with darwin/macos x

Reyk Floeter reyk at openbsd.org
Sat Mar 11 01:57:36 EST 2006


hi,

the following patch adds ssh tun support for Darwin/MacOS X (layer 2+3).

I tested it with Darwin 8.0.1 x86 and MacOS X 10.4 Tiger PPC, I would
like to see any tests from MacOS X users.

It requires an external tun/tap driver, see below.

reyk

--- README.platform.orig	2006-02-13 20:22:04.000000000 -0800
+++ README.platform	2006-02-13 20:21:45.000000000 -0800
@@ -30,6 +30,18 @@ gcc, gcc-mingw-core, mingw-runtime, binu
 openssl-devel, zlib, minres, minires-devel.
 
 
+Darwin and MacOS X
+------------------
+Darwin does not provide a tun(4) driver required for OpenSSH-based
+virtual private networks. The BSD manpage still exists, but the driver
+has been removed in recent releases of Darwin and MacOS X.
+
+Nevertheless, tunnel support is known to work with Darwin 8 and
+MacOS X 10.4 in Point-to-Point (Layer 3) and Ethernet (Layer 2) mode
+using a third party driver. More information is available at:
+	http://www-user.rhrk.uni-kl.de/~nissler/tuntap/
+
+
 Solaris
 -------
 If you enable BSM auditing on Solaris, you need to update audit_event(4)
--- configure.orig	2006-02-13 19:16:02.000000000 -0800
+++ configure	2006-02-13 18:28:39.000000000 -0800
@@ -5285,6 +5285,21 @@ cat >>confdefs.h <<_ACEOF
 #define BIND_8_COMPAT 1
 _ACEOF
 
+
+cat >>confdefs.h <<\_ACEOF
+#define SSH_TUN_FREEBSD 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define SSH_TUN_COMPAT_AF 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define SSH_TUN_PREPEND_AF 1
+_ACEOF
+
 	;;
 *-*-hpux*)
 	# first we define all of the options common to all HP-UX releases
--- configure.ac.orig	2006-02-13 20:25:27.000000000 -0800
+++ configure.ac	2006-02-13 20:25:48.000000000 -0800
@@ -231,6 +231,11 @@ main() { if (NSVersionOfRunTimeLibrary("
 	AC_DEFINE(BROKEN_SETREGID)
 	AC_DEFINE_UNQUOTED(BIND_8_COMPAT, 1,
 		[Define if your resolver libs need this for getrrsetbyname])
+	AC_DEFINE(SSH_TUN_FREEBSD, 1, [Open tunnel devices the FreeBSD way])
+	AC_DEFINE(SSH_TUN_COMPAT_AF, 1,
+	    [Use tunnel device compatibility to OpenBSD])
+	AC_DEFINE(SSH_TUN_PREPEND_AF, 1,
+	    [Prepend the address family to IP tunnel traffic])
 	;;
 *-*-hpux*)
 	# first we define all of the options common to all HP-UX releases
--- openbsd-compat/port-tun.c.orig	2006-02-13 19:16:25.000000000 -0800
+++ openbsd-compat/port-tun.c	2006-02-13 18:28:46.000000000 -0800
@@ -26,6 +26,7 @@
  * settings.
  *
  * SSH_TUN_LINUX	Use the (newer) Linux tun/tap device
+ * SSH_TUN_FREEBSD	Use the FreeBSD tun/tap device
  * SSH_TUN_COMPAT_AF	Translate the OpenBSD address family
  * SSH_TUN_PREPEND_AF	Prepend/remove the address family
  */
@@ -93,7 +94,10 @@ sys_tun_open(int tun, int mode)
 #ifdef SSH_TUN_FREEBSD
 #include <sys/socket.h>
 #include <net/if.h>
+
+#if !defined(SSH_TUN_PREPEND_AF)
 #include <net/if_tun.h>
+#endif
 
 int
 sys_tun_open(int tun, int mode)




More information about the openssh-unix-dev mailing list