gluon/package/gluon-mesh-batman-adv/luasrc/lib/gluon/upgrade/320-gluon-mesh-batman-adv-client-bridge
T-X b3762fc61c gluon-client-bridge: move IPv4 local subnet route to br-client (#1312)
This patch moves the prefix4 subnet route from the local-node veth
device to br-client (while keeping the next node ipv4 address on the
local node device).

This is in preparation to allow routing over the br-client interface
later.
2018-02-16 00:00:12 +01:00

57 lines
1.4 KiB
Lua
Executable File

#!/usr/bin/lua
-- This script must be ordered after 300-gluon-client-bridge-network, as
-- it overrides parts of network.client
local site = require 'gluon.site'
local sysconfig = require 'gluon.sysconfig'
local sysctl = require 'gluon.sysctl'
local util = require 'gluon.util'
local uci = require('simple-uci').cursor()
uci:section('network', 'interface', 'client', {
ipv6 = true,
proto = 'dhcpv6',
reqprefix = 'no',
peerdns = not site.dns.servers(),
sourcefilter = false,
keep_ra_dnslifetime = true,
robustness = 3,
query_interval = 2000,
query_response_interval = 500,
})
uci:delete('network', 'client_lan')
uci:delete('network', 'local_node_route')
uci:section('network', 'route', 'local_node_route', {
interface = 'client',
target = site.prefix4(),
})
uci:delete('network', 'local_node_route6')
uci:section('network', 'route6', 'local_node_route6', {
interface = 'client',
target = site.prefix6(),
gateway = '::',
})
uci:save('network')
local networks = uci:get_list('firewall', 'mesh', 'network')
util.add_to_set(networks, 'client')
uci:set_list('firewall', 'mesh', 'network', networks)
local networks = uci:get_list('firewall', 'drop', 'network')
util.remove_from_set(networks, 'client')
uci:set_list('firewall', 'drop', 'network', networks)
uci:delete('firewall', 'local_node_dns')
uci:save('firewall')
sysctl.set('net.ipv6.conf.local-node.forwarding', 0)