$OpenBSD: patch-src_openvpn_tun_c,v 1.2 2013/10/21 09:15:07 bluhm Exp $
--- src/openvpn/tun.c.orig	Wed Mar 20 09:28:14 2013
+++ src/openvpn/tun.c	Sat Oct 19 15:53:44 2013
@@ -867,7 +867,7 @@ do_ifconfig (struct tuntap *tt,
       if (!tun && tt->topology == TOP_SUBNET)
 	{
 	  /* Add a network route for the local tun interface */
-	  struct route r;
+	  struct route_base r;
 	  CLEAR (r);      
 	  r.flags = RT_DEFINED | RT_METRIC_DEFINED;
 	  r.network = tt->local & tt->remote_netmask;
@@ -911,7 +911,19 @@ do_ifconfig (struct tuntap *tt,
 			  );
 	}
       else
-	argv_printf (&argv,
+      {
+        if (tt->topology == TOP_SUBNET)
+          argv_printf (&argv,
+                              "%s %s %s %s netmask %s mtu %d up",
+                              IFCONFIG_PATH,
+                              actual,
+                              ifconfig_local,
+                              ifconfig_local,
+                              ifconfig_remote_netmask,
+                              tun_mtu
+                              );
+        else
+	  argv_printf (&argv,
 			  "%s %s %s netmask %s mtu %d broadcast %s link0",
 			  IFCONFIG_PATH,
 			  actual,
@@ -920,6 +932,7 @@ do_ifconfig (struct tuntap *tt,
 			  tun_mtu,
 			  ifconfig_broadcast
 			  );
+      }
       argv_msg (M_INFO, &argv);
       openvpn_execve_check (&argv, es, S_FATAL, "OpenBSD ifconfig failed");
       if ( do_ipv6 )
@@ -939,6 +952,18 @@ do_ifconfig (struct tuntap *tt,
 	}
       tt->did_ifconfig = true;
 
+      /* Add a network route for the local tun interface */
+      if (!tun && tt->topology == TOP_SUBNET)
+        {
+          struct route_base r;
+          CLEAR (r);
+          r.flags = RT_DEFINED;
+          r.network = tt->local & tt->remote_netmask;
+          r.netmask = tt->remote_netmask;
+          r.gateway = tt->local;
+          add_route (&r, tt, 0, NULL, es);
+        }
+
 #elif defined(TARGET_NETBSD)
 
 /* whether or not NetBSD can do IPv6 can be seen by the availability of
@@ -1064,7 +1089,7 @@ do_ifconfig (struct tuntap *tt,
       /* Add a network route for the local tun interface */
       if (!tun && tt->topology == TOP_SUBNET)
 	{
-	  struct route r;
+	  struct route_base r;
 	  CLEAR (r);
 	  r.flags = RT_DEFINED;
 	  r.network = tt->local & tt->remote_netmask;
@@ -1130,7 +1155,7 @@ do_ifconfig (struct tuntap *tt,
 	/* Add a network route for the local tun interface */
       if (!tun && tt->topology == TOP_SUBNET)
         {
-          struct route r;
+          struct route_base r;
           CLEAR (r);
           r.flags = RT_DEFINED;
           r.network = tt->local & tt->remote_netmask;
