I think this is a security issue. Listening to 0.0.0.0 instead of my VPN address that is not yet up is a problem. With the fix, the bind fails if the address is invalid.
From: Gabriel Brand gabrielb@braincalibration.de
--- dlls/ws2_32/tests/sock.c | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c index c2345c1fa60..b43d7d61867 100644 --- a/dlls/ws2_32/tests/sock.c +++ b/dlls/ws2_32/tests/sock.c @@ -12526,6 +12526,11 @@ static void test_bind(void)
s = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
+ WSASetLastError(0xdeadbeef); + ret = bind(s, (const struct sockaddr *)&invalid_addr, sizeof(invalid_addr)); + ok(ret == -1, "expected failure\n"); + ok(WSAGetLastError() == WSAEADDRNOTAVAIL, "got error %u\n", WSAGetLastError()); + WSASetLastError(0xdeadbeef); ret = bind(s, (const struct sockaddr *)&bind_addr, sizeof(bind_addr)); ok(!ret, "expected success\n");
From: Gabriel Brand gabrielb@braincalibration.de
This fixes returning success if the address is not found. --- server/sock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/server/sock.c b/server/sock.c index 84c0d4a4931..c34fd3eb5eb 100644 --- a/server/sock.c +++ b/server/sock.c @@ -2231,7 +2231,7 @@ static int bind_to_interface( struct sock *sock, const struct sockaddr_in *addr in_addr_t bind_addr = addr->sin_addr.s_addr; struct ifaddrs *ifaddrs, *ifaddr; int fd = get_unix_fd( sock->fd ); - int err = 0; + int err = -1;
if (bind_addr == htonl( INADDR_ANY ) || bind_addr == htonl( INADDR_LOOPBACK )) return 0;
From: Gabriel Brand gabrielb@braincalibration.de
--- dlls/kernelbase/winerror.mc | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/dlls/kernelbase/winerror.mc b/dlls/kernelbase/winerror.mc index da36b0f59bc..45ad7153463 100644 --- a/dlls/kernelbase/winerror.mc +++ b/dlls/kernelbase/winerror.mc @@ -3770,6 +3770,11 @@ SymbolicName=WSAEMFILE Language=ENU Too many open files. . +MessageId=10049 +SymbolicName=WSAEADDRNOTAVAIL +Language=ENU +Cannot assign requested address. +. MessageId=10054 SymbolicName=WSAECONNRESET Language=ENU
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=141516
Your paranoid android.
=== w1064_2qxl (64 bit report) ===
ws2_32: sock.c:13054: Test failed: wait timed out sock.c:13070: Test failed: wait timed out sock.c:13083: Test failed: got size 5 sock.c:13084: Test failed: got "datad" sock.c:12918: Test failed: got size 0 sock.c:12919: Test failed: got "" sock.c:12918: Test failed: got size 0 sock.c:12919: Test failed: got ""
=== w1064_adm (64 bit report) ===
ws2_32: sock.c:13054: Test failed: wait timed out sock.c:12918: Test failed: got size 5 sock.c:12918: Test failed: got size 3 sock.c:12919: Test failed: got "datad" sock.c:12919: Test failed: got "ata"
=== w10pro64_ar (64 bit report) ===
ws2_32: sock.c:4724: Test failed: expected 1, got 0 sock.c:4725: Test failed: fdWrite socket is not in the set