Commit 746357a3 authored by Franco Fichtner's avatar Franco Fichtner

ipsec: fix crash reports

(cherry picked from commit 504c0762)
parent a95c3cd5
...@@ -72,11 +72,18 @@ if (isset($config['ipsec']['phase1'])) { ...@@ -72,11 +72,18 @@ if (isset($config['ipsec']['phase1'])) {
} }
$ipsec_leases = json_decode(configd_run("ipsec list leases"), true); $ipsec_leases = json_decode(configd_run("ipsec list leases"), true);
if ($ipsec_leases == null) {
$ipsec_leases = array();
}
// parse configured tunnels
$ipsec_status = json_decode(configd_run("ipsec list status"), true); $ipsec_status = json_decode(configd_run("ipsec list status"), true);
if ($ipsec_status == null) {
$ipsec_status = array();
}
// parse configured tunnels
$activetunnels = 0; $activetunnels = 0;
if ($ipsec_status != null) {
foreach ($ipsec_status as $status_key => $status_value) { foreach ($ipsec_status as $status_key => $status_value) {
if (isset($status_value['children'])) { if (isset($status_value['children'])) {
foreach($status_value['children'] as $child_status_key => $child_status_value) { foreach($status_value['children'] as $child_status_key => $child_status_value) {
...@@ -95,7 +102,6 @@ if (isset($config['ipsec']['phase1'])) { ...@@ -95,7 +102,6 @@ if (isset($config['ipsec']['phase1'])) {
} }
} }
} }
}
} }
if (isset($config['ipsec']['phase2'])) { if (isset($config['ipsec']['phase2'])) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment