]>
The Tcpdump Group git mirrors - tcpdump/blob - print-nfs.c
a7218f25d071d95813b0560a23085aeb69685829
2 * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
3 * The Regents of the University of California. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that: (1) source code distributions
7 * retain the above copyright notice and this paragraph in its entirety, (2)
8 * distributions including binary code include the above copyright notice and
9 * this paragraph in its entirety in the documentation or other materials
10 * provided with the distribution, and (3) all advertising materials mentioning
11 * features or use of this software display the following acknowledgement:
12 * ``This product includes software developed by the University of California,
13 * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
14 * the University nor the names of its contributors may be used to endorse
15 * or promote products derived from this software without specific prior
17 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
18 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
22 /* \summary: Network File System (NFS) printer */
28 #include "netdissect-stdinc.h"
34 #include "netdissect.h"
35 #include "addrtoname.h"
47 static void nfs_printfh(netdissect_options
*, const uint32_t *, const u_int
);
48 static int xid_map_enter(netdissect_options
*, const struct sunrpc_msg
*, const u_char
*);
49 static int xid_map_find(netdissect_options
*, const struct sunrpc_msg
*, const u_char
*, uint32_t *, uint32_t *);
50 static void interp_reply(netdissect_options
*, const struct sunrpc_msg
*, uint32_t, uint32_t, int);
51 static const uint32_t *parse_post_op_attr(netdissect_options
*, const uint32_t *, int);
54 * Mapping of old NFS Version 2 RPC numbers to generic numbers.
56 static uint32_t nfsv3_procid
[NFS_NPROCS
] = {
85 static const struct tok nfsproc_str
[] = {
86 { NFSPROC_NOOP
, "nop" },
87 { NFSPROC_NULL
, "null" },
88 { NFSPROC_GETATTR
, "getattr" },
89 { NFSPROC_SETATTR
, "setattr" },
90 { NFSPROC_LOOKUP
, "lookup" },
91 { NFSPROC_ACCESS
, "access" },
92 { NFSPROC_READLINK
, "readlink" },
93 { NFSPROC_READ
, "read" },
94 { NFSPROC_WRITE
, "write" },
95 { NFSPROC_CREATE
, "create" },
96 { NFSPROC_MKDIR
, "mkdir" },
97 { NFSPROC_SYMLINK
, "symlink" },
98 { NFSPROC_MKNOD
, "mknod" },
99 { NFSPROC_REMOVE
, "remove" },
100 { NFSPROC_RMDIR
, "rmdir" },
101 { NFSPROC_RENAME
, "rename" },
102 { NFSPROC_LINK
, "link" },
103 { NFSPROC_READDIR
, "readdir" },
104 { NFSPROC_READDIRPLUS
, "readdirplus" },
105 { NFSPROC_FSSTAT
, "fsstat" },
106 { NFSPROC_FSINFO
, "fsinfo" },
107 { NFSPROC_PATHCONF
, "pathconf" },
108 { NFSPROC_COMMIT
, "commit" },
113 * NFS V2 and V3 status values.
115 * Some of these come from the RFCs for NFS V2 and V3, with the message
116 * strings taken from the FreeBSD C library "errlst.c".
118 * Others are errors that are not in the RFC but that I suspect some
119 * NFS servers could return; the values are FreeBSD errno values, as
120 * the first NFS server was the SunOS 2.0 one, and until 5.0 SunOS
121 * was primarily BSD-derived.
123 static const struct tok status2str
[] = {
124 { 1, "Operation not permitted" }, /* EPERM */
125 { 2, "No such file or directory" }, /* ENOENT */
126 { 5, "Input/output error" }, /* EIO */
127 { 6, "Device not configured" }, /* ENXIO */
128 { 11, "Resource deadlock avoided" }, /* EDEADLK */
129 { 12, "Cannot allocate memory" }, /* ENOMEM */
130 { 13, "Permission denied" }, /* EACCES */
131 { 17, "File exists" }, /* EEXIST */
132 { 18, "Cross-device link" }, /* EXDEV */
133 { 19, "Operation not supported by device" }, /* ENODEV */
134 { 20, "Not a directory" }, /* ENOTDIR */
135 { 21, "Is a directory" }, /* EISDIR */
136 { 22, "Invalid argument" }, /* EINVAL */
137 { 26, "Text file busy" }, /* ETXTBSY */
138 { 27, "File too large" }, /* EFBIG */
139 { 28, "No space left on device" }, /* ENOSPC */
140 { 30, "Read-only file system" }, /* EROFS */
141 { 31, "Too many links" }, /* EMLINK */
142 { 45, "Operation not supported" }, /* EOPNOTSUPP */
143 { 62, "Too many levels of symbolic links" }, /* ELOOP */
144 { 63, "File name too long" }, /* ENAMETOOLONG */
145 { 66, "Directory not empty" }, /* ENOTEMPTY */
146 { 69, "Disc quota exceeded" }, /* EDQUOT */
147 { 70, "Stale NFS file handle" }, /* ESTALE */
148 { 71, "Too many levels of remote in path" }, /* EREMOTE */
149 { 99, "Write cache flushed to disk" }, /* NFSERR_WFLUSH (not used) */
150 { 10001, "Illegal NFS file handle" }, /* NFS3ERR_BADHANDLE */
151 { 10002, "Update synchronization mismatch" }, /* NFS3ERR_NOT_SYNC */
152 { 10003, "READDIR/READDIRPLUS cookie is stale" }, /* NFS3ERR_BAD_COOKIE */
153 { 10004, "Operation not supported" }, /* NFS3ERR_NOTSUPP */
154 { 10005, "Buffer or request is too small" }, /* NFS3ERR_TOOSMALL */
155 { 10006, "Unspecified error on server" }, /* NFS3ERR_SERVERFAULT */
156 { 10007, "Object of that type not supported" }, /* NFS3ERR_BADTYPE */
157 { 10008, "Request couldn't be completed in time" }, /* NFS3ERR_JUKEBOX */
161 static const struct tok nfsv3_writemodes
[] = {
168 static const struct tok type2str
[] = {
179 static const struct tok sunrpc_auth_str
[] = {
180 { SUNRPC_AUTH_OK
, "OK" },
181 { SUNRPC_AUTH_BADCRED
, "Bogus Credentials (seal broken)" },
182 { SUNRPC_AUTH_REJECTEDCRED
, "Rejected Credentials (client should begin new session)" },
183 { SUNRPC_AUTH_BADVERF
, "Bogus Verifier (seal broken)" },
184 { SUNRPC_AUTH_REJECTEDVERF
, "Verifier expired or was replayed" },
185 { SUNRPC_AUTH_TOOWEAK
, "Credentials are too weak" },
186 { SUNRPC_AUTH_INVALIDRESP
, "Bogus response verifier" },
187 { SUNRPC_AUTH_FAILED
, "Unknown failure" },
191 static const struct tok sunrpc_str
[] = {
192 { SUNRPC_PROG_UNAVAIL
, "PROG_UNAVAIL" },
193 { SUNRPC_PROG_MISMATCH
, "PROG_MISMATCH" },
194 { SUNRPC_PROC_UNAVAIL
, "PROC_UNAVAIL" },
195 { SUNRPC_GARBAGE_ARGS
, "GARBAGE_ARGS" },
196 { SUNRPC_SYSTEM_ERR
, "SYSTEM_ERR" },
201 print_nfsaddr(netdissect_options
*ndo
,
202 const u_char
*bp
, const char *s
, const char *d
)
205 const struct ip6_hdr
*ip6
;
206 char srcaddr
[INET6_ADDRSTRLEN
], dstaddr
[INET6_ADDRSTRLEN
];
208 srcaddr
[0] = dstaddr
[0] = '\0';
209 switch (IP_V((const struct ip
*)bp
)) {
211 ip
= (const struct ip
*)bp
;
212 strlcpy(srcaddr
, GET_IPADDR_STRING(ip
->ip_src
), sizeof(srcaddr
));
213 strlcpy(dstaddr
, GET_IPADDR_STRING(ip
->ip_dst
), sizeof(dstaddr
));
216 ip6
= (const struct ip6_hdr
*)bp
;
217 strlcpy(srcaddr
, GET_IP6ADDR_STRING(ip6
->ip6_src
),
219 strlcpy(dstaddr
, GET_IP6ADDR_STRING(ip6
->ip6_dst
),
223 strlcpy(srcaddr
, "?", sizeof(srcaddr
));
224 strlcpy(dstaddr
, "?", sizeof(dstaddr
));
228 ND_PRINT("%s.%s > %s.%s: ", srcaddr
, s
, dstaddr
, d
);
232 * NFS Version 3 sattr3 structure for the new node creation case.
233 * This does not have a fixed layout on the network, so this
234 * structure does not correspond to the layout of the data on
235 * the network; it's used to store the data when the sattr3
236 * is parsed for use when it's later printed.
247 uint32_t sa_atimetype
;
252 uint32_t sa_mtimetype
;
259 static const uint32_t *
260 parse_sattr3(netdissect_options
*ndo
,
261 const uint32_t *dp
, struct nfsv3_sattr
*sa3
)
263 sa3
->sa_modeset
= GET_BE_U_4(dp
);
265 if (sa3
->sa_modeset
) {
266 sa3
->sa_mode
= GET_BE_U_4(dp
);
270 sa3
->sa_uidset
= GET_BE_U_4(dp
);
272 if (sa3
->sa_uidset
) {
273 sa3
->sa_uid
= GET_BE_U_4(dp
);
277 sa3
->sa_gidset
= GET_BE_U_4(dp
);
279 if (sa3
->sa_gidset
) {
280 sa3
->sa_gid
= GET_BE_U_4(dp
);
284 sa3
->sa_sizeset
= GET_BE_U_4(dp
);
286 if (sa3
->sa_sizeset
) {
287 sa3
->sa_size
= GET_BE_U_4(dp
);
291 sa3
->sa_atimetype
= GET_BE_U_4(dp
);
293 if (sa3
->sa_atimetype
== NFSV3SATTRTIME_TOCLIENT
) {
295 sa3
->sa_atime
.nfsv3_sec
= GET_BE_U_4(dp
);
297 sa3
->sa_atime
.nfsv3_nsec
= GET_BE_U_4(dp
);
301 sa3
->sa_mtimetype
= GET_BE_U_4(dp
);
303 if (sa3
->sa_mtimetype
== NFSV3SATTRTIME_TOCLIENT
) {
305 sa3
->sa_mtime
.nfsv3_sec
= GET_BE_U_4(dp
);
307 sa3
->sa_mtime
.nfsv3_nsec
= GET_BE_U_4(dp
);
317 print_sattr3(netdissect_options
*ndo
,
318 const struct nfsv3_sattr
*sa3
, int verbose
)
321 ND_PRINT(" mode %o", sa3
->sa_mode
);
323 ND_PRINT(" uid %u", sa3
->sa_uid
);
325 ND_PRINT(" gid %u", sa3
->sa_gid
);
327 if (sa3
->sa_atimetype
== NFSV3SATTRTIME_TOCLIENT
)
328 ND_PRINT(" atime %u.%06u", sa3
->sa_atime
.nfsv3_sec
,
329 sa3
->sa_atime
.nfsv3_nsec
);
330 if (sa3
->sa_mtimetype
== NFSV3SATTRTIME_TOCLIENT
)
331 ND_PRINT(" mtime %u.%06u", sa3
->sa_mtime
.nfsv3_sec
,
332 sa3
->sa_mtime
.nfsv3_nsec
);
337 nfsreply_print(netdissect_options
*ndo
,
338 const u_char
*bp
, u_int length
,
341 const struct sunrpc_msg
*rp
;
342 char srcid
[20], dstid
[20]; /*fits 32bit*/
344 ndo
->ndo_protocol
= "nfs";
345 rp
= (const struct sunrpc_msg
*)bp
;
347 ND_TCHECK_4(rp
->rm_xid
);
348 if (!ndo
->ndo_nflag
) {
349 strlcpy(srcid
, "nfs", sizeof(srcid
));
350 snprintf(dstid
, sizeof(dstid
), "%u",
351 GET_BE_U_4(rp
->rm_xid
));
353 snprintf(srcid
, sizeof(srcid
), "%u", NFS_PORT
);
354 snprintf(dstid
, sizeof(dstid
), "%u",
355 GET_BE_U_4(rp
->rm_xid
));
357 print_nfsaddr(ndo
, bp2
, srcid
, dstid
);
359 nfsreply_noaddr_print(ndo
, bp
, length
, bp2
);
367 nfsreply_noaddr_print(netdissect_options
*ndo
,
368 const u_char
*bp
, u_int length
,
371 const struct sunrpc_msg
*rp
;
372 uint32_t proc
, vers
, reply_stat
;
373 enum sunrpc_reject_stat rstat
;
376 enum sunrpc_auth_stat rwhy
;
378 ndo
->ndo_protocol
= "nfs";
379 rp
= (const struct sunrpc_msg
*)bp
;
381 ND_TCHECK_4(rp
->rm_reply
.rp_stat
);
382 reply_stat
= GET_BE_U_4(&rp
->rm_reply
.rp_stat
);
383 switch (reply_stat
) {
385 case SUNRPC_MSG_ACCEPTED
:
386 ND_PRINT("reply ok %u", length
);
387 if (xid_map_find(ndo
, rp
, bp2
, &proc
, &vers
) >= 0)
388 interp_reply(ndo
, rp
, proc
, vers
, length
);
391 case SUNRPC_MSG_DENIED
:
392 ND_PRINT("reply ERR %u: ", length
);
393 ND_TCHECK_4(rp
->rm_reply
.rp_reject
.rj_stat
);
394 rstat
= GET_BE_U_4(&rp
->rm_reply
.rp_reject
.rj_stat
);
397 case SUNRPC_RPC_MISMATCH
:
398 ND_TCHECK_4(rp
->rm_reply
.rp_reject
.rj_vers
.high
);
399 rlow
= GET_BE_U_4(&rp
->rm_reply
.rp_reject
.rj_vers
.low
);
400 rhigh
= GET_BE_U_4(&rp
->rm_reply
.rp_reject
.rj_vers
.high
);
401 ND_PRINT("RPC Version mismatch (%u-%u)", rlow
, rhigh
);
404 case SUNRPC_AUTH_ERROR
:
405 ND_TCHECK_4(rp
->rm_reply
.rp_reject
.rj_why
);
406 rwhy
= GET_BE_U_4(&rp
->rm_reply
.rp_reject
.rj_why
);
407 ND_PRINT("Auth %s", tok2str(sunrpc_auth_str
, "Invalid failure code %u", rwhy
));
411 ND_PRINT("Unknown reason for rejecting rpc message %u", (unsigned int)rstat
);
417 ND_PRINT("reply Unknown rpc response code=%u %u", reply_stat
, length
);
427 * Return a pointer to the first file handle in the packet.
428 * If the packet was truncated, return 0.
430 static const uint32_t *
431 parsereq(netdissect_options
*ndo
,
432 const struct sunrpc_msg
*rp
, u_int length
)
435 u_int len
, rounded_len
;
438 * Find the start of the req data (if we captured it).
439 * First, get the length of the credentials, and make sure
440 * we have all of the opaque part of the credentials.
442 dp
= (const uint32_t *)&rp
->rm_call
.cb_cred
;
443 if (length
< 2 * sizeof(*dp
))
445 len
= GET_BE_U_4(dp
+ 1);
446 rounded_len
= roundup2(len
, 4);
447 ND_TCHECK_LEN(dp
+ 2, rounded_len
);
448 if (2 * sizeof(*dp
) + rounded_len
<= length
) {
450 * We have all of the credentials. Skip past them; they
451 * consist of 4 bytes of flavor, 4 bytes of length,
452 * and len-rounded-up-to-a-multiple-of-4 bytes of
455 dp
+= (len
+ (2 * sizeof(*dp
) + 3)) / sizeof(*dp
);
456 length
-= 2 * sizeof(*dp
) + rounded_len
;
459 * Now get the length of the verifier, and make sure
460 * we have all of the opaque part of the verifier.
462 if (length
< 2 * sizeof(*dp
))
464 len
= GET_BE_U_4(dp
+ 1);
465 rounded_len
= roundup2(len
, 4);
466 ND_TCHECK_LEN(dp
+ 2, rounded_len
);
467 if (2 * sizeof(*dp
) + rounded_len
< length
) {
469 * We have all of the verifier. Skip past it;
470 * it consists of 4 bytes of flavor, 4 bytes of
471 * length, and len-rounded-up-to-a-multiple-of-4
474 dp
+= (len
+ (2 * sizeof(*dp
) + 3)) / sizeof(*dp
);
483 * Print out an NFS file handle and return a pointer to following word.
484 * If packet was truncated, return 0.
486 static const uint32_t *
487 parsefh(netdissect_options
*ndo
,
488 const uint32_t *dp
, int v3
)
493 len
= GET_BE_U_4(dp
) / 4;
498 if (ND_TTEST_LEN(dp
, len
* sizeof(*dp
))) {
499 nfs_printfh(ndo
, dp
, len
);
506 * Print out a file name and return pointer to 32-bit word past it.
507 * If packet was truncated, return 0.
509 static const uint32_t *
510 parsefn(netdissect_options
*ndo
,
513 uint32_t len
, rounded_len
;
516 /* Fetch big-endian string length */
517 len
= GET_BE_U_4(dp
);
520 if (UINT_MAX
- len
< 3) {
521 ND_PRINT("[cannot pad to 32-bit boundaries]");
522 nd_print_invalid(ndo
);
526 rounded_len
= roundup2(len
, 4);
527 ND_TCHECK_LEN(dp
, rounded_len
);
529 cp
= (const u_char
*)dp
;
530 /* Update 32-bit pointer (NFS filenames padded to 32-bit boundaries) */
531 dp
+= rounded_len
/ sizeof(*dp
);
533 if (nd_printn(ndo
, cp
, len
, ndo
->ndo_snapend
)) {
545 * Print out file handle and file name.
546 * Return pointer to 32-bit word past file name.
547 * If packet was truncated (or there was some other error), return 0.
549 static const uint32_t *
550 parsefhn(netdissect_options
*ndo
,
551 const uint32_t *dp
, int v3
)
553 dp
= parsefh(ndo
, dp
, v3
);
557 return (parsefn(ndo
, dp
));
561 nfsreq_noaddr_print(netdissect_options
*ndo
,
562 const u_char
*bp
, u_int length
,
565 const struct sunrpc_msg
*rp
;
570 uint32_t access_flags
;
571 struct nfsv3_sattr sa3
;
573 ndo
->ndo_protocol
= "nfs";
574 ND_PRINT("%u", length
);
575 rp
= (const struct sunrpc_msg
*)bp
;
577 if (!xid_map_enter(ndo
, rp
, bp2
)) /* record proc number for later on */
580 v3
= (GET_BE_U_4(&rp
->rm_call
.cb_vers
) == NFS_VER3
);
581 proc
= GET_BE_U_4(&rp
->rm_call
.cb_proc
);
583 if (!v3
&& proc
< NFS_NPROCS
)
584 proc
= nfsv3_procid
[proc
];
586 ND_PRINT(" %s", tok2str(nfsproc_str
, "proc-%u", proc
));
589 case NFSPROC_GETATTR
:
590 case NFSPROC_SETATTR
:
591 case NFSPROC_READLINK
:
594 case NFSPROC_PATHCONF
:
595 dp
= parsereq(ndo
, rp
, length
);
598 if (parsefh(ndo
, dp
, v3
) == NULL
)
607 dp
= parsereq(ndo
, rp
, length
);
610 if (parsefhn(ndo
, dp
, v3
) == NULL
)
615 dp
= parsereq(ndo
, rp
, length
);
618 dp
= parsefh(ndo
, dp
, v3
);
621 access_flags
= GET_BE_U_4(dp
);
622 if (access_flags
& ~NFSV3ACCESS_FULL
) {
623 /* NFSV3ACCESS definitions aren't up to date */
624 ND_PRINT(" %04x", access_flags
);
625 } else if ((access_flags
& NFSV3ACCESS_FULL
) == NFSV3ACCESS_FULL
) {
626 ND_PRINT(" NFS_ACCESS_FULL");
628 char separator
= ' ';
629 if (access_flags
& NFSV3ACCESS_READ
) {
630 ND_PRINT(" NFS_ACCESS_READ");
633 if (access_flags
& NFSV3ACCESS_LOOKUP
) {
634 ND_PRINT("%cNFS_ACCESS_LOOKUP", separator
);
637 if (access_flags
& NFSV3ACCESS_MODIFY
) {
638 ND_PRINT("%cNFS_ACCESS_MODIFY", separator
);
641 if (access_flags
& NFSV3ACCESS_EXTEND
) {
642 ND_PRINT("%cNFS_ACCESS_EXTEND", separator
);
645 if (access_flags
& NFSV3ACCESS_DELETE
) {
646 ND_PRINT("%cNFS_ACCESS_DELETE", separator
);
649 if (access_flags
& NFSV3ACCESS_EXECUTE
)
650 ND_PRINT("%cNFS_ACCESS_EXECUTE", separator
);
655 dp
= parsereq(ndo
, rp
, length
);
658 dp
= parsefh(ndo
, dp
, v3
);
662 ND_PRINT(" %u bytes @ %" PRIu64
,
666 ND_PRINT(" %u bytes @ %u",
673 dp
= parsereq(ndo
, rp
, length
);
676 dp
= parsefh(ndo
, dp
, v3
);
680 ND_PRINT(" %u (%u) bytes @ %" PRIu64
,
684 if (ndo
->ndo_vflag
) {
686 tok2str(nfsv3_writemodes
,
687 NULL
, GET_BE_U_4(dp
+ 3)));
690 ND_PRINT(" %u (%u) bytes @ %u (%u)",
698 case NFSPROC_SYMLINK
:
699 dp
= parsereq(ndo
, rp
, length
);
702 dp
= parsefhn(ndo
, dp
, v3
);
706 if (v3
&& (dp
= parse_sattr3(ndo
, dp
, &sa3
)) == NULL
)
708 if (parsefn(ndo
, dp
) == NULL
)
710 if (v3
&& ndo
->ndo_vflag
)
711 print_sattr3(ndo
, &sa3
, ndo
->ndo_vflag
);
715 dp
= parsereq(ndo
, rp
, length
);
718 dp
= parsefhn(ndo
, dp
, v3
);
721 type
= (nfs_type
) GET_BE_U_4(dp
);
723 dp
= parse_sattr3(ndo
, dp
, &sa3
);
726 ND_PRINT(" %s", tok2str(type2str
, "unk-ft %u", type
));
727 if (ndo
->ndo_vflag
&& (type
== NFCHR
|| type
== NFBLK
)) {
734 print_sattr3(ndo
, &sa3
, ndo
->ndo_vflag
);
738 dp
= parsereq(ndo
, rp
, length
);
741 dp
= parsefhn(ndo
, dp
, v3
);
745 if (parsefhn(ndo
, dp
, v3
) == NULL
)
750 dp
= parsereq(ndo
, rp
, length
);
753 dp
= parsefh(ndo
, dp
, v3
);
757 if (parsefhn(ndo
, dp
, v3
) == NULL
)
761 case NFSPROC_READDIR
:
762 dp
= parsereq(ndo
, rp
, length
);
765 dp
= parsefh(ndo
, dp
, v3
);
770 * We shouldn't really try to interpret the
771 * offset cookie here.
773 ND_PRINT(" %u bytes @ %" PRId64
,
776 if (ndo
->ndo_vflag
) {
778 * This displays the 8 bytes
779 * of the verifier in order,
780 * from the low-order byte
781 * to the high-order byte.
783 ND_PRINT(" verf %08x%08x",
789 * Print the offset as signed, since -1 is
790 * common, but offsets > 2^31 aren't.
792 ND_PRINT(" %u bytes @ %u",
798 case NFSPROC_READDIRPLUS
:
799 dp
= parsereq(ndo
, rp
, length
);
802 dp
= parsefh(ndo
, dp
, v3
);
806 * We don't try to interpret the offset
809 ND_PRINT(" %u bytes @ %" PRId64
,
812 if (ndo
->ndo_vflag
) {
814 * This displays the 8 bytes
815 * of the verifier in order,
816 * from the low-order byte
817 * to the high-order byte.
819 ND_PRINT(" max %u verf %08x%08x",
827 dp
= parsereq(ndo
, rp
, length
);
830 dp
= parsefh(ndo
, dp
, v3
);
833 ND_PRINT(" %u bytes @ %" PRIu64
,
848 * Print out an NFS file handle.
849 * We assume packet was not truncated before the end of the
850 * file handle pointed to by dp.
852 * Note: new version (using portable file-handle parser) doesn't produce
853 * generation number. It probably could be made to do that, with some
854 * additional hacking on the parser code.
857 nfs_printfh(netdissect_options
*ndo
,
858 const uint32_t *dp
, const u_int len
)
862 const char *sfsname
= NULL
;
865 if (ndo
->ndo_uflag
) {
867 char const *sep
= "";
870 for (i
=0; i
<len
; i
++) {
872 * This displays 4 bytes in big-endian byte
873 * order. That's as good a choice as little-
874 * endian, as there's no guarantee that the
875 * server is big-endian or little-endian or
876 * that the file handle contains 4-byte
877 * integral fields, and is better than "the
878 * byte order of the host running tcpdump", as
879 * the latter means that different hosts
880 * running tcpdump may show the same file
881 * handle in different ways.
883 ND_PRINT("%s%x", sep
, GET_BE_U_4(dp
+ i
));
890 Parse_fh(ndo
, (const u_char
*)dp
, len
, &fsid
, &ino
, NULL
, &sfsname
, 0);
893 /* file system ID is ASCII, not numeric, for this server OS */
894 char temp
[NFSX_V3FHMAX
+1];
897 /* Make sure string is null-terminated */
899 if (stringlen
> NFSX_V3FHMAX
)
900 stringlen
= NFSX_V3FHMAX
;
901 strncpy(temp
, sfsname
, stringlen
);
902 temp
[stringlen
] = '\0';
903 /* Remove trailing spaces */
904 spacep
= strchr(temp
, ' ');
908 ND_PRINT(" fh %s/", temp
);
910 ND_PRINT(" fh %u,%u/",
911 fsid
.Fsid_dev
.Major
, fsid
.Fsid_dev
.Minor
);
914 if(fsid
.Fsid_dev
.Minor
== 257)
915 /* Print the undecoded handle */
916 ND_PRINT("%s", fsid
.Opaque_Handle
);
918 ND_PRINT("%ld", (long) ino
);
922 * Maintain a small cache of recent client.XID.server/proc pairs, to allow
923 * us to match up replies with requests and thus to know how to parse
927 struct xid_map_entry
{
928 uint32_t xid
; /* transaction ID (net order) */
929 int ipver
; /* IP version (4 or 6) */
930 nd_ipv6 client
; /* client IP address (net order) */
931 nd_ipv6 server
; /* server IP address (net order) */
932 uint32_t proc
; /* call proc number (host order) */
933 uint32_t vers
; /* program version (host order) */
937 * Map entries are kept in an array that we manage as a ring;
938 * new entries are always added at the tail of the ring. Initially,
939 * all the entries are zero and hence don't match anything.
942 #define XIDMAPSIZE 64
944 static struct xid_map_entry xid_map
[XIDMAPSIZE
];
946 static int xid_map_next
= 0;
947 static int xid_map_hint
= 0;
950 xid_map_enter(netdissect_options
*ndo
,
951 const struct sunrpc_msg
*rp
, const u_char
*bp
)
953 const struct ip
*ip
= NULL
;
954 const struct ip6_hdr
*ip6
= NULL
;
955 struct xid_map_entry
*xmep
;
957 if (!ND_TTEST_4(rp
->rm_call
.cb_proc
))
959 switch (IP_V((const struct ip
*)bp
)) {
961 ip
= (const struct ip
*)bp
;
964 ip6
= (const struct ip6_hdr
*)bp
;
970 xmep
= &xid_map
[xid_map_next
];
972 if (++xid_map_next
>= XIDMAPSIZE
)
975 UNALIGNED_MEMCPY(&xmep
->xid
, &rp
->rm_xid
, sizeof(xmep
->xid
));
978 UNALIGNED_MEMCPY(&xmep
->client
, ip
->ip_src
,
980 UNALIGNED_MEMCPY(&xmep
->server
, ip
->ip_dst
,
985 UNALIGNED_MEMCPY(&xmep
->client
, ip6
->ip6_src
,
986 sizeof(ip6
->ip6_src
));
987 UNALIGNED_MEMCPY(&xmep
->server
, ip6
->ip6_dst
,
988 sizeof(ip6
->ip6_dst
));
990 xmep
->proc
= GET_BE_U_4(&rp
->rm_call
.cb_proc
);
991 xmep
->vers
= GET_BE_U_4(&rp
->rm_call
.cb_vers
);
996 * Returns 0 and puts NFSPROC_xxx in proc return and
997 * version in vers return, or returns -1 on failure
1000 xid_map_find(netdissect_options
*ndo
, const struct sunrpc_msg
*rp
,
1001 const u_char
*bp
, uint32_t *proc
, uint32_t *vers
)
1004 struct xid_map_entry
*xmep
;
1006 const struct ip
*ip
= (const struct ip
*)bp
;
1007 const struct ip6_hdr
*ip6
= (const struct ip6_hdr
*)bp
;
1010 UNALIGNED_MEMCPY(&xid
, &rp
->rm_xid
, sizeof(xmep
->xid
));
1011 /* Start searching from where we last left off */
1016 if (xmep
->ipver
!= IP_V(ip
) || xmep
->xid
!= xid
)
1018 switch (xmep
->ipver
) {
1020 if (UNALIGNED_MEMCMP(ip
->ip_src
, &xmep
->server
,
1021 sizeof(ip
->ip_src
)) != 0 ||
1022 UNALIGNED_MEMCMP(ip
->ip_dst
, &xmep
->client
,
1023 sizeof(ip
->ip_dst
)) != 0) {
1028 if (UNALIGNED_MEMCMP(ip6
->ip6_src
, &xmep
->server
,
1029 sizeof(ip6
->ip6_src
)) != 0 ||
1030 UNALIGNED_MEMCMP(ip6
->ip6_dst
, &xmep
->client
,
1031 sizeof(ip6
->ip6_dst
)) != 0) {
1047 if (++i
>= XIDMAPSIZE
)
1049 } while (i
!= xid_map_hint
);
1056 * Routines for parsing reply packets
1060 * Return a pointer to the beginning of the actual results.
1061 * If the packet was truncated, return 0.
1063 static const uint32_t *
1064 parserep(netdissect_options
*ndo
,
1065 const struct sunrpc_msg
*rp
, u_int length
, int *nfserrp
)
1069 enum sunrpc_accept_stat astat
;
1073 * Here we find the address of the ar_verf credentials.
1074 * Originally, this calculation was
1075 * dp = (uint32_t *)&rp->rm_reply.rp_acpt.ar_verf
1076 * On the wire, the rp_acpt field starts immediately after
1077 * the (32 bit) rp_stat field. However, rp_acpt (which is a
1078 * "struct accepted_reply") contains a "struct opaque_auth",
1079 * whose internal representation contains a pointer, so on a
1080 * 64-bit machine the compiler inserts 32 bits of padding
1081 * before rp->rm_reply.rp_acpt.ar_verf. So, we cannot use
1082 * the internal representation to parse the on-the-wire
1083 * representation. Instead, we skip past the rp_stat field,
1084 * which is an "enum" and so occupies one 32-bit word.
1086 dp
= ((const uint32_t *)&rp
->rm_reply
) + 1;
1087 len
= GET_BE_U_4(dp
+ 1);
1091 * skip past the ar_verf credentials.
1093 dp
+= (len
+ (2*sizeof(uint32_t) + 3)) / sizeof(uint32_t);
1096 * now we can check the ar_stat field
1098 astat
= (enum sunrpc_accept_stat
) GET_BE_U_4(dp
);
1099 if (astat
!= SUNRPC_SUCCESS
) {
1100 ND_PRINT(" %s", tok2str(sunrpc_str
, "ar_stat %u", astat
));
1101 *nfserrp
= 1; /* suppress trunc string */
1104 /* successful return */
1105 ND_TCHECK_LEN(dp
, sizeof(astat
));
1106 return ((const uint32_t *) (sizeof(astat
) + ((const char *)dp
)));
1111 static const uint32_t *
1112 parsestatus(netdissect_options
*ndo
,
1113 const uint32_t *dp
, u_int
*er
, int *nfserrp
)
1117 errnum
= GET_BE_U_4(dp
);
1121 if (!ndo
->ndo_qflag
)
1122 ND_PRINT(" ERROR: %s",
1123 tok2str(status2str
, "unk %u", errnum
));
1129 static const uint32_t *
1130 parsefattr(netdissect_options
*ndo
,
1131 const uint32_t *dp
, int verbose
, int v3
)
1133 const struct nfs_fattr
*fap
;
1135 fap
= (const struct nfs_fattr
*)dp
;
1136 ND_TCHECK_4(fap
->fa_gid
);
1139 * XXX - UIDs and GIDs are unsigned in NFS and in
1140 * at least some UN*Xes, but we'll show them as
1141 * signed because -2 has traditionally been the
1142 * UID for "nobody", rather than 4294967294.
1144 ND_PRINT(" %s %o ids %d/%d",
1145 tok2str(type2str
, "unk-ft %u ",
1146 GET_BE_U_4(fap
->fa_type
)),
1147 GET_BE_U_4(fap
->fa_mode
),
1148 GET_BE_S_4(fap
->fa_uid
),
1149 GET_BE_S_4(fap
->fa_gid
));
1151 ND_PRINT(" sz %" PRIu64
,
1152 GET_BE_U_8(fap
->fa3_size
));
1154 ND_PRINT(" sz %u", GET_BE_U_4(fap
->fa2_size
));
1157 /* print lots more stuff */
1160 ND_TCHECK_8(&fap
->fa3_ctime
);
1161 ND_PRINT(" nlink %u rdev %u/%u",
1162 GET_BE_U_4(fap
->fa_nlink
),
1163 GET_BE_U_4(fap
->fa3_rdev
.specdata1
),
1164 GET_BE_U_4(fap
->fa3_rdev
.specdata2
));
1165 ND_PRINT(" fsid %" PRIx64
,
1166 GET_BE_U_8(fap
->fa3_fsid
));
1167 ND_PRINT(" fileid %" PRIx64
,
1168 GET_BE_U_8(fap
->fa3_fileid
));
1169 ND_PRINT(" a/m/ctime %u.%06u",
1170 GET_BE_U_4(fap
->fa3_atime
.nfsv3_sec
),
1171 GET_BE_U_4(fap
->fa3_atime
.nfsv3_nsec
));
1172 ND_PRINT(" %u.%06u",
1173 GET_BE_U_4(fap
->fa3_mtime
.nfsv3_sec
),
1174 GET_BE_U_4(fap
->fa3_mtime
.nfsv3_nsec
));
1175 ND_PRINT(" %u.%06u",
1176 GET_BE_U_4(fap
->fa3_ctime
.nfsv3_sec
),
1177 GET_BE_U_4(fap
->fa3_ctime
.nfsv3_nsec
));
1179 ND_TCHECK_8(&fap
->fa2_ctime
);
1180 ND_PRINT(" nlink %u rdev 0x%x fsid 0x%x nodeid 0x%x a/m/ctime",
1181 GET_BE_U_4(fap
->fa_nlink
),
1182 GET_BE_U_4(fap
->fa2_rdev
),
1183 GET_BE_U_4(fap
->fa2_fsid
),
1184 GET_BE_U_4(fap
->fa2_fileid
));
1185 ND_PRINT(" %u.%06u",
1186 GET_BE_U_4(fap
->fa2_atime
.nfsv2_sec
),
1187 GET_BE_U_4(fap
->fa2_atime
.nfsv2_usec
));
1188 ND_PRINT(" %u.%06u",
1189 GET_BE_U_4(fap
->fa2_mtime
.nfsv2_sec
),
1190 GET_BE_U_4(fap
->fa2_mtime
.nfsv2_usec
));
1191 ND_PRINT(" %u.%06u",
1192 GET_BE_U_4(fap
->fa2_ctime
.nfsv2_sec
),
1193 GET_BE_U_4(fap
->fa2_ctime
.nfsv2_usec
));
1196 return ((const uint32_t *)((const unsigned char *)dp
+
1197 (v3
? NFSX_V3FATTR
: NFSX_V2FATTR
)));
1203 parseattrstat(netdissect_options
*ndo
,
1204 const uint32_t *dp
, int verbose
, int v3
, int *nfserrp
)
1208 dp
= parsestatus(ndo
, dp
, &er
, nfserrp
);
1214 return (parsefattr(ndo
, dp
, verbose
, v3
) != NULL
);
1218 parsediropres(netdissect_options
*ndo
,
1219 const uint32_t *dp
, int *nfserrp
)
1223 dp
= parsestatus(ndo
, dp
, &er
, nfserrp
);
1229 dp
= parsefh(ndo
, dp
, 0);
1233 return (parsefattr(ndo
, dp
, ndo
->ndo_vflag
, 0) != NULL
);
1237 parselinkres(netdissect_options
*ndo
,
1238 const uint32_t *dp
, int v3
, int *nfserrp
)
1242 dp
= parsestatus(ndo
, dp
, &er
, nfserrp
);
1248 dp
= parse_post_op_attr(ndo
, dp
, ndo
->ndo_vflag
);
1253 return (parsefn(ndo
, dp
) != NULL
);
1257 parsestatfs(netdissect_options
*ndo
,
1258 const uint32_t *dp
, int v3
, int *nfserrp
)
1260 const struct nfs_statfs
*sfsp
;
1263 dp
= parsestatus(ndo
, dp
, &er
, nfserrp
);
1275 dp
= parse_post_op_attr(ndo
, dp
, ndo
->ndo_vflag
);
1280 ND_TCHECK_LEN(dp
, (v3
? NFSX_V3STATFS
: NFSX_V2STATFS
));
1282 sfsp
= (const struct nfs_statfs
*)dp
;
1285 ND_PRINT(" tbytes %" PRIu64
" fbytes %" PRIu64
" abytes %" PRIu64
,
1286 GET_BE_U_8(sfsp
->sf_tbytes
),
1287 GET_BE_U_8(sfsp
->sf_fbytes
),
1288 GET_BE_U_8(sfsp
->sf_abytes
));
1289 if (ndo
->ndo_vflag
) {
1290 ND_PRINT(" tfiles %" PRIu64
" ffiles %" PRIu64
" afiles %" PRIu64
" invar %u",
1291 GET_BE_U_8(sfsp
->sf_tfiles
),
1292 GET_BE_U_8(sfsp
->sf_ffiles
),
1293 GET_BE_U_8(sfsp
->sf_afiles
),
1294 GET_BE_U_4(sfsp
->sf_invarsec
));
1297 ND_PRINT(" tsize %u bsize %u blocks %u bfree %u bavail %u",
1298 GET_BE_U_4(sfsp
->sf_tsize
),
1299 GET_BE_U_4(sfsp
->sf_bsize
),
1300 GET_BE_U_4(sfsp
->sf_blocks
),
1301 GET_BE_U_4(sfsp
->sf_bfree
),
1302 GET_BE_U_4(sfsp
->sf_bavail
));
1311 parserddires(netdissect_options
*ndo
,
1312 const uint32_t *dp
, int *nfserrp
)
1316 dp
= parsestatus(ndo
, dp
, &er
, nfserrp
);
1324 ND_TCHECK_4(dp
+ 2);
1325 ND_PRINT(" offset 0x%x size %u ",
1326 GET_BE_U_4(dp
), GET_BE_U_4(dp
+ 1));
1327 if (GET_BE_U_4(dp
+ 2) != 0)
1335 static const uint32_t *
1336 parse_wcc_attr(netdissect_options
*ndo
,
1339 /* Our caller has already checked this */
1340 ND_PRINT(" sz %" PRIu64
, GET_BE_U_8(dp
));
1341 ND_PRINT(" mtime %u.%06u ctime %u.%06u",
1342 GET_BE_U_4(dp
+ 2), GET_BE_U_4(dp
+ 3),
1343 GET_BE_U_4(dp
+ 4), GET_BE_U_4(dp
+ 5));
1348 * Pre operation attributes. Print only if vflag > 1.
1350 static const uint32_t *
1351 parse_pre_op_attr(netdissect_options
*ndo
,
1352 const uint32_t *dp
, int verbose
)
1354 if (!GET_BE_U_4(dp
))
1357 ND_TCHECK_LEN(dp
, 24);
1359 return parse_wcc_attr(ndo
, dp
);
1361 /* If not verbose enough, just skip over wcc_attr */
1369 * Post operation attributes are printed if vflag >= 1
1371 static const uint32_t *
1372 parse_post_op_attr(netdissect_options
*ndo
,
1373 const uint32_t *dp
, int verbose
)
1375 if (!GET_BE_U_4(dp
))
1379 return parsefattr(ndo
, dp
, verbose
, 1);
1381 return (dp
+ (NFSX_V3FATTR
/ sizeof (uint32_t)));
1384 static const uint32_t *
1385 parse_wcc_data(netdissect_options
*ndo
,
1386 const uint32_t *dp
, int verbose
)
1390 dp
= parse_pre_op_attr(ndo
, dp
, verbose
);
1396 return parse_post_op_attr(ndo
, dp
, verbose
);
1399 static const uint32_t *
1400 parsecreateopres(netdissect_options
*ndo
,
1401 const uint32_t *dp
, int verbose
, int *nfserrp
)
1405 dp
= parsestatus(ndo
, dp
, &er
, nfserrp
);
1409 dp
= parse_wcc_data(ndo
, dp
, verbose
);
1411 if (!GET_BE_U_4(dp
))
1414 dp
= parsefh(ndo
, dp
, 1);
1418 dp
= parse_post_op_attr(ndo
, dp
, verbose
);
1421 if (ndo
->ndo_vflag
> 1) {
1422 ND_PRINT(" dir attr:");
1423 dp
= parse_wcc_data(ndo
, dp
, verbose
);
1430 static const uint32_t *
1431 parsewccres(netdissect_options
*ndo
,
1432 const uint32_t *dp
, int verbose
, int *nfserrp
)
1436 dp
= parsestatus(ndo
, dp
, &er
, nfserrp
);
1439 return parse_wcc_data(ndo
, dp
, verbose
);
1442 static const uint32_t *
1443 parsev3rddirres(netdissect_options
*ndo
,
1444 const uint32_t *dp
, int verbose
, int *nfserrp
)
1448 dp
= parsestatus(ndo
, dp
, &er
, nfserrp
);
1453 dp
= parse_post_op_attr(ndo
, dp
, verbose
);
1458 if (ndo
->ndo_vflag
) {
1460 * This displays the 8 bytes of the verifier in order,
1461 * from the low-order byte to the high-order byte.
1463 ND_PRINT(" verf %08x%08x",
1464 GET_BE_U_4(dp
), GET_BE_U_4(dp
+ 1));
1471 parsefsinfo(netdissect_options
*ndo
,
1472 const uint32_t *dp
, int *nfserrp
)
1474 const struct nfsv3_fsinfo
*sfp
;
1477 dp
= parsestatus(ndo
, dp
, &er
, nfserrp
);
1482 dp
= parse_post_op_attr(ndo
, dp
, ndo
->ndo_vflag
);
1488 sfp
= (const struct nfsv3_fsinfo
*)dp
;
1489 ND_TCHECK_SIZE(sfp
);
1490 ND_PRINT(" rtmax %u rtpref %u wtmax %u wtpref %u dtpref %u",
1491 GET_BE_U_4(sfp
->fs_rtmax
),
1492 GET_BE_U_4(sfp
->fs_rtpref
),
1493 GET_BE_U_4(sfp
->fs_wtmax
),
1494 GET_BE_U_4(sfp
->fs_wtpref
),
1495 GET_BE_U_4(sfp
->fs_dtpref
));
1496 if (ndo
->ndo_vflag
) {
1497 ND_PRINT(" rtmult %u wtmult %u maxfsz %" PRIu64
,
1498 GET_BE_U_4(sfp
->fs_rtmult
),
1499 GET_BE_U_4(sfp
->fs_wtmult
),
1500 GET_BE_U_8(sfp
->fs_maxfilesize
));
1501 ND_PRINT(" delta %u.%06u ",
1502 GET_BE_U_4(sfp
->fs_timedelta
.nfsv3_sec
),
1503 GET_BE_U_4(sfp
->fs_timedelta
.nfsv3_nsec
));
1511 parsepathconf(netdissect_options
*ndo
,
1512 const uint32_t *dp
, int *nfserrp
)
1515 const struct nfsv3_pathconf
*spp
;
1517 dp
= parsestatus(ndo
, dp
, &er
, nfserrp
);
1522 dp
= parse_post_op_attr(ndo
, dp
, ndo
->ndo_vflag
);
1528 spp
= (const struct nfsv3_pathconf
*)dp
;
1529 ND_TCHECK_SIZE(spp
);
1531 ND_PRINT(" linkmax %u namemax %u %s %s %s %s",
1532 GET_BE_U_4(spp
->pc_linkmax
),
1533 GET_BE_U_4(spp
->pc_namemax
),
1534 GET_BE_U_4(spp
->pc_notrunc
) ? "notrunc" : "",
1535 GET_BE_U_4(spp
->pc_chownrestricted
) ? "chownres" : "",
1536 GET_BE_U_4(spp
->pc_caseinsensitive
) ? "igncase" : "",
1537 GET_BE_U_4(spp
->pc_casepreserving
) ? "keepcase" : "");
1544 interp_reply(netdissect_options
*ndo
,
1545 const struct sunrpc_msg
*rp
, uint32_t proc
, uint32_t vers
,
1553 v3
= (vers
== NFS_VER3
);
1555 if (!v3
&& proc
< NFS_NPROCS
)
1556 proc
= nfsv3_procid
[proc
];
1558 ND_PRINT(" %s", tok2str(nfsproc_str
, "proc-%u", proc
));
1561 case NFSPROC_GETATTR
:
1562 dp
= parserep(ndo
, rp
, length
, &nfserr
);
1565 if (parseattrstat(ndo
, dp
, !ndo
->ndo_qflag
, v3
, &nfserr
) == 0)
1569 case NFSPROC_SETATTR
:
1570 dp
= parserep(ndo
, rp
, length
, &nfserr
);
1574 if (parsewccres(ndo
, dp
, ndo
->ndo_vflag
, &nfserr
) == 0)
1577 if (parseattrstat(ndo
, dp
, !ndo
->ndo_qflag
, 0, &nfserr
) == 0)
1582 case NFSPROC_LOOKUP
:
1583 dp
= parserep(ndo
, rp
, length
, &nfserr
);
1587 dp
= parsestatus(ndo
, dp
, &er
, &nfserr
);
1591 if (ndo
->ndo_vflag
> 1) {
1592 ND_PRINT(" post dattr:");
1593 dp
= parse_post_op_attr(ndo
, dp
, ndo
->ndo_vflag
);
1598 dp
= parsefh(ndo
, dp
, v3
);
1601 dp
= parse_post_op_attr(ndo
, dp
, ndo
->ndo_vflag
);
1604 if (ndo
->ndo_vflag
> 1) {
1605 ND_PRINT(" post dattr:");
1606 dp
= parse_post_op_attr(ndo
, dp
, ndo
->ndo_vflag
);
1612 if (parsediropres(ndo
, dp
, &nfserr
) == 0)
1617 case NFSPROC_ACCESS
:
1618 dp
= parserep(ndo
, rp
, length
, &nfserr
);
1621 dp
= parsestatus(ndo
, dp
, &er
, &nfserr
);
1626 dp
= parse_post_op_attr(ndo
, dp
, ndo
->ndo_vflag
);
1630 ND_PRINT(" c %04x", GET_BE_U_4(dp
));
1634 case NFSPROC_READLINK
:
1635 dp
= parserep(ndo
, rp
, length
, &nfserr
);
1638 if (parselinkres(ndo
, dp
, v3
, &nfserr
) == 0)
1643 dp
= parserep(ndo
, rp
, length
, &nfserr
);
1647 dp
= parsestatus(ndo
, dp
, &er
, &nfserr
);
1650 dp
= parse_post_op_attr(ndo
, dp
, ndo
->ndo_vflag
);
1654 if (ndo
->ndo_vflag
) {
1655 ND_PRINT(" %u bytes", GET_BE_U_4(dp
));
1656 if (GET_BE_U_4(dp
+ 1))
1661 if (parseattrstat(ndo
, dp
, ndo
->ndo_vflag
, 0, &nfserr
) == 0)
1667 dp
= parserep(ndo
, rp
, length
, &nfserr
);
1671 dp
= parsestatus(ndo
, dp
, &er
, &nfserr
);
1674 dp
= parse_wcc_data(ndo
, dp
, ndo
->ndo_vflag
);
1678 if (ndo
->ndo_vflag
) {
1679 ND_PRINT(" %u bytes", GET_BE_U_4(dp
));
1680 if (ndo
->ndo_vflag
> 1) {
1682 tok2str(nfsv3_writemodes
,
1683 NULL
, GET_BE_U_4(dp
+ 1)));
1685 /* write-verf-cookie */
1686 ND_PRINT(" verf %" PRIx64
,
1687 GET_BE_U_8(dp
+ 2));
1693 if (parseattrstat(ndo
, dp
, ndo
->ndo_vflag
, v3
, &nfserr
) == 0)
1698 case NFSPROC_CREATE
:
1700 dp
= parserep(ndo
, rp
, length
, &nfserr
);
1704 if (parsecreateopres(ndo
, dp
, ndo
->ndo_vflag
, &nfserr
) == NULL
)
1707 if (parsediropres(ndo
, dp
, &nfserr
) == 0)
1712 case NFSPROC_SYMLINK
:
1713 dp
= parserep(ndo
, rp
, length
, &nfserr
);
1717 if (parsecreateopres(ndo
, dp
, ndo
->ndo_vflag
, &nfserr
) == NULL
)
1720 if (parsestatus(ndo
, dp
, &er
, &nfserr
) == NULL
)
1726 dp
= parserep(ndo
, rp
, length
, &nfserr
);
1729 if (parsecreateopres(ndo
, dp
, ndo
->ndo_vflag
, &nfserr
) == NULL
)
1733 case NFSPROC_REMOVE
:
1735 dp
= parserep(ndo
, rp
, length
, &nfserr
);
1739 if (parsewccres(ndo
, dp
, ndo
->ndo_vflag
, &nfserr
) == NULL
)
1742 if (parsestatus(ndo
, dp
, &er
, &nfserr
) == NULL
)
1747 case NFSPROC_RENAME
:
1748 dp
= parserep(ndo
, rp
, length
, &nfserr
);
1752 dp
= parsestatus(ndo
, dp
, &er
, &nfserr
);
1755 if (ndo
->ndo_vflag
) {
1757 dp
= parse_wcc_data(ndo
, dp
, ndo
->ndo_vflag
);
1761 dp
= parse_wcc_data(ndo
, dp
, ndo
->ndo_vflag
);
1766 if (parsestatus(ndo
, dp
, &er
, &nfserr
) == NULL
)
1772 dp
= parserep(ndo
, rp
, length
, &nfserr
);
1776 dp
= parsestatus(ndo
, dp
, &er
, &nfserr
);
1779 if (ndo
->ndo_vflag
) {
1780 ND_PRINT(" file POST:");
1781 dp
= parse_post_op_attr(ndo
, dp
, ndo
->ndo_vflag
);
1785 dp
= parse_wcc_data(ndo
, dp
, ndo
->ndo_vflag
);
1791 if (parsestatus(ndo
, dp
, &er
, &nfserr
) == NULL
)
1796 case NFSPROC_READDIR
:
1797 dp
= parserep(ndo
, rp
, length
, &nfserr
);
1801 if (parsev3rddirres(ndo
, dp
, ndo
->ndo_vflag
, &nfserr
) == NULL
)
1804 if (parserddires(ndo
, dp
, &nfserr
) == 0)
1809 case NFSPROC_READDIRPLUS
:
1810 dp
= parserep(ndo
, rp
, length
, &nfserr
);
1813 if (parsev3rddirres(ndo
, dp
, ndo
->ndo_vflag
, &nfserr
) == NULL
)
1817 case NFSPROC_FSSTAT
:
1818 dp
= parserep(ndo
, rp
, length
, &nfserr
);
1821 if (parsestatfs(ndo
, dp
, v3
, &nfserr
) == 0)
1825 case NFSPROC_FSINFO
:
1826 dp
= parserep(ndo
, rp
, length
, &nfserr
);
1829 if (parsefsinfo(ndo
, dp
, &nfserr
) == 0)
1833 case NFSPROC_PATHCONF
:
1834 dp
= parserep(ndo
, rp
, length
, &nfserr
);
1837 if (parsepathconf(ndo
, dp
, &nfserr
) == 0)
1841 case NFSPROC_COMMIT
:
1842 dp
= parserep(ndo
, rp
, length
, &nfserr
);
1845 dp
= parsewccres(ndo
, dp
, ndo
->ndo_vflag
, &nfserr
);
1848 if (ndo
->ndo_vflag
> 1) {
1849 /* write-verf-cookie */
1850 ND_PRINT(" verf %" PRIx64
, GET_BE_U_8(dp
));
1861 nd_print_trunc(ndo
);