svn commit: r235137 - in stable/8: contrib/traceroute
contrib/traceroute/lbl usr.sbin/traceroute
Ulrich Spoerlein
uqs at FreeBSD.org
Tue May 8 08:19:08 UTC 2012
Author: uqs
Date: Tue May 8 08:19:07 2012
New Revision: 235137
URL: http://svn.freebsd.org/changeset/base/235137
Log:
Sync traceroute(8) with head.
Merges r215937,216184 and r211062,215880,220968:
- Remove unused traceroute(8) contrib code from head
- make WARNS=3 clean
- fix an operator precedence bug for TCP tracerouting
- Remove unneeded struct timezone passed to gettimeofday().
- Remove clause 3 and 4 from TNF licenses.
- Check return code of setuid() in traceroute.
Requested by: tuexen
Deleted:
stable/8/contrib/traceroute/Makefile.in
stable/8/contrib/traceroute/aclocal.m4
stable/8/contrib/traceroute/acsite.m4
stable/8/contrib/traceroute/config.guess
stable/8/contrib/traceroute/config.sub
stable/8/contrib/traceroute/configure
stable/8/contrib/traceroute/configure.in
stable/8/contrib/traceroute/findsaddr-generic.c
stable/8/contrib/traceroute/findsaddr-linux.c
stable/8/contrib/traceroute/findsaddr-mib.c
stable/8/contrib/traceroute/install-sh
stable/8/contrib/traceroute/lbl/gnuc.h
stable/8/contrib/traceroute/lbl/os-solaris2.h
stable/8/contrib/traceroute/lbl/os-sunos4.h
stable/8/contrib/traceroute/mkdep
stable/8/contrib/traceroute/strerror.c
stable/8/contrib/traceroute/usleep.c
Modified:
stable/8/contrib/traceroute/as.c
stable/8/contrib/traceroute/as.h
stable/8/contrib/traceroute/ifaddrlist.c
stable/8/contrib/traceroute/traceroute.c
stable/8/usr.sbin/traceroute/Makefile
Directory Properties:
stable/8/contrib/traceroute/ (props changed)
stable/8/usr.sbin/traceroute/ (props changed)
Modified: stable/8/contrib/traceroute/as.c
==============================================================================
--- stable/8/contrib/traceroute/as.c Tue May 8 03:39:44 2012 (r235136)
+++ stable/8/contrib/traceroute/as.c Tue May 8 08:19:07 2012 (r235137)
@@ -16,13 +16,6 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the NetBSD
- * Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
@@ -63,13 +56,14 @@ struct aslookup {
};
void *
-as_setup(char *server)
+as_setup(const char *server)
{
struct aslookup *asn;
struct addrinfo hints, *res0, *res;
FILE *f;
int s, error;
+ s = -1;
if (server == NULL)
server = getenv("RA_SERVER");
if (server == NULL)
Modified: stable/8/contrib/traceroute/as.h
==============================================================================
--- stable/8/contrib/traceroute/as.h Tue May 8 03:39:44 2012 (r235136)
+++ stable/8/contrib/traceroute/as.h Tue May 8 08:19:07 2012 (r235137)
@@ -16,13 +16,6 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the NetBSD
- * Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
@@ -37,6 +30,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-void *as_setup(char *);
+void *as_setup(const char *);
unsigned int as_lookup(void *, char *, sa_family_t);
void as_shutdown(void *);
Modified: stable/8/contrib/traceroute/ifaddrlist.c
==============================================================================
--- stable/8/contrib/traceroute/ifaddrlist.c Tue May 8 03:39:44 2012 (r235136)
+++ stable/8/contrib/traceroute/ifaddrlist.c Tue May 8 08:19:07 2012 (r235137)
@@ -61,11 +61,6 @@ struct rtentry;
#include <string.h>
#include <unistd.h>
-#include "gnuc.h"
-#ifdef HAVE_OS_PROTO_H
-#include "os-proto.h"
-#endif
-
#include "ifaddrlist.h"
/*
@@ -76,14 +71,14 @@ ifaddrlist(register struct ifaddrlist **
{
register int fd, nipaddr;
#ifdef HAVE_SOCKADDR_SA_LEN
- register int n;
+ size_t n;
#endif
register struct ifreq *ifrp, *ifend, *ifnext, *mp;
register struct sockaddr_in *sin;
register struct ifaddrlist *al;
struct ifconf ifc;
struct ifreq ibuf[(32 * 1024) / sizeof(struct ifreq)], ifr;
-#define MAX_IPADDR (sizeof(ibuf) / sizeof(ibuf[0]))
+#define MAX_IPADDR ((int)(sizeof(ibuf) / sizeof(ibuf[0])))
static struct ifaddrlist ifaddrlist[MAX_IPADDR];
char device[sizeof(ifr.ifr_name) + 1];
@@ -96,10 +91,10 @@ ifaddrlist(register struct ifaddrlist **
ifc.ifc_buf = (caddr_t)ibuf;
if (ioctl(fd, SIOCGIFCONF, (char *)&ifc) < 0 ||
- ifc.ifc_len < sizeof(struct ifreq)) {
+ ifc.ifc_len < (int)sizeof(struct ifreq)) {
if (errno == EINVAL)
(void)sprintf(errbuf,
- "SIOCGIFCONF: ifreq struct too small (%d bytes)",
+ "SIOCGIFCONF: ifreq struct too small (%zu bytes)",
sizeof(ibuf));
else
(void)sprintf(errbuf, "SIOCGIFCONF: %s",
Modified: stable/8/contrib/traceroute/traceroute.c
==============================================================================
--- stable/8/contrib/traceroute/traceroute.c Tue May 8 03:39:44 2012 (r235136)
+++ stable/8/contrib/traceroute/traceroute.c Tue May 8 08:19:07 2012 (r235137)
@@ -220,7 +220,6 @@ static const char rcsid[] =
#include <netinet/ip_var.h>
#include <netinet/ip_icmp.h>
#include <netinet/udp.h>
-#include <netinet/udp_var.h>
#include <netinet/tcp.h>
#include <netinet/tcpip.h>
@@ -245,11 +244,6 @@ static const char rcsid[] =
#include <string.h>
#include <unistd.h>
-#include "gnuc.h"
-#ifdef HAVE_OS_PROTO_H
-#include "os-proto.h"
-#endif
-
/* rfc1716 */
#ifndef ICMP_UNREACH_FILTER_PROHIB
#define ICMP_UNREACH_FILTER_PROHIB 13 /* admin prohibited filter */
@@ -515,7 +509,10 @@ main(int argc, char **argv)
sockerrno = errno;
}
- setuid(getuid());
+ if (setuid(getuid()) != 0) {
+ perror("setuid()");
+ exit(1);
+ }
#ifdef IPCTL_DEFTTL
{
@@ -962,7 +959,6 @@ main(int argc, char **argv)
for (probe = 0, loss = 0; probe < nprobes; ++probe) {
register int cc;
struct timeval t1, t2;
- struct timezone tz;
register struct ip *ip;
struct outdata outdata;
@@ -973,7 +969,7 @@ main(int argc, char **argv)
outdata.ttl = ttl;
/* Avoid alignment problems by copying bytewise: */
- (void)gettimeofday(&t1, &tz);
+ (void)gettimeofday(&t1, NULL);
memcpy(&outdata.tv, &t1, sizeof(outdata.tv));
/* Finalize and send packet */
@@ -986,7 +982,7 @@ main(int argc, char **argv)
double T;
int precis;
- (void)gettimeofday(&t2, &tz);
+ (void)gettimeofday(&t2, NULL);
i = packet_ok(packet, cc, from, seq);
/* Skip short packet */
if (i == 0)
@@ -1152,7 +1148,6 @@ wait_for_reply(register int sock, regist
fd_set *fdsp;
size_t nfds;
struct timeval now, wait;
- struct timezone tz;
register int cc = 0;
register int error;
int fromlen = sizeof(*fromp);
@@ -1165,7 +1160,7 @@ wait_for_reply(register int sock, regist
wait.tv_sec = tp->tv_sec + waittime;
wait.tv_usec = tp->tv_usec;
- (void)gettimeofday(&now, &tz);
+ (void)gettimeofday(&now, NULL);
tvsub(&wait, &now);
if (wait.tv_sec < 0) {
wait.tv_sec = 0;
@@ -1431,7 +1426,7 @@ tcp_check(const u_char *data, int seq)
return (ntohs(tcp->th_sport) == ident
&& ntohs(tcp->th_dport) == port + (fixedPort ? 0 : seq))
- && tcp->th_seq == (ident << 16) | (port + seq);
+ && tcp->th_seq == (((tcp_seq)ident << 16) | (port + seq));
}
void
@@ -1504,19 +1499,17 @@ u_short
p_cksum(struct ip *ip, u_short *data, int len)
{
static struct ipovly ipo;
- u_short sumh, sumd;
- u_long sumt;
+ u_short sum[2];
ipo.ih_pr = ip->ip_p;
ipo.ih_len = htons(len);
ipo.ih_src = ip->ip_src;
ipo.ih_dst = ip->ip_dst;
- sumh = in_cksum((u_short*)&ipo, sizeof(ipo)); /* pseudo ip hdr cksum */
- sumd = in_cksum((u_short*)data, len); /* payload data cksum */
- sumt = (sumh << 16) | (sumd);
+ sum[1] = in_cksum((u_short*)&ipo, sizeof(ipo)); /* pseudo ip hdr cksum */
+ sum[0] = in_cksum(data, len); /* payload data cksum */
- return ~in_cksum((u_short*)&sumt, sizeof(sumt));
+ return ~in_cksum(sum, sizeof(sum));
}
/*
Modified: stable/8/usr.sbin/traceroute/Makefile
==============================================================================
--- stable/8/usr.sbin/traceroute/Makefile Tue May 8 03:39:44 2012 (r235136)
+++ stable/8/usr.sbin/traceroute/Makefile Tue May 8 08:19:07 2012 (r235137)
@@ -29,7 +29,9 @@ DPADD= ${LIBIPSEC}
LDADD= -lipsec
.endif
-CFLAGS+= -I${TRACEROUTE_DISTDIR}/lbl -I${TRACEROUTE_DISTDIR}
+CFLAGS+= -I${TRACEROUTE_DISTDIR}
+
+WARNS?= 3
version.c: ${TRACEROUTE_DISTDIR}/VERSION
@rm -f ${.TARGET}
More information about the svn-src-all
mailing list