--- Makefile +++ Makefile 1996/08/14 17:51:58 @@ -2,6 +2,7 @@ BINDEST = /usr/sbin MANDEST = /usr/man/man8 +DOC = /usr/doc/packages/traceroute CFLAGS = -I. -O2 -Wall -Wno-unused @@ -9,9 +10,10 @@ $(CC) -o $@ $@.o $(LFLAGS) install: $(PROG) - cp $(PROG) $(BINDEST) - cp $(PROG).8 $(MANDEST) - chmod a=x,u+s $(BINDEST)/$(PROG) + install -s -m 4755 traceroute $(BINDEST) + install -m 0644 traceroute.8 ${DEBDIR}$(MANDEST) + mkdir -p $(DOC) + install -m 0644 *.awk ${DOC} clean: $(RM) $(PROG) $(PROG).o --- Makefile.Linux +++ Makefile.Linux 1996/08/14 17:51:58 @@ -0,0 +1,18 @@ +# +# +# Makefile.Linux to integrate package into source tree of S.u.S.E.-Linux +# +# Copyright (C) 1996 S.u.S.E. GmbH Fuerth, Germany. +# +# Please send bug-fixes or comments to feedback@suse.de. +# +# Author: Florian La Roche +# +# + +compile: + make + +install: + make install + --- README.awk +++ README.awk 1996/08/14 17:51:58 @@ -0,0 +1,14 @@ +A couple of awk programs to massage the traceroute output are +included. "mean.awk" and "median.awk" compute the mean and median +time to each hop, respectively. I've found that something like + + traceroute -q 7 foo.somewhere >t + awk -f median.awk t | graph + +can give you a quick picture of the bad spots on a long +path (median is usually a better noise filter than mean). + +Enjoy. + + - Van Jacobson (van@helios.ee.lbl.gov) + --- mean.awk +++ mean.awk 1996/08/14 17:51:58 @@ -1,4 +1,4 @@ -#!/bin/awk -f +#!/usr/bin/awk -f # # Copyright (c) 1990, 1993 # The Regents of the University of California. All rights reserved. --- median.awk +++ median.awk 1996/08/14 17:51:58 @@ -1,4 +1,4 @@ -#!/bin/awk -f +#!/usr/bin/awk -f # # Copyright (c) 1990, 1993 # The Regents of the University of California. All rights reserved. --- traceroute.c +++ traceroute.c 1996/08/14 17:51:58 @@ -454,8 +454,10 @@ #ifdef IP_HDRINCL if (setsockopt(sndsock, IPPROTO_IP, IP_HDRINCL, (char *)&on, sizeof(on)) < 0) { - perror("traceroute: IP_HDRINCL"); - exit(6); + if (errno != ENOPROTOOPT) { + perror("traceroute: IP_HDRINCL"); + exit(6); + } } #endif IP_HDRINCL if (options & SO_DEBUG) @@ -481,6 +483,8 @@ } #endif IP_HDRINCL } + /* just in case, and to make ps show who is running traceroute */ + setuid(getuid()); Fprintf(stderr, "traceroute to %s (%s)", hostname, inet_ntoa(to->sin_addr)); @@ -609,7 +613,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); @@ -843,7 +847,7 @@ else { in.s_addr = ntohl(in.s_addr); #define C(x) ((x) & 0xff) - Sprintf(line, "%lu.%lu.%lu.%lu", C(in.s_addr >> 24), + Sprintf(line, "%u.%u.%u.%u", C(in.s_addr >> 24), C(in.s_addr >> 16), C(in.s_addr >> 8), C(in.s_addr)); } return (line);