#include "nfs.h"
#include "bootp.h"
-/*#define NFS_DEBUG*/
+#undef NFS_DEBUG
#if ((CONFIG_COMMANDS & CFG_CMD_NET) && (CONFIG_COMMANDS & CFG_CMD_NFS))
int sport;
id = ++rpc_id;
+#ifdef NFS_DEBUG
+ printf ("%s xid: %d, rpc_id: %d\n", __FUNCTION__, id, rpc_id);
+#endif
pkt.u.call.id = htonl(id);
pkt.u.call.type = htonl(MSG_CALL);
pkt.u.call.rpcvers = htonl(2); /* use RPC version 2 */
{
uint32_t data[16];
+#ifdef NFS_DEBUG
+ printf ("%s\n", __FUNCTION__);
+#endif
+
data[0] = 0; data[1] = 0; /* auth credential */
data[2] = 0; data[3] = 0; /* auth verifier */
data[4] = htonl(prog);
int len;
int pathlen;
+#ifdef NFS_DEBUG
+ printf ("%s\n", __FUNCTION__);
+#endif
+
pathlen = strlen (path);
p = &(data[0]);
uint32_t *p;
int len;
+#ifdef NFS_DEBUG
+ printf ("%s\n", __FUNCTION__);
+#endif
+
if ((NfsSrvMountPort == -1) || (!fs_mounted)) {
/* Nothing mounted, nothing to umount */
return;
uint32_t *p;
int len;
+#ifdef NFS_DEBUG
+ printf ("%s\n", __FUNCTION__);
+#endif
+
p = &(data[0]);
p = (uint32_t *)rpc_add_credentials ((long *)p);
int len;
int fnamelen;
+#ifdef NFS_DEBUG
+ printf ("%s\n", __FUNCTION__);
+#endif
+
fnamelen = strlen (fname);
p = &(data[0]);
uint32_t *p;
int len;
+#ifdef NFS_DEBUG
+ printf ("%s\n", __FUNCTION__);
+#endif
+
p = &(data[0]);
p = (uint32_t *)rpc_add_credentials ((long *)p);
if (rpc_pkt.u.reply.rstatus ||
rpc_pkt.u.reply.verifier ||
- rpc_pkt.u.reply.astatus ||
rpc_pkt.u.reply.astatus) {
+#ifdef NFS_DEBUG
+ printf ("rstatus: %d\n", rpc_pkt.u.reply.rstatus);
+ printf ("verifier: %08lx\n", rpc_pkt.u.reply.verifier);
+ printf ("v2: %08lx\n", rpc_pkt.u.reply.v2);
+ printf ("astatus: %d\n", rpc_pkt.u.reply.astatus);
+#endif
return -1;
}
memcpy ((unsigned char *)&rpc_pkt, pkt, len);
- if (ntohl(rpc_pkt.u.reply.id) != rpc_id)
+ if (ntohl(rpc_pkt.u.reply.id) != rpc_id) {
+#ifdef NFS_DEBUG
+ printf ("rpc_id error. expected: %d, got: %d\n", \
+ rpc_id, ntohl(rpc_pkt.u.reply.id));
+#endif
return -1;
+ }
if (rpc_pkt.u.reply.rstatus ||
rpc_pkt.u.reply.verifier ||
rpc_pkt.u.reply.astatus ||
rpc_pkt.u.reply.data[0]) {
+#ifdef NFS_DEBUG
+ printf ("rstatus: %d\n", rpc_pkt.u.reply.rstatus);
+ printf ("verifier: %08lx\n", rpc_pkt.u.reply.verifier);
+ printf ("astatus: %d\n", rpc_pkt.u.reply.astatus);
+ printf ("data[0]: %08lx\n", rpc_pkt.u.reply.data[0]);
+#endif
return -1;
}
struct rpc_t rpc_pkt;
int rlen;
-#ifdef NFS_DEBUG_nop
+#ifdef NFS_DEBUG
printf ("%s\n", __FUNCTION__);
#endif
printf ("%s\n", __FUNCTION__);
#endif
+ if (!pkt && !dest && !src && !len) /* ARP packet */
+ return;
if (dest != NfsOurPort) return;
switch (NfsState) {