[PATCH] server: Always update cached socket name after connect.
Paul Gofman
pgofman at codeweavers.com
Mon Feb 7 10:14:45 CST 2022
Fixes a regression introduced by
5c009c17b3a212c3f5b0034c465077c0c593daae.
For IPV6 socket already bound with bind() with IPV6_V6ONLY set to 0
the address returned by getsockname() may change after it is connected
to a IPV4 peer (e. g., from :: to ::ffff:192.0.2.128).
The effect of blamed commit is that before that Unix getsockname()
was called for each ws2_32 getsockname() and after the commit the
socket name is cached at bind and connect.
Signed-off-by: Paul Gofman <pgofman at codeweavers.com>
---
Fixes Street Fighter V connection to server. The game first sets IPV6_V6ONLY to 0, then binds the IPV6 socket
to "::", then calls for WSAConnectEx and keeps querying the address, which in the correct case should become
e. g. ::ffff:192.0.2.128 after connection but stays at the initial state after the blamed commit.
server/sock.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/server/sock.c b/server/sock.c
index 40fb0cac535..512b7c0f78e 100644
--- a/server/sock.c
+++ b/server/sock.c
@@ -2340,7 +2340,7 @@ static void sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
allow_fd_caching( sock->fd );
unix_len = sizeof(unix_addr);
- if (!sock->bound && !getsockname( unix_fd, &unix_addr.addr, &unix_len ))
+ if (!getsockname( unix_fd, &unix_addr.addr, &unix_len ))
sock->addr_len = sockaddr_from_unix( &unix_addr, &sock->addr.addr, sizeof(sock->addr) );
sock->bound = 1;
--
2.34.1
More information about the wine-devel
mailing list