summaryrefslogtreecommitdiff
path: root/usr.sbin/traceroute
diff options
context:
space:
mode:
authorFlorian Obser <florian@cvs.openbsd.org>2014-04-18 17:01:07 +0000
committerFlorian Obser <florian@cvs.openbsd.org>2014-04-18 17:01:07 +0000
commit7d287e4f75ea41445b5082796c48dc57c7a0d103 (patch)
treedcefb2f92569564d0956642dbd46a78e5ab3c2ac /usr.sbin/traceroute
parent4ee87eb3d3fe435f04eff67b7664611f84d569d6 (diff)
Move ident / perturb initialisation up, this is AF independent.
OK benno@
Diffstat (limited to 'usr.sbin/traceroute')
-rw-r--r--usr.sbin/traceroute/traceroute.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/usr.sbin/traceroute/traceroute.c b/usr.sbin/traceroute/traceroute.c
index 6bb761b4e00..4f2619d670f 100644
--- a/usr.sbin/traceroute/traceroute.c
+++ b/usr.sbin/traceroute/traceroute.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: traceroute.c,v 1.108 2014/04/18 17:00:07 florian Exp $ */
+/* $OpenBSD: traceroute.c,v 1.109 2014/04/18 17:01:06 florian Exp $ */
/* $NetBSD: traceroute.c,v 1.10 1995/05/21 15:50:45 mycroft Exp $ */
/*-
@@ -501,6 +501,12 @@ main(int argc, char *argv[])
setvbuf(stdout, NULL, _IOLBF, 0);
+ ident = getpid() & 0xffff;
+ tmprnd = arc4random();
+ sec_perturb = (tmprnd & 0x80000000) ? -(tmprnd & 0x7ff) :
+ (tmprnd & 0x7ff);
+ usec_perturb = arc4random();
+
(void) memset(&to, 0, sizeof(struct sockaddr));
to.sin_family = AF_INET;
if (inet_aton(*argv, &to.sin_addr) != 0)
@@ -594,12 +600,6 @@ main(int argc, char *argv[])
ip->ip_v = IPVERSION;
ip->ip_tos = tos;
- ident = getpid() & 0xffff;
- tmprnd = arc4random();
- sec_perturb = (tmprnd & 0x80000000) ? -(tmprnd & 0x7ff) :
- (tmprnd & 0x7ff);
- usec_perturb = arc4random();
-
if (options & SO_DEBUG)
(void) setsockopt(rcvsock, SOL_SOCKET, SO_DEBUG,
(char *)&on, sizeof(on));