summaryrefslogtreecommitdiffstats
path: root/src/etc/inc
diff options
context:
space:
mode:
authorLuiz Otavio O Souza <luiz@netgate.com>2016-02-16 10:53:04 -0600
committerLuiz Otavio O Souza <luiz@netgate.com>2016-02-16 10:53:35 -0600
commit2a0aef55bc0deaaa81b0321c3d1e9b1b72f77290 (patch)
tree03d84d42c2a641f2571ef97ad946ec2e6411a106 /src/etc/inc
parent985118b8b15bef26c4eb1a11f25373b3a24d0a97 (diff)
downloadpfsense-2a0aef55bc0deaaa81b0321c3d1e9b1b72f77290.zip
pfsense-2a0aef55bc0deaaa81b0321c3d1e9b1b72f77290.tar.gz
Simplify and correct the comments in get_carp_interface_status().
Diffstat (limited to 'src/etc/inc')
-rw-r--r--src/etc/inc/pfsense-utils.inc39
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 "";
OpenPOWER on IntegriCloud