From 48821ce60a95f1a5a0d22656ecae0af9924b52c3 Mon Sep 17 00:00:00 2001 From: Jason Hendry Date: Fri, 9 Jan 2015 12:27:27 +0000 Subject: Improving detection of dead tunnels for IKEv2 --- lib/OPMode.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/OPMode.pm b/lib/OPMode.pm index d9f7526..87ce910 100644 --- a/lib/OPMode.pm +++ b/lib/OPMode.pm @@ -642,7 +642,8 @@ sub process_tunnels{ foreach my $data (keys %{$esp_hash{$connectid}{$esp_sa}}) { $tunnel_hash{$connectid}->{$data} = $esp_hash{$connectid}{$esp_sa}{$data} if ($data =~ /^_/); } - my $atime = $tunnel_hash{$connectid}->{_lifetime} - $tunnel_hash{$connectid}->{_expire}; + my ($atime, $esp_lifetime, $esp_expire) = (-1, $tunnel_hash{$connectid}->{_lifetime}, $tunnel_hash{$connectid}->{_expire}); + $atime = $esp_lifetime - $esp_expire if (($esp_lifetime ne 'n/a') && ($esp_expire ne 'n/a')); $tunnel_hash{$connectid}->{_state} = "up" if ($atime >= 0); last; } -- cgit v1.2.3