From 0f76c2f7d0c078e109c4d8ee892fd366de36581a Mon Sep 17 00:00:00 2001 From: angelos Date: Sun, 27 Apr 1997 23:06:01 +0000 Subject: [PATCH] Randomize RPC xid. --- sys/nfs/krpc_subr.c | 9 ++++++--- 1 file 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 #include #include +#include /* * 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); -- 2.20.1