Project

General

Profile

Bug #6692 ยป socket.ipv6_unique_local_address.bug_6692.patch

drbrain (Eric Hodel), 07/10/2012 05:46 AM

View differences:

ext/socket/raddrinfo.c (working copy)
}
/*
* Returns true for IPv6 unique local address (fc00::/7, RFC4193).
* It returns false otherwise.
*/
static VALUE
addrinfo_ipv6_unique_local_p(VALUE self)
{
struct in6_addr *addr = extract_in6_addr(self);
if (addr && IN6_IS_ADDR_UNIQUE_LOCAL(addr)) return Qtrue;
return Qfalse;
}
/*
* Returns true for IPv4-mapped IPv6 address (::ffff:0:0/80).
* It returns false otherwise.
*/
......
rb_define_method(rb_cAddrinfo, "ipv6_multicast?", addrinfo_ipv6_multicast_p, 0);
rb_define_method(rb_cAddrinfo, "ipv6_linklocal?", addrinfo_ipv6_linklocal_p, 0);
rb_define_method(rb_cAddrinfo, "ipv6_sitelocal?", addrinfo_ipv6_sitelocal_p, 0);
rb_define_method(rb_cAddrinfo, "ipv6_unique_local?", addrinfo_ipv6_unique_local_p, 0);
rb_define_method(rb_cAddrinfo, "ipv6_v4mapped?", addrinfo_ipv6_v4mapped_p, 0);
rb_define_method(rb_cAddrinfo, "ipv6_v4compat?", addrinfo_ipv6_v4compat_p, 0);
rb_define_method(rb_cAddrinfo, "ipv6_mc_nodelocal?", addrinfo_ipv6_mc_nodelocal_p, 0);
test/socket/test_addrinfo.rb (working copy)
[:ipv6_v4mapped?, "::ffff:0.0.0.0", "::ffff:255.255.255.255"],
[:ipv6_linklocal?, "fe80::", "febf::"],
[:ipv6_sitelocal?, "fec0::", "feef::"],
[:ipv6_multicast?, "ff00::", "ffff::"]
[:ipv6_multicast?, "ff00::", "ffff::"],
[:ipv6_unique_local?, "fc00::", "fd00::"],
]
mlist = [
[:ipv6_mc_nodelocal?, "ff01::", "ff11::"],
test/socket/test_socket.rb (working copy)
end
when /darwin/
if !ai.ipv6?
elsif ai.ipv6_unique_local?
next true # iCloud addresses do not work, see Bug 6692
elsif ifr_name = ai.ip_address[/%(.*)/, 1]
# Mac OS X may sets IFDISABLED as FreeBSD does
ulSIOCGIFFLAGS = 3223349521
    (1-1/1)