Roy Marples wrote:
Hi List!

In some instances, Linux requires routes being stuck to interfaces instead of floating. Mainly in virtual environments like Xen and Qemu.

Attached is a patch that addresses this issue.

Thanks

------------------------------------------------------------------------

--- openvpn-2.0.6/route.c       2006-04-07 14:59:40.311648814 +0100
+++ openvpn-2.0.6/route.c       2006-04-07 14:57:28.860077986 +0100
@@ -685,18 +685,20 @@ add_route (struct route *r, const struct
#if defined(TARGET_LINUX)
 #ifdef CONFIG_FEATURE_IPROUTE
-  buf_printf (&buf, IPROUTE_PATH " route add %s/%d via %s",
+  buf_printf (&buf, IPROUTE_PATH " route add %s/%d via %s dev %s",
              network,
              count_netmask_bits(netmask),
-             gateway);
+             gateway,
+             tt->actual_name);
   if (r->metric_defined)
     buf_printf (&buf, " metric %d", r->metric);
#else
-  buf_printf (&buf, ROUTE_PATH " add -net %s netmask %s gw %s",
+  buf_printf (&buf, ROUTE_PATH " add -net %s netmask %s gw %s dev %s",
              network,
              netmask,
-             gateway);
+             gateway,
+             tt->actual_name);
   if (r->metric_defined)
     buf_printf (&buf, " metric %d", r->metric);
 #endif  /*CONFIG_FEATURE_IPROUTE*/
@@ -792,7 +794,7 @@ add_route (struct route *r, const struct
     buf_printf (&buf, " -rtt %d", r->metric);
 #endif
- buf_printf (&buf, " -net %s %s -netmask %s",
+  buf_printf (&buf, " -net %s %s -netmask %s dev",
              network,
              gateway,
              netmask);
@@ -830,14 +832,16 @@ delete_route (const struct route *r, con
#if defined(TARGET_LINUX)
 #ifdef CONFIG_FEATURE_IPROUTE
-  buf_printf (&buf, IPROUTE_PATH " route del %s/%d",
+  buf_printf (&buf, IPROUTE_PATH " route del %s/%d dev %s",
              network,
-             count_netmask_bits(netmask));
+             count_netmask_bits(netmask),
+             tt->actual_name);
 #else
- buf_printf (&buf, ROUTE_PATH " del -net %s netmask %s",
+  buf_printf (&buf, ROUTE_PATH " del -net %s netmask %s dev %s",
              network,
-             netmask);
+             netmask,
+             tt->actual_name);
 #endif /*CONFIG_FEATURE_IPROUTE*/
   if (r->metric_defined)
     buf_printf (&buf, " metric %d", r->metric);

Roy,

What about the case where you don't want to associate a route with the tun/tap interface, such as when you're doing the routing dance to make --redirect-gateway work?

James


Reply via email to