Project

General

Profile

Bug #7638

Carp Status incorrect - visual bug in webconfigurator interface

Added by Steven Brown about 3 years ago. Updated about 3 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
CARP
Target version:
Start date:
06/11/2017
Due date:
% Done:

100%

Estimated time:
0.10 h
Affected Version:
All
Affected Architecture:
All

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);

Associated revisions

Revision fd4e14b8 (diff)
Added by Jim Pingle about 3 years ago

Match whitespace after $vhid when checking CARP status to avoid partial matches. Fixes #7638
While here, fix variable references with braces and combine the two calls to grep into a single pattern.

Revision 8cb09b29 (diff)
Added by Jim Pingle about 3 years ago

Match whitespace after $vhid when checking CARP status to avoid partial matches. Fixes #7638
While here, fix variable references with braces and combine the two calls to grep into a single pattern.

(cherry picked from commit fd4e14b8853e7a30ee23532d686270cb40d84d03)

Revision ff4034ed (diff)
Added by Jim Pingle about 3 years ago

Match whitespace after $vhid when checking CARP status to avoid partial matches. Fixes #7638
While here, fix variable references with braces and combine the two calls to grep into a single pattern.

(cherry picked from commit fd4e14b8853e7a30ee23532d686270cb40d84d03)
(cherry picked from commit 8cb09b295385faf4a3cd0af6e261cdf6f45b3d36)

History

#2 Updated by Jim Pingle about 3 years ago

  • Status changed from New to Feedback
  • % Done changed from 0 to 100

#3 Updated by Jim Pingle about 3 years ago

  • Category set to CARP
  • Assignee set to Jim Pingle
  • Target version set to 2.3.4-p1
  • Affected Version set to All
  • Affected Architecture All added
  • Affected Architecture deleted ()

#4 Updated by Jim Pingle about 3 years ago

  • Status changed from Feedback to Resolved

Fixed

Also available in: Atom PDF