From b43f9663c0ac9c328b2d5e915fd3ad03190ca534 Mon Sep 17 00:00:00 2001 From: Christof Schulze Date: Mon, 25 Apr 2016 02:37:17 +0200 Subject: [PATCH] generate temporary config for babel --- .../upgrade/330-gluon-mesh-babel-interfaces | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/package/gluon-mesh-babel/files/lib/gluon/upgrade/330-gluon-mesh-babel-interfaces b/package/gluon-mesh-babel/files/lib/gluon/upgrade/330-gluon-mesh-babel-interfaces index fca7101f..43fdb08c 100755 --- a/package/gluon-mesh-babel/files/lib/gluon/upgrade/330-gluon-mesh-babel-interfaces +++ b/package/gluon-mesh-babel/files/lib/gluon/upgrade/330-gluon-mesh-babel-interfaces @@ -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')