Merge pull request #5095 from jow-/dhcpv6-rework
[project/luci.git] / modules / luci-mod-network / htdocs / luci-static / resources / view / network / interfaces.js
index bb9e63d1e596d7f369d7662ac7fa7a0726f8a4ec..9b2c9bfd5df21d47a208b23d108b363b9308b235 100644 (file)
@@ -1246,6 +1246,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]);
@@ -1301,10 +1313,11 @@ return view.extend({
                }
 
                function getDevType(section_id) {
-                       var cfgtype = uci.get('network', section_id, 'type'),
-                           dev = getDevice(section_id);
+                       var dev = getDevice(section_id),
+                           cfg = uci.get('network', section_id),
+                           type = cfg ? (uci.get('network', section_id, 'type') || 'ethernet') : (dev ? dev.getType() : '');
 
-                       switch (cfgtype || (dev ? dev.getType() : '')) {
+                       switch (type) {
                        case '':
                                return null;