summaryrefslogtreecommitdiffstats
path: root/usr.sbin/traceroute
diff options
context:
space:
mode:
authorflorian <florian@openbsd.org>2014-04-18 16:24:41 +0000
committerflorian <florian@openbsd.org>2014-04-18 16:24:41 +0000
commit96e7993780a9bae0b82f15ceb239966f7da6ac5d (patch)
treead6b2fc771b42a4ce3a7e7ae0131d330154a2b34 /usr.sbin/traceroute
parentmove ICMP6 code parsing to function (diff)
downloadwireguard-openbsd-96e7993780a9bae0b82f15ceb239966f7da6ac5d.tar.xz
wireguard-openbsd-96e7993780a9bae0b82f15ceb239966f7da6ac5d.zip
move cast from packet to ip up to avoid casts in print()
OK benno@
Diffstat (limited to 'usr.sbin/traceroute')
-rw-r--r--usr.sbin/traceroute/traceroute.c9
1 files changed, 4 insertions, 5 deletions
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) {