bugfix: tun_client connection does not persist/retry

refs AREDN->ticket:229

Change-Id: I843bd2eb7c6d88ec4917e52cfc5bbdfaeda9f4c0
This commit is contained in:
Darryl Quinn 2017-04-26 12:06:24 -05:00
parent e5fc675cfc
commit f532ee6a40
1 changed files with 25 additions and 3 deletions

View File

@ -20,6 +20,18 @@ uci_type_count() {
} }
######### UTILITY FUNCTIONS END ########### ######### UTILITY FUNCTIONS END ###########
default_config() {
local cfg="$1"
local new_file="$2"
local persist
config_get persist "$persist" persist "yes"
echo "default {" >> $new_file
echo " persist $persist;" >> $new_file
echo "}" >> $new_file
echo " " >> $new_file
}
options_config() { options_config() {
local cfg="$1" local cfg="$1"
@ -122,12 +134,22 @@ start() {
config_load vtun config_load vtun
fi fi
#if default section doesn't exist, add it
j=`uci get vtun.@default[0]`
if [ $? -ne 0 ]
then
j=`uci add vtun default`
j='uci commit vtun'
config_load vtun
fi
# Remove the current vtun config file # Remove the current vtun config file
mkdir -p /tmp/vtun mkdir -p /tmp/vtun
rm -f $CLIENT_CONF rm -f $CLIENT_CONF
# config_foreach network_config network # config_foreach network_config network
config_foreach options_config options "$CLIENT_CONF" config_foreach options_config options "$CLIENT_CONF"
config_foreach default_config default "$CLIENT_CONF"
config_foreach to_server_config server "$CLIENT_CONF" config_foreach to_server_config server "$CLIENT_CONF"
# STARTUP CLIENT TO SERVER CONNECTIONS # STARTUP CLIENT TO SERVER CONNECTIONS