This commit is contained in:
Christof Schulze 2018-02-15 23:00:18 +00:00 committed by GitHub
commit 5a63712c34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 14 deletions

View File

@ -83,6 +83,7 @@
-- connected to using a known IP address. -- connected to using a known IP address.
next_node = { next_node = {
-- anycast IPs of all nodes -- anycast IPs of all nodes
-- name = { 'nextnode.location.community.example.org', 'nextnode', 'nn' },
ip4 = '10.xxx.0.xxx', ip4 = '10.xxx.0.xxx',
ip6 = 'fdxx:xxxx:xxxx::xxxx', ip6 = 'fdxx:xxxx:xxxx::xxxx',
}, },

View File

@ -163,6 +163,7 @@ next_node \: package
:: ::
next_node = { next_node = {
name = { 'nextnode.location.community.example.org', 'nextnode', 'nn' },
ip4 = '10.23.42.1', ip4 = '10.23.42.1',
ip6 = 'fdca:ffee:babe:1::1', ip6 = 'fdca:ffee:babe:1::1',
mac = '16:41:95:40:f7:dc' mac = '16:41:95:40:f7:dc'
@ -172,7 +173,13 @@ next_node \: package
omitted, there will be no IPv4 or IPv6 anycast address. The MAC address omitted, there will be no IPv4 or IPv6 anycast address. The MAC address
defaults to ``16:41:95:40:f7:dc``; this value usually doesn't need to be defaults to ``16:41:95:40:f7:dc``; this value usually doesn't need to be
changed, but it can be adjusted to match existing deployments that use a changed, but it can be adjusted to match existing deployments that use a
different value. different value. Each entry in the ``name``-field will be resolved to the
IPv4 and IPv6-address.
For this to work, clients must use the next-node as their resolver. In
batman-based networks this requires setting the central DHCP server to
deliver this address as DNS server via DHCP option. When running a radvd
inside the network, this should be set to deliver the next-node
IPv6-address via rdnss.
mesh \: optional mesh \: optional
Options specific to routing protocols. Options specific to routing protocols.

View File

@ -70,6 +70,7 @@ if need_table({'dns'}, nil, false) then
need_number({'dns', 'cacheentries'}, false) need_number({'dns', 'cacheentries'}, false)
end end
need_string_array(in_domain({'next_node', 'name'}), false)
need_string_match(in_domain({'next_node', 'ip6'}), '^[%x:]+$', false) need_string_match(in_domain({'next_node', 'ip6'}), '^[%x:]+$', false)
need_string_match(in_domain({'next_node', 'ip4'}), '^%d+.%d+.%d+.%d+$', false) need_string_match(in_domain({'next_node', 'ip4'}), '^%d+.%d+.%d+.%d+$', false)

View File

@ -25,22 +25,21 @@ if dns.servers then
}) })
end end
if next_node.name and next_node.ip4 then local function set_dns_record(name, ip, sectionname)
uci:section('dhcp', 'domain', 'nextnode4', { if not ip then return end
name = next_node.name, uci:section('dhcp', 'domain', sectionname, {
ip = next_node.ip4, name = name,
ip = ip,
}) })
else
uci:delete('dhcp', 'domain', 'nextnode4')
end end
if next_node.name and next_node.ip6 then uci:delete_all('dhcp', 'domain', function(s)
uci:section('dhcp', 'domain', 'nextnode6', { return (s['.name'] and string.match(s['.name'], "^nextnode[46]"))
name = next_node.name, end)
ip = next_node.ip6,
}) for i, name in ipairs(next_node.name or {}) do
else set_dns_record(name, next_node.ip4, 'nextnode4_' .. i)
uci:delete('dhcp', 'domain', 'nextnode6') set_dns_record(name, next_node.ip6, 'nextnode6_' .. i)
end end
uci:save('dhcp') uci:save('dhcp')