[512] in linux-net channel archive
Re: 1.3.0 and traceroute
daemon@ATHENA.MIT.EDU (firebug)
Thu Jun 15 17:22:00 1995
To: calle@calle.in-berlin.de (Carsten Paeth)
Date: Thu, 15 Jun 1995 16:03:38 -0400 (EDT)
From: "firebug" <firebug@cloud9.net>
Cc: pko@paradigm.co.za, linux-kernel@vger.rutgers.edu,
linux-net@vger.rutgers.edu
In-Reply-To: <m0sLp4h-00000EC@calle.in-berlin.de> from "Carsten Paeth" at Jun 14, 95 11:49:26 am
> > Anyone tried to run a traceroute to a box not on your own subnet ? Times
> > out on the 1st hop !!?
>
> Yes, I tried yesterday.
> Same result.
> On 1.2.9 it is working.
It does it with a traceroute to anywhere, it does not have to be on the same
subnet.
The IP total length field on traceroute's packets is being set 255 times too
high, so apparantly somewhere there is a htons() there shouldn't be, or a
missing one where there should be.
After perusing the kernel source for a bit, I couldn't find the bug. So, I
decided to look at the traceroute source... It would seem, that since it's
using an IPPROTO_RAW socket, it should be doing any work with the IP header
that has to be done. And, not much to my surprise at that point, I found
that it seems to be missing an htons().
I could be wrong on this, but as far as I can determine, traceroute must
have worked due to a bug in the old kernels that set the length field based
on what it was told in the sendto() instead of leaving it alone like it
should when using IPPROTO_RAW.
So, IMHO, the fix is to send_probe() in traceroute.c:
--- traceroute.c.old Sun Apr 30 17:59:00 1995
+++ traceroute.c Thu Jun 15 15:26:03 1995
@@ -609,7 +609,7 @@
ip->ip_off = 0;
ip->ip_hl = sizeof(*ip) >> 2;
ip->ip_p = IPPROTO_UDP;
- ip->ip_len = datalen;
+ ip->ip_len = htons(datalen);
ip->ip_ttl = ttl;
ip->ip_v = IPVERSION;
ip->ip_id = htons(ident+seq);