diff --git a/package/gluon-core/check_site.lua b/package/gluon-core/check_site.lua index 3586149e..480b367c 100644 --- a/package/gluon-core/check_site.lua +++ b/package/gluon-core/check_site.lua @@ -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+$') diff --git a/package/gluon-next-node/check_site.lua b/package/gluon-next-node/check_site.lua index 83889a8e..b38de2a4 100644 --- a/package/gluon-next-node/check_site.lua +++ b/package/gluon-next-node/check_site.lua @@ -1,4 +1,7 @@ -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$') diff --git a/package/gluon-next-node/files/lib/gluon/upgrade/400-next-node b/package/gluon-next-node/files/lib/gluon/upgrade/400-next-node index 79cc0369..e8ecfca4 100755 --- a/package/gluon-next-node/files/lib/gluon/upgrade/400-next-node +++ b/package/gluon-next-node/files/lib/gluon/upgrade/400-next-node @@ -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', } )