]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
ipHops() off-by-ones
authorwessels <>
Sat, 25 Jan 1997 05:18:39 +0000 (05:18 +0000)
committerwessels <>
Sat, 25 Jan 1997 05:18:39 +0000 (05:18 +0000)
src/pinger.cc

index 653296d60bee7077b3ca29dd147bfa269f0d578b..d596044e68ad3195d64e2bdd8db9510576d18f25 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: pinger.cc,v 1.18 1996/12/14 18:55:00 wessels Exp $
+ * $Id: pinger.cc,v 1.19 1997/01/24 22:18:39 wessels Exp $
  *
  * DEBUG: section 42    ICMP Pinger program
  * AUTHOR: Duane Wessels
@@ -267,15 +267,17 @@ pingerLog(struct icmphdr *icmp, struct in_addr addr, int rtt, int hops)
 static int
 ipHops(int ttl)
 {
-    if (ttl < 32)
-       return 32 - ttl;
-    if (ttl < 64)
-       return 62 - ttl;        /* 62 = (64+60)/2 */
-    if (ttl < 128)
-       return 128 - ttl;
-    if (ttl < 192)
-       return 192 - ttl;
-    return 255 - ttl;
+    if (ttl < 33)
+       return 33 - ttl;
+    if (ttl < 63)
+       return 63 - ttl;        /* 62 = (64+60)/2 */
+    if (ttl < 65)
+       return 65 - ttl;        /* 62 = (64+60)/2 */
+    if (ttl < 129)
+       return 129 - ttl;
+    if (ttl < 193)
+       return 193 - ttl;
+    return 256 - ttl;
 }
 
 static int