From e1771d9b1d23e2c97192be5d9b42cbd4a3c337ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Mon, 15 Jan 2007 15:14:02 +0000 Subject: [PATCH] Calmed down ICMP protocol module as well. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19812 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../kernel/network/protocols/icmp/icmp.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/add-ons/kernel/network/protocols/icmp/icmp.cpp b/src/add-ons/kernel/network/protocols/icmp/icmp.cpp index 5111721240..8fd6a64925 100644 --- a/src/add-ons/kernel/network/protocols/icmp/icmp.cpp +++ b/src/add-ons/kernel/network/protocols/icmp/icmp.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2006, Haiku, Inc. All Rights Reserved. + * Copyright 2006-2007, Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. * * Authors: @@ -20,6 +20,13 @@ #include #include +//#define TRACE_ICMP +#ifdef TRACE_ICMP +# define TRACE(x) dprintf x +#else +# define TRACE(x) ; +#endif + struct icmp_header { uint8 type; @@ -202,7 +209,7 @@ icmp_get_mtu(net_protocol *protocol, const struct sockaddr *address) status_t icmp_receive_data(net_buffer *buffer) { - dprintf("ICMP received some data, buffer length %lu\n", buffer->size); + TRACE(("ICMP received some data, buffer length %lu\n", buffer->size)); NetBufferHeader bufferHeader(buffer); if (bufferHeader.Status() < B_OK) @@ -212,9 +219,10 @@ icmp_receive_data(net_buffer *buffer) bufferHeader.Detach(); // the pointer stays valid after this - dprintf(" got type %u, code %u, checksum %u\n", header.type, header.code, - ntohs(header.checksum)); - dprintf(" computed checksum: %ld\n", gBufferModule->checksum(buffer, 0, buffer->size, true)); + TRACE((" got type %u, code %u, checksum %u\n", header.type, header.code, + ntohs(header.checksum))); + TRACE((" computed checksum: %ld\n", gBufferModule->checksum(buffer, 0, buffer->size, true))); + if (gBufferModule->checksum(buffer, 0, buffer->size, true) != 0) return B_BAD_DATA;