luci-mod-interfaces: simplify configuring MAC address of 802.1q devices
authorJo-Philipp Wich <jo@mein.io>
Sat, 5 Jun 2021 14:16:14 +0000 (16:16 +0200)
committerJo-Philipp Wich <jo@mein.io>
Sat, 5 Jun 2021 14:17:37 +0000 (16:17 +0200)
Treat not explicitly configured, preexisting VLAN interfaces as simple
network devices when adding configuration for them, since it is more
likely that people want to set general device properties such as MAC
address instead of reconfiguring ingress/egress QoS mapping, which is
the only editable property of preexisting VLAN device config dialogs.

Ref: https://github.com/openwrt/luci/issues/5102
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js

index a8e289c480b98089dde0d6190f9eac09138cced8..ee946f836ee5219d630123311209ab1f427e6779 100644 (file)
@@ -1124,6 +1124,18 @@ return view.extend({
                        if (m) {
                                var devtype = getDevType(section_id);
 
+                               /* Treat not explicitly configured, preexisting VLAN interfaces
+                                  as simple network devices when adding configuration for them,
+                                  since it is more likely that people want to set general device
+                                  properties such as MAC address instead of reconfiguring ingress/
+                                  egress QoS mapping, which is the only editable property of
+                                  preexisting VLAN device config dialogs.
+
+                                  Ref: https://github.com/openwrt/luci/issues/5102
+                                */
+                               if (devtype == '8021q')
+                                       devtype = 'ethernet';
+
                                section_id = uci.add('network', 'device');
 
                                uci.set('network', section_id, 'name', m[1]);