Project

General

Profile

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)
1793 1793
}
1794 1794

  
1795 1795
/*
1796
 * Returns true for IPv6 unique local address (fc00::/7, RFC4193).
1797
 * It returns false otherwise.
1798
 */
1799
static VALUE
1800
addrinfo_ipv6_unique_local_p(VALUE self)
1801
{
1802
    struct in6_addr *addr = extract_in6_addr(self);
1803
    if (addr && IN6_IS_ADDR_UNIQUE_LOCAL(addr)) return Qtrue;
1804
    return Qfalse;
1805
}
1806

  
1807
/*
1796 1808
 * Returns true for IPv4-mapped IPv6 address (::ffff:0:0/80).
1797 1809
 * It returns false otherwise.
1798 1810
 */
......
2207 2219
    rb_define_method(rb_cAddrinfo, "ipv6_multicast?", addrinfo_ipv6_multicast_p, 0);
2208 2220
    rb_define_method(rb_cAddrinfo, "ipv6_linklocal?", addrinfo_ipv6_linklocal_p, 0);
2209 2221
    rb_define_method(rb_cAddrinfo, "ipv6_sitelocal?", addrinfo_ipv6_sitelocal_p, 0);
2222
    rb_define_method(rb_cAddrinfo, "ipv6_unique_local?", addrinfo_ipv6_unique_local_p, 0);
2210 2223
    rb_define_method(rb_cAddrinfo, "ipv6_v4mapped?", addrinfo_ipv6_v4mapped_p, 0);
2211 2224
    rb_define_method(rb_cAddrinfo, "ipv6_v4compat?", addrinfo_ipv6_v4compat_p, 0);
2212 2225
    rb_define_method(rb_cAddrinfo, "ipv6_mc_nodelocal?", addrinfo_ipv6_mc_nodelocal_p, 0);
test/socket/test_addrinfo.rb (working copy)
512 512
        [:ipv6_v4mapped?, "::ffff:0.0.0.0", "::ffff:255.255.255.255"],
513 513
        [:ipv6_linklocal?, "fe80::", "febf::"],
514 514
        [:ipv6_sitelocal?, "fec0::", "feef::"],
515
        [:ipv6_multicast?, "ff00::", "ffff::"]
515
        [:ipv6_multicast?, "ff00::", "ffff::"],
516
        [:ipv6_unique_local?, "fc00::", "fd00::"],
516 517
      ]
517 518
      mlist = [
518 519
        [:ipv6_mc_nodelocal?, "ff01::", "ff11::"],
test/socket/test_socket.rb (working copy)
334 334
          end
335 335
        when /darwin/
336 336
          if !ai.ipv6?
337
          elsif ai.ipv6_unique_local?
338
            next true # iCloud addresses do not work, see Bug 6692
337 339
          elsif ifr_name = ai.ip_address[/%(.*)/, 1]
338 340
            # Mac OS X may sets IFDISABLED as FreeBSD does
339 341
            ulSIOCGIFFLAGS = 3223349521