[PATCH v3 2/4] ws2_32: Drop support for getting the IP_HDRINCL socket option

Alex Henrie alexhenrie24 at gmail.com
Mon Aug 16 23:58:29 CDT 2021


Windows only supports setting this option, not getting it.

Signed-off-by: Alex Henrie <alexhenrie24 at gmail.com>
---
v3: Set WSAEINVAL

I moved the case statement near the bottom of the list because we will
need to add cases for other options that also merely set WSAEINVAL and
return -1.
---
 dlls/ntdll/unix/socket.c |  3 ---
 dlls/ws2_32/socket.c     |  7 ++++---
 dlls/ws2_32/tests/sock.c | 18 ++++++------------
 include/wine/afd.h       |  1 -
 4 files changed, 10 insertions(+), 19 deletions(-)

diff --git a/dlls/ntdll/unix/socket.c b/dlls/ntdll/unix/socket.c
index 4f0c83597df..1ac4365c012 100644
--- a/dlls/ntdll/unix/socket.c
+++ b/dlls/ntdll/unix/socket.c
@@ -1762,9 +1762,6 @@ 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:
-            return do_getsockopt( handle, io, IPPROTO_IP, IP_HDRINCL, out_buffer, out_size );
-
         case IOCTL_AFD_WINE_SET_IP_HDRINCL:
             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 9a45124cd9e..c991d212a07 100644
--- a/dlls/ws2_32/socket.c
+++ b/dlls/ws2_32/socket.c
@@ -1677,9 +1677,6 @@ 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 );
 
@@ -1704,6 +1701,10 @@ 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/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c
index 6693c469dce..51aa0e61282 100644
--- a/dlls/ws2_32/tests/sock.c
+++ b/dlls/ws2_32/tests/sock.c
@@ -1437,12 +1437,9 @@ todo_wine
             k = 99;
             SetLastError(0xdeadbeef);
             err = getsockopt(s, IPPROTO_IP, IP_HDRINCL, (char *) &k, &size);
-            todo_wine
-            {
-                ok(err == -1, "Expected -1, got %d\n", err);
-                ok(GetLastError() == WSAEINVAL, "Expected 10022, got %d\n", GetLastError());
-                ok(k == 99, "Expected 99, got %d\n", k);
-            }
+            ok(err == -1, "Expected -1, got %d\n", err);
+            ok(GetLastError() == WSAEINVAL, "Expected 10022, got %d\n", GetLastError());
+            ok(k == 99, "Expected 99, got %d\n", k);
 
             size = sizeof(k);
             k = 0;
@@ -1453,12 +1450,9 @@ todo_wine
             k = 99;
             SetLastError(0xdeadbeef);
             err = getsockopt(s, IPPROTO_IP, IP_HDRINCL, (char *) &k, &size);
-            todo_wine
-            {
-                ok(err == -1, "Expected -1, got %d\n", err);
-                ok(GetLastError() == WSAEINVAL, "Expected 10022, got %d\n", GetLastError());
-                ok(k == 99, "Expected 99, got %d\n", k);
-            }
+            ok(err == -1, "Expected -1, got %d\n", err);
+            ok(GetLastError() == WSAEINVAL, "Expected 10022, got %d\n", GetLastError());
+            ok(k == 99, "Expected 99, got %d\n", k);
         }
         else /* <= 2003 the tests differ between TCP and UDP, UDP silently accepts */
         {
diff --git a/include/wine/afd.h b/include/wine/afd.h
index 49bbcccd3af..43e140c91c6 100644
--- a/include/wine/afd.h
+++ b/include/wine/afd.h
@@ -187,7 +187,6 @@ 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)
-- 
2.32.0




More information about the wine-devel mailing list