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)
committerRafał Miłecki <rafal@milecki.pl>
Thu, 27 May 2021 10:19:05 +0000 (12:19 +0200)
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>
(cherry picked from commit 3b4c161e01e2bd19105c123fbec463bc069d637b)

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)));