From 89f171b052fbe72aed654d2a1c3d5a24e9bf9902 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ermal=20LU=C3=87I?= Date: Thu, 15 Jan 2015 20:17:46 +0100 Subject: Ticket #3997, teach code to track carp through uniqids(). Missing carp GUI changes and upgrade code --- etc/inc/pfsense-utils.inc | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'etc/inc/pfsense-utils.inc') diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc index 1bfa1a4..a89c151 100644 --- a/etc/inc/pfsense-utils.inc +++ b/etc/inc/pfsense-utils.inc @@ -369,18 +369,16 @@ function convert_ip_to_network_format($ip, $subnet) { * get_carp_interface_status($carpinterface): returns the status of a carp ip */ function get_carp_interface_status($carpinterface) { - $carp_query = ""; - /* XXX: Need to fidn a better way for this! */ - list ($interface, $vhid) = explode("_vip", $carpinterface); $interface = get_real_interface($interface); - exec("/sbin/ifconfig $interface | /usr/bin/grep -v grep | /usr/bin/grep carp: | /usr/bin/grep 'vhid {$vhid}'", $carp_query); + $carp_query = ''; + $_gb = exec("/sbin/ifconfig $interface | /usr/bin/grep -v grep | /usr/bin/grep carp: | /usr/bin/head -n 1", $carp_query); foreach($carp_query as $int) { - if(stristr($int, "MASTER")) + if (stripos($int, "MASTER")) return gettext("MASTER"); - if(stristr($int, "BACKUP")) + if (stripos($int, "BACKUP")) return gettext("BACKUP"); - if(stristr($int, "INIT")) + if (stripos($int, "INIT")) return gettext("INIT"); } return; @@ -2627,7 +2625,7 @@ function is_ipaddr_configured($ipaddr, $ignore_if = "", $check_localip = false, $interface_list_vips = get_configured_vips_list(true); foreach ($interface_list_vips as $id => $vip) { /* Skip CARP interfaces here since they were already checked above */ - if ($id == $ignore_vip_id || (strstr($ignore_if, '_vip') && $ignore_vip_if == $vip['if'])) + if ($id == $ignore_vip_id || (substr($ignore_if, 0, 4) == '_vip') && substr($ignore_vip_if, 5) == $vip['uniqdid'])) continue; if (strcasecmp($ipaddr, $vip['ipaddr']) == 0) return true; -- cgit v1.1