Project

General

Profile

Actions

Bug #2261

closed

Spanning Tree interface priority options do not alter Bridge

Added by mike bold over 12 years ago. Updated over 12 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
Interfaces
Target version:
Start date:
03/06/2012
Due date:
% Done:

100%

Estimated time:
Plus Target Version:
Release Notes:
Affected Version:
2.0.1
Affected Architecture:

Description

Version

pfSense-2.0.1-RELEASE

Description

When trying to set the Spanning Tree interface priority for a Bridge an error occurs.

How to repeat

  1. Select Interfaces -> Assign -> Bridges from the menu.
  2. Click the Plus icon to add a bridge. Select WAN and LAN as the member interfaces.
  3. Click Show Advanced Options button and tick the Enable spanning tree options for this bridge box.
  4. Select WAN and LAN as the STP interfaces.
  5. Enter values of 64 for the WAN and LAN interface Priority.
  6. Click Save.
  7. Now select Status -> System log from the menu. You will see the following error message:

php: /interfaces_bridge_edit.php: The command '/sbin/ifconfig bridge0 ifpriority 64' returned exit code '1', the output was 'ifconfig: 'ifpriority' requires 2 arguments'

Cause

this code in /etc/inc/interfaces.inc is the problem.

if (!empty($bridge['ifpriority'])) {
$pconfig = explode(",", $bridge['ifpriority']);
$ifpriority = array();
foreach ($pconfig as $cfg) {
$embcfg = explode(":", $cfg);
foreach ($embcfg as $key => $value)
$ifpriority[$key] = $value;
}
foreach ($ifpriority as $key => $value) {
$realif = get_real_interface($key);
mwexec("/sbin/ifconfig ${bridgeif} ifpriority {$realif} {$value}");
}
}

I believe it was the programmers intention that the line $embcfg = explode(":", $cfg) would result in an array that looks like this:

$embcfg['WAN']=64
$embcfg['LAN']=64

However what you really end up with is this:

$embcfg[0]='WAN'
$embcfg[1]='64'
$embcfg[2]='LAN'
$embcfg[3]='64'

Solution

I have made some tiny alterations to the code and is now working on my system. If this is accepted as a bug I can provide my code fix if needed. Please also note this same issue effects setting the Path Cost on the Bridge as well.


Files

interfaces_bridge_edit.php (26 KB) interfaces_bridge_edit.php mike bold, 03/22/2012 05:45 AM
interfaces.inc (109 KB) interfaces.inc mike bold, 03/22/2012 05:45 AM
interfaces_bridge_edit.php.diff.txt (70 KB) interfaces_bridge_edit.php.diff.txt mike bold, 03/22/2012 12:12 PM
interfaces.inc.diff.txt (321 KB) interfaces.inc.diff.txt mike bold, 03/22/2012 12:12 PM
interfaces_ORIG.inc (109 KB) interfaces_ORIG.inc original interfaces.inc file in my source download mike bold, 03/22/2012 12:12 PM
interfaces_bridge_edit_ORIG.php (25.7 KB) interfaces_bridge_edit_ORIG.php original interfaces_bridge_edit.php file in my source download mike bold, 03/22/2012 12:12 PM
Actions

Also available in: Atom PDF