* Fix binding to link level sockets. The bound type was constructed using the

sdl_e_type in network byte order, causing such a socket not to receive
  anything.
  When working around that by not using htons() on bind, sending would then fail
  on such a socket because the byte order is actually required to be swapped
  there.
* Extend the comment for the B_NET_FRAME_TYPE macro to document that the input
  types are supposed to be in host byte order to avoid future confusion.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42357 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Lotz 2011-07-01 20:26:37 +00:00
parent 97510b0338
commit 4cde5cc228
2 changed files with 2 additions and 2 deletions

View File

@ -77,7 +77,7 @@ typedef struct ancillary_data_container ancillary_data_container;
#define B_NET_FRAME_TYPE(super, sub) (((int32)(super) << 16) | (sub))
// Use this when registering a device handler, see net/if_types.h for
// the possible "super" values.
// the possible "super" values. Input values are in host byte order.
// sub types

View File

@ -167,7 +167,7 @@ LinkProtocol::Bind(const sockaddr* address)
if (linkAddress.sdl_type != 0) {
fBoundType = B_NET_FRAME_TYPE(linkAddress.sdl_type,
linkAddress.sdl_e_type);
ntohs(linkAddress.sdl_e_type));
// Bind to the type requested - this is needed in order to
// receive any buffers
// TODO: this could be easily changed by introducing catch all or rule