[PATCH 1/5] Reuse function and value for default GW

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Remove duplicated code to get default GW and
use existing get_default_gw().

Reuse default GW value just obtained, don't
call get_default_gw() twice.

Signed-off-by: Antonio Borneo <borneo.antonio at gmail.com>
---
 vpnc-script |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/vpnc-script b/vpnc-script
index 4c502c2..b5ea1b4 100755
--- a/vpnc-script
+++ b/vpnc-script
@@ -232,14 +232,13 @@ else # use route command
 	}
 
 	del_vpngateway_route() {
-	        vpngw_route=`netstat -r -n | awk '/:/ { next; } /^(default|0\.0\.0\.0)/ { print $2; }'`
-		route $route_syntax_del -host "$VPNGATEWAY" $route_syntax_gw "$vpngw_route"
+		route $route_syntax_del -host "$VPNGATEWAY" $route_syntax_gw "`get_default_gw`"
 	}
 
 	set_default_route() {
 		DEFAULTGW="`get_default_gw`"
 		echo "$DEFAULTGW" > "$DEFAULT_ROUTE_FILE"
-		route $route_syntax_del default $route_syntax_gw "`get_default_gw`"
+		route $route_syntax_del default $route_syntax_gw "$DEFAULTGW"
 		route add default $route_syntax_gw "$INTERNAL_IP4_ADDRESS" $route_syntax_interface
 	}
 
-- 
1.7.3.4




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux