diff options
author | Ermal <eri@pfsense.org> | 2013-12-06 19:16:34 +0000 |
---|---|---|
committer | Ermal <eri@pfsense.org> | 2013-12-06 19:16:34 +0000 |
commit | 0c21eb70b6f830e2c1edc06597c2e0bd443ed855 (patch) | |
tree | 44ec1b7260627acf632391edb9814fb5eb5401f0 /etc/inc/util.inc | |
parent | 86c135def224d010ac057f283b3a02f9699cb91a (diff) | |
download | pfsense-0c21eb70b6f830e2c1edc06597c2e0bd443ed855.zip pfsense-0c21eb70b6f830e2c1edc06597c2e0bd443ed855.tar.gz |
Use _vip as identified for CARP vip IPs to allow easier upgrade code. This way only ipaliases on carp need to be upgraded.
Diffstat (limited to 'etc/inc/util.inc')
-rw-r--r-- | etc/inc/util.inc | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/etc/inc/util.inc b/etc/inc/util.inc index 69fcbf5..67646a3 100644 --- a/etc/inc/util.inc +++ b/etc/inc/util.inc @@ -800,7 +800,7 @@ function is_inrange($test, $start, $end) { } /* XXX: return the configured carp interface list */ -function get_configured_carp_interface_list() { +function get_configured_carp_interface_list($carpinterface = "", $family = "inet") { global $config; $iflist = array(); @@ -810,8 +810,16 @@ function get_configured_carp_interface_list() { foreach ($viparr as $vip) { switch ($vip['mode']) { case "carp": - $vipif = get_real_interface($vip['interface']) . "@{$vip['vhid']}"; - $iflist[$vipif] = $vip['subnet']; + if (!empty($carpinterface)) { + if ($carpinterface == "{$vip['interface']}_vip{$vip['vhid']}") { + if ($family == "inet" && is_ipaddrv4($vip['subnet'])) + return $vip['subnet']; + else if ($family == "inet6" && is_ipaddrv6($vip['subnet'])) + return $vip['subnet']; + } + } else { + $iflist["{$vip['interface']}_vip{$vip['vhid']}"] = $vip['subnet']; + } break; } } @@ -849,8 +857,11 @@ function get_configured_vips_list() { if(is_array($config['virtualip']['vip'])) { $viparr = &$config['virtualip']['vip']; - foreach ($viparr as $vip) - $alias_list[] = array("ipaddr" => $vip['subnet'], "if" => $vip['interface']); + foreach ($viparr as $vip) { + if ($vip['mode'] == "carp") + $alias_list[] = array("ipaddr" => $vip['subnet'], "if" => "$vip['interface']}_vip{$vip['vhid']}"); + else + $alias_list[] = array("ipaddr" => $vip['subnet'], "if" => $vip['interface']); } return $alias_list; |