Merge pull request #2013 from freifunk-gluon/outdoor-setup-ifname
Reuse outdoor device logic for setup mode interface selection, plus some cleanup
This commit is contained in:
commit
3daacfb92e
@ -1,7 +1,7 @@
|
|||||||
return function(form, uci)
|
return function(form, uci)
|
||||||
local platform = require 'gluon.platform'
|
local platform = require 'gluon.platform'
|
||||||
|
|
||||||
if not platform.is_outdoor_device() then
|
if not (platform.is_outdoor_device() and platform.device_uses_11a(uci)) then
|
||||||
-- only visible on wizard for outdoor devices
|
-- only visible on wizard for outdoor devices
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@ -22,7 +22,7 @@ if sysconfig.gluon_version then
|
|||||||
outdoor = false
|
outdoor = false
|
||||||
elseif config == 'preset' then
|
elseif config == 'preset' then
|
||||||
-- enable outdoor mode through presets on new installs
|
-- enable outdoor mode through presets on new installs
|
||||||
outdoor = platform.is_outdoor_device()
|
outdoor = platform.is_outdoor_device() and platform.device_uses_11a(uci)
|
||||||
else
|
else
|
||||||
-- enable/disable outdoor mode unconditionally on new installs
|
-- enable/disable outdoor mode unconditionally on new installs
|
||||||
outdoor = config
|
outdoor = config
|
||||||
|
@ -26,7 +26,10 @@ end
|
|||||||
function M.is_outdoor_device()
|
function M.is_outdoor_device()
|
||||||
if M.match('ar71xx', 'generic', {
|
if M.match('ar71xx', 'generic', {
|
||||||
'bullet-m',
|
'bullet-m',
|
||||||
|
'cpe210',
|
||||||
'cpe510',
|
'cpe510',
|
||||||
|
'wbs210',
|
||||||
|
'wbs510',
|
||||||
'lbe-m5',
|
'lbe-m5',
|
||||||
'loco-m-xw',
|
'loco-m-xw',
|
||||||
'nanostation-m',
|
'nanostation-m',
|
||||||
@ -35,6 +38,7 @@ function M.is_outdoor_device()
|
|||||||
'rocket-m-ti',
|
'rocket-m-ti',
|
||||||
'rocket-m-xw',
|
'rocket-m-xw',
|
||||||
'unifi-outdoor',
|
'unifi-outdoor',
|
||||||
|
'unifi-outdoor-plus',
|
||||||
}) then
|
}) then
|
||||||
return true
|
return true
|
||||||
|
|
||||||
@ -46,7 +50,10 @@ function M.is_outdoor_device()
|
|||||||
M.get_model() == 'Ubiquiti UniFi-AC-MESH-PRO' then
|
M.get_model() == 'Ubiquiti UniFi-AC-MESH-PRO' then
|
||||||
return true
|
return true
|
||||||
|
|
||||||
elseif M.match('ath79', 'generic', {'devolo,dvl1750x'}) then
|
elseif M.match('ath79', 'generic', {
|
||||||
|
'devolo,dvl1750x',
|
||||||
|
'tplink,cpe220-v3',
|
||||||
|
}) then
|
||||||
return true
|
return true
|
||||||
|
|
||||||
elseif M.match('ipq40xx', 'generic', {'engenius,ens620ext'}) then
|
elseif M.match('ipq40xx', 'generic', {'engenius,ens620ext'}) then
|
||||||
@ -66,24 +73,36 @@ function M.device_supports_wpa3()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function M.device_supports_mfp(uci)
|
function M.device_supports_mfp(uci)
|
||||||
local idx = 0
|
|
||||||
local supports_mfp = true
|
local supports_mfp = true
|
||||||
|
|
||||||
if not M.device_supports_wpa3() then
|
if not M.device_supports_wpa3() then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
uci:foreach('wireless', 'wifi-device', function()
|
uci:foreach('wireless', 'wifi-device', function(radio)
|
||||||
local phypath = '/sys/kernel/debug/ieee80211/phy' .. idx .. '/'
|
local phy = util.find_phy(radio)
|
||||||
|
local phypath = '/sys/kernel/debug/ieee80211/' .. phy .. '/'
|
||||||
|
|
||||||
if not util.file_contains_line(phypath .. 'hwflags', 'MFP_CAPABLE') then
|
if not util.file_contains_line(phypath .. 'hwflags', 'MFP_CAPABLE') then
|
||||||
supports_mfp = false
|
supports_mfp = false
|
||||||
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
idx = idx + 1
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
return supports_mfp
|
return supports_mfp
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function M.device_uses_11a(uci)
|
||||||
|
local ret = false
|
||||||
|
|
||||||
|
uci:foreach('wireless', 'wifi-device', function(radio)
|
||||||
|
if radio.hwmode == '11a' or radio.hwmode == '11na' then
|
||||||
|
ret = true
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
return ret
|
||||||
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
@ -8,22 +8,15 @@ if sysconfig.setup_ifname then
|
|||||||
os.exit(0)
|
os.exit(0)
|
||||||
end
|
end
|
||||||
|
|
||||||
if platform.match('ar71xx', 'generic', {
|
if platform.is_outdoor_device() or
|
||||||
'cpe210',
|
platform.match('ar71xx', 'generic', {
|
||||||
'cpe510',
|
|
||||||
'wbs210',
|
|
||||||
'wbs510',
|
|
||||||
'airgateway',
|
'airgateway',
|
||||||
'nanostation-m',
|
|
||||||
'nanostation-m-xw',
|
|
||||||
'unifi-outdoor-plus',
|
|
||||||
'uap-pro',
|
'uap-pro',
|
||||||
'unifiac-pro'
|
'unifiac-pro'
|
||||||
}) or platform.match('ar71xx', 'mikrotik') then
|
}) or
|
||||||
sysconfig.setup_ifname = sysconfig.config_ifname or sysconfig.wan_ifname or sysconfig.lan_ifname
|
platform.match('ar71xx', 'mikrotik')
|
||||||
|
then
|
||||||
|
sysconfig.setup_ifname = sysconfig.wan_ifname or sysconfig.lan_ifname
|
||||||
else
|
else
|
||||||
sysconfig.setup_ifname = sysconfig.config_ifname or sysconfig.lan_ifname or sysconfig.wan_ifname
|
sysconfig.setup_ifname = sysconfig.lan_ifname or sysconfig.wan_ifname
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Remove the old sysconfig setting
|
|
||||||
sysconfig.config_ifname = nil
|
|
||||||
|
Loading…
Reference in New Issue
Block a user