From: florian Date: Fri, 18 Apr 2014 16:24:41 +0000 (+0000) Subject: move cast from packet to ip up to avoid casts in print() X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=96e7993780a9bae0b82f15ceb239966f7da6ac5d;p=openbsd move cast from packet to ip up to avoid casts in print() OK benno@ --- diff --git a/usr.sbin/traceroute/traceroute.c b/usr.sbin/traceroute/traceroute.c index def7e6b4c0a..62d41e16e98 100644 --- a/usr.sbin/traceroute/traceroute.c +++ b/usr.sbin/traceroute/traceroute.c @@ -1,4 +1,4 @@ -/* $OpenBSD: traceroute.c,v 1.102 2014/04/18 16:22:18 florian Exp $ */ +/* $OpenBSD: traceroute.c,v 1.103 2014/04/18 16:24:41 florian Exp $ */ /* $NetBSD: traceroute.c,v 1.10 1995/05/21 15:50:45 mycroft Exp $ */ /*- @@ -677,16 +677,15 @@ main(int argc, char *argv[]) /* Skip short packet */ if (i == 0) continue; + ip = (struct ip *)packet; if (from.sin_addr.s_addr != lastaddr) { print((struct sockaddr *)&from, - (cc - (((struct ip*)packet)->ip_hl - <<2)), inet_ntop(AF_INET, - &((struct ip*)packet)->ip_dst, + cc - (ip->ip_hl << 2), + inet_ntop(AF_INET, &ip->ip_dst, hbuf, sizeof(hbuf))); lastaddr = from.sin_addr.s_addr; } printf(" %g ms", deltaT(&t1, &t2)); - ip = (struct ip *)packet; if (ttl_flag) printf(" (%u)", ip->ip_ttl); if (i == -2) {