gluon-mesh-batman-adv-*: move MTU configuration to version-specific upgrade scripts

This commit is contained in:
Matthias Schiffer 2015-01-24 17:14:18 +01:00
parent 89e14fccac
commit eca1bac23f
3 changed files with 80 additions and 3 deletions

View File

@ -0,0 +1,40 @@
#!/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', 1532)
uci:set('network', mesh .. '_vlan', 'mtu', 1528)
else
uci:set('network', mesh, 'mtu', 1528)
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')

View File

@ -0,0 +1,40 @@
#!/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')

View File

@ -33,14 +33,12 @@ local function configure_radio(radio, index, config)
uci:section('network', 'interface', mesh,
{
proto = 'none',
mtu = '1532',
}
)
uci:section('network', 'interface', mesh .. '_vlan',
{
ifname = '@' .. mesh .. '.' .. config.mesh_vlan,
proto = 'batadv',
mtu = '1528',
mesh = 'bat0',
}
)
@ -48,7 +46,6 @@ local function configure_radio(radio, index, config)
uci:section('network', 'interface', mesh,
{
proto = 'batadv',
mtu = '1528',
mesh = 'bat0',
}
)