Erich Hoover : ws2_32: Silence error when binding to loopback adapter.
Alexandre Julliard
julliard at winehq.org
Fri Oct 12 11:37:44 CDT 2012
Module: wine
Branch: master
Commit: 9f1b1bef5cd174f957dacb73856f4019d90b862e
URL: http://source.winehq.org/git/wine.git/?a=commit;h=9f1b1bef5cd174f957dacb73856f4019d90b862e
Author: Erich Hoover <ehoover at mines.edu>
Date: Thu Oct 11 14:08:23 2012 -0600
ws2_32: Silence error when binding to loopback adapter.
---
dlls/ws2_32/socket.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
index f978350..792ab1c 100644
--- a/dlls/ws2_32/socket.c
+++ b/dlls/ws2_32/socket.c
@@ -2146,13 +2146,14 @@ static BOOL interface_bind( SOCKET s, int fd, struct sockaddr *addr )
{
struct sockaddr_in *in_sock = (struct sockaddr_in *) addr;
unsigned int sock_type = 0, optlen = sizeof(sock_type);
+ in_addr_t bind_addr = in_sock->sin_addr.s_addr;
PIP_ADAPTER_INFO adapters = NULL, adapter;
BOOL ret = FALSE;
DWORD adap_size;
int enable = 1;
- if (in_sock->sin_addr.s_addr == htonl(WS_INADDR_ANY))
- return FALSE; /* Not binding to specific interface, uses default route */
+ if (bind_addr == htonl(WS_INADDR_ANY) || bind_addr == htonl(WS_INADDR_LOOPBACK))
+ return FALSE; /* Not binding to a network adapter, special interface binding unnecessary. */
if (getsockopt(fd, SOL_SOCKET, SO_TYPE, &sock_type, &optlen) == -1 || sock_type != SOCK_DGRAM)
return FALSE; /* Special interface binding is only necessary for UDP datagrams. */
if (GetAdaptersInfo(NULL, &adap_size) != ERROR_BUFFER_OVERFLOW)
@@ -2165,7 +2166,7 @@ static BOOL interface_bind( SOCKET s, int fd, struct sockaddr *addr )
{
in_addr_t adapter_addr = (in_addr_t) inet_addr(adapter->IpAddressList.IpAddress.String);
- if (in_sock->sin_addr.s_addr == adapter_addr)
+ if (bind_addr == adapter_addr)
{
#if defined(IP_BOUND_IF)
/* IP_BOUND_IF sets both the incoming and outgoing restriction at once */
More information about the wine-cvs
mailing list