Commit a294f755 authored by Alex Henrie's avatar Alex Henrie Committed by Alexandre Julliard

ws2_32: Reimplement inet_ntop on top of ntdll functions.

And add a couple of tests for IPv6 addresses that Windows represents using dot-decimal notation for the last 32 bits but GNU/Linux does not. Signed-off-by: 's avatarAlex Henrie <alexhenrie24@gmail.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 0af08318
......@@ -18296,9 +18296,6 @@ for ac_func in \
getprotobyname \
getprotobynumber \
getservbyport \
inet_addr \
inet_network \
inet_ntop \
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
......
......@@ -2249,9 +2249,6 @@ AC_CHECK_FUNCS(\
getprotobyname \
getprotobynumber \
getservbyport \
inet_addr \
inet_network \
inet_ntop \
)
dnl Check for clock_gettime which may be in -lrt
......
......@@ -8351,10 +8351,8 @@ int WINAPI WSARemoveServiceClass(LPGUID info)
*/
PCSTR WINAPI WS_inet_ntop( INT family, PVOID addr, PSTR buffer, SIZE_T len )
{
#ifdef HAVE_INET_NTOP
struct WS_in6_addr *in6;
struct WS_in_addr *in;
PCSTR pdst;
NTSTATUS status;
ULONG size = min( len, (ULONG)-1 );
TRACE("family %d, addr (%p), buffer (%p), len %ld\n", family, addr, buffer, len);
if (!buffer)
......@@ -8367,14 +8365,12 @@ PCSTR WINAPI WS_inet_ntop( INT family, PVOID addr, PSTR buffer, SIZE_T len )
{
case WS_AF_INET:
{
in = addr;
pdst = inet_ntop( AF_INET, &in->WS_s_addr, buffer, len );
status = RtlIpv4AddressToStringExA( (IN_ADDR *)addr, 0, buffer, &size );
break;
}
case WS_AF_INET6:
{
in6 = addr;
pdst = inet_ntop( AF_INET6, in6->WS_s6_addr, buffer, len );
status = RtlIpv6AddressToStringExA( (IN6_ADDR *)addr, 0, 0, buffer, &size );
break;
}
default:
......@@ -8382,13 +8378,9 @@ PCSTR WINAPI WS_inet_ntop( INT family, PVOID addr, PSTR buffer, SIZE_T len )
return NULL;
}
if (!pdst) SetLastError( STATUS_INVALID_PARAMETER );
return pdst;
#else
FIXME( "not supported on this platform\n" );
SetLastError( WSAEAFNOSUPPORT );
if (status == STATUS_SUCCESS) return buffer;
SetLastError( STATUS_INVALID_PARAMETER );
return NULL;
#endif
}
/***********************************************************************
......
......@@ -5008,6 +5008,12 @@ static void test_inet_pton(void)
"0x12345678", NULL, NULL},
{AF_INET6, 0, 0, /* windows bug */
"::1:2:3:4:5:6:7", NULL, NULL},
{AF_INET6, 1, 0, /* Test 30 */
"::5efe:1.2.3.4", "::5efe:1.2.3.4",
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x5e\xfe\x01\x02\x03\x04"},
{AF_INET6, 1, 0,
"::ffff:0:1.2.3.4", "::ffff:0:1.2.3.4",
"\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x01\x02\x03\x04"},
};
int i, ret;
DWORD err;
......
......@@ -296,18 +296,9 @@
/* Define to 1 if you have the `ilogbf' function. */
#undef HAVE_ILOGBF
/* Define to 1 if you have the `inet_addr' function. */
#undef HAVE_INET_ADDR
/* Define to 1 if you have the <inet/mib2.h> header file. */
#undef HAVE_INET_MIB2_H
/* Define to 1 if you have the `inet_network' function. */
#undef HAVE_INET_NETWORK
/* Define to 1 if you have the `inet_ntop' function. */
#undef HAVE_INET_NTOP
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment