This reverts most of commit e0013193044911140181ee69de4e7c721c6d0aa0.
My previous diagnosis was incorrect: Windows does support both getting and setting IP_HDRINCL, but only on raw sockets. Very old versions of Windows also accept it on UDP sockets.
Signed-off-by: Alex Henrie alexhenrie24@gmail.com --- The final patch in this series now includes tests that would have caught this mistake. Similar mistakes will not happen again.
We could support IP_HDRINCL on UDP sockets in Wine for perfect compatibility with Windows XP, but then we'd have to specially mark it as broken in the tests. Doesn't seem worth it. --- dlls/ntdll/unix/socket.c | 5 +++++ dlls/ws2_32/socket.c | 7 +++---- include/wine/afd.h | 1 + 3 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/dlls/ntdll/unix/socket.c b/dlls/ntdll/unix/socket.c index 2382794a830..8469def786a 100644 --- a/dlls/ntdll/unix/socket.c +++ b/dlls/ntdll/unix/socket.c @@ -1771,7 +1771,12 @@ NTSTATUS sock_ioctl( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc, void *apc return do_setsockopt( handle, io, IPPROTO_IP, IP_DROP_SOURCE_MEMBERSHIP, in_buffer, in_size );
#ifdef IP_HDRINCL + case IOCTL_AFD_WINE_GET_IP_HDRINCL: + if (get_sock_type( handle ) != SOCK_RAW) return STATUS_INVALID_PARAMETER; + return do_getsockopt( handle, io, IPPROTO_IP, IP_HDRINCL, out_buffer, out_size ); + case IOCTL_AFD_WINE_SET_IP_HDRINCL: + if (get_sock_type( handle ) != SOCK_RAW) return STATUS_INVALID_PARAMETER; return do_setsockopt( handle, io, IPPROTO_IP, IP_HDRINCL, in_buffer, in_size ); #endif
diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c index c991d212a07..9a45124cd9e 100644 --- a/dlls/ws2_32/socket.c +++ b/dlls/ws2_32/socket.c @@ -1677,6 +1677,9 @@ int WINAPI getsockopt( SOCKET s, int level, int optname, char *optval, int *optl case IP_DONTFRAGMENT: return server_getsockopt( s, IOCTL_AFD_WINE_GET_IP_DONTFRAGMENT, optval, optlen );
+ case IP_HDRINCL: + return server_getsockopt( s, IOCTL_AFD_WINE_GET_IP_HDRINCL, optval, optlen ); + case IP_MULTICAST_IF: return server_getsockopt( s, IOCTL_AFD_WINE_GET_IP_MULTICAST_IF, optval, optlen );
@@ -1701,10 +1704,6 @@ int WINAPI getsockopt( SOCKET s, int level, int optname, char *optval, int *optl case IP_UNICAST_IF: return server_getsockopt( s, IOCTL_AFD_WINE_GET_IP_UNICAST_IF, optval, optlen );
- case IP_HDRINCL: - SetLastError( WSAEINVAL ); - return -1; - default: FIXME( "unrecognized IP option %u\n", optname ); /* fall through */ diff --git a/include/wine/afd.h b/include/wine/afd.h index 43e140c91c6..49bbcccd3af 100644 --- a/include/wine/afd.h +++ b/include/wine/afd.h @@ -187,6 +187,7 @@ struct afd_get_events_params #define IOCTL_AFD_WINE_SET_IP_DONTFRAGMENT WINE_AFD_IOC(243) #define IOCTL_AFD_WINE_SET_IP_DROP_MEMBERSHIP WINE_AFD_IOC(244) #define IOCTL_AFD_WINE_SET_IP_DROP_SOURCE_MEMBERSHIP WINE_AFD_IOC(245) +#define IOCTL_AFD_WINE_GET_IP_HDRINCL WINE_AFD_IOC(246) #define IOCTL_AFD_WINE_SET_IP_HDRINCL WINE_AFD_IOC(247) #define IOCTL_AFD_WINE_GET_IP_MULTICAST_IF WINE_AFD_IOC(248) #define IOCTL_AFD_WINE_SET_IP_MULTICAST_IF WINE_AFD_IOC(249)