gluon/package/gluon-mesh-wireless-sae/luasrc/lib/gluon/upgrade/205-wireless-mesh-sae
David Bauer a922944fee mesh-wireless-sae: drop unused function parameters
Drop these unused parameters in the function description, as only the
first parameter is referenced within the function block.
2021-05-02 02:20:00 +02:00

30 lines
695 B
Lua
Executable File

#!/usr/bin/lua
local site = require 'gluon.site'
local wireless = require 'gluon.wireless'
local hash = require 'hash'
local uci = require('simple-uci').cursor()
local function configure_sae(vif)
uci:set('wireless', vif, 'encryption', 'sae')
uci:set('wireless', vif, 'key', site.wifi.mesh.sae_passphrase() or hash.md5(site.prefix6()))
end
wireless.foreach_radio(uci, function(radio)
local radio_name = radio['.name']
local vif = 'mesh_' .. radio_name
local enable = site.wifi.mesh.sae(false)
if uci:get('wireless', vif) then
uci:delete('wireless', vif, 'encryption')
uci:delete('wireless', vif, 'key')
if enable then
configure_sae(vif)
end
end
end)
uci:save('wireless')