Project

General

Profile

Actions

Bug #2261

closed

Spanning Tree interface priority options do not alter Bridge

Added by mike bold over 9 years ago. Updated over 9 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 #1

Updated by Chris Buechler over 9 years ago

  • Category changed from Web Interface to Interfaces
  • Target version set to 2.1
  • Affected Version set to 2.0.1
Actions #2

Updated by Chris Buechler over 9 years ago

  • Status changed from New to Assigned
  • Assignee set to Darren Embry
Actions #3

Updated by Darren Embry over 9 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.

Actions #4

Updated by Darren Embry over 9 years ago

  • Status changed from Feedback to Resolved
  • % Done changed from 0 to 100
Actions #5

Updated by mike bold over 9 years ago

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.

Actions #6

Updated by Darren Embry over 9 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.

Actions #7

Updated by mike bold over 9 years ago

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.

Actions #8

Updated by Darren Embry over 9 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>
Actions #9

Updated by mike bold over 9 years ago

Nice one! That looks good.

Actions #10

Updated by Darren Embry over 9 years ago

  • Status changed from Feedback to Resolved
  • % Done changed from 90 to 100

I'm closing this then.

Actions

Also available in: Atom PDF