Commit a615e677 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

ws2_32: Move the getsockopt(IPV6_DONTFRAG) implementation to ntdll.

parent ef54a8c3
......@@ -1807,6 +1807,39 @@ NTSTATUS sock_ioctl( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc, void *apc
return do_setsockopt( handle, io, IPPROTO_IPV6, IPV6_ADD_MEMBERSHIP, in_buffer, in_size );
#endif
case IOCTL_AFD_WINE_GET_IPV6_DONTFRAG:
{
socklen_t len = out_size;
int ret;
if ((status = server_get_unix_fd( handle, 0, &fd, &needs_close, NULL, NULL )))
return status;
#ifdef IPV6_DONTFRAG
ret = getsockopt( fd, IPPROTO_IPV6, IPV6_DONTFRAG, out_buffer, &len );
#elif defined(IPV6_MTU_DISCOVER) && defined(IPV6_PMTUDISC_DONT)
{
int value;
len = sizeof(value);
ret = getsockopt( fd, IPPROTO_IPV6, IPV6_MTU_DISCOVER, &value, &len );
if (!ret) *(DWORD *)out_buffer = (value != IPV6_PMTUDISC_DONT);
}
#else
{
static int once;
if (!once++)
FIXME( "IPV6_DONTFRAGMENT is not supported on this platform\n" );
ret = 0; /* fake success */
}
#endif
if (needs_close) close( fd );
if (ret) return sock_errno_to_status( errno );
io->Information = len;
return STATUS_SUCCESS;
}
default:
{
if ((code >> 16) == FILE_DEVICE_NETWORK)
......
......@@ -742,60 +742,6 @@ static BOOL set_dont_fragment(SOCKET s, int level, BOOL value)
return value;
}
static BOOL get_dont_fragment(SOCKET s, int level, BOOL *out)
{
int fd, optname, value, not_expected;
socklen_t optlen = sizeof(value);
if (level == IPPROTO_IP)
{
#ifdef IP_DONTFRAG
optname = IP_DONTFRAG;
not_expected = 0;
#elif defined(IP_MTU_DISCOVER) && defined(IP_PMTUDISC_DONT)
optname = IP_MTU_DISCOVER;
not_expected = IP_PMTUDISC_DONT;
#else
static int once;
if (!once++)
FIXME("IP_DONTFRAGMENT for IPv4 not supported in this platform\n");
return TRUE; /* fake success */
#endif
}
else
{
#ifdef IPV6_DONTFRAG
optname = IPV6_DONTFRAG;
not_expected = 0;
#elif defined(IPV6_MTU_DISCOVER) && defined(IPV6_PMTUDISC_DONT)
optname = IPV6_MTU_DISCOVER;
not_expected = IPV6_PMTUDISC_DONT;
#else
static int once;
if (!once++)
FIXME("IP_DONTFRAGMENT for IPv6 not supported in this platform\n");
return TRUE; /* fake success */
#endif
}
fd = get_sock_fd(s, 0, NULL);
if (fd == -1) return FALSE;
if (!getsockopt(fd, level, optname, &value, &optlen))
{
*out = value != not_expected;
value = TRUE;
}
else
{
WSASetLastError(wsaErrno());
value = FALSE;
}
release_sock_fd(s, fd);
return value;
}
struct per_thread_data *get_per_thread_data(void)
{
struct per_thread_data * ptb = NtCurrentTeb()->WinSockData;
......@@ -2511,6 +2457,9 @@ INT WINAPI WS_getsockopt(SOCKET s, INT level,
case WS_IPPROTO_IPV6:
switch(optname)
{
case WS_IPV6_DONTFRAG:
return server_getsockopt( s, IOCTL_AFD_WINE_GET_IPV6_DONTFRAG, optval, optlen );
case WS_IPV6_MULTICAST_IF:
case WS_IPV6_MULTICAST_HOPS:
case WS_IPV6_MULTICAST_LOOP:
......@@ -2529,8 +2478,6 @@ INT WINAPI WS_getsockopt(SOCKET s, INT level,
}
release_sock_fd( s, fd );
return ret;
case WS_IPV6_DONTFRAG:
return get_dont_fragment(s, IPPROTO_IPV6, (BOOL *)optval) ? 0 : SOCKET_ERROR;
default:
FIXME( "unrecognized IPv6 option %u\n", optname );
......
......@@ -208,6 +208,7 @@ struct afd_get_events_params
#define IOCTL_AFD_WINE_GET_IP_UNICAST_IF WINE_AFD_IOC(263)
#define IOCTL_AFD_WINE_SET_IP_UNICAST_IF WINE_AFD_IOC(264)
#define IOCTL_AFD_WINE_SET_IPV6_ADD_MEMBERSHIP WINE_AFD_IOC(265)
#define IOCTL_AFD_WINE_GET_IPV6_DONTFRAG WINE_AFD_IOC(266)
struct afd_create_params
{
......
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