From fc4bc6fd53e8415e974352b3d41b978e3207478e Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 6 Jun 2020 16:58:00 +0200 Subject: [PATCH] gluon-web-wifi-config: make mesh VIF options depend on outdoor=false Instead of relying on the existence of interface sections only (which is still used for the case of interface types that are not configured at all in the site config), add a proper dependency. This fixes section visiblity with enabled outdoor mode after the following fix, and gives the user immediate feedback (allowing to disable outdoor mode and enable meshing in a single step). (cherry picked from commit d012d7d32fa5235fd260efab64142005f8d36c2f) --- .../config-mode/model/admin/wifi-config.lua | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/package/gluon-web-wifi-config/luasrc/lib/gluon/config-mode/model/admin/wifi-config.lua b/package/gluon-web-wifi-config/luasrc/lib/gluon/config-mode/model/admin/wifi-config.lua index 0fb6be37..0d1a5f6a 100644 --- a/package/gluon-web-wifi-config/luasrc/lib/gluon/config-mode/model/admin/wifi-config.lua +++ b/package/gluon-web-wifi-config/luasrc/lib/gluon/config-mode/model/admin/wifi-config.lua @@ -47,13 +47,18 @@ f:section(Section, nil, translate( )) +local mesh_vifs_5ghz = {} + + uci:foreach('wireless', 'wifi-device', function(config) local radio = config['.name'] + local is_5ghz = false local title if config.hwmode == '11g' or config.hwmode == '11ng' then title = translate("2.4GHz WLAN") elseif config.hwmode == '11a' or config.hwmode == '11na' then + is_5ghz = true title = translate("5GHz WLAN") else return @@ -72,10 +77,16 @@ uci:foreach('wireless', 'wifi-device', function(config) function o:write(data) uci:set('wireless', t .. '_' .. radio, 'disabled', not data) end + + return o end vif_option('client', translate('Enable client network (access point)')) - vif_option('mesh', translate("Enable mesh network (802.11s)")) + + local mesh_vif = vif_option('mesh', translate("Enable mesh network (802.11s)")) + if is_5ghz then + table.insert(mesh_vifs_5ghz, mesh_vif) + end local phy = util.find_phy(config) if not phy then @@ -119,6 +130,10 @@ if has_5ghz_radio() then local outdoor = r:option(Flag, 'outdoor', translate("Node will be installed outdoors")) outdoor.default = uci:get_bool('gluon', 'wireless', 'outdoor') + for _, mesh_vif in ipairs(mesh_vifs_5ghz) do + mesh_vif:depends(outdoor, false) + end + function outdoor:write(data) uci:set('gluon', 'wireless', 'outdoor', data) end