From: Michael Tremer Date: Fri, 4 Aug 2017 21:28:17 +0000 (+0000) Subject: ipsec: Make sure strongswan is started when it should be X-Git-Tag: 009~43 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b863fe52d4d5b0882c8ae9a764bb03e9fb55c9c7;p=network.git ipsec: Make sure strongswan is started when it should be Signed-off-by: Michael Tremer --- 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 }