gluon-mesh-batman-adv-*: add gluon_mesh protocol handlers
This commit is contained in:
parent
5cd6295265
commit
b7380decc2
@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
exec /lib/gluon/mesh-batman-adv-core/config_mesh_interface setup 1528
|
@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
exec /lib/gluon/mesh-batman-adv-core/config_mesh_interface teardown
|
@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
exec /lib/gluon/mesh-batman-adv-core/config_mesh_interface setup 1532
|
@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
exec /lib/gluon/mesh-batman-adv-core/config_mesh_interface teardown
|
@ -0,0 +1,44 @@
|
||||
#!/usr/bin/lua
|
||||
|
||||
local util = require 'gluon.util'
|
||||
local fs = require 'nixio.fs'
|
||||
|
||||
|
||||
local ifname = os.getenv('IFNAME')
|
||||
local cmd = arg[1]
|
||||
|
||||
|
||||
if cmd == 'setup' then
|
||||
|
||||
local fixed_mtu = tonumber(os.getenv('FIXED_MTU')) or 0
|
||||
local transitive = tonumber(os.getenv('TRANSITIVE')) or 0
|
||||
|
||||
local mtu = tonumber(arg[2])
|
||||
|
||||
if fixed_mtu == 0 then
|
||||
local lower = fs.glob('/sys/class/net/' .. ifname .. '/lower_*/wireless')()
|
||||
if lower then
|
||||
lower = lower:match('/lower_([^/]+)/wireless$')
|
||||
util.exec('ip', 'link', 'set', 'dev', lower, 'mtu', tostring(mtu+4))
|
||||
end
|
||||
|
||||
util.exec('ip', 'link', 'set', 'dev', ifname, 'mtu', tostring(mtu))
|
||||
end
|
||||
|
||||
local file = assert(io.open('/sys/class/net/' .. ifname .. '/batman_adv/mesh_iface', 'w'))
|
||||
file:write('bat0')
|
||||
file:close()
|
||||
|
||||
file = assert(io.open('/sys/class/net/' .. ifname .. '/batman_adv/no_rebroadcast', 'w'))
|
||||
file:write(tostring(transitive))
|
||||
file:close()
|
||||
|
||||
elseif cmd == 'teardown' then
|
||||
|
||||
local file = io.open('/sys/class/net/' .. ifname .. '/batman_adv/mesh_iface', 'w')
|
||||
if file then
|
||||
file:write('none')
|
||||
file:close()
|
||||
end
|
||||
|
||||
end
|
Loading…
Reference in New Issue
Block a user