From 6404b0051215f3bff8dff65b629ec7c971cdd059 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Fri, 23 Jul 2010 10:04:40 +0000 Subject: [PATCH] * 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. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37710 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/network/protocols/icmp/icmp.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/add-ons/kernel/network/protocols/icmp/icmp.cpp b/src/add-ons/kernel/network/protocols/icmp/icmp.cpp index 83d84735a5..c312de8a37 100644 --- a/src/add-ons/kernel/network/protocols/icmp/icmp.cpp +++ b/src/add-ons/kernel/network/protocols/icmp/icmp.cpp @@ -463,8 +463,6 @@ icmp_error_reply(net_protocol* protocol, net_buffer* buffer, uint32 code, 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 @@ icmp_error_reply(net_protocol* protocol, net_buffer* buffer, uint32 code, 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);