* 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
This commit is contained in:
Axel Dörfler 2010-07-21 14:54:24 +00:00
parent 82a115e8bc
commit fcea1b1665
2 changed files with 6 additions and 14 deletions

View File

@ -27,12 +27,10 @@
#include <net_stack.h> #include <net_stack.h>
#include <NetBufferUtilities.h> #include <NetBufferUtilities.h>
//#include <util/list.h>
#include "ipv4.h" #include "ipv4.h"
#define TRACE_ICMP //#define TRACE_ICMP
#ifdef TRACE_ICMP #ifdef TRACE_ICMP
# define TRACE(x...) dprintf(x) # define TRACE(x...) dprintf(x)
#else #else
@ -70,11 +68,6 @@ typedef NetBufferField<uint16, offsetof(icmp_header, checksum)>
ICMPChecksumField; 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 // type unreach codes
#define ICMP_CODE_UNREACH_NEED_FRAGMENT 4 #define ICMP_CODE_UNREACH_NEED_FRAGMENT 4
// this is used for path MTU discovery // this is used for path MTU discovery
@ -365,6 +358,7 @@ icmp_receive_data(net_buffer* buffer)
if (error > 0) { if (error > 0) {
// Deliver the error to the domain protocol which will // Deliver the error to the domain protocol which will
// propagate the error to the upper protocols // propagate the error to the upper protocols
bufferHeader.Remove();
return domain->module->error_received(error, buffer); return domain->module->error_received(error, buffer);
} }
break; break;

View File

@ -1679,16 +1679,14 @@ ipv4_deliver_data(net_protocol* _protocol, net_buffer* buffer)
status_t 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 net_protocol_module_info* protocol = receiving_protocol(buffer->protocol);
NetBufferFieldReader<ipv4_header, 8> header(data);
net_protocol_module_info* protocol = receiving_protocol(header->protocol);
if (protocol == NULL) if (protocol == NULL)
return B_ERROR; return B_ERROR;
// propagate error // propagate error
return protocol->error_received(code, data); return protocol->error_received(code, buffer);
} }