From owner-svn-src-all@FreeBSD.ORG Sat Dec 4 14:19:28 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0129B106566B; Sat, 4 Dec 2010 14:19:28 +0000 (UTC) (envelope-from uqs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E2AB78FC08; Sat, 4 Dec 2010 14:19:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oB4EJRDd077513; Sat, 4 Dec 2010 14:19:27 GMT (envelope-from uqs@svn.freebsd.org) Received: (from uqs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oB4EJRsa077507; Sat, 4 Dec 2010 14:19:27 GMT (envelope-from uqs@svn.freebsd.org) Message-Id: <201012041419.oB4EJRsa077507@svn.freebsd.org> From: Ulrich Spoerlein Date: Sat, 4 Dec 2010 14:19:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r216184 - in head: contrib/traceroute usr.sbin/traceroute X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Dec 2010 14:19:28 -0000 Author: uqs Date: Sat Dec 4 14:19:27 2010 New Revision: 216184 URL: http://svn.freebsd.org/changeset/base/216184 Log: traceroute(8): make WARNS=3 clean Also fixes an operator precedence bug for TCP tracerouting Modified: head/contrib/traceroute/as.c head/contrib/traceroute/as.h head/contrib/traceroute/ifaddrlist.c head/contrib/traceroute/traceroute.c head/usr.sbin/traceroute/Makefile Modified: head/contrib/traceroute/as.c ============================================================================== --- head/contrib/traceroute/as.c Sat Dec 4 13:06:41 2010 (r216183) +++ head/contrib/traceroute/as.c Sat Dec 4 14:19:27 2010 (r216184) @@ -56,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: head/contrib/traceroute/as.h ============================================================================== --- head/contrib/traceroute/as.h Sat Dec 4 13:06:41 2010 (r216183) +++ head/contrib/traceroute/as.h Sat Dec 4 14:19:27 2010 (r216184) @@ -30,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: head/contrib/traceroute/ifaddrlist.c ============================================================================== --- head/contrib/traceroute/ifaddrlist.c Sat Dec 4 13:06:41 2010 (r216183) +++ head/contrib/traceroute/ifaddrlist.c Sat Dec 4 14:19:27 2010 (r216184) @@ -71,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]; @@ -91,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: head/contrib/traceroute/traceroute.c ============================================================================== --- head/contrib/traceroute/traceroute.c Sat Dec 4 13:06:41 2010 (r216183) +++ head/contrib/traceroute/traceroute.c Sat Dec 4 14:19:27 2010 (r216184) @@ -220,7 +220,6 @@ static const char rcsid[] = #include #include #include -#include #include #include @@ -1424,7 +1423,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 @@ -1497,19 +1496,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: head/usr.sbin/traceroute/Makefile ============================================================================== --- head/usr.sbin/traceroute/Makefile Sat Dec 4 13:06:41 2010 (r216183) +++ head/usr.sbin/traceroute/Makefile Sat Dec 4 14:19:27 2010 (r216184) @@ -31,7 +31,7 @@ LDADD= -lipsec CFLAGS+= -I${TRACEROUTE_DISTDIR} -WARNS?= 0 +WARNS?= 3 version.c: ${TRACEROUTE_DISTDIR}/VERSION @rm -f ${.TARGET}