]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - src/icmp/Icmp.cc
SourceFormat Enforcement
[thirdparty/squid.git] / src / icmp / Icmp.cc
index 38c0c0419446090e6b1306f4622f10e7c61e3286..25c490942cb912447cd0a72b50559b0007ffc3ae 100644 (file)
@@ -1,40 +1,17 @@
 /*
- * $Id: icmp.cc,v 1.94 2007/12/14 23:11:47 amosjeffries Exp $
- *
- * DEBUG: section 37    ICMP Routines
- * AUTHOR: Duane Wessels, Amos Jeffries
- *
- * SQUID Web Proxy Cache          http://www.squid-cache.org/
- * ----------------------------------------------------------
- *
- *  Squid is the result of efforts by numerous individuals from
- *  the Internet community; see the CONTRIBUTORS file for full
- *  details.   Many organizations have provided support for Squid's
- *  development; see the SPONSORS file for full details.  Squid is
- *  Copyrighted (C) 2001 by the Regents of the University of
- *  California; see the COPYRIGHT file for full details.  Squid
- *  incorporates software developed and/or copyrighted by other
- *  sources; see the CREDITS file for full details.
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
+ * Copyright (C) 1996-2017 The Squid Software Foundation and contributors
  *
+ * Squid software is distributed under GPLv2+ license and includes
+ * contributions from numerous individuals and organizations.
+ * Please see the COPYING and CONTRIBUTORS files for details.
  */
+
+/* DEBUG: section 37    ICMP Routines */
+
 #include "squid.h"
+#include "Debug.h"
 #include "Icmp.h"
 #include "SquidTime.h"
-#include "Debug.h"
 
 Icmp::Icmp()
 {
@@ -64,12 +41,13 @@ Icmp::CheckSum(unsigned short *ptr, int size)
     unsigned short oddbyte;
     unsigned short answer;
 
-    if (!ptr) return 65535; // bad input.
+    if (!ptr) return (int)htons(0xffff); // bad input.
 
     sum = 0;
 
     while (size > 1) {
-        sum += *ptr++;
+        sum += *ptr;
+        ++ptr;
         size -= 2;
     }
 
@@ -107,7 +85,7 @@ Icmp::ipHops(int ttl)
 }
 
 void
-Icmp::Log(const IPAddress &addr, const u_int8_t type, const char* pkt_str, const int rtt, const int hops)
+Icmp::Log(const Ip::Address &addr, const uint8_t type, const char* pkt_str, const int rtt, const int hops)
 {
     debugs(42, 2, "pingerLog: " << std::setw(9) << current_time.tv_sec  <<
            "." << std::setfill('0') << std::setw(6) <<
@@ -118,3 +96,4 @@ Icmp::Log(const IPAddress &addr, const u_int8_t type, const char* pkt_str, const
 }
 
 #endif /* USE_ICMP */
+