[haiku-commits] r37710 - haiku/trunk/src/add-ons/kernel/network/protocols/icmp

  • From: axeld@xxxxxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 23 Jul 2010 12:04:40 +0200 (CEST)

Author: axeld
Date: 2010-07-23 12:04:40 +0200 (Fri, 23 Jul 2010)
New Revision: 37710
Changeset: http://dev.haiku-os.org/changeset/37710

Modified:
   haiku/trunk/src/add-ons/kernel/network/protocols/icmp/icmp.cpp
Log:
* We need to delay the checksum computation after the reply is complete.
* Also, we need to set the buffer's protocol.
* Now we actually send correct ICMP messages.


Modified: haiku/trunk/src/add-ons/kernel/network/protocols/icmp/icmp.cpp
===================================================================
--- haiku/trunk/src/add-ons/kernel/network/protocols/icmp/icmp.cpp      
2010-07-23 10:02:10 UTC (rev 37709)
+++ haiku/trunk/src/add-ons/kernel/network/protocols/icmp/icmp.cpp      
2010-07-23 10:04:40 UTC (rev 37710)
@@ -463,8 +463,6 @@
        icmpHeader->gateway = errorData ? *((uint32*)errorData) : 0;
        icmpHeader->checksum = 0;
        icmpHeader.Sync();
-       *ICMPChecksumField(reply)
-               = gBufferModule->checksum(reply, 0, reply->size, true);
 
        // Append IP header + 8 byte of the original datagram
        status_t status = gBufferModule->append_restored_header(reply, buffer, 
0,
@@ -474,7 +472,12 @@
                if (domain == NULL)
                        return B_ERROR;
 
-               TRACE("  send ICMP message to %s\n", AddressString(
+               *ICMPChecksumField(reply)
+                       = gBufferModule->checksum(reply, 0, reply->size, true);
+
+               reply->protocol = IPPROTO_ICMP;
+
+               TRACE("  send ICMP message %p to %s\n", reply, AddressString(
                                domain->address_module, reply->destination, 
true).Data());
 
                status = domain->module->send_data(NULL, reply);


Other related posts:

  • » [haiku-commits] r37710 - haiku/trunk/src/add-ons/kernel/network/protocols/icmp - axeld