summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--etc/inc/interfaces.inc7
-rw-r--r--usr/local/www/diag_ipsec.php26
2 files changed, 15 insertions, 18 deletions
diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc
index 704d245..14368d3 100644
--- a/etc/inc/interfaces.inc
+++ b/etc/inc/interfaces.inc
@@ -3852,9 +3852,9 @@ function find_ip_interface($ip, $bits = null) {
foreach ($ifdescrs as $ifdescr => $ifname) {
$ifip = ($isv6ip) ? get_interface_ipv6($ifname) : get_interface_ip($ifname);
- if ($ifip === null)
+ if (is_null($ifip))
continue;
- if ($bits === null) {
+ if (is_null($bits)) {
if ($ip == $ifip) {
$int = get_real_interface($ifname);
return $int;
@@ -3867,6 +3867,7 @@ function find_ip_interface($ip, $bits = null) {
}
}
}
+
return false;
}
@@ -3889,7 +3890,7 @@ function find_virtual_ip_alias($ip, $bits = null) {
if ($vip['mode'] === "ipalias") {
if (is_ipaddrv6($vip['subnet']) != $isv6ip)
continue;
- if ($bits === null) {
+ if (is_null($bits)) {
if (ip_in_subnet($ip, $vip['subnet'] . "/" . $vip['subnet_bits'])) {
return $vip;
}
diff --git a/usr/local/www/diag_ipsec.php b/usr/local/www/diag_ipsec.php
index 01c7c7e..68f7dc8 100644
--- a/usr/local/www/diag_ipsec.php
+++ b/usr/local/www/diag_ipsec.php
@@ -152,31 +152,27 @@ $mobile = ipsec_dump_mobile();
$source = "";
$ip_interface = null;
$ip_alias = null;
- if ($ph2ent['localid']['type'] == 'lan') {
- $source = get_interface_ip('lan');
- } else if ($ph2ent['localid']['type'] == 'network') {
- $ip_interface = find_ip_interface($ph2ent['localid']['address'], $ph2ent['localid']['netbits']);
- if (!$ip_interface) {
- $ip_alias = find_virtual_ip_alias($ph2ent['localid']['address'], $ph2ent['localid']['netbits']);
- }
- } else {
- $ip_interface = find_ip_interface($ph2ent['localid']['address']);
- if (!$ip_interface) {
- $ip_alias = find_virtual_ip_alias($ph2ent['localid']['address']);
- }
- }
+ $localinfo = ipsec_idinfo_to_cidr($ph2ent['localid'], false, $ph2ent['mode']);
+ list($localip, $localsub) = explode("/", $localinfo);
+ $ip_interface = find_ip_interface($localip, $localsub);
+ if (!$ip_interface)
+ $ip_alias = find_virtual_ip_alias($localip, $localsub);
if ($ip_interface) {
- if (is_ipaddrv6($ph2ent['localid']['address']))
+ if (is_ipaddrv6($localip))
$source = get_interface_ipv6($ip_interface);
else
$source = get_interface_ip($ip_interface);
} else if ($ip_alias) {
$source = $ip_alias['subnet'];
}
+ if (!empty($ph2ent['pinghost']))
+ $remoteid = $ph2ent['pinghost'];
+ else
+ $remoteid = $ph2ent['remoteid']['address'];
?>
<?php if (($ph2ent['remoteid']['type'] != "mobile") && ($icon != "pass") && ($source != "")): ?>
<center>
- <a href="diag_ipsec.php?act=connect&amp;remoteid=<?php echo $ph2ent['remoteid']['address']; ?>&amp;source=<?php echo $source; ?>">
+ <a href="diag_ipsec.php?act=connect&amp;remoteid=<?php echo $remoteid; ?>&amp;source=<?php echo $source; ?>">
<img src ="/themes/<?php echo $g['theme']; ?>/images/icons/icon_service_start.gif" alt="Connect VPN" title="Connect VPN" border="0">
</a>
</center>
OpenPOWER on IntegriCloud