diff options
Diffstat (limited to 'src/etc/inc/vpn.inc')
-rw-r--r-- | src/etc/inc/vpn.inc | 50 |
1 files changed, 22 insertions, 28 deletions
diff --git a/src/etc/inc/vpn.inc b/src/etc/inc/vpn.inc index c79a761..c7d6662 100644 --- a/src/etc/inc/vpn.inc +++ b/src/etc/inc/vpn.inc @@ -275,7 +275,6 @@ function vpn_ipsec_configure($restart = false) { $ipmap = array(); $rgmap = array(); $filterdns_list = array(); - $listeniflist = array(); $aggressive_mode_psk = false; unset($iflist); $ifacesuse = array(); @@ -289,14 +288,14 @@ function vpn_ipsec_configure($restart = false) { continue; } - if (strpos($ph1ent['interface'], '_vip')) { - $vpninterface = explode('_vip', $ph1ent['interface']); - $ifacesuse[] = get_real_interface($vpninterface[0]); + if (substr($ph1ent['interface'], 0, 4) == "_vip") { + $vpninterface = get_configured_vip_interface($ph1ent['interface']); + $ifacesuse[] = get_real_interface($vpninterface); } else { $vpninterface = get_failover_interface($ph1ent['interface']); - if (strpos($vpninterface, '_vip')) { - $vpninterface = explode('_vip', $vpninterface); - $ifacesuse[] = get_real_interface($vpninterface[0]); + if (substr($vpninterface, 0, 4) == "_vip") { + $vpninterface = get_configured_vip_interface($vpninterface); + $ifacesuse[] = get_real_interface($vpninterface); } elseif (!empty($vpninterface)) { $ifacesuse[] = $vpninterface; } @@ -307,7 +306,6 @@ function vpn_ipsec_configure($restart = false) { } $ikeid = $ph1ent['ikeid']; - $listeniflist = get_real_interface($a_phase1['interface']); $ep = ipsec_get_phase1_src($ph1ent); if (!is_ipaddr($ep)) { @@ -388,10 +386,10 @@ function vpn_ipsec_configure($restart = false) { } /* if no valid src IP was found in configured interfaces, try the vips */ if (is_null($srcip)) { - $viplist = get_configured_vips_list(); - foreach ($viplist as $vip) { - if (ip_in_subnet($vip['ipaddr'], $local_subnet)) { - $srcip = $vip['ipaddr']; + $viplist = get_configured_vip_list(); + foreach ($viplist as $vip => $address) { + if (ip_in_subnet($address, $local_subnet)) { + $srcip = $address; break; } } @@ -897,16 +895,14 @@ EOD; } if ($ph1ent['protocol'] == 'inet') { - if (strpos($ph1ent['interface'], '_vip')) { - $vpninterface = explode('_vip', $ph1ent['interface']); - $ifacesuse = get_real_interface($vpninterface[0]); - $vpninterface = $vpninterface[0]; + if (substr($ph1ent['interface'], 0, 4) == "_vip") { + $vpninterface = get_configured_vip_interface($ph1ent['interface']); + $ifacesuse = get_real_interface($vpninterface); } else { $ifacesuse = get_failover_interface($ph1ent['interface']); - if (strpos($ifacesuse, '_vip')) { - $vpninterface = explode('_vip', $ifacesuse); - $ifacesuse = get_real_interface($vpninterface[0]); - $vpninterface = $vpninterface[0]; + if (substr($ifacesuse, 0, 4) == "_vip") { + $vpninterface = get_configured_vip_interface($ifacesuse); + $ifacesuse = get_real_interface($vpninterface); } else { $vpninterface = convert_real_interface_to_friendly_interface_name($ifacesuse); } @@ -926,16 +922,14 @@ EOD; } } } else if ($ph1ent['protocol'] == 'inet6') { - if (strpos($ph1ent['interface'], '_vip')) { - $vpninterface = explode('_vip', $ph1ent['interface']); - $ifacesuse = get_real_interface($vpninterface[0]); - $vpninterface = $vpninterface[0]; + if (substr($ph1ent['interface'], 0, 4) == "_vip") { + $vpninterface = get_configured_vip_interface($ph1ent['interface']); + $ifacesuse = get_real_interface($vpninterface); } else { $ifacesuse = get_failover_interface($ph1ent['interface']); - if (strpos($ifacesuse, '_vip')) { - $vpninterface = explode('_vip', $ifacesuse); - $ifacesuse = get_real_interface($vpninterface[0]); - $vpninterface = $vpninterface[0]; + if (substr($ifacesuse, 0, 4) == "_vip") { + $vpninterface = get_configured_vip_interface($ifacesuse); + $ifacesuse = get_real_interface($vpninterface); } else { $vpninterface = convert_real_interface_to_friendly_interface_name($ifacesuse); } |