Bug #2261
closedSpanning Tree interface priority options do not alter Bridge
100%
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
- Select Interfaces -> Assign -> Bridges from the menu.
- Click the Plus icon to add a bridge. Select WAN and LAN as the member interfaces.
- Click Show Advanced Options button and tick the Enable spanning tree options for this bridge box.
- Select WAN and LAN as the STP interfaces.
- Enter values of 64 for the WAN and LAN interface Priority.
- Click Save.
- 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