gluon-core: add WPA3 platorm helper
This adds a helper method, which determines if the current platform supports WPA3 or not. WPA3 is supported if - the device is not in the featureset category "tiny" - the WiFi driver supports 802.11w management frame protection
This commit is contained in:
parent
88bed04679
commit
86b5104790
@ -1,5 +1,6 @@
|
||||
local platform_info = require 'platform_info'
|
||||
local util = require 'gluon.util'
|
||||
local unistd = require 'posix.unistd'
|
||||
|
||||
|
||||
local M = setmetatable({}, {
|
||||
@ -55,4 +56,34 @@ function M.is_outdoor_device()
|
||||
return false
|
||||
end
|
||||
|
||||
function M.device_supports_wpa3()
|
||||
-- rt2x00 crashes when enabling WPA3 personal / OWE VAP
|
||||
if M.match('ramips', 'rt305x') or M.match('ramips', 'mt7620') then
|
||||
return false
|
||||
end
|
||||
|
||||
return unistd.access('/lib/gluon/features/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 .. '/'
|
||||
|
||||
if not util.file_contains_line(phypath .. 'hwflags', 'MFP_CAPABLE') then
|
||||
supports_mfp = false
|
||||
end
|
||||
|
||||
idx = idx + 1
|
||||
end)
|
||||
|
||||
return supports_mfp
|
||||
end
|
||||
|
||||
return M
|
||||
|
@ -35,6 +35,15 @@ function M.contains(table, value)
|
||||
return false
|
||||
end
|
||||
|
||||
function M.file_contains_line(path, value)
|
||||
for line in io.lines(path) do
|
||||
if line == value then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function M.add_to_set(t, itm)
|
||||
for _,v in ipairs(t) do
|
||||
if v == itm then return false end
|
||||
|
Loading…
Reference in New Issue
Block a user