Paul Gofman : server: Always update cached socket name after connect.

Alexandre Julliard julliard at winehq.org
Tue Feb 8 16:11:45 CST 2022


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

Author: Paul Gofman <pgofman at codeweavers.com>
Date:   Mon Feb  7 19:14:45 2022 +0300

server: Always update cached socket name after connect.

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>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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;
 




More information about the wine-cvs mailing list