luci-mod-network: allow wifi bridging with bridge or bridge vlan ifaces
authorJo-Philipp Wich <jo@mein.io>
Wed, 17 Mar 2021 09:45:04 +0000 (10:45 +0100)
committerJo-Philipp Wich <jo@mein.io>
Thu, 18 Mar 2021 16:28:40 +0000 (17:28 +0100)
Recent netifd automatically adds wireless devices as bridge ports if the
layer 2 device referenced by the "config interface" target network is a
Linux network bridge or a VLAN interface on top of a network bridge.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
modules/luci-mod-network/htdocs/luci-static/resources/view/network/wireless.js

index c8a8e5c213b22175f1195a59a8de44dd1b98735e..748cb6254f4aeb67300a2e1130aae894717bb455 100644 (file)
@@ -987,8 +987,17 @@ return view.extend({
                                                                return net || network.addNetwork(name, { proto: 'none' });
                                                        }, this, values[i])).then(L.bind(function(dev, net) {
                                                                if (net) {
-                                                                       if (!net.isEmpty())
-                                                                               net.set('type', 'bridge');
+                                                                       if (!net.isEmpty()) {
+                                                                               var target_dev = net.getDevice();
+
+                                                                               /* Resolve parent interface of vlan */
+                                                                               while (target_dev && target_dev.getType() == 'vlan')
+                                                                                       target_dev = target_dev.getParent();
+
+                                                                               if (!target_dev || target_dev.getType() != 'bridge')
+                                                                                       net.set('type', 'bridge');
+                                                                       }
+
                                                                        net.addDevice(dev);
                                                                }
                                                        }, this, dev)));