Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47956 Signed-off-by: Fabian Maurer dark.shadow4@web.de --- v2: Don't modify caller data --- dlls/ws2_32/socket.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c index aa0a164ff9..22a07ce893 100644 --- a/dlls/ws2_32/socket.c +++ b/dlls/ws2_32/socket.c @@ -692,6 +692,10 @@ static const int ws_ip_map[][2] = MAP_OPTION( IP_MULTICAST_LOOP ), MAP_OPTION( IP_ADD_MEMBERSHIP ), MAP_OPTION( IP_DROP_MEMBERSHIP ), + MAP_OPTION( IP_ADD_SOURCE_MEMBERSHIP ), + MAP_OPTION( IP_DROP_SOURCE_MEMBERSHIP ), + MAP_OPTION( IP_BLOCK_SOURCE ), + MAP_OPTION( IP_UNBLOCK_SOURCE ), MAP_OPTION( IP_OPTIONS ), #ifdef IP_HDRINCL MAP_OPTION( IP_HDRINCL ), @@ -5801,6 +5805,7 @@ int WINAPI WS_setsockopt(SOCKET s, int level, int optname, int woptval; struct linger linger; struct timeval tval; + struct ip_mreq_source mreq_source;
TRACE("(socket %04lx, %s, optval %s, optlen %d)\n", s, debugstr_sockopt(level, optname), debugstr_optval(optval, optlen), @@ -6011,6 +6016,23 @@ int WINAPI WS_setsockopt(SOCKET s, int level, int optname, case WS_IPPROTO_IP: switch(optname) { + case WS_IP_ADD_SOURCE_MEMBERSHIP: + case WS_IP_DROP_SOURCE_MEMBERSHIP: + case WS_IP_BLOCK_SOURCE: + case WS_IP_UNBLOCK_SOURCE: + { + /* ip_mreq_source is different on Windows (switched source/interface)m so we need to make a copy */ + WS_IP_MREQ_SOURCE* val = (void*)optval; + mreq_source.imr_interface.s_addr = val->imr_interface.S_un.S_addr; + mreq_source.imr_multiaddr.s_addr = val->imr_multiaddr.S_un.S_addr; + mreq_source.imr_sourceaddr.s_addr = val->imr_sourceaddr.S_un.S_addr; + + optval = (char*)&mreq_source; + optlen = sizeof(mreq_source); + + convert_sockopt(&level, &optname); + break; + } case WS_IP_ADD_MEMBERSHIP: case WS_IP_DROP_MEMBERSHIP: #ifdef IP_HDRINCL -- 2.23.0
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=57976
Your paranoid android.
=== debian10 (32 bit report) ===
ws2_32: sock.c:3058: Test succeeded inside todo block: Test[1]: expected 0, got 0 sock.c:3052: Test failed: Test[2]: expected 2, got 0 sock.c:3058: Test succeeded inside todo block: Test[2]: expected 0, got 0
October 18, 2019 9:28 AM, "Fabian Maurer" dark.shadow4@web.de wrote:
diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c index aa0a164ff9..22a07ce893 100644 --- a/dlls/ws2_32/socket.c +++ b/dlls/ws2_32/socket.c @@ -6011,6 +6016,23 @@ int WINAPI WS_setsockopt(SOCKET s, int level, int optname, case WS_IPPROTO_IP: switch(optname) {
case WS_IP_ADD_SOURCE_MEMBERSHIP:
case WS_IP_DROP_SOURCE_MEMBERSHIP:
case WS_IP_BLOCK_SOURCE:
case WS_IP_UNBLOCK_SOURCE:
{
/* ip_mreq_source is different on Windows (switched source/interface)m so we need to make a copy */
Only on Linux. BSD has it in the same order as Windows.
WS_IP_MREQ_SOURCE* val = (void*)optval;
mreq_source.imr_interface.s_addr = val->imr_interface.S_un.S_addr;
mreq_source.imr_multiaddr.s_addr = val->imr_multiaddr.S_un.S_addr;
mreq_source.imr_sourceaddr.s_addr = val->imr_sourceaddr.S_un.S_addr;
optval = (char*)&mreq_source;
optlen = sizeof(mreq_source);
convert_sockopt(&level, &optname);
break;
} case WS_IP_ADD_MEMBERSHIP: case WS_IP_DROP_MEMBERSHIP:
#ifdef IP_HDRINCL
Chip