summaryrefslogtreecommitdiff
path: root/sys/altq
diff options
context:
space:
mode:
Diffstat (limited to 'sys/altq')
-rw-r--r--sys/altq/altq_cdnr.c4
-rw-r--r--sys/altq/altq_classq.h4
-rw-r--r--sys/altq/altq_red.c4
-rw-r--r--sys/altq/altq_rmclass.c4
-rw-r--r--sys/altq/altq_var.h3
5 files changed, 10 insertions, 9 deletions
diff --git a/sys/altq/altq_cdnr.c b/sys/altq/altq_cdnr.c
index 1519958fb96..e4455ae646d 100644
--- a/sys/altq/altq_cdnr.c
+++ b/sys/altq/altq_cdnr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: altq_cdnr.c,v 1.8 2007/09/13 20:40:02 chl Exp $ */
+/* $OpenBSD: altq_cdnr.c,v 1.9 2008/04/20 07:05:51 deraadt Exp $ */
/* $KAME: altq_cdnr.c,v 1.8 2000/12/14 08:12:45 thorpej Exp $ */
/*
@@ -846,7 +846,7 @@ tswtcm_input(cb, pktinfo)
* marker
*/
if (avg_rate > tsw->cmtd_rate) {
- u_int32_t randval = random() % avg_rate;
+ u_int32_t randval = arc4random_uniform(avg_rate);
if (avg_rate > tsw->peak_rate) {
if (randval < avg_rate - tsw->peak_rate) {
diff --git a/sys/altq/altq_classq.h b/sys/altq/altq_classq.h
index 3ee2aad31c7..4fdb9b43c57 100644
--- a/sys/altq/altq_classq.h
+++ b/sys/altq/altq_classq.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: altq_classq.h,v 1.3 2003/01/07 00:29:28 cloder Exp $ */
+/* $OpenBSD: altq_classq.h,v 1.4 2008/04/20 07:05:51 deraadt Exp $ */
/* $KAME: altq_classq.h,v 1.4 2001/02/09 07:20:40 kjc Exp $ */
/*
@@ -155,7 +155,7 @@ _getq_random(class_queue_t *q)
else {
struct mbuf *prev = NULL;
- n = random() % qlen(q) + 1;
+ n = arc4random_uniform(qlen(q)) + 1;
for (i = 0; i < n; i++) {
prev = m;
m = m->m_nextpkt;
diff --git a/sys/altq/altq_red.c b/sys/altq/altq_red.c
index 21ef242eed3..57e97600073 100644
--- a/sys/altq/altq_red.c
+++ b/sys/altq/altq_red.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: altq_red.c,v 1.14 2007/09/13 20:40:02 chl Exp $ */
+/* $OpenBSD: altq_red.c,v 1.15 2008/04/20 07:05:52 deraadt Exp $ */
/* $KAME: altq_red.c,v 1.10 2002/04/03 05:38:51 kjc Exp $ */
/*
@@ -403,7 +403,7 @@ drop_early(int fp_len, int fp_probd, int count)
* drop probability = (avg - TH_MIN) / d
*/
- if ((random() % d) < fp_len) {
+ if (arc4random_uniform(d) < fp_len) {
/* drop or mark */
return (1);
}
diff --git a/sys/altq/altq_rmclass.c b/sys/altq/altq_rmclass.c
index de55447a9f9..dd58fea4807 100644
--- a/sys/altq/altq_rmclass.c
+++ b/sys/altq/altq_rmclass.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: altq_rmclass.c,v 1.13 2007/09/13 20:40:02 chl Exp $ */
+/* $OpenBSD: altq_rmclass.c,v 1.14 2008/04/20 07:05:52 deraadt Exp $ */
/* $KAME: altq_rmclass.c,v 1.10 2001/02/09 07:20:40 kjc Exp $ */
/*
@@ -1729,7 +1729,7 @@ _getq_random(class_queue_t *q)
} else {
struct mbuf *prev = NULL;
- n = random() % qlen(q) + 1;
+ n = arc4random_uniform(qlen(q)) + 1;
for (i = 0; i < n; i++) {
prev = m;
m = m->m_nextpkt;
diff --git a/sys/altq/altq_var.h b/sys/altq/altq_var.h
index e71b47f502d..f7f617523f6 100644
--- a/sys/altq/altq_var.h
+++ b/sys/altq/altq_var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: altq_var.h,v 1.14 2004/04/27 02:56:20 kjc Exp $ */
+/* $OpenBSD: altq_var.h,v 1.15 2008/04/20 07:05:52 deraadt Exp $ */
/* $KAME: altq_var.h,v 1.8 2001/02/09 09:44:41 kjc Exp $ */
/*
@@ -34,6 +34,7 @@
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/queue.h>
+#include <dev/rndvar.h>
#ifndef ALTQ_RED
#define ALTQ_RED /* RED is enabled by default */