From: Steve Cai Date: Tue, 26 Feb 2013 00:40:29 +0000 (-0800) Subject: randomize the initial rpc xid to avoid reply cache collision X-Git-Tag: upstream/1.9.6^2~233^2 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=a27561934c35e2ced470a4832e5f9cca5dee4585;p=deb_libnfs.git randomize the initial rpc xid to avoid reply cache collision --- diff --git a/lib/init.c b/lib/init.c index bbcfb86..06f6e4b 100644 --- a/lib/init.c +++ b/lib/init.c @@ -25,6 +25,7 @@ #include #include #include +#include #include "slist.h" #include "libnfs-zdr.h" #include "libnfs.h" @@ -34,6 +35,7 @@ struct rpc_context *rpc_init_context(void) { struct rpc_context *rpc; + static uint32_t salt = 0; rpc = malloc(sizeof(struct rpc_context)); if (rpc == NULL) { @@ -59,7 +61,8 @@ struct rpc_context *rpc_init_context(void) free(rpc); return NULL; } - rpc->xid = 1; + rpc->xid = salt + time(NULL); + salt += 0x01000000; rpc->fd = -1; return rpc;