From b863fe52d4d5b0882c8ae9a764bb03e9fb55c9c7 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Fri, 4 Aug 2017 21:28:17 +0000 Subject: [PATCH] ipsec: Make sure strongswan is started when it should be Signed-off-by: Michael Tremer --- src/functions/functions.ipsec | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/functions/functions.ipsec b/src/functions/functions.ipsec index 22c6d529..d75d920d 100644 --- a/src/functions/functions.ipsec +++ b/src/functions/functions.ipsec @@ -344,12 +344,24 @@ ipsec_strongswan_autostart() { done # Start strongswan when we need it and when it is not yet enabled - if ${autostart_needed} && ! service_is_enabled "strongswan"; then - service_enable "strongswan" + if ${autostart_needed}; then + if ! service_is_enabled "strongswan"; then + service_enable "strongswan" + fi + + if ! service_is_active "strongswan"; then + service_start "strongswan" + fi # Disable strongswan when we do not need it but it is enabled - elif ! ${autostart_needed} && service_is_enabled "strongswan"; then - service_disable "strongswan" + elif ! ${autostart_needed}; then + if service_is_enabled "strongswan"; then + service_disable "strongswan" + fi + + if service_is_active "strongswan"; then + service_stop "strongswan" + fi fi } -- 2.47.3