#600723 bridge-utils: multiple bridge_pathcost options are not supported

Package:
bridge-utils
Source:
bridge-utils
Description:
Utilities for configuring the Linux Ethernet bridge
Submitter:
Rien Broekstra
Date:
2013-08-29 23:03:05 UTC
Severity:
normal
#600723#5
Date:
2010-10-19 14:40:17 UTC
From:
To:
I try to configure a bridge with different path costs for the ports in the bridge like this in /etc/network/interfaces:

auto mybridge
iface mybridge inet manual
        bridge-ports ctz-priv eth0.3084
        bridge_bridgeprio 1
        bridge_stp yes
        bridge_pathcost ctz-priv 100
        bridge_pathcost eth0.3084 10

Trying to ifup this interface results in:

vpnbox-f2-en1:/etc/network# ifup mybridge
/etc/network/interfaces:39: duplicate option
ifup: couldn't read interfaces file "/etc/network/interfaces"

Can ifup accept multiple options for per-port configuration of a bridge (i.e. path cost and port prio, and maybe waitport)?

#600723#10
Date:
2013-03-13 04:32:17 UTC
From:
To:
The error
" vpnbox-f2-en1:/etc/network# ifup mybridge /etc/network/interfaces:39:
duplicate option ifup: couldn't read interfaces file
"/etc/network/interfaces"

is not seen in 1.5-6.


However there is another error in 1.5-6. Multiple bridge_pathcost lines
in  in /etc/network/interfaces for multiple ports does not work.
Only the last bridge_pathcost line sticks.

This is because env variable IF_BRIDGE_PATHCOST can contain only
pathcost for one bridge port and that happens to be the last pathcost
line for the interface.

Eg:

auto mybridge
iface mybridge inet manual
         bridge-ports ctz-priv eth0.3084
         bridge_bridgeprio 1
         bridge_stp yes
         bridge_pathcost ctz-priv 100
         bridge_pathcost eth0.3084 10

IF_BRIDGE_PATHCOST only contains "eth0.3084 10"

#600723#15
Date:
2013-03-18 17:20:35 UTC
From:
To:

#600723#20
Date:
2013-03-18 18:45:18 UTC
From:
To:
Thanks for your contribution, looks nice at first glance, I'll take a closer
look at it, but I'm afraid it is too late for this to reach wheezy, so we'll
have to make this and other changes for post wheezy.

Regards.

#600723#25
Date:
2013-08-22 22:07:23 UTC
From:
To:
The contributed patch is nice but has a race condition in it; the bridge
if-pre-up.d tests whether the interface is defined, but not whether it
is up yet so when rebooting the brctl setpathcost fails for the
interfaces that aren't there yet.

(I'm reporting from Ubuntu 12.04 but I'm hoping there's not too much
difference)

I have three interfaces on my bridge, two of which are a tap device and
one or both of them consistently fail to have the pathcost applied.


It does work, however, if I port the patch to the if-up.d directory.

M.

#600723#30
Date:
2013-08-29 22:52:00 UTC
From:
To:
I have to retract my previous statement; it does not work perfectly.

In kernels in < 3.11 (I think) the bridge resets its pathcost settings
every time the carrier from a bridged device drops and comes back.

Only since this patch made it into mainline

http://www.spinics.net/lists/linux-ethernet-bridging/msg04818.html

(and again, I'm not really sure when it merged but it was > 3.8 and <
3.11) the bridge remembers the pathcost that you gave it.

I've now worked around it using ifplugd.

M.