]>
The Tcpdump Group git mirrors - tcpdump/blob - print-nfs.c
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
) {
294 sa3
->sa_atime
.nfsv3_sec
= GET_BE_U_4(dp
);
296 sa3
->sa_atime
.nfsv3_nsec
= GET_BE_U_4(dp
);
300 sa3
->sa_mtimetype
= GET_BE_U_4(dp
);
302 if (sa3
->sa_mtimetype
== NFSV3SATTRTIME_TOCLIENT
) {
303 sa3
->sa_mtime
.nfsv3_sec
= GET_BE_U_4(dp
);
305 sa3
->sa_mtime
.nfsv3_nsec
= GET_BE_U_4(dp
);
313 print_sattr3(netdissect_options
*ndo
,
314 const struct nfsv3_sattr
*sa3
, int verbose
)
317 ND_PRINT(" mode %o", sa3
->sa_mode
);
319 ND_PRINT(" uid %u", sa3
->sa_uid
);
321 ND_PRINT(" gid %u", sa3
->sa_gid
);
323 if (sa3
->sa_atimetype
== NFSV3SATTRTIME_TOCLIENT
)
324 ND_PRINT(" atime %u.%06u", sa3
->sa_atime
.nfsv3_sec
,
325 sa3
->sa_atime
.nfsv3_nsec
);
326 if (sa3
->sa_mtimetype
== NFSV3SATTRTIME_TOCLIENT
)
327 ND_PRINT(" mtime %u.%06u", sa3
->sa_mtime
.nfsv3_sec
,
328 sa3
->sa_mtime
.nfsv3_nsec
);
333 nfsreply_print(netdissect_options
*ndo
,
334 const u_char
*bp
, u_int length
,
337 const struct sunrpc_msg
*rp
;
338 char srcid
[20], dstid
[20]; /*fits 32bit*/
340 ndo
->ndo_protocol
= "nfs";
341 rp
= (const struct sunrpc_msg
*)bp
;
343 ND_TCHECK_4(rp
->rm_xid
);
344 if (!ndo
->ndo_nflag
) {
345 strlcpy(srcid
, "nfs", sizeof(srcid
));
346 snprintf(dstid
, sizeof(dstid
), "%u",
347 GET_BE_U_4(rp
->rm_xid
));
349 snprintf(srcid
, sizeof(srcid
), "%u", NFS_PORT
);
350 snprintf(dstid
, sizeof(dstid
), "%u",
351 GET_BE_U_4(rp
->rm_xid
));
353 print_nfsaddr(ndo
, bp2
, srcid
, dstid
);
355 nfsreply_noaddr_print(ndo
, bp
, length
, bp2
);
363 nfsreply_noaddr_print(netdissect_options
*ndo
,
364 const u_char
*bp
, u_int length
,
367 const struct sunrpc_msg
*rp
;
368 uint32_t proc
, vers
, reply_stat
;
369 enum sunrpc_reject_stat rstat
;
372 enum sunrpc_auth_stat rwhy
;
374 ndo
->ndo_protocol
= "nfs";
375 rp
= (const struct sunrpc_msg
*)bp
;
377 ND_TCHECK_4(rp
->rm_reply
.rp_stat
);
378 reply_stat
= GET_BE_U_4(&rp
->rm_reply
.rp_stat
);
379 switch (reply_stat
) {
381 case SUNRPC_MSG_ACCEPTED
:
382 ND_PRINT("reply ok %u", length
);
383 if (xid_map_find(ndo
, rp
, bp2
, &proc
, &vers
) >= 0)
384 interp_reply(ndo
, rp
, proc
, vers
, length
);
387 case SUNRPC_MSG_DENIED
:
388 ND_PRINT("reply ERR %u: ", length
);
389 ND_TCHECK_4(rp
->rm_reply
.rp_reject
.rj_stat
);
390 rstat
= GET_BE_U_4(&rp
->rm_reply
.rp_reject
.rj_stat
);
393 case SUNRPC_RPC_MISMATCH
:
394 ND_TCHECK_4(rp
->rm_reply
.rp_reject
.rj_vers
.high
);
395 rlow
= GET_BE_U_4(&rp
->rm_reply
.rp_reject
.rj_vers
.low
);
396 rhigh
= GET_BE_U_4(&rp
->rm_reply
.rp_reject
.rj_vers
.high
);
397 ND_PRINT("RPC Version mismatch (%u-%u)", rlow
, rhigh
);
400 case SUNRPC_AUTH_ERROR
:
401 ND_TCHECK_4(rp
->rm_reply
.rp_reject
.rj_why
);
402 rwhy
= GET_BE_U_4(&rp
->rm_reply
.rp_reject
.rj_why
);
403 ND_PRINT("Auth %s", tok2str(sunrpc_auth_str
, "Invalid failure code %u", rwhy
));
407 ND_PRINT("Unknown reason for rejecting rpc message %u", (unsigned int)rstat
);
413 ND_PRINT("reply Unknown rpc response code=%u %u", reply_stat
, length
);
423 * Return a pointer to the first file handle in the packet.
424 * If the packet was truncated, return 0.
426 static const uint32_t *
427 parsereq(netdissect_options
*ndo
,
428 const struct sunrpc_msg
*rp
, u_int length
)
431 u_int len
, rounded_len
;
434 * Find the start of the req data (if we captured it).
435 * First, get the length of the credentials, and make sure
436 * we have all of the opaque part of the credentials.
438 dp
= (const uint32_t *)&rp
->rm_call
.cb_cred
;
439 if (length
< 2 * sizeof(*dp
))
441 len
= GET_BE_U_4(dp
+ 1);
442 rounded_len
= roundup2(len
, 4);
443 ND_TCHECK_LEN(dp
+ 2, rounded_len
);
444 if (2 * sizeof(*dp
) + rounded_len
<= length
) {
446 * We have all of the credentials. Skip past them; they
447 * consist of 4 bytes of flavor, 4 bytes of length,
448 * and len-rounded-up-to-a-multiple-of-4 bytes of
451 dp
+= (len
+ (2 * sizeof(*dp
) + 3)) / sizeof(*dp
);
452 length
-= 2 * sizeof(*dp
) + rounded_len
;
455 * Now get the length of the verifier, and make sure
456 * we have all of the opaque part of the verifier.
458 if (length
< 2 * sizeof(*dp
))
460 len
= GET_BE_U_4(dp
+ 1);
461 rounded_len
= roundup2(len
, 4);
462 ND_TCHECK_LEN(dp
+ 2, rounded_len
);
463 if (2 * sizeof(*dp
) + rounded_len
< length
) {
465 * We have all of the verifier. Skip past it;
466 * it consists of 4 bytes of flavor, 4 bytes of
467 * length, and len-rounded-up-to-a-multiple-of-4
470 dp
+= (len
+ (2 * sizeof(*dp
) + 3)) / sizeof(*dp
);
479 * Print out an NFS file handle and return a pointer to following word.
480 * If packet was truncated, return 0.
482 static const uint32_t *
483 parsefh(netdissect_options
*ndo
,
484 const uint32_t *dp
, int v3
)
489 len
= GET_BE_U_4(dp
) / 4;
494 if (ND_TTEST_LEN(dp
, len
* sizeof(*dp
))) {
495 nfs_printfh(ndo
, dp
, len
);
502 * Print out a file name and return pointer to 32-bit word past it.
503 * If packet was truncated, return 0.
505 static const uint32_t *
506 parsefn(netdissect_options
*ndo
,
509 uint32_t len
, rounded_len
;
512 /* Fetch big-endian string length */
513 len
= GET_BE_U_4(dp
);
516 if (UINT_MAX
- len
< 3) {
517 ND_PRINT("[cannot pad to 32-bit boundaries]");
518 nd_print_invalid(ndo
);
522 rounded_len
= roundup2(len
, 4);
523 ND_TCHECK_LEN(dp
, rounded_len
);
525 cp
= (const u_char
*)dp
;
526 /* Update 32-bit pointer (NFS filenames padded to 32-bit boundaries) */
527 dp
+= rounded_len
/ sizeof(*dp
);
529 if (nd_printn(ndo
, cp
, len
, ndo
->ndo_snapend
)) {
541 * Print out file handle and file name.
542 * Return pointer to 32-bit word past file name.
543 * If packet was truncated (or there was some other error), return 0.
545 static const uint32_t *
546 parsefhn(netdissect_options
*ndo
,
547 const uint32_t *dp
, int v3
)
549 dp
= parsefh(ndo
, dp
, v3
);
553 return (parsefn(ndo
, dp
));
557 nfsreq_noaddr_print(netdissect_options
*ndo
,
558 const u_char
*bp
, u_int length
,
561 const struct sunrpc_msg
*rp
;
566 uint32_t access_flags
;
567 struct nfsv3_sattr sa3
;
569 ndo
->ndo_protocol
= "nfs";
570 ND_PRINT("%u", length
);
571 rp
= (const struct sunrpc_msg
*)bp
;
573 if (!xid_map_enter(ndo
, rp
, bp2
)) /* record proc number for later on */
576 v3
= (GET_BE_U_4(&rp
->rm_call
.cb_vers
) == NFS_VER3
);
577 proc
= GET_BE_U_4(&rp
->rm_call
.cb_proc
);
579 if (!v3
&& proc
< NFS_NPROCS
)
580 proc
= nfsv3_procid
[proc
];
582 ND_PRINT(" %s", tok2str(nfsproc_str
, "proc-%u", proc
));
585 case NFSPROC_GETATTR
:
586 case NFSPROC_SETATTR
:
587 case NFSPROC_READLINK
:
590 case NFSPROC_PATHCONF
:
591 dp
= parsereq(ndo
, rp
, length
);
594 if (parsefh(ndo
, dp
, v3
) == NULL
)
603 dp
= parsereq(ndo
, rp
, length
);
606 if (parsefhn(ndo
, dp
, v3
) == NULL
)
611 dp
= parsereq(ndo
, rp
, length
);
614 dp
= parsefh(ndo
, dp
, v3
);
617 access_flags
= GET_BE_U_4(dp
);
618 if (access_flags
& ~NFSV3ACCESS_FULL
) {
619 /* NFSV3ACCESS definitions aren't up to date */
620 ND_PRINT(" %04x", access_flags
);
621 } else if ((access_flags
& NFSV3ACCESS_FULL
) == NFSV3ACCESS_FULL
) {
622 ND_PRINT(" NFS_ACCESS_FULL");
624 char separator
= ' ';
625 if (access_flags
& NFSV3ACCESS_READ
) {
626 ND_PRINT(" NFS_ACCESS_READ");
629 if (access_flags
& NFSV3ACCESS_LOOKUP
) {
630 ND_PRINT("%cNFS_ACCESS_LOOKUP", separator
);
633 if (access_flags
& NFSV3ACCESS_MODIFY
) {
634 ND_PRINT("%cNFS_ACCESS_MODIFY", separator
);
637 if (access_flags
& NFSV3ACCESS_EXTEND
) {
638 ND_PRINT("%cNFS_ACCESS_EXTEND", separator
);
641 if (access_flags
& NFSV3ACCESS_DELETE
) {
642 ND_PRINT("%cNFS_ACCESS_DELETE", separator
);
645 if (access_flags
& NFSV3ACCESS_EXECUTE
)
646 ND_PRINT("%cNFS_ACCESS_EXECUTE", separator
);
651 dp
= parsereq(ndo
, rp
, length
);
654 dp
= parsefh(ndo
, dp
, v3
);
658 ND_PRINT(" %u bytes @ %" PRIu64
,
662 ND_PRINT(" %u bytes @ %u",
669 dp
= parsereq(ndo
, rp
, length
);
672 dp
= parsefh(ndo
, dp
, v3
);
676 ND_PRINT(" %u (%u) bytes @ %" PRIu64
,
680 if (ndo
->ndo_vflag
) {
682 tok2str(nfsv3_writemodes
,
683 NULL
, GET_BE_U_4(dp
+ 3)));
686 ND_PRINT(" %u (%u) bytes @ %u (%u)",
694 case NFSPROC_SYMLINK
:
695 dp
= parsereq(ndo
, rp
, length
);
698 dp
= parsefhn(ndo
, dp
, v3
);
702 if (v3
&& (dp
= parse_sattr3(ndo
, dp
, &sa3
)) == NULL
)
704 if (parsefn(ndo
, dp
) == NULL
)
706 if (v3
&& ndo
->ndo_vflag
)
707 print_sattr3(ndo
, &sa3
, ndo
->ndo_vflag
);
711 dp
= parsereq(ndo
, rp
, length
);
714 dp
= parsefhn(ndo
, dp
, v3
);
717 type
= (nfs_type
) GET_BE_U_4(dp
);
719 dp
= parse_sattr3(ndo
, dp
, &sa3
);
722 ND_PRINT(" %s", tok2str(type2str
, "unk-ft %u", type
));
723 if (ndo
->ndo_vflag
&& (type
== NFCHR
|| type
== NFBLK
)) {
730 print_sattr3(ndo
, &sa3
, ndo
->ndo_vflag
);
734 dp
= parsereq(ndo
, rp
, length
);
737 dp
= parsefhn(ndo
, dp
, v3
);
741 if (parsefhn(ndo
, dp
, v3
) == NULL
)
746 dp
= parsereq(ndo
, rp
, length
);
749 dp
= parsefh(ndo
, dp
, v3
);
753 if (parsefhn(ndo
, dp
, v3
) == NULL
)
757 case NFSPROC_READDIR
:
758 dp
= parsereq(ndo
, rp
, length
);
761 dp
= parsefh(ndo
, dp
, v3
);
766 * We shouldn't really try to interpret the
767 * offset cookie here.
769 ND_PRINT(" %u bytes @ %" PRId64
,
772 if (ndo
->ndo_vflag
) {
774 * This displays the 8 bytes
775 * of the verifier in order,
776 * from the low-order byte
777 * to the high-order byte.
779 ND_PRINT(" verf %08x%08x",
785 * Print the offset as signed, since -1 is
786 * common, but offsets > 2^31 aren't.
788 ND_PRINT(" %u bytes @ %u",
794 case NFSPROC_READDIRPLUS
:
795 dp
= parsereq(ndo
, rp
, length
);
798 dp
= parsefh(ndo
, dp
, v3
);
802 * We don't try to interpret the offset
805 ND_PRINT(" %u bytes @ %" PRId64
,
808 if (ndo
->ndo_vflag
) {
810 * This displays the 8 bytes
811 * of the verifier in order,
812 * from the low-order byte
813 * to the high-order byte.
815 ND_PRINT(" max %u verf %08x%08x",
823 dp
= parsereq(ndo
, rp
, length
);
826 dp
= parsefh(ndo
, dp
, v3
);
829 ND_PRINT(" %u bytes @ %" PRIu64
,
844 * Print out an NFS file handle.
845 * We assume packet was not truncated before the end of the
846 * file handle pointed to by dp.
848 * Note: new version (using portable file-handle parser) doesn't produce
849 * generation number. It probably could be made to do that, with some
850 * additional hacking on the parser code.
853 nfs_printfh(netdissect_options
*ndo
,
854 const uint32_t *dp
, const u_int len
)
858 const char *sfsname
= NULL
;
861 if (ndo
->ndo_uflag
) {
863 char const *sep
= "";
866 for (i
=0; i
<len
; i
++) {
868 * This displays 4 bytes in big-endian byte
869 * order. That's as good a choice as little-
870 * endian, as there's no guarantee that the
871 * server is big-endian or little-endian or
872 * that the file handle contains 4-byte
873 * integral fields, and is better than "the
874 * byte order of the host running tcpdump", as
875 * the latter means that different hosts
876 * running tcpdump may show the same file
877 * handle in different ways.
879 ND_PRINT("%s%x", sep
, GET_BE_U_4(dp
+ i
));
886 Parse_fh(ndo
, (const u_char
*)dp
, len
, &fsid
, &ino
, NULL
, &sfsname
, 0);
889 /* file system ID is ASCII, not numeric, for this server OS */
890 char temp
[NFSX_V3FHMAX
+1];
893 /* Make sure string is null-terminated */
895 if (stringlen
> NFSX_V3FHMAX
)
896 stringlen
= NFSX_V3FHMAX
;
897 strncpy(temp
, sfsname
, stringlen
);
898 temp
[stringlen
] = '\0';
899 /* Remove trailing spaces */
900 spacep
= strchr(temp
, ' ');
904 ND_PRINT(" fh %s/", temp
);
906 ND_PRINT(" fh %u,%u/",
907 fsid
.Fsid_dev
.Major
, fsid
.Fsid_dev
.Minor
);
910 if(fsid
.Fsid_dev
.Minor
== 257)
911 /* Print the undecoded handle */
912 ND_PRINT("%s", fsid
.Opaque_Handle
);
914 ND_PRINT("%ld", (long) ino
);
918 * Maintain a small cache of recent client.XID.server/proc pairs, to allow
919 * us to match up replies with requests and thus to know how to parse
923 struct xid_map_entry
{
924 uint32_t xid
; /* transaction ID (net order) */
925 int ipver
; /* IP version (4 or 6) */
926 nd_ipv6 client
; /* client IP address (net order) */
927 nd_ipv6 server
; /* server IP address (net order) */
928 uint32_t proc
; /* call proc number (host order) */
929 uint32_t vers
; /* program version (host order) */
933 * Map entries are kept in an array that we manage as a ring;
934 * new entries are always added at the tail of the ring. Initially,
935 * all the entries are zero and hence don't match anything.
938 #define XIDMAPSIZE 64
940 static struct xid_map_entry xid_map
[XIDMAPSIZE
];
942 static int xid_map_next
= 0;
943 static int xid_map_hint
= 0;
946 xid_map_enter(netdissect_options
*ndo
,
947 const struct sunrpc_msg
*rp
, const u_char
*bp
)
949 const struct ip
*ip
= NULL
;
950 const struct ip6_hdr
*ip6
= NULL
;
951 struct xid_map_entry
*xmep
;
953 if (!ND_TTEST_4(rp
->rm_call
.cb_proc
))
955 switch (IP_V((const struct ip
*)bp
)) {
957 ip
= (const struct ip
*)bp
;
960 ip6
= (const struct ip6_hdr
*)bp
;
966 xmep
= &xid_map
[xid_map_next
];
968 if (++xid_map_next
>= XIDMAPSIZE
)
971 UNALIGNED_MEMCPY(&xmep
->xid
, &rp
->rm_xid
, sizeof(xmep
->xid
));
974 UNALIGNED_MEMCPY(&xmep
->client
, ip
->ip_src
,
976 UNALIGNED_MEMCPY(&xmep
->server
, ip
->ip_dst
,
981 UNALIGNED_MEMCPY(&xmep
->client
, ip6
->ip6_src
,
982 sizeof(ip6
->ip6_src
));
983 UNALIGNED_MEMCPY(&xmep
->server
, ip6
->ip6_dst
,
984 sizeof(ip6
->ip6_dst
));
986 xmep
->proc
= GET_BE_U_4(&rp
->rm_call
.cb_proc
);
987 xmep
->vers
= GET_BE_U_4(&rp
->rm_call
.cb_vers
);
992 * Returns 0 and puts NFSPROC_xxx in proc return and
993 * version in vers return, or returns -1 on failure
996 xid_map_find(netdissect_options
*ndo
, const struct sunrpc_msg
*rp
,
997 const u_char
*bp
, uint32_t *proc
, uint32_t *vers
)
1000 struct xid_map_entry
*xmep
;
1002 const struct ip
*ip
= (const struct ip
*)bp
;
1003 const struct ip6_hdr
*ip6
= (const struct ip6_hdr
*)bp
;
1006 UNALIGNED_MEMCPY(&xid
, &rp
->rm_xid
, sizeof(xmep
->xid
));
1007 /* Start searching from where we last left off */
1012 if (xmep
->ipver
!= IP_V(ip
) || xmep
->xid
!= xid
)
1014 switch (xmep
->ipver
) {
1016 if (UNALIGNED_MEMCMP(ip
->ip_src
, &xmep
->server
,
1017 sizeof(ip
->ip_src
)) != 0 ||
1018 UNALIGNED_MEMCMP(ip
->ip_dst
, &xmep
->client
,
1019 sizeof(ip
->ip_dst
)) != 0) {
1024 if (UNALIGNED_MEMCMP(ip6
->ip6_src
, &xmep
->server
,
1025 sizeof(ip6
->ip6_src
)) != 0 ||
1026 UNALIGNED_MEMCMP(ip6
->ip6_dst
, &xmep
->client
,
1027 sizeof(ip6
->ip6_dst
)) != 0) {
1043 if (++i
>= XIDMAPSIZE
)
1045 } while (i
!= xid_map_hint
);
1052 * Routines for parsing reply packets
1056 * Return a pointer to the beginning of the actual results.
1057 * If the packet was truncated, return 0.
1059 static const uint32_t *
1060 parserep(netdissect_options
*ndo
,
1061 const struct sunrpc_msg
*rp
, u_int length
, int *nfserrp
)
1065 enum sunrpc_accept_stat astat
;
1069 * Here we find the address of the ar_verf credentials.
1070 * Originally, this calculation was
1071 * dp = (uint32_t *)&rp->rm_reply.rp_acpt.ar_verf
1072 * On the wire, the rp_acpt field starts immediately after
1073 * the (32 bit) rp_stat field. However, rp_acpt (which is a
1074 * "struct accepted_reply") contains a "struct opaque_auth",
1075 * whose internal representation contains a pointer, so on a
1076 * 64-bit machine the compiler inserts 32 bits of padding
1077 * before rp->rm_reply.rp_acpt.ar_verf. So, we cannot use
1078 * the internal representation to parse the on-the-wire
1079 * representation. Instead, we skip past the rp_stat field,
1080 * which is an "enum" and so occupies one 32-bit word.
1082 dp
= ((const uint32_t *)&rp
->rm_reply
) + 1;
1083 len
= GET_BE_U_4(dp
+ 1);
1087 * skip past the ar_verf credentials.
1089 dp
+= (len
+ (2*sizeof(uint32_t) + 3)) / sizeof(uint32_t);
1092 * now we can check the ar_stat field
1094 astat
= (enum sunrpc_accept_stat
) GET_BE_U_4(dp
);
1095 if (astat
!= SUNRPC_SUCCESS
) {
1096 ND_PRINT(" %s", tok2str(sunrpc_str
, "ar_stat %u", astat
));
1097 *nfserrp
= 1; /* suppress trunc string */
1100 /* successful return */
1101 ND_TCHECK_LEN(dp
, sizeof(astat
));
1102 return ((const uint32_t *) (sizeof(astat
) + ((const char *)dp
)));
1107 static const uint32_t *
1108 parsestatus(netdissect_options
*ndo
,
1109 const uint32_t *dp
, u_int
*er
, int *nfserrp
)
1113 errnum
= GET_BE_U_4(dp
);
1117 if (!ndo
->ndo_qflag
)
1118 ND_PRINT(" ERROR: %s",
1119 tok2str(status2str
, "unk %u", errnum
));
1125 static const uint32_t *
1126 parsefattr(netdissect_options
*ndo
,
1127 const uint32_t *dp
, int verbose
, int v3
)
1129 const struct nfs_fattr
*fap
;
1131 fap
= (const struct nfs_fattr
*)dp
;
1132 ND_TCHECK_4(fap
->fa_gid
);
1135 * XXX - UIDs and GIDs are unsigned in NFS and in
1136 * at least some UN*Xes, but we'll show them as
1137 * signed because -2 has traditionally been the
1138 * UID for "nobody", rather than 4294967294.
1140 ND_PRINT(" %s %o ids %d/%d",
1141 tok2str(type2str
, "unk-ft %u ",
1142 GET_BE_U_4(fap
->fa_type
)),
1143 GET_BE_U_4(fap
->fa_mode
),
1144 GET_BE_S_4(fap
->fa_uid
),
1145 GET_BE_S_4(fap
->fa_gid
));
1147 ND_PRINT(" sz %" PRIu64
,
1148 GET_BE_U_8(fap
->fa3_size
));
1150 ND_PRINT(" sz %u", GET_BE_U_4(fap
->fa2_size
));
1153 /* print lots more stuff */
1156 ND_TCHECK_8(&fap
->fa3_ctime
);
1157 ND_PRINT(" nlink %u rdev %u/%u",
1158 GET_BE_U_4(fap
->fa_nlink
),
1159 GET_BE_U_4(fap
->fa3_rdev
.specdata1
),
1160 GET_BE_U_4(fap
->fa3_rdev
.specdata2
));
1161 ND_PRINT(" fsid %" PRIx64
,
1162 GET_BE_U_8(fap
->fa3_fsid
));
1163 ND_PRINT(" fileid %" PRIx64
,
1164 GET_BE_U_8(fap
->fa3_fileid
));
1165 ND_PRINT(" a/m/ctime %u.%06u",
1166 GET_BE_U_4(fap
->fa3_atime
.nfsv3_sec
),
1167 GET_BE_U_4(fap
->fa3_atime
.nfsv3_nsec
));
1168 ND_PRINT(" %u.%06u",
1169 GET_BE_U_4(fap
->fa3_mtime
.nfsv3_sec
),
1170 GET_BE_U_4(fap
->fa3_mtime
.nfsv3_nsec
));
1171 ND_PRINT(" %u.%06u",
1172 GET_BE_U_4(fap
->fa3_ctime
.nfsv3_sec
),
1173 GET_BE_U_4(fap
->fa3_ctime
.nfsv3_nsec
));
1175 ND_TCHECK_8(&fap
->fa2_ctime
);
1176 ND_PRINT(" nlink %u rdev 0x%x fsid 0x%x nodeid 0x%x a/m/ctime",
1177 GET_BE_U_4(fap
->fa_nlink
),
1178 GET_BE_U_4(fap
->fa2_rdev
),
1179 GET_BE_U_4(fap
->fa2_fsid
),
1180 GET_BE_U_4(fap
->fa2_fileid
));
1181 ND_PRINT(" %u.%06u",
1182 GET_BE_U_4(fap
->fa2_atime
.nfsv2_sec
),
1183 GET_BE_U_4(fap
->fa2_atime
.nfsv2_usec
));
1184 ND_PRINT(" %u.%06u",
1185 GET_BE_U_4(fap
->fa2_mtime
.nfsv2_sec
),
1186 GET_BE_U_4(fap
->fa2_mtime
.nfsv2_usec
));
1187 ND_PRINT(" %u.%06u",
1188 GET_BE_U_4(fap
->fa2_ctime
.nfsv2_sec
),
1189 GET_BE_U_4(fap
->fa2_ctime
.nfsv2_usec
));
1192 return ((const uint32_t *)((const unsigned char *)dp
+
1193 (v3
? NFSX_V3FATTR
: NFSX_V2FATTR
)));
1199 parseattrstat(netdissect_options
*ndo
,
1200 const uint32_t *dp
, int verbose
, int v3
, int *nfserrp
)
1204 dp
= parsestatus(ndo
, dp
, &er
, nfserrp
);
1210 return (parsefattr(ndo
, dp
, verbose
, v3
) != NULL
);
1214 parsediropres(netdissect_options
*ndo
,
1215 const uint32_t *dp
, int *nfserrp
)
1219 dp
= parsestatus(ndo
, dp
, &er
, nfserrp
);
1225 dp
= parsefh(ndo
, dp
, 0);
1229 return (parsefattr(ndo
, dp
, ndo
->ndo_vflag
, 0) != NULL
);
1233 parselinkres(netdissect_options
*ndo
,
1234 const uint32_t *dp
, int v3
, int *nfserrp
)
1238 dp
= parsestatus(ndo
, dp
, &er
, nfserrp
);
1244 dp
= parse_post_op_attr(ndo
, dp
, ndo
->ndo_vflag
);
1249 return (parsefn(ndo
, dp
) != NULL
);
1253 parsestatfs(netdissect_options
*ndo
,
1254 const uint32_t *dp
, int v3
, int *nfserrp
)
1256 const struct nfs_statfs
*sfsp
;
1259 dp
= parsestatus(ndo
, dp
, &er
, nfserrp
);
1271 dp
= parse_post_op_attr(ndo
, dp
, ndo
->ndo_vflag
);
1276 ND_TCHECK_LEN(dp
, (v3
? NFSX_V3STATFS
: NFSX_V2STATFS
));
1278 sfsp
= (const struct nfs_statfs
*)dp
;
1281 ND_PRINT(" tbytes %" PRIu64
" fbytes %" PRIu64
" abytes %" PRIu64
,
1282 GET_BE_U_8(sfsp
->sf_tbytes
),
1283 GET_BE_U_8(sfsp
->sf_fbytes
),
1284 GET_BE_U_8(sfsp
->sf_abytes
));
1285 if (ndo
->ndo_vflag
) {
1286 ND_PRINT(" tfiles %" PRIu64
" ffiles %" PRIu64
" afiles %" PRIu64
" invar %u",
1287 GET_BE_U_8(sfsp
->sf_tfiles
),
1288 GET_BE_U_8(sfsp
->sf_ffiles
),
1289 GET_BE_U_8(sfsp
->sf_afiles
),
1290 GET_BE_U_4(sfsp
->sf_invarsec
));
1293 ND_PRINT(" tsize %u bsize %u blocks %u bfree %u bavail %u",
1294 GET_BE_U_4(sfsp
->sf_tsize
),
1295 GET_BE_U_4(sfsp
->sf_bsize
),
1296 GET_BE_U_4(sfsp
->sf_blocks
),
1297 GET_BE_U_4(sfsp
->sf_bfree
),
1298 GET_BE_U_4(sfsp
->sf_bavail
));
1307 parserddires(netdissect_options
*ndo
,
1308 const uint32_t *dp
, int *nfserrp
)
1312 dp
= parsestatus(ndo
, dp
, &er
, nfserrp
);
1320 ND_TCHECK_4(dp
+ 2);
1321 ND_PRINT(" offset 0x%x size %u ",
1322 GET_BE_U_4(dp
), GET_BE_U_4(dp
+ 1));
1323 if (GET_BE_U_4(dp
+ 2) != 0)
1331 static const uint32_t *
1332 parse_wcc_attr(netdissect_options
*ndo
,
1335 /* Our caller has already checked this */
1336 ND_PRINT(" sz %" PRIu64
, GET_BE_U_8(dp
));
1337 ND_PRINT(" mtime %u.%06u ctime %u.%06u",
1338 GET_BE_U_4(dp
+ 2), GET_BE_U_4(dp
+ 3),
1339 GET_BE_U_4(dp
+ 4), GET_BE_U_4(dp
+ 5));
1344 * Pre operation attributes. Print only if vflag > 1.
1346 static const uint32_t *
1347 parse_pre_op_attr(netdissect_options
*ndo
,
1348 const uint32_t *dp
, int verbose
)
1350 if (!GET_BE_U_4(dp
))
1353 ND_TCHECK_LEN(dp
, 24);
1355 return parse_wcc_attr(ndo
, dp
);
1357 /* If not verbose enough, just skip over wcc_attr */
1365 * Post operation attributes are printed if vflag >= 1
1367 static const uint32_t *
1368 parse_post_op_attr(netdissect_options
*ndo
,
1369 const uint32_t *dp
, int verbose
)
1371 if (!GET_BE_U_4(dp
))
1375 return parsefattr(ndo
, dp
, verbose
, 1);
1377 return (dp
+ (NFSX_V3FATTR
/ sizeof (uint32_t)));
1380 static const uint32_t *
1381 parse_wcc_data(netdissect_options
*ndo
,
1382 const uint32_t *dp
, int verbose
)
1386 dp
= parse_pre_op_attr(ndo
, dp
, verbose
);
1392 return parse_post_op_attr(ndo
, dp
, verbose
);
1395 static const uint32_t *
1396 parsecreateopres(netdissect_options
*ndo
,
1397 const uint32_t *dp
, int verbose
, int *nfserrp
)
1401 dp
= parsestatus(ndo
, dp
, &er
, nfserrp
);
1405 dp
= parse_wcc_data(ndo
, dp
, verbose
);
1407 if (!GET_BE_U_4(dp
))
1410 dp
= parsefh(ndo
, dp
, 1);
1414 dp
= parse_post_op_attr(ndo
, dp
, verbose
);
1417 if (ndo
->ndo_vflag
> 1) {
1418 ND_PRINT(" dir attr:");
1419 dp
= parse_wcc_data(ndo
, dp
, verbose
);
1426 static const uint32_t *
1427 parsewccres(netdissect_options
*ndo
,
1428 const uint32_t *dp
, int verbose
, int *nfserrp
)
1432 dp
= parsestatus(ndo
, dp
, &er
, nfserrp
);
1435 return parse_wcc_data(ndo
, dp
, verbose
);
1438 static const uint32_t *
1439 parsev3rddirres(netdissect_options
*ndo
,
1440 const uint32_t *dp
, int verbose
, int *nfserrp
)
1444 dp
= parsestatus(ndo
, dp
, &er
, nfserrp
);
1449 dp
= parse_post_op_attr(ndo
, dp
, verbose
);
1454 if (ndo
->ndo_vflag
) {
1456 * This displays the 8 bytes of the verifier in order,
1457 * from the low-order byte to the high-order byte.
1459 ND_PRINT(" verf %08x%08x",
1460 GET_BE_U_4(dp
), GET_BE_U_4(dp
+ 1));
1467 parsefsinfo(netdissect_options
*ndo
,
1468 const uint32_t *dp
, int *nfserrp
)
1470 const struct nfsv3_fsinfo
*sfp
;
1473 dp
= parsestatus(ndo
, dp
, &er
, nfserrp
);
1478 dp
= parse_post_op_attr(ndo
, dp
, ndo
->ndo_vflag
);
1484 sfp
= (const struct nfsv3_fsinfo
*)dp
;
1485 ND_TCHECK_SIZE(sfp
);
1486 ND_PRINT(" rtmax %u rtpref %u wtmax %u wtpref %u dtpref %u",
1487 GET_BE_U_4(sfp
->fs_rtmax
),
1488 GET_BE_U_4(sfp
->fs_rtpref
),
1489 GET_BE_U_4(sfp
->fs_wtmax
),
1490 GET_BE_U_4(sfp
->fs_wtpref
),
1491 GET_BE_U_4(sfp
->fs_dtpref
));
1492 if (ndo
->ndo_vflag
) {
1493 ND_PRINT(" rtmult %u wtmult %u maxfsz %" PRIu64
,
1494 GET_BE_U_4(sfp
->fs_rtmult
),
1495 GET_BE_U_4(sfp
->fs_wtmult
),
1496 GET_BE_U_8(sfp
->fs_maxfilesize
));
1497 ND_PRINT(" delta %u.%06u ",
1498 GET_BE_U_4(sfp
->fs_timedelta
.nfsv3_sec
),
1499 GET_BE_U_4(sfp
->fs_timedelta
.nfsv3_nsec
));
1507 parsepathconf(netdissect_options
*ndo
,
1508 const uint32_t *dp
, int *nfserrp
)
1511 const struct nfsv3_pathconf
*spp
;
1513 dp
= parsestatus(ndo
, dp
, &er
, nfserrp
);
1518 dp
= parse_post_op_attr(ndo
, dp
, ndo
->ndo_vflag
);
1524 spp
= (const struct nfsv3_pathconf
*)dp
;
1525 ND_TCHECK_SIZE(spp
);
1527 ND_PRINT(" linkmax %u namemax %u %s %s %s %s",
1528 GET_BE_U_4(spp
->pc_linkmax
),
1529 GET_BE_U_4(spp
->pc_namemax
),
1530 GET_BE_U_4(spp
->pc_notrunc
) ? "notrunc" : "",
1531 GET_BE_U_4(spp
->pc_chownrestricted
) ? "chownres" : "",
1532 GET_BE_U_4(spp
->pc_caseinsensitive
) ? "igncase" : "",
1533 GET_BE_U_4(spp
->pc_casepreserving
) ? "keepcase" : "");
1540 interp_reply(netdissect_options
*ndo
,
1541 const struct sunrpc_msg
*rp
, uint32_t proc
, uint32_t vers
,
1549 v3
= (vers
== NFS_VER3
);
1551 if (!v3
&& proc
< NFS_NPROCS
)
1552 proc
= nfsv3_procid
[proc
];
1554 ND_PRINT(" %s", tok2str(nfsproc_str
, "proc-%u", proc
));
1557 case NFSPROC_GETATTR
:
1558 dp
= parserep(ndo
, rp
, length
, &nfserr
);
1561 if (parseattrstat(ndo
, dp
, !ndo
->ndo_qflag
, v3
, &nfserr
) == 0)
1565 case NFSPROC_SETATTR
:
1566 dp
= parserep(ndo
, rp
, length
, &nfserr
);
1570 if (parsewccres(ndo
, dp
, ndo
->ndo_vflag
, &nfserr
) == 0)
1573 if (parseattrstat(ndo
, dp
, !ndo
->ndo_qflag
, 0, &nfserr
) == 0)
1578 case NFSPROC_LOOKUP
:
1579 dp
= parserep(ndo
, rp
, length
, &nfserr
);
1583 dp
= parsestatus(ndo
, dp
, &er
, &nfserr
);
1587 if (ndo
->ndo_vflag
> 1) {
1588 ND_PRINT(" post dattr:");
1589 dp
= parse_post_op_attr(ndo
, dp
, ndo
->ndo_vflag
);
1594 dp
= parsefh(ndo
, dp
, v3
);
1597 dp
= parse_post_op_attr(ndo
, dp
, ndo
->ndo_vflag
);
1600 if (ndo
->ndo_vflag
> 1) {
1601 ND_PRINT(" post dattr:");
1602 dp
= parse_post_op_attr(ndo
, dp
, ndo
->ndo_vflag
);
1608 if (parsediropres(ndo
, dp
, &nfserr
) == 0)
1613 case NFSPROC_ACCESS
:
1614 dp
= parserep(ndo
, rp
, length
, &nfserr
);
1617 dp
= parsestatus(ndo
, dp
, &er
, &nfserr
);
1622 dp
= parse_post_op_attr(ndo
, dp
, ndo
->ndo_vflag
);
1626 ND_PRINT(" c %04x", GET_BE_U_4(dp
));
1630 case NFSPROC_READLINK
:
1631 dp
= parserep(ndo
, rp
, length
, &nfserr
);
1634 if (parselinkres(ndo
, dp
, v3
, &nfserr
) == 0)
1639 dp
= parserep(ndo
, rp
, length
, &nfserr
);
1643 dp
= parsestatus(ndo
, dp
, &er
, &nfserr
);
1646 dp
= parse_post_op_attr(ndo
, dp
, ndo
->ndo_vflag
);
1650 if (ndo
->ndo_vflag
) {
1651 ND_PRINT(" %u bytes", GET_BE_U_4(dp
));
1652 if (GET_BE_U_4(dp
+ 1))
1657 if (parseattrstat(ndo
, dp
, ndo
->ndo_vflag
, 0, &nfserr
) == 0)
1663 dp
= parserep(ndo
, rp
, length
, &nfserr
);
1667 dp
= parsestatus(ndo
, dp
, &er
, &nfserr
);
1670 dp
= parse_wcc_data(ndo
, dp
, ndo
->ndo_vflag
);
1674 if (ndo
->ndo_vflag
) {
1675 ND_PRINT(" %u bytes", GET_BE_U_4(dp
));
1676 if (ndo
->ndo_vflag
> 1) {
1678 tok2str(nfsv3_writemodes
,
1679 NULL
, GET_BE_U_4(dp
+ 1)));
1681 /* write-verf-cookie */
1682 ND_PRINT(" verf %" PRIx64
,
1683 GET_BE_U_8(dp
+ 2));
1689 if (parseattrstat(ndo
, dp
, ndo
->ndo_vflag
, v3
, &nfserr
) == 0)
1694 case NFSPROC_CREATE
:
1696 dp
= parserep(ndo
, rp
, length
, &nfserr
);
1700 if (parsecreateopres(ndo
, dp
, ndo
->ndo_vflag
, &nfserr
) == NULL
)
1703 if (parsediropres(ndo
, dp
, &nfserr
) == 0)
1708 case NFSPROC_SYMLINK
:
1709 dp
= parserep(ndo
, rp
, length
, &nfserr
);
1713 if (parsecreateopres(ndo
, dp
, ndo
->ndo_vflag
, &nfserr
) == NULL
)
1716 if (parsestatus(ndo
, dp
, &er
, &nfserr
) == NULL
)
1722 dp
= parserep(ndo
, rp
, length
, &nfserr
);
1725 if (parsecreateopres(ndo
, dp
, ndo
->ndo_vflag
, &nfserr
) == NULL
)
1729 case NFSPROC_REMOVE
:
1731 dp
= parserep(ndo
, rp
, length
, &nfserr
);
1735 if (parsewccres(ndo
, dp
, ndo
->ndo_vflag
, &nfserr
) == NULL
)
1738 if (parsestatus(ndo
, dp
, &er
, &nfserr
) == NULL
)
1743 case NFSPROC_RENAME
:
1744 dp
= parserep(ndo
, rp
, length
, &nfserr
);
1748 dp
= parsestatus(ndo
, dp
, &er
, &nfserr
);
1751 if (ndo
->ndo_vflag
) {
1753 dp
= parse_wcc_data(ndo
, dp
, ndo
->ndo_vflag
);
1757 dp
= parse_wcc_data(ndo
, dp
, ndo
->ndo_vflag
);
1762 if (parsestatus(ndo
, dp
, &er
, &nfserr
) == NULL
)
1768 dp
= parserep(ndo
, rp
, length
, &nfserr
);
1772 dp
= parsestatus(ndo
, dp
, &er
, &nfserr
);
1775 if (ndo
->ndo_vflag
) {
1776 ND_PRINT(" file POST:");
1777 dp
= parse_post_op_attr(ndo
, dp
, ndo
->ndo_vflag
);
1781 dp
= parse_wcc_data(ndo
, dp
, ndo
->ndo_vflag
);
1787 if (parsestatus(ndo
, dp
, &er
, &nfserr
) == NULL
)
1792 case NFSPROC_READDIR
:
1793 dp
= parserep(ndo
, rp
, length
, &nfserr
);
1797 if (parsev3rddirres(ndo
, dp
, ndo
->ndo_vflag
, &nfserr
) == NULL
)
1800 if (parserddires(ndo
, dp
, &nfserr
) == 0)
1805 case NFSPROC_READDIRPLUS
:
1806 dp
= parserep(ndo
, rp
, length
, &nfserr
);
1809 if (parsev3rddirres(ndo
, dp
, ndo
->ndo_vflag
, &nfserr
) == NULL
)
1813 case NFSPROC_FSSTAT
:
1814 dp
= parserep(ndo
, rp
, length
, &nfserr
);
1817 if (parsestatfs(ndo
, dp
, v3
, &nfserr
) == 0)
1821 case NFSPROC_FSINFO
:
1822 dp
= parserep(ndo
, rp
, length
, &nfserr
);
1825 if (parsefsinfo(ndo
, dp
, &nfserr
) == 0)
1829 case NFSPROC_PATHCONF
:
1830 dp
= parserep(ndo
, rp
, length
, &nfserr
);
1833 if (parsepathconf(ndo
, dp
, &nfserr
) == 0)
1837 case NFSPROC_COMMIT
:
1838 dp
= parserep(ndo
, rp
, length
, &nfserr
);
1841 dp
= parsewccres(ndo
, dp
, ndo
->ndo_vflag
, &nfserr
);
1844 if (ndo
->ndo_vflag
> 1) {
1845 /* write-verf-cookie */
1846 ND_PRINT(" verf %" PRIx64
, GET_BE_U_8(dp
));
1857 nd_print_trunc(ndo
);