This commit is contained in:
Maciej Krüger 2022-04-12 00:20:20 +02:00 committed by Alexander List
parent 214c1e37f4
commit 8479a31ec5
3 changed files with 38 additions and 9 deletions

View File

@ -16,7 +16,7 @@ if not sysconfig.gluon_version then
-- This is needed to distribute devices which have radios
-- capable of operating in the 2.4 GHz and 5 GHz band need
-- to be distributed evenly.
local radio_band_count = {band24=0, band5=0}
local radio_band_count = {band24=0, band5=0, band60=0}
wireless.foreach_radio(uci, function(radio)
local hwmodes = iwinfo.nl80211.hwmodelist(wireless.find_phy(radio))
if hwmodes.g and not (hwmodes.a or hwmodes.ac) then
@ -25,6 +25,8 @@ if not sysconfig.gluon_version then
elseif (hwmodes.a or hwmodes.ac) and not hwmodes.g then
-- 5 GHz
radio_band_count["band5"] = radio_band_count["band5"] + 1
elseif (hwmodes.ad) then
radio_band_count["band60"] = radio_band_count["band60"] + 1
end
end)
@ -223,13 +225,15 @@ local function configure_mesh_wireless(radio, index, config, disabled)
local ibss_disabled = is_disabled('ibss_' .. radio_name)
local mesh_disabled = is_disabled('mesh_' .. radio_name)
configure_ibss(config.ibss(), radio, index, suffix,
first_non_nil(
ibss_disabled,
mesh_disabled,
config.ibss.disabled(false)
if radio.band ~= '60g' then
configure_ibss(config.ibss(), radio, index, suffix,
first_non_nil(
ibss_disabled,
mesh_disabled,
config.ibss.disabled(false)
)
)
)
end
configure_mesh(config.mesh(), radio, index, suffix,
first_non_nil(
mesh_disabled,
@ -291,6 +295,8 @@ wireless.foreach_radio(uci, function(radio, index, config)
configure_mesh_wireless(radio, index, config)
end
elseif (band == '60g') then
configure_mesh_wireless(radio, index, config, true)
end
uci:set('wireless', radio_name, 'beacon_int', beacon_interval)

View File

@ -118,6 +118,8 @@ function M.foreach_radio(uci, f)
f(radio, index, site.wifi24)
elseif band == '5g' then
f(radio, index, site.wifi5)
elseif band == '60g' then
f(radio, index, site.wifi60)
end
end
end
@ -174,4 +176,17 @@ function M.device_uses_11a(uci)
return ret
end
function M.device_uses_ad(uci)
local ret = false
uci:foreach('wireless', 'wifi-device', function(radio)
if radio.band == '60g' then
ret = true
return false
end
end)
return ret
end
return M

View File

@ -43,12 +43,16 @@ uci:foreach('wireless', 'wifi-device', function(config)
local radio = config['.name']
local is_5ghz = false
local is_60ghz = false
local title
if config.band == '2g' then
title = translate("2.4GHz WLAN")
elseif config.band == '5g' then
is_5ghz = true
title = translate("5GHz WLAN")
elseif config.band == '60g' then
is_60ghz = true
title = translate("60Ghz WLAN")
else
return
end
@ -93,8 +97,10 @@ uci:foreach('wireless', 'wifi-device', function(config)
return o
end
vif_option('client', {'client', 'owe'}, translate('Enable client network (access point)'))
vif_option('ibss', {'ibss'}, translate("Enable mesh network (IBSS, outdated)"))
if not is_60ghz then
vif_option('client', {'client', 'owe'}, translate('Enable client network (access point)'))
vif_option('ibss', {'ibss'}, translate("Enable mesh network (IBSS, outdated)"))
end
local mesh_vif = vif_option('mesh', {'mesh'}, translate("Enable mesh network (802.11s)"))
if is_5ghz then
@ -133,6 +139,8 @@ uci:foreach('wireless', 'wifi-device', function(config)
if is_5ghz then
conf = site.wifi5
elseif is_60ghz then
conf = site.wifi60
else
conf = site.wifi24
end