summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAngelos D. Keromytis <angelos@cvs.openbsd.org>1997-04-27 23:06:02 +0000
committerAngelos D. Keromytis <angelos@cvs.openbsd.org>1997-04-27 23:06:02 +0000
commit9a5b3c89b9ce4e34f22ec9cf9963cb91c7b9e75b (patch)
tree29a980f27af00515d406c55e33baa24240a307b8
parent1501a670903b6ae9d349b02301161f6bc86cc284 (diff)
Randomize RPC xid.
-rw-r--r--sys/nfs/krpc_subr.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/nfs/krpc_subr.c b/sys/nfs/krpc_subr.c
index 4336e8a6d05..13fd92f30d6 100644
--- a/sys/nfs/krpc_subr.c
+++ b/sys/nfs/krpc_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: krpc_subr.c,v 1.6 1997/04/25 09:22:34 deraadt Exp $ */
+/* $OpenBSD: krpc_subr.c,v 1.7 1997/04/27 23:06:01 angelos Exp $ */
/* $NetBSD: krpc_subr.c,v 1.12.4.1 1996/06/07 00:52:26 cgd Exp $ */
/*
@@ -60,6 +60,7 @@
#include <nfs/rpcv2.h>
#include <nfs/krpc.h>
#include <nfs/xdr_subs.h>
+#include <dev/rndvar.h>
/*
* Kernel support for Sun RPC
@@ -200,7 +201,8 @@ krpc_call(sa, prog, vers, func, data, from_p)
struct rpc_reply *reply;
struct uio auio;
int error, rcvflg, timo, secs, len;
- static u_int32_t xid = ~0xFF;
+ static u_int32_t xid = 0;
+ u_int32_t newxid;
u_int16_t tport;
/*
@@ -296,7 +298,8 @@ krpc_call(sa, prog, vers, func, data, from_p)
mhead->m_len = sizeof(*call);
bzero((caddr_t)call, sizeof(*call));
/* rpc_call part */
- xid++;
+ while ((newxid = arc4random()) == xid);
+ xid = newxid;
call->rp_xid = txdr_unsigned(xid);
/* call->rp_direction = 0; */
call->rp_rpcvers = txdr_unsigned(2);