Bug #7638
closedCarp Status incorrect - visual bug in webconfigurator interface
100%
Description
There is a bug where if certain high VHID numbers are added before lower numbers, the status on the Status -> CARP (failover) page will show as incorrect for certain vhids due to pattern matching error.
The issue can be reproduced by the following:
Add CARP IP with VHID = 10
Add CARP IP with VHID = 1
Set CARP IP with VHID = 10 to be MASTER. Both CARP IPs will show as MASTER in Status page.
Issue arises because of the a pattern match on the following output of ifconfig:
carp: MASTER vhid 10 advbase 1 advskew 0
carp: BACKUP vhid 1 advbase 1 advskew 150
The following line in pfsense-utils.inc (get_carp_interface_status function) is responsible:
$_gb = exec("/sbin/ifconfig $interface | /usr/bin/grep carp: | /usr/bin/grep \"vhid $vhid\"", $carp_query);
Pattern matching of the grep statement needs to include the termination white space character after the $vhid variable to ensure that the pattern "vhid 1" doesn't match on "vhid 10" in the first line.
Changing this line to the following fixes the error:
$_gb = exec("/sbin/ifconfig $interface | /usr/bin/grep carp: | /usr/bin/grep \"vhid $vhid \"", $carp_query);