Project

General

Profile

Actions

Bug #6692

closed

TestSocket::test_udp_server always fails on OS X with Back to my Mac enabled

Added by drbrain (Eric Hodel) over 11 years ago. Updated over 11 years ago.

Status:
Closed
Target version:
ruby -v:
-
Backport:
[ruby-core:46159]

Description

=begin
OS X ships with a feature to create a VPN between all your Mac computers.

This creates an extra utun interface for the tunnel and a unique local IPv6 unicast addresses on the loopback interface:

lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
options=3<RXCSUM,TXCSUM>
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1
inet 127.0.0.1 netmask 0xff000000
inet6 ::1 prefixlen 128
inet6 fd92:5aed:a1b2:7539:129a:ddff:fe49:be28 prefixlen 128

(I have invalidated this address)

test_udp_server discovers the addresses for the local machine and attempts to send a UDP message to them. Unfortunately the Back to my Mac address does not respond to any communication:

$ ping6 -c 10 fd92:5aed:a1b2:7539:129a:ddff:fe49:be28
PING6(56=40+8+8 bytes) fd92:5aed:a1b2:7539:129a:ddff:fe49:be28 --> fd92:5aed:a1b2:7539:129a:ddff:fe49:be28

--- fd92:5aed:a1b2:7539:129a:ddff:fe49:be28 ping6 statistics ---
10 packets transmitted, 0 packets received, 100.0% packet loss

So the test always fails:

$ make test-all TESTS='socket -n test_udp_server'
[…]

Running tests:

[1/1] TestSocket#test_udp_server = 10.01 s
1) Error:
test_udp_server(TestSocket):
RuntimeError: no response from #<Addrinfo: fd92:5aed:a1b2:7539:129a:ddff:fe49:be28>
/Users/drbrain/Work/svn/ruby/trunk/test/socket/test_socket.rb:375:in block (3 levels) in test_udp_server' /Users/drbrain/Work/svn/ruby/trunk/.ext/common/socket.rb:68:in connect_internal'
/Users/drbrain/Work/svn/ruby/trunk/.ext/common/socket.rb:135:in connect' /Users/drbrain/Work/svn/ruby/trunk/test/socket/test_socket.rb:371:in block (2 levels) in test_udp_server'
/Users/drbrain/Work/svn/ruby/trunk/test/socket/test_socket.rb:370:in each' /Users/drbrain/Work/svn/ruby/trunk/test/socket/test_socket.rb:370:in block in test_udp_server'
/Users/drbrain/Work/svn/ruby/trunk/.ext/common/socket.rb:628:in udp_server_sockets' /Users/drbrain/Work/svn/ruby/trunk/test/socket/test_socket.rb:309:in test_udp_server'

Finished tests in 10.021782s, 0.0998 tests/s, 0.3991 assertions/s.
1 tests, 4 assertions, 0 failures, 1 errors, 0 skips

ruby -v: ruby 2.0.0dev (2012-07-04 trunk 36295) [x86_64-darwin11.4.0]

I'm unsure how to filter the Back to my Mac address to allow this test to pass.

To reproduce this test failure, get a Mac and enable Back to my Mac in the iCloud (10.7) or MobileMe (10.6 and earlier) preference pane, then run:

make test-all TESTS='socket -n test_udp_server'

=end


Files


Related issues 1 (0 open1 closed)

Related to Ruby master - Bug #5151: test/socket/test_socket.rb fail when udp connection failedClosedmrkn (Kenta Murata)08/03/2011Actions

Updated by naruse (Yui NARUSE) over 11 years ago

I notice the existence of this issue for year but can't understand how to reproduce and fix.

Now your info, enabling iCloud, reproduces this, thanks!
But I still cannot understand the reason why ruby can't communicate with the address
though we can avoid this with a workaround: skip IPv6 addresses begin with fdXX on Mac OS X.

Updated by drbrain (Eric Hodel) over 11 years ago

netstat says this about the iCloud route:

fd92::[…] link#1 UHL lo0

So there's no reason it shouldn't work that I can see.

I think skipping IPv6 addresses for fc00::/7 is the best solution.

The attached patch adds Addrinfo#ipv6_unique_local? and uses it in test_udp_server

Since the C macro has an underscore before local (unlike LINKLOCAL) I placed it in the ruby method as well.

Updated by naruse (Yui NARUSE) over 11 years ago

drbrain (Eric Hodel) wrote:

netstat says this about the iCloud route:

fd92::[…] link#1 UHL lo0

So there's no reason it shouldn't work that I can see.

I think skipping IPv6 addresses for fc00::/7 is the best solution.

The attached patch adds Addrinfo#ipv6_unique_local? and uses it in test_udp_server

Since the C macro has an underscore before local (unlike LINKLOCAL) I placed it in the ruby method as well.

It's ok if you separate changes to socket and test_udp_server,
and see version of darwin in the test.

Updated by naruse (Yui NARUSE) over 11 years ago

  • Status changed from Open to Assigned
  • Assignee set to drbrain (Eric Hodel)
Actions #5

Updated by drbrain (Eric Hodel) over 11 years ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r36475.
Eric, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • test/socket/test_socket.rb: Ignore IPv6 unique local addresses on OS
    X (iCloud Back to my Mac addresses) for test_udp_socket since they do
    not act as loopback addresses. [Bug #6692]
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0