From 8c070c8d55858e64f29551d347aa59e6e523e8fb Mon Sep 17 00:00:00 2001 From: Florian Maurer Date: Sun, 22 Dec 2024 21:20:52 +0100 Subject: [PATCH] gluon-web-wifi-config: remove mesh checkbox if channel is unsupported --- .../lib/gluon/upgrade/320-gluon-client-bridge-wireless | 6 +++--- .../lib/gluon/config-mode/model/admin/wifi-config.lua | 10 +++++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/package/gluon-client-bridge/luasrc/lib/gluon/upgrade/320-gluon-client-bridge-wireless b/package/gluon-client-bridge/luasrc/lib/gluon/upgrade/320-gluon-client-bridge-wireless index 8542c35118..98443bed9e 100755 --- a/package/gluon-client-bridge/luasrc/lib/gluon/upgrade/320-gluon-client-bridge-wireless +++ b/package/gluon-client-bridge/luasrc/lib/gluon/upgrade/320-gluon-client-bridge-wireless @@ -14,7 +14,7 @@ local function is_disabled(config, name) return config.disabled(false) end -local has_client_radio = false +local has_client_only_radio = false local function configure_ap(radio, index, config, radio_name) local name = 'client_' .. radio_name @@ -24,7 +24,7 @@ local function configure_ap(radio, index, config, radio_name) local disabled = is_disabled(ap, name) if not wireless.supports_channel(radio, config.channel()) then - has_client_radio = true + has_client_only_radio = true end uci:delete('wireless', name) @@ -119,7 +119,7 @@ wireless.foreach_radio(uci, function(radio, index, config) configure_owe_transition_mode(config, radio_name) end) -if not sysconfig.gluon_version and has_client_radio then +if not sysconfig.gluon_version and has_client_only_radio then wireless.foreach_radio(uci, function(radio, _, config) local radio_name = radio['.name'] 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 3f0169418a..c927445b4f 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 @@ -95,9 +95,13 @@ uci:foreach('wireless', 'wifi-device', function(config) vif_option('client', {'client', 'owe'}, translate('Enable client network (access point)')) - local mesh_vif = vif_option('mesh', {'mesh'}, translate("Enable mesh network (802.11s)")) - if is_5ghz then - table.insert(mesh_vifs_5ghz, mesh_vif) + -- disable setting mesh iface setting if radio does not support configured mesh channel + if wireless.supports_channel(config, tonumber(config.channel)) then + local mesh_vif = vif_option('mesh', {'mesh'}, translate("Enable mesh network (802.11s)")) + + if is_5ghz then + table.insert(mesh_vifs_5ghz, mesh_vif) + end end local phy = wireless.find_phy(config)