Merge pull request #2695 from Kistelini/preserve_channels

gluon-core: preserve channel list for 5G radios
This commit is contained in:
Matthias Schiffer 2023-02-27 23:28:30 +01:00 committed by GitHub
commit a0f8d2ca52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -53,16 +53,12 @@ local function is_outdoor()
end end
local function get_channel(radio, config) local function get_channel(radio, config)
local channel if radio.band == '5g' and is_outdoor() then
if wireless.preserve_channels(uci) then
-- preserved channel always wins
channel = radio.channel
elseif radio.band == '5g' and is_outdoor() then
-- actual channel will be picked and probed from chanlist -- actual channel will be picked and probed from chanlist
channel = 'auto' return 'auto'
end end
return channel or config.channel() return config.channel()
end end
local function get_htmode(radio) local function get_htmode(radio)
@ -179,6 +175,20 @@ local function configure_mesh_wireless(radio, index, config, disabled)
) )
end end
local function set_channels(radio, radio_name, config)
if wireless.preserve_channels(uci) then
return
end
local channel = get_channel(radio, config)
uci:set('wireless', radio_name, 'channel', channel)
local chanlist
if radio.band == '5g' and is_outdoor() then
chanlist = config.outdor_chanlist()
end
uci:set('wireless', radio_name, 'channels', chanlist)
end
wireless.foreach_radio(uci, function(radio, index, config) wireless.foreach_radio(uci, function(radio, index, config)
local radio_name = radio['.name'] local radio_name = radio['.name']
@ -194,13 +204,13 @@ wireless.foreach_radio(uci, function(radio, index, config)
return return
end end
local channel = get_channel(radio, config)
local htmode = get_htmode(radio) local htmode = get_htmode(radio)
local beacon_interval = config.beacon_interval() local beacon_interval = config.beacon_interval()
uci:delete('wireless', radio_name, 'disabled') uci:delete('wireless', radio_name, 'disabled')
uci:set('wireless', radio_name, 'channel', channel) set_channels(radio, radio_name, config)
uci:set('wireless', radio_name, 'htmode', htmode) uci:set('wireless', radio_name, 'htmode', htmode)
uci:set('wireless', radio_name, 'country', site.regdom()) uci:set('wireless', radio_name, 'country', site.regdom())
@ -218,13 +228,10 @@ wireless.foreach_radio(uci, function(radio, index, config)
uci:set_list('wireless', radio_name, 'hostapd_options', hostapd_options) uci:set_list('wireless', radio_name, 'hostapd_options', hostapd_options)
if is_outdoor() then if is_outdoor() then
uci:set('wireless', radio_name, 'channels', config.outdoor_chanlist())
-- enforce outdoor channels by filtering the regdom for outdoor channels -- enforce outdoor channels by filtering the regdom for outdoor channels
uci:set('wireless', radio_name, 'country3', '0x4f') uci:set('wireless', radio_name, 'country3', '0x4f')
configure_mesh_wireless(radio, index, config, true) configure_mesh_wireless(radio, index, config, true)
else else
uci:delete('wireless', radio_name, 'channels')
uci:delete('wireless', radio_name, 'country3') uci:delete('wireless', radio_name, 'country3')
configure_mesh_wireless(radio, index, config) configure_mesh_wireless(radio, index, config)
end end