From 81688f0fd9c3ddc57279e6674e331ce0a222e6d6 Mon Sep 17 00:00:00 2001 From: Joe Julian Date: Mon, 13 Jul 2015 15:52:26 -0700 Subject: [PATCH] Allow veryisolated networks With veryisolated networks, there is no ip address assigned thus matching the network name and ip address fails. This allows the null ip address to match a named network when that forward_mode is set. --- lib/vagrant-libvirt/action/create_networks.rb | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/vagrant-libvirt/action/create_networks.rb b/lib/vagrant-libvirt/action/create_networks.rb index 883c83f..6c86afe 100644 --- a/lib/vagrant-libvirt/action/create_networks.rb +++ b/lib/vagrant-libvirt/action/create_networks.rb @@ -116,13 +116,16 @@ module VagrantPlugins # @available_networks should be filled before calling this function. def handle_ip_option(env) return if !@options[:ip] + net_address = nil + if @options[:forward_mode] != 'veryisolated' + net_address = network_address(@options[:ip], @options[:netmask]) + # Set IP address of network (actually bridge). It will be used as + # gateway address for machines connected to this network. + net = IPAddr.new(net_address) + end - net_address = network_address(@options[:ip], @options[:netmask]) @interface_network[:network_address] = net_address - # Set IP address of network (actually bridge). It will be used as - # gateway address for machines connected to this network. - net = IPAddr.new(net_address) # Default to first address (after network name) @interface_network[:ip_address] = @options[:host_ip].nil? ? net.to_range.begin.succ : IPAddr.new(@options[:host_ip])