Skip to content
Snippets Groups Projects
Unverified Commit b902ddd8 authored by Matthias Schiffer's avatar Matthias Schiffer
Browse files

gluon-next-node: make IPv4 next-node address optional

If next_node.ip4 is not set or gluon-next-node is not used, prefix4 will
now be optional as well.
parent ea95dceb
No related branches found
No related tags found
No related merge requests found
......@@ -19,7 +19,6 @@ need_string 'timezone'
need_string_array('ntp_servers', false)
need_string_match('prefix4', '^%d+.%d+.%d+.%d+/%d+$')
need_string_match('prefix6', '^[%x:]+/%d+$')
......
need_string_match('next_node.ip4', '^%d+.%d+.%d+.%d+$')
if need_string_match('next_node.ip4', '^%d+.%d+.%d+.%d+$', false) then
need_string_match('prefix4', '^%d+.%d+.%d+.%d+/%d+$')
end
need_string_match('next_node.ip6', '^[%x:]+$')
need_string_match('next_node.mac', '^%x[02468aAcCeE]:%x%x:%x%x:%x%x:%x%x:%x%x$')
......@@ -17,14 +17,20 @@ c:section('network', 'device', 'local_node_dev',
}
)
local prefix4 = ip.IPv4(site.prefix4)
local ip4, netmask
if site.next_node.ip4 then
ip4 = site.next_node.ip4
netmask = ip.IPv4(site.prefix4):mask():string()
end
c:delete('network', 'local_node')
c:section('network', 'interface', 'local_node',
{
ifname = 'local-node',
proto = 'static',
ipaddr = site.next_node.ip4,
netmask = prefix4:mask():string(),
ipaddr = ip4,
netmask = netmask,
ip6addr = site.next_node.ip6 .. '/128',
}
)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment