summaryrefslogtreecommitdiffstats
path: root/usr/local/www
diff options
context:
space:
mode:
Diffstat (limited to 'usr/local/www')
-rw-r--r--usr/local/www/widgets/include/ipsec.inc13
-rw-r--r--usr/local/www/widgets/javascript/ipsec.js9
-rw-r--r--usr/local/www/widgets/widgets/ipsec.widget.php79
3 files changed, 51 insertions, 50 deletions
diff --git a/usr/local/www/widgets/include/ipsec.inc b/usr/local/www/widgets/include/ipsec.inc
index 0a7bb2c..ed869b2 100644
--- a/usr/local/www/widgets/include/ipsec.inc
+++ b/usr/local/www/widgets/include/ipsec.inc
@@ -33,10 +33,13 @@ function output_ipsec_tunnel_status($tunnel) {
$foundsrc = false;
$founddst = false;
foreach($sad as $sa) {
- $sourceIF = find_ip_interface($sa['src']);
- $sourceIF = convert_real_interface_to_friendly_interface_name($sourceIF);
- if($sourceIF == $tunnel['interface'])
- $foundsrc = true;
+ if (!$foundsrc){
+ $sourceIF = find_ip_interface($sa['src']);
+ $sourceIF = convert_real_interface_to_friendly_interface_name($sourceIF);
+
+ if($sourceIF == $tunnel['interface'])
+ $foundsrc = true;
+ }
if($sa['dst'] == $tunnel['remote-gateway'])
$founddst = true;
}
@@ -49,6 +52,4 @@ function output_ipsec_tunnel_status($tunnel) {
}
return $iconfn;
}
-
-
?> \ No newline at end of file
diff --git a/usr/local/www/widgets/javascript/ipsec.js b/usr/local/www/widgets/javascript/ipsec.js
new file mode 100644
index 0000000..c9d704a
--- /dev/null
+++ b/usr/local/www/widgets/javascript/ipsec.js
@@ -0,0 +1,9 @@
+function updateIpsec(){
+ selectIntLink = "ipsecDetailed";
+ ipsecsettings = "ipsecDetail=";
+ ipsecsettings += d.getElementById(selectIntLink).checked;
+
+ selectIntLink = "ipsec-config";
+ textlink = d.getElementById(selectIntLink);
+ textlink.value = ipsecsettings;
+} \ No newline at end of file
diff --git a/usr/local/www/widgets/widgets/ipsec.widget.php b/usr/local/www/widgets/widgets/ipsec.widget.php
index c1dd987..2588d57 100644
--- a/usr/local/www/widgets/widgets/ipsec.widget.php
+++ b/usr/local/www/widgets/widgets/ipsec.widget.php
@@ -30,13 +30,42 @@
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
+ if($config['widgets']['ipsec-config']){
+ $ipsecDetail = $pconfig['ipsec-config'];
+ $eqposition = strpos($ipsecDetail,"=");
+ $ipsecDetail = substr($ipsecDetail, $eqposition+1);
+ }
+ else {
+ $ipsecDetail = "notchecked";
+ }
?>
+
+
+<div id="ipsec-settings" name="ipsec-settings" class="widgetconfigdiv" style="display:none;">
+ <input id="ipsecDetailed" name="ipsecDetailed" type="checkbox" onchange="updateIpsec();" <?php if ($ipsecDetail == "true") echo "checked";?>>
+ Enable Detailed Tunnel Status display
+ <br><br>
+ <b>Note:</b> changing this setting can affect Load times when loading the dashboard page (especially with many IPSEC tunnels)
+ <br><br>
+ <input id="submit" name="submit" type="submit" onclick="return updatePref();" class="formbtn" value="Save Setting" />
+</div>
+
<div>&nbsp;</div>
+<input type="hidden" id="ipsec-config" name="ipsec-config" value="">
+
+<script language="javascript" type="text/javascript">
+ d = document;
+ selectIntLink = "ipsec-configure";
+ textlink = d.getElementById(selectIntLink);
+ textlink.style.display = "inline";
+</script>
+
<?php
$tab_array = array();
$tab_array[0] = array("Overview", true, "ipsec-Overview");
- $tab_array[1] = array("Tunnel Status", false, "ipsec-tunnel");
+ if ($ipsecDetail == "true")
+ $tab_array[1] = array("Tunnel Status", false, "ipsec-tunnel");
display_widget_tabs($tab_array);
/* query SAD */
@@ -72,45 +101,6 @@
$sad[] = $cursa;
pclose($fd);
}
-
-
- /* query SAD */
- $fd = @popen("/sbin/setkey -DP", "r");
- $spd = array();
- if ($fd) {
- while (!feof($fd)) {
- $line = chop(fgets($fd));
- if (!$line)
- continue;
- if ($line == "No SPD entries.")
- break;
- if ($line[0] != "\t") {
- if (is_array($cursp))
- $spd[] = $cursp;
- $cursp = array();
- $linea = explode(" ", $line);
- $cursp['src'] = substr($linea[0], 0, strpos($linea[0], "["));
- $cursp['dst'] = substr($linea[1], 0, strpos($linea[1], "["));
- $i = 0;
- } else if (is_array($cursp)) {
- $linea = explode(" ", trim($line));
- if ($i == 1) {
- if ($linea[1] == "none") /* don't show default anti-lockout rule */
- unset($cursp);
- else
- $cursp['dir'] = $linea[0];
- } else if ($i == 2) {
- $upperspec = explode("/", $linea[0]);
- $cursp['proto'] = $upperspec[0];
- list($cursp['ep_src'], $cursp['ep_dst']) = explode("-", $upperspec[2]);
- }
- }
- $i++;
- }
- if (is_array($cursp) && count($cursp))
- $spd[] = $cursp;
- pclose($fd);
- }
?>
<div id="ipsec-Overview" style="display:block;background-color:#EEEEEE;">
<div>
@@ -160,7 +150,7 @@
</div>
-
+<?php if ($ipsecDetail == "true"): ?>
<div id="ipsec-tunnel" style="display:none;background-color:#EEEEEE;">
<div style="padding: 10px">
<div style="display:table-row;">
@@ -172,7 +162,8 @@
<div style="max-height:105px;overflow:auto;">
<?php
foreach ($config['ipsec']['tunnel'] as $ipsec):
-
+ $ipsecstatus = false;
+
if (isset($ipsec['disabled'])) {
$spans = "<span class=\"gray\">";
$spane = "</span>";
@@ -190,7 +181,7 @@
?>
<?=$spane;?>
</div>
- <div class="listr" style="display:table-cell;width:90px"><?=$spans;?>
+ <div class="listr" style="display:table-cell;width:100px"><?=$spans;?>
<?=$ipsec['remote-subnet'];?>
<br/>
(<?=htmlspecialchars($ipsec['remote-gateway']);?>)<?=$spane;?>
@@ -236,5 +227,5 @@
</div>
</div>
</div>
-
+<? endif; ?>
OpenPOWER on IntegriCloud