diff options
author | Mike Frysinger <vapier@gentoo.org> | 2005-05-03 01:22:29 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2005-05-03 01:22:29 +0000 |
commit | 51ab54c9bdc44d51b37d92ebb3f7fd48ca9d49b4 (patch) | |
tree | 4008e686baf3a1f8e3bdba38f0d39c547c1906a5 /net-analyzer/traceroute | |
parent | Fix for problem where no files got installed. See bug #90906. (diff) | |
download | historical-51ab54c9bdc44d51b37d92ebb3f7fd48ca9d49b4.tar.gz historical-51ab54c9bdc44d51b37d92ebb3f7fd48ca9d49b4.tar.bz2 historical-51ab54c9bdc44d51b37d92ebb3f7fd48ca9d49b4.zip |
Add a bunch of misc patches from Redhat.
Package-Manager: portage-2.0.51.21
Diffstat (limited to 'net-analyzer/traceroute')
11 files changed, 689 insertions, 4 deletions
diff --git a/net-analyzer/traceroute/ChangeLog b/net-analyzer/traceroute/ChangeLog index e2207b769b91..0fe17f5e92d6 100644 --- a/net-analyzer/traceroute/ChangeLog +++ b/net-analyzer/traceroute/ChangeLog @@ -1,6 +1,18 @@ # ChangeLog for net-analyzer/traceroute -# Copyright 2002-2004 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/net-analyzer/traceroute/ChangeLog,v 1.22 2004/12/05 03:43:07 obz Exp $ +# Copyright 1999-2005 Gentoo Foundation; Distributed under the GPL v2 +# $Header: /var/cvsroot/gentoo-x86/net-analyzer/traceroute/ChangeLog,v 1.23 2005/05/03 01:22:29 vapier Exp $ + +*traceroute-1.4_p12-r3 (03 May 2005) + + 03 May 2005; Mike Frysinger <vapier@gentoo.org> + +files/traceroute-1.4a12-LDFLAGS.patch, + +files/traceroute-1.4a5-bigpacklen.patch, + +files/traceroute-1.4a5-droproot.patch, + +files/traceroute-1.4a5-llanfairpwllgwyngyllgogerychwyrndrobwllllantysilio + gogogoch.patch, +files/traceroute-1.4a5-lsrr.patch, + +files/traceroute-1.4a5-secfix.patch, + +files/traceroute-1.4a5-unaligned.patch, +traceroute-1.4_p12-r3.ebuild: + Add a bunch of misc patches from Redhat. 05 Dec 2004; Mike Gardiner <obz@gentoo.org> traceroute-1.4_p12-r2.ebuild: Keyworded hppa and ia64, after SpankY's testing diff --git a/net-analyzer/traceroute/Manifest b/net-analyzer/traceroute/Manifest index 42665b2fd505..b21fb5d3fd22 100644 --- a/net-analyzer/traceroute/Manifest +++ b/net-analyzer/traceroute/Manifest @@ -1,6 +1,15 @@ -MD5 aff9a4dee8eed15b59a95ddf2582fb43 ChangeLog 3136 +MD5 476b0f074cf4998fcbd60a79093172dd ChangeLog 3644 MD5 7ed4ef8e3d3fd7d4c7e9682b2519d739 metadata.xml 235 +MD5 6ed03a57d2efaa3f50b3cfb7091e45de traceroute-1.4_p12-r3.ebuild 1421 MD5 1731d7d9c4e9cf77dcbe935e512350bd traceroute-1.4_p12-r2.ebuild 1253 -MD5 fcda909e9a6d3cfd61a2ec945f439ef7 files/digest-traceroute-1.4_p12-r2 68 +MD5 45878a065e3d7577e6177b55d175b7f1 files/traceroute-1.4a5-lsrr.patch 9287 MD5 32d8c8e06ae121436c95a2992552ab84 files/traceroute-1.4-target-resolv.patch 539 MD5 0502b89228de25efeefd5a95fcc58aeb files/traceroute-1.4a12.patch 1097 +MD5 fcda909e9a6d3cfd61a2ec945f439ef7 files/digest-traceroute-1.4_p12-r3 68 +MD5 2cbc4c5f84cfb5e98982fdc14951faa0 files/traceroute-1.4a5-unaligned.patch 769 +MD5 ec9afbce16d7136e1c4a785afacecec6 files/traceroute-1.4a5-llanfairpwllgwyngyllgogerychwyrndrobwllllantysiliogogogoch.patch 1346 +MD5 b5a0fddf1127ff8dff438c21559f1211 files/traceroute-1.4a5-secfix.patch 1151 +MD5 cd50b5830f5b207329b7884746927503 files/traceroute-1.4a5-bigpacklen.patch 530 +MD5 f5c863e684d2ab284f1ad126e2b71fce files/traceroute-1.4a5-droproot.patch 2778 +MD5 7b7dbb5ba09f5fa1eb77df4d1ebc17f6 files/traceroute-1.4a12-LDFLAGS.patch 221 +MD5 fcda909e9a6d3cfd61a2ec945f439ef7 files/digest-traceroute-1.4_p12-r2 68 diff --git a/net-analyzer/traceroute/files/digest-traceroute-1.4_p12-r3 b/net-analyzer/traceroute/files/digest-traceroute-1.4_p12-r3 new file mode 100644 index 000000000000..d4bcb6358e93 --- /dev/null +++ b/net-analyzer/traceroute/files/digest-traceroute-1.4_p12-r3 @@ -0,0 +1 @@ +MD5 964d599ef696efccdeebe7721cd4828d traceroute-1.4a12.tar.gz 74917 diff --git a/net-analyzer/traceroute/files/traceroute-1.4a12-LDFLAGS.patch b/net-analyzer/traceroute/files/traceroute-1.4a12-LDFLAGS.patch new file mode 100644 index 000000000000..e2eaa9e0836c --- /dev/null +++ b/net-analyzer/traceroute/files/traceroute-1.4a12-LDFLAGS.patch @@ -0,0 +1,9 @@ +--- traceroute-1.4a12/Makefile.in ++++ traceroute-1.4a12/Makefile.in +@@ -82,5 +82,5 @@ + traceroute: $(OBJ) + @rm -f $@ +- $(CC) $(CFLAGS) -o $@ $(OBJ) $(LIBS) ++ $(CC) $(LDFLAGS) -o $@ $(OBJ) $(LIBS) + + version.o: version.c diff --git a/net-analyzer/traceroute/files/traceroute-1.4a5-bigpacklen.patch b/net-analyzer/traceroute/files/traceroute-1.4a5-bigpacklen.patch new file mode 100644 index 000000000000..2ff2dff2ae1c --- /dev/null +++ b/net-analyzer/traceroute/files/traceroute-1.4a5-bigpacklen.patch @@ -0,0 +1,21 @@ +Ripped from Fedora. + +--- traceroute-1.4a5/traceroute.c ++++ traceroute-1.4a5/traceroute.c +@@ -503,6 +496,16 @@ + + default: + usage(); ++ } ++ ++ /* This checking was moved here by oh3mqu+rpm@vip.fi */ ++ /* It was useless before packlen gets command line value */ ++ if (packlen == 0) ++ packlen = minpacket; /* minimum sized packet */ ++ else if (minpacket > packlen || packlen > maxpacket) { ++ Fprintf(stderr, "%s: packet size must be %d <= s <= %d\n", ++ prog, minpacket, maxpacket); ++ exit(1); + } + + #ifdef HAVE_SETLINEBUF diff --git a/net-analyzer/traceroute/files/traceroute-1.4a5-droproot.patch b/net-analyzer/traceroute/files/traceroute-1.4a5-droproot.patch new file mode 100644 index 000000000000..70267f498528 --- /dev/null +++ b/net-analyzer/traceroute/files/traceroute-1.4a5-droproot.patch @@ -0,0 +1,103 @@ +Ripped from Fedora. + +* Tue Jul 18 2000 Jeff Johnson <jbj@redhat.com> +- drop root privileges even earlier (#13466). + +--- traceroute-1.4a12/traceroute.c ++++ traceroute-1.4a12/traceroute.c +@@ -383,6 +383,40 @@ + else + prog = argv[0]; + ++ cp = "icmp"; ++ if ((pe = getprotobyname(cp)) == NULL) { ++ Fprintf(stderr, "%s: unknown protocol %s\n", prog, cp); ++ exit(1); ++ } ++ ++ /* Insure the socket fds won't be 0, 1 or 2 */ ++ if (open(devnull, O_RDONLY) < 0 || ++ open(devnull, O_RDONLY) < 0 || ++ open(devnull, O_RDONLY) < 0) { ++ Fprintf(stderr, "%s: open \"%s\": %s\n", ++ prog, devnull, strerror(errno)); ++ exit(1); ++ } ++ if ((s = socket(AF_INET, SOCK_RAW, pe->p_proto)) < 0) { ++ Fprintf(stderr, "%s: icmp socket: %s\n", prog, strerror(errno)); ++ exit(1); ++ } ++ ++#ifndef __hpux ++ sndsock = socket(AF_INET, SOCK_RAW, IPPROTO_RAW); ++#else ++ sndsock = socket(AF_INET, SOCK_RAW, ++ useicmp ? IPPROTO_ICMP : IPPROTO_UDP); ++#endif ++ ++ if (sndsock < 0) { ++ Fprintf(stderr, "%s: raw socket: %s\n", prog, strerror(errno)); ++ exit(1); ++ } ++ ++ /* Revert to non-privileged user after opening sockets */ ++ setuid(getuid()); ++ + opterr = 0; + while ((op = getopt(argc, argv, "dFInrvxf:g:i:m:p:q:s:t:w:z:")) != EOF) + switch (op) { +@@ -604,42 +638,6 @@ + outdata = (struct outdata *)(outudp + 1); + } + +- cp = "icmp"; +- if ((pe = getprotobyname(cp)) == NULL) { +- Fprintf(stderr, "%s: unknown protocol %s\n", prog, cp); +- exit(1); +- } +- +- /* Insure the socket fds won't be 0, 1 or 2 */ +- if (open(devnull, O_RDONLY) < 0 || +- open(devnull, O_RDONLY) < 0 || +- open(devnull, O_RDONLY) < 0) { +- Fprintf(stderr, "%s: open \"%s\": %s\n", +- prog, devnull, strerror(errno)); +- exit(1); +- } +- if ((s = socket(AF_INET, SOCK_RAW, pe->p_proto)) < 0) { +- Fprintf(stderr, "%s: icmp socket: %s\n", prog, strerror(errno)); +- exit(1); +- } +- if (options & SO_DEBUG) +- (void)setsockopt(s, SOL_SOCKET, SO_DEBUG, (char *)&on, +- sizeof(on)); +- if (options & SO_DONTROUTE) +- (void)setsockopt(s, SOL_SOCKET, SO_DONTROUTE, (char *)&on, +- sizeof(on)); +- +-#ifndef __hpux +- sndsock = socket(AF_INET, SOCK_RAW, IPPROTO_RAW); +-#else +- sndsock = socket(AF_INET, SOCK_RAW, +- useicmp ? IPPROTO_ICMP : IPPROTO_UDP); +-#endif +- if (sndsock < 0) { +- Fprintf(stderr, "%s: raw socket: %s\n", prog, strerror(errno)); +- exit(1); +- } +- + #if defined(IP_OPTIONS) && !defined(HAVE_RAW_OPTIONS) + if (lsrr > 0) { + u_char optlist[MAX_IPOPTLEN]; +@@ -672,6 +670,11 @@ + } + } + #endif ++ ++ if (options & SO_DEBUG) ++ (void)setsockopt(s, SOL_SOCKET, SO_DEBUG, (char *)&on, sizeof(on)); ++ if (options & SO_DONTROUTE) ++ (void)setsockopt(s, SOL_SOCKET, SO_DONTROUTE, (char *)&on, sizeof(on)); + + #ifdef SO_SNDBUF + if (setsockopt(sndsock, SOL_SOCKET, SO_SNDBUF, (char *)&packlen, diff --git a/net-analyzer/traceroute/files/traceroute-1.4a5-llanfairpwllgwyngyllgogerychwyrndrobwllllantysiliogogogoch.patch b/net-analyzer/traceroute/files/traceroute-1.4a5-llanfairpwllgwyngyllgogerychwyrndrobwllllantysiliogogogoch.patch new file mode 100644 index 000000000000..5f7248c7c1ca --- /dev/null +++ b/net-analyzer/traceroute/files/traceroute-1.4a5-llanfairpwllgwyngyllgogerychwyrndrobwllllantysiliogogogoch.patch @@ -0,0 +1,41 @@ +From rik.wade@theplanet.net Fri Jan 14 16:22:07 2000 +Envelope-to: alan@lxorguk.ukuu.org.uk +Delivery-date: Fri, 14 Jan 2000 16:22:07 +0000 +From: rik.wade@theplanet.net +Date: Fri, 14 Jan 2000 17:19:26 +0000 +To: alan.cox@linux.org +Subject: patch (traceroute) 1.4a5 +Message-ID: <20000114171926.X953@theplanet.net> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Mailer: Mutt 1.0i + +Alan, + +Please find below a small patch for traceroute 1.4a5 which allows it to +trace to the domain: + +llanfairpwllgwyngyllgogerychwyrndrobwllllantysiliogogogoch.co.uk + +The current limit is hard-coded to 64bytes. According to the RFC +shouldn't it be 256 max for the entire name? + +Anyway, a simple patch which should work: + + +thanks, +rik wade + +--- traceroute-1.4a5/traceroute.c.hostname Fri Jan 14 12:34:50 2000 ++++ traceroute-1.4a5/traceroute.c Fri Jan 14 12:42:33 2000 +@@ -240,3 +240,3 @@ + #ifndef MAXHOSTNAMELEN +-#define MAXHOSTNAMELEN 64 ++#define MAXHOSTNAMELEN 256 + #endif +-- ++------------------------------------------------------------------------+ +| rik.wade@theplanet.net mob: +44(0)7771 766621 | +| Internet Systems Developer tel: +44(0)1132 076054 | +| Planet Online Limited fax: +44(0)1132 346065 | ++------------------------------------------------------------------------+ diff --git a/net-analyzer/traceroute/files/traceroute-1.4a5-lsrr.patch b/net-analyzer/traceroute/files/traceroute-1.4a5-lsrr.patch new file mode 100644 index 000000000000..00c2037e7333 --- /dev/null +++ b/net-analyzer/traceroute/files/traceroute-1.4a5-lsrr.patch @@ -0,0 +1,368 @@ +* Wed Oct 4 2000 Jeff Johnson <jbj@redhat.com> +- support LSRR correctly (#16281). + +https://bugzilla.redhat.com/bugzilla/16281 + +--- traceroute-1.4a5/configure ++++ traceroute-1.4a5/configure +@@ -1789,11 +1789,13 @@ + ;; + + linux*) +- V_INCLS="$V_INCLS -Ilinux-include -DHAVE_IFF_LOOPBACK -DUSE_KERNEL_ROUTING_TABLE" + cat >> confdefs.h <<\EOF +-#define BYTESWAP_IP_HDR 1 ++#define HAVE_RAW_OPTIONS 1 ++#define BYTESWAP_IP_LEN 1 ++#define HAVE_IFF_LOOPBACK 1 ++#define USE_KERNEL_ROUTING_TABLE 1 + EOF +- ++ V_INCLS="$V_INCLS -Ilinux-include" + ;; + + osf3*) +--- traceroute-1.4a5/traceroute.c ++++ traceroute-1.4a5/traceroute.c +@@ -207,6 +207,7 @@ + #include <sys/socket.h> + #include <sys/time.h> + ++#include <net/if.h> + #include <netinet/in_systm.h> + #include <netinet/in.h> + #include <netinet/ip.h> +@@ -229,6 +230,11 @@ + #include <string.h> + #include <unistd.h> + ++#ifdef __linux__ ++#include <linux/types.h> ++#include <linux/icmp.h> ++#endif ++ + #include "gnuc.h" + #ifdef HAVE_OS_PROTO_H + #include "os-proto.h" +@@ -240,7 +246,9 @@ + /* Maximum number of gateways (include room for one noop) */ + #define NGATEWAYS ((int)((MAX_IPOPTLEN - IPOPT_MINOFF - 1) / sizeof(u_int32_t))) + ++#ifndef MAXHOSTNAMELEN + #define MAXHOSTNAMELEN 256 ++#endif + + #define Fprintf (void)fprintf + #define Printf (void)printf +@@ -277,7 +285,10 @@ + struct sockaddr_in wherefrom; /* Who we are */ + int packlen; /* total length of packet */ + int minpacket; /* min ip packet size */ +-int maxpacket = 32 * 1024; /* max ip packet size */ ++#if !defined(IP_MAXPACKET) ++#define IP_MAXPACKET 64 * 1024 ++#endif ++int maxpacket = IP_MAXPACKET; /* max ip packet size */ + int pmtu; /* Path MTU Discovery (RFC1191) */ + u_int pausemsecs; + +@@ -324,6 +335,13 @@ + __dead void usage(void); + int wait_for_reply(int, struct sockaddr_in *, struct timeval *); + ++#ifdef linux ++struct sockaddr_in *to = (struct sockaddr_in *)&whereto; ++#endif ++#ifndef LAUGHTER ++u_short uh_sport; ++#endif ++ + #ifdef USE_KERNEL_ROUTING_TABLE + struct ifaddrlist *search_routing_table(struct sockaddr_in *to, struct ifaddrlist *al, int n); + #endif +@@ -337,10 +355,12 @@ + register u_char *outp; + register u_int32_t *ap; + register struct sockaddr_in *from = (struct sockaddr_in *)&wherefrom; ++#ifndef linux + register struct sockaddr_in *to = (struct sockaddr_in *)&whereto; ++#endif + register struct hostinfo *hi; +- int on = 1; + register struct protoent *pe; ++ int on = 1; + register int ttl, probe, i; + register int seq = 0; + int tos = 0, settos = 0; +@@ -396,7 +416,7 @@ + + case 'g': + if (strlen(optarg) >= MAXHOSTNAMELEN) { +- Fprintf(stderr, "%s: Nice Try !\n", prog); ++ Fprintf(stderr, "%s: Gateway address too long\n", prog); + exit(-1); + } + if (lsrr >= NGATEWAYS) { +@@ -413,7 +433,7 @@ + device = optarg; + if (strlen(device) >= 16) { /* that is the IFNAMSIZ + * from kernel headers */ +- Fprintf(stderr, "%s: Nice try !\n", prog); ++ Fprintf(stderr, "%s: Interface name too long\n", prog); + exit(-1); + } + break; +@@ -449,7 +469,7 @@ + */ + source = optarg; + if (strlen(source) >= MAXHOSTNAMELEN) { +- Fprintf(stderr, "%s: Nice Try !\n", prog); ++ Fprintf(stderr, "%s: Source address too long\n", prog); + exit(-1); + } + break; +@@ -504,7 +524,7 @@ + case 1: + hostname = argv[optind]; + if (strlen(hostname) >= MAXHOSTNAMELEN) { +- Fprintf(stderr, "%s: Nice try !\n", prog); ++ Fprintf(stderr, "%s: Address too long\n", prog); + exit(-1); + } + hi = gethostinfo(hostname); +@@ -594,7 +614,32 @@ + outip->ip_p = IPPROTO_UDP; + + outudp = (struct udphdr *)outp; +- outudp->uh_sport = htons(ident); ++#ifdef LAUGHTER ++ outudp->uh_sport = htons(ident); ++#else ++ /* Avoid udp port conflicts! */ ++ if (!useicmp) { ++ struct sockaddr_in s; ++ int alen = sizeof(s); ++ int lock_fd = socket(AF_INET, SOCK_DGRAM, 0); ++ if (lock_fd < 0) { ++ perror("socket"); ++ exit(1); ++ } ++ memset(&s, 0, sizeof(s)); ++ if (bind(lock_fd, (struct sockaddr*)&s, sizeof(s)) == -1) { ++ perror("bind"); ++ exit(1); ++ } ++ if (getsockname(lock_fd, (struct sockaddr*)&s, &alen) == -1) { ++ perror("getsockname"); ++ exit(1); ++ } ++ uh_sport = s.sin_port; ++ outudp->uh_sport = s.sin_port; ++ /* DO NOT CLOSE LOCK SOCKET */ ++ } ++#endif + outudp->uh_ulen = + htons((u_short)(packlen - (sizeof(*outip) + optlen))); + outdata = (struct outdata *)(outudp + 1); +@@ -670,6 +715,52 @@ + (void)setsockopt(sndsock, SOL_SOCKET, SO_DONTROUTE, (char *)&on, + sizeof(on)); + ++#ifndef LAUGHTER ++ do { ++ int alen; ++ int probe_fd = socket(AF_INET, SOCK_DGRAM, 0); ++ int sport; ++ ++ if (probe_fd < 0) { ++ perror("socket"); ++ exit(1); ++ } ++ if (device) { ++ struct ifreq ifr; ++ strncpy(ifr.ifr_name, device, IFNAMSIZ-1); ++ if (setsockopt(probe_fd, SOL_SOCKET, SO_BINDTODEVICE, &ifr, sizeof(ifr)) == -1) { ++ close(probe_fd); ++ break; ++ } ++ } ++ sport = to->sin_port; ++ to->sin_port = htons(1025); ++ if (connect(probe_fd, (struct sockaddr*)to, sizeof(*to)) == -1) { ++ perror("socket"); ++ exit(1); ++ } ++ to->sin_port = sport; ++ alen = sizeof(*from); ++ if (getsockname(probe_fd, (struct sockaddr*)from, &alen) == -1) { ++ perror("getsockname"); ++ exit(1); ++ } ++ close(probe_fd); ++ if (source == NULL) ++ goto selected; ++ hi = gethostinfo(source); ++ source = hi->name; ++ hi->name = NULL; ++ for (i = hi->n, ap = hi->addrs; i > 0; --i, ++ap) { ++ if (from->sin_addr.s_addr == *ap) { ++ freehostinfo(hi); ++ goto selected; ++ } ++ } ++ freehostinfo(hi); ++ } while (0); ++#endif ++ + /* Get the interface address list */ + n = ifaddrlist(&allist, errbuf); + al = allist; +@@ -750,6 +841,10 @@ + setgid(getgid()); + setuid(getuid()); + ++ ++#ifndef LAUGHTER ++selected: ++#endif + outip->ip_src = from->sin_addr; + #ifndef IP_HDRINCL + if (bind(sndsock, (struct sockaddr *)from, sizeof(*from)) < 0) { +@@ -759,6 +854,27 @@ + } + #endif + ++#ifdef linux ++ if (bind(sndsock, (struct sockaddr *)from, sizeof(*from)) < 0) { ++ Fprintf(stderr, "%s: bind: %s\n", ++ prog, strerror(errno)); ++ exit (1); ++ } ++ if (bind(s, (struct sockaddr *)from, sizeof(*from)) < 0) { ++ Fprintf(stderr, "%s: bind ICMP socket: %s\n", ++ prog, strerror(errno)); ++ exit (1); ++ } ++ if (1) { ++ struct icmp_filter filt; ++ filt.data = ~((1<<ICMP_TIMXCEED)|(1<<ICMP_UNREACH)); ++ if (useicmp) ++ filt.data &= ~(1<<ICMP_ECHOREPLY); ++ if (setsockopt(s, SOL_RAW, ICMP_FILTER, (char*)&filt, sizeof(filt)) == -1) ++ perror("WARNING: setsockopt(ICMP_FILTER)"); ++ } ++#endif ++ + Fprintf(stderr, "%s to %s (%s)", + prog, hostname, inet_ntoa(to->sin_addr)); + if (source) +@@ -901,10 +1017,21 @@ + struct ip tip; + + outip->ip_ttl = ttl; ++#ifdef linux ++ /* Do not fiddle with ID, it must be unique ++ and only kernel is allowed to make it. --ANK ++ */ ++ outip->ip_id = 0; ++#else + #ifndef __hpux + outip->ip_id = htons(ident + seq); + #endif ++#endif + ++#ifdef LAUGHTER ++ /* The comment below has nothing to do with reality and ++ udp cksum has nothing to do with ip one. --ANK ++ */ + /* + * In most cases, the kernel will recalculate the ip checksum. + * But we must do it anyway so that the udp checksum comes out +@@ -916,6 +1043,7 @@ + if (outip->ip_sum == 0) + outip->ip_sum = 0xffff; + } ++#endif + + /* Payload */ + outdata->seq = seq; +@@ -936,6 +1064,7 @@ + if (outicmp->icmp_cksum == 0) + outicmp->icmp_cksum = 0xffff; + } else if (doipcksum) { ++#ifdef FULL_CRAP_I_WONDER_WHY_LBNL_FOLKS_DID_IT + /* Checksum (we must save and restore ip header) */ + tip = *outip; + ui = (struct udpiphdr *)outip; +@@ -948,6 +1077,30 @@ + if (outudp->uh_sum == 0) + outudp->uh_sum = 0xffff; + *outip = tip; ++#else ++ struct udpmagichdr { ++ struct in_addr src; ++ struct in_addr dst; ++ u_char zero; ++ u_char proto; ++ u_short len; ++ } h, saved, *hptr; ++ ++ h.src = outip->ip_src; ++ h.dst = to->sin_addr; ++ h.zero = 0; ++ h.proto = IPPROTO_UDP; ++ h.len = outudp->uh_ulen; ++ hptr = ((struct udpmagichdr*)outudp) - 1; ++ saved = *hptr; ++ *hptr = h; ++ outudp->uh_sum = 0; ++ outudp->uh_sum = in_cksum((u_short *)hptr, ntohs(outudp->uh_ulen) + sizeof(*hptr)); ++ if (outudp->uh_sum == 0) ++ outudp->uh_sum = 0xffff; ++ *hptr = saved; ++#endif ++ + } + /* XXX undocumented debugging hack */ + +@@ -1054,6 +1207,10 @@ + #else + icp = (struct icmp *)buf; + #endif ++ ++ if (in_cksum((u_short *)icp, htons(ip->ip_len) - hlen) && useicmp) ++ fprintf(stderr, "Icmp checksum is wrong\n"); ++ + type = icp->icmp_type; + code = icp->icmp_code; + if ((type == ICMP_TIMXCEED && code == ICMP_TIMXCEED_INTRANS) || +@@ -1083,7 +1240,11 @@ + /* XXX 8 is a magic number */ + if (hlen + 12 <= cc && + hip->ip_p == IPPROTO_UDP && ++#ifdef LAUGHTER + up->uh_sport == htons(ident) && ++#else ++ up->uh_sport == uh_sport && ++#endif + up->uh_dport == htons(port + seq)) + return (type == ICMP_TIMXCEED ? -1 : code + 1); + } +@@ -1126,6 +1287,8 @@ + + /* + * Checksum routine for Internet Protocol family headers (C Version) ++ * ++ * Certainly, it was broken --ANK + */ + u_short + in_cksum(register u_short *addr, register int len) +@@ -1148,7 +1311,7 @@ + + /* mop up an odd byte, if necessary */ + if (nleft == 1) +- sum += *(u_char *)w; ++ sum += htons(*(u_char *)w<<8); + + /* + * add back carry outs from top 16 bits to low 16 bits diff --git a/net-analyzer/traceroute/files/traceroute-1.4a5-secfix.patch b/net-analyzer/traceroute/files/traceroute-1.4a5-secfix.patch new file mode 100644 index 000000000000..7c739d154a72 --- /dev/null +++ b/net-analyzer/traceroute/files/traceroute-1.4a5-secfix.patch @@ -0,0 +1,49 @@ +Ripped from Fedora. + +--- traceroute-1.4a5/traceroute.c.secfix Fri Jun 13 05:30:27 1997 ++++ traceroute-1.4a5/traceroute.c Tue Dec 16 12:14:32 1997 +@@ -368,6 +368,10 @@ + break; + + case 'g': ++ if (strlen(optarg) >= MAXHOSTNAMELEN) { ++ Fprintf(stderr, "%s: Nice Try !\n", prog); ++ exit(-1); ++ } + if (lsrr >= NGATEWAYS) { + Fprintf(stderr, + "%s: No more than %d gateways\n", +@@ -380,6 +384,11 @@ + + case 'i': + device = optarg; ++ if (strlen(device) >= 16) { /* that is the IFNAMSIZ ++ * from kernel headers */ ++ Fprintf(stderr, "%s: Nice try !\n", prog); ++ exit(-1); ++ } + break; + + case 'I': +@@ -412,6 +421,10 @@ + * probe (e.g., on a multi-homed host). + */ + source = optarg; ++ if (strlen(source) >= MAXHOSTNAMELEN) { ++ Fprintf(stderr, "%s: Nice Try !\n", prog); ++ exit(-1); ++ } + break; + + case 't': +@@ -470,6 +483,10 @@ + + case 1: + hostname = argv[optind]; ++ if (strlen(hostname) >= MAXHOSTNAMELEN) { ++ Fprintf(stderr, "%s: Nice try !\n", prog); ++ exit(-1); ++ } + hi = gethostinfo(hostname); + setsin(to, hi->addrs[0]); + if (hi->n > 1) diff --git a/net-analyzer/traceroute/files/traceroute-1.4a5-unaligned.patch b/net-analyzer/traceroute/files/traceroute-1.4a5-unaligned.patch new file mode 100644 index 000000000000..c1c80cbb3621 --- /dev/null +++ b/net-analyzer/traceroute/files/traceroute-1.4a5-unaligned.patch @@ -0,0 +1,25 @@ +Ripped from Fedora. + +* Thu May 27 1999 Richard Henderson <rth@twiddle.net> +- avoid unaligned traps writing into the output data area. + +--- traceroute-1.4a5/traceroute.c ++++ traceroute-1.4a5/traceroute.c +@@ -258,7 +258,7 @@ struct hostinfo { + struct outdata { + u_char seq; /* sequence number of this packet */ + u_char ttl; /* ttl packet left with */ +- struct timeval tv; /* time packet left */ ++ struct timeval tv __attribute__((packed)); /* time packet left */ + }; + + u_char packet[512]; /* last inbound (icmp) packet */ +@@ -917,7 +917,7 @@ send_probe(register int seq, int ttl, re + /* Payload */ + outdata->seq = seq; + outdata->ttl = ttl; +- outdata->tv = *tp; ++ memcpy(&outdata->tv, tp, sizeof(outdata->tv)); + + if (useicmp) + outicmp->icmp_seq = htons(seq); diff --git a/net-analyzer/traceroute/traceroute-1.4_p12-r3.ebuild b/net-analyzer/traceroute/traceroute-1.4_p12-r3.ebuild new file mode 100644 index 000000000000..54a32de2b182 --- /dev/null +++ b/net-analyzer/traceroute/traceroute-1.4_p12-r3.ebuild @@ -0,0 +1,47 @@ +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-analyzer/traceroute/traceroute-1.4_p12-r3.ebuild,v 1.1 2005/05/03 01:22:29 vapier Exp $ + +inherit eutils flag-o-matic + +MY_P=${PN}-${PV/_p/a} +DESCRIPTION="Utility to trace the route of IP packets" +HOMEPAGE="http://ee.lbl.gov/" +SRC_URI="ftp://ee.lbl.gov/${MY_P}.tar.gz" + +LICENSE="BSD" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86" +IUSE="static" + +DEPEND="" + +S=${WORKDIR}/${MY_P} + +src_unpack() { + unpack ${A} + cd "${S}" + epatch "${FILESDIR}"/traceroute-1.4-target-resolv.patch + epatch "${FILESDIR}"/traceroute-1.4a12-LDFLAGS.patch + epatch "${FILESDIR}"/traceroute-1.4a5-bigpacklen.patch + epatch "${FILESDIR}"/traceroute-1.4a12.patch + epatch "${FILESDIR}"/traceroute-1.4a5-droproot.patch + epatch "${FILESDIR}"/traceroute-1.4a5-llanfairpwllgwyngyllgogerychwyrndrobwllllantysiliogogogoch.patch + epatch "${FILESDIR}"/traceroute-1.4a5-secfix.patch + epatch "${FILESDIR}"/traceroute-1.4a5-unaligned.patch + + # assume linux by default #26699 + sed -i '/^t=/s:generic:linux:' configure + + use static && append-ldflags -static + append-ldflags -Wl,-z,now -Wl,-z,relro +} + +src_install() { + dosbin traceroute || die "dosbin" + fowners root:wheel /usr/sbin/traceroute + fperms 4711 /usr/sbin/traceroute + + doman traceroute.8 + dodoc CHANGES INSTALL +} |