use arc4random
This commit is contained in:
parent
6cebe67965
commit
d6bd155256
@ -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 @@ main(argc, argv)
|
||||
/* timer initialization */
|
||||
rtadvd_timer_init();
|
||||
|
||||
/* random value initialization */
|
||||
srandom((u_long)time(NULL));
|
||||
|
||||
/* get iflist block from kernel */
|
||||
init_iflist();
|
||||
|
||||
@ -821,7 +818,7 @@ rs_input(int len, struct nd_router_solicit *rs,
|
||||
* 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 @@ ra_timer_update(void *data, struct timeval *tm)
|
||||
* 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
|
||||
|
Loading…
Reference in New Issue
Block a user