]>
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 nfsaddr_print(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 if (!ndo
->ndo_nflag
) {
344 strlcpy(srcid
, "nfs", sizeof(srcid
));
345 snprintf(dstid
, sizeof(dstid
), "%u",
346 GET_BE_U_4(rp
->rm_xid
));
348 snprintf(srcid
, sizeof(srcid
), "%u", NFS_PORT
);
349 snprintf(dstid
, sizeof(dstid
), "%u",
350 GET_BE_U_4(rp
->rm_xid
));
352 nfsaddr_print(ndo
, bp2
, srcid
, dstid
);
354 nfsreply_noaddr_print(ndo
, bp
, length
, bp2
);
358 nfsreply_noaddr_print(netdissect_options
*ndo
,
359 const u_char
*bp
, u_int length
,
362 const struct sunrpc_msg
*rp
;
363 uint32_t proc
, vers
, reply_stat
;
364 enum sunrpc_reject_stat rstat
;
367 enum sunrpc_auth_stat rwhy
;
369 ndo
->ndo_protocol
= "nfs";
370 rp
= (const struct sunrpc_msg
*)bp
;
372 ND_TCHECK_4(rp
->rm_reply
.rp_stat
);
373 reply_stat
= GET_BE_U_4(&rp
->rm_reply
.rp_stat
);
374 switch (reply_stat
) {
376 case SUNRPC_MSG_ACCEPTED
:
377 ND_PRINT("reply ok %u", length
);
378 if (xid_map_find(ndo
, rp
, bp2
, &proc
, &vers
) >= 0)
379 interp_reply(ndo
, rp
, proc
, vers
, length
);
382 case SUNRPC_MSG_DENIED
:
383 ND_PRINT("reply ERR %u: ", length
);
384 ND_TCHECK_4(rp
->rm_reply
.rp_reject
.rj_stat
);
385 rstat
= GET_BE_U_4(&rp
->rm_reply
.rp_reject
.rj_stat
);
388 case SUNRPC_RPC_MISMATCH
:
389 ND_TCHECK_4(rp
->rm_reply
.rp_reject
.rj_vers
.high
);
390 rlow
= GET_BE_U_4(&rp
->rm_reply
.rp_reject
.rj_vers
.low
);
391 rhigh
= GET_BE_U_4(&rp
->rm_reply
.rp_reject
.rj_vers
.high
);
392 ND_PRINT("RPC Version mismatch (%u-%u)", rlow
, rhigh
);
395 case SUNRPC_AUTH_ERROR
:
396 ND_TCHECK_4(rp
->rm_reply
.rp_reject
.rj_why
);
397 rwhy
= GET_BE_U_4(&rp
->rm_reply
.rp_reject
.rj_why
);
398 ND_PRINT("Auth %s", tok2str(sunrpc_auth_str
, "Invalid failure code %u", rwhy
));
402 ND_PRINT("Unknown reason for rejecting rpc message %u", (unsigned int)rstat
);
408 ND_PRINT("reply Unknown rpc response code=%u %u", reply_stat
, length
);
418 * Return a pointer to the first file handle in the packet.
419 * If the packet was truncated, return 0.
421 static const uint32_t *
422 parsereq(netdissect_options
*ndo
,
423 const struct sunrpc_msg
*rp
, u_int length
)
426 u_int len
, rounded_len
;
429 * Find the start of the req data (if we captured it).
430 * First, get the length of the credentials, and make sure
431 * we have all of the opaque part of the credentials.
433 dp
= (const uint32_t *)&rp
->rm_call
.cb_cred
;
434 if (length
< 2 * sizeof(*dp
))
436 len
= GET_BE_U_4(dp
+ 1);
437 rounded_len
= roundup2(len
, 4);
438 ND_TCHECK_LEN(dp
+ 2, rounded_len
);
439 if (2 * sizeof(*dp
) + rounded_len
<= length
) {
441 * We have all of the credentials. Skip past them; they
442 * consist of 4 bytes of flavor, 4 bytes of length,
443 * and len-rounded-up-to-a-multiple-of-4 bytes of
446 dp
+= (len
+ (2 * sizeof(*dp
) + 3)) / sizeof(*dp
);
447 length
-= 2 * sizeof(*dp
) + rounded_len
;
450 * Now get the length of the verifier, and make sure
451 * we have all of the opaque part of the verifier.
453 if (length
< 2 * sizeof(*dp
))
455 len
= GET_BE_U_4(dp
+ 1);
456 rounded_len
= roundup2(len
, 4);
457 ND_TCHECK_LEN(dp
+ 2, rounded_len
);
458 if (2 * sizeof(*dp
) + rounded_len
< length
) {
460 * We have all of the verifier. Skip past it;
461 * it consists of 4 bytes of flavor, 4 bytes of
462 * length, and len-rounded-up-to-a-multiple-of-4
465 dp
+= (len
+ (2 * sizeof(*dp
) + 3)) / sizeof(*dp
);
474 * Print out an NFS file handle and return a pointer to following word.
475 * If packet was truncated, return 0.
477 static const uint32_t *
478 parsefh(netdissect_options
*ndo
,
479 const uint32_t *dp
, int v3
)
484 len
= GET_BE_U_4(dp
) / 4;
489 if (ND_TTEST_LEN(dp
, len
* sizeof(*dp
))) {
490 nfs_printfh(ndo
, dp
, len
);
497 * Print out a file name and return pointer to 32-bit word past it.
498 * If packet was truncated, return 0.
500 static const uint32_t *
501 parsefn(netdissect_options
*ndo
,
504 uint32_t len
, rounded_len
;
507 /* Fetch big-endian string length */
508 len
= GET_BE_U_4(dp
);
511 if (UINT_MAX
- len
< 3) {
512 ND_PRINT("[cannot pad to 32-bit boundaries]");
513 nd_print_invalid(ndo
);
517 rounded_len
= roundup2(len
, 4);
518 ND_TCHECK_LEN(dp
, rounded_len
);
520 cp
= (const u_char
*)dp
;
521 /* Update 32-bit pointer (NFS filenames padded to 32-bit boundaries) */
522 dp
+= rounded_len
/ sizeof(*dp
);
524 if (nd_printn(ndo
, cp
, len
, ndo
->ndo_snapend
)) {
536 * Print out file handle and file name.
537 * Return pointer to 32-bit word past file name.
538 * If packet was truncated (or there was some other error), return 0.
540 static const uint32_t *
541 parsefhn(netdissect_options
*ndo
,
542 const uint32_t *dp
, int v3
)
544 dp
= parsefh(ndo
, dp
, v3
);
548 return (parsefn(ndo
, dp
));
552 nfsreq_noaddr_print(netdissect_options
*ndo
,
553 const u_char
*bp
, u_int length
,
556 const struct sunrpc_msg
*rp
;
561 uint32_t access_flags
;
562 struct nfsv3_sattr sa3
;
564 ndo
->ndo_protocol
= "nfs";
565 ND_PRINT("%u", length
);
566 rp
= (const struct sunrpc_msg
*)bp
;
568 if (!xid_map_enter(ndo
, rp
, bp2
)) /* record proc number for later on */
571 v3
= (GET_BE_U_4(&rp
->rm_call
.cb_vers
) == NFS_VER3
);
572 proc
= GET_BE_U_4(&rp
->rm_call
.cb_proc
);
574 if (!v3
&& proc
< NFS_NPROCS
)
575 proc
= nfsv3_procid
[proc
];
577 ND_PRINT(" %s", tok2str(nfsproc_str
, "proc-%u", proc
));
580 case NFSPROC_GETATTR
:
581 case NFSPROC_SETATTR
:
582 case NFSPROC_READLINK
:
585 case NFSPROC_PATHCONF
:
586 dp
= parsereq(ndo
, rp
, length
);
589 if (parsefh(ndo
, dp
, v3
) == NULL
)
598 dp
= parsereq(ndo
, rp
, length
);
601 if (parsefhn(ndo
, dp
, v3
) == NULL
)
606 dp
= parsereq(ndo
, rp
, length
);
609 dp
= parsefh(ndo
, dp
, v3
);
612 access_flags
= GET_BE_U_4(dp
);
613 if (access_flags
& ~NFSV3ACCESS_FULL
) {
614 /* NFSV3ACCESS definitions aren't up to date */
615 ND_PRINT(" %04x", access_flags
);
616 } else if ((access_flags
& NFSV3ACCESS_FULL
) == NFSV3ACCESS_FULL
) {
617 ND_PRINT(" NFS_ACCESS_FULL");
619 char separator
= ' ';
620 if (access_flags
& NFSV3ACCESS_READ
) {
621 ND_PRINT(" NFS_ACCESS_READ");
624 if (access_flags
& NFSV3ACCESS_LOOKUP
) {
625 ND_PRINT("%cNFS_ACCESS_LOOKUP", separator
);
628 if (access_flags
& NFSV3ACCESS_MODIFY
) {
629 ND_PRINT("%cNFS_ACCESS_MODIFY", separator
);
632 if (access_flags
& NFSV3ACCESS_EXTEND
) {
633 ND_PRINT("%cNFS_ACCESS_EXTEND", separator
);
636 if (access_flags
& NFSV3ACCESS_DELETE
) {
637 ND_PRINT("%cNFS_ACCESS_DELETE", separator
);
640 if (access_flags
& NFSV3ACCESS_EXECUTE
)
641 ND_PRINT("%cNFS_ACCESS_EXECUTE", separator
);
646 dp
= parsereq(ndo
, rp
, length
);
649 dp
= parsefh(ndo
, dp
, v3
);
653 ND_PRINT(" %u bytes @ %" PRIu64
,
657 ND_PRINT(" %u bytes @ %u",
664 dp
= parsereq(ndo
, rp
, length
);
667 dp
= parsefh(ndo
, dp
, v3
);
671 ND_PRINT(" %u (%u) bytes @ %" PRIu64
,
675 if (ndo
->ndo_vflag
) {
677 tok2str(nfsv3_writemodes
,
678 NULL
, GET_BE_U_4(dp
+ 3)));
681 ND_PRINT(" %u (%u) bytes @ %u (%u)",
689 case NFSPROC_SYMLINK
:
690 dp
= parsereq(ndo
, rp
, length
);
693 dp
= parsefhn(ndo
, dp
, v3
);
697 if (v3
&& (dp
= parse_sattr3(ndo
, dp
, &sa3
)) == NULL
)
699 if (parsefn(ndo
, dp
) == NULL
)
701 if (v3
&& ndo
->ndo_vflag
)
702 print_sattr3(ndo
, &sa3
, ndo
->ndo_vflag
);
706 dp
= parsereq(ndo
, rp
, length
);
709 dp
= parsefhn(ndo
, dp
, v3
);
712 type
= (nfs_type
) GET_BE_U_4(dp
);
714 dp
= parse_sattr3(ndo
, dp
, &sa3
);
717 ND_PRINT(" %s", tok2str(type2str
, "unk-ft %u", type
));
718 if (ndo
->ndo_vflag
&& (type
== NFCHR
|| type
== NFBLK
)) {
725 print_sattr3(ndo
, &sa3
, ndo
->ndo_vflag
);
729 dp
= parsereq(ndo
, rp
, length
);
732 dp
= parsefhn(ndo
, dp
, v3
);
736 if (parsefhn(ndo
, dp
, v3
) == NULL
)
741 dp
= parsereq(ndo
, rp
, length
);
744 dp
= parsefh(ndo
, dp
, v3
);
748 if (parsefhn(ndo
, dp
, v3
) == NULL
)
752 case NFSPROC_READDIR
:
753 dp
= parsereq(ndo
, rp
, length
);
756 dp
= parsefh(ndo
, dp
, v3
);
761 * We shouldn't really try to interpret the
762 * offset cookie here.
764 ND_PRINT(" %u bytes @ %" PRId64
,
767 if (ndo
->ndo_vflag
) {
769 * This displays the 8 bytes
770 * of the verifier in order,
771 * from the low-order byte
772 * to the high-order byte.
774 ND_PRINT(" verf %08x%08x",
780 * Print the offset as signed, since -1 is
781 * common, but offsets > 2^31 aren't.
783 ND_PRINT(" %u bytes @ %u",
789 case NFSPROC_READDIRPLUS
:
790 dp
= parsereq(ndo
, rp
, length
);
793 dp
= parsefh(ndo
, dp
, v3
);
797 * We don't try to interpret the offset
800 ND_PRINT(" %u bytes @ %" PRId64
,
803 if (ndo
->ndo_vflag
) {
805 * This displays the 8 bytes
806 * of the verifier in order,
807 * from the low-order byte
808 * to the high-order byte.
810 ND_PRINT(" max %u verf %08x%08x",
818 dp
= parsereq(ndo
, rp
, length
);
821 dp
= parsefh(ndo
, dp
, v3
);
824 ND_PRINT(" %u bytes @ %" PRIu64
,
839 * Print out an NFS file handle.
840 * We assume packet was not truncated before the end of the
841 * file handle pointed to by dp.
843 * Note: new version (using portable file-handle parser) doesn't produce
844 * generation number. It probably could be made to do that, with some
845 * additional hacking on the parser code.
848 nfs_printfh(netdissect_options
*ndo
,
849 const uint32_t *dp
, const u_int len
)
853 const char *sfsname
= NULL
;
856 if (ndo
->ndo_uflag
) {
858 char const *sep
= "";
861 for (i
=0; i
<len
; i
++) {
863 * This displays 4 bytes in big-endian byte
864 * order. That's as good a choice as little-
865 * endian, as there's no guarantee that the
866 * server is big-endian or little-endian or
867 * that the file handle contains 4-byte
868 * integral fields, and is better than "the
869 * byte order of the host running tcpdump", as
870 * the latter means that different hosts
871 * running tcpdump may show the same file
872 * handle in different ways.
874 ND_PRINT("%s%x", sep
, GET_BE_U_4(dp
+ i
));
881 Parse_fh(ndo
, (const u_char
*)dp
, len
, &fsid
, &ino
, NULL
, &sfsname
, 0);
884 /* file system ID is ASCII, not numeric, for this server OS */
885 char temp
[NFSX_V3FHMAX
+1];
888 /* Make sure string is null-terminated */
890 if (stringlen
> NFSX_V3FHMAX
)
891 stringlen
= NFSX_V3FHMAX
;
892 strncpy(temp
, sfsname
, stringlen
);
893 temp
[stringlen
] = '\0';
894 /* Remove trailing spaces */
895 spacep
= strchr(temp
, ' ');
899 ND_PRINT(" fh %s/", temp
);
901 ND_PRINT(" fh %u,%u/",
902 fsid
.Fsid_dev
.Major
, fsid
.Fsid_dev
.Minor
);
905 if(fsid
.Fsid_dev
.Minor
== 257)
906 /* Print the undecoded handle */
907 ND_PRINT("%s", fsid
.Opaque_Handle
);
913 * Maintain a small cache of recent client.XID.server/proc pairs, to allow
914 * us to match up replies with requests and thus to know how to parse
918 struct xid_map_entry
{
919 uint32_t xid
; /* transaction ID (net order) */
920 int ipver
; /* IP version (4 or 6) */
921 nd_ipv6 client
; /* client IP address (net order) */
922 nd_ipv6 server
; /* server IP address (net order) */
923 uint32_t proc
; /* call proc number (host order) */
924 uint32_t vers
; /* program version (host order) */
928 * Map entries are kept in an array that we manage as a ring;
929 * new entries are always added at the tail of the ring. Initially,
930 * all the entries are zero and hence don't match anything.
933 #define XIDMAPSIZE 64
935 static struct xid_map_entry xid_map
[XIDMAPSIZE
];
937 static int xid_map_next
= 0;
938 static int xid_map_hint
= 0;
941 xid_map_enter(netdissect_options
*ndo
,
942 const struct sunrpc_msg
*rp
, const u_char
*bp
)
944 const struct ip
*ip
= NULL
;
945 const struct ip6_hdr
*ip6
= NULL
;
946 struct xid_map_entry
*xmep
;
948 if (!ND_TTEST_4(rp
->rm_call
.cb_proc
))
950 switch (IP_V((const struct ip
*)bp
)) {
952 ip
= (const struct ip
*)bp
;
955 ip6
= (const struct ip6_hdr
*)bp
;
961 xmep
= &xid_map
[xid_map_next
];
963 if (++xid_map_next
>= XIDMAPSIZE
)
966 UNALIGNED_MEMCPY(&xmep
->xid
, &rp
->rm_xid
, sizeof(xmep
->xid
));
969 UNALIGNED_MEMCPY(&xmep
->client
, ip
->ip_src
,
971 UNALIGNED_MEMCPY(&xmep
->server
, ip
->ip_dst
,
975 UNALIGNED_MEMCPY(&xmep
->client
, ip6
->ip6_src
,
976 sizeof(ip6
->ip6_src
));
977 UNALIGNED_MEMCPY(&xmep
->server
, ip6
->ip6_dst
,
978 sizeof(ip6
->ip6_dst
));
980 xmep
->proc
= GET_BE_U_4(&rp
->rm_call
.cb_proc
);
981 xmep
->vers
= GET_BE_U_4(&rp
->rm_call
.cb_vers
);
986 * Returns 0 and puts NFSPROC_xxx in proc return and
987 * version in vers return, or returns -1 on failure
990 xid_map_find(netdissect_options
*ndo
, const struct sunrpc_msg
*rp
,
991 const u_char
*bp
, uint32_t *proc
, uint32_t *vers
)
994 struct xid_map_entry
*xmep
;
996 const struct ip
*ip
= (const struct ip
*)bp
;
997 const struct ip6_hdr
*ip6
= (const struct ip6_hdr
*)bp
;
1000 UNALIGNED_MEMCPY(&xid
, &rp
->rm_xid
, sizeof(xmep
->xid
));
1001 /* Start searching from where we last left off */
1006 if (xmep
->ipver
!= IP_V(ip
) || xmep
->xid
!= xid
)
1008 switch (xmep
->ipver
) {
1010 if (UNALIGNED_MEMCMP(ip
->ip_src
, &xmep
->server
,
1011 sizeof(ip
->ip_src
)) != 0 ||
1012 UNALIGNED_MEMCMP(ip
->ip_dst
, &xmep
->client
,
1013 sizeof(ip
->ip_dst
)) != 0) {
1018 if (UNALIGNED_MEMCMP(ip6
->ip6_src
, &xmep
->server
,
1019 sizeof(ip6
->ip6_src
)) != 0 ||
1020 UNALIGNED_MEMCMP(ip6
->ip6_dst
, &xmep
->client
,
1021 sizeof(ip6
->ip6_dst
)) != 0) {
1037 if (++i
>= XIDMAPSIZE
)
1039 } while (i
!= xid_map_hint
);
1046 * Routines for parsing reply packets
1050 * Return a pointer to the beginning of the actual results.
1051 * If the packet was truncated, return 0.
1053 static const uint32_t *
1054 parserep(netdissect_options
*ndo
,
1055 const struct sunrpc_msg
*rp
, u_int length
, int *nfserrp
)
1059 enum sunrpc_accept_stat astat
;
1063 * Here we find the address of the ar_verf credentials.
1064 * Originally, this calculation was
1065 * dp = (uint32_t *)&rp->rm_reply.rp_acpt.ar_verf
1066 * On the wire, the rp_acpt field starts immediately after
1067 * the (32 bit) rp_stat field. However, rp_acpt (which is a
1068 * "struct accepted_reply") contains a "struct opaque_auth",
1069 * whose internal representation contains a pointer, so on a
1070 * 64-bit machine the compiler inserts 32 bits of padding
1071 * before rp->rm_reply.rp_acpt.ar_verf. So, we cannot use
1072 * the internal representation to parse the on-the-wire
1073 * representation. Instead, we skip past the rp_stat field,
1074 * which is an "enum" and so occupies one 32-bit word.
1076 dp
= ((const uint32_t *)&rp
->rm_reply
) + 1;
1077 len
= GET_BE_U_4(dp
+ 1);
1081 * skip past the ar_verf credentials.
1083 dp
+= (len
+ (2*sizeof(uint32_t) + 3)) / sizeof(uint32_t);
1086 * now we can check the ar_stat field
1088 astat
= (enum sunrpc_accept_stat
) GET_BE_U_4(dp
);
1089 if (astat
!= SUNRPC_SUCCESS
) {
1090 ND_PRINT(" %s", tok2str(sunrpc_str
, "ar_stat %u", astat
));
1091 *nfserrp
= 1; /* suppress trunc string */
1094 /* successful return */
1095 ND_TCHECK_LEN(dp
, sizeof(astat
));
1096 return ((const uint32_t *) (sizeof(astat
) + ((const char *)dp
)));
1101 static const uint32_t *
1102 parsestatus(netdissect_options
*ndo
,
1103 const uint32_t *dp
, u_int
*er
, int *nfserrp
)
1107 errnum
= GET_BE_U_4(dp
);
1111 if (!ndo
->ndo_qflag
)
1112 ND_PRINT(" ERROR: %s",
1113 tok2str(status2str
, "unk %u", errnum
));
1119 static const uint32_t *
1120 parsefattr(netdissect_options
*ndo
,
1121 const uint32_t *dp
, int verbose
, int v3
)
1123 const struct nfs_fattr
*fap
;
1125 fap
= (const struct nfs_fattr
*)dp
;
1126 ND_TCHECK_4(fap
->fa_gid
);
1129 * XXX - UIDs and GIDs are unsigned in NFS and in
1130 * at least some UN*Xes, but we'll show them as
1131 * signed because -2 has traditionally been the
1132 * UID for "nobody", rather than 4294967294.
1134 ND_PRINT(" %s %o ids %d/%d",
1135 tok2str(type2str
, "unk-ft %u ",
1136 GET_BE_U_4(fap
->fa_type
)),
1137 GET_BE_U_4(fap
->fa_mode
),
1138 GET_BE_S_4(fap
->fa_uid
),
1139 GET_BE_S_4(fap
->fa_gid
));
1141 ND_PRINT(" sz %" PRIu64
,
1142 GET_BE_U_8(fap
->fa3_size
));
1144 ND_PRINT(" sz %u", GET_BE_U_4(fap
->fa2_size
));
1147 /* print lots more stuff */
1150 ND_TCHECK_8(&fap
->fa3_ctime
);
1151 ND_PRINT(" nlink %u rdev %u/%u",
1152 GET_BE_U_4(fap
->fa_nlink
),
1153 GET_BE_U_4(fap
->fa3_rdev
.specdata1
),
1154 GET_BE_U_4(fap
->fa3_rdev
.specdata2
));
1155 ND_PRINT(" fsid %" PRIx64
,
1156 GET_BE_U_8(fap
->fa3_fsid
));
1157 ND_PRINT(" fileid %" PRIx64
,
1158 GET_BE_U_8(fap
->fa3_fileid
));
1159 ND_PRINT(" a/m/ctime %u.%06u",
1160 GET_BE_U_4(fap
->fa3_atime
.nfsv3_sec
),
1161 GET_BE_U_4(fap
->fa3_atime
.nfsv3_nsec
));
1162 ND_PRINT(" %u.%06u",
1163 GET_BE_U_4(fap
->fa3_mtime
.nfsv3_sec
),
1164 GET_BE_U_4(fap
->fa3_mtime
.nfsv3_nsec
));
1165 ND_PRINT(" %u.%06u",
1166 GET_BE_U_4(fap
->fa3_ctime
.nfsv3_sec
),
1167 GET_BE_U_4(fap
->fa3_ctime
.nfsv3_nsec
));
1169 ND_TCHECK_8(&fap
->fa2_ctime
);
1170 ND_PRINT(" nlink %u rdev 0x%x fsid 0x%x nodeid 0x%x a/m/ctime",
1171 GET_BE_U_4(fap
->fa_nlink
),
1172 GET_BE_U_4(fap
->fa2_rdev
),
1173 GET_BE_U_4(fap
->fa2_fsid
),
1174 GET_BE_U_4(fap
->fa2_fileid
));
1175 ND_PRINT(" %u.%06u",
1176 GET_BE_U_4(fap
->fa2_atime
.nfsv2_sec
),
1177 GET_BE_U_4(fap
->fa2_atime
.nfsv2_usec
));
1178 ND_PRINT(" %u.%06u",
1179 GET_BE_U_4(fap
->fa2_mtime
.nfsv2_sec
),
1180 GET_BE_U_4(fap
->fa2_mtime
.nfsv2_usec
));
1181 ND_PRINT(" %u.%06u",
1182 GET_BE_U_4(fap
->fa2_ctime
.nfsv2_sec
),
1183 GET_BE_U_4(fap
->fa2_ctime
.nfsv2_usec
));
1186 return ((const uint32_t *)((const unsigned char *)dp
+
1187 (v3
? NFSX_V3FATTR
: NFSX_V2FATTR
)));
1193 parseattrstat(netdissect_options
*ndo
,
1194 const uint32_t *dp
, int verbose
, int v3
, int *nfserrp
)
1198 dp
= parsestatus(ndo
, dp
, &er
, nfserrp
);
1204 return (parsefattr(ndo
, dp
, verbose
, v3
) != NULL
);
1208 parsediropres(netdissect_options
*ndo
,
1209 const uint32_t *dp
, int *nfserrp
)
1213 dp
= parsestatus(ndo
, dp
, &er
, nfserrp
);
1219 dp
= parsefh(ndo
, dp
, 0);
1223 return (parsefattr(ndo
, dp
, ndo
->ndo_vflag
, 0) != NULL
);
1227 parselinkres(netdissect_options
*ndo
,
1228 const uint32_t *dp
, int v3
, int *nfserrp
)
1232 dp
= parsestatus(ndo
, dp
, &er
, nfserrp
);
1238 dp
= parse_post_op_attr(ndo
, dp
, ndo
->ndo_vflag
);
1243 return (parsefn(ndo
, dp
) != NULL
);
1247 parsestatfs(netdissect_options
*ndo
,
1248 const uint32_t *dp
, int v3
, int *nfserrp
)
1250 const struct nfs_statfs
*sfsp
;
1253 dp
= parsestatus(ndo
, dp
, &er
, nfserrp
);
1265 dp
= parse_post_op_attr(ndo
, dp
, ndo
->ndo_vflag
);
1270 ND_TCHECK_LEN(dp
, (v3
? NFSX_V3STATFS
: NFSX_V2STATFS
));
1272 sfsp
= (const struct nfs_statfs
*)dp
;
1275 ND_PRINT(" tbytes %" PRIu64
" fbytes %" PRIu64
" abytes %" PRIu64
,
1276 GET_BE_U_8(sfsp
->sf_tbytes
),
1277 GET_BE_U_8(sfsp
->sf_fbytes
),
1278 GET_BE_U_8(sfsp
->sf_abytes
));
1279 if (ndo
->ndo_vflag
) {
1280 ND_PRINT(" tfiles %" PRIu64
" ffiles %" PRIu64
" afiles %" PRIu64
" invar %u",
1281 GET_BE_U_8(sfsp
->sf_tfiles
),
1282 GET_BE_U_8(sfsp
->sf_ffiles
),
1283 GET_BE_U_8(sfsp
->sf_afiles
),
1284 GET_BE_U_4(sfsp
->sf_invarsec
));
1287 ND_PRINT(" tsize %u bsize %u blocks %u bfree %u bavail %u",
1288 GET_BE_U_4(sfsp
->sf_tsize
),
1289 GET_BE_U_4(sfsp
->sf_bsize
),
1290 GET_BE_U_4(sfsp
->sf_blocks
),
1291 GET_BE_U_4(sfsp
->sf_bfree
),
1292 GET_BE_U_4(sfsp
->sf_bavail
));
1301 parserddires(netdissect_options
*ndo
,
1302 const uint32_t *dp
, int *nfserrp
)
1306 dp
= parsestatus(ndo
, dp
, &er
, nfserrp
);
1314 ND_PRINT(" offset 0x%x size %u ",
1315 GET_BE_U_4(dp
), GET_BE_U_4(dp
+ 1));
1316 if (GET_BE_U_4(dp
+ 2) != 0)
1322 static const uint32_t *
1323 parse_wcc_attr(netdissect_options
*ndo
,
1326 /* Our caller has already checked this */
1327 ND_PRINT(" sz %" PRIu64
, GET_BE_U_8(dp
));
1328 ND_PRINT(" mtime %u.%06u ctime %u.%06u",
1329 GET_BE_U_4(dp
+ 2), GET_BE_U_4(dp
+ 3),
1330 GET_BE_U_4(dp
+ 4), GET_BE_U_4(dp
+ 5));
1335 * Pre operation attributes. Print only if vflag > 1.
1337 static const uint32_t *
1338 parse_pre_op_attr(netdissect_options
*ndo
,
1339 const uint32_t *dp
, int verbose
)
1341 if (!GET_BE_U_4(dp
))
1344 ND_TCHECK_LEN(dp
, 24);
1346 return parse_wcc_attr(ndo
, dp
);
1348 /* If not verbose enough, just skip over wcc_attr */
1356 * Post operation attributes are printed if vflag >= 1
1358 static const uint32_t *
1359 parse_post_op_attr(netdissect_options
*ndo
,
1360 const uint32_t *dp
, int verbose
)
1362 if (!GET_BE_U_4(dp
))
1366 return parsefattr(ndo
, dp
, verbose
, 1);
1368 return (dp
+ (NFSX_V3FATTR
/ sizeof (uint32_t)));
1371 static const uint32_t *
1372 parse_wcc_data(netdissect_options
*ndo
,
1373 const uint32_t *dp
, int verbose
)
1377 dp
= parse_pre_op_attr(ndo
, dp
, verbose
);
1383 return parse_post_op_attr(ndo
, dp
, verbose
);
1386 static const uint32_t *
1387 parsecreateopres(netdissect_options
*ndo
,
1388 const uint32_t *dp
, int verbose
, int *nfserrp
)
1392 dp
= parsestatus(ndo
, dp
, &er
, nfserrp
);
1396 dp
= parse_wcc_data(ndo
, dp
, verbose
);
1398 if (!GET_BE_U_4(dp
))
1401 dp
= parsefh(ndo
, dp
, 1);
1405 dp
= parse_post_op_attr(ndo
, dp
, verbose
);
1408 if (ndo
->ndo_vflag
> 1) {
1409 ND_PRINT(" dir attr:");
1410 dp
= parse_wcc_data(ndo
, dp
, verbose
);
1417 static const uint32_t *
1418 parsewccres(netdissect_options
*ndo
,
1419 const uint32_t *dp
, int verbose
, int *nfserrp
)
1423 dp
= parsestatus(ndo
, dp
, &er
, nfserrp
);
1426 return parse_wcc_data(ndo
, dp
, verbose
);
1429 static const uint32_t *
1430 parsev3rddirres(netdissect_options
*ndo
,
1431 const uint32_t *dp
, int verbose
, int *nfserrp
)
1435 dp
= parsestatus(ndo
, dp
, &er
, nfserrp
);
1440 dp
= parse_post_op_attr(ndo
, dp
, verbose
);
1445 if (ndo
->ndo_vflag
) {
1447 * This displays the 8 bytes of the verifier in order,
1448 * from the low-order byte to the high-order byte.
1450 ND_PRINT(" verf %08x%08x",
1451 GET_BE_U_4(dp
), GET_BE_U_4(dp
+ 1));
1458 parsefsinfo(netdissect_options
*ndo
,
1459 const uint32_t *dp
, int *nfserrp
)
1461 const struct nfsv3_fsinfo
*sfp
;
1464 dp
= parsestatus(ndo
, dp
, &er
, nfserrp
);
1469 dp
= parse_post_op_attr(ndo
, dp
, ndo
->ndo_vflag
);
1475 sfp
= (const struct nfsv3_fsinfo
*)dp
;
1476 ND_TCHECK_SIZE(sfp
);
1477 ND_PRINT(" rtmax %u rtpref %u wtmax %u wtpref %u dtpref %u",
1478 GET_BE_U_4(sfp
->fs_rtmax
),
1479 GET_BE_U_4(sfp
->fs_rtpref
),
1480 GET_BE_U_4(sfp
->fs_wtmax
),
1481 GET_BE_U_4(sfp
->fs_wtpref
),
1482 GET_BE_U_4(sfp
->fs_dtpref
));
1483 if (ndo
->ndo_vflag
) {
1484 ND_PRINT(" rtmult %u wtmult %u maxfsz %" PRIu64
,
1485 GET_BE_U_4(sfp
->fs_rtmult
),
1486 GET_BE_U_4(sfp
->fs_wtmult
),
1487 GET_BE_U_8(sfp
->fs_maxfilesize
));
1488 ND_PRINT(" delta %u.%06u ",
1489 GET_BE_U_4(sfp
->fs_timedelta
.nfsv3_sec
),
1490 GET_BE_U_4(sfp
->fs_timedelta
.nfsv3_nsec
));
1498 parsepathconf(netdissect_options
*ndo
,
1499 const uint32_t *dp
, int *nfserrp
)
1502 const struct nfsv3_pathconf
*spp
;
1504 dp
= parsestatus(ndo
, dp
, &er
, nfserrp
);
1509 dp
= parse_post_op_attr(ndo
, dp
, ndo
->ndo_vflag
);
1515 spp
= (const struct nfsv3_pathconf
*)dp
;
1516 ND_TCHECK_SIZE(spp
);
1518 ND_PRINT(" linkmax %u namemax %u %s %s %s %s",
1519 GET_BE_U_4(spp
->pc_linkmax
),
1520 GET_BE_U_4(spp
->pc_namemax
),
1521 GET_BE_U_4(spp
->pc_notrunc
) ? "notrunc" : "",
1522 GET_BE_U_4(spp
->pc_chownrestricted
) ? "chownres" : "",
1523 GET_BE_U_4(spp
->pc_caseinsensitive
) ? "igncase" : "",
1524 GET_BE_U_4(spp
->pc_casepreserving
) ? "keepcase" : "");
1531 interp_reply(netdissect_options
*ndo
,
1532 const struct sunrpc_msg
*rp
, uint32_t proc
, uint32_t vers
,
1540 v3
= (vers
== NFS_VER3
);
1542 if (!v3
&& proc
< NFS_NPROCS
)
1543 proc
= nfsv3_procid
[proc
];
1545 ND_PRINT(" %s", tok2str(nfsproc_str
, "proc-%u", proc
));
1548 case NFSPROC_GETATTR
:
1549 dp
= parserep(ndo
, rp
, length
, &nfserr
);
1552 if (parseattrstat(ndo
, dp
, !ndo
->ndo_qflag
, v3
, &nfserr
) == 0)
1556 case NFSPROC_SETATTR
:
1557 dp
= parserep(ndo
, rp
, length
, &nfserr
);
1561 if (parsewccres(ndo
, dp
, ndo
->ndo_vflag
, &nfserr
) == NULL
)
1564 if (parseattrstat(ndo
, dp
, !ndo
->ndo_qflag
, 0, &nfserr
) == 0)
1569 case NFSPROC_LOOKUP
:
1570 dp
= parserep(ndo
, rp
, length
, &nfserr
);
1574 dp
= parsestatus(ndo
, dp
, &er
, &nfserr
);
1578 if (ndo
->ndo_vflag
> 1) {
1579 ND_PRINT(" post dattr:");
1580 dp
= parse_post_op_attr(ndo
, dp
, ndo
->ndo_vflag
);
1585 dp
= parsefh(ndo
, dp
, v3
);
1588 dp
= parse_post_op_attr(ndo
, dp
, ndo
->ndo_vflag
);
1591 if (ndo
->ndo_vflag
> 1) {
1592 ND_PRINT(" post dattr:");
1593 dp
= parse_post_op_attr(ndo
, dp
, ndo
->ndo_vflag
);
1599 if (parsediropres(ndo
, dp
, &nfserr
) == 0)
1604 case NFSPROC_ACCESS
:
1605 dp
= parserep(ndo
, rp
, length
, &nfserr
);
1608 dp
= parsestatus(ndo
, dp
, &er
, &nfserr
);
1613 dp
= parse_post_op_attr(ndo
, dp
, ndo
->ndo_vflag
);
1617 ND_PRINT(" c %04x", GET_BE_U_4(dp
));
1621 case NFSPROC_READLINK
:
1622 dp
= parserep(ndo
, rp
, length
, &nfserr
);
1625 if (parselinkres(ndo
, dp
, v3
, &nfserr
) == 0)
1630 dp
= parserep(ndo
, rp
, length
, &nfserr
);
1634 dp
= parsestatus(ndo
, dp
, &er
, &nfserr
);
1637 dp
= parse_post_op_attr(ndo
, dp
, ndo
->ndo_vflag
);
1641 if (ndo
->ndo_vflag
) {
1642 ND_PRINT(" %u bytes", GET_BE_U_4(dp
));
1643 if (GET_BE_U_4(dp
+ 1))
1648 if (parseattrstat(ndo
, dp
, ndo
->ndo_vflag
, 0, &nfserr
) == 0)
1654 dp
= parserep(ndo
, rp
, length
, &nfserr
);
1658 dp
= parsestatus(ndo
, dp
, &er
, &nfserr
);
1661 dp
= parse_wcc_data(ndo
, dp
, ndo
->ndo_vflag
);
1665 if (ndo
->ndo_vflag
) {
1666 ND_PRINT(" %u bytes", GET_BE_U_4(dp
));
1667 if (ndo
->ndo_vflag
> 1) {
1669 tok2str(nfsv3_writemodes
,
1670 NULL
, GET_BE_U_4(dp
+ 1)));
1672 /* write-verf-cookie */
1673 ND_PRINT(" verf %" PRIx64
,
1674 GET_BE_U_8(dp
+ 2));
1680 if (parseattrstat(ndo
, dp
, ndo
->ndo_vflag
, v3
, &nfserr
) == 0)
1685 case NFSPROC_CREATE
:
1687 dp
= parserep(ndo
, rp
, length
, &nfserr
);
1691 if (parsecreateopres(ndo
, dp
, ndo
->ndo_vflag
, &nfserr
) == NULL
)
1694 if (parsediropres(ndo
, dp
, &nfserr
) == 0)
1699 case NFSPROC_SYMLINK
:
1700 dp
= parserep(ndo
, rp
, length
, &nfserr
);
1704 if (parsecreateopres(ndo
, dp
, ndo
->ndo_vflag
, &nfserr
) == NULL
)
1707 if (parsestatus(ndo
, dp
, &er
, &nfserr
) == NULL
)
1713 dp
= parserep(ndo
, rp
, length
, &nfserr
);
1716 if (parsecreateopres(ndo
, dp
, ndo
->ndo_vflag
, &nfserr
) == NULL
)
1720 case NFSPROC_REMOVE
:
1722 dp
= parserep(ndo
, rp
, length
, &nfserr
);
1726 if (parsewccres(ndo
, dp
, ndo
->ndo_vflag
, &nfserr
) == NULL
)
1729 if (parsestatus(ndo
, dp
, &er
, &nfserr
) == NULL
)
1734 case NFSPROC_RENAME
:
1735 dp
= parserep(ndo
, rp
, length
, &nfserr
);
1739 dp
= parsestatus(ndo
, dp
, &er
, &nfserr
);
1742 if (ndo
->ndo_vflag
) {
1744 dp
= parse_wcc_data(ndo
, dp
, ndo
->ndo_vflag
);
1748 dp
= parse_wcc_data(ndo
, dp
, ndo
->ndo_vflag
);
1753 if (parsestatus(ndo
, dp
, &er
, &nfserr
) == NULL
)
1759 dp
= parserep(ndo
, rp
, length
, &nfserr
);
1763 dp
= parsestatus(ndo
, dp
, &er
, &nfserr
);
1766 if (ndo
->ndo_vflag
) {
1767 ND_PRINT(" file POST:");
1768 dp
= parse_post_op_attr(ndo
, dp
, ndo
->ndo_vflag
);
1772 dp
= parse_wcc_data(ndo
, dp
, ndo
->ndo_vflag
);
1778 if (parsestatus(ndo
, dp
, &er
, &nfserr
) == NULL
)
1783 case NFSPROC_READDIR
:
1784 dp
= parserep(ndo
, rp
, length
, &nfserr
);
1788 if (parsev3rddirres(ndo
, dp
, ndo
->ndo_vflag
, &nfserr
) == NULL
)
1791 if (parserddires(ndo
, dp
, &nfserr
) == 0)
1796 case NFSPROC_READDIRPLUS
:
1797 dp
= parserep(ndo
, rp
, length
, &nfserr
);
1800 if (parsev3rddirres(ndo
, dp
, ndo
->ndo_vflag
, &nfserr
) == NULL
)
1804 case NFSPROC_FSSTAT
:
1805 dp
= parserep(ndo
, rp
, length
, &nfserr
);
1808 if (parsestatfs(ndo
, dp
, v3
, &nfserr
) == 0)
1812 case NFSPROC_FSINFO
:
1813 dp
= parserep(ndo
, rp
, length
, &nfserr
);
1816 if (parsefsinfo(ndo
, dp
, &nfserr
) == 0)
1820 case NFSPROC_PATHCONF
:
1821 dp
= parserep(ndo
, rp
, length
, &nfserr
);
1824 if (parsepathconf(ndo
, dp
, &nfserr
) == 0)
1828 case NFSPROC_COMMIT
:
1829 dp
= parserep(ndo
, rp
, length
, &nfserr
);
1832 dp
= parsewccres(ndo
, dp
, ndo
->ndo_vflag
, &nfserr
);
1835 if (ndo
->ndo_vflag
> 1) {
1836 /* write-verf-cookie */
1837 ND_PRINT(" verf %" PRIx64
, GET_BE_U_8(dp
));
1848 nd_print_trunc(ndo
);