diff options
author | Luiz Otavio O Souza <luiz@netgate.com> | 2016-02-16 07:48:27 -0600 |
---|---|---|
committer | Luiz Otavio O Souza <luiz@netgate.com> | 2016-02-16 08:05:28 -0600 |
commit | ce94deb04e06d4430e01b51f652d330c5125c4c9 (patch) | |
tree | dc19b0bb26fb0936e9067c97fb53a75036da43fa /src/etc/inc/util.inc | |
parent | 35e1cbdeab83bc9a4cb867638ff4dd2b1d8c0d29 (diff) | |
download | pfsense-ce94deb04e06d4430e01b51f652d330c5125c4c9.zip pfsense-ce94deb04e06d4430e01b51f652d330c5125c4c9.tar.gz |
Implement a switch that allows get_configured_vip_list() return only the selected type of VIP addresses: CARP, IP alias or all VIPs (default).
It seems that a few packages still rely on this.
Ticket #5885
Diffstat (limited to 'src/etc/inc/util.inc')
-rw-r--r-- | src/etc/inc/util.inc | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/etc/inc/util.inc b/src/etc/inc/util.inc index 76cc0d1..c0a0d56 100644 --- a/src/etc/inc/util.inc +++ b/src/etc/inc/util.inc @@ -56,6 +56,10 @@ * */ +define(VIP_ALL, 1); +define(VIP_CARP, 2); +define(VIP_IPALIAS, 3); + /* kill a process by pid file */ function killbypid($pidfile) { return sigkillbypid($pidfile, "TERM"); @@ -1132,7 +1136,7 @@ function is_inrange($test, $start, $end) { return is_ipaddrv6($test) ? is_inrange_v6($test, $start, $end) : is_inrange_v4($test, $start, $end); } -function get_configured_vip_list($family = 'all') { +function get_configured_vip_list($family = 'all', $type = VIP_ALL) { global $config; $list = array(); @@ -1142,8 +1146,16 @@ function get_configured_vip_list($family = 'all') { $viparr = &$config['virtualip']['vip']; foreach ($viparr as $vip) { - if ($vip['mode'] != "carp" && $vip['mode'] != "ipalias") { - continue; + + if ($type == VIP_CARP) { + if ($vip['mode'] != "carp") + continue; + } elseif ($type == VIP_IPALIAS) { + if ($vip['mode'] != "ipalias") + continue; + } else { + if ($vip['mode'] != "carp" && $vip['mode'] != "ipalias") + continue; } if ($family == 'all' || |