Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/rtadvd use arc4random



details:   https://anonhg.NetBSD.org/src/rev/64204a73bdda
branches:  trunk
changeset: 532419:64204a73bdda
user:      itojun <itojun%NetBSD.org@localhost>
date:      Fri Jun 07 00:45:46 2002 +0000

description:
use arc4random

diffstat:

 usr.sbin/rtadvd/rtadvd.c |  9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)

diffs (37 lines):

diff -r b809722875b4 -r 64204a73bdda usr.sbin/rtadvd/rtadvd.c
--- a/usr.sbin/rtadvd/rtadvd.c  Fri Jun 07 00:45:15 2002 +0000
+++ b/usr.sbin/rtadvd/rtadvd.c  Fri Jun 07 00:45:46 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rtadvd.c,v 1.19 2002/06/07 00:45:15 itojun Exp $       */
+/*     $NetBSD: rtadvd.c,v 1.20 2002/06/07 00:45:46 itojun Exp $       */
 /*     $KAME: rtadvd.c,v 1.66 2002/05/29 14:18:36 itojun Exp $ */
 
 /*
@@ -207,9 +207,6 @@
        /* timer initialization */
        rtadvd_timer_init();
 
-       /* random value initialization */
-       srandom((u_long)time(NULL));
-
        /* get iflist block from kernel */
        init_iflist();
 
@@ -821,7 +818,7 @@
                 * delay and send the advertisement at the
                 * already-scheduled time. RFC-2461 6.2.6
                 */
-               delay = random() % MAX_RA_DELAY_TIME;
+               delay = arc4random() % MAX_RA_DELAY_TIME;
                interval.tv_sec = 0;
                interval.tv_usec = delay;
                rest = rtadvd_timer_rest(ra->timer);
@@ -1582,7 +1579,7 @@
         * MaxRtrAdvInterval (RFC2461 6.2.4).
         */
        interval = rai->mininterval; 
-       interval += random() % (rai->maxinterval - rai->mininterval);
+       interval += arc4random() % (rai->maxinterval - rai->mininterval);
 
        /*
         * For the first few advertisements (up to



Home | Main Index | Thread Index | Old Index