Skip to content
Snippets Groups Projects
300-gluon-client-bridge-network 1.5 KiB
Newer Older
local sysconfig = require 'gluon.sysconfig'
	local plen = site.prefix4:match('/%d+$')
	ip4 = site.next_node.ip4 .. plen
end

if site.next_node.ip6 then
	ip6 = site.next_node.ip6 .. '/128'
end

uci:section('network', 'interface', 'client', {
	type = 'bridge',
	proto = 'static',
	macaddr = site.next_node.mac,
	ipaddr = ip4,
	ip6addr = ip6,
})
uci:delete('network', 'client', 'reqprefix')
uci:delete('network', 'client', 'peerdns')
uci:delete('network', 'client', 'sourcefilter')
uci:delete('network', 'client', 'netmask')
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:set_list('network', 'client', 'ifname', interfaces)

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,
})