fff-vpn-select: do not configure peers on vpn-stop

There are two reasons why there should be no peers.
Meshrouter without wan or no peers in hoodfile for a protocol.
With this patch there is only one condition left for vpn-start-stop.
Peers present or not. And it is less complicated to implement start/stop.

Signed-off-by: Robert Langhammer <rlanghammer@web.de>
Acked-by: Fabian Bläse <fabian@blaese.de>
This commit is contained in:
Robert Langhammer 2022-03-16 11:36:22 +01:00 committed by Fabian Bläse
parent 2bc21aa63f
commit 8e127a3936
1 changed files with 15 additions and 13 deletions

View File

@ -24,19 +24,21 @@ done
# configure vpn # configure vpn
if [ -n "$hoodfile" ] && [ -s "$hoodfile" ] ; then if [ "$0" != "/usr/sbin/vpn-stop" ] ; then
json_load "$(cat "$hoodfile")" if [ -n "$hoodfile" ] && [ -s "$hoodfile" ] ; then
json_select hood json_load "$(cat "$hoodfile")"
json_get_var id id json_select hood
json_select ".." json_get_var id id
json_select vpn json_select ".."
json_get_keys vpn_keys json_select vpn
for key in $vpn_keys; do json_get_keys vpn_keys
json_select $key for key in $vpn_keys; do
json_get_var protocol protocol json_select $key
"${protocol}_addpeer" json_get_var protocol protocol
json_select ".." # back to vpn "${protocol}_addpeer"
done json_select ".." # back to vpn
done
fi
fi fi
# start/restart/stop vpnservices # start/restart/stop vpnservices