tunnels: Tunnels should only start when in mesh mode

Tunnels are not supported in other modes as such we should only let them start in mesh mode.
This commit is contained in:
Conrad Lara - KG6JEI 2015-05-24 12:59:11 -07:00
parent 5cc53dec88
commit 3850cbac53
2 changed files with 41 additions and 28 deletions

View File

@ -106,8 +106,9 @@ apply_uci_config() {
} }
start() { start() {
# only if vtun is installed # only if vtun is installed and ind mesh mode
if [[ -x "/usr/sbin/vtund" ]] configmode=$(uci -q -c /etc/local/uci/ get hsmmmesh.settings.config)
if [ -x "/usr/sbin/vtund" -a "$configmode" = "mesh" ]
then then
apply_uci_config apply_uci_config
config_load vtun config_load vtun

View File

@ -97,6 +97,11 @@ apply_uci_config() {
} }
start() { start() {
configmode=$(uci -q -c /etc/local/uci/ get hsmmmesh.settings.config)
if [ -x "/usr/sbin/vtund" -a "$configmode" = "mesh" ]
then
apply_uci_config apply_uci_config
config_load vtun config_load vtun
@ -120,13 +125,20 @@ start() {
# START SERVER LISTENER # START SERVER LISTENER
/usr/sbin/vtund -s -f $SERVER_CONF /usr/sbin/vtund -s -f $SERVER_CONF
fi
} }
stop() { stop() {
# only if vtun is installed
if [ -x "/usr/sbin/vtund" ]
then
# find the vtund SERVER process... --- FIX THIS # find the vtund SERVER process... --- FIX THIS
for x in `ps -w|grep -F 'vtund[s]:'|grep -v grep|awk '{print $1}'` for x in `ps -w|grep -F 'vtund[s]:'|grep -v grep|awk '{print $1}'`
do do
s=`echo $s $x` s=`echo $s $x`
done done
kill $s kill $s
fi
} }