diff options
author | Jeremy Evans <code@jeremyevans.net> | 2020-08-24 12:39:08 -0700 |
---|---|---|
committer | Jeremy Evans <code@jeremyevans.net> | 2020-11-07 13:47:45 -0800 |
commit | 2f12af42f7f26d570219b87a89294532a86a8ae2 (patch) | |
tree | 77e536c6d1e89cb7fb42842e37c1a33beaaf1988 /lib | |
parent | fcde1e0e626998d75beb561c016fd99bf64d3a79 (diff) | |
download | ruby-2f12af42f7f26d570219b87a89294532a86a8ae2.tar.gz |
Add support for IPv6 link local addresses to resolv
Now that it should work correctly, test that every address returned
by Socket.ip_address_list is resolvable.
Socket works with IPv6 link local addresses, and ipaddr now does
as well, so I think resolv should support them.
Fixes [Bug #17112]
Diffstat (limited to 'lib')
-rw-r--r-- | lib/resolv.rb | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/lib/resolv.rb b/lib/resolv.rb index d50940ad15..2c4f83d212 100644 --- a/lib/resolv.rb +++ b/lib/resolv.rb @@ -2460,13 +2460,38 @@ class Resolv \z/x ## + # IPv6 link local address format fe80:b:c:d:e:f:g:h%em1 + Regex_8HexLinkLocal = /\A + fe80 + (?::[0-9A-Fa-f]{1,4}){7} + %[0-9A-Za-z]+ + \z/x + + ## + # Compressed IPv6 link local address format fe80::b%em1 + + Regex_CompressedHexLinkLocal = /\A + fe80: + (?: + ((?:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4})*)?) :: + ((?:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4})*)?) + | + :((?:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4})*)?) + )? + :[0-9A-Fa-f]{1,4}%[0-9A-Za-z]+ + \z/x + + ## # A composite IPv6 address Regexp. Regex = / (?:#{Regex_8Hex}) | (?:#{Regex_CompressedHex}) | (?:#{Regex_6Hex4Dec}) | - (?:#{Regex_CompressedHex4Dec})/x + (?:#{Regex_CompressedHex4Dec}) | + (?:#{Regex_8HexLinkLocal}) | + (?:#{Regex_CompressedHexLinkLocal}) + /x ## # Creates a new IPv6 address from +arg+ which may be: |