server: Always update cached socket name after connect.

Fixes a regression introduced by
5c009c17b3.

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@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Paul Gofman 2022-02-07 19:14:45 +03:00 committed by Alexandre Julliard
parent 9da1a5059d
commit 4c1a288f63
1 changed files with 1 additions and 1 deletions

View File

@ -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;