Translate connect()s to INADDR_ANY to INADDR_LOOPBACK. Not sure, if that
is required, but Linux seems to do it. It also allows us to create AF_INET socketpair()s -- not really needed, but probably nice for testing. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25126 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -417,6 +417,15 @@ TCPEndpoint::Connect(const sockaddr *address)
|
||||
} else if (fState != CLOSED)
|
||||
return EINPROGRESS;
|
||||
|
||||
// consider destination address INADDR_ANY as INADDR_LOOPBACK
|
||||
sockaddr_in _address;
|
||||
if (((sockaddr_in*)address)->sin_addr.s_addr == INADDR_ANY) {
|
||||
memcpy(&_address, address, sizeof(sockaddr_in));
|
||||
_address.sin_len = sizeof(sockaddr_in);
|
||||
_address.sin_addr.s_addr = INADDR_LOOPBACK;
|
||||
address = (sockaddr*)&_address;
|
||||
}
|
||||
|
||||
status_t status = _PrepareSendPath(address);
|
||||
if (status < B_OK)
|
||||
return status;
|
||||
|
||||
Reference in New Issue
Block a user