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

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

parent a615e677
......@@ -1840,6 +1840,25 @@ NTSTATUS sock_ioctl( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc, void *apc
return STATUS_SUCCESS;
}
case IOCTL_AFD_WINE_SET_IPV6_DONTFRAG:
#ifdef IPV6_DONTFRAG
return do_setsockopt( handle, io, IPPROTO_IPV6, IPV6_DONTFRAG, in_buffer, in_size );
#elif defined(IPV6_MTU_DISCOVER) && defined(IPV6_PMTUDISC_DO) && defined(IPV6_PMTUDISC_DONT)
{
int value = *(DWORD *)in_buffer ? IPV6_PMTUDISC_DO : IPV6_PMTUDISC_DONT;
return do_setsockopt( handle, io, IPPROTO_IP, IPV6_MTU_DISCOVER, &value, sizeof(value) );
}
#else
{
static int once;
if (!once++)
FIXME( "IPV6_DONTFRAGMENT is not supported on this platform\n" );
return STATUS_SUCCESS; /* fake success */
}
#endif
default:
{
if ((code >> 16) == FILE_DEVICE_NETWORK)
......
......@@ -694,54 +694,6 @@ static inline void release_sock_fd( SOCKET s, int fd )
close( fd );
}
static BOOL set_dont_fragment(SOCKET s, int level, BOOL value)
{
int fd, optname;
if (level == IPPROTO_IP)
{
#ifdef IP_DONTFRAG
optname = IP_DONTFRAG;
#elif defined(IP_MTU_DISCOVER) && defined(IP_PMTUDISC_DO) && defined(IP_PMTUDISC_DONT)
optname = IP_MTU_DISCOVER;
value = value ? IP_PMTUDISC_DO : 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;
#elif defined(IPV6_MTU_DISCOVER) && defined(IPV6_PMTUDISC_DO) && defined(IPV6_PMTUDISC_DONT)
optname = IPV6_MTU_DISCOVER;
value = value ? IPV6_PMTUDISC_DO : 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 (!setsockopt(fd, level, optname, &value, sizeof(value)))
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;
......@@ -3667,6 +3619,9 @@ int WINAPI WS_setsockopt(SOCKET s, int level, int optname,
case WS_IPV6_ADD_MEMBERSHIP:
return server_setsockopt( s, IOCTL_AFD_WINE_SET_IPV6_ADD_MEMBERSHIP, optval, optlen );
case WS_IPV6_DONTFRAG:
return server_setsockopt( s, IOCTL_AFD_WINE_SET_IPV6_DONTFRAG, optval, optlen );
#ifdef IPV6_DROP_MEMBERSHIP
case WS_IPV6_DROP_MEMBERSHIP:
#endif
......@@ -3679,8 +3634,6 @@ int WINAPI WS_setsockopt(SOCKET s, int level, int optname,
#endif
convert_sockopt(&level, &optname);
break;
case WS_IPV6_DONTFRAG:
return set_dont_fragment(s, IPPROTO_IPV6, *(BOOL *)optval) ? 0 : SOCKET_ERROR;
case WS_IPV6_PROTECTION_LEVEL:
FIXME("IPV6_PROTECTION_LEVEL is ignored!\n");
return 0;
......
......@@ -209,6 +209,7 @@ struct afd_get_events_params
#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)
#define IOCTL_AFD_WINE_SET_IPV6_DONTFRAG WINE_AFD_IOC(267)
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