Skip to content
Snippets Groups Projects
Unverified Commit 3daacfb9 authored by Matthias Schiffer's avatar Matthias Schiffer Committed by GitHub
Browse files

Merge pull request #2013 from freifunk-gluon/outdoor-setup-ifname

Reuse outdoor device logic for setup mode interface selection, plus some cleanup
parents b842ec43 8807c76a
No related branches found
No related tags found
No related merge requests found
return function(form, uci)
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
return
end
......
......@@ -22,7 +22,7 @@ if sysconfig.gluon_version then
outdoor = false
elseif config == 'preset' then
-- 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
-- enable/disable outdoor mode unconditionally on new installs
outdoor = config
......
......@@ -26,7 +26,10 @@ end
function M.is_outdoor_device()
if M.match('ar71xx', 'generic', {
'bullet-m',
'cpe210',
'cpe510',
'wbs210',
'wbs510',
'lbe-m5',
'loco-m-xw',
'nanostation-m',
......@@ -35,6 +38,7 @@ function M.is_outdoor_device()
'rocket-m-ti',
'rocket-m-xw',
'unifi-outdoor',
'unifi-outdoor-plus',
}) then
return true
......@@ -46,7 +50,10 @@ function M.is_outdoor_device()
M.get_model() == 'Ubiquiti UniFi-AC-MESH-PRO' then
return true
elseif M.match('ath79', 'generic', {'devolo,dvl1750x'}) then
elseif M.match('ath79', 'generic', {
'devolo,dvl1750x',
'tplink,cpe220-v3',
}) then
return true
elseif M.match('ipq40xx', 'generic', {'engenius,ens620ext'}) then
......@@ -66,24 +73,36 @@ function M.device_supports_wpa3()
end
function M.device_supports_mfp(uci)
local idx = 0
local supports_mfp = true
if not M.device_supports_wpa3() then
return false
end
uci:foreach('wireless', 'wifi-device', function()
local phypath = '/sys/kernel/debug/ieee80211/phy' .. idx .. '/'
uci:foreach('wireless', 'wifi-device', function(radio)
local phy = util.find_phy(radio)
local phypath = '/sys/kernel/debug/ieee80211/' .. phy .. '/'
if not util.file_contains_line(phypath .. 'hwflags', 'MFP_CAPABLE') then
supports_mfp = false
return false
end
idx = idx + 1
end)
return supports_mfp
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
......@@ -8,22 +8,15 @@ if sysconfig.setup_ifname then
os.exit(0)
end
if platform.match('ar71xx', 'generic', {
'cpe210',
'cpe510',
'wbs210',
'wbs510',
'airgateway',
'nanostation-m',
'nanostation-m-xw',
'unifi-outdoor-plus',
'uap-pro',
'unifiac-pro'
}) or platform.match('ar71xx', 'mikrotik') then
sysconfig.setup_ifname = sysconfig.config_ifname or sysconfig.wan_ifname or sysconfig.lan_ifname
if platform.is_outdoor_device() or
platform.match('ar71xx', 'generic', {
'airgateway',
'uap-pro',
'unifiac-pro'
}) or
platform.match('ar71xx', 'mikrotik')
then
sysconfig.setup_ifname = sysconfig.wan_ifname or sysconfig.lan_ifname
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
-- Remove the old sysconfig setting
sysconfig.config_ifname = nil
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment