[haiku-commits] r34669 - haiku/trunk/src/add-ons/kernel/network/stack

  • From: axeld@xxxxxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Tue, 15 Dec 2009 18:40:14 +0100 (CET)

Author: axeld
Date: 2009-12-15 18:40:14 +0100 (Tue, 15 Dec 2009)
New Revision: 34669
Changeset: http://dev.haiku-os.org/changeset/34669/haiku

Modified:
   haiku/trunk/src/add-ons/kernel/network/stack/net_socket.cpp
Log:
* Made sure the sockaddr::sa_len field is set correctly for sendto(), and
  connect().
* This fixes not working connections whenever the incoming sa_len field happened
  to be zero.


Modified: haiku/trunk/src/add-ons/kernel/network/stack/net_socket.cpp
===================================================================
--- haiku/trunk/src/add-ons/kernel/network/stack/net_socket.cpp 2009-12-15 
17:00:03 UTC (rev 34668)
+++ haiku/trunk/src/add-ons/kernel/network/stack/net_socket.cpp 2009-12-15 
17:40:14 UTC (rev 34669)
@@ -266,17 +266,17 @@
                messageHeader->msg_controllen = 0;
                return B_OK;
        }
-       
+
        if (socket->first_info->process_ancillary_data_no_container == NULL)
                return EOPNOTSUPP;
-       
+
        bytesWritten = socket->first_info->process_ancillary_data_no_container(
                socket->first_protocol, buffer, dataBuffer,
                messageHeader->msg_controllen);
        if (bytesWritten < 0)
                return bytesWritten;
        messageHeader->msg_controllen = bytesWritten;
-       
+
        return B_OK;
 }
 
@@ -975,6 +975,7 @@
        }
 
        memcpy(&socket->address, address, sizeof(sockaddr));
+       socket->address.ss_len = sizeof(sockaddr_storage);
 
        status_t status = socket->first_info->bind(socket->first_protocol,
                (sockaddr*)address);
@@ -1201,7 +1202,7 @@
                                = gNetBufferModule.get_ancillary_data(buffer);
                        if (container != NULL)
                                status = process_ancillary_data(socket, 
container, header);
-                       else 
+                       else
                                status = process_ancillary_data(socket, buffer, 
header);
                        if (status != B_OK) {
                                gNetBufferModule.free(buffer);
@@ -1424,6 +1425,7 @@
                buffer->flags = flags;
                memcpy(buffer->source, &socket->address, 
socket->address.ss_len);
                memcpy(buffer->destination, address, addressLength);
+               buffer->destination->sa_len = addressLength;
 
                if (status == B_OK) {
                        status = 
socket->first_info->send_data(socket->first_protocol,


Other related posts:

  • » [haiku-commits] r34669 - haiku/trunk/src/add-ons/kernel/network/stack - axeld