From d1e6dfb7e3a02ede79224fbce1a3e9772ed81471 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 30 Aug 2016 01:13:34 +0200 Subject: [PATCH] gluon-mesh-batman-adv-*, gluon-mesh-vpn-fastd: configure batman-adv through gluon_mesh proto --- package/gluon-mesh-batman-adv-14/Makefile | 2 - .../upgrade/350-gluon-mesh-batman-adv-14 | 47 ------------------- package/gluon-mesh-batman-adv-15/Makefile | 2 - .../upgrade/350-gluon-mesh-batman-adv-15 | 47 ------------------- .../320-gluon-mesh-batman-adv-core-wireless | 9 ++-- ...330-gluon-mesh-batman-adv-core-mesh-on-wan | 14 +++--- ...340-gluon-mesh-batman-adv-core-mesh-on-lan | 12 ++--- .../lib/gluon/upgrade/400-mesh-vpn-fastd | 14 +++--- 8 files changed, 23 insertions(+), 124 deletions(-) delete mode 100755 package/gluon-mesh-batman-adv-14/luasrc/lib/gluon/upgrade/350-gluon-mesh-batman-adv-14 delete mode 100755 package/gluon-mesh-batman-adv-15/luasrc/lib/gluon/upgrade/350-gluon-mesh-batman-adv-15 diff --git a/package/gluon-mesh-batman-adv-14/Makefile b/package/gluon-mesh-batman-adv-14/Makefile index 504d7c2f..aa53e85f 100644 --- a/package/gluon-mesh-batman-adv-14/Makefile +++ b/package/gluon-mesh-batman-adv-14/Makefile @@ -24,12 +24,10 @@ define Build/Configure endef define Build/Compile - $(call GluonSrcDiet,./luasrc,$(PKG_BUILD_DIR)/luadest/) endef define Package/gluon-mesh-batman-adv-14/install $(CP) ./files/* $(1)/ - $(CP) $(PKG_BUILD_DIR)/luadest/* $(1)/ endef $(eval $(call BuildPackage,gluon-mesh-batman-adv-14)) diff --git a/package/gluon-mesh-batman-adv-14/luasrc/lib/gluon/upgrade/350-gluon-mesh-batman-adv-14 b/package/gluon-mesh-batman-adv-14/luasrc/lib/gluon/upgrade/350-gluon-mesh-batman-adv-14 deleted file mode 100755 index 30e2682b..00000000 --- a/package/gluon-mesh-batman-adv-14/luasrc/lib/gluon/upgrade/350-gluon-mesh-batman-adv-14 +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/lua - -local site = require 'gluon.site_config' - -local uci = require('luci.model.uci').cursor() - - -local function configure_mtu(radio, config, mtu) - if config.ibss then - local network = 'ibss_' .. radio - - if config.ibss.vlan then - uci:set('network', network, 'mtu', mtu + 4) - uci:set('network', network .. '_vlan', 'mtu', mtu) - else - uci:set('network', network, 'mtu', mtu) - end - end - - if config.mesh then - uci:set('network', 'mesh_' .. radio, 'mtu', mtu) - end -end - - -local radios = {} - -uci:foreach('wireless', 'wifi-device', - function(s) - table.insert(radios, s['.name']) - end -) - -local mtu = 1528 - -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, mtu) - elseif hwmode == '11a' or hwmode == '11na' then - configure_mtu(radio, site.wifi5, mtu) - end -end - - -uci:save('network') diff --git a/package/gluon-mesh-batman-adv-15/Makefile b/package/gluon-mesh-batman-adv-15/Makefile index d07d2832..d64fea88 100644 --- a/package/gluon-mesh-batman-adv-15/Makefile +++ b/package/gluon-mesh-batman-adv-15/Makefile @@ -24,12 +24,10 @@ define Build/Configure endef define Build/Compile - $(call GluonSrcDiet,./luasrc,$(PKG_BUILD_DIR)/luadest/) endef define Package/gluon-mesh-batman-adv-15/install $(CP) ./files/* $(1)/ - $(CP) $(PKG_BUILD_DIR)/luadest/* $(1)/ endef $(eval $(call BuildPackage,gluon-mesh-batman-adv-15)) diff --git a/package/gluon-mesh-batman-adv-15/luasrc/lib/gluon/upgrade/350-gluon-mesh-batman-adv-15 b/package/gluon-mesh-batman-adv-15/luasrc/lib/gluon/upgrade/350-gluon-mesh-batman-adv-15 deleted file mode 100755 index 7148d42c..00000000 --- a/package/gluon-mesh-batman-adv-15/luasrc/lib/gluon/upgrade/350-gluon-mesh-batman-adv-15 +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/lua - -local site = require 'gluon.site_config' - -local uci = require('luci.model.uci').cursor() - - -local function configure_mtu(radio, config, mtu) - if config.ibss then - local network = 'ibss_' .. radio - - if config.ibss.vlan then - uci:set('network', network, 'mtu', mtu + 4) - uci:set('network', network .. '_vlan', 'mtu', mtu) - else - uci:set('network', network, 'mtu', mtu) - end - end - - if config.mesh then - uci:set('network', 'mesh_' .. radio, 'mtu', mtu) - end -end - - -local radios = {} - -uci:foreach('wireless', 'wifi-device', - function(s) - table.insert(radios, s['.name']) - end -) - -local mtu = 1532 - -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, mtu) - elseif hwmode == '11a' or hwmode == '11na' then - configure_mtu(radio, site.wifi5, mtu) - end -end - - -uci:save('network') diff --git a/package/gluon-mesh-batman-adv-core/luasrc/lib/gluon/upgrade/320-gluon-mesh-batman-adv-core-wireless b/package/gluon-mesh-batman-adv-core/luasrc/lib/gluon/upgrade/320-gluon-mesh-batman-adv-core-wireless index 217fbe6a..9e23eb39 100755 --- a/package/gluon-mesh-batman-adv-core/luasrc/lib/gluon/upgrade/320-gluon-mesh-batman-adv-core-wireless +++ b/package/gluon-mesh-batman-adv-core/luasrc/lib/gluon/upgrade/320-gluon-mesh-batman-adv-core-wireless @@ -48,15 +48,13 @@ local function configure_ibss(config, radio, index, suffix, disabled) uci:section('network', 'interface', name .. '_vlan', { ifname = '@' .. name .. '.' .. config.vlan, - proto = 'batadv', - mesh = 'bat0', + proto = 'gluon_mesh', } ) else uci:section('network', 'interface', name, { - proto = 'batadv', - mesh = 'bat0', + proto = 'gluon_mesh', } ) end @@ -95,8 +93,7 @@ local function configure_mesh(config, radio, index, suffix, disabled) uci:section('network', 'interface', name, { - proto = 'batadv', - mesh = 'bat0', + proto = 'gluon_mesh', } ) diff --git a/package/gluon-mesh-batman-adv-core/luasrc/lib/gluon/upgrade/330-gluon-mesh-batman-adv-core-mesh-on-wan b/package/gluon-mesh-batman-adv-core/luasrc/lib/gluon/upgrade/330-gluon-mesh-batman-adv-core-mesh-on-wan index 7a964ee2..eefa8d0f 100755 --- a/package/gluon-mesh-batman-adv-core/luasrc/lib/gluon/upgrade/330-gluon-mesh-batman-adv-core-mesh-on-wan +++ b/package/gluon-mesh-batman-adv-core/luasrc/lib/gluon/upgrade/330-gluon-mesh-batman-adv-core-mesh-on-wan @@ -6,13 +6,13 @@ local uci = require 'luci.model.uci' local c = uci.cursor() if not c:get('network', 'mesh_wan') then - c:section('network', 'interface', 'mesh_wan', - { ifname = 'br-wan' - , proto = 'batadv' - , mesh = 'bat0' - , mesh_no_rebroadcast = '1' - , auto = site.mesh_on_wan and 1 or 0 - }) + c:section('network', 'interface', 'mesh_wan', { + ifname = 'br-wan', + proto = 'gluon_mesh', + transitive = 1, + fixed_mtu = 1, + auto = site.mesh_on_wan and 1 or 0, + }) end c:save('network') diff --git a/package/gluon-mesh-batman-adv-core/luasrc/lib/gluon/upgrade/340-gluon-mesh-batman-adv-core-mesh-on-lan b/package/gluon-mesh-batman-adv-core/luasrc/lib/gluon/upgrade/340-gluon-mesh-batman-adv-core-mesh-on-lan index 116944f8..5df00909 100755 --- a/package/gluon-mesh-batman-adv-core/luasrc/lib/gluon/upgrade/340-gluon-mesh-batman-adv-core-mesh-on-lan +++ b/package/gluon-mesh-batman-adv-core/luasrc/lib/gluon/upgrade/340-gluon-mesh-batman-adv-core-mesh-on-lan @@ -12,13 +12,13 @@ if not sysconfig.lan_ifname then end uci:section('network', 'interface', 'mesh_lan', { - ifname = sysconfig.lan_ifname, - type = 'bridge', + ifname = sysconfig.lan_ifname, + type = 'bridge', igmp_snooping = 0, - proto = 'batadv', - mesh = 'bat0', - mesh_no_rebroadcast = '1', - macaddr = util.get_mac(2), + proto = 'gluon_mesh', + transitive = 1, + fixed_mtu = 1, + macaddr = util.get_mac(2), }) if uci:get('network', 'mesh_lan', 'auto') == nil then diff --git a/package/gluon-mesh-vpn-fastd/luasrc/lib/gluon/upgrade/400-mesh-vpn-fastd b/package/gluon-mesh-vpn-fastd/luasrc/lib/gluon/upgrade/400-mesh-vpn-fastd index e660db9e..2fd35a1f 100755 --- a/package/gluon-mesh-vpn-fastd/luasrc/lib/gluon/upgrade/400-mesh-vpn-fastd +++ b/package/gluon-mesh-vpn-fastd/luasrc/lib/gluon/upgrade/400-mesh-vpn-fastd @@ -122,13 +122,13 @@ uci:save('fastd') uci:section('network', 'interface', 'mesh_vpn', - { - ifname = 'mesh-vpn', - proto = 'batadv', - mesh = 'bat0', - mesh_no_rebroadcast = 1, - macaddr = util.get_mac(3), - } + { + ifname = 'mesh-vpn', + proto = 'gluon_mesh', + transitive = 1, + fixed_mtu = 1, + macaddr = util.get_mac(3), + } ) uci:save('network')