8217311: Improve Exception thrown when MulticastSocket.setInterface fails on AIX(Unix)
authorclanger
Fri, 18 Jan 2019 09:04:09 +0100
changeset 53381 e1da82072c79
parent 53380 c8208421a860
child 53382 28b79ca141df
8217311: Improve Exception thrown when MulticastSocket.setInterface fails on AIX(Unix) Reviewed-by: sgroeger, alanb, mbaesken, chegar
src/java.base/unix/native/libnet/PlainDatagramSocketImpl.c
--- a/src/java.base/unix/native/libnet/PlainDatagramSocketImpl.c	Fri Jan 18 08:00:05 2019 +0100
+++ b/src/java.base/unix/native/libnet/PlainDatagramSocketImpl.c	Fri Jan 18 09:04:09 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1084,7 +1084,7 @@
 
     if (setsockopt(fd, IPPROTO_IPV6, IPV6_MULTICAST_IF,
                    (const char*)&index, sizeof(index)) < 0) {
-        if (errno == EINVAL && index > 0) {
+        if ((errno == EINVAL || errno == EADDRNOTAVAIL) && index > 0) {
             JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException",
                 "IPV6_MULTICAST_IF failed (interface has IPv4 "
                 "address only?)");