From bd0bb466f073c50a443c09096e89acf0abf8fdaa Mon Sep 17 00:00:00 2001 From: Ermal Date: Wed, 12 Nov 2014 22:06:03 +0100 Subject: [PATCH] Do not display the disabled tunnels since they are not needed in the widget. Ticket #3955 --- .../www/widgets/widgets/ipsec.widget.php | 70 +++++++------------ 1 file changed, 25 insertions(+), 45 deletions(-) diff --git a/usr/local/www/widgets/widgets/ipsec.widget.php b/usr/local/www/widgets/widgets/ipsec.widget.php index 69a99686a..dcedf597d 100644 --- a/usr/local/www/widgets/widgets/ipsec.widget.php +++ b/usr/local/www/widgets/widgets/ipsec.widget.php @@ -61,36 +61,28 @@ if (isset($config['ipsec']['phase1'])){?> if ($ph2ent['remoteid']['type'] == "mobile") continue; ipsec_lookup_phase1($ph2ent,$ph1ent); - $ipsecstatus = false; - $tun_disabled = "false"; - $foundsrc = false; - $founddst = false; + if (!isset($ph1ent['disabled']) && !isset($ph2ent['disabled'])) { - if (isset($ph1ent['disabled']) || isset($ph2ent['disabled'])) { - $tun_disabled = "true"; - continue; - } + if (is_array($ipsec_status['query']) && + is_array($ipsec_status['query']['ikesalist']) && + is_array($ipsec_status['query']['ikesalist']['ikesa']) && + ipsec_phase1_status($ipsec_status['query']['ikesalist']['ikesa'], $ph1ent['ikeid'])) { + /* tunnel is up */ + $iconfn = "true"; + $activecounter++; + } else { + /* tunnel is down */ + $iconfn = "false"; + $inactivecounter++; + } - if (is_array($ipsec_status['query']) && - is_array($ipsec_status['query']['ikesalist']) && - is_array($ipsec_status['query']['ikesalist']['ikesa']) && - ipsec_phase1_status($ipsec_status['query']['ikesalist']['ikesa'], $ph1ent['ikeid'])) { - /* tunnel is up */ - $iconfn = "true"; - $activecounter++; - } else { - /* tunnel is down */ - $iconfn = "false"; - $inactivecounter++; - } - - $ipsec_detail_array[] = array('src' => convert_friendly_interface_to_friendly_descr($ph1ent['interface']), + $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']), 'descr' => $ph2ent['descr'], - 'status' => $iconfn, - 'disabled' => $tun_disabled); + 'status' => $iconfn); + } } } @@ -122,32 +114,20 @@ if (isset($config['ipsec']['phase1'])){?>
Status
- "; - $spane = ""; - } - else { - $spans = $spane = ""; - } - - ?> + +
- - - +
-
+

- () + ()
-
-
+
+
} echo "Tunnel status"; - - ?>
+ ?> +