#define NFS_TIMEOUT 10
static int fs_mounted = 0;
-static unsigned long rpc_id;
+static unsigned long rpc_id = 0;
static int nfs_offset = -1;
static int nfs_len;
return path;
}
-/**************************************************************************
-RPC_INIT - set up the ID counter to something fairly random
-**************************************************************************/
-static void
-rpc_init (void)
-{
- unsigned long t;
- t=get_ticks();
- rpc_id = t ^ (t << 8) ^ (t << 16);
-}
-
/**************************************************************************
RPC_ADD_CREDENTIALS - Add RPC authentication/verifier entries
**************************************************************************/
int pktlen;
int sport;
- id = rpc_id++;
+ id = ++rpc_id;
pkt.u.call.id = htonl(id);
pkt.u.call.type = htonl(MSG_CALL);
pkt.u.call.rpcvers = htonl(2); /* use RPC version 2 */
pktlen = (char *)p + datalen*sizeof(uint32_t) - (char *)&pkt;
- memcpy ((char *)NetTxPacket+ETHER_HDR_SIZE+IP_HDR_SIZE, (char *)&pkt, pktlen);
+ memcpy ((char *)NetTxPacket + NetEthHdrSize() + IP_HDR_SIZE, (char *)&pkt, pktlen);
if (rpc_prog == PROG_PORTMAP)
sport = SUNRPC_PORT;
printf ("%s\n", __FUNCTION__);
#endif
+ if (ntohl(rpc_pkt.u.reply.id) != rpc_id)
+ return -1;
+
if (rpc_pkt.u.reply.rstatus ||
rpc_pkt.u.reply.verifier ||
rpc_pkt.u.reply.astatus ||
rpc_pkt.u.reply.astatus) {
+ return -1;
}
switch (prog) {
memcpy ((unsigned char *)&rpc_pkt, pkt, len);
+ if (ntohl(rpc_pkt.u.reply.id) != rpc_id)
+ return -1;
+
if (rpc_pkt.u.reply.rstatus ||
rpc_pkt.u.reply.verifier ||
rpc_pkt.u.reply.astatus ||
memcpy ((unsigned char *)&rpc_pkt, pkt, len);
+ if (ntohl(rpc_pkt.u.reply.id) != rpc_id)
+ return -1;
+
if (rpc_pkt.u.reply.rstatus ||
rpc_pkt.u.reply.verifier ||
rpc_pkt.u.reply.astatus) {
memcpy ((unsigned char *)&rpc_pkt, pkt, len);
+ if (ntohl(rpc_pkt.u.reply.id) != rpc_id)
+ return -1;
+
if (rpc_pkt.u.reply.rstatus ||
rpc_pkt.u.reply.verifier ||
rpc_pkt.u.reply.astatus ||
memcpy ((unsigned char *)&rpc_pkt, pkt, len);
+ if (ntohl(rpc_pkt.u.reply.id) != rpc_id)
+ return -1;
+
if (rpc_pkt.u.reply.rstatus ||
rpc_pkt.u.reply.verifier ||
rpc_pkt.u.reply.astatus ||
memcpy ((uchar *)&rpc_pkt, pkt, sizeof(rpc_pkt.u.reply));
+ if (ntohl(rpc_pkt.u.reply.id) != rpc_id)
+ return -1;
+
if (rpc_pkt.u.reply.rstatus ||
rpc_pkt.u.reply.verifier ||
rpc_pkt.u.reply.astatus ||
print_IPaddr (NetOurGatewayIP) ;
}
}
- putc ('\n');
-
- printf ("Filename '%s/%s'.", nfs_path, nfs_filename);
+ printf ("\nFilename '%s/%s'.", nfs_path, nfs_filename);
if (NetBootFileSize) {
printf (" Size is 0x%x Bytes = ", NetBootFileSize<<9);
print_size (NetBootFileSize<<9, "");
}
- putc ('\n');
-
- printf ("Load address: 0x%lx\n", load_addr);
-
- printf ("Loading: *\b");
+ printf ("\nLoad address: 0x%lx\n"
+ "Loading: *\b", load_addr);
NetSetTimeout (NFS_TIMEOUT * CFG_HZ, NfsTimeout);
NetSetHandler (NfsHandler);
- rpc_init ();
NfsTimeoutCount = 0;
NfsState = STATE_PRCLOOKUP_PROG_MOUNT_REQ;