Skip to contentSkip to conversation

NetBSD patch for OpenVPN

Openvpn-devel Dimitri Goldin 2 participants 2 messages Jul 26, 2002

lore
Share & tools
lore
#0 lore raw

Hello list,

The patch for the NetBSD "support" ist ready.
I only added some entries for NetBSD and used the same ifconfig code as OpenBSD in tun.c.
The patch is attached.
I hope I did everything right.

Cheers,
Dimitri

Signature · 3 lines
pub  1024D/3A264EA8 2002-07-07 Dimitri Goldin <[email protected]...>              
Fingerprint: 3AA9 1264 51AA 0BB5 EB29  A6E3 9648 F42A 3A26 4EA8                 
                                                "Don't Panic."                  

*** ../openvpn-1.3.1/configure.ac Thu Jul 11 07:17:04 2002
--- configure.ac Fri Jul 26 22:19:27 2002
***************
*** 114,123 ****
--- 114,126 ----
AC_DEFINE(TARGET_OPENBSD, 1, [Are we running on OpenBSD?]) ;;
*freebsd*)
AC_DEFINE(TARGET_FREEBSD, 1, [Are we running on FreeBSD?]) ;;
+ *netbsd*)
+ AC_DEFINE(TARGET_NETBSD, 1, [Are we running NetBSD?])
+ ;;
*darwin*)
dnl some Mac OS X tendering (we use vararg macros...) AC_DEFINE(TARGET_DARWIN, 1, [Are we running on Mac OS X?]) CPPFLAGS="$CPPFLAGS -no-cpp-precomp"
;;
*** ../openvpn-1.3.1/syshead.h Thu Jun 13 20:50:28 2002
--- syshead.h Fri Jul 26 21:14:24 2002
***************
*** 194,203 ****
--- 194,211 ----
#include <net/if_tun.h>
#endif

  #endif /* TARGET_FREEBSD */

+ #ifdef TARGET_NETBSD
+
+ #ifdef HAVE_NET_IF_TUN_H
+ #include <net/if_tun.h>
+ #endif
+
+ #endif /* TAGET_NETBSD */
+
#ifdef HAVE_SYS_MMAN_H
#ifdef TARGET_DARWIN
#define _P1003_1B_VISIBLE
#endif /* TARGET_DARWIN */
#include <sys/mman.h>
*** ../openvpn-1.3.1/tun.c Tue Jul 2 19:09:26 2002
--- tun.c Fri Jul 26 21:14:24 2002
***************
*** 147,156 ****
--- 147,168 ----
tun_mtu

  		);
        msg (M_INFO, "%s", command_line);
        system_check (command_line, "OpenBSD ifconfig failed", true);

+ #elif defined(TARGET_NETBSD)
+
+ snprintf (command_line, sizeof (command_line),
+ IFCONFIG_PATH " %s %s %s mtu %d netmask 255.255.255.255 up",
+ dev,
+ ifconfig_local,

+                 ifconfig_remote,
+                 tun_mtu
+                 );

+ msg (M_INFO, "%s", command_line);
+ system_check (command_line, "NetBSD ifconfig failed", true);
+
#elif defined(TARGET_DARWIN)

        /*
         * Darwin seems to exibit similar behaviour to OpenBSD...
         */

*** ../openvpn-1.3.1/tun.h Tue Jul 2 19:09:27 2002
--- tun.h Fri Jul 26 21:21:58 2002
***************
*** 92,100 ****
--- 92,102 ----

    return IFCONFIG_AFTER_TUN_OPEN;
  #elif defined(TARGET_OPENBSD)
    return IFCONFIG_BEFORE_TUN_OPEN;
  #elif defined(TARGET_DARWIN)
    return IFCONFIG_AFTER_TUN_OPEN;
+ #elif defined(TARGET_NETBSD)
+   return IFCONFIG_DEFAULT;
  #else
    return IFCONFIG_DEFAULT;

#endif
}

#1 lore raw

Dimitri,

Thanks for the patch, I will apply it to the CVS shortly.

One question I have, were you able to connect OpenVPN running on NetBSD to OpenVPN running on a different platform such as Linux?

I ask because some tun/tap devices will prepend unnecessary stuff onto the datagram that must be disabled with an explicit ioctl call if cross-platform compatibility is to be preserved. You can see some examples of this in tun.c.

If this is the case, you might find that NetBSD <-> NetBSD tunnels work fine, but NetBSD <-> Linux tunnels are broken. Just something to check for if possible...

James

----- Original Message -----
From: "Dimitri Goldin" <[email protected]...>
To: <[email protected]>
Sent: Friday, July 26, 2002 3:58 PM
Subject: [Openvpn-devel] NetBSD patch for OpenVPN

Quoted 16 lines

Hello list,

The patch for the NetBSD "support" ist ready.
I only added some entries for NetBSD and used the same ifconfig code as OpenBSD in tun.c.
The patch is attached.
I hope I did everything right.

Cheers,
Dimitri
--
pub 1024D/3A264EA8 2002-07-07 Dimitri Goldin <[email protected]...>
Fingerprint: 3AA9 1264 51AA 0BB5 EB29 A6E3 9648 F42A 3A26 4EA8

                                                "Don't Panic."