[PATCH-22.03] netifd: fix bridge setting vlan bug for wireless devices
LiXiong Liu
lxliu at ikuai8.com
Mon Sep 12 21:15:21 PDT 2022
When netifd processes device wlanX,
device wlanX may not exist,
or device wlanX has been in bridge BR-LAN in advance,
which will result in bridge addition failure.
A way to reproduce the problem:
config device
option name 'br-lan'
option type 'bridge'
list ports 'lan1'
list ports 'lan2'
list ports 'lan3'
list ports 'lan4'
list ports 'lan5'
list ports 'wlan0'
list ports 'wlan0-1'
list ports 'wlan1'
list ports 'wlan1-1'
config bridge-vlan
option device 'br-lan'
option untagged '1'
option local '1'
option vlan '4094'
list ports 'lan4'
list ports 'lan5'
config bridge-vlan
option device 'br-lan'
option vlan '10'
list ports 'lan1:u*'
list ports 'lan2:u*'
list ports 'wlan1:u*'
list ports 'wlan1-1:u*'
list ports 'lan5:t'
config bridge-vlan
option device 'br-lan'
option vlan '200'
list ports 'wlan0:u*'
list ports 'wlan0-1:u*'
list ports 'lan3:u*'
list ports 'lan5:t'
root at OpenWrt:/# bridge vlan
port vlan-id
lan1 10 PVID Egress Untagged
......
wlan0 200 PVID Egress Untagged
wlan1 10 PVID Egress Untagged
wlan0-1 200 PVID Egress Untagged
wlan1-1 10 PVID Egress Untagged
root at OpenWrt:/# wifi down ; sleep 10 ; wifi
root at OpenWrt:/# bridge vlan
port vlan-id
lan1 10 PVID Egress Untagged
......
wlan0 1 PVID Egress Untagged
wlan1 1 PVID Egress Untagged
wlan0-1 200 PVID Egress Untagged
Signed-off-by: LiXiong Liu <lxliu at ikuai8.com>
---
bridge.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/bridge.c b/bridge.c
index 7e61b9d..9f769ef 100644
--- a/bridge.c
+++ b/bridge.c
@@ -415,9 +415,7 @@ bridge_enable_member(struct bridge_member *bm)
bm->dev.dev->settings.flags |= DEV_OPT_IPV6;
}
- ret = device_claim(&bm->dev);
- if (ret < 0)
- goto error;
+ device_claim(&bm->dev);
dev = bm->dev.dev;
if (dev->settings.auth && !dev->auth_status)
@@ -429,7 +427,6 @@ bridge_enable_member(struct bridge_member *bm)
ret = system_bridge_addif(&bst->dev, bm->dev.dev);
if (ret < 0) {
D(DEVICE, "Bridge device %s could not be added\n", bm->dev.dev->ifname);
- goto error;
}
bm->active = true;
--
1.9.1
More information about the openwrt-devel
mailing list