Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
746357a3
Commit
746357a3
authored
Apr 27, 2016
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ipsec: fix crash reports
(cherry picked from commit
504c0762
)
parent
a95c3cd5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
18 deletions
+24
-18
ipsec.widget.php
src/www/widgets/widgets/ipsec.widget.php
+24
-18
No files found.
src/www/widgets/widgets/ipsec.widget.php
View file @
746357a3
...
...
@@ -72,27 +72,33 @@ if (isset($config['ipsec']['phase1'])) {
}
$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
);
if
(
$ipsec_status
==
null
)
{
$ipsec_status
=
array
();
}
// parse configured tunnels
$activetunnels
=
0
;
if
(
$ipsec_status
!=
null
)
{
foreach
(
$ipsec_status
as
$status_key
=>
$status_value
)
{
if
(
isset
(
$status_value
[
'children'
]))
{
foreach
(
$status_value
[
'children'
]
as
$child_status_key
=>
$child_status_value
)
{
$ipsec_tunnels
[
$child_status_key
]
=
array
(
'active'
=>
false
,
'local-addrs'
=>
$status_value
[
'local-addrs'
],
'remote-addrs'
=>
$status_value
[
'remote-addrs'
],
);
$ipsec_tunnels
[
$child_status_key
][
'local-ts'
]
=
implode
(
','
,
$child_status_value
[
'local-ts'
]);
$ipsec_tunnels
[
$child_status_key
][
'remote-ts'
]
=
implode
(
','
,
$child_status_value
[
'remote-ts'
]);
}
}
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
++
;
}
foreach
(
$ipsec_status
as
$status_key
=>
$status_value
)
{
if
(
isset
(
$status_value
[
'children'
]))
{
foreach
(
$status_value
[
'children'
]
as
$child_status_key
=>
$child_status_value
)
{
$ipsec_tunnels
[
$child_status_key
]
=
array
(
'active'
=>
false
,
'local-addrs'
=>
$status_value
[
'local-addrs'
],
'remote-addrs'
=>
$status_value
[
'remote-addrs'
],
);
$ipsec_tunnels
[
$child_status_key
][
'local-ts'
]
=
implode
(
','
,
$child_status_value
[
'local-ts'
]);
$ipsec_tunnels
[
$child_status_key
][
'remote-ts'
]
=
implode
(
','
,
$child_status_value
[
'remote-ts'
]);
}
}
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
++
;
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment