Skip link-local addresses when fixing IPv6 route

This occurs with a Linux host when a link-local address is configured
for vboxnet0 (which is the default for VirtualBox 5.2.6).

`connect': Invalid argument - connect(2) for "fe80::ffff:ffff:ffff:ffff" port 80 (Errno::EINVAL)
This commit is contained in:
Cédric Félizard 2018-02-19 13:47:48 +00:00 committed by Chris Roberts
parent 80edb39122
commit f53238d253
1 changed files with 3 additions and 0 deletions

View File

@ -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