diff options
-rw-r--r-- | etc/inc/ipsec.inc | 24 | ||||
-rw-r--r-- | usr/local/www/diag_ipsec.php | 2 |
2 files changed, 25 insertions, 1 deletions
diff --git a/etc/inc/ipsec.inc b/etc/inc/ipsec.inc index a6efa65..2710f9a 100644 --- a/etc/inc/ipsec.inc +++ b/etc/inc/ipsec.inc @@ -656,6 +656,30 @@ function ipsec_get_number_of_phase2($ikeid) { return $nbph2; } +function ipsec_get_descr($ikeid) { + global $config; + + if (!isset($config['ipsec']['phase1']) || + !is_array($config['ipsec']['phase1'])) + return ""; + + $descr = ''; + $a_phase1 = $config['ipsec']['phase1']; + foreach ($a_phase1 as $p1) { + if ($p1['ikeid'] == $ikeid) { + $descr = $p1['descr']; + break; + } + } + unset($a_phase1); + + return $descr; +} + +function ipsec_get_descr_by_peerconfig($peerconfig) { + return ipsec_get_descr(substr($peerconfig, strrpos($peerconfig, '-') + 1)); +} + function ipsec_disconnect_mobile($username) { if (empty($username)) return false; diff --git a/usr/local/www/diag_ipsec.php b/usr/local/www/diag_ipsec.php index 7a19bd4..ad6c463 100644 --- a/usr/local/www/diag_ipsec.php +++ b/usr/local/www/diag_ipsec.php @@ -116,7 +116,7 @@ $status = ipsec_smp_dump_status(); ?> <tr> <td class="listlr"> - <?php echo htmlspecialchars($ikesa['peerconfig']);?> + <?php echo htmlspecialchars(ipsec_get_descr_by_peerconfig($ikesa['peerconfig']));?> </td> <td class="listr"> <?php if (!is_array($ikesa['local'])) |