gluon-packages/gluon/gluon-mesh-batman-adv-15/files/lib/gluon/upgrade/350-gluon-mesh-batman-adv-15

41 lines
802 B
Lua
Executable File

#!/usr/bin/lua
local site = require 'gluon.site_config'
local uci = require('luci.model.uci').cursor()
local function configure_mtu(radio, config)
local mesh = 'mesh_' .. radio
if config.mesh_vlan then
uci:set('network', mesh, 'mtu', 1536)
uci:set('network', mesh .. '_vlan', 'mtu', 1532)
else
uci:set('network', mesh, 'mtu', 1532)
end
end
local radios = {}
uci:foreach('wireless', 'wifi-device',
function(s)
table.insert(radios, s['.name'])
end
)
for _, radio in ipairs(radios) do
local hwmode = uci:get('wireless', radio, 'hwmode')
if hwmode == '11g' or hwmode == '11ng' then
configure_mtu(radio, site.wifi24)
elseif hwmode == '11a' or hwmode == '11na' then
configure_mtu(radio, site.wifi5)
end
end
uci:save('network')
uci:commit('network')