From 21b2912fc0f072cba213e776333f6f2797041101 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ermal=20LU=C3=87I?= Date: Wed, 24 Dec 2014 18:21:22 +0100 Subject: Correct status counter of inactive tunnels --- usr/local/www/widgets/widgets/ipsec.widget.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/usr/local/www/widgets/widgets/ipsec.widget.php b/usr/local/www/widgets/widgets/ipsec.widget.php index f33b4e6..81c0159 100644 --- a/usr/local/www/widgets/widgets/ipsec.widget.php +++ b/usr/local/www/widgets/widgets/ipsec.widget.php @@ -86,8 +86,10 @@ if (isset($config['ipsec']['phase1'])) { ?> } else $ikeid = "con{$ph1ent['ikeid']}"; + $found = false; foreach ($ipsec_status['query']['ikesalist']['ikesa'] as $ikeid => $ikesa) { if ($ikeid == $ikesa['peerconfig']) { + $found = true; $ph2ikeid = $ikesa['id']; if (ipsec_phase1_status($ipsec_status['query']['ikesalist']['ikesa'], $ph2ikeid)) { /* tunnel is up */ @@ -101,6 +103,12 @@ if (isset($config['ipsec']['phase1'])) { ?> } } + if ($found === false) { + /* tunnel is down */ + $iconfn = "false"; + $inactivecounter++; + } + $ipsec_detail_array[] = array('src' => convert_friendly_interface_to_friendly_descr($ph1ent['interface']), 'dest' => $ph1ent['remote-gateway'], 'remote-subnet' => ipsec_idinfo_to_text($ph2ent['remoteid']), -- cgit v1.1