I want to set a per-bridge-port STP parameter (e.g., path cost) for a wireless interface which is added to the bridge dynamically (by hostapd or wpa-supplicant in 4-address mode).
Can some hotplug hook be employed for that? I need the bridge and the interface names... Other ideas?
I have never played with mesh networks, I just need to extend the wireless coverage with another access point and I can't use copper. WDS works mostly fine, except the wireless link between the APs disconnects sometimes (due to EM noise?) and half of the network becomes (temporary) unavailable.
Both APs are 2.4GHz/5GHz dual band and these two links seem to fail independently at random. So the idea is to create a redundant dual-link setup to improve resilience. I have enabled STP and bridged these two interfaces at both ends and this seems to work fine. Now I want to adjust the priorities so that 5GHz link is preferred (when both are available) because it supposedly has more bandwidth...
Keep in mind that only values of exponents to the base of 2 are allowed.
If you have multiple wireless links then IMHO a layer-2 mesh is more suitable.
STP is unaware of the link quality. Like, you have link and signal is ok but the band is shitty. Or you have air collisions.
Olsr or babel are layer-3 but have link quality calculations.
Batman adv is layer-2 but has its own kind of STP called loop avoidance.
Usage: brctl [commands]
commands:
addbr <bridge> add bridge
delbr <bridge> delete bridge
addif <bridge> <device> add interface to bridge
delif <bridge> <device> delete interface from bridge
hairpin <bridge> <port> {on|off} turn hairpin on/off
setageing <bridge> <time> set ageing time
setbridgeprio <bridge> <prio> set bridge priority
setfd <bridge> <time> set bridge forward delay
sethello <bridge> <time> set hello time
setmaxage <bridge> <time> set max message age
setpathcost <bridge> <port> <cost> set path cost
setportprio <bridge> <port> <prio> set port priority
show [ <bridge> ] show a list of bridges
showmacs <bridge> show a list of mac addrs
showstp <bridge> show bridge stp info
stp <bridge> {on|off} turn stp on/off
The bridge "priority" option (=setbridgeprio) is used to select the root bridge.
I'm interested in using setpathcost and/or setportprio options.
I'm not aware of a specific event like add interface to a bridge but see https://openwrt.org/docs/guide-user/base-system/hotplug#iface how to use hot plug events on the bridge. The adding of an interface to a bridge should be more or less instant so you could check if the interface is a part of that bridge after the bridge comes up.
But if your Wi-Fi device is on and off maybe a cronjob which checks every minute the state is an option?
@_bernd thank you. Probably a cron job is the simplest way to go.
Wireless interfaces are added to the bridge after the association/authentication phases. This may happen much later than the bridge comes up.
Another issue is with unpredictable wireless interface names, like phy0-ap1.sta2 or phy3-sta4. How do I map the wifi-device and wifi-iface names from /etc/config/wireless to the low-level linux names?
You can/should set the interface name in the wireless config. eg: option ifname 'my-ifname-1'
Note the maximum length is 15 characters, no spaces, begin with alpha and then alpha-numeric only. (I don't think a period "." is valid but hyphens are)