From a6c0ad00b28a5d3f91338b50f7e69fbd45f2154e Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Sat, 5 Jun 2021 18:41:39 +0200 Subject: luci-mod-network: allow device declarations and device configs to coexist It is legal to have two device sections referring to the same netdev if one section is a declaration (a section setting option type) and the other is a configuration (a section not specifying a type but matching an existing netdev). Support this case in LuCI since it might be required for some complex device setups. Additionally, fix the device type determination for device configuration sections without type, those should be treated as ethernet (a.k.a. simple device) configuration instead of falling back to the underlying netdev device type. Signed-off-by: Jo-Philipp Wich --- .../htdocs/luci-static/resources/view/network/interfaces.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'modules/luci-mod-network/htdocs/luci-static/resources/view') diff --git a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js index ee946f836e..544cad1aa1 100644 --- a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js +++ b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js @@ -1191,10 +1191,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; -- cgit v1.2.3