--- old/make/autoconf/flags.m4 2018-01-29 07:30:51.188857155 -0500 +++ new/make/autoconf/flags.m4 2018-01-29 07:30:50.812835263 -0500 @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2018, 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 @@ -918,7 +918,6 @@ -MD -Zc:wchar_t- -W3 -wd4800 \ -DWIN32_LEAN_AND_MEAN \ -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE \ - -D_WINSOCK_DEPRECATED_NO_WARNINGS \ -DWIN32 -DIAL" if test "x$OPENJDK_$1_CPU" = xx86_64; then $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -D_AMD64_ -Damd64" --- old/make/autoconf/generated-configure.sh 2018-01-29 07:30:52.234918056 -0500 +++ new/make/autoconf/generated-configure.sh 2018-01-29 07:30:51.838895000 -0500 @@ -5191,7 +5191,7 @@ #CUSTOM_AUTOCONF_INCLUDE # Do not change or remove the following line, it is needed for consistency checks: -DATE_WHEN_GENERATED=1516225089 +DATE_WHEN_GENERATED=1516891599 ############################################################################### # @@ -52507,7 +52507,6 @@ -MD -Zc:wchar_t- -W3 -wd4800 \ -DWIN32_LEAN_AND_MEAN \ -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE \ - -D_WINSOCK_DEPRECATED_NO_WARNINGS \ -DWIN32 -DIAL" if test "x$OPENJDK_TARGET_CPU" = xx86_64; then COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -D_AMD64_ -Damd64" @@ -53388,7 +53387,6 @@ -MD -Zc:wchar_t- -W3 -wd4800 \ -DWIN32_LEAN_AND_MEAN \ -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE \ - -D_WINSOCK_DEPRECATED_NO_WARNINGS \ -DWIN32 -DIAL" if test "x$OPENJDK_BUILD_CPU" = xx86_64; then OPENJDK_BUILD_COMMON_CCXXFLAGS_JDK="$OPENJDK_BUILD_COMMON_CCXXFLAGS_JDK -D_AMD64_ -Damd64" --- old/src/java.base/windows/native/libnio/ch/SocketDispatcher.c 2018-01-29 07:30:53.619998695 -0500 +++ new/src/java.base/windows/native/libnio/ch/SocketDispatcher.c 2018-01-29 07:30:53.238976512 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2018, 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 @@ -272,7 +272,7 @@ int len = sizeof(l); if (getsockopt(fd, SOL_SOCKET, SO_LINGER, (char *)&l, &len) == 0) { if (l.l_onoff == 0) { - WSASendDisconnect(fd, NULL); + shutdown(fd, SD_SEND); } } } --- old/src/jdk.jdwp.agent/share/native/libdt_socket/socketTransport.c 2018-01-29 07:30:54.363041955 -0500 +++ new/src/jdk.jdwp.agent/share/native/libdt_socket/socketTransport.c 2018-01-29 07:30:53.965018782 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2018, 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 @@ -241,7 +241,9 @@ // getaddrinfo might return more than one address // but we are using first one only - return ((struct sockaddr_in *)(res->ai_addr))->sin_addr.s_addr; + uint32_t addr = ((struct sockaddr_in *)(res->ai_addr))->sin_addr.s_addr; + freeaddrinfo(res); + return addr; } static int @@ -315,16 +317,25 @@ */ addr = dbgsysInetAddr(hostname); if (addr == 0xffffffff) { - struct hostent *hp = dbgsysGetHostByName(hostname); - if (hp == NULL) { + struct addrinfo hints; + struct addrinfo *results = NULL; + memset (&hints, 0, sizeof(hints)); + hints.ai_family = AF_INET; + hints.ai_socktype = SOCK_STREAM; + hints.ai_protocol = IPPROTO_TCP; + + int ai = dbgsysGetAddrInfo(hostname, NULL, &hints, &results); + + if (ai != 0) { /* don't use RETURN_IO_ERROR as unknown host is normal */ - setLastError(0, "gethostbyname: unknown host"); + setLastError(0, "getaddrinfo: unknown host"); (*callback->free)(buf); return JDWPTRANSPORT_ERROR_IO_ERROR; } /* lookup was successful */ - memcpy(&(sa->sin_addr), hp->h_addr_list[0], hp->h_length); + sa->sin_addr = ((struct sockaddr_in *)results->ai_addr)->sin_addr; + freeaddrinfo(results); } else { sa->sin_addr.s_addr = addr; } --- old/src/jdk.jdwp.agent/share/native/libdt_socket/sysSocket.h 2018-01-29 07:30:55.096084632 -0500 +++ new/src/jdk.jdwp.agent/share/native/libdt_socket/sysSocket.h 2018-01-29 07:30:54.705061867 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2018, 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 @@ -47,7 +47,7 @@ int dbgsysListen(int fd, int backlog); int dbgsysRecv(int fd, char *buf, size_t nBytes, int flags); int dbgsysSend(int fd, char *buf, size_t nBytes, int flags); -struct hostent *dbgsysGetHostByName(char *hostname); +int dbgsysGetAddrInfo(char *hostname, char *service, struct addrinfo *hints, struct addrinfo **results); int dbgsysSocket(int domain, int type, int protocol); int dbgsysBind(int fd, struct sockaddr *name, socklen_t namelen); int dbgsysSetSocketOption(int fd, jint cmd, jboolean on, jvalue value); --- old/src/jdk.jdwp.agent/unix/native/libdt_socket/socket_md.c 2018-01-29 07:30:55.822126902 -0500 +++ new/src/jdk.jdwp.agent/unix/native/libdt_socket/socket_md.c 2018-01-29 07:30:55.431104137 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2018, 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 @@ -126,9 +126,11 @@ return rv; } -struct hostent * -dbgsysGetHostByName(char *hostname) { - return gethostbyname(hostname); +int +dbgsysGetAddrInfo(char *hostname, char *service, + struct addrinfo *hints, + struct addrinfo **results) { + return getaddrinfo(hostname, service, hints, results); } unsigned short --- old/src/jdk.jdwp.agent/windows/native/libdt_socket/socket_md.c 2018-01-29 07:30:56.550169288 -0500 +++ new/src/jdk.jdwp.agent/windows/native/libdt_socket/socket_md.c 2018-01-29 07:30:56.159146523 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2018, 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 @@ -24,6 +24,7 @@ */ #include #include +#include #include "sysSocket.h" #include "socketTransport.h" @@ -197,9 +198,11 @@ return send(fd, buf, (int)nBytes, flags); } -struct hostent * -dbgsysGetHostByName(char *hostname) { - return gethostbyname(hostname); +int +dbgsysGetAddrInfo(char *hostname, char *service, + struct addrinfo *hints, + struct addrinfo **result) { + return getaddrinfo(hostname, service, hints, result); } unsigned short @@ -223,7 +226,7 @@ if (getsockopt(fd, SOL_SOCKET, SO_LINGER, (char *)&l, &len) == 0) { if (l.l_onoff == 0) { - WSASendDisconnect(fd, NULL); + shutdown(fd, SD_SEND); } } return closesocket(fd); @@ -239,7 +242,9 @@ uint32_t dbgsysInetAddr(const char* cp) { - return (uint32_t)inet_addr(cp); + uint32_t addr; + inet_pton(AF_INET, cp, &addr); + return addr; } uint32_t