Skip to contentSkip to conversation

Add gateway argument to Linux ip route del

PATCH In review Mickael Chazaux 2 participants 3 messages Feb 24, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add gateway argument to Linux ip route del

In some use cases, it is valuable to have the gateway passed when deleting a route. Even if is ignored by iproute2, custom tools selected via the --iproute option can make use of it.

---

 route.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
route.c +4 -2
index cf9a5ea..6fd44ca 100644
@@ -1718,10 +1718,12 @@ delete_route (struct route *r,
 
 #if defined(TARGET_LINUX)
 #ifdef CONFIG_FEATURE_IPROUTE
-  argv_printf (&argv, "%s route del %s/%d",
+  argv_printf (&argv, "%s route del %s/%d via %s",
             iproute_path,
             network,
-             count_netmask_bits(netmask));
+             count_netmask_bits(netmask),
+             gateway
+       );
 #else
  argv_printf (&argv, "%s del -net %s netmask %s",
              ROUTE_PATH,

--
1.7.0.4

#1 lore raw

If tool does not use it, environment should be used.

Quoted 42 lines · Mickael Chazaux

In some use cases, it is valuable to have the gateway passed when deleting a route. Even if is ignored by iproute2, custom tools selected via the --iproute option can make use of it.

---

 route.c |    6 ++++--

 1 files changed, 4 insertions(+), 2 deletions(-)
route.c +4 -3
index cf9a5ea..6fd44ca 100644
@@ -1718,10 +1718,12 @@ delete_route (struct route *r,
 
  #if defined(TARGET_LINUX)
  #ifdef CONFIG_FEATURE_IPROUTE
-  argv_printf (&argv, "%s route del %s/%d",
+  argv_printf (&argv, "%s route del %s/%d via %s",
             iproute_path,
             network,
-             count_netmask_bits(netmask));
+             count_netmask_bits(netmask),
+             gateway
+       );
  #else
  argv_printf (&argv, "%s del -net %s netmask %s",
              ROUTE_PATH,
--

1.7.0.4

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning Cloud computing makes use of virtualization - but cloud computing also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Openvpn-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

#2 lore raw

Hi,

2012/2/24 Alon Bar-Lev <[email protected]...>:

Quoted 2 lines

If tool does not use it, environment should be used.

Did not thought of that, works great. Thanks!

Mickael