Mailing List Archive

svn commit: vpnc r505 - /branches/vpnc-nortel/vpnc-script /trunk/vpnc-script
Author: Antonio Borneo
Date: Sat Jan 14 08:56:47 2012
New Revision: 505

Log:
Reuse function and value for default GW

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@gmail.com>

Modified:
branches/vpnc-nortel/vpnc-script
trunk/vpnc-script

Modified: branches/vpnc-nortel/vpnc-script
==============================================================================
--- branches/vpnc-nortel/vpnc-script (original)
+++ branches/vpnc-nortel/vpnc-script Sat Jan 14 08:56:47 2012
@@ -232,14 +232,13 @@
}

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
}


Modified: trunk/vpnc-script
==============================================================================
--- trunk/vpnc-script (original)
+++ trunk/vpnc-script Sat Jan 14 08:56:47 2012
@@ -232,14 +232,13 @@
}

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
}


_______________________________________________
vpnc-devel mailing list
vpnc-devel@unix-ag.uni-kl.de
https://lists.unix-ag.uni-kl.de/mailman/listinfo/vpnc-devel
http://www.unix-ag.uni-kl.de/~massar/vpnc/