gluon-core: platform: clean up device_supports_mfp()

- Use util.find_phy()
- Stop foreach() as soon as the result is known
This commit is contained in:
Matthias Schiffer 2020-05-06 23:55:42 +02:00
parent 64725858b4
commit 5ec08d841d
No known key found for this signature in database
GPG Key ID: 16EF3F64CB201D9C

View File

@ -66,21 +66,20 @@ 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