#!/usr/bin/lua

local site = require 'gluon.site'
local babelconf='/etc/gluon-babeld.conf'

local file = io.open(babelconf, "w")
file:write("ipv6-subtrees true\n")
file:write("reflect-kernel-metric true\n")
file:write("export-table 254\n")
file:write("import-table 254\n")

file:write("out ip " .. site.next_node.ip6() .. "/128 deny\n")
file:write("redistribute ip " .. site.next_node.ip6() .. "/128 deny\n")
file:write("redistribute ip " .. site.prefix6() .. " eq 128  allow\n")
file:write("redistribute ip " .. site.node_client_prefix6() .. " eq 128  allow\n")
file:write("redistribute ip " .. site.node_prefix6() .. " eq 128  allow\n")
file:write("redistribute ip 2000::/3 allow\n")

file:write("redistribute local if br-wan deny\n")
file:write("redistribute local ip 0.0.0.0/0 deny\n")
file:close()
