Only start vtund server if we have active clients. 04/27/2022 (#343)

Without active clients the server will fail to start. This is okay, except this
error code causes the package installer to incorrectly report an install problem
requiring an unnecessary reboot.
This commit is contained in:
Tim Wilkinson 2022-04-27 09:38:56 -07:00 committed by GitHub
parent 7aff95711e
commit 1c6c596d38
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -8,6 +8,7 @@ SERVER_CONF=/tmp/vtun/vtundsrv.conf
# Starting tun interface is tun50
TUNNUM=50
MAXTUNNUM=$((`uci get aredn.@tunnel[0].maxclients 2>/dev/null` + $TUNNUM - 1))
STUNNUM=${TUNNUM}
network_config() {
local cfg="$1"
@ -121,8 +122,11 @@ start() {
config_foreach options_config options "$SERVER_CONF"
config_foreach allowed_client_config client "$SERVER_CONF"
# START SERVER LISTENER
/usr/sbin/vtund -s -f $SERVER_CONF
# START SERVER LISTENER IF NECESSARY
if [ "${TUNNUM}" != "${STUNNUM}" ]
then
/usr/sbin/vtund -s -f $SERVER_CONF
fi
fi
}