From 18d6073d34d7e0c5ab9eabfe35bbd48e95a84b99 Mon Sep 17 00:00:00 2001 From: Viacheslav Date: Sun, 31 Oct 2021 15:38:19 +0000 Subject: vpn-op: T3846: Fix for restart vpn with nhrp config After command "restart vpn" nhrp/IPSec configuration not loaded Add checks if nhrp exist in the configuration and help to load it via swanctl. (cherry picked from commit 49ebd98d580c8cea83da510ded19d7bc163218c4) --- scripts/vyatta-vpn-op.pl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/vyatta-vpn-op.pl b/scripts/vyatta-vpn-op.pl index 8bf0301..3be7fd8 100755 --- a/scripts/vyatta-vpn-op.pl +++ b/scripts/vyatta-vpn-op.pl @@ -62,6 +62,11 @@ if ($op eq 'clear-vpn-ipsec-process') { my $update_interval = `cli-shell-api returnActiveValue vpn ipsec auto-update`; if ($update_interval eq ''){ system 'sudo /usr/sbin/ipsec restart >&/dev/null'; + # Check if nhrp configuration exists, exit code + # As 'restart vpn' doesn't load nhrp configuration T3846 + if (system('cli-shell-api existsActive protocols nhrp') == 0) { + system 'sudo swanctl --load-all'; + } } else { system 'sudo /usr/sbin/ipsec restart --auto-update '.$update_interval.' >&/dev/null'; } -- cgit v1.2.3