diff options
-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 ""; |