Skip to content
Snippets Groups Projects
300-gluon-client-bridge-network 1.42 KiB
Newer Older
#!/usr/bin/lua

local sysconfig = require 'gluon.sysconfig'
local sysctl = require 'gluon.sysctl'
local interfaces = uci:get('network', 'client', 'ifname') or {}
if type(interfaces) == 'string' then
	local ifname = interfaces
	interfaces = {}
if sysconfig.lan_ifname and not ifname and not uci:get_bool('network', 'mesh_lan', 'auto') then
	for lanif in sysconfig.lan_ifname:gmatch('%S+') do
uci:delete('network', 'client')
uci:section('network', 'interface', 'client', {
	type = 'bridge',
	ifname = interfaces,
	proto = 'none',
	auto = true,
	ipv6 = false,
	macaddr = sysconfig.primary_mac,
})
uci:delete('firewall', 'client')
uci:section('firewall', 'zone', 'client', {
	name = 'client',
	network = {'client'},
	input = 'DROP',
	output = 'DROP',
	forward = 'DROP',
})

uci:save('firewall')


local dnsmasq = uci:get_first('dhcp', 'dnsmasq')
uci:set('dhcp', dnsmasq, 'boguspriv', false)
uci:set('dhcp', dnsmasq, 'localise_queries', false)
uci:set('dhcp', dnsmasq, 'rebind_protection', false)
uci:section('dhcp', 'dhcp', 'client', {
	interface = 'client',
	ignore = true,
})


sysctl.set('net.ipv6.conf.br-client.forwarding', 0)