Hi list!

I set my openvpn server to dish out default routes with a high metric. This 
allows me to prefer hard wired LAN over the vpn, whilst allowing the same 
openvpn server to provide default routes for my wireless. Config is like so

push "route 0.0.0.0 0.0.0.0 10.73.1.1 500"

This works great! However, when the openvpn client stops it tears down all 
default routes - which is not desirable.

Attached is a patch that only tears down routes on the metric given, so if a 
route was created with a metric, tear down the route with that metric. Only 
patched for Linux systems as I'm unsure of the command for others - although 
its probably very similar.

Thanks
-- 
Roy Marples <uberl...@gentoo.org>
Gentoo Linux Developer
--- route.c
+++ route.c
@@ -832,6 +832,8 @@
 	      network,
 	      netmask);
 #endif /*CONFIG_FEATURE_IPROUTE*/
+  if (r->metric_defined)
+    buf_printf (&buf, " metric %d", r->metric);
   msg (D_ROUTE, "%s", BSTR (&buf));
   system_check (BSTR (&buf), es, 0, "ERROR: Linux route delete command failed");

Reply via email to