From 8e127a39365f744adc78b4d9ff74a9fb1207804a Mon Sep 17 00:00:00 2001 From: Robert Langhammer Date: Wed, 16 Mar 2022 11:36:22 +0100 Subject: [PATCH] fff-vpn-select: do not configure peers on vpn-stop MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Acked-by: Fabian Bläse --- .../fff-vpn-select/files/usr/sbin/vpn-select | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/packages/fff/fff-vpn-select/files/usr/sbin/vpn-select b/src/packages/fff/fff-vpn-select/files/usr/sbin/vpn-select index 8f9be37e..565b1daa 100755 --- a/src/packages/fff/fff-vpn-select/files/usr/sbin/vpn-select +++ b/src/packages/fff/fff-vpn-select/files/usr/sbin/vpn-select @@ -24,19 +24,21 @@ done # configure vpn -if [ -n "$hoodfile" ] && [ -s "$hoodfile" ] ; then - json_load "$(cat "$hoodfile")" - json_select hood - json_get_var id id - json_select ".." - json_select vpn - json_get_keys vpn_keys - for key in $vpn_keys; do - json_select $key - json_get_var protocol protocol - "${protocol}_addpeer" - json_select ".." # back to vpn - done +if [ "$0" != "/usr/sbin/vpn-stop" ] ; then + if [ -n "$hoodfile" ] && [ -s "$hoodfile" ] ; then + json_load "$(cat "$hoodfile")" + json_select hood + json_get_var id id + json_select ".." + json_select vpn + json_get_keys vpn_keys + for key in $vpn_keys; do + json_select $key + json_get_var protocol protocol + "${protocol}_addpeer" + json_select ".." # back to vpn + done + fi fi # start/restart/stop vpnservices