mirror of
https://git.FreeBSD.org/src.git
synced 2024-11-27 08:00:11 +00:00
Now that we own the code, use arc4random(3) unconditionally
and remove the corresponding HAVE_ARC4RANDOM conditions. MFC after: 2 weeks
This commit is contained in:
parent
e72879e554
commit
56160b2e67
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=288963
@ -21,6 +21,6 @@ SRCS= rtsold.c rtsol.c if.c probe.c dump.c rtsock.c
|
||||
MAN=
|
||||
|
||||
WARNS?= 3
|
||||
CFLAGS+= -DHAVE_ARC4RANDOM -DSMALL
|
||||
CFLAGS+= -DSMALL
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
@ -21,8 +21,6 @@ SRCS= rtadvd.c rrenum.c advcap.c if.c config.c timer.c timer_subr.c \
|
||||
|
||||
LIBADD= util
|
||||
|
||||
CFLAGS+= -DHAVE_ARC4RANDOM
|
||||
|
||||
WARNS?= 1
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
@ -241,14 +241,6 @@ main(int argc, char *argv[])
|
||||
/* timer initialization */
|
||||
rtadvd_timer_init();
|
||||
|
||||
#ifndef HAVE_ARC4RANDOM
|
||||
/* random value initialization */
|
||||
#ifdef __FreeBSD__
|
||||
srandomdev();
|
||||
#else
|
||||
srandom((unsigned long)time(NULL));
|
||||
#endif
|
||||
#endif
|
||||
pfh = pidfile_open(pidfilename, 0600, &otherpid);
|
||||
if (pfh == NULL) {
|
||||
if (errno == EEXIST)
|
||||
@ -1015,11 +1007,7 @@ set_short_delay(struct ifinfo *ifi)
|
||||
* delay and send the advertisement at the
|
||||
* already-scheduled time. RFC 4861 6.2.6
|
||||
*/
|
||||
#ifdef HAVE_ARC4RANDOM
|
||||
delay = arc4random_uniform(MAX_RA_DELAY_TIME);
|
||||
#else
|
||||
delay = random() % MAX_RA_DELAY_TIME;
|
||||
#endif
|
||||
interval.tv_sec = 0;
|
||||
interval.tv_nsec = delay * 1000;
|
||||
rest = rtadvd_timer_rest(ifi->ifi_ra_timer);
|
||||
@ -1893,13 +1881,8 @@ ra_timer_update(void *arg, struct timespec *tm)
|
||||
* MaxRtrAdvInterval (RFC4861 6.2.4).
|
||||
*/
|
||||
interval = rai->rai_mininterval;
|
||||
#ifdef HAVE_ARC4RANDOM
|
||||
interval += arc4random_uniform(rai->rai_maxinterval -
|
||||
rai->rai_mininterval);
|
||||
#else
|
||||
interval += random() % (rai->rai_maxinterval -
|
||||
rai->rai_mininterval);
|
||||
#endif
|
||||
break;
|
||||
case IFI_STATE_TRANSITIVE:
|
||||
/*
|
||||
|
@ -20,6 +20,5 @@ MLINKS= rtsold.8 rtsol.8
|
||||
SRCS= rtsold.c rtsol.c if.c probe.c dump.c rtsock.c
|
||||
|
||||
WARNS?= 3
|
||||
CFLAGS+= -DHAVE_ARC4RANDOM
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
@ -214,10 +214,6 @@ main(int argc, char **argv)
|
||||
errx(1, "pid filename (%s) must be an absolute path",
|
||||
pidfilename);
|
||||
}
|
||||
#ifndef HAVE_ARC4RANDOM
|
||||
/* random value initialization */
|
||||
srandom((u_long)time(NULL));
|
||||
#endif
|
||||
|
||||
#if (__FreeBSD_version < 900000)
|
||||
if (Fflag) {
|
||||
@ -725,11 +721,7 @@ rtsol_timer_update(struct ifinfo *ifi)
|
||||
ifi->timer = tm_max; /* stop timer(valid?) */
|
||||
break;
|
||||
case IFS_DELAY:
|
||||
#ifndef HAVE_ARC4RANDOM
|
||||
interval = random() % (MAX_RTR_SOLICITATION_DELAY * MILLION);
|
||||
#else
|
||||
interval = arc4random_uniform(MAX_RTR_SOLICITATION_DELAY * MILLION);
|
||||
#endif
|
||||
ifi->timer.tv_sec = interval / MILLION;
|
||||
ifi->timer.tv_nsec = (interval % MILLION) * 1000;
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user