diff options
author | Viacheslav <v.gletenko@vyos.io> | 2021-12-28 22:29:09 +0000 |
---|---|---|
committer | Viacheslav <v.gletenko@vyos.io> | 2021-12-28 23:50:26 +0000 |
commit | 627be9ee69babfa641224abdce9e31afa5245b83 (patch) | |
tree | 47701d798e073fa3f45ae45f9ad0c2ca1e98b91b /scripts/vpn-config.pl | |
parent | 9cc1a0ad937929606a38e63cefb7708f24cae975 (diff) | |
download | vyatta-cfg-vpn-627be9ee69babfa641224abdce9e31afa5245b83.tar.gz vyatta-cfg-vpn-627be9ee69babfa641224abdce9e31afa5245b83.zip |
ipsec: T2922: Fix logLevel set when charon not loaded
LogLevel confiugration modes for ipsec are applied without any
check the state of the 'charon' process i.e at this time it tries
to apply config to not fully loaded charon process
Add checks and timeout for charon process, before executing IPSec
logging options and logging modes
Diffstat (limited to 'scripts/vpn-config.pl')
-rwxr-xr-x | scripts/vpn-config.pl | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/scripts/vpn-config.pl b/scripts/vpn-config.pl index 8bb052c..dc09071 100755 --- a/scripts/vpn-config.pl +++ b/scripts/vpn-config.pl @@ -1295,6 +1295,21 @@ if ( $vcVPN->isDeleted('.') my @logmodes = $vcVPN->returnValues('ipsec logging log-modes'); my @oldmodes = $vcVPN->returnOrigValues('ipsec logging log-modes'); my $charonloglevel = $vcVPN->returnValue('ipsec logging log-level'); + + # Charon is not yet fully loaded when trying to change logLevel + # Set a small timeout for waiting for charon will be loaded + # 0 => process not found, 1 => process found + my $timeout = 7; + if (system("pgrep charon | wc -l" == 0)) { + while ($timeout >= 1){ + sleep(1); + if (system("pgrep charon | wc -l" == 1)){ + last; + } + $timeout--; + } + } + # Clean up any logging modes if present if (@oldmodes > 0) { foreach my $mode (@oldmodes) { |