summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@vyos.io>2021-12-29 14:13:04 +0700
committerGitHub <noreply@github.com>2021-12-29 14:13:04 +0700
commitf917f26776e4d90cd89fbc9b7fb5e87eec96d770 (patch)
tree47701d798e073fa3f45ae45f9ad0c2ca1e98b91b
parent9cc1a0ad937929606a38e63cefb7708f24cae975 (diff)
parent627be9ee69babfa641224abdce9e31afa5245b83 (diff)
downloadvyatta-cfg-vpn-f917f26776e4d90cd89fbc9b7fb5e87eec96d770.tar.gz
vyatta-cfg-vpn-f917f26776e4d90cd89fbc9b7fb5e87eec96d770.zip
Merge pull request #56 from sever-sever/T2922
ipsec: T2922: Fix logLevel set when charon not loaded
-rwxr-xr-xscripts/vpn-config.pl15
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) {