mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-31 16:57:10 +00:00
use arc4random.
Obtained from: KAME MFC after: 1 week
This commit is contained in:
parent
51964a1b2b
commit
dba14c305c
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=118962
@ -18,7 +18,7 @@ PROG= rtadvd
|
||||
MAN= rtadvd.conf.5 rtadvd.8
|
||||
SRCS= rtadvd.c rrenum.c advcap.c if.c config.c timer.c dump.c
|
||||
|
||||
CFLAGS+= -DINET6 -DHAVE_POLL_H
|
||||
CFLAGS+= -DINET6 -DHAVE_ARC4RANDOM -DHAVE_POLL_H
|
||||
|
||||
DPADD= ${LIBCOMPAT}
|
||||
LDADD= -lcompat
|
||||
|
@ -214,11 +214,13 @@ main(argc, argv)
|
||||
/* timer initialization */
|
||||
rtadvd_timer_init();
|
||||
|
||||
#ifndef HAVE_ARC4RANDOM
|
||||
/* random value initialization */
|
||||
#ifdef __FreeBSD__
|
||||
srandomdev();
|
||||
#else
|
||||
srandom((u_long)time(NULL));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* get iflist block from kernel */
|
||||
@ -1634,7 +1636,11 @@ ra_timer_update(void *data, struct timeval *tm)
|
||||
* MaxRtrAdvInterval (RFC2461 6.2.4).
|
||||
*/
|
||||
interval = rai->mininterval;
|
||||
#ifdef HAVE_ARC4RANDOM
|
||||
interval += arc4random() % (rai->maxinterval - rai->mininterval);
|
||||
#else
|
||||
interval += random() % (rai->maxinterval - rai->mininterval);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* For the first few advertisements (up to
|
||||
|
Loading…
Reference in New Issue
Block a user