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 ###########
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() {
local cfg="$1"
@ -112,22 +124,32 @@ start() {
then
apply_uci_config
config_load vtun
#if options section doesn't exist, add it
j=`uci get vtun.@options[0]`
if [ $? -ne 0 ]
if [ $? -ne 0 ]
then
j=`uci add vtun options`
j='uci commit vtun'
config_load vtun
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
mkdir -p /tmp/vtun
rm -f $CLIENT_CONF
# config_foreach network_config network
config_foreach options_config options "$CLIENT_CONF"
config_foreach default_config default "$CLIENT_CONF"
config_foreach to_server_config server "$CLIENT_CONF"
# STARTUP CLIENT TO SERVER CONNECTIONS