Author: axeld Date: 2010-07-21 16:54:24 +0200 (Wed, 21 Jul 2010) New Revision: 37650 Changeset: http://dev.haiku-os.org/changeset/37650 Modified: haiku/trunk/src/add-ons/kernel/network/protocols/icmp/icmp.cpp haiku/trunk/src/add-ons/kernel/network/protocols/ipv4/ipv4.cpp Log: * ICMP now removes its header before passing the error on to the upper levels. * Therefore, IPv4 no longer needs to mess with that (incorrectly, anyway). * Removed unused include, turned off ICMP debug output. 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-21 14:09:48 UTC (rev 37649) +++ haiku/trunk/src/add-ons/kernel/network/protocols/icmp/icmp.cpp 2010-07-21 14:54:24 UTC (rev 37650) @@ -27,12 +27,10 @@ #include <net_stack.h> #include <NetBufferUtilities.h> -//#include <util/list.h> - #include "ipv4.h" -#define TRACE_ICMP +//#define TRACE_ICMP #ifdef TRACE_ICMP # define TRACE(x...) dprintf(x) #else @@ -70,11 +68,6 @@ ICMPChecksumField; -#define ICMP_TYPE_ECHO_REPLY 0 -#define ICMP_TYPE_UNREACH 3 -#define ICMP_TYPE_REDIRECT 5 -#define ICMP_TYPE_ECHO_REQUEST 8 - // type unreach codes #define ICMP_CODE_UNREACH_NEED_FRAGMENT 4 // this is used for path MTU discovery @@ -365,6 +358,7 @@ if (error > 0) { // Deliver the error to the domain protocol which will // propagate the error to the upper protocols + bufferHeader.Remove(); return domain->module->error_received(error, buffer); } break; Modified: haiku/trunk/src/add-ons/kernel/network/protocols/ipv4/ipv4.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/network/protocols/ipv4/ipv4.cpp 2010-07-21 14:09:48 UTC (rev 37649) +++ haiku/trunk/src/add-ons/kernel/network/protocols/ipv4/ipv4.cpp 2010-07-21 14:54:24 UTC (rev 37650) @@ -733,7 +733,7 @@ // and lists for RAW and non-RAW sockets. return deliver_multicast(&gIPv4Module, buffer, true); } - + RawSocketList::Iterator iterator = sRawSockets.GetIterator(); size_t count = 0; @@ -1679,16 +1679,14 @@ status_t -ipv4_error_received(uint32 code, net_buffer* data) +ipv4_error_received(uint32 code, net_buffer* buffer) { - // Extracts the IP header in the ICMP message - NetBufferFieldReader<ipv4_header, 8> header(data); - net_protocol_module_info* protocol = receiving_protocol(header->protocol); + net_protocol_module_info* protocol = receiving_protocol(buffer->protocol); if (protocol == NULL) return B_ERROR; // propagate error - return protocol->error_received(code, data); + return protocol->error_received(code, buffer); }