Commit 6d6b4bff authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

ws2_32: Enable IP_DONTFRAGMENT by default for SOCK_STREAM sockets.

parent 2538a74c
......@@ -7606,9 +7606,14 @@ SOCKET WINAPI WSASocketW(int af, int type, int protocol,
if (ipxptype > 0)
set_ipx_packettype(ret, ipxptype);
/* ensure IP_DONTFRAGMENT is disabled, in Linux the global default can be enabled */
if (unixaf == AF_INET || unixaf == AF_INET6)
set_dont_fragment(ret, unixaf == AF_INET6 ? IPPROTO_IPV6 : IPPROTO_IP, FALSE);
{
/* ensure IP_DONTFRAGMENT is disabled for SOCK_DGRAM and SOCK_RAW, enabled for SOCK_STREAM */
if (unixtype == SOCK_DGRAM || unixtype == SOCK_RAW) /* in Linux the global default can be enabled */
set_dont_fragment(ret, unixaf == AF_INET6 ? IPPROTO_IPV6 : IPPROTO_IP, FALSE);
else if (unixtype == SOCK_STREAM)
set_dont_fragment(ret, unixaf == AF_INET6 ? IPPROTO_IPV6 : IPPROTO_IP, TRUE);
}
#ifdef IPV6_V6ONLY
if (unixaf == AF_INET6)
......
......@@ -1908,6 +1908,59 @@ todo_wine
ok(value == 1, "Expected 1, got %d\n", value);
closesocket(s);
s = socket(family, SOCK_STREAM, 0);
if (s == INVALID_SOCKET && i)
{
skip("IPv6 is not supported\n");
break;
}
ok(s != INVALID_SOCKET, "socket failed with error %d\n", GetLastError());
size = sizeof(value);
value = 0xdead;
err = getsockopt(s, level, IP_DONTFRAGMENT, (char *) &value, &size);
ok(!err, "Expected 0, got %d with error %d\n", err, GetLastError());
ok(value == 1 || broken(value == 0) /* < vista */, "Expected 1, got %d\n", value);
size = sizeof(value);
value = 0;
err = setsockopt(s, level, IP_DONTFRAGMENT, (char *) &value, size);
ok(!err, "Expected 0, got %d with error %d\n", err, GetLastError());
value = 0xdead;
err = getsockopt(s, level, IP_DONTFRAGMENT, (char *) &value, &size);
ok(!err, "Expected 0, got %d with error %d\n", err, GetLastError());
ok(value == 0, "Expected 0, got %d\n", value);
closesocket(s);
s = socket(family, SOCK_RAW, 0);
if (s == INVALID_SOCKET)
{
if (WSAGetLastError() == WSAEACCES) skip("SOCK_RAW is not available\n");
else if (i) skip("IPv6 is not supported\n");
break;
}
ok(s != INVALID_SOCKET, "socket failed with error %d\n", GetLastError());
size = sizeof(value);
value = 0xdead;
err = getsockopt(s, level, IP_DONTFRAGMENT, (char *) &value, &size);
ok(!err, "Expected 0, got %d with error %d\n", err, GetLastError());
ok(value == 0, "Expected 0, got %d\n", value);
size = sizeof(value);
value = 1;
err = setsockopt(s, level, IP_DONTFRAGMENT, (char *) &value, size);
ok(!err, "Expected 0, got %d with error %d\n", err, GetLastError());
value = 0xdead;
err = getsockopt(s, level, IP_DONTFRAGMENT, (char *) &value, &size);
ok(!err, "Expected 0, got %d with error %d\n", err, GetLastError());
ok(value == 1, "Expected 1, got %d\n", value);
closesocket(s);
}
}
......
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