diff options
author | Taniadz <tdziubenko@ukr.net> | 2017-10-31 15:52:47 +0200 |
---|---|---|
committer | Taniadz <tdziubenko@ukr.net> | 2017-10-31 15:52:47 +0200 |
commit | b53019e4bf1b51b40cefc263479ee0531341cb78 (patch) | |
tree | a21c1d8ed47b1eab6a1266a806c0026b6e914c25 /scripts | |
parent | d0e7c861ed20d871d71efd46caf517bbee8c1a69 (diff) | |
download | vyatta-cfg-vpn-b53019e4bf1b51b40cefc263479ee0531341cb78.tar.gz vyatta-cfg-vpn-b53019e4bf1b51b40cefc263479ee0531341cb78.zip |
T126: charon listening on ALL interfaces(correct sorting)
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/vpn-config.pl | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/scripts/vpn-config.pl b/scripts/vpn-config.pl index 95c783e..071b3b8 100755 --- a/scripts/vpn-config.pl +++ b/scripts/vpn-config.pl @@ -1253,9 +1253,24 @@ if ( $vcVPN->isDeleted('.') vpn_exec("ipsec down peer-$old_peer-tunnel-$tunnel", "Cleaning up site-to-site peer $old_peer at tunnel $tunnel"); } } + # Check if returnValues equals returnOrigValues for ipsec-interfaces and restart if they are not equal + my $equals = 1; my @working_interfaces = $vcVPN->returnValues("ipsec ipsec-interfaces interface"); my @active_interfaces = $vcVPN->returnOrigValues("ipsec ipsec-interfaces interface"); - if (@working_interfaces != @active_interfaces) { + if (scalar(@working_interfaces) != scalar(@active_interfaces)){ + $equals = 0; + } + else { + my @sorted_working = sort @working_interfaces; + my @sorted_active = sort @active_interfaces; + foreach (my $i = 0; $i < @sorted_working; $i++) { + if ($sorted_working[$i] ne $sorted_active[$i]) { + $equals = 0; + last; + } + } + } + if ($equals == 0) { vpn_exec('ipsec restart >&/dev/null', 're-starting ipsec'); }else { vpn_exec('ipsec rereadall >&/dev/null', 're-read secrets and certs'); |