diff --git a/package/gluon-config-mode-outdoor/luasrc/lib/gluon/config-mode/wizard/0250-outdoor.lua b/package/gluon-config-mode-outdoor/luasrc/lib/gluon/config-mode/wizard/0250-outdoor.lua index a4753f5a..c36c1f8f 100644 --- a/package/gluon-config-mode-outdoor/luasrc/lib/gluon/config-mode/wizard/0250-outdoor.lua +++ b/package/gluon-config-mode-outdoor/luasrc/lib/gluon/config-mode/wizard/0250-outdoor.lua @@ -1,7 +1,7 @@ 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 diff --git a/package/gluon-core/luasrc/lib/gluon/upgrade/180-outdoors b/package/gluon-core/luasrc/lib/gluon/upgrade/180-outdoors index f9278e1f..5c5a92e2 100755 --- a/package/gluon-core/luasrc/lib/gluon/upgrade/180-outdoors +++ b/package/gluon-core/luasrc/lib/gluon/upgrade/180-outdoors @@ -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 diff --git a/package/gluon-core/luasrc/usr/lib/lua/gluon/platform.lua b/package/gluon-core/luasrc/usr/lib/lua/gluon/platform.lua index 47138958..85f1de76 100644 --- a/package/gluon-core/luasrc/usr/lib/lua/gluon/platform.lua +++ b/package/gluon-core/luasrc/usr/lib/lua/gluon/platform.lua @@ -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 diff --git a/package/gluon-setup-mode/luasrc/lib/gluon/upgrade/320-setup-ifname b/package/gluon-setup-mode/luasrc/lib/gluon/upgrade/320-setup-ifname index 7f0ca7b8..b1c87623 100755 --- a/package/gluon-setup-mode/luasrc/lib/gluon/upgrade/320-setup-ifname +++ b/package/gluon-setup-mode/luasrc/lib/gluon/upgrade/320-setup-ifname @@ -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