Skip to contentSkip to conversation

PATCH: Remove route with metrics

Openvpn-devel Roy Marples 1 participant 1 message Mar 31, 2006

lore
Share & tools
lore
#0 lore raw

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

Signature · 2 lines
Roy Marples <[email protected]...>
Gentoo Linux Developer
route.c +2 -0
@@ -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");