From ec8b4d8d14d58272bb1f426c0e983ae947791f00 Mon Sep 17 00:00:00 2001 From: Ermal Date: Mon, 11 Feb 2013 09:42:38 +0000 Subject: Try to use standard interface to find the source for connecting a tunnel. Also if a ping host is defined for the configuration used that for remoteid since its known to be reachble --- usr/local/www/diag_ipsec.php | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) (limited to 'usr/local') 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']; ?>
- + Connect VPN
-- cgit v1.1