diff options
author | Lorenzo Colitti <lorenzo@google.com> | 2009-10-01 13:47:04 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2009-10-01 13:47:04 -0700 |
commit | 4d26d908fc812a30683ff5b831f6ae77a2bedd30 (patch) | |
tree | 51326c1edd1acd700ddceac1ec290f6d27de002e | |
parent | 12ee3ae4b1b803cdf9f9293fb8d5bd35956aeb88 (diff) | |
parent | 13ba046f66a84e7d91b39e11eb1d4bd8a2031067 (diff) | |
download | libcore-4d26d908fc812a30683ff5b831f6ae77a2bedd30.zip libcore-4d26d908fc812a30683ff5b831f6ae77a2bedd30.tar.gz libcore-4d26d908fc812a30683ff5b831f6ae77a2bedd30.tar.bz2 |
am 1507c7ce: am f94c5d77: More multicast fixes.
Merge commit '1507c7ce4fc88f7bdf5e89ba10839809693eeefb'
* commit '1507c7ce4fc88f7bdf5e89ba10839809693eeefb':
More multicast fixes.
3 files changed, 6 insertions, 5 deletions
diff --git a/luni/src/main/native/java_net_NetworkInterface.c b/luni/src/main/native/java_net_NetworkInterface.c index 7fdf4fe..e994aea 100644 --- a/luni/src/main/native/java_net_NetworkInterface.c +++ b/luni/src/main/native/java_net_NetworkInterface.c @@ -520,8 +520,9 @@ int sockGetNetworkInterfaces(struct NetworkInterfaceArray_struct * array) { /* since this function can return multiple entries for the same name, only do it for the first one with any given name */ if((NULL == lastName) || (strncmp(lastName, ifc.ifc_req[counter].ifr_name, IFNAMSIZ) != 0)) { - /* get the index for the interface. This is only truely necessary on platforms that support IPV6 */ - interfaces[currentAdapterIndex].index = 0; + /* get the index for the interface */ + interfaces[currentAdapterIndex].index = + ifc.ifc_req[counter].ifr_ifindex; /* get the name and display name for the adapter */ /* there only seems to be one name so use it for both the name and the display name */ nameLength = strlen(ifc.ifc_req[counter].ifr_name); diff --git a/luni/src/main/native/org_apache_harmony_luni_platform_OSNetworkSystem.cpp b/luni/src/main/native/org_apache_harmony_luni_platform_OSNetworkSystem.cpp index 604819a..fd3820b 100644 --- a/luni/src/main/native/org_apache_harmony_luni_platform_OSNetworkSystem.cpp +++ b/luni/src/main/native/org_apache_harmony_luni_platform_OSNetworkSystem.cpp @@ -3271,8 +3271,9 @@ static void osNetworkSystem_setSocketOptionImpl(JNIEnv* env, jclass clazz, if ((anOption >> 16) & BROKEN_MULTICAST_IF) { return; } - // This call is IPv4 only. - if (getSocketAddressFamily(handle) != AF_INET) { + // This call is IPv4 only. The socket may be IPv6, but the address + // that identifies the interface to join must be an IPv4 address. + if (sockVal.ss_family != AF_INET) { throwSocketException(env, SOCKERR_BADAF); return; } diff --git a/luni/src/test/java/tests/api/java/net/MulticastSocketTest.java b/luni/src/test/java/tests/api/java/net/MulticastSocketTest.java index 997055b..1429063 100644 --- a/luni/src/test/java/tests/api/java/net/MulticastSocketTest.java +++ b/luni/src/test/java/tests/api/java/net/MulticastSocketTest.java @@ -1099,7 +1099,6 @@ public class MulticastSocketTest extends SocketTestCase { method = "setNetworkInterface", args = {java.net.NetworkInterface.class} ) - @KnownFailure("No interfaces if there's no debugger connected") public void test_setNetworkInterfaceLjava_net_NetworkInterface() throws IOException, InterruptedException { String msg = null; |