From a60db3cedeb229706d3bda5e5865bae08b798876 Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Thu, 20 Apr 2017 22:46:28 +0200 Subject: [PATCH] ipsec: work around widget issues; closes #1552 In the end, it's better to check if the key exists, although it always should, that's what the key is for.... --- src/www/widgets/widgets/ipsec.widget.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/www/widgets/widgets/ipsec.widget.php b/src/www/widgets/widgets/ipsec.widget.php index e49e19edd..5828b640e 100644 --- a/src/www/widgets/widgets/ipsec.widget.php +++ b/src/www/widgets/widgets/ipsec.widget.php @@ -61,8 +61,14 @@ if (isset($config['ipsec']['phase1'])) { } foreach ($status_value['sas'] as $sas_key => $sas_value) { foreach ($sas_value['child-sas'] as $child_sa_key => $child_sa_value) { - $ipsec_tunnels[$child_sa_key]['active'] = true; - $activetunnels++; + if (!isset($ipsec_tunnels[$child_sa_key])) { + /* XXX bug on strongSwan 5.5.2 appends -3 and -4 here? */ + $child_sa_key = preg_replace('/-.*$/', '', $child_sa_key); + } + if (isset($ipsec_tunnels[$child_sa_key])) { + $ipsec_tunnels[$child_sa_key]['active'] = true; + $activetunnels++; + } } } }