From: wessels <> Date: Sat, 25 Jan 1997 05:18:39 +0000 (+0000) Subject: ipHops() off-by-ones X-Git-Tag: SQUID_3_0_PRE1~5167 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f15528f6c52e590018c16ec95b2a27f8e5b56bc3;p=thirdparty%2Fsquid.git ipHops() off-by-ones --- diff --git a/src/pinger.cc b/src/pinger.cc index 653296d60b..d596044e68 100644 --- a/src/pinger.cc +++ b/src/pinger.cc @@ -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