Try making the initial port used a little more random

libnfs-4.0.0-vitalif
Ronnie Sahlberg 2013-05-28 17:22:28 -07:00
parent 67a9f57e67
commit cb5b8be2eb
2 changed files with 5 additions and 24 deletions

View File

@ -401,8 +401,12 @@ static int rpc_connect_sockaddr_async(struct rpc_context *rpc, struct sockaddr_s
static int portOfs = 0;
const int firstPort = 512; /* >= 512 according to Sun docs */
const int portCount = IPPORT_RESERVED - firstPort;
int startOfs = portOfs, port, rc;
int startOfs, port, rc;
if (portOfs == 0) {
portOfs = time(NULL) % 400;
}
startOfs = portOfs;
do {
rc = -1;
port = htons(firstPort + portOfs);

View File

@ -65,26 +65,3 @@ cl /I. /Iwin32 /Iinclude/nfsc /Iinclude /Imount /Infs -Zi -Od -DWIN32 -D_WIN32_W
.lib mswsock.lib advapi32.lib wsock32.lib advapi32.lib