diff options
author | Ermal <eri@pfsense.org> | 2010-06-14 12:11:47 +0000 |
---|---|---|
committer | Ermal <eri@pfsense.org> | 2010-06-14 12:11:47 +0000 |
commit | 7de83e0304565845710a16fdcb7c2abedd7f016a (patch) | |
tree | ea3688252fed37cdaa0b3bbf4f43c9a46df03473 /etc/inc/interfaces.inc | |
parent | 2b6f65d736003028f8def68b325cc10998dc6fea (diff) | |
download | pfsense-7de83e0304565845710a16fdcb7c2abedd7f016a.zip pfsense-7de83e0304565845710a16fdcb7c2abedd7f016a.tar.gz |
Simplify/optimize code for carp [re]configuration. This is possibly related to Ticket #601. Also this speedups vip creation on large number of interfaces.
Diffstat (limited to 'etc/inc/interfaces.inc')
-rw-r--r-- | etc/inc/interfaces.inc | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc index 731d42a..4300d2e 100644 --- a/etc/inc/interfaces.inc +++ b/etc/inc/interfaces.inc @@ -1616,26 +1616,14 @@ function interface_carp_configure(&$vip) { return; } - /* ensure CARP IP really exists prior to loading up */ - /* XXX: this can be bound to only the interface choosen in the carp creation. Not yet since upgrade is needed! */ - $found = false; - $iflist = get_configured_interface_list(); - foreach($iflist as $if) { - $ww_subnet_ip = get_interface_ip($if); - $ww_subnet_bits = get_interface_subnet($if); - if (ip_in_subnet($vip['subnet'], gen_subnet($ww_subnet_ip, $ww_subnet_bits) . "/" . $ww_subnet_bits)) { - $found = true; - break; - } - } - if($found == false) { + /* Ensure CARP IP really exists prior to loading up. */ + $ww_subnet_ip = find_interface_ip($realif); + $ww_subnet_bits = find_interface_subnet($realif); + if (!ip_in_subnet($vip['subnet'], gen_subnet($ww_subnet_ip, $ww_subnet_bits) . "/" . $ww_subnet_bits)) { file_notice("CARP", "Sorry but we could not find a matching real interface subnet for the virtual IP address {$vip['subnet']}.", "Firewall: Virtual IP", ""); return; } - /* invalidate interface cache */ - get_interface_arr(true); - /* create the carp interface and setup */ if (does_interface_exist($vipif)) { pfSense_interface_flags($vipif, -IFF_UP); |