generate temporary config for babel
This commit is contained in:
parent
be6a6f3746
commit
b43f9663c0
@ -3,6 +3,7 @@
|
||||
local uci = require('luci.model.uci').cursor()
|
||||
local site = require 'gluon.site_config'
|
||||
local interfaces='/lib/gluon/core/mesh_interfaces'
|
||||
local babelconf='/var/etc/gluon-babel.conf'
|
||||
|
||||
if site.mesh_on_wan then
|
||||
uci:section('babeld', 'interface', 'mesh_wan',
|
||||
@ -14,20 +15,29 @@ if site.mesh_on_wan then
|
||||
uci:add_to_set('firewall', 'mesh_babel', 'network', 'wan')
|
||||
end
|
||||
|
||||
uci:delete_all('babeld', 'interface')
|
||||
file = io.open(babelconf, "w")
|
||||
file:write("ipv6-subtrees true\n")
|
||||
file:write("export-table 10\n")
|
||||
file:write("import-table 255\n")
|
||||
file:write("import-table 11\n")
|
||||
|
||||
pcall( function()
|
||||
for interface in io.lines(interfaces) do
|
||||
local section = interface:gsub('[^%w_]','_')
|
||||
uci:section('babeld', 'interface', 'interface_' .. section, { ifname = interface })
|
||||
file:write("interface " .. interface .. "\n")
|
||||
end
|
||||
end)
|
||||
|
||||
file:write(" redistribute ip " .. site.prefix6 .. " eq 128 allow\n")
|
||||
file:write(" redistribute ip " .. site.babel_mesh.prefix .. " eq 128 allow\n")
|
||||
file:write(" redistribute local deny\n")
|
||||
file:write(" redistribute ip ::/0 eq 0 allow\n")
|
||||
file:close()
|
||||
|
||||
|
||||
uci:add_to_set('firewall', 'mesh_babel', 'network', 'client')
|
||||
uci:add_to_set('firewall', 'mesh_babel', 'network', 'local_node4')
|
||||
uci:add_to_set('firewall', 'mesh_babel', 'network', 'local_node6')
|
||||
|
||||
uci:save('babeld')
|
||||
uci:save('firewall')
|
||||
uci:commit('babeld')
|
||||
uci:commit('firewall')
|
||||
|
Loading…
Reference in New Issue
Block a user