$OpenBSD: patch-src_openvpn_tun_c,v 1.3 2014/10/10 21:07:07 sthen Exp $
--- src/openvpn/tun.c.orig	Thu May  1 12:12:22 2014
+++ src/openvpn/tun.c	Tue Jul 29 22:10:23 2014
@@ -917,7 +917,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,
@@ -926,6 +938,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 )
@@ -944,6 +957,18 @@ do_ifconfig (struct tuntap *tt,
 	  add_route_connected_v6_net(tt, es);
 	}
       tt->did_ifconfig = true;
+
+      /* Add a network route for the local tun interface */
+      if (!tun && tt->topology == TOP_SUBNET)
+        {
+          struct route_ipv4 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)
 
