From eca1bac23f6c943c71d2eabe352c7032e3617245 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 24 Jan 2015 17:14:18 +0100 Subject: [PATCH] gluon-mesh-batman-adv-*: move MTU configuration to version-specific upgrade scripts --- .../upgrade/350-gluon-mesh-batman-adv-14 | 40 +++++++++++++++++++ .../upgrade/350-gluon-mesh-batman-adv-15 | 40 +++++++++++++++++++ .../320-gluon-mesh-batman-adv-core-wireless | 3 -- 3 files changed, 80 insertions(+), 3 deletions(-) create mode 100755 gluon/gluon-mesh-batman-adv-14/files/lib/gluon/upgrade/350-gluon-mesh-batman-adv-14 create mode 100755 gluon/gluon-mesh-batman-adv-15/files/lib/gluon/upgrade/350-gluon-mesh-batman-adv-15 diff --git a/gluon/gluon-mesh-batman-adv-14/files/lib/gluon/upgrade/350-gluon-mesh-batman-adv-14 b/gluon/gluon-mesh-batman-adv-14/files/lib/gluon/upgrade/350-gluon-mesh-batman-adv-14 new file mode 100755 index 0000000..b3ed1e8 --- /dev/null +++ b/gluon/gluon-mesh-batman-adv-14/files/lib/gluon/upgrade/350-gluon-mesh-batman-adv-14 @@ -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') diff --git a/gluon/gluon-mesh-batman-adv-15/files/lib/gluon/upgrade/350-gluon-mesh-batman-adv-15 b/gluon/gluon-mesh-batman-adv-15/files/lib/gluon/upgrade/350-gluon-mesh-batman-adv-15 new file mode 100755 index 0000000..96f7d31 --- /dev/null +++ b/gluon/gluon-mesh-batman-adv-15/files/lib/gluon/upgrade/350-gluon-mesh-batman-adv-15 @@ -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') diff --git a/gluon/gluon-mesh-batman-adv-core/files/lib/gluon/upgrade/320-gluon-mesh-batman-adv-core-wireless b/gluon/gluon-mesh-batman-adv-core/files/lib/gluon/upgrade/320-gluon-mesh-batman-adv-core-wireless index 98ac4c6..74b40d8 100755 --- a/gluon/gluon-mesh-batman-adv-core/files/lib/gluon/upgrade/320-gluon-mesh-batman-adv-core-wireless +++ b/gluon/gluon-mesh-batman-adv-core/files/lib/gluon/upgrade/320-gluon-mesh-batman-adv-core-wireless @@ -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', } )