From 29044f0dab0fc39d87b4a594a719bee005f05904 Mon Sep 17 00:00:00 2001 From: Ad Schellevis Date: Tue, 19 Jan 2016 21:28:34 +0100 Subject: [PATCH] (legacy, ipsec) add ipsec phase1 description from config in status page --- src/www/diag_ipsec.php | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/www/diag_ipsec.php b/src/www/diag_ipsec.php index a74f5909b..ebdada566 100644 --- a/src/www/diag_ipsec.php +++ b/src/www/diag_ipsec.php @@ -32,6 +32,25 @@ require_once("guiconfig.inc"); require_once("services.inc"); +/** + * search config for phase 1 description + * @param string $conn connection string in format conXXX-XX + * @return string description (or blank if none found) + */ +function ipsec_conn_description($conn) +{ + global $config; + $ipsec_conn_seq = substr(explode('-', $conn)[0],3); + if (isset($config['ipsec']['phase1']) && is_array($config['ipsec']['phase1'])) { + foreach ($config['ipsec']['phase1'] as $phase1) { + if ($phase1['ikeid'] == $ipsec_conn_seq && !empty($phase1['descr'])) { + return $phase1['descr']; + } + } + } + return ""; +} + if ($_SERVER['REQUEST_METHOD'] === 'POST') { if (isset($_POST['action'])) { $act = $_POST['action']; @@ -101,9 +120,9 @@ include("head.inc"); - $ipsec_conn): ?> + $ipsec_conn):?> - + ()