* 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:
Axel Dörfler
2010-12-04 14:33:02 +00:00
parent 341056ce05
commit 04f8af7bf9
+5 -1
View File
@@ -182,6 +182,9 @@ LinkProtocol::Bind(const sockaddr* address)
fBoundToDevice = boundTo; fBoundToDevice = boundTo;
socket->bound_to_device = boundTo->device->index; 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; return B_OK;
} }
@@ -198,6 +201,7 @@ LinkProtocol::Unbind()
put_device_interface(fBoundToDevice); put_device_interface(fBoundToDevice);
socket->bound_to_device = 0; socket->bound_to_device = 0;
socket->address.ss_len = 0;
return B_OK; return B_OK;
} }
@@ -217,7 +221,7 @@ LinkProtocol::MTU()
status_t status_t
LinkProtocol::SocketStatus(bool peek) const LinkProtocol::SocketStatus(bool peek) const
{ {
if (fMonitoredDevice == NULL) if (fMonitoredDevice == NULL && !IsBound())
return B_DEVICE_NOT_FOUND; return B_DEVICE_NOT_FOUND;
return LocalDatagramSocket::SocketStatus(peek); return LocalDatagramSocket::SocketStatus(peek);