Merge pull request #6659 from swiftstack/change_ipv6_adapter_address
Use <prefix>::1 as the IPv6 adapter IP.
This commit is contained in:
commit
d47c7c74d7
|
@ -290,8 +290,8 @@ module VagrantPlugins
|
||||||
# Default subnet prefix length
|
# Default subnet prefix length
|
||||||
options[:netmask] ||= 64
|
options[:netmask] ||= 64
|
||||||
|
|
||||||
# IPv6 we just mask the address and use that as the adapter
|
# Set adapter IP to <prefix>::1
|
||||||
options[:adapter_ip] ||= ip.mask(options[:netmask].to_i).to_s
|
options[:adapter_ip] ||= (ip.mask(options[:netmask].to_i) | 1).to_s
|
||||||
|
|
||||||
# Append a 6 to the end of the type
|
# Append a 6 to the end of the type
|
||||||
options[:type] = "#{options[:type]}6".to_sym
|
options[:type] = "#{options[:type]}6".to_sym
|
||||||
|
|
|
@ -42,6 +42,34 @@ describe VagrantPlugins::ProviderVirtualBox::Action::Network do
|
||||||
expect(called).to eq(true)
|
expect(called).to eq(true)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "creates a host-only interface with an IPv6 address <prefix>:1" do
|
||||||
|
guest = double("guest")
|
||||||
|
machine.config.vm.network 'private_network', { type: :static, ip: 'dead:beef::100' }
|
||||||
|
#allow(driver).to receive(:read_bridged_interfaces) { [] }
|
||||||
|
allow(driver).to receive(:read_host_only_interfaces) { [] }
|
||||||
|
#allow(driver).to receive(:read_dhcp_servers) { [] }
|
||||||
|
allow(machine).to receive(:guest) { guest }
|
||||||
|
allow(driver).to receive(:create_host_only_network) {{ name: 'vboxnet0' }}
|
||||||
|
allow(guest).to receive(:capability)
|
||||||
|
interface_ip = 'dead:beef::1'
|
||||||
|
|
||||||
|
subject.call(env)
|
||||||
|
|
||||||
|
expect(driver).to have_received(:create_host_only_network).with({
|
||||||
|
adapter_ip: interface_ip,
|
||||||
|
netmask: 64,
|
||||||
|
})
|
||||||
|
|
||||||
|
expect(guest).to have_received(:capability).with(:configure_networks, [{
|
||||||
|
type: :static6,
|
||||||
|
adapter_ip: 'dead:beef::1',
|
||||||
|
ip: 'dead:beef::100',
|
||||||
|
netmask: 64,
|
||||||
|
auto_config: true,
|
||||||
|
interface: nil
|
||||||
|
}])
|
||||||
|
end
|
||||||
|
|
||||||
context "with a dhcp private network" do
|
context "with a dhcp private network" do
|
||||||
let(:bridgedifs) { [] }
|
let(:bridgedifs) { [] }
|
||||||
let(:hostonlyifs) { [] }
|
let(:hostonlyifs) { [] }
|
||||||
|
|
Loading…
Reference in New Issue