There is NO reason to use arc4random() here, and it needlessly slows down the
forwarding path, so goodbye.
This commit is contained in:
parent
f4f3bc1663
commit
bef90cbfa4
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: altq_blue.c,v 1.6 2003/09/05 22:43:01 itojun Exp $ */
|
/* $NetBSD: altq_blue.c,v 1.7 2003/10/07 21:22:11 mycroft Exp $ */
|
||||||
/* $KAME: altq_blue.c,v 1.8 2002/01/07 11:25:40 kjc Exp $ */
|
/* $KAME: altq_blue.c,v 1.8 2002/01/07 11:25:40 kjc Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -61,7 +61,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: altq_blue.c,v 1.6 2003/09/05 22:43:01 itojun Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: altq_blue.c,v 1.7 2003/10/07 21:22:11 mycroft Exp $");
|
||||||
|
|
||||||
#if defined(__FreeBSD__) || defined(__NetBSD__)
|
#if defined(__FreeBSD__) || defined(__NetBSD__)
|
||||||
#include "opt_altq.h"
|
#include "opt_altq.h"
|
||||||
@ -511,7 +511,7 @@ static int
|
|||||||
drop_early(rp)
|
drop_early(rp)
|
||||||
blue_t *rp;
|
blue_t *rp;
|
||||||
{
|
{
|
||||||
if ((arc4random() % rp->blue_max_pmark) < rp->blue_pmark) {
|
if ((random() % rp->blue_max_pmark) < rp->blue_pmark) {
|
||||||
/* drop or mark */
|
/* drop or mark */
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: altq_cdnr.c,v 1.5 2003/09/05 22:43:02 itojun Exp $ */
|
/* $NetBSD: altq_cdnr.c,v 1.6 2003/10/07 21:22:11 mycroft Exp $ */
|
||||||
/* $KAME: altq_cdnr.c,v 1.8 2000/12/14 08:12:45 thorpej Exp $ */
|
/* $KAME: altq_cdnr.c,v 1.8 2000/12/14 08:12:45 thorpej Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -28,7 +28,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: altq_cdnr.c,v 1.5 2003/09/05 22:43:02 itojun Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: altq_cdnr.c,v 1.6 2003/10/07 21:22:11 mycroft Exp $");
|
||||||
|
|
||||||
#if defined(__FreeBSD__) || defined(__NetBSD__)
|
#if defined(__FreeBSD__) || defined(__NetBSD__)
|
||||||
#include "opt_altq.h"
|
#include "opt_altq.h"
|
||||||
@ -846,7 +846,7 @@ tswtcm_input(cb, pktinfo)
|
|||||||
* marker
|
* marker
|
||||||
*/
|
*/
|
||||||
if (avg_rate > tsw->cmtd_rate) {
|
if (avg_rate > tsw->cmtd_rate) {
|
||||||
u_int32_t randval = arc4random() % avg_rate;
|
u_int32_t randval = random() % avg_rate;
|
||||||
|
|
||||||
if (avg_rate > tsw->peak_rate) {
|
if (avg_rate > tsw->peak_rate) {
|
||||||
if (randval < avg_rate - tsw->peak_rate) {
|
if (randval < avg_rate - tsw->peak_rate) {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: altq_red.c,v 1.7 2003/09/05 22:43:02 itojun Exp $ */
|
/* $NetBSD: altq_red.c,v 1.8 2003/10/07 21:22:11 mycroft Exp $ */
|
||||||
/* $KAME: altq_red.c,v 1.9 2002/01/07 11:25:40 kjc Exp $ */
|
/* $KAME: altq_red.c,v 1.9 2002/01/07 11:25:40 kjc Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -61,7 +61,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: altq_red.c,v 1.7 2003/09/05 22:43:02 itojun Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: altq_red.c,v 1.8 2003/10/07 21:22:11 mycroft Exp $");
|
||||||
|
|
||||||
#if defined(__FreeBSD__) || defined(__NetBSD__)
|
#if defined(__FreeBSD__) || defined(__NetBSD__)
|
||||||
#include "opt_altq.h"
|
#include "opt_altq.h"
|
||||||
@ -812,7 +812,7 @@ drop_early(fp_len, fp_probd, count)
|
|||||||
* drop probability = (avg - TH_MIN) / d
|
* drop probability = (avg - TH_MIN) / d
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ((arc4random() % d) < fp_len) {
|
if ((random() % d) < fp_len) {
|
||||||
/* drop or mark */
|
/* drop or mark */
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: altq_rmclass.c,v 1.6 2003/09/05 22:43:03 itojun Exp $ */
|
/* $NetBSD: altq_rmclass.c,v 1.7 2003/10/07 21:22:11 mycroft Exp $ */
|
||||||
/* $KAME: altq_rmclass.c,v 1.9 2000/12/14 08:12:46 thorpej Exp $ */
|
/* $KAME: altq_rmclass.c,v 1.9 2000/12/14 08:12:46 thorpej Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -38,7 +38,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: altq_rmclass.c,v 1.6 2003/09/05 22:43:03 itojun Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: altq_rmclass.c,v 1.7 2003/10/07 21:22:11 mycroft Exp $");
|
||||||
|
|
||||||
#ident "@(#)rm_class.c 1.48 97/12/05 SMI"
|
#ident "@(#)rm_class.c 1.48 97/12/05 SMI"
|
||||||
|
|
||||||
@ -1828,7 +1828,7 @@ _getq_random(q)
|
|||||||
} else {
|
} else {
|
||||||
struct mbuf *prev = NULL;
|
struct mbuf *prev = NULL;
|
||||||
|
|
||||||
n = arc4random() % qlen(q) + 1;
|
n = random() % qlen(q) + 1;
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
prev = m;
|
prev = m;
|
||||||
m = m->m_nextpkt;
|
m = m->m_nextpkt;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user