Zebediah Figura : ws2_32: Move the setsockopt(IP_HDRINCL) implementation to ntdll.

Alexandre Julliard julliard at winehq.org
Thu Jul 8 16:43:49 CDT 2021


Module: wine
Branch: master
Commit: f0533d9a5ada291c371e6267360e9b73c78a24f3
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=f0533d9a5ada291c371e6267360e9b73c78a24f3

Author: Zebediah Figura <zfigura at codeweavers.com>
Date:   Wed Jul  7 20:16:39 2021 -0500

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

Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ntdll/unix/socket.c |  3 +++
 dlls/ws2_32/socket.c     |  6 +++---
 dlls/ws2_32/tests/sock.c | 20 +++++++++++---------
 include/wine/afd.h       |  1 +
 4 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/dlls/ntdll/unix/socket.c b/dlls/ntdll/unix/socket.c
index 1fbe1c8b663..eeb495b82c0 100644
--- a/dlls/ntdll/unix/socket.c
+++ b/dlls/ntdll/unix/socket.c
@@ -1745,6 +1745,9 @@ NTSTATUS sock_ioctl( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc, void *apc
 #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
 
         default:
diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
index e38ca770ce5..a354e6a31a5 100644
--- a/dlls/ws2_32/socket.c
+++ b/dlls/ws2_32/socket.c
@@ -3643,6 +3643,9 @@ int WINAPI WS_setsockopt(SOCKET s, int level, int optname,
         case WS_IP_DROP_SOURCE_MEMBERSHIP:
             return server_setsockopt( s, IOCTL_AFD_WINE_SET_IP_DROP_SOURCE_MEMBERSHIP, optval, optlen );
 
+        case WS_IP_HDRINCL:
+            return server_setsockopt( s, IOCTL_AFD_WINE_SET_IP_HDRINCL, optval, optlen );
+
         case WS_IP_UNBLOCK_SOURCE:
         {
             WS_IP_MREQ_SOURCE* val = (void*)optval;
@@ -3656,9 +3659,6 @@ int WINAPI WS_setsockopt(SOCKET s, int level, int optname,
             convert_sockopt(&level, &optname);
             break;
         }
-#ifdef IP_HDRINCL
-        case WS_IP_HDRINCL:
-#endif
         case WS_IP_MULTICAST_IF:
         case WS_IP_MULTICAST_LOOP:
         case WS_IP_MULTICAST_TTL:
diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c
index 97b772e12d9..e7bd3b8fe15 100644
--- a/dlls/ws2_32/tests/sock.c
+++ b/dlls/ws2_32/tests/sock.c
@@ -1431,29 +1431,31 @@ todo_wine
         err = setsockopt(s, IPPROTO_IP, IP_HDRINCL, (char *) &k, size);
         if (err == -1) /* >= Vista */
         {
-            todo_wine {
             ok(GetLastError() == WSAEINVAL, "Expected 10022, got %d\n", GetLastError());
             k = 99;
             SetLastError(0xdeadbeef);
             err = getsockopt(s, IPPROTO_IP, IP_HDRINCL, (char *) &k, &size);
-            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);
+            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);
+            }
 
             size = sizeof(k);
             k = 0;
             SetLastError(0xdeadbeef);
             err = setsockopt(s, IPPROTO_IP, IP_HDRINCL, (char *) &k, size);
-            }
             ok(err == -1, "Expected -1, got %d\n", err);
-            todo_wine {
             ok(GetLastError() == WSAEINVAL, "Expected 10022, got %d\n", GetLastError());
             k = 99;
             SetLastError(0xdeadbeef);
             err = getsockopt(s, IPPROTO_IP, IP_HDRINCL, (char *) &k, &size);
-            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);
+            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);
             }
         }
         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 3b293cc49f2..4e76bbce6e2 100644
--- a/include/wine/afd.h
+++ b/include/wine/afd.h
@@ -189,6 +189,7 @@ struct afd_get_events_params
 #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)
 
 struct afd_create_params
 {




More information about the wine-cvs mailing list