Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Jan 2000 20:45:59 -0500
From:      Greg Rumple <grumple@zaphon.llamas.net>
To:        freebsd-ports@FreeBSD.ORG
Subject:   mtr 0.41
Message-ID:  <20000127204559.B7463@zaphon.llamas.net>

next in thread | raw e-mail | index | archive | help
I was using mtr 0.41 fine for a while and then it stopped working for me
on both 3.4-STABLE and 4.0-CURRENT.  I finally spent the time last night
to determine what the problem is with it and fix it.

It appears that in the IPHeader that is sent in the ping, that mtr
inbeds the PID of the process, so that it can verify on the reply that
it was from mtr.  Well it stores this value in a 16-bit integer
location.  Well examination of my system showed that PID's on FreeBSD
now go very high (mine was at like at 83500 at the time of my gdb
session), much larger than a 16 bit value.  So I made the following
change to the code which allows mtr to work again on my system (even
after my PID's roll past a 16-bit value).

-------------------------------------------------------------------
diff -r -u mtr-0.41/net.c mtr-0.41.patched/net.c
--- mtr-0.41/net.c      Thu Jan 27 20:42:00 2000
+++ mtr-0.41.patched/net.c      Thu Jan 27 20:42:44 2000
@@ -282,7 +282,7 @@
 
   header = (struct ICMPHeader *)(packet + sizeof(struct IPHeader));
   if(header->type == ICMP_ECHOREPLY) {
-    if(header->id != getpid())
+    if(header->id != (uint16)getpid())
       return;
 
     net_process_ping(header->sequence, fromaddr.sin_addr.s_addr, now);
@@ -293,7 +293,7 @@
     
     header = (struct ICMPHeader *)(packet + sizeof(struct IPHeader) + 
                                sizeof(struct ICMPHeader) + sizeof(struct IPHeader));
-    if(header->id != getpid())
+    if(header->id != (uint16)getpid())
       return;
 
     net_process_ping(header->sequence, fromaddr.sin_addr.s_addr, now);

-------------------------------------------------------------------

Of course this does possibly allow two copies of mtr to collide on a
system.  But honestly I'm not to worried about this happening.  And if
it does, I'll be heading out to buy a lottery ticket cuz it's my lucky
day.

Greg

-- 
Greg Rumple
grumple@zaphon.llamas.net


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000127204559.B7463>