test: fix multicast join test on OSX when using IPv6

When choosing an IPv6 interface all low level APIs use the interface
index which can be gathered with if_nametoindex. Passing a 0 means to
use the default as per the documentation. On OSX, however, this is not
the case and when 0 is specified it gives EADDRNOTAVAIL error. So, we
workaround the test, by using the 'lo0' interface on OSX, which has an
index of 1.
This commit is contained in:
Saúl Ibarra Corretgé 2014-03-20 11:07:00 +01:00
parent 15140cebe1
commit 8bbf469cb0

View File

@ -116,7 +116,11 @@ TEST_IMPL(udp_multicast_join6) {
ASSERT(r == 0);
/* join the multicast channel */
#if defined(__APPLE__)
r = uv_udp_set_membership(&client, "ff02::1", "::1%lo0", UV_JOIN_GROUP);
#else
r = uv_udp_set_membership(&client, "ff02::1", NULL, UV_JOIN_GROUP);
#endif
ASSERT(r == 0);
r = uv_udp_recv_start(&client, alloc_cb, cl_recv_cb);