]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-nfs.c
There's no link-layer header on Linux ARPHRD_ATM packets; there's
[tcpdump] / print-nfs.c
index 8beac1d6affd13c44fd094607efdb7a5265c2187..c135486693a055d37cf675c6045e870c6469cc5e 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-nfs.c,v 1.85 2000-09-29 04:58:44 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-nfs.c,v 1.89 2001-07-08 08:01:43 itojun Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -36,9 +36,6 @@ struct mbuf;
 struct rtentry;
 
 #include <netinet/in.h>
-#ifdef INET6
-#include <netinet/ip6.h>
-#endif
 
 #include <rpc/rpc.h>
 
@@ -54,6 +51,9 @@ struct rtentry;
 #include "nfsfh.h"
 
 #include "ip.h"
+#ifdef INET6
+#include "ip6.h"
+#endif
 
 static void nfs_printfh(const u_int32_t *, const u_int);
 static void xid_map_enter(const struct rpc_msg *, const u_char *);
@@ -226,7 +226,7 @@ print_nfsaddr(const u_char *bp, const char *s, const char *d)
 #endif
 
        srcaddr[0] = dstaddr[0] = '\0';
-       switch (((struct ip *)bp)->ip_v) {
+       switch (IP_V((struct ip *)bp)) {
        case 4:
                ip = (struct ip *)bp;
                strlcpy(srcaddr, ipaddr_string(&ip->ip_src), sizeof(srcaddr));
@@ -827,7 +827,7 @@ xid_map_enter(const struct rpc_msg *rp, const u_char *bp)
 #endif
        struct xid_map_entry *xmep;
 
-       switch (((struct ip *)bp)->ip_v) {
+       switch (IP_V((struct ip *)bp)) {
        case 4:
                ip = (struct ip *)bp;
                break;
@@ -884,7 +884,7 @@ xid_map_find(const struct rpc_msg *rp, const u_char *bp, u_int32_t *proc,
        do {
                xmep = &xid_map[i];
                cmp = 1;
-               if (xmep->ipver != ip->ip_v || xmep->xid != xid)
+               if (xmep->ipver != IP_V(ip) || xmep->xid != xid)
                        goto nextitem;
                switch (xmep->ipver) {
                case 4:
@@ -1205,7 +1205,7 @@ parserddires(const u_int32_t *dp)
        int er;
 
        dp = parsestatus(dp, &er);
-       if (dp == 0 || er)
+       if (dp == NULL || er)
                return (0);
        if (qflag)
                return (1);
@@ -1487,7 +1487,8 @@ interp_reply(const struct rpc_msg *rp, u_int32_t proc, u_int32_t vers, int lengt
 
        case NFSPROC_ACCESS:
                printf(" access");
-               dp = parserep(rp, length);
+               if (!(dp = parserep(rp, length)))
+                       break;
                if (!(dp = parsestatus(dp, &er)))
                        break;
                if (vflag)