diff options
author | Ermal <eri@pfsense.org> | 2013-02-13 22:40:22 +0000 |
---|---|---|
committer | Ermal <eri@pfsense.org> | 2013-02-13 22:40:22 +0000 |
commit | a1e4e2a79fce4c734cf3d8e485531f60da5763e8 (patch) | |
tree | 4726208cfc520ee50772f7d8d593c482bb0e865b /etc/inc | |
parent | 72f25519a9ee36cd9c0ba33a3b8736ef0fb7ae26 (diff) | |
download | pfsense-a1e4e2a79fce4c734cf3d8e485531f60da5763e8.zip pfsense-a1e4e2a79fce4c734cf3d8e485531f60da5763e8.tar.gz |
Two interfaces, carp, ip aliases might be on the same subnet as their parent. What needs to be checked is the ip itself
Diffstat (limited to 'etc/inc')
-rw-r--r-- | etc/inc/pfsense-utils.inc | 21 | ||||
-rw-r--r-- | etc/inc/util.inc | 11 |
2 files changed, 18 insertions, 14 deletions
diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc index bba28dd..47469d8 100644 --- a/etc/inc/pfsense-utils.inc +++ b/etc/inc/pfsense-utils.inc @@ -2444,6 +2444,15 @@ function is_ipaddr_configured($ipaddr, $ignore_if = "", $check_localip = false, if (ip_in_subnet($ipaddr, $subnet . '/' . $bitmask)) return true; } + + $interface_list_vips = get_configured_vips_list(true); + foreach ($interface_list_vips as $id => $vip) { + if ($ignore_if == "vip_{$id}") + continue; + if (strcasecmp($ipaddr, $vip['ipaddr']) == 0) + return true; + } + } else { $interface_list_ips = get_configured_ip_addresses(); foreach($interface_list_ips as $if => $ilips) { @@ -2454,19 +2463,11 @@ function is_ipaddr_configured($ipaddr, $ignore_if = "", $check_localip = false, } } - $interface_list_vips = get_configured_vips_list(); - foreach($interface_list_vips as $id => $vip) { - if ($ignore_if == "vip_" . $id) - continue; - if (strcasecmp($ipaddr, $vip['ipaddr']) == 0) - return true; - } - if ($check_localip) { - if (isset($config['pptpd']['localip']) && (strcasecmp($ipaddr, $config['pptpd']['localip']) == 0)) + if (is_array($config['pptpd']) && !empty($config['pptpd']['localip']) && (strcasecmp($ipaddr, $config['pptpd']['localip']) == 0)) return true; - if (isset($config['l2tp']['localip']) && (strcasecmp($ipaddr, $config['l2tp']['localip']) == 0)) + if (!is_array($config['l2tp']) && !empty($config['l2tp']['localip']) && (strcasecmp($ipaddr, $config['l2tp']['localip']) == 0)) return true; } diff --git a/etc/inc/util.inc b/etc/inc/util.inc index fb495f4..3c78f95 100644 --- a/etc/inc/util.inc +++ b/etc/inc/util.inc @@ -836,22 +836,24 @@ function get_configured_interface_with_descr($only_opt = false, $withdisabled = */ function get_configured_ip_addresses() { global $config; - require_once("interfaces.inc"); + + if (!function_exists('get_configured_interface_list')) + require_once("interfaces.inc"); $ip_array = array(); $interfaces = get_configured_interface_list(); - if(is_array($interfaces)) { + if (is_array($interfaces)) { foreach($interfaces as $int) { $ipaddr = get_interface_ip($int); $ip_array[$int] = $ipaddr; } } $interfaces = get_configured_carp_interface_list(); - if(is_array($interfaces)) + if (is_array($interfaces)) foreach($interfaces as $int => $ipaddr) $ip_array[$int] = $ipaddr; /* pppoe server */ - if (is_array($config['pppoes']['pppoe'])) { + if (is_array($config['pppoes']) && is_array($config['pppoes']['pppoe'])) { foreach($config['pppoes']['pppoe'] as $pppoe) { if ($pppoe['mode'] == "server") { if(is_ipaddr($pppoe['localip'])) { @@ -861,6 +863,7 @@ function get_configured_ip_addresses() { } } } + return $ip_array; } |