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
Updated by Chris Buechler almost 13 years ago
- Category changed from Web Interface to Interfaces
- Target version set to 2.1
- Affected Version set to 2.0.1
Updated by Chris Buechler almost 13 years ago
- Status changed from New to Assigned
- Assignee set to Darren Embry
Updated by Darren Embry almost 13 years ago
- Status changed from Assigned to Feedback
Mike, can you attach your patch please? I think I could figure this one out on my own but would like to see your patch regardless.
Updated by Darren Embry almost 13 years ago
- Status changed from Feedback to Resolved
- % Done changed from 0 to 100
Updated by mike bold almost 13 years ago
- File interfaces_bridge_edit.php interfaces_bridge_edit.php added
- File interfaces.inc interfaces.inc added
Hi Darren, sorry for the delay, I see you have resolved the issue in file interfaces.inc. Nice one!
I also made a few changes to interfaces_bridge_edit.php in order to correctly read/write the priority/path cost settings to the main XML configuration file.
I've attached the changes I made for your perusal.
Updated by Darren Embry almost 13 years ago
- Status changed from Resolved to Feedback
- % Done changed from 100 to 90
Can you attach actual patches (aka diff's) please? I was really hoping for those instead of entire files. :-)
Your attached file seems to be based on an older version of interfaces_bridge_edit; diffing it with current git repos yields too much noise.
Updated by mike bold almost 13 years ago
- File interfaces_bridge_edit.php.diff.txt interfaces_bridge_edit.php.diff.txt added
- File interfaces.inc.diff.txt interfaces.inc.diff.txt added
- File interfaces_ORIG.inc interfaces_ORIG.inc added
- File interfaces_bridge_edit_ORIG.php interfaces_bridge_edit_ORIG.php added
Please find diff's attached.
I don't think they are very easy to read so I've also included the original source files for my installation in case you'd prefer to run your own diff program.
Updated by Darren Embry almost 13 years ago
Thanks, I've committed your changes to interfaces_bridge_edit.php. Here's what XML looks like now:
<ifpriority>wan:111,lan:222</ifpriority> <ifpathcost>wan:333,lan:444</ifpathcost>
Updated by Darren Embry over 12 years ago
- Status changed from Feedback to Resolved
- % Done changed from 90 to 100
I'm closing this then.