diff options
author | Luiz Otavio O Souza <luiz@netgate.com> | 2016-02-16 10:53:04 -0600 |
---|---|---|
committer | Luiz Otavio O Souza <luiz@netgate.com> | 2016-02-16 10:53:35 -0600 |
commit | 2a0aef55bc0deaaa81b0321c3d1e9b1b72f77290 (patch) | |
tree | 03d84d42c2a641f2571ef97ad946ec2e6411a106 | |
parent | 985118b8b15bef26c4eb1a11f25373b3a24d0a97 (diff) | |
download | pfsense-2a0aef55bc0deaaa81b0321c3d1e9b1b72f77290.zip pfsense-2a0aef55bc0deaaa81b0321c3d1e9b1b72f77290.tar.gz |
Simplify and correct the comments in get_carp_interface_status().
-rw-r--r-- | src/etc/inc/pfsense-utils.inc | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/src/etc/inc/pfsense-utils.inc b/src/etc/inc/pfsense-utils.inc index baf163a..42fb321 100644 --- a/src/etc/inc/pfsense-utils.inc +++ b/src/etc/inc/pfsense-utils.inc @@ -415,30 +415,27 @@ function convert_ip_to_network_format($ip, $subnet) { } /* - * get_carp_interface_status($carpinterface): returns the status of a carp ip + * get_carp_interface_status($carpid): returns the status of a carp uniqid */ -function get_carp_interface_status($carpinterface) { - global $config; +function get_carp_interface_status($carpid) { - foreach ($config['virtualip']['vip'] as $carp) { - if ($carp['mode'] != "carp") - continue; - if ($carpinterface !== "_vip{$carp['uniqid']}") - continue; + $carpiface = get_configured_vip_interface($carpid); + if ($carpiface == NULL) + return ""; + $interface = get_real_interface($carpiface); + if ($interface == NULL) + return ""; - $interface = get_real_interface($carp['interface']); - $vhid = $carp['vhid']; - $carp_query = ''; - $_gb = exec("/sbin/ifconfig $interface | /usr/bin/grep carp: | /usr/bin/grep \"vhid $vhid\"", $carp_query); - foreach ($carp_query as $int) { - if (stripos($int, "MASTER")) - return "MASTER"; - elseif (stripos($int, "BACKUP")) - return "BACKUP"; - elseif (stripos($int, "INIT")) - return "INIT"; - } - break; + $vhid = $carp['vhid']; + $carp_query = ''; + $_gb = exec("/sbin/ifconfig $interface | /usr/bin/grep carp: | /usr/bin/grep \"vhid $vhid\"", $carp_query); + foreach ($carp_query as $int) { + if (stripos($int, "MASTER")) + return "MASTER"; + elseif (stripos($int, "BACKUP")) + return "BACKUP"; + elseif (stripos($int, "INIT")) + return "INIT"; } return ""; |