gluon/package/gluon-client-isolation/luasrc/lib/gluon/upgrade/340-client-isolation
2023-04-03 22:18:14 +02:00

39 lines
1018 B
Lua
Executable File

#!/usr/bin/lua
local site = require 'gluon.site'
local wireless = require 'gluon.wireless'
local isolate = site.mesh.isolate("none")
local uci = require('simple-uci').cursor()
wireless.foreach_radio(uci, function(radio)
local radio_name = radio['.name']
local vif = 'client_' .. radio_name
if uci:get('wireless', vif) then
uci:delete('wireless', vif, 'isolate')
if isolate == "all" or isolate == "wireless" then
uci:set('wireless', vif, 'isolate', '1')
end
end
vif = 'owe_' .. radio_name
if uci:get('wireless', vif) then
uci:delete('wireless', vif, 'isolate')
if isolate == "all" or isolate == "wireless" then
uci:set('wireless', vif, 'isolate', '1')
end
end
end)
uci:save('wireless')
uci:delete('network', 'gluon_bat0', 'ap_isolation')
uci:delete('network', 'gluon_bat0', 'isolation_mark')
if isolate == "all" or isolate == "wireless" then
uci:set('network', 'gluon_bat0', 'ap_isolation', '1')
uci:set('network', 'gluon_bat0', 'isolation_mark', '0x10/0x10')
end
uci:save('network')