Is there a doc to explain how br-lan works?

Hi all,

I'm working on 22.03.5 branch. I try to set up AP mode and add wifi to bridge, like this.

root@agave-0985:~# cat /etc/config/network 

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

config interface 'wwan'
        option proto 'dhcp'

config device
        option name 'br-lan'
        option type 'bridge'
        list ports 'usb0'
        list ports 'wlan0'

config interface 'lan'
        option device 'br-lan'
        option proto 'static'
        option ipaddr '192.168.1.1'
        option netmask '255.255.255.0'

root@agave-0985:~# cat /etc/config/wireless 

config wifi-device 'radio0'
        option type 'mac80211'
        option path 'platform/d800b000.scif/mmc_host/mmc1/mmc1:0001/mmc1:0001:1'
        option channel '1'
        option hwmode '11g'
        option disabled '0'
        option htmode 'HT20'
        option cell_density '0'

config wifi-iface 'wifinet1'
        option encryption 'psk2'
        option device 'radio0'
        option key '741852963'
        option mode 'ap'
        option ssid 'safari'
        option ieee80211w '1'
        option network 'lan'

With above setting, br-lan can not be bring up. I try to debug why. Please help. Thanks.

wifi being attached to LAN is the default ... ?

1 Like

@frollic

Yes, wifi should be attached to LAN by default. Interesting part is bridge has correct interface, but br-lan did not bring up by default. I don't know how to check which part is wrong. Thanks.

Hi @frollic

Just simply the question, following code is okay, usb0 can join bridge with dhcp server.

config interface 'lan'
        option device 'usb0'
        option proto 'static'
        option ipaddr '192.168.1.1'
        option netmask '255.255.255.0'

If I use official way to setup, bridge is always failure.

config device
        option name 'br-lan'
        option type 'bridge'
        list ports 'usb0'

config interface 'lan'
        option device 'br-lan'
        option proto 'static'
        option ipaddr '192.168.1.1'
        option netmask '255.255.255.0'

Any idea to fix this issue? Thanks.

The error from netifd.

<- 4aad5559 #9eec5298           data: {"objid":1629236984,"data":{"interface":[{"interface":"lan","up":false,"pending":false,"available":false,"autostart":true,"dynamic":false,"p
roto":"static","device":"br-lan","data":{},"errors":[{"subsystem":"interface","code":"DEVICE_CLAIM_FAILED"}]},{"interface":"loopback","up":true,"pending":false,"available":true,"
autostart":true,"dynamic":false,"uptime":455,"l3_device":"lo","proto":"static","device":"lo","updated":["addresses"],"metric":0,"dns_metric":0,"delegation":true,"ipv4-address":[{
"address":"127.0.0.1","mask":8}],"ipv6-address":[],"ipv6-prefix":[],"ipv6-prefix-assignment":[],"route":[],"dns-server":[],"dns-search":[],"neighbors":[],"inactive":{"ipv4-addres
s":[],"ipv6-address":[],"route":[],"dns-server":[],"dns-search":[],"neighbors":[]},"data":{}},{"interface":"wwan","up":false,"pending":false,"available":false,"autostart":true,"d
ynamic":false,"proto":"dhcp","data":{},"errors":[{"subsystem":"interface","code":"NO_DEVICE"}]}]}}
-> 9eec5298 #611c2ef8           data: {"objid":1629236984,"data":{"interface":[{"interface":"lan","up":false,"pending":false,"available":false,"autostart":true,"dynamic":false,"p
roto":"static","device":"br-lan","data":{},"errors":[{"subsystem":"interface","code":"DEVICE_CLAIM_FAILED"}]},{"interface":"loopback","up":true,"pending":false,"available":true,"
autostart":true,"dynamic":false,"uptime":455,"l3_device":"lo","proto":"static","device":"lo","updated":["addresses"],"metric":0,"dns_metric":0,"delegation":true,"ipv4-address":[{
"address":"127.0.0.1","mask":8}],"ipv6-address":[],"ipv6-prefix":[],"ipv6-prefix-assignment":[],"route":[],"dns-server":[],"dns-search":[],"neighbors":[],"inactive":{"ipv4-addres
s":[],"ipv6-address":[],"route":[],"dns-server":[],"dns-search":[],"neighbors":[]},"data":{}},{"interface":"wwan","up":false,"pending":false,"available":false,"autostart":true,"d
ynamic":false,"proto":"dhcp","data":{},"errors":[{"subsystem":"interface","code":"NO_DEVICE"}]}]}}

You're in the wrong file. WiFi is attached to a network in /etc/config/wireless and never added to the bridge. wlan0 is just the underlying network interface, the actual interfaces are called something like phy0-ap0. Attaching the phy0-ap0 interface to the correct bridge is, AFAIK, handled by netifd.

1 Like

@andyboeh

Before adding wifi interface into bridge, I would like to use usb0 to try first.
You can see I add usb0 to bridge, but br-lan did not show up. This is the first question I try to resolve.
Thanks.

@vgaetera

Yes, Im sure usb0 is ready. Thanks.

root@ag# ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: usb0: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether ba:65:10:05:79:24 brd ff:ff:ff:ff:ff:ff
3: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc mq qlen 1000
    link/ether 02:01:38:aa:09:85 brd ff:ff:ff:ff:ff:ff

Finally, figure it out, we enable CONFIG_VLAN_8021Q_GVRP and fix this issue. Thanks.

not just this one, but also some other of your posts in this thread sound a bit unusual for the usual out of the box OpenWRT.
…On what device are you? And from where is the firmware file?

@Pico This is a device with camera module from OV solution, it is not usual solution for router.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.