From owner-svn-src-all@freebsd.org Tue Oct 6 23:43:00 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DE7739D18AF; Tue, 6 Oct 2015 23:42:59 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B3ADA964; Tue, 6 Oct 2015 23:42:59 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t96NgwHA084226; Tue, 6 Oct 2015 23:42:58 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t96Ngw77084221; Tue, 6 Oct 2015 23:42:58 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201510062342.t96Ngw77084221@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 6 Oct 2015 23:42:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288963 - in head: sbin/rtsol usr.sbin/rtadvd usr.sbin/rtsold X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Oct 2015 23:43:00 -0000 Author: delphij Date: Tue Oct 6 23:42:58 2015 New Revision: 288963 URL: https://svnweb.freebsd.org/changeset/base/288963 Log: Now that we own the code, use arc4random(3) unconditionally and remove the corresponding HAVE_ARC4RANDOM conditions. MFC after: 2 weeks Modified: head/sbin/rtsol/Makefile head/usr.sbin/rtadvd/Makefile head/usr.sbin/rtadvd/rtadvd.c head/usr.sbin/rtsold/Makefile head/usr.sbin/rtsold/rtsold.c Modified: head/sbin/rtsol/Makefile ============================================================================== --- head/sbin/rtsol/Makefile Tue Oct 6 22:59:00 2015 (r288962) +++ head/sbin/rtsol/Makefile Tue Oct 6 23:42:58 2015 (r288963) @@ -21,6 +21,6 @@ SRCS= rtsold.c rtsol.c if.c probe.c dump MAN= WARNS?= 3 -CFLAGS+= -DHAVE_ARC4RANDOM -DSMALL +CFLAGS+= -DSMALL .include Modified: head/usr.sbin/rtadvd/Makefile ============================================================================== --- head/usr.sbin/rtadvd/Makefile Tue Oct 6 22:59:00 2015 (r288962) +++ head/usr.sbin/rtadvd/Makefile Tue Oct 6 23:42:58 2015 (r288963) @@ -21,8 +21,6 @@ SRCS= rtadvd.c rrenum.c advcap.c if.c co LIBADD= util -CFLAGS+= -DHAVE_ARC4RANDOM - WARNS?= 1 .include Modified: head/usr.sbin/rtadvd/rtadvd.c ============================================================================== --- head/usr.sbin/rtadvd/rtadvd.c Tue Oct 6 22:59:00 2015 (r288962) +++ head/usr.sbin/rtadvd/rtadvd.c Tue Oct 6 23:42:58 2015 (r288963) @@ -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 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: head/usr.sbin/rtsold/Makefile ============================================================================== --- head/usr.sbin/rtsold/Makefile Tue Oct 6 22:59:00 2015 (r288962) +++ head/usr.sbin/rtsold/Makefile Tue Oct 6 23:42:58 2015 (r288963) @@ -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 Modified: head/usr.sbin/rtsold/rtsold.c ============================================================================== --- head/usr.sbin/rtsold/rtsold.c Tue Oct 6 22:59:00 2015 (r288962) +++ head/usr.sbin/rtsold/rtsold.c Tue Oct 6 23:42:58 2015 (r288963) @@ -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;