gluon-mesh-batman-adv-*, gluon-mesh-vpn-fastd: configure batman-adv through gluon_mesh proto

This commit is contained in:
Matthias Schiffer 2016-08-30 01:13:34 +02:00
parent b7380decc2
commit d1e6dfb7e3
No known key found for this signature in database
GPG Key ID: 16EF3F64CB201D9C
8 changed files with 23 additions and 124 deletions

View File

@ -24,12 +24,10 @@ define Build/Configure
endef endef
define Build/Compile define Build/Compile
$(call GluonSrcDiet,./luasrc,$(PKG_BUILD_DIR)/luadest/)
endef endef
define Package/gluon-mesh-batman-adv-14/install define Package/gluon-mesh-batman-adv-14/install
$(CP) ./files/* $(1)/ $(CP) ./files/* $(1)/
$(CP) $(PKG_BUILD_DIR)/luadest/* $(1)/
endef endef
$(eval $(call BuildPackage,gluon-mesh-batman-adv-14)) $(eval $(call BuildPackage,gluon-mesh-batman-adv-14))

View File

@ -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')

View File

@ -24,12 +24,10 @@ define Build/Configure
endef endef
define Build/Compile define Build/Compile
$(call GluonSrcDiet,./luasrc,$(PKG_BUILD_DIR)/luadest/)
endef endef
define Package/gluon-mesh-batman-adv-15/install define Package/gluon-mesh-batman-adv-15/install
$(CP) ./files/* $(1)/ $(CP) ./files/* $(1)/
$(CP) $(PKG_BUILD_DIR)/luadest/* $(1)/
endef endef
$(eval $(call BuildPackage,gluon-mesh-batman-adv-15)) $(eval $(call BuildPackage,gluon-mesh-batman-adv-15))

View File

@ -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')

View File

@ -48,15 +48,13 @@ local function configure_ibss(config, radio, index, suffix, disabled)
uci:section('network', 'interface', name .. '_vlan', uci:section('network', 'interface', name .. '_vlan',
{ {
ifname = '@' .. name .. '.' .. config.vlan, ifname = '@' .. name .. '.' .. config.vlan,
proto = 'batadv', proto = 'gluon_mesh',
mesh = 'bat0',
} }
) )
else else
uci:section('network', 'interface', name, uci:section('network', 'interface', name,
{ {
proto = 'batadv', proto = 'gluon_mesh',
mesh = 'bat0',
} }
) )
end end
@ -95,8 +93,7 @@ local function configure_mesh(config, radio, index, suffix, disabled)
uci:section('network', 'interface', name, uci:section('network', 'interface', name,
{ {
proto = 'batadv', proto = 'gluon_mesh',
mesh = 'bat0',
} }
) )

View File

@ -6,12 +6,12 @@ local uci = require 'luci.model.uci'
local c = uci.cursor() local c = uci.cursor()
if not c:get('network', 'mesh_wan') then if not c:get('network', 'mesh_wan') then
c:section('network', 'interface', 'mesh_wan', c:section('network', 'interface', 'mesh_wan', {
{ ifname = 'br-wan' ifname = 'br-wan',
, proto = 'batadv' proto = 'gluon_mesh',
, mesh = 'bat0' transitive = 1,
, mesh_no_rebroadcast = '1' fixed_mtu = 1,
, auto = site.mesh_on_wan and 1 or 0 auto = site.mesh_on_wan and 1 or 0,
}) })
end end

View File

@ -15,9 +15,9 @@ uci:section('network', 'interface', 'mesh_lan', {
ifname = sysconfig.lan_ifname, ifname = sysconfig.lan_ifname,
type = 'bridge', type = 'bridge',
igmp_snooping = 0, igmp_snooping = 0,
proto = 'batadv', proto = 'gluon_mesh',
mesh = 'bat0', transitive = 1,
mesh_no_rebroadcast = '1', fixed_mtu = 1,
macaddr = util.get_mac(2), macaddr = util.get_mac(2),
}) })

View File

@ -124,9 +124,9 @@ uci:save('fastd')
uci:section('network', 'interface', 'mesh_vpn', uci:section('network', 'interface', 'mesh_vpn',
{ {
ifname = 'mesh-vpn', ifname = 'mesh-vpn',
proto = 'batadv', proto = 'gluon_mesh',
mesh = 'bat0', transitive = 1,
mesh_no_rebroadcast = 1, fixed_mtu = 1,
macaddr = util.get_mac(3), macaddr = util.get_mac(3),
} }
) )