Merge pull request #10077 from chrisroberts/e-ipv6-link-local
Skip link-local addresses when fixing IPv6 route
This commit is contained in:
commit
09c8e2800c
|
@ -43,6 +43,7 @@ module VagrantPlugins
|
||||||
# If we have no IPv6, forget it
|
# If we have no IPv6, forget it
|
||||||
return if !has_v6
|
return if !has_v6
|
||||||
|
|
||||||
|
link_local_range = IPAddr.new("fe80::/10")
|
||||||
host_only_interfaces(env).each do |interface|
|
host_only_interfaces(env).each do |interface|
|
||||||
next if !present?(interface[:ipv6])
|
next if !present?(interface[:ipv6])
|
||||||
next if interface[:status] != "Up"
|
next if interface[:status] != "Up"
|
||||||
|
@ -50,6 +51,8 @@ module VagrantPlugins
|
||||||
ip = IPAddr.new(interface[:ipv6])
|
ip = IPAddr.new(interface[:ipv6])
|
||||||
ip |= ("1" * (128 - interface[:ipv6_prefix].to_i)).to_i(2)
|
ip |= ("1" * (128 - interface[:ipv6_prefix].to_i)).to_i(2)
|
||||||
|
|
||||||
|
next if link_local_range.include?(ip)
|
||||||
|
|
||||||
@logger.info("testing IPv6: #{ip}")
|
@logger.info("testing IPv6: #{ip}")
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
|
|
@ -123,6 +123,23 @@ describe VagrantPlugins::ProviderVirtualBox::Action::NetworkFixIPv6 do
|
||||||
expect(socket).to_not have_received(:connect)
|
expect(socket).to_not have_received(:connect)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "should ignore interfaces with link-local IPv6 address" do
|
||||||
|
all_networks = [{name: "vboxnet0",
|
||||||
|
ipv6: "fe80::ffff:ffff:ffff:ffff",
|
||||||
|
ipv6_prefix: 64,
|
||||||
|
status: 'Up'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
ifaces = { 1 => {type: :hostonly, hostonly: "vboxnet0"}
|
||||||
|
}
|
||||||
|
allow(machine.provider.driver).to receive(:read_network_interfaces)
|
||||||
|
.and_return(ifaces)
|
||||||
|
allow(machine.provider.driver).to receive(:read_host_only_interfaces)
|
||||||
|
.and_return(all_networks)
|
||||||
|
subject.call(env)
|
||||||
|
expect(socket).to_not have_received(:connect)
|
||||||
|
end
|
||||||
|
|
||||||
it "should ignore nat interfaces" do
|
it "should ignore nat interfaces" do
|
||||||
all_networks = [{name: "vboxnet0",
|
all_networks = [{name: "vboxnet0",
|
||||||
ipv6: "",
|
ipv6: "",
|
||||||
|
|
Loading…
Reference in New Issue