src/java.base/unix/native/libnet/PlainDatagramSocketImpl.c
changeset 55375 96c7427456f9
parent 54627 22323f20401b
child 59313 6f12009ea9d7
--- a/src/java.base/unix/native/libnet/PlainDatagramSocketImpl.c	Thu Jun 13 12:22:28 2019 +0530
+++ b/src/java.base/unix/native/libnet/PlainDatagramSocketImpl.c	Thu Jun 13 09:10:51 2019 +0100
@@ -79,10 +79,6 @@
 static jfieldID pdsi_connectedAddress;
 static jfieldID pdsi_connectedPort;
 
-extern void setDefaultScopeID(JNIEnv *env, struct sockaddr *him);
-extern int getDefaultScopeID(JNIEnv *env);
-
-
 /*
  * Returns a java.lang.Integer based on 'i'
  */
@@ -200,7 +196,6 @@
                                   JNI_TRUE) != 0) {
       return;
     }
-    setDefaultScopeID(env, &sa.sa);
 
     if (NET_Bind(fd, &sa, len) < 0)  {
         if (errno == EADDRINUSE || errno == EADDRNOTAVAIL ||
@@ -266,8 +261,6 @@
       return;
     }
 
-    setDefaultScopeID(env, &rmtaddr.sa);
-
     if (NET_Connect(fd, &rmtaddr.sa, len) == -1) {
         NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "ConnectException",
                         "Connect failed");
@@ -334,11 +327,11 @@
 
 /*
  * Class:     java_net_PlainDatagramSocketImpl
- * Method:    send
+ * Method:    send0
  * Signature: (Ljava/net/DatagramPacket;)V
  */
 JNIEXPORT void JNICALL
-Java_java_net_PlainDatagramSocketImpl_send(JNIEnv *env, jobject this,
+Java_java_net_PlainDatagramSocketImpl_send0(JNIEnv *env, jobject this,
                                            jobject packet) {
 
     char BUF[MAX_BUFFER_LEN];
@@ -393,7 +386,6 @@
         }
         rmtaddrP = &rmtaddr.sa;
     }
-    setDefaultScopeID(env, &rmtaddr.sa);
 
     if (packetBufferLen > MAX_BUFFER_LEN) {
         /* When JNI-ifying the JDK's IO routines, we turned
@@ -2145,26 +2137,6 @@
                 NET_ThrowCurrent(env, "getsockopt IPV6_MULTICAST_IF failed");
                 return;
             }
-
-#ifdef __linux__
-            /*
-             * On 2.4.8+ if we join a group with the interface set to 0
-             * then the kernel records the interface it decides. This causes
-             * subsequent leave groups to fail as there is no match. Thus we
-             * pick the interface if there is a matching route.
-             */
-            if (index == 0) {
-                int rt_index = getDefaultIPv6Interface(&(mname6.ipv6mr_multiaddr));
-                if (rt_index > 0) {
-                    index = rt_index;
-                }
-            }
-#endif
-#ifdef MACOSX
-            if (family == AF_INET6 && index == 0) {
-                index = getDefaultScopeID(env);
-            }
-#endif
             mname6.ipv6mr_interface = index;
         } else {
             jint idx = (*env)->GetIntField(env, niObj, ni_indexID);