diff options
Diffstat (limited to 'etc/inc/vpn.inc')
-rw-r--r-- | etc/inc/vpn.inc | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/etc/inc/vpn.inc b/etc/inc/vpn.inc index e7fa4b9..b509d08 100644 --- a/etc/inc/vpn.inc +++ b/etc/inc/vpn.inc @@ -290,21 +290,15 @@ charon { EOD; - if (is_array($a_client) && isset($a_client['enable']) && !empty($a_client['net_list'])) + if (is_array($a_client) && isset($a_client['enable']) && isset($a_client['net_list'])) $strongswan .= "\tcisco_unity = yes\n"; $strongswan .= "\tplugins {\n"; if (is_array($a_client) && isset($a_client['enable'])) { $strongswan .= "\t\tattr {\n"; - if ($a_client['pool_address'] && $a_client['pool_netbits']) { - $pool_address = $a_client['pool_address']; - $pool_netmask = gen_subnet_mask($a_client['pool_netbits']); - $pool_address = long2ip32(ip2long($pool_address)+1); - - $strongswan .= "\t\taddress = {$pool_address}\n"; - $strongswan .= "\t\tnetmask = {$pool_netmask}\n"; - } + if ($a_client['pool_address'] && $a_client['pool_netbits']) + $strongswan .= "\t\tsubnet = {$a_client['pool_address']}/{$a_client['pool_netbits']}\n"; $cfgservers = array(); if (!empty($a_client['dns_server1'])) @@ -328,7 +322,7 @@ EOD; $strongswan .= "\t\tnbns = " . implode(",", $cfgservers) . "\n"; unset($cfgservers); - if (!empty($a_client['net_list'])) { + if (isset($a_client['net_list'])) { $net_list = ''; foreach ($a_phase2 as $ph2ent) { if (isset($ph2ent['disabled'])) @@ -339,13 +333,12 @@ EOD; $localid = ipsec_idinfo_to_cidr($ph2ent['localid'], true, $ph2ent['mode']); - if ($net_list) - $net_list .= ", "; + if (!empty($net_list)) + $net_list .= ","; $net_list .= $localid; } if (!empty($net_list)) { - $strongswan .= "\t\tsubnet = {$net_list}\n"; $strongswan .= "\t\tsplit-include = {$net_list}\n"; unset($net_list); } |