From fcea1b1665d2048833de13c30b72ed15aa67d2b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Wed, 21 Jul 2010 14:54:24 +0000 Subject: [PATCH] * 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. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37650 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/network/protocols/icmp/icmp.cpp | 10 ++-------- src/add-ons/kernel/network/protocols/ipv4/ipv4.cpp | 10 ++++------ 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/src/add-ons/kernel/network/protocols/icmp/icmp.cpp b/src/add-ons/kernel/network/protocols/icmp/icmp.cpp index 14f8959988..dee67029ee 100644 --- a/src/add-ons/kernel/network/protocols/icmp/icmp.cpp +++ b/src/add-ons/kernel/network/protocols/icmp/icmp.cpp @@ -27,12 +27,10 @@ #include #include -//#include - #include "ipv4.h" -#define TRACE_ICMP +//#define TRACE_ICMP #ifdef TRACE_ICMP # define TRACE(x...) dprintf(x) #else @@ -70,11 +68,6 @@ typedef NetBufferField 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 @@ icmp_receive_data(net_buffer* buffer) 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; diff --git a/src/add-ons/kernel/network/protocols/ipv4/ipv4.cpp b/src/add-ons/kernel/network/protocols/ipv4/ipv4.cpp index 88963875e3..55bc52a64d 100644 --- a/src/add-ons/kernel/network/protocols/ipv4/ipv4.cpp +++ b/src/add-ons/kernel/network/protocols/ipv4/ipv4.cpp @@ -733,7 +733,7 @@ raw_receive_data(net_buffer* buffer) // 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 @@ ipv4_deliver_data(net_protocol* _protocol, net_buffer* buffer) 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 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); }