* net_protocol::bind() needs to set the socket's address. This now gives
the correct sender MAC address in outgoing link level packets. * SocketStatus() now also works correctly for bound protocols, ie. receiving data from a bound link level socket is now working as well. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39722 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -182,6 +182,9 @@ LinkProtocol::Bind(const sockaddr* address)
|
||||
fBoundToDevice = boundTo;
|
||||
socket->bound_to_device = boundTo->device->index;
|
||||
|
||||
memcpy(&socket->address, address, sizeof(struct sockaddr_storage));
|
||||
socket->address.ss_len = sizeof(struct sockaddr_storage);
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
@@ -198,6 +201,7 @@ LinkProtocol::Unbind()
|
||||
put_device_interface(fBoundToDevice);
|
||||
|
||||
socket->bound_to_device = 0;
|
||||
socket->address.ss_len = 0;
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
@@ -217,7 +221,7 @@ LinkProtocol::MTU()
|
||||
status_t
|
||||
LinkProtocol::SocketStatus(bool peek) const
|
||||
{
|
||||
if (fMonitoredDevice == NULL)
|
||||
if (fMonitoredDevice == NULL && !IsBound())
|
||||
return B_DEVICE_NOT_FOUND;
|
||||
|
||||
return LocalDatagramSocket::SocketStatus(peek);
|
||||
|
||||
Reference in New Issue
Block a user