diff options
author | Ermal <eri@pfsense.org> | 2010-05-10 10:12:30 +0000 |
---|---|---|
committer | Ermal <eri@pfsense.org> | 2010-05-10 10:12:30 +0000 |
commit | 3fbc3487a663f2e7e6537aa4e6e79b1a30652039 (patch) | |
tree | bc7d471ece2b89396c2333b9eb8105d9ed980cd7 /etc/inc/interfaces.inc | |
parent | 1d002dc97a53a844f82764e535de05bda2d5f067 (diff) | |
download | pfsense-3fbc3487a663f2e7e6537aa4e6e79b1a30652039.zip pfsense-3fbc3487a663f2e7e6537aa4e6e79b1a30652039.tar.gz |
Fix an edge error in getting the carp interfaces reported by Effone.
Diffstat (limited to 'etc/inc/interfaces.inc')
-rw-r--r-- | etc/inc/interfaces.inc | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc index a4e14da..92e5048 100644 --- a/etc/inc/interfaces.inc +++ b/etc/inc/interfaces.inc @@ -2777,22 +2777,18 @@ function link_ip_to_carp_interface($ip) { $carp_ints = ""; if (is_array($config['virtualip']['vip'])) { $first = 0; + $carp_int = array(); foreach ($config['virtualip']['vip'] as $vip) { if ($vip['mode'] == "carp" || $vip['mode'] == "carpdev") { $carp_ip = $vip['subnet']; $carp_sn = $vip['subnet_bits']; $carp_nw = gen_subnet($carp_ip, $carp_sn); - if (ip_in_subnet($ip, "{$carp_nw}/{$carp_sn}")) { - $carp_int = "vip{$vip['vhid']}"; - if (!stristr($carp_ints, $carp_int)) { - if ($first > 0) - $carp_ints .= " "; - $carp_ints .= "{$carp_int}"; - $first++; - } - } + if (ip_in_subnet($ip, "{$carp_nw}/{$carp_sn}")) + $carp_int[] = "vip{$vip['vhid']}"; } } + if (!empty($carp_int)) + $carp_ints = implode(" ", array_unique($carp_int)); } return $carp_ints; |