]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Make "topology subnet" work on Solaris (ifconfig + route metric changes by Kazuyoshi...
authorGert Doering <gert@greenie.muc.de>
Sat, 30 Oct 2010 19:03:16 +0000 (21:03 +0200)
committerDavid Sommerseth <dazo@users.sourceforge.net>
Fri, 12 Nov 2010 20:54:08 +0000 (21:54 +0100)
Tested on OpenSolaris/i386, no impact for other TARGETs.

Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Kazuyoshi Aizawa <admin2@whiteboard.ne.jp>
Signed-off-by: David Sommerseth <dazo@users.sourceforge.net>
route.c
tun.c

diff --git a/route.c b/route.c
index 24d4bd8f7aaae0d289bece8d35f95169e7cc4727..612bcbef317d08f2d7c5a269cadc8def4c146242 100644 (file)
--- a/route.c
+++ b/route.c
@@ -923,16 +923,14 @@ add_route (struct route *r, const struct tuntap *tt, unsigned int flags, const s
   argv_printf (&argv, "%s add",
                ROUTE_PATH);
 
-#if 0
-  if (r->metric_defined)
-    argv_printf_cat (&argv, "-rtt %d", r->metric);
-#endif
-
   argv_printf_cat (&argv, "%s -netmask %s %s",
              network,
              netmask,
              gateway);
 
+  if (r->metric_defined)
+    argv_printf_cat (&argv, "%d", r->metric);
+
   argv_msg (D_ROUTE, &argv);
   status = openvpn_execve_check (&argv, es, 0, "ERROR: Solaris route add command failed");
 
diff --git a/tun.c b/tun.c
index facf979371a971b74b646c519bace65c8c33c102..a984369fc533472d8fc165ca032c3b0e9d2de20b 100644 (file)
--- a/tun.c
+++ b/tun.c
@@ -702,6 +702,19 @@ do_ifconfig (struct tuntap *tt,
                            );
        }
       else
+        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 broadcast + up",
                             IFCONFIG_PATH,
@@ -714,6 +727,20 @@ do_ifconfig (struct tuntap *tt,
       if (!openvpn_execve_check (&argv, es, 0, "Solaris ifconfig phase-2 failed"))
        solaris_error_close (tt, es, actual);
 
+      if (!tun && tt->topology == TOP_SUBNET)
+       {
+         /* Add a network route for the local tun interface */
+         struct route r;
+         CLEAR (r);      
+         r.defined = true;       
+         r.network = tt->local & tt->remote_netmask;
+         r.netmask = tt->remote_netmask;
+         r.gateway = tt->local;  
+         r.metric_defined = true;
+         r.metric = 0;
+         add_route (&r, tt, 0, es);
+       }
+
       tt->did_ifconfig = true;
 
 #elif defined(TARGET_OPENBSD)