Commit 7be9871f authored by Franco Fichtner's avatar Franco Fichtner

widgets: ipsec warnings; fixes #154

parent 50613a49
......@@ -36,16 +36,20 @@ function vpn_ipsec_configure_loglevels($forconfig = false)
global $config, $ipsec_loglevels;
$cfgtext = array();
foreach ($ipsec_loglevels as $lkey => $ldescr) {
if (!isset($config['ipsec']["ipsec_{$lkey}"]) && !$forconfig)
mwexec("/usr/local/sbin/ipsec stroke loglevel {$lkey} -- -1", false);
else if (is_numeric($config['ipsec']["ipsec_{$lkey}"]) &&
intval($config['ipsec']["ipsec_{$lkey}"]) >= 1 && intval($config['ipsec']["ipsec_{$lkey}"]) <= 5)
$forconfig ? $cfgtext[] = "${lkey} " . (intval($config['ipsec']["ipsec_{$lkey}"]) - 1) :
mwexec("/usr/local/sbin/ipsec stroke loglevel {$lkey} " . (intval($config['ipsec']["ipsec_{$lkey}"]) - 1) , false);
if (isset($ipsec_loglevels)) {
foreach ($ipsec_loglevels as $lkey => $ldescr) {
if (!isset($config['ipsec']["ipsec_{$lkey}"]) && !$forconfig)
mwexec("/usr/local/sbin/ipsec stroke loglevel {$lkey} -- -1", false);
else if (is_numeric($config['ipsec']["ipsec_{$lkey}"]) &&
intval($config['ipsec']["ipsec_{$lkey}"]) >= 1 && intval($config['ipsec']["ipsec_{$lkey}"]) <= 5)
$forconfig ? $cfgtext[] = "${lkey} " . (intval($config['ipsec']["ipsec_{$lkey}"]) - 1) :
mwexec("/usr/local/sbin/ipsec stroke loglevel {$lkey} " . (intval($config['ipsec']["ipsec_{$lkey}"]) - 1) , false);
}
}
if ($forconfig)
if ($forconfig) {
return implode(',', $cfgtext);
}
}
/* include all configuration functions */
......
......@@ -35,9 +35,7 @@ require_once("functions.inc");
require_once("ipsec.inc");
if (isset($config['ipsec']['phase1'])) {
?>
<div>&nbsp;</div>
<?php
echo "<div>&nbsp;</div>\n";
$tab_array = array();
$tab_array[0] = array("Overview", true, "ipsec-Overview");
$tab_array[1] = array("Tunnels", false, "ipsec-tunnel");
......@@ -53,37 +51,41 @@ if (isset($config['ipsec']['phase1'])) {
$inactivecounter = 0;
$ipsec_detail_array = array();
foreach ($config['ipsec']['phase2'] as $ph2ent) {
if ($ph2ent['remoteid']['type'] == "mobile") {
continue;
}
ipsec_lookup_phase1($ph2ent, $ph1ent);
$ipsecstatus = false;
if (isset($config['ipsec']['phase2'])) {
foreach ($config['ipsec']['phase2'] as $ph2ent) {
if ($ph2ent['remoteid']['type'] == "mobile") {
continue;
}
ipsec_lookup_phase1($ph2ent, $ph1ent);
$ipsecstatus = false;
$tun_disabled = "false";
$foundsrc = false;
$founddst = false;
$tun_disabled = "false";
$foundsrc = false;
$founddst = false;
if (isset($ph1ent['disabled']) || isset($ph2ent['disabled'])) {
$tun_disabled = "true";
continue;
}
if (isset($ipsec_status['query']['ikesalist']['ikesa']) && isset($ph1ent['ikeid']) && ipsec_phase1_status($ipsec_status['query']['ikesalist']['ikesa'], $ph1ent['ikeid'])) {
/* tunnel is up */
$iconfn = "true";
$activecounter++;
} else {
/* tunnel is down */
$iconfn = "false";
$inactivecounter++;
}
if (isset($ph1ent['disabled']) || isset($ph2ent['disabled'])) {
$tun_disabled = "true";
continue;
}
if (isset($ipsec_status['query']['ikesalist']['ikesa']) && isset($ph1ent['ikeid']) && ipsec_phase1_status($ipsec_status['query']['ikesalist']['ikesa'], $ph1ent['ikeid'])) {
/* tunnel is up */
$iconfn = "true";
$activecounter++;
} else {
/* tunnel is down */
$iconfn = "false";
$inactivecounter++;
}
$ipsec_detail_array[] = array('src' => convert_friendly_interface_to_friendly_descr($ph1ent['interface']),
'dest' => $ph1ent['remote-gateway'],
'remote-subnet' => ipsec_idinfo_to_text($ph2ent['remoteid']),
'descr' => $ph2ent['descr'],
'status' => $iconfn,
'disabled' => $tun_disabled);
$ipsec_detail_array[] = array(
'src' => convert_friendly_interface_to_friendly_descr($ph1ent['interface']),
'dest' => $ph1ent['remote-gateway'],
'remote-subnet' => ipsec_idinfo_to_text($ph2ent['remoteid']),
'descr' => $ph2ent['descr'],
'status' => $iconfn,
'disabled' => $tun_disabled
);
}
}
}
......
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