summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@baturin.org>2014-12-08 03:05:00 +0600
committerDaniil Baturin <daniil@baturin.org>2014-12-08 03:05:00 +0600
commit32336f949395e54007b15bb2aa404d93eda09241 (patch)
treed3da04e9ff8dd4360311f8e8329c50bed20e4c1f
parent05ff24760a908158a2deb1f545cb75590136044a (diff)
parente6318ab674759c453b0e1971f476e2f55d6fe9f6 (diff)
downloadvyatta-op-vpn-32336f949395e54007b15bb2aa404d93eda09241.tar.gz
vyatta-op-vpn-32336f949395e54007b15bb2aa404d93eda09241.zip
Merge pull request #8 from jhendryUK/fix_ikev2_sa_info_when_rekeying_disabled
Bug #401: Fix "show vpn ipsec sa" for IKEv2 when rekeying is disabled
-rw-r--r--lib/OPMode.pm29
1 files changed, 18 insertions, 11 deletions
diff --git a/lib/OPMode.pm b/lib/OPMode.pm
index d9f7526..8d45cf4 100644
--- a/lib/OPMode.pm
+++ b/lib/OPMode.pm
@@ -584,7 +584,7 @@ sub process_tunnels{
$tunnel_hash{$connectid}->{_ikelife} = $ikelife;
$tunnel_hash{$connectid}->{_pfsgrp} = $pfs_group;
- } elsif ($line =~ /\]:\s+IKE SPIs: .* (reauthentication|rekeying) in (.*)/) {
+ } elsif ($line =~ /\]:\s+IKE SPIs: .* (reauthentication|rekeying) (disabled|in .*)/) {
$tunnel_hash{$connectid}->{_ikeexpire} = conv_time($2);
my $atime = $tunnel_hash{$connectid}->{_ikelife} - $tunnel_hash{$connectid}->{_ikeexpire};
@@ -599,7 +599,7 @@ sub process_tunnels{
$esp_hash{$connectid}{$1}->{_inspi} = $2;
$esp_hash{$connectid}{$1}->{_outspi} = $3;
- } elsif ($line =~ /{(\d+)}:\s+(.*?)\/(.*?), (\d+) bytes_i.* (\d+) bytes_o.*rekeying in (.*)/) {
+ } elsif ($line =~ /{(\d+)}:\s+(.*?)\/(.*?), (\d+) bytes_i.* (\d+) bytes_o.*rekeying (disabled|in .*)/) {
my $esp_id = $1;
$esp_hash{$connectid}{$esp_id}->{_encryption} = $2;
$esp_hash{$connectid}{$esp_id}->{_hash} = $3;
@@ -653,17 +653,24 @@ sub process_tunnels{
sub conv_time {
my @time = split(/\s+/, $_[0]);
- my $multiply = 1;
+ my ($rc, $multiply) = ("", 1);
- if ($time[1] =~ /minute/i) {
- $multiply = 60;
- } elsif ($time[1] =~ /hour/i) {
- $multiply = 3600;
- } elsif ($time[1] =~ /day/i) {
- $multiply = 86400;
- }
+ if ($time[0] eq 'disabled') {
+ $rc = 0;
+ } else {
+
+ if ($time[2] =~ /minute/i) {
+ $multiply = 60;
+ } elsif ($time[2] =~ /hour/i) {
+ $multiply = 3600;
+ } elsif ($time[2] =~ /day/i) {
+ $multiply = 86400;
+ }
- return $time[0] * $multiply;
+ $rc = $time[1] * $multiply;
+ }
+
+ return $rc;
}
sub get_conns