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

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2021-07-01 17:10:27 -05:00 committed by Alexandre Julliard
parent 1276c73feb
commit f38bb98a49
3 changed files with 37 additions and 2 deletions

View File

@ -1684,6 +1684,39 @@ NTSTATUS sock_ioctl( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc, void *apc
case IOCTL_AFD_WINE_SET_IP_BLOCK_SOURCE:
return do_setsockopt( handle, io, IPPROTO_IP, IP_BLOCK_SOURCE, in_buffer, in_size );
case IOCTL_AFD_WINE_GET_IP_DONTFRAGMENT:
{
socklen_t len = out_size;
int ret;
if ((status = server_get_unix_fd( handle, 0, &fd, &needs_close, NULL, NULL )))
return status;
#ifdef IP_DONTFRAG
ret = getsockopt( fd, IPPROTO_IP, IP_DONTFRAG, out_buffer, &len );
#elif defined(IP_MTU_DISCOVER) && defined(IP_PMTUDISC_DONT)
{
int value;
len = sizeof(value);
ret = getsockopt( fd, IPPROTO_IP, IP_MTU_DISCOVER, &value, &len );
if (!ret) *(DWORD *)out_buffer = (value != IP_PMTUDISC_DONT);
}
#else
{
static int once;
if (!once++)
FIXME( "IP_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)

View File

@ -2433,6 +2433,9 @@ INT WINAPI WS_getsockopt(SOCKET s, INT level,
case WS_IPPROTO_IP:
switch(optname)
{
case WS_IP_DONTFRAGMENT:
return server_getsockopt( s, IOCTL_AFD_WINE_GET_IP_DONTFRAGMENT, optval, optlen );
#ifdef IP_HDRINCL
case WS_IP_HDRINCL:
#endif
@ -2458,8 +2461,6 @@ INT WINAPI WS_getsockopt(SOCKET s, INT level,
}
release_sock_fd( s, fd );
return ret;
case WS_IP_DONTFRAGMENT:
return get_dont_fragment(s, IPPROTO_IP, (BOOL *)optval) ? 0 : SOCKET_ERROR;
default:
FIXME( "unrecognized IP option %u\n", optname );

View File

@ -184,6 +184,7 @@ struct afd_get_events_params
#define IOCTL_AFD_WINE_SET_IP_ADD_MEMBERSHIP WINE_AFD_IOC(239)
#define IOCTL_AFD_WINE_SET_IP_ADD_SOURCE_MEMBERSHIP WINE_AFD_IOC(240)
#define IOCTL_AFD_WINE_SET_IP_BLOCK_SOURCE WINE_AFD_IOC(241)
#define IOCTL_AFD_WINE_GET_IP_DONTFRAGMENT WINE_AFD_IOC(242)
struct afd_create_params
{