From a072a71213fa09af7fbdf5404d311d650a451eb6 Mon Sep 17 00:00:00 2001 From: Kistelini Date: Tue, 8 Nov 2022 10:00:27 +0100 Subject: [PATCH] gluon-core: preserve wireless channel width during updates (#2696) If the uci option 'gluon.wireless.preserve_channels' is set then the channel width of wireless radios (htmode) is preserved during updates, too. --- docs/features/wlan-configuration.rst | 4 ++-- package/gluon-core/luasrc/lib/gluon/upgrade/200-wireless | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/features/wlan-configuration.rst b/docs/features/wlan-configuration.rst index 4f6ea2de..e721954e 100644 --- a/docs/features/wlan-configuration.rst +++ b/docs/features/wlan-configuration.rst @@ -16,8 +16,8 @@ by the user). This means that it is not possible to enable or disable an existin configurations during upgrades. During upgrades the wifi channel of the 2.4GHz and 5GHz radio will be restored to the channel -configured in the site.conf. If you need to preserve a user defined wifi channel during upgrades -you can configure this via the uci section ``gluon-core.wireless``:: +configured in the site.conf. The channel width will be reset to Gluon's default. If you need to preserve +these settings during upgrades you can configure this via the uci section ``gluon-core.wireless``:: uci set gluon.wireless.preserve_channels='1' diff --git a/package/gluon-core/luasrc/lib/gluon/upgrade/200-wireless b/package/gluon-core/luasrc/lib/gluon/upgrade/200-wireless index 871d6810..c93e8169 100755 --- a/package/gluon-core/luasrc/lib/gluon/upgrade/200-wireless +++ b/package/gluon-core/luasrc/lib/gluon/upgrade/200-wireless @@ -66,6 +66,10 @@ local function get_channel(radio, config) end local function get_htmode(radio) + if wireless.preserve_channels(uci) then + return radio.htmode + end + if radio.band == '5g' and is_outdoor() then local outdoor_htmode = uci:get('gluon', 'wireless', 'outdoor_' .. radio['.name'] .. '_htmode') if outdoor_htmode ~= nil then