How do I force STP to prioritize specific interface?

As the title says, I would like to know how
I am using WDS to configure a wireless bridge. A Tp-link C2600 and a NBG6616 (the latter using non-ct drivers, becase -ct does not work with WDS. If using -ct the links seems ok, but no traffick can pass).
I have configured a link on to different radios (one 2GHz, and 5GHz).
If I enable one of them, everything works perfectly.
But I would like to have both enabled, so there is failover between those two.
So I have enabled stp on one of the ap's.
It works fine. I can disable one of the interfaces of either ap's and after a short time STP reconfigures the interfaces, so the link i working.
BUT: I would like to priority my 5GHz link (phy0-sta0) over 2GHz (phy1-sta0). But when both interfaces are up, stp puts phy0-sta0 in blocking state.
I have tried to lower both port priority and path cost on phy0-sta0 using
root@n5:~# brctl setpathcost br-lan phy0-sta0 70
root@n5:~# brctl setportprio br-lan phy0-sta0 32
Even if it worked, it would not be persistent, because port priority resets to default whenever the interface reconnects, and path cost resets at reboot

I have tried to install ustp (OpenWrt STP/RSTP daemon) - but it doesnt change anything.
As I understand it, stp should automatically configure a lower cost on phy0-sta0, because it has a higher bandwith than phy1-sta0, but in my case, it does not work like that.

Below is some output from uci export (with passwords redacted)

package wireless

config wifi-device 'radio0'
        option type 'mac80211'
        option path 'pci0000:00/0000:00:00.0'
        option channel 'auto'
        option band '5g'
        option htmode 'HT20'
        option cell_density '0'
        option country 'DK'
        option txpower '14'
        option disabled '0'

config wifi-device 'radio1'
        option type 'mac80211'
        option path 'platform/ahb/18100000.wmac'
        option channel '6'
        option band '2g'
        option htmode 'HT40'
        option country 'DK'
        option cell_density '0'
        option disabled '0'

config wifi-iface 'default_radio1'
        option device 'radio1'
        option network 'lan'
        option mode 'ap'
        option ssid 'EEE'
        option encryption 'psk2'
        option key '_redacted_'
        option disabled '1'

config wifi-iface 'wifinet3'
        option device 'radio0'
        option mode 'sta'
        option ssid 'link-n6-5g'
        option encryption 'psk2'
        option key '_redacted_'
        option wds '1'
        option network 'lan'

config wifi-iface 'wifinet5'
        option device 'radio0'
        option mode 'ap'
        option ssid 'n5_5G'
        option encryption 'psk2'
        option key '_redacted_'
        option network 'lan'
        option disabled '1'

config wifi-iface 'wifinet6'
        option device 'radio1'
        option mode 'ap'
        option ssid 'n5_2G'
        option encryption 'psk2'
        option key '_redacted_'
        option network 'lan'
        option disabled '1'

config wifi-iface 'wifinet7'
        option device 'radio0'
        option mode 'ap'
        option ssid 'n5_rad'
        option encryption 'wpa2'
        option auth_server '127.0.0.1'
        option auth_secret '_redacted_'
        option network 'lan'

config wifi-iface 'wifinet2'
        option device 'radio1'
        option mode 'sta'
        option ssid 'link-n6-2g'
        option encryption 'psk2'
        option network 'lan'
        option wpa_psk_file2 '/tmp/wpapsk'
        option key '_redacted_'
        option disabled '0'
        option wds '1'
package network

config interface 'loopback'
        option device 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config globals 'globals'
        option ula_prefix 'fda8:12a5:08dc::/48'
        option packet_steering '1'

config device
        option name 'br-lan'
        option type 'bridge'
        list ports 'eth0.1'
        option stp '1'

config interface 'lan'
        option device 'br-lan'
        option proto 'static'
        option ipaddr '192.168.91.5'
        option netmask '255.255.255.0'
        option ip6assign '60'
        option gateway '192.168.91.1'
        list dns '192.168.91.1'
        list dns_search 'lan'

config interface 'wan'
        option device 'eth1.2'
        option proto 'dhcp'

config interface 'wan6'
        option device 'eth1.2'
        option proto 'dhcpv6'

config switch
        option name 'switch0'
        option reset '1'
        option enable_vlan '1'

config switch_vlan
        option device 'switch0'
        option vlan '1'
        option ports '0t 1 2 3 4'
        option vid '1'

config switch_vlan
        option device 'switch0'
        option vlan '2'
        option ports '6t 5'
        option vid '2'

config device
        option type 'bridge'
        option name 'br-vlan3'

config device
        option name 'phy1-sta0'
root@n5:~# brctl showstp br-lan
br-lan
 bridge id              7fff.e8377a7c19a6
 designated root        7fff.e8377a7c19a6
 root port                 0                    path cost                  0
 max age                  10.00                 bridge max age            10.00
 hello time                1.00                 bridge hello time          1.00
 forward delay             8.00                 bridge forward delay       8.00
 ageing time             300.00
 hello timer               0.00                 tcn timer                  0.00
 topology change timer     0.00                 gc timer                 264.28
 flags


phy1-sta0 (2)
 port id                8002                    state                forwarding
 designated root        7fff.e8377a7c19a6       path cost                100
 designated bridge      7fff.e8377a7c19a6       message age timer          0.00
 designated port        8002                    forward delay timer        0.00
 designated cost           0                    hold timer                 0.00
 flags

phy0-ap0 (3)
 port id                8003                    state                forwarding
 designated root        7fff.e8377a7c19a6       path cost                100
 designated bridge      7fff.e8377a7c19a6       message age timer          0.00
 designated port        8003                    forward delay timer        0.00
 designated cost           0                    hold timer                 0.00
 flags
 hairpin mode              1

phy0-sta0 (4)
 port id                8004                    state                  blocking
 designated root        7fff.e8377a7c19a6       path cost                100
 designated bridge      7fff.e8377a7c19a6       message age timer          0.00
 designated port        8004                    forward delay timer        0.00
 designated cost           0                    hold timer                 0.00
 flags

eth0.1 (1)
 port id                8001                    state                forwarding
 designated root        7fff.e8377a7c19a6       path cost                  5
 designated bridge      7fff.e8377a7c19a6       message age timer          0.00
 designated port        8001                    forward delay timer        0.00
 designated cost           0                    hold timer                 0.00
 flags
root@n5:~# brctl setpathcost br-lan phy0-sta0 70
root@n5:~# brctl setportprio br-lan phy0-sta0 32
root@n5:~# brctl showstp br-lan

br-lan
 bridge id              7fff.e8377a7c19a6
 designated root        7fff.e8377a7c19a6
 root port                 0                    path cost                  0
 max age                  10.00                 bridge max age            10.00
 hello time                1.00                 bridge hello time          1.00
 forward delay             8.00                 bridge forward delay       8.00
 ageing time             300.00
 hello timer               0.00                 tcn timer                  0.00
 topology change timer     0.00                 gc timer                  88.03
 flags


phy1-sta0 (2)
 port id                8002                    state                forwarding
 designated root        7fff.e8377a7c19a6       path cost                100
 designated bridge      7fff.e8377a7c19a6       message age timer          0.00
 designated port        8002                    forward delay timer        0.00
 designated cost           0                    hold timer                 0.00
 flags

phy0-ap0 (3)
 port id                8003                    state                forwarding
 designated root        7fff.e8377a7c19a6       path cost                100
 designated bridge      7fff.e8377a7c19a6       message age timer          0.00
 designated port        8003                    forward delay timer        0.00
 designated cost           0                    hold timer                 0.00
 flags
 hairpin mode              1

phy0-sta0 (4)
 port id                4004                    state                  blocking
 designated root        7fff.e8377a7c19a6       path cost                 70
 designated bridge      7fff.e8377a7c19a6       message age timer          0.00
 designated port        4004                    forward delay timer        0.00
 designated cost           0                    hold timer                 0.00
 flags

eth0.1 (1)
 port id                8001                    state                forwarding
 designated root        7fff.e8377a7c19a6       path cost                  5
 designated bridge      7fff.e8377a7c19a6       message age timer          0.00
 designated port        8001                    forward delay timer        0.00
 designated cost           0                    hold timer                 0.00
 flags

1 Like