- (djm) [misc.c] Disable tunnel code for non-OpenBSD (for now), enable
   again by providing a sys_tun_open() function for your platform and
   setting the CUSTOM_SYS_TUN_OPEN define. More work is required to match
   OpenBSD's tunnel protocol, which prepends the address family to the
   packet
diff --git a/ChangeLog b/ChangeLog
index 00791e3..e1418db 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -55,6 +55,11 @@
      [channels.c channels.h session.c]
      make sure protocol messages for internal channels are ignored.
      allow adjust messages for non-open channels; with and ok djm@
+ - (djm) [misc.c] Disable tunnel code for non-OpenBSD (for now), enable
+   again by providing a sys_tun_open() function for your platform and 
+   setting the CUSTOM_SYS_TUN_OPEN define. More work is required to match 
+   OpenBSD's tunnel protocol, which prepends the address family to the 
+   packet
 
 20051201
  - (djm) [envpass.sh] Remove regress script that was accidentally committed 
@@ -3447,4 +3452,4 @@
    - (djm) Trim deprecated options from INSTALL. Mention UsePAM
    - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu
 
-$Id: ChangeLog,v 1.4026 2005/12/13 08:33:57 djm Exp $
+$Id: ChangeLog,v 1.4027 2005/12/13 09:44:13 djm Exp $
diff --git a/configure.ac b/configure.ac
index b24d371..80daa0c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
-# $Id: configure.ac,v 1.313 2005/12/13 08:33:20 djm Exp $
+# $Id: configure.ac,v 1.314 2005/12/13 09:44:13 djm Exp $
 #
 # Copyright (c) 1999-2004 Damien Miller
 #
@@ -359,6 +359,7 @@
 *-*-openbsd*)
 	AC_DEFINE(HAVE_ATTRIBUTE__SENTINEL__, 1, [OpenBSD's gcc has sentinel])
 	AC_DEFINE(HAVE_ATTRIBUTE__BOUNDED__, 1, [OpenBSD's gcc has bounded])
+	AC_DEFINE(SSH_TUN_BSD, 1, [Open tunnel devices the BSD way])
 	;;
 *-*-solaris*)
 	if test "x$withval" != "xno" ; then
diff --git a/misc.c b/misc.c
index 4f41332..4141e6c 100644
--- a/misc.c
+++ b/misc.c
@@ -541,6 +541,9 @@
 int
 tun_open(int tun, int mode)
 {
+#if defined(CUSTOM_SYS_TUN_OPEN)
+	return (sys_tun_open(tun, mode));
+#elif defined(SSH_TUN_BSD)
 	struct ifreq ifr;
 	char name[100];
 	int fd = -1, sock;
@@ -594,6 +597,10 @@
 	debug("%s: failed to set %s mode %d: %s", __func__, name,
 	    mode, strerror(errno));
 	return (-1);
+#else
+	error("Tunnel interfaces are not supported on this platform");
+	return (-1);
+#endif
 }
 
 void