[515] in linux-net channel archive
Re: 1.3.0 and traceroute
daemon@ATHENA.MIT.EDU (Derek Wildstar)
Thu Jun 15 23:41:20 1995
Date: Thu, 15 Jun 1995 19:57:51 -0700
From: Derek Wildstar <dwild@starforce.com>
To: firebug <firebug@cloud9.net>
Cc: Carsten Paeth <calle@calle.in-berlin.de>, pko@paradigm.co.za,
linux-kernel@vger.rutgers.edu, linux-net@vger.rutgers.edu
In-Reply-To: <199506152004.UAA06778@cloud9.net>
Maybe you guys missed this, sorry to those who already saw it. I'm not
sure who the author is, but it worked on my system. cd to linux/net/ipv4
and patch.
+----------------------------------------+----------+
| Derek Wildstar <dwild@starforce.com> | |
+----------------------------------------+ Hukt on |
| University of Washington IRC co-admin | fonix |
| alfred1.u.washington.edu:6667,9998 | werkd |
| <irc@u.washington.edu> | fore me! |
+----------------------------------------+----------+
----------------------------------------------------------
--- raw.c~ Tue Jun 6 10:16:44 1995
+++ raw.c Tue Jun 13 17:31:17 1995
@@ -144,6 +144,13 @@
struct iphdr *iph=(struct iphdr *)to;
iph->saddr=saddr;
iph->check=0;
+ iph->tot_len=htons(fraglen); /* This is right as you cant frag
+ RAW packets */
+ /*
+ * Deliberate breach of modularity to keep
+ * ip_build_xmit clean (well less messy).
+ */
+ iph->id = htons(ip_id_count++);
iph->check=ip_fast_csum((unsigned char *)iph, iph->ihl);
}
}
------------------------------------------------------------
On Thu, 15 Jun 1995, firebug wrote:
> > > 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);
>