summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/netinet/igmp.c3
-rw-r--r--sys/netinet/igmp_var.h4
-rw-r--r--sys/netinet/in_pcb.c7
-rw-r--r--sys/netinet/tcp_input.c5
-rw-r--r--sys/netinet/tcp_subr.c5
-rw-r--r--sys/netinet/tcp_timer.c5
-rw-r--r--sys/netinet/tcp_usrreq.c5
7 files changed, 20 insertions, 14 deletions
diff --git a/sys/netinet/igmp.c b/sys/netinet/igmp.c
index e37d502e7e5..b9099aaac54 100644
--- a/sys/netinet/igmp.c
+++ b/sys/netinet/igmp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: igmp.c,v 1.2 1996/03/03 22:30:26 niklas Exp $ */
+/* $OpenBSD: igmp.c,v 1.3 1997/02/05 15:48:21 deraadt Exp $ */
/* $NetBSD: igmp.c,v 1.15 1996/02/13 23:41:25 christos Exp $ */
/*
@@ -27,6 +27,7 @@
#include <netinet/ip_var.h>
#include <netinet/igmp.h>
#include <netinet/igmp_var.h>
+#include <dev/rndvar.h>
#include <machine/stdarg.h>
diff --git a/sys/netinet/igmp_var.h b/sys/netinet/igmp_var.h
index dccbd637b81..f31ef56f019 100644
--- a/sys/netinet/igmp_var.h
+++ b/sys/netinet/igmp_var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: igmp_var.h,v 1.2 1996/03/03 22:30:27 niklas Exp $ */
+/* $OpenBSD: igmp_var.h,v 1.3 1997/02/05 15:48:22 deraadt Exp $ */
/* $NetBSD: igmp_var.h,v 1.9 1996/02/13 23:41:31 christos Exp $ */
/*
@@ -71,7 +71,7 @@ struct igmpstat igmpstat;
* DELAY * countdown frequency). We assume that the routine random()
* is defined somewhere (and that it returns a positive number).
*/
-#define IGMP_RANDOM_DELAY(X) (random() % (X) + 1)
+#define IGMP_RANDOM_DELAY(X) (arc4random() % (X) + 1)
void igmp_init __P((void));
void igmp_input __P((struct mbuf *, ...));
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c
index 3a74cd535f2..ff1f639563c 100644
--- a/sys/netinet/in_pcb.c
+++ b/sys/netinet/in_pcb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in_pcb.c,v 1.13 1997/01/15 03:27:14 kstailey Exp $ */
+/* $OpenBSD: in_pcb.c,v 1.14 1997/02/05 15:48:23 deraadt Exp $ */
/* $NetBSD: in_pcb.c,v 1.25 1996/02/13 23:41:53 christos Exp $ */
/*
@@ -57,6 +57,7 @@
#include <netinet/in_pcb.h>
#include <netinet/in_var.h>
#include <netinet/ip_var.h>
+#include <dev/rndvar.h>
struct in_addr zeroin_addr;
@@ -217,7 +218,7 @@ portloop:
*/
if (loopcount == 0) { /* only do this once. */
old = first;
- first -= (random() % (first - last));
+ first -= (arc4random() % (first - last));
}
count = first - last;
@@ -243,7 +244,7 @@ portloop:
*/
if (loopcount == 0) { /* only do this once. */
old = first;
- first += (random() % (last - first));
+ first += (arc4random() % (last - first));
}
count = last - first;
diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c
index e0d20e0c6f1..ea37f2be8d5 100644
--- a/sys/netinet/tcp_input.c
+++ b/sys/netinet/tcp_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_input.c,v 1.8 1996/09/25 11:39:56 niklas Exp $ */
+/* $OpenBSD: tcp_input.c,v 1.9 1997/02/05 15:48:24 deraadt Exp $ */
/* $NetBSD: tcp_input.c,v 1.23 1996/02/13 23:43:44 christos Exp $ */
/*
@@ -61,6 +61,7 @@
#include <netinet/tcp_var.h>
#include <netinet/tcpip.h>
#include <netinet/tcp_debug.h>
+#include <dev/rndvar.h>
#include <machine/stdarg.h>
@@ -676,7 +677,7 @@ findpcb:
#ifdef TCP_COMPAT_42
tcp_iss += TCP_ISSINCR/2;
#else /* TCP_COMPAT_42 */
- tcp_iss += random() % (TCP_ISSINCR / 2) + 1;
+ tcp_iss += arc4random() % (TCP_ISSINCR / 2) + 1;
#endif /* !TCP_COMPAT_42 */
tp->irs = ti->ti_seq;
tcp_sendseqinit(tp);
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c
index 09d139a31b0..c53bc198c12 100644
--- a/sys/netinet/tcp_subr.c
+++ b/sys/netinet/tcp_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_subr.c,v 1.7 1996/07/29 22:01:50 niklas Exp $ */
+/* $OpenBSD: tcp_subr.c,v 1.8 1997/02/05 15:48:25 deraadt Exp $ */
/* $NetBSD: tcp_subr.c,v 1.22 1996/02/13 23:44:00 christos Exp $ */
/*
@@ -61,6 +61,7 @@
#include <netinet/tcp_timer.h>
#include <netinet/tcp_var.h>
#include <netinet/tcpip.h>
+#include <dev/rndvar.h>
/* patchable/settable parameters for tcp */
int tcp_mssdflt = TCP_MSS;
@@ -94,7 +95,7 @@ tcp_init()
#ifdef TCP_COMPAT_42
tcp_iss = 1; /* wrong */
#else /* TCP_COMPAT_42 */
- tcp_iss = random() + 1;
+ tcp_iss = arc4random() + 1;
#endif /* !TCP_COMPAT_42 */
in_pcbinit(&tcbtable, tcbhashsize);
if (max_protohdr < sizeof(struct tcpiphdr))
diff --git a/sys/netinet/tcp_timer.c b/sys/netinet/tcp_timer.c
index 14e8d42ca7b..ba972adff32 100644
--- a/sys/netinet/tcp_timer.c
+++ b/sys/netinet/tcp_timer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_timer.c,v 1.6 1996/09/12 06:19:57 tholo Exp $ */
+/* $OpenBSD: tcp_timer.c,v 1.7 1997/02/05 15:48:26 deraadt Exp $ */
/* $NetBSD: tcp_timer.c,v 1.14 1996/02/13 23:44:09 christos Exp $ */
/*
@@ -60,6 +60,7 @@
#include <netinet/tcp_timer.h>
#include <netinet/tcp_var.h>
#include <netinet/tcpip.h>
+#include <dev/rndvar.h>
int tcp_keepidle = TCPTV_KEEP_IDLE;
int tcp_keepintvl = TCPTV_KEEPINTVL;
@@ -143,7 +144,7 @@ tpgone:
if ((int)tcp_iss < 0)
tcp_iss = 0; /* XXX */
#else /* TCP_COMPAT_42 */
- tcp_iss += random() % (TCP_ISSINCR / PR_SLOWHZ) + 1; /* increment iss */
+ tcp_iss += arc4random() % (TCP_ISSINCR / PR_SLOWHZ) + 1; /* increment iss */
#endif /* !TCP_COMPAT_42 */
tcp_now++; /* for timestamps */
splx(s);
diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c
index 233403a8680..19647d2695f 100644
--- a/sys/netinet/tcp_usrreq.c
+++ b/sys/netinet/tcp_usrreq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_usrreq.c,v 1.7 1996/09/20 22:53:12 deraadt Exp $ */
+/* $OpenBSD: tcp_usrreq.c,v 1.8 1997/02/05 15:48:27 deraadt Exp $ */
/* $NetBSD: tcp_usrreq.c,v 1.20 1996/02/13 23:44:16 christos Exp $ */
/*
@@ -67,6 +67,7 @@
#include <netinet/tcp_var.h>
#include <netinet/tcpip.h>
#include <netinet/tcp_debug.h>
+#include <dev/rndvar.h>
/*
* TCP protocol interface to socket abstraction.
@@ -215,7 +216,7 @@ tcp_usrreq(so, req, m, nam, control)
#ifdef TCP_COMPAT_42
tcp_iss += TCP_ISSINCR/2;
#else /* TCP_COMPAT_42 */
- tcp_iss += random() % (TCP_ISSINCR / 2) + 1;
+ tcp_iss += arc4random() % (TCP_ISSINCR / 2) + 1;
#endif /* !TCP_COMPAT_42 */
tcp_sendseqinit(tp);
error = tcp_output(tp);