Move ident / perturb initialisation up, this is AF independent.
authorflorian <florian@openbsd.org>
Fri, 18 Apr 2014 17:01:06 +0000 (17:01 +0000)
committerflorian <florian@openbsd.org>
Fri, 18 Apr 2014 17:01:06 +0000 (17:01 +0000)
OK benno@

usr.sbin/traceroute/traceroute.c

index 6bb761b..4f2619d 100644 (file)
@@ -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));