svn commit: r290149 - in stable/10: sbin/rtsol usr.sbin/rtadvd usr.sbin/rtsold

Xin LI delphij at FreeBSD.org
Thu Oct 29 16:53:36 UTC 2015


Author: delphij
Date: Thu Oct 29 16:53:34 2015
New Revision: 290149
URL: https://svnweb.freebsd.org/changeset/base/290149

Log:
  MFC r288963:
  
  Now that we own the code, use arc4random(3) unconditionally
  and remove the corresponding HAVE_ARC4RANDOM conditions.

Modified:
  stable/10/sbin/rtsol/Makefile
  stable/10/usr.sbin/rtadvd/Makefile
  stable/10/usr.sbin/rtadvd/rtadvd.c
  stable/10/usr.sbin/rtsold/Makefile
  stable/10/usr.sbin/rtsold/rtsold.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sbin/rtsol/Makefile
==============================================================================
--- stable/10/sbin/rtsol/Makefile	Thu Oct 29 16:50:28 2015	(r290148)
+++ stable/10/sbin/rtsol/Makefile	Thu Oct 29 16:53:34 2015	(r290149)
@@ -23,6 +23,6 @@ SRCS=	rtsold.c rtsol.c if.c probe.c dump
 MAN=
 
 WARNS?=	3
-CFLAGS+= -DHAVE_ARC4RANDOM -DHAVE_POLL_H -DSMALL
+CFLAGS+= -DHAVE_POLL_H -DSMALL
 
 .include <bsd.prog.mk>

Modified: stable/10/usr.sbin/rtadvd/Makefile
==============================================================================
--- stable/10/usr.sbin/rtadvd/Makefile	Thu Oct 29 16:50:28 2015	(r290148)
+++ stable/10/usr.sbin/rtadvd/Makefile	Thu Oct 29 16:53:34 2015	(r290149)
@@ -22,8 +22,6 @@ SRCS=	rtadvd.c rrenum.c advcap.c if.c co
 DPADD=	${LIBUTIL}
 LDADD=	-lutil
 
-CFLAGS+= -DHAVE_ARC4RANDOM
-
 WARNS?=	1
 
 .include <bsd.prog.mk>

Modified: stable/10/usr.sbin/rtadvd/rtadvd.c
==============================================================================
--- stable/10/usr.sbin/rtadvd/rtadvd.c	Thu Oct 29 16:50:28 2015	(r290148)
+++ stable/10/usr.sbin/rtadvd/rtadvd.c	Thu Oct 29 16:53:34 2015	(r290149)
@@ -242,14 +242,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)
@@ -1016,11 +1008,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);
@@ -1894,13 +1882,8 @@ ra_timer_update(void *arg, struct timesp
 		 * 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:
 		/*

Modified: stable/10/usr.sbin/rtsold/Makefile
==============================================================================
--- stable/10/usr.sbin/rtsold/Makefile	Thu Oct 29 16:50:28 2015	(r290148)
+++ stable/10/usr.sbin/rtsold/Makefile	Thu Oct 29 16:53:34 2015	(r290149)
@@ -20,7 +20,7 @@ MLINKS=	rtsold.8 rtsol.8
 SRCS=	rtsold.c rtsol.c if.c probe.c dump.c rtsock.c
 
 WARNS?=	3
-CFLAGS+= -DHAVE_ARC4RANDOM -DHAVE_POLL_H
+CFLAGS+= -DHAVE_POLL_H
 DPADD=	${LIBKVM}
 LDADD=	-lkvm
 

Modified: stable/10/usr.sbin/rtsold/rtsold.c
==============================================================================
--- stable/10/usr.sbin/rtsold/rtsold.c	Thu Oct 29 16:50:28 2015	(r290148)
+++ stable/10/usr.sbin/rtsold/rtsold.c	Thu Oct 29 16:53:34 2015	(r290149)
@@ -223,10 +223,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) {
@@ -780,11 +776,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;


More information about the svn-src-all mailing list