Skip to contentSkip to conversation

Fix directly connected routes for "topology subnet" on Solaris.

PATCH In review Gert Doering 2 participants 3 messages Mar 26, 2013 – Mar 27, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix directly connected routes for "topology subnet" on Solaris.

This basically brings back the previously-working metric setting for directly connected routes (add a "0" to the "route add" command) on Solaris/OpenSolaris. It was working in f0eac1a59790, and got broken by the route.c/route.h refactoring in 576dc96ca1ef1 - the patch un-does that change to the TARGET_SOLARIS code, plus adds some more descriptive comments.

---
 src/openvpn/route.c |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)
src/openvpn/route.c +9 -6
index 134ed58..d848db6 100644
@@ -1397,17 +1397,20 @@ add_route (struct route *r,
   argv_printf (&argv, "%s add",
 		ROUTE_PATH);
 
-#if 0
-  if (r->flags & RT_METRIC_DEFINED)
-    argv_printf_cat (&argv, "-rtt %d", r->metric);
-#endif
-
   argv_printf_cat (&argv, "%s -netmask %s %s",
 	      network,
 	      netmask,
 	      gateway);
 
-  /* FIXME -- add on-link support for Solaris */
+  /* Solaris can only distinguish between "metric 0" == "on-link on the
+   * interface where the IP address given is configured" and "metric > 0" 
+   * == "use gateway specified" (no finer-grained route metrics available)
+   * 
+   * More recent versions of Solaris can also do "-interface", but that 
+   * would break backwards compatibility with older versions for no gain.
+   */
+  if (r->flags & RT_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");
Signature · 1 line
1.5.6.5
#1 lore raw
Quoted 33 lines · Gert Doering

This basically brings back the previously-working metric setting for directly connected routes (add a "0" to the "route add" command) on Solaris/OpenSolaris. It was working in f0eac1a59790, and got broken by the route.c/route.h refactoring in 576dc96ca1ef1 - the patch un-does that change to the TARGET_SOLARIS code, plus adds some more descriptive comments.

---
 src/openvpn/route.c |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)
src/openvpn/route.c +2 -6
index 134ed58..d848db6 100644
@@ -1397,17 +1397,20 @@ add_route (struct route *r,
   argv_printf (&argv, "%s add",
 		ROUTE_PATH);
 
-#if 0
-  if (r->flags & RT_METRIC_DEFINED)
-    argv_printf_cat (&argv, "-rtt %d", r->metric);
-#endif
-
   argv_printf_cat (&argv, "%s -netmask %s %s",
 	      network,
 	      netmask,
 	      gateway);
 
-  /* FIXME -- add on-link support for Solaris */
+  /* Solaris can only distinguish between "metric 0" == "on-link on the
+   * interface where the IP address given is configured" and "metric > 0" 

src/openvpn/route.c add_route (struct route *r, · line 1416

Quoted 10 lines
src/openvpn/route.c +7 -0
+   * == "use gateway specified" (no finer-grained route metrics available)
+   * 
+   * More recent versions of Solaris can also do "-interface", but that 
+   * would break backwards compatibility with older versions for no gain.
+   */
+  if (r->flags & RT_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");

ACK on this; I don't have Solaris to test with, but the code changes are fine to fix the platform's needs.

--
Josh

#2 lore raw
In reply to Gert Doering

Patch has been applied to the master and release/2.3 branch.

commit 792e8956b999b6932d472e4ab592bff160e52888 (master) commit c9ec7f77e0726b7ebd9e5824be36118593df01ad (release/2.3)

Author: Gert Doering <[email protected]...>
Date:   Tue Mar 26 17:09:35 2013 +0100
     Fix directly connected routes for "topology subnet" on Solaris.

     Signed-off-by: Gert Doering <[email protected]...>
     Acked-by: Josh Cepek <[email protected]...>
     Message-Id: <[email protected]...>
     URL: http://article.gmane.org/gmane.network.openvpn.devel/7460

--
kind regards,

Gert Doering