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.
This commit is contained in:
		
							parent
							
								
									ea95dceb10
								
							
						
					
					
						commit
						b902ddd8df
					
				| @ -19,7 +19,6 @@ need_string 'timezone' | |||||||
| 
 | 
 | ||||||
| need_string_array('ntp_servers', false) | need_string_array('ntp_servers', false) | ||||||
| 
 | 
 | ||||||
| need_string_match('prefix4', '^%d+.%d+.%d+.%d+/%d+$') |  | ||||||
| need_string_match('prefix6', '^[%x:]+/%d+$') | need_string_match('prefix6', '^[%x:]+/%d+$') | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -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.ip6', '^[%x:]+$') | ||||||
| 
 | 
 | ||||||
| need_string_match('next_node.mac', '^%x[02468aAcCeE]:%x%x:%x%x:%x%x:%x%x:%x%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:delete('network', 'local_node') | ||||||
| c:section('network', 'interface', 'local_node', | c:section('network', 'interface', 'local_node', | ||||||
| 	  { | 	  { | ||||||
| 		  ifname = 'local-node', | 		  ifname = 'local-node', | ||||||
| 		  proto = 'static', | 		  proto = 'static', | ||||||
| 		  ipaddr = site.next_node.ip4, | 		  ipaddr = ip4, | ||||||
| 		  netmask = prefix4:mask():string(), | 		  netmask = netmask, | ||||||
| 		  ip6addr = site.next_node.ip6 .. '/128', | 		  ip6addr = site.next_node.ip6 .. '/128', | ||||||
| 	  } | 	  } | ||||||
| ) | ) | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user