2 * Routines for nfs dissection
3 * Copyright 1999, Uwe Girlich <Uwe.Girlich@philosys.de>
4 * Copyright 2000-2001, Mike Frisch <frisch@hummingbird.com> (NFSv4 decoding)
6 * $Id: packet-nfs.c,v 1.64 2002/01/20 22:12:26 guy Exp $
8 * Ethereal - Network traffic analyzer
9 * By Gerald Combs <gerald@ethereal.com>
10 * Copyright 1998 Gerald Combs
12 * Copied from packet-smb.c
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License
16 * as published by the Free Software Foundation; either version 2
17 * of the License, or (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
34 #ifdef HAVE_SYS_TYPES_H
35 #include <sys/types.h>
41 #include "packet-rpc.h"
42 #include "packet-nfs.h"
46 static int proto_nfs = -1;
48 static int hf_nfs_fh_length = -1;
49 static int hf_nfs_fh_hash = -1;
50 static int hf_nfs_fh_fsid_major = -1;
51 static int hf_nfs_fh_fsid_minor = -1;
52 static int hf_nfs_fh_fsid_inode = -1;
53 static int hf_nfs_fh_xfsid_major = -1;
54 static int hf_nfs_fh_xfsid_minor = -1;
55 static int hf_nfs_fh_fstype = -1;
56 static int hf_nfs_fh_fn = -1;
57 static int hf_nfs_fh_fn_len = -1;
58 static int hf_nfs_fh_fn_inode = -1;
59 static int hf_nfs_fh_fn_generation = -1;
60 static int hf_nfs_fh_xfn = -1;
61 static int hf_nfs_fh_xfn_len = -1;
62 static int hf_nfs_fh_xfn_inode = -1;
63 static int hf_nfs_fh_xfn_generation = -1;
64 static int hf_nfs_fh_dentry = -1;
65 static int hf_nfs_fh_dev = -1;
66 static int hf_nfs_fh_xdev = -1;
67 static int hf_nfs_fh_dirinode = -1;
68 static int hf_nfs_fh_pinode = -1;
69 static int hf_nfs_fh_hp_len = -1;
70 static int hf_nfs_fh_version = -1;
71 static int hf_nfs_fh_auth_type = -1;
72 static int hf_nfs_fh_fsid_type = -1;
73 static int hf_nfs_fh_fileid_type = -1;
74 static int hf_nfs_stat = -1;
75 static int hf_nfs_name = -1;
76 static int hf_nfs_full_name = -1;
77 static int hf_nfs_readlink_data = -1;
78 static int hf_nfs_read_offset = -1;
79 static int hf_nfs_read_count = -1;
80 static int hf_nfs_read_totalcount = -1;
81 static int hf_nfs_data = -1;
82 static int hf_nfs_write_beginoffset = -1;
83 static int hf_nfs_write_offset = -1;
84 static int hf_nfs_write_totalcount = -1;
85 static int hf_nfs_symlink_to = -1;
86 static int hf_nfs_readdir_cookie = -1;
87 static int hf_nfs_readdir_count = -1;
88 static int hf_nfs_readdir_entry = -1;
89 static int hf_nfs_readdir_entry_fileid = -1;
90 static int hf_nfs_readdir_entry_name = -1;
91 static int hf_nfs_readdir_entry_cookie = -1;
92 static int hf_nfs_readdir_entry3_fileid = -1;
93 static int hf_nfs_readdir_entry3_name = -1;
94 static int hf_nfs_readdir_entry3_cookie = -1;
95 static int hf_nfs_readdirplus_entry_fileid = -1;
96 static int hf_nfs_readdirplus_entry_name = -1;
97 static int hf_nfs_readdirplus_entry_cookie = -1;
98 static int hf_nfs_readdir_eof = -1;
99 static int hf_nfs_statfs_tsize = -1;
100 static int hf_nfs_statfs_bsize = -1;
101 static int hf_nfs_statfs_blocks = -1;
102 static int hf_nfs_statfs_bfree = -1;
103 static int hf_nfs_statfs_bavail = -1;
104 static int hf_nfs_ftype3 = -1;
105 static int hf_nfs_nfsstat3 = -1;
106 static int hf_nfs_read_eof = -1;
107 static int hf_nfs_write_stable = -1;
108 static int hf_nfs_write_committed = -1;
109 static int hf_nfs_createmode3 = -1;
110 static int hf_nfs_fsstat_invarsec = -1;
111 static int hf_nfs_fsinfo_rtmax = -1;
112 static int hf_nfs_fsinfo_rtpref = -1;
113 static int hf_nfs_fsinfo_rtmult = -1;
114 static int hf_nfs_fsinfo_wtmax = -1;
115 static int hf_nfs_fsinfo_wtpref = -1;
116 static int hf_nfs_fsinfo_wtmult = -1;
117 static int hf_nfs_fsinfo_dtpref = -1;
118 static int hf_nfs_fsinfo_maxfilesize = -1;
119 static int hf_nfs_fsinfo_properties = -1;
120 static int hf_nfs_pathconf_linkmax = -1;
121 static int hf_nfs_pathconf_name_max = -1;
122 static int hf_nfs_pathconf_no_trunc = -1;
123 static int hf_nfs_pathconf_chown_restricted = -1;
124 static int hf_nfs_pathconf_case_insensitive = -1;
125 static int hf_nfs_pathconf_case_preserving = -1;
126 static int hf_nfs_data_follows = -1;
128 static int hf_nfs_atime = -1;
129 static int hf_nfs_atime_sec = -1;
130 static int hf_nfs_atime_nsec = -1;
131 static int hf_nfs_atime_usec = -1;
132 static int hf_nfs_mtime = -1;
133 static int hf_nfs_mtime_sec = -1;
134 static int hf_nfs_mtime_nsec = -1;
135 static int hf_nfs_mtime_usec = -1;
136 static int hf_nfs_ctime = -1;
137 static int hf_nfs_ctime_sec = -1;
138 static int hf_nfs_ctime_nsec = -1;
139 static int hf_nfs_ctime_usec = -1;
140 static int hf_nfs_dtime = -1;
141 static int hf_nfs_dtime_sec = -1;
142 static int hf_nfs_dtime_nsec = -1;
144 static int hf_nfs_fattr_type = -1;
145 static int hf_nfs_fattr_nlink = -1;
146 static int hf_nfs_fattr_uid = -1;
147 static int hf_nfs_fattr_gid = -1;
148 static int hf_nfs_fattr_size = -1;
149 static int hf_nfs_fattr_blocksize = -1;
150 static int hf_nfs_fattr_rdev = -1;
151 static int hf_nfs_fattr_blocks = -1;
152 static int hf_nfs_fattr_fsid = -1;
153 static int hf_nfs_fattr_fileid = -1;
154 static int hf_nfs_fattr3_type = -1;
155 static int hf_nfs_fattr3_nlink = -1;
156 static int hf_nfs_fattr3_uid = -1;
157 static int hf_nfs_fattr3_gid = -1;
158 static int hf_nfs_fattr3_size = -1;
159 static int hf_nfs_fattr3_used = -1;
160 static int hf_nfs_fattr3_rdev = -1;
161 static int hf_nfs_fattr3_fsid = -1;
162 static int hf_nfs_fattr3_fileid = -1;
163 static int hf_nfs_wcc_attr_size = -1;
164 static int hf_nfs_set_size3_size = -1;
165 static int hf_nfs_cookie3 = -1;
166 static int hf_nfs_fsstat3_resok_tbytes = -1;
167 static int hf_nfs_fsstat3_resok_fbytes = -1;
168 static int hf_nfs_fsstat3_resok_abytes = -1;
169 static int hf_nfs_fsstat3_resok_tfiles = -1;
170 static int hf_nfs_fsstat3_resok_ffiles = -1;
171 static int hf_nfs_fsstat3_resok_afiles = -1;
172 static int hf_nfs_uid3 = -1;
173 static int hf_nfs_gid3 = -1;
174 static int hf_nfs_offset3 = -1;
175 static int hf_nfs_count3 = -1;
176 static int hf_nfs_count3_maxcount = -1;
177 static int hf_nfs_count3_dircount= -1;
180 static int hf_nfs_argop4 = -1;
181 static int hf_nfs_resop4 = -1;
182 static int hf_nfs_linktext4 = -1;
183 static int hf_nfs_tag4 = -1;
184 static int hf_nfs_component4 = -1;
185 static int hf_nfs_clientid4 = -1;
186 static int hf_nfs_ace4 = -1;
187 static int hf_nfs_recall = -1;
188 static int hf_nfs_open_claim_type4 = -1;
189 static int hf_nfs_opentype4 = -1;
190 static int hf_nfs_limit_by4 = -1;
191 static int hf_nfs_open_delegation_type4 = -1;
192 static int hf_nfs_ftype4 = -1;
193 static int hf_nfs_change_info4_atomic = -1;
194 static int hf_nfs_open4_share_access = -1;
195 static int hf_nfs_open4_share_deny = -1;
196 static int hf_nfs_seqid4 = -1;
197 static int hf_nfs_lock_seqid4 = -1;
198 static int hf_nfs_mand_attr = -1;
199 static int hf_nfs_recc_attr = -1;
200 static int hf_nfs_time_how4 = -1;
201 static int hf_nfs_attrlist4 = -1;
202 static int hf_nfs_fattr4_expire_type = -1;
203 static int hf_nfs_fattr4_link_support = -1;
204 static int hf_nfs_fattr4_symlink_support = -1;
205 static int hf_nfs_fattr4_named_attr = -1;
206 static int hf_nfs_fattr4_unique_handles = -1;
207 static int hf_nfs_fattr4_archive = -1;
208 static int hf_nfs_fattr4_cansettime = -1;
209 static int hf_nfs_fattr4_case_insensitive = -1;
210 static int hf_nfs_fattr4_case_preserving = -1;
211 static int hf_nfs_fattr4_chown_restricted = -1;
212 static int hf_nfs_fattr4_hidden = -1;
213 static int hf_nfs_fattr4_homogeneous = -1;
214 static int hf_nfs_fattr4_mimetype = -1;
215 static int hf_nfs_fattr4_no_trunc = -1;
216 static int hf_nfs_fattr4_system = -1;
217 static int hf_nfs_fattr4_owner = -1;
218 static int hf_nfs_fattr4_owner_group = -1;
219 static int hf_nfs_fattr4_size = -1;
220 static int hf_nfs_fattr4_aclsupport = -1;
221 static int hf_nfs_fattr4_lease_time = -1;
222 static int hf_nfs_fattr4_fileid = -1;
223 static int hf_nfs_fattr4_files_avail = -1;
224 static int hf_nfs_fattr4_files_free = -1;
225 static int hf_nfs_fattr4_files_total = -1;
226 static int hf_nfs_fattr4_maxfilesize = -1;
227 static int hf_nfs_fattr4_maxlink = -1;
228 static int hf_nfs_fattr4_maxname = -1;
229 static int hf_nfs_fattr4_numlinks = -1;
230 static int hf_nfs_fattr4_maxread = -1;
231 static int hf_nfs_fattr4_maxwrite = -1;
232 static int hf_nfs_fattr4_quota_hard = -1;
233 static int hf_nfs_fattr4_quota_soft = -1;
234 static int hf_nfs_fattr4_quota_used = -1;
235 static int hf_nfs_fattr4_space_avail = -1;
236 static int hf_nfs_fattr4_space_free = -1;
237 static int hf_nfs_fattr4_space_total = -1;
238 static int hf_nfs_fattr4_space_used = -1;
239 static int hf_nfs_who = -1;
240 static int hf_nfs_server = -1;
241 static int hf_nfs_stable_how4 = -1;
242 static int hf_nfs_dirlist4_eof = -1;
243 static int hf_nfs_stateid4 = -1;
244 static int hf_nfs_offset4 = -1;
245 static int hf_nfs_specdata1 = -1;
246 static int hf_nfs_specdata2 = -1;
247 static int hf_nfs_lock_type4 = -1;
248 static int hf_nfs_reclaim4 = -1;
249 static int hf_nfs_length4 = -1;
250 static int hf_nfs_changeid4 = -1;
251 static int hf_nfs_nfstime4_seconds = -1;
252 static int hf_nfs_nfstime4_nseconds = -1;
253 static int hf_nfs_fsid4_major = -1;
254 static int hf_nfs_fsid4_minor = -1;
255 static int hf_nfs_acetype4 = -1;
256 static int hf_nfs_aceflag4 = -1;
257 static int hf_nfs_acemask4 = -1;
258 static int hf_nfs_delegate_type = -1;
259 static int hf_nfs_secinfo_flavor = -1;
260 static int hf_nfs_num_blocks = -1;
261 static int hf_nfs_bytes_per_block = -1;
262 static int hf_nfs_eof = -1;
263 static int hf_nfs_stateid4_delegate_stateid = -1;
264 static int hf_nfs_verifier4 = -1;
265 static int hf_nfs_cookie4 = -1;
266 static int hf_nfs_cookieverf4 = -1;
267 static int hf_nfs_cb_program = -1;
268 static int hf_nfs_cb_location = -1;
269 static int hf_nfs_recall4 = -1;
270 static int hf_nfs_filesize = -1;
271 static int hf_nfs_count4 = -1;
272 static int hf_nfs_count4_dircount = -1;
273 static int hf_nfs_count4_maxcount = -1;
274 static int hf_nfs_minorversion = -1;
275 static int hf_nfs_open_owner4 = -1;
276 static int hf_nfs_lock_owner4 = -1;
277 static int hf_nfs_new_lock_owner = -1;
278 static int hf_nfs_sec_oid4 = -1;
279 static int hf_nfs_qop4 = -1;
280 static int hf_nfs_secinfo_rpcsec_gss_info_service = -1;
281 static int hf_nfs_attrdircreate = -1;
282 static int hf_nfs_client_id4_id = -1;
283 static int hf_nfs_stateid4_other = -1;
284 static int hf_nfs_lock4_reclaim = -1;
286 static gint ett_nfs = -1;
287 static gint ett_nfs_fh_encoding = -1;
288 static gint ett_nfs_fh_fsid = -1;
289 static gint ett_nfs_fh_xfsid = -1;
290 static gint ett_nfs_fh_fn = -1;
291 static gint ett_nfs_fh_xfn = -1;
292 static gint ett_nfs_fh_hp = -1;
293 static gint ett_nfs_fh_auth = -1;
294 static gint ett_nfs_fhandle = -1;
295 static gint ett_nfs_timeval = -1;
296 static gint ett_nfs_mode = -1;
297 static gint ett_nfs_fattr = -1;
298 static gint ett_nfs_sattr = -1;
299 static gint ett_nfs_diropargs = -1;
300 static gint ett_nfs_readdir_entry = -1;
301 static gint ett_nfs_mode3 = -1;
302 static gint ett_nfs_specdata3 = -1;
303 static gint ett_nfs_fh3 = -1;
304 static gint ett_nfs_nfstime3 = -1;
305 static gint ett_nfs_fattr3 = -1;
306 static gint ett_nfs_post_op_fh3 = -1;
307 static gint ett_nfs_sattr3 = -1;
308 static gint ett_nfs_diropargs3 = -1;
309 static gint ett_nfs_sattrguard3 = -1;
310 static gint ett_nfs_set_mode3 = -1;
311 static gint ett_nfs_set_uid3 = -1;
312 static gint ett_nfs_set_gid3 = -1;
313 static gint ett_nfs_set_size3 = -1;
314 static gint ett_nfs_set_atime = -1;
315 static gint ett_nfs_set_mtime = -1;
316 static gint ett_nfs_pre_op_attr = -1;
317 static gint ett_nfs_post_op_attr = -1;
318 static gint ett_nfs_wcc_attr = -1;
319 static gint ett_nfs_wcc_data = -1;
320 static gint ett_nfs_access = -1;
321 static gint ett_nfs_fsinfo_properties = -1;
324 static gint ett_nfs_compound_call4 = -1;
325 static gint ett_nfs_utf8string = -1;
326 static gint ett_nfs_argop4 = -1;
327 static gint ett_nfs_resop4 = -1;
328 static gint ett_nfs_access4 = -1;
329 static gint ett_nfs_close4 = -1;
330 static gint ett_nfs_commit4 = -1;
331 static gint ett_nfs_create4 = -1;
332 static gint ett_nfs_delegpurge4 = -1;
333 static gint ett_nfs_delegreturn4 = -1;
334 static gint ett_nfs_getattr4 = -1;
335 static gint ett_nfs_getfh4 = -1;
336 static gint ett_nfs_link4 = -1;
337 static gint ett_nfs_lock4 = -1;
338 static gint ett_nfs_lockt4 = -1;
339 static gint ett_nfs_locku4 = -1;
340 static gint ett_nfs_lookup4 = -1;
341 static gint ett_nfs_lookupp4 = -1;
342 static gint ett_nfs_nverify4 = -1;
343 static gint ett_nfs_open4 = -1;
344 static gint ett_nfs_openattr4 = -1;
345 static gint ett_nfs_open_confirm4 = -1;
346 static gint ett_nfs_open_downgrade4 = -1;
347 static gint ett_nfs_putfh4 = -1;
348 static gint ett_nfs_putpubfh4 = -1;
349 static gint ett_nfs_putrootfh4 = -1;
350 static gint ett_nfs_read4 = -1;
351 static gint ett_nfs_readdir4 = -1;
352 static gint ett_nfs_readlink4 = -1;
353 static gint ett_nfs_remove4 = -1;
354 static gint ett_nfs_rename4 = -1;
355 static gint ett_nfs_renew4 = -1;
356 static gint ett_nfs_restorefh4 = -1;
357 static gint ett_nfs_savefh4 = -1;
358 static gint ett_nfs_secinfo4 = -1;
359 static gint ett_nfs_setattr4 = -1;
360 static gint ett_nfs_setclientid4 = -1;
361 static gint ett_nfs_setclientid_confirm4 = -1;
362 static gint ett_nfs_verify4 = -1;
363 static gint ett_nfs_write4 = -1;
364 static gint ett_nfs_verifier4 = -1;
365 static gint ett_nfs_opaque = -1;
366 static gint ett_nfs_dirlist4 = -1;
367 static gint ett_nfs_pathname4 = -1;
368 static gint ett_nfs_change_info4 = -1;
369 static gint ett_nfs_open_delegation4 = -1;
370 static gint ett_nfs_open_claim4 = -1;
371 static gint ett_nfs_opentype4 = -1;
372 static gint ett_nfs_lock_owner4 = -1;
373 static gint ett_nfs_cb_client4 = -1;
374 static gint ett_nfs_client_id4 = -1;
375 static gint ett_nfs_bitmap4 = -1;
376 static gint ett_nfs_fattr4 = -1;
377 static gint ett_nfs_fsid4 = -1;
378 static gint ett_nfs_fs_locations4 = -1;
379 static gint ett_nfs_fs_location4 = -1;
380 static gint ett_nfs_open4_result_flags = -1;
381 static gint ett_nfs_secinfo4_flavor_info = -1;
382 static gint ett_nfs_stateid4 = -1;
385 /* file name snooping */
386 gboolean nfs_file_name_snooping = FALSE;
387 gboolean nfs_file_name_full_snooping = FALSE;
388 typedef struct nfs_name_snoop {
394 unsigned char *parent;
396 unsigned char *full_name;
399 typedef struct nfs_name_snoop_key {
403 } nfs_name_snoop_key_t;
405 static GMemChunk *nfs_name_snoop_chunk = NULL;
406 static int nfs_name_snoop_init_count = 100;
407 static GHashTable *nfs_name_snoop_unmatched = NULL;
409 static GMemChunk *nfs_name_snoop_key_chunk = NULL;
410 static int nfs_name_snoop_key_init_count = 100;
411 static GHashTable *nfs_name_snoop_matched = NULL;
413 static GHashTable *nfs_name_snoop_known = NULL;
416 nfs_name_snoop_matched_equal(gconstpointer k1, gconstpointer k2)
418 nfs_name_snoop_key_t *key1 = (nfs_name_snoop_key_t *)k1;
419 nfs_name_snoop_key_t *key2 = (nfs_name_snoop_key_t *)k2;
421 return (key1->key==key2->key)
422 &&(key1->fh_len==key2->fh_len)
423 &&(!memcmp(key1->fh, key2->fh, key1->fh_len));
426 nfs_name_snoop_matched_hash(gconstpointer k)
428 nfs_name_snoop_key_t *key = (nfs_name_snoop_key_t *)k;
433 for(i=0;i<key->fh_len;i++)
439 nfs_name_snoop_unmatched_equal(gconstpointer k1, gconstpointer k2)
441 guint32 key1 = (guint32)k1;
442 guint32 key2 = (guint32)k2;
447 nfs_name_snoop_unmatched_hash(gconstpointer k)
449 guint32 key = (guint32)k;
454 nfs_name_snoop_unmatched_free_all(gpointer key_arg, gpointer value, gpointer user_data)
456 nfs_name_snoop_t *nns = (nfs_name_snoop_t *)value;
459 g_free((gpointer)nns->name);
464 g_free((gpointer)nns->full_name);
466 nns->full_name_len=0;
469 g_free((gpointer)nns->parent);
474 g_free((gpointer)nns->fh);
482 nfs_name_snoop_init(void)
484 if (nfs_name_snoop_unmatched != NULL) {
485 g_hash_table_foreach_remove(nfs_name_snoop_unmatched,
486 nfs_name_snoop_unmatched_free_all, NULL);
488 /* The fragment table does not exist. Create it */
489 nfs_name_snoop_unmatched=g_hash_table_new(nfs_name_snoop_unmatched_hash,
490 nfs_name_snoop_unmatched_equal);
492 if (nfs_name_snoop_matched != NULL) {
493 g_hash_table_foreach_remove(nfs_name_snoop_matched,
494 nfs_name_snoop_unmatched_free_all, NULL);
496 /* The fragment table does not exist. Create it */
497 nfs_name_snoop_matched=g_hash_table_new(nfs_name_snoop_matched_hash,
498 nfs_name_snoop_matched_equal);
500 if (nfs_name_snoop_known != NULL) {
501 g_hash_table_foreach_remove(nfs_name_snoop_known,
502 nfs_name_snoop_unmatched_free_all, NULL);
504 /* The fragment table does not exist. Create it */
505 nfs_name_snoop_known=g_hash_table_new(nfs_name_snoop_matched_hash,
506 nfs_name_snoop_matched_equal);
509 if(nfs_name_snoop_chunk){
510 g_mem_chunk_destroy(nfs_name_snoop_chunk);
511 nfs_name_snoop_chunk = NULL;
513 if(nfs_name_snoop_key_chunk){
514 g_mem_chunk_destroy(nfs_name_snoop_key_chunk);
515 nfs_name_snoop_key_chunk = NULL;
518 if(nfs_file_name_snooping){
519 nfs_name_snoop_chunk = g_mem_chunk_new("nfs_name_snoop_chunk",
520 sizeof(nfs_name_snoop_t),
521 nfs_name_snoop_init_count * sizeof(nfs_name_snoop_t),
523 nfs_name_snoop_key_chunk = g_mem_chunk_new("nfs_name_snoop_key_chunk",
524 sizeof(nfs_name_snoop_key_t),
525 nfs_name_snoop_key_init_count * sizeof(nfs_name_snoop_key_t),
532 nfs_name_snoop_add_name(int xid, tvbuff_t *tvb, int name_offset, int name_len, int parent_offset, int parent_len, unsigned char *name)
534 nfs_name_snoop_t *nns, *old_nns;
535 unsigned char *ptr=NULL;
537 /* filter out all '.' and '..' names */
539 ptr=(unsigned char *)tvb_get_ptr(tvb, name_offset, name_len);
552 nns=g_mem_chunk_alloc(nfs_name_snoop_chunk);
558 nns->parent_len=parent_len;
559 nns->parent=g_malloc(parent_len);
560 memcpy(nns->parent, tvb_get_ptr(tvb, parent_offset, parent_len), parent_len);
566 nns->name_len=name_len;
570 nns->name=g_malloc(name_len+1);
571 memcpy(nns->name, ptr, name_len);
573 nns->name[name_len]=0;
575 nns->full_name_len=0;
578 /* remove any old entry for this */
579 old_nns=g_hash_table_lookup(nfs_name_snoop_unmatched, (gconstpointer)xid);
581 /* if we havnt seen the reply yet, then there are no
582 matched entries for it, thus we can dealloc the arrays*/
584 g_free(old_nns->name);
588 g_free(old_nns->parent);
589 old_nns->parent=NULL;
590 old_nns->parent_len=0;
592 g_mem_chunk_free(nfs_name_snoop_chunk, old_nns);
594 g_hash_table_remove(nfs_name_snoop_unmatched, (gconstpointer)xid);
597 g_hash_table_insert(nfs_name_snoop_unmatched, (gpointer)xid, nns);
601 nfs_name_snoop_add_fh(int xid, tvbuff_t *tvb, int fh_offset, int fh_len)
603 nfs_name_snoop_t *nns, *old_nns;
604 nfs_name_snoop_key_t *key;
606 /* find which request we correspond to */
607 nns=g_hash_table_lookup(nfs_name_snoop_unmatched, (gconstpointer)xid);
609 /* oops couldnt find matching request, bail out */
613 /* if we have already seen this response earlier */
618 /* oki, we have a new entry */
619 nns->fh=g_malloc(fh_len);
620 memcpy(nns->fh, tvb_get_ptr(tvb, fh_offset, fh_len), fh_len);
623 key=g_mem_chunk_alloc(nfs_name_snoop_key_chunk);
625 key->fh_len=nns->fh_len;
628 /* already have something matched for this fh, remove it from
630 old_nns=g_hash_table_lookup(nfs_name_snoop_matched, key);
632 g_hash_table_remove(nfs_name_snoop_matched, key);
635 g_hash_table_remove(nfs_name_snoop_unmatched, (gconstpointer)xid);
636 g_hash_table_insert(nfs_name_snoop_matched, key, nns);
640 nfs_full_name_snoop(nfs_name_snoop_t *nns, int *len, unsigned char **name, unsigned char **pos)
642 nfs_name_snoop_t *parent_nns = NULL;
643 nfs_name_snoop_key_t key;
645 /* check if the nns component ends with a '/' else we just allocate
646 an extra byte to len to accommodate for it later */
647 if(nns->name[nns->name_len-1]!='/'){
651 (*len) += nns->name_len;
653 if(nns->parent==NULL){
654 *name = g_malloc((*len)+1);
657 strcpy(*pos, nns->name);
658 *pos += nns->name_len;
663 key.fh_len=nns->parent_len;
666 parent_nns=g_hash_table_lookup(nfs_name_snoop_matched, &key);
669 nfs_full_name_snoop(parent_nns, len, name, pos);
671 /* make sure components are '/' separated */
672 if( (*pos)[-1] != '/'){
677 strcpy(*pos, nns->name);
678 *pos += nns->name_len;
687 nfs_name_snoop_fh(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int fh_offset, int fh_len)
689 nfs_name_snoop_key_t key;
690 nfs_name_snoop_t *nns = NULL;
692 /* if this is a new packet, see if we can register the mapping */
693 if(!pinfo->fd->flags.visited){
696 key.fh=(unsigned char *)tvb_get_ptr(tvb, fh_offset, fh_len);
698 nns=g_hash_table_lookup(nfs_name_snoop_matched, &key);
700 nfs_name_snoop_key_t *k;
701 k=g_mem_chunk_alloc(nfs_name_snoop_key_chunk);
702 k->key=pinfo->fd->num;
703 k->fh_len=nns->fh_len;
705 g_hash_table_insert(nfs_name_snoop_known, k, nns);
707 if(nfs_file_name_full_snooping){
708 unsigned char *name=NULL, *pos=NULL;
711 nfs_full_name_snoop(nns, &len, &name, &pos);
714 nns->full_name_len=len;
720 /* see if we know this mapping */
722 key.key=pinfo->fd->num;
724 key.fh=(unsigned char *)tvb_get_ptr(tvb, fh_offset, fh_len);
726 nns=g_hash_table_lookup(nfs_name_snoop_known, &key);
729 /* if we know the mapping, print the filename */
731 proto_tree_add_string_format(tree, hf_nfs_name, tvb,
732 fh_offset, 0, nns->name, "Name: %s", nns->name);
734 proto_tree_add_string_format(tree, hf_nfs_full_name, tvb,
735 fh_offset, 0, nns->name, "Full Name: %s", nns->full_name);
740 /* file handle dissection */
742 #define FHT_UNKNOWN 0
744 #define FHT_LINUX_KNFSD_LE 2
745 #define FHT_LINUX_NFSD_LE 3
746 #define FHT_LINUX_KNFSD_NEW 4
748 static const value_string names_fhtype[] =
750 { FHT_UNKNOWN, "unknown" },
751 { FHT_SVR4, "System V R4" },
752 { FHT_LINUX_KNFSD_LE, "Linux knfsd (little-endian)" },
753 { FHT_LINUX_NFSD_LE, "Linux user-land nfsd (little-endian)" },
754 { FHT_LINUX_KNFSD_NEW, "Linux knfsd (new)" },
759 /* SVR4: checked with ReliantUNIX (5.43, 5.44, 5.45) */
762 dissect_fhandle_data_SVR4(tvbuff_t* tvb, int offset, proto_tree *tree,
765 guint32 nof = offset;
777 temp = tvb_get_ntohl(tvb, fsid_O);
778 fsid_major = ( temp>>18 ) & 0x3fff; /* 14 bits */
779 fsid_minor = ( temp ) & 0x3ffff; /* 18 bits */
781 proto_item* fsid_item = NULL;
782 proto_tree* fsid_tree = NULL;
784 fsid_item = proto_tree_add_text(tree, tvb,
786 "file system ID: %d,%d", fsid_major, fsid_minor);
788 fsid_tree = proto_item_add_subtree(fsid_item,
790 proto_tree_add_uint(fsid_tree, hf_nfs_fh_fsid_major,
791 tvb, fsid_O, 2, fsid_major);
792 proto_tree_add_uint(fsid_tree, hf_nfs_fh_fsid_minor,
793 tvb, fsid_O+1, 3, fsid_minor);
796 nof = fsid_O + fsid_L;
799 /* file system type */
807 fstype = tvb_get_ntohl(tvb, fstype_O);
809 proto_tree_add_uint(tree, hf_nfs_fh_fstype, tvb,
810 fstype_O, fstype_L, fstype);
812 nof = fstype_O + fstype_L;
822 guint32 fn_data_inode_O;
823 guint32 fn_data_inode_L;
825 guint32 fn_data_gen_O;
826 guint32 fn_data_gen_L;
833 fn_len = tvb_get_ntohs(tvb, fn_len_O);
834 fn_data_O = fn_O + fn_len_L;
835 fn_data_inode_O = fn_data_O + 2;
837 inode = tvb_get_ntohl(tvb, fn_data_inode_O);
838 fn_data_gen_O = fn_data_inode_O + fn_data_inode_L;
840 gen = tvb_get_ntohl(tvb, fn_data_gen_O);
841 fn_L = fn_len_L + fn_len;
843 proto_item* fn_item = NULL;
844 proto_tree* fn_tree = NULL;
846 fn_item = proto_tree_add_uint(tree, hf_nfs_fh_fn, tvb,
849 fn_tree = proto_item_add_subtree(fn_item,
851 proto_tree_add_uint(fn_tree, hf_nfs_fh_fn_len,
852 tvb, fn_len_O, fn_len_L, fn_len);
853 proto_tree_add_uint(fn_tree, hf_nfs_fh_fn_inode,
854 tvb, fn_data_inode_O, fn_data_inode_L, inode);
855 proto_tree_add_uint(fn_tree, hf_nfs_fh_fn_generation,
856 tvb, fn_data_gen_O, fn_data_gen_L, gen);
859 nof = fn_O + fn_len_L + fn_len;
862 /* exported file number */
869 guint32 xfn_data_inode_O;
870 guint32 xfn_data_inode_L;
872 guint32 xfn_data_gen_O;
873 guint32 xfn_data_gen_L;
880 xfn_len = tvb_get_ntohs(tvb, xfn_len_O);
881 xfn_data_O = xfn_O + xfn_len_L;
882 xfn_data_inode_O = xfn_data_O + 2;
883 xfn_data_inode_L = 4;
884 xinode = tvb_get_ntohl(tvb, xfn_data_inode_O);
885 xfn_data_gen_O = xfn_data_inode_O + xfn_data_inode_L;
887 xgen = tvb_get_ntohl(tvb, xfn_data_gen_O);
888 xfn_L = xfn_len_L + xfn_len;
890 proto_item* xfn_item = NULL;
891 proto_tree* xfn_tree = NULL;
893 xfn_item = proto_tree_add_uint(tree, hf_nfs_fh_xfn, tvb,
894 xfn_O, xfn_L, xinode);
896 xfn_tree = proto_item_add_subtree(xfn_item,
898 proto_tree_add_uint(xfn_tree, hf_nfs_fh_xfn_len,
899 tvb, xfn_len_O, xfn_len_L, xfn_len);
900 proto_tree_add_uint(xfn_tree, hf_nfs_fh_xfn_inode,
901 tvb, xfn_data_inode_O, xfn_data_inode_L, xinode);
902 proto_tree_add_uint(xfn_tree, hf_nfs_fh_xfn_generation,
903 tvb, xfn_data_gen_O, xfn_data_gen_L, xgen);
910 /* Checked with RedHat Linux 6.2 (kernel 2.2.14 knfsd) */
913 dissect_fhandle_data_LINUX_KNFSD_LE(tvbuff_t* tvb, int offset, proto_tree *tree,
927 dentry = tvb_get_letohl(tvb, offset+0);
928 inode = tvb_get_letohl(tvb, offset+4);
929 dirinode = tvb_get_letohl(tvb, offset+8);
930 temp = tvb_get_letohs (tvb,offset+12);
931 fsid_major = (temp >> 8) & 0xff;
932 fsid_minor = (temp ) & 0xff;
933 temp = tvb_get_letohs(tvb,offset+16);
934 xfsid_major = (temp >> 8) & 0xff;
935 xfsid_minor = (temp ) & 0xff;
936 xinode = tvb_get_letohl(tvb,offset+20);
937 gen = tvb_get_letohl(tvb,offset+24);
940 proto_tree_add_uint(tree, hf_nfs_fh_dentry,
941 tvb, offset+0, 4, dentry);
942 proto_tree_add_uint(tree, hf_nfs_fh_fn_inode,
943 tvb, offset+4, 4, inode);
944 proto_tree_add_uint(tree, hf_nfs_fh_dirinode,
945 tvb, offset+8, 4, dirinode);
947 /* file system id (device) */
949 proto_item* fsid_item = NULL;
950 proto_tree* fsid_tree = NULL;
952 fsid_item = proto_tree_add_text(tree, tvb,
954 "file system ID: %d,%d", fsid_major, fsid_minor);
956 fsid_tree = proto_item_add_subtree(fsid_item,
958 proto_tree_add_uint(fsid_tree, hf_nfs_fh_fsid_major,
959 tvb, offset+13, 1, fsid_major);
960 proto_tree_add_uint(fsid_tree, hf_nfs_fh_fsid_minor,
961 tvb, offset+12, 1, fsid_minor);
965 /* exported file system id (device) */
967 proto_item* xfsid_item = NULL;
968 proto_tree* xfsid_tree = NULL;
970 xfsid_item = proto_tree_add_text(tree, tvb,
972 "exported file system ID: %d,%d", xfsid_major, xfsid_minor);
974 xfsid_tree = proto_item_add_subtree(xfsid_item,
976 proto_tree_add_uint(xfsid_tree, hf_nfs_fh_xfsid_major,
977 tvb, offset+17, 1, xfsid_major);
978 proto_tree_add_uint(xfsid_tree, hf_nfs_fh_xfsid_minor,
979 tvb, offset+16, 1, xfsid_minor);
983 proto_tree_add_uint(tree, hf_nfs_fh_xfn_inode,
984 tvb, offset+20, 4, xinode);
985 proto_tree_add_uint(tree, hf_nfs_fh_fn_generation,
986 tvb, offset+24, 4, gen);
991 /* Checked with RedHat Linux 5.2 (nfs-server 2.2beta47 user-land nfsd) */
994 dissect_fhandle_data_LINUX_NFSD_LE(tvbuff_t* tvb, int offset, proto_tree *tree,
1000 pinode = tvb_get_letohl(tvb, offset+0);
1002 proto_tree_add_uint(tree, hf_nfs_fh_pinode,
1003 tvb, offset+0, 4, pinode);
1011 hashlen = tvb_get_guint8(tvb, offset+4);
1013 proto_item* hash_item = NULL;
1014 proto_tree* hash_tree = NULL;
1016 hash_item = proto_tree_add_text(tree, tvb, offset+4,
1019 tvb_bytes_to_str(tvb,offset+5,hashlen));
1021 hash_tree = proto_item_add_subtree(hash_item,
1024 proto_tree_add_uint(hash_tree,
1025 hf_nfs_fh_hp_len, tvb, offset+4, 1,
1027 proto_tree_add_text(hash_tree, tvb, offset+5,
1030 tvb_bytes_to_str(tvb,offset+5,hashlen));
1038 /* Checked with SuSE 7.1 (kernel 2.4.0 knfsd) */
1039 /* read linux-2.4.5/include/linux/nfsd/nfsfh.h for more details */
1041 #define AUTH_TYPE_NONE 0
1042 static const value_string auth_type_names[] = {
1043 { AUTH_TYPE_NONE, "no authentication" },
1047 #define FSID_TYPE_MAJOR_MINOR_INODE 0
1048 static const value_string fsid_type_names[] = {
1049 { FSID_TYPE_MAJOR_MINOR_INODE, "major/minor/inode" },
1053 #define FILEID_TYPE_ROOT 0
1054 #define FILEID_TYPE_INODE_GENERATION 1
1055 #define FILEID_TYPE_INODE_GENERATION_PARENT 2
1056 static const value_string fileid_type_names[] = {
1057 { FILEID_TYPE_ROOT, "root" },
1058 { FILEID_TYPE_INODE_GENERATION, "inode/generation" },
1059 { FILEID_TYPE_INODE_GENERATION_PARENT, "inode/generation/parent" },
1064 dissect_fhandle_data_LINUX_KNFSD_NEW(tvbuff_t* tvb, int offset, proto_tree *tree,
1072 version = tvb_get_guint8(tvb, offset + 0);
1074 proto_tree_add_uint(tree, hf_nfs_fh_version,
1075 tvb, offset+0, 1, version);
1080 auth_type = tvb_get_guint8(tvb, offset + 1);
1081 fsid_type = tvb_get_guint8(tvb, offset + 2);
1082 fileid_type = tvb_get_guint8(tvb, offset + 3);
1084 proto_item* encoding_item = proto_tree_add_text(tree, tvb,
1086 "encoding: %u %u %u",
1087 auth_type, fsid_type, fileid_type);
1088 if (encoding_item) {
1089 proto_tree* encoding_tree = proto_item_add_subtree(encoding_item,
1090 ett_nfs_fh_encoding);
1091 if (encoding_tree) {
1092 proto_tree_add_uint(encoding_tree, hf_nfs_fh_auth_type,
1093 tvb, offset+1, 1, auth_type);
1094 proto_tree_add_uint(encoding_tree, hf_nfs_fh_fsid_type,
1095 tvb, offset+2, 1, fsid_type);
1096 proto_tree_add_uint(encoding_tree, hf_nfs_fh_fileid_type,
1097 tvb, offset+3, 1, fileid_type);
1104 /* unknown version */
1109 switch (auth_type) {
1111 /* no authentication */
1113 proto_tree_add_text(tree, tvb,
1115 "authentication: none");
1119 /* unknown authentication type */
1124 switch (fsid_type) {
1130 fsid_major = tvb_get_ntohs(tvb, offset + 0);
1131 fsid_minor = tvb_get_ntohs(tvb, offset + 2);
1132 fsid_inode = tvb_get_letohl(tvb, offset + 4);
1134 proto_item* fsid_item = proto_tree_add_text(tree, tvb,
1136 "file system ID: %u,%u (inode %u)",
1137 fsid_major, fsid_minor, fsid_inode);
1139 proto_tree* fsid_tree = proto_item_add_subtree(fsid_item,
1142 proto_tree_add_uint(fsid_tree, hf_nfs_fh_fsid_major,
1143 tvb, offset+0, 2, fsid_major);
1144 proto_tree_add_uint(fsid_tree, hf_nfs_fh_fsid_minor,
1145 tvb, offset+2, 2, fsid_minor);
1146 proto_tree_add_uint(fsid_tree, hf_nfs_fh_fsid_inode,
1147 tvb, offset+4, 4, fsid_inode);
1154 /* unknown fsid type */
1159 switch (fileid_type) {
1162 proto_tree_add_text(tree, tvb,
1164 "file ID: root inode");
1171 inode = tvb_get_letohl(tvb, offset + 0);
1172 generation = tvb_get_letohl(tvb, offset + 4);
1175 proto_item* fileid_item = proto_tree_add_text(tree, tvb,
1180 proto_tree* fileid_tree = proto_item_add_subtree(
1181 fileid_item, ett_nfs_fh_fn);
1183 proto_tree_add_uint(fileid_tree, hf_nfs_fh_fn_inode,
1184 tvb, offset+0, 4, inode);
1185 proto_tree_add_uint(fileid_tree, hf_nfs_fh_fn_generation,
1186 tvb, offset+4, 4, generation);
1196 guint32 parent_inode;
1198 inode = tvb_get_letohl(tvb, offset + 0);
1199 generation = tvb_get_letohl(tvb, offset + 4);
1200 parent_inode = tvb_get_letohl(tvb, offset + 8);
1203 proto_item* fileid_item = proto_tree_add_text(tree, tvb,
1208 proto_tree* fileid_tree = proto_item_add_subtree(
1209 fileid_item, ett_nfs_fh_fn);
1211 proto_tree_add_uint(fileid_tree, hf_nfs_fh_fn_inode,
1212 tvb, offset+0, 4, inode);
1213 proto_tree_add_uint(fileid_tree, hf_nfs_fh_fn_generation,
1214 tvb, offset+4, 4, generation);
1215 proto_tree_add_uint(fileid_tree, hf_nfs_fh_dirinode,
1216 tvb, offset+8, 4, parent_inode);
1224 /* unknown fileid type */
1235 dissect_fhandle_data_unknown(tvbuff_t *tvb, int offset, proto_tree *tree,
1240 gboolean first_line;
1244 while (bytes_left != 0) {
1246 if (sublen > bytes_left)
1247 sublen = bytes_left;
1248 proto_tree_add_text(tree, tvb, offset, sublen,
1250 first_line ? "data: " :
1252 tvb_bytes_to_str(tvb,offset,sublen));
1253 bytes_left -= sublen;
1261 dissect_fhandle_data(tvbuff_t *tvb, int offset, packet_info *pinfo,
1262 proto_tree *tree, unsigned int fhlen)
1264 unsigned int fhtype = FHT_UNKNOWN;
1266 /* filehandle too long */
1267 if (fhlen>64) goto type_ready;
1268 /* Not all bytes there. Any attempt to deduce the type would be
1270 if (!tvb_bytes_exist(tvb,offset,fhlen)) goto type_ready;
1272 /* create a semiunique hash value for the filehandle */
1277 for(fhhash=0,i=0;i<(fhlen-3);i+=4){
1278 fhhash ^= tvb_get_ntohl(tvb, offset+i);
1280 proto_tree_add_uint(tree, hf_nfs_fh_hash, tvb, offset, fhlen,
1283 if(nfs_file_name_snooping){
1284 nfs_name_snoop_fh(pinfo, tree, tvb, offset, fhlen);
1287 /* calculate (heuristically) fhtype */
1290 if (tvb_get_ntohl(tvb,offset) == 0x01000000) {
1291 fhtype=FHT_LINUX_KNFSD_NEW;
1295 if (tvb_get_ntohl(tvb,offset) == 0x01000001) {
1296 fhtype=FHT_LINUX_KNFSD_NEW;
1300 if (tvb_get_ntohl(tvb,offset) == 0x01000002) {
1301 fhtype=FHT_LINUX_KNFSD_NEW;
1307 if (tvb_get_ntohs(tvb,offset+4) == 0) {
1308 len1=tvb_get_ntohs(tvb,offset+8);
1309 if (tvb_bytes_exist(tvb,offset+10+len1,2)) {
1310 len2=tvb_get_ntohs(tvb,
1312 if (fhlen==12+len1+len2) {
1318 len1 = tvb_get_guint8(tvb,offset+4);
1319 if (len1<28 && tvb_bytes_exist(tvb,offset+5,len1)) {
1321 for (len2=5+len1;len2<32;len2++) {
1322 if (tvb_get_guint8(tvb,offset+len2)) {
1328 fhtype=FHT_LINUX_NFSD_LE;
1332 if (tvb_get_ntohl(tvb,offset+28) == 0) {
1333 if (tvb_get_ntohs(tvb,offset+14) == 0) {
1334 if (tvb_get_ntohs(tvb,offset+18) == 0) {
1335 fhtype=FHT_LINUX_KNFSD_LE;
1345 proto_tree_add_text(tree, tvb, offset, 0,
1346 "type: %s", val_to_str(fhtype, names_fhtype, "Unknown"));
1350 dissect_fhandle_data_SVR4 (tvb, offset, tree,
1353 case FHT_LINUX_KNFSD_LE:
1354 dissect_fhandle_data_LINUX_KNFSD_LE(tvb, offset, tree,
1357 case FHT_LINUX_NFSD_LE:
1358 dissect_fhandle_data_LINUX_NFSD_LE (tvb, offset, tree,
1361 case FHT_LINUX_KNFSD_NEW:
1362 dissect_fhandle_data_LINUX_KNFSD_NEW (tvb, offset, tree,
1367 dissect_fhandle_data_unknown(tvb, offset, tree, fhlen);
1373 /***************************/
1374 /* NFS Version 2, RFC 1094 */
1375 /***************************/
1378 /* RFC 1094, Page 12..14 */
1379 const value_string names_nfs_stat[] =
1386 { 13, "ERR_ACCES" },
1387 { 17, "ERR_EXIST" },
1388 { 18, "ERR_XDEV" }, /* not in spec, but can happen */
1389 { 19, "ERR_NODEV" },
1390 { 20, "ERR_NOTDIR" },
1391 { 21, "ERR_ISDIR" },
1392 { 22, "ERR_INVAL" }, /* not in spec, but I think it can happen */
1393 { 26, "ERR_TXTBSY" }, /* not in spec, but I think it can happen */
1395 { 28, "ERR_NOSPC" },
1397 { 31, "ERR_MLINK" }, /* not in spec, but can happen */
1398 { 45, "ERR_OPNOTSUPP" }, /* not in spec, but I think it can happen */
1399 { 63, "ERR_NAMETOOLONG" },
1400 { 66, "ERR_NOTEMPTY" },
1401 { 69, "ERR_DQUOT" },
1402 { 70, "ERR_STALE" },
1403 { 99, "ERR_WFLUSH" },
1407 /* NFSv4 Draft Specification, Page 198-199 */
1408 const value_string names_nfs_stat4[] = {
1410 { 1, "NFS4ERR_PERM" },
1411 { 2, "NFS4ERR_NOENT" },
1412 { 5, "NFS4ERR_IO" },
1413 { 6, "NFS4ERR_NXIO" },
1414 { 13, "NFS4ERR_ACCES" },
1415 { 17, "NFS4ERR_EXIST" },
1416 { 18, "NFS4ERR_XDEV" },
1417 { 19, "NFS4ERR_NODEV" },
1418 { 20, "NFS4ERR_NOTDIR" },
1419 { 21, "NFS4ERR_ISDIR" },
1420 { 22, "NFS4ERR_INVAL" },
1421 { 27, "NFS4ERR_FBIG" },
1422 { 28, "NFS4ERR_NOSPC" },
1423 { 30, "NFS4ERR_ROFS" },
1424 { 31, "NFS4ERR_MLINK" },
1425 { 63, "NFS4ERR_NAMETOOLONG" },
1426 { 66, "NFS4ERR_NOTEMPTY" },
1427 { 69, "NFS4ERR_DQUOT" },
1428 { 70, "NFS4ERR_STALE" },
1429 { 10001, "NFS4ERR_BADHANDLE" },
1430 { 10003, "NFS4ERR_BAD_COOKIE" },
1431 { 10004, "NFS4ERR_NOTSUPP" },
1432 { 10005, "NFS4ERR_TOOSMALL" },
1433 { 10006, "NFS4ERR_SERVERFAULT" },
1434 { 10007, "NFS4ERR_BADTYPE" },
1435 { 10008, "NFS4ERR_DELAY" },
1436 { 10009, "NFS4ERR_SAME" },
1437 { 10010, "NFS4ERR_DENIED" },
1438 { 10011, "NFS4ERR_EXPIRED" },
1439 { 10012, "NFS4ERR_LOCKED" },
1440 { 10013, "NFS4ERR_GRACE" },
1441 { 10014, "NFS4ERR_FHEXPIRED" },
1442 { 10015, "NFS4ERR_SHARE_DENIED" },
1443 { 10016, "NFS4ERR_WRONGSEC" },
1444 { 10017, "NFS4ERR_CLID_INUSE" },
1445 { 10018, "NFS4ERR_RESOURCE" },
1446 { 10019, "NFS4ERR_MOVED" },
1447 { 10020, "NFS4ERR_NOFILEHANDLE" },
1448 { 10021, "NFS4ERR_MINOR_VERS_MISMATCH" },
1449 { 10022, "NFS4ERR_STALE_CLIENTID" },
1450 { 10023, "NFS4ERR_STALE_STATEID" },
1451 { 10024, "NFS4ERR_OLD_STATEID" },
1452 { 10025, "NFS4ERR_BAD_STATEID" },
1453 { 10026, "NFS4ERR_BAD_SEQID" },
1454 { 10027, "NFS4ERR_NOT_SAME" },
1455 { 10028, "NFS4ERR_LOCK_RANGE" },
1456 { 10029, "NFS4ERR_SYMLINK" },
1457 { 10030, "NFS4ERR_READDIR_NOSPC" },
1458 { 10031, "NFS4ERR_LEASE_MOVED" },
1459 { 10032, "NFS4ERR_ATTRNOTSUPP" },
1460 { 10033, "NFS4ERR_NO_GRACE" },
1461 { 10034, "NFS4ERR_RECLAIM_BAD" },
1462 { 10035, "NFS4ERR_RECLAIM_CONFLICT" },
1463 { 10036, "NFS4ERR_BADXDR" },
1464 { 10037, "NFS4ERR_LOCKS_HELD" },
1469 /* This function has been modified to support NFSv4 style error codes as
1470 * well as being backwards compatible with NFSv2 and NFSv3.
1473 dissect_stat_internal(tvbuff_t *tvb, int offset, packet_info *pinfo,
1474 proto_tree *tree, guint32* status, int nfsvers)
1478 stat = tvb_get_ntohl(tvb, offset+0);
1481 /* this gives the right NFSv2 number<->message relation */
1482 /* and makes it searchable via "nfs.status" */
1483 proto_tree_add_uint_format(tree, hf_nfs_nfsstat3, tvb,
1484 offset+0, 4, stat, "Status: %s (%u)",
1486 (nfsvers != 4)? names_nfs_stat: names_nfs_stat4,"%u"), stat);
1491 if (status) *status = stat;
1497 /* RFC 1094, Page 12..14 */
1499 dissect_stat(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree,
1502 return dissect_stat_internal(tvb, offset, pinfo, tree, status, !4);
1506 /* RFC 1094, Page 12..14 */
1508 dissect_nfs2_stat_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree* tree)
1512 offset = dissect_stat(tvb, offset, pinfo, tree, &status);
1519 dissect_nfs_nfsstat4(tvbuff_t *tvb, int offset, packet_info *pinfo,
1520 proto_tree *tree, guint32 *status)
1522 return dissect_stat_internal(tvb, offset, pinfo, tree, status, 4);
1526 /* RFC 1094, Page 15 */
1528 dissect_ftype(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree,
1532 char* ftype_name = NULL;
1534 const value_string nfs2_ftype[] =
1537 { 1, "Regular File" },
1539 { 3, "Block Special Device" },
1540 { 4, "Character Special Device" },
1541 { 5, "Symbolic Link" },
1545 ftype = tvb_get_ntohl(tvb, offset+0);
1546 ftype_name = val_to_str(ftype, nfs2_ftype, "%u");
1549 proto_tree_add_text(tree, tvb, offset, 4,
1550 "%s: %s (%u)", name, ftype_name, ftype);
1558 /* RFC 1094, Page 15 */
1560 dissect_fhandle(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree,
1564 proto_tree* ftree = NULL;
1567 fitem = proto_tree_add_text(tree, tvb, offset, FHSIZE,
1570 ftree = proto_item_add_subtree(fitem, ett_nfs_fhandle);
1573 /* are we snooping fh to filenames ?*/
1574 if((!pinfo->fd->flags.visited) && nfs_file_name_snooping){
1575 rpc_call_info_value *civ=pinfo->private_data;
1577 /* NFS v2 LOOKUP, CREATE, MKDIR calls might give us a mapping*/
1578 if( (civ->prog==100003)
1581 &&((civ->proc==4)||(civ->proc==9)||(civ->proc==14))
1583 nfs_name_snoop_add_fh(civ->xid, tvb,
1587 /* MOUNT v1,v2 MNT replies might give us a filehandle*/
1588 if( (civ->prog==100005)
1590 &&((civ->vers==1)||(civ->vers==2))
1593 nfs_name_snoop_add_fh(civ->xid, tvb,
1598 dissect_fhandle_data(tvb, offset, pinfo, ftree, FHSIZE);
1604 /* RFC 1094, Page 15 */
1606 dissect_nfs2_fhandle_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
1608 offset = dissect_fhandle(tvb, offset, pinfo, tree, "object");
1614 /* RFC 1094, Page 15 */
1616 dissect_timeval(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, int hf_time, int hf_time_sec, int hf_time_usec)
1622 proto_item* time_item;
1623 proto_tree* time_tree = NULL;
1625 seconds = tvb_get_ntohl(tvb, offset+0);
1626 useconds = tvb_get_ntohl(tvb, offset+4);
1628 ts.nsecs = useconds*1000;
1631 time_item = proto_tree_add_time(tree, hf_time, tvb, offset, 8,
1634 time_tree = proto_item_add_subtree(time_item, ett_nfs_timeval);
1638 proto_tree_add_uint(time_tree, hf_time_sec, tvb, offset, 4,
1640 proto_tree_add_uint(time_tree, hf_time_usec, tvb, offset+4, 4,
1648 /* RFC 1094, Page 16 */
1649 const value_string nfs2_mode_names[] = {
1650 { 0040000, "Directory" },
1651 { 0020000, "Character Special Device" },
1652 { 0060000, "Block Special Device" },
1653 { 0100000, "Regular File" },
1654 { 0120000, "Symbolic Link" },
1655 { 0140000, "Named Socket" },
1660 dissect_mode(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree,
1664 proto_item* mode_item = NULL;
1665 proto_tree* mode_tree = NULL;
1667 mode = tvb_get_ntohl(tvb, offset+0);
1670 mode_item = proto_tree_add_text(tree, tvb, offset, 4,
1671 "%s: 0%o", name, mode);
1673 mode_tree = proto_item_add_subtree(mode_item, ett_nfs_mode);
1677 proto_tree_add_text(mode_tree, tvb, offset, 4, "%s",
1678 decode_enumerated_bitfield(mode, 0160000, 16,
1679 nfs2_mode_names, "%s"));
1680 proto_tree_add_text(mode_tree, tvb, offset, 4, "%s",
1681 decode_boolean_bitfield(mode, 04000, 16, "Set user id on exec", "not SUID"));
1682 proto_tree_add_text(mode_tree, tvb, offset, 4, "%s",
1683 decode_boolean_bitfield(mode, 02000, 16, "Set group id on exec", "not SGID"));
1684 proto_tree_add_text(mode_tree, tvb, offset, 4, "%s",
1685 decode_boolean_bitfield(mode, 01000, 16, "Save swapped text even after use", "not save swapped text"));
1686 proto_tree_add_text(mode_tree, tvb, offset, 4, "%s",
1687 decode_boolean_bitfield(mode, 0400, 16, "Read permission for owner", "no Read permission for owner"));
1688 proto_tree_add_text(mode_tree, tvb, offset, 4, "%s",
1689 decode_boolean_bitfield(mode, 0200, 16, "Write permission for owner", "no Write permission for owner"));
1690 proto_tree_add_text(mode_tree, tvb, offset, 4, "%s",
1691 decode_boolean_bitfield(mode, 0100, 16, "Execute permission for owner", "no Execute permission for owner"));
1692 proto_tree_add_text(mode_tree, tvb, offset, 4, "%s",
1693 decode_boolean_bitfield(mode, 040, 16, "Read permission for group", "no Read permission for group"));
1694 proto_tree_add_text(mode_tree, tvb, offset, 4, "%s",
1695 decode_boolean_bitfield(mode, 020, 16, "Write permission for group", "no Write permission for group"));
1696 proto_tree_add_text(mode_tree, tvb, offset, 4, "%s",
1697 decode_boolean_bitfield(mode, 010, 16, "Execute permission for group", "no Execute permission for group"));
1698 proto_tree_add_text(mode_tree, tvb, offset, 4, "%s",
1699 decode_boolean_bitfield(mode, 04, 16, "Read permission for others", "no Read permission for others"));
1700 proto_tree_add_text(mode_tree, tvb, offset, 4, "%s",
1701 decode_boolean_bitfield(mode, 02, 16, "Write permission for others", "no Write permission for others"));
1702 proto_tree_add_text(mode_tree, tvb, offset, 4, "%s",
1703 decode_boolean_bitfield(mode, 01, 16, "Execute permission for others", "no Execute permission for others"));
1711 /* RFC 1094, Page 15 */
1713 dissect_fattr(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, char* name)
1715 proto_item* fattr_item = NULL;
1716 proto_tree* fattr_tree = NULL;
1717 int old_offset = offset;
1720 fattr_item = proto_tree_add_text(tree, tvb, offset, -1,
1722 fattr_tree = proto_item_add_subtree(fattr_item, ett_nfs_fattr);
1725 offset = dissect_ftype(tvb, offset, pinfo, fattr_tree, "type");
1726 offset = dissect_mode(tvb, offset, pinfo, fattr_tree, "mode");
1727 offset = dissect_rpc_uint32(tvb, pinfo, fattr_tree, hf_nfs_fattr_nlink, offset);
1728 offset = dissect_rpc_uint32(tvb, pinfo, fattr_tree, hf_nfs_fattr_uid, offset);
1729 offset = dissect_rpc_uint32(tvb, pinfo, fattr_tree, hf_nfs_fattr_gid, offset);
1730 offset = dissect_rpc_uint32(tvb, pinfo, fattr_tree, hf_nfs_fattr_size, offset);
1731 offset = dissect_rpc_uint32(tvb, pinfo, fattr_tree, hf_nfs_fattr_blocksize, offset);
1732 offset = dissect_rpc_uint32(tvb, pinfo, fattr_tree, hf_nfs_fattr_rdev, offset);
1733 offset = dissect_rpc_uint32(tvb, pinfo, fattr_tree, hf_nfs_fattr_blocks, offset);
1734 offset = dissect_rpc_uint32(tvb, pinfo, fattr_tree, hf_nfs_fattr_fsid, offset);
1735 offset = dissect_rpc_uint32(tvb, pinfo, fattr_tree, hf_nfs_fattr_fileid, offset);
1737 offset = dissect_timeval(tvb, offset, pinfo, fattr_tree, hf_nfs_atime, hf_nfs_atime_sec, hf_nfs_atime_usec);
1738 offset = dissect_timeval(tvb, offset, pinfo, fattr_tree, hf_nfs_mtime, hf_nfs_mtime_sec, hf_nfs_mtime_usec);
1739 offset = dissect_timeval(tvb, offset, pinfo, fattr_tree, hf_nfs_ctime, hf_nfs_ctime_sec, hf_nfs_ctime_usec);
1741 /* now we know, that fattr is shorter */
1743 proto_item_set_len(fattr_item, offset - old_offset);
1750 /* RFC 1094, Page 17 */
1752 dissect_sattr(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, char* name)
1754 proto_item* sattr_item = NULL;
1755 proto_tree* sattr_tree = NULL;
1756 int old_offset = offset;
1759 sattr_item = proto_tree_add_text(tree, tvb, offset, -1,
1761 sattr_tree = proto_item_add_subtree(sattr_item, ett_nfs_sattr);
1764 if (tvb_get_ntohl(tvb, offset+0) != 0xffffffff)
1765 offset = dissect_mode(tvb, offset, pinfo, sattr_tree, "mode");
1767 proto_tree_add_text(sattr_tree, tvb, offset, 4, "mode: no value");
1771 if (tvb_get_ntohl(tvb, offset+0) != 0xffffffff)
1772 offset = dissect_rpc_uint32(tvb, pinfo, sattr_tree, hf_nfs_fattr_uid,
1775 proto_tree_add_text(sattr_tree, tvb, offset, 4, "uid: no value");
1779 if (tvb_get_ntohl(tvb, offset+0) != 0xffffffff)
1780 offset = dissect_rpc_uint32(tvb, pinfo, sattr_tree, hf_nfs_fattr_gid,
1783 proto_tree_add_text(sattr_tree, tvb, offset, 4, "gid: no value");
1787 if (tvb_get_ntohl(tvb, offset+0) != 0xffffffff)
1788 offset = dissect_rpc_uint32(tvb, pinfo, sattr_tree, hf_nfs_fattr_size,
1791 proto_tree_add_text(sattr_tree, tvb, offset, 4, "size: no value");
1795 if (tvb_get_ntohl(tvb, offset+0) != 0xffffffff) {
1796 offset = dissect_timeval(tvb, offset, pinfo, sattr_tree, hf_nfs_atime, hf_nfs_atime_sec, hf_nfs_atime_usec);
1798 proto_tree_add_text(sattr_tree, tvb, offset, 8, "atime: no value");
1802 if (tvb_get_ntohl(tvb, offset+0) != 0xffffffff) {
1803 offset = dissect_timeval(tvb, offset, pinfo, sattr_tree, hf_nfs_mtime, hf_nfs_mtime_sec, hf_nfs_mtime_usec);
1805 proto_tree_add_text(sattr_tree, tvb, offset, 8, "mtime: no value");
1809 /* now we know, that sattr is shorter */
1811 proto_item_set_len(sattr_item, offset - old_offset);
1818 /* RFC 1094, Page 17 */
1820 dissect_filename(tvbuff_t *tvb, int offset, packet_info *pinfo,
1821 proto_tree *tree, int hf, char **string_ret)
1823 offset = dissect_rpc_string(tvb, pinfo, tree, hf, offset, string_ret);
1828 /* RFC 1094, Page 17 */
1830 dissect_path(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, int hf)
1832 offset = dissect_rpc_string(tvb, pinfo, tree, hf, offset, NULL);
1837 /* RFC 1094, Page 17,18 */
1839 dissect_attrstat(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree){
1842 offset = dissect_stat(tvb, offset, pinfo, tree, &status);
1845 offset = dissect_fattr(tvb, offset, pinfo, tree, "attributes");
1856 /* RFC 1094, Page 17,18 */
1858 dissect_nfs2_attrstat_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree* tree)
1860 offset = dissect_attrstat(tvb, offset, pinfo, tree);
1866 /* RFC 1094, Page 18 */
1868 dissect_diropargs(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, char* name)
1870 proto_item* diropargs_item = NULL;
1871 proto_tree* diropargs_tree = NULL;
1872 int old_offset = offset;
1875 diropargs_item = proto_tree_add_text(tree, tvb, offset, -1,
1877 diropargs_tree = proto_item_add_subtree(diropargs_item, ett_nfs_diropargs);
1880 /* are we snooping fh to filenames ?*/
1881 if((!pinfo->fd->flags.visited) && nfs_file_name_snooping){
1882 /* v2 LOOKUP, CREATE, MKDIR calls might give us a mapping*/
1883 rpc_call_info_value *civ=pinfo->private_data;
1885 if( (civ->prog==100003)
1888 &&((civ->proc==4)||(civ->proc==9)||(civ->proc==14))
1890 nfs_name_snoop_add_name(civ->xid, tvb,
1891 offset+36, tvb_get_ntohl(tvb, offset+32),
1896 offset = dissect_fhandle (tvb,offset,pinfo,diropargs_tree,"dir");
1897 offset = dissect_filename(tvb,offset,pinfo,diropargs_tree,hf_nfs_name,NULL);
1899 /* now we know, that diropargs is shorter */
1900 if (diropargs_item) {
1901 proto_item_set_len(diropargs_item, offset - old_offset);
1908 /* RFC 1094, Page 18 */
1910 dissect_nfs2_diropargs_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
1912 offset = dissect_diropargs(tvb, offset, pinfo, tree, "where");
1918 /* RFC 1094, Page 18 */
1920 dissect_diropres(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
1924 offset = dissect_stat(tvb, offset, pinfo, tree, &status);
1927 offset = dissect_fhandle(tvb, offset, pinfo, tree, "file");
1928 offset = dissect_fattr (tvb, offset, pinfo, tree, "attributes");
1939 /* nfsdata is simply a chunk of RPC opaque data (length, data, fill bytes) */
1941 dissect_nfsdata(tvbuff_t *tvb, int offset, packet_info *pinfo,
1942 proto_tree *tree, int hf)
1944 offset = dissect_rpc_data(tvb, pinfo, tree, hf, offset);
1949 /* RFC 1094, Page 18 */
1951 dissect_nfs2_diropres_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
1954 offset = dissect_diropres(tvb, offset, pinfo, tree);
1959 /* RFC 1094, Page 6 */
1961 dissect_nfs2_setattr_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
1964 offset = dissect_fhandle(tvb, offset, pinfo, tree, "file" );
1965 offset = dissect_sattr (tvb, offset, pinfo, tree, "attributes");
1971 /* RFC 1094, Page 6 */
1973 dissect_nfs2_readlink_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
1978 offset = dissect_stat(tvb, offset, pinfo, tree, &status);
1981 offset = dissect_path(tvb, offset, pinfo, tree, hf_nfs_readlink_data);
1992 /* RFC 1094, Page 7 */
1994 dissect_nfs2_read_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
1997 guint32 offset_value;
2001 offset = dissect_fhandle(tvb, offset, pinfo, tree, "file" );
2002 offset_value = tvb_get_ntohl(tvb, offset+0);
2003 count = tvb_get_ntohl(tvb, offset+4);
2004 totalcount = tvb_get_ntohl(tvb, offset+8);
2006 proto_tree_add_uint(tree, hf_nfs_read_offset, tvb,
2007 offset+0, 4, offset_value);
2008 proto_tree_add_uint(tree, hf_nfs_read_count, tvb,
2009 offset+4, 4, count);
2010 proto_tree_add_uint(tree, hf_nfs_read_totalcount, tvb,
2011 offset+8, 4, totalcount);
2019 /* RFC 1094, Page 7 */
2021 dissect_nfs2_read_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
2026 offset = dissect_stat(tvb, offset, pinfo, tree, &status);
2029 offset = dissect_fattr(tvb, offset, pinfo, tree, "attributes");
2030 offset = dissect_nfsdata(tvb, offset, pinfo, tree, hf_nfs_data);
2041 /* RFC 1094, Page 8 */
2043 dissect_nfs2_write_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
2046 guint32 beginoffset;
2047 guint32 offset_value;
2050 offset = dissect_fhandle(tvb, offset, pinfo, tree, "file" );
2051 beginoffset = tvb_get_ntohl(tvb, offset+0);
2052 offset_value = tvb_get_ntohl(tvb, offset+4);
2053 totalcount = tvb_get_ntohl(tvb, offset+8);
2055 proto_tree_add_uint(tree, hf_nfs_write_beginoffset, tvb,
2056 offset+0, 4, beginoffset);
2057 proto_tree_add_uint(tree, hf_nfs_write_offset, tvb,
2058 offset+4, 4, offset_value);
2059 proto_tree_add_uint(tree, hf_nfs_write_totalcount, tvb,
2060 offset+8, 4, totalcount);
2064 offset = dissect_nfsdata(tvb, offset, pinfo, tree, hf_nfs_data);
2070 /* RFC 1094, Page 8 */
2072 dissect_nfs2_createargs_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
2075 offset = dissect_diropargs(tvb, offset, pinfo, tree, "where" );
2076 offset = dissect_sattr (tvb, offset, pinfo, tree, "attributes");
2082 /* RFC 1094, Page 9 */
2084 dissect_nfs2_rename_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
2087 offset = dissect_diropargs(tvb, offset, pinfo, tree, "from");
2088 offset = dissect_diropargs(tvb, offset, pinfo, tree, "to" );
2094 /* RFC 1094, Page 9 */
2096 dissect_nfs2_link_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
2099 offset = dissect_fhandle (tvb, offset, pinfo, tree, "from");
2100 offset = dissect_diropargs(tvb, offset, pinfo, tree, "to" );
2106 /* RFC 1094, Page 10 */
2108 dissect_nfs2_symlink_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
2111 offset = dissect_diropargs(tvb, offset, pinfo, tree, "from" );
2112 offset = dissect_path (tvb, offset, pinfo, tree, hf_nfs_symlink_to);
2113 offset = dissect_sattr (tvb, offset, pinfo, tree, "attributes" );
2119 /* RFC 1094, Page 11 */
2121 dissect_nfs2_readdir_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
2127 offset = dissect_fhandle (tvb, offset, pinfo, tree, "dir");
2128 cookie = tvb_get_ntohl(tvb, offset+ 0);
2129 count = tvb_get_ntohl(tvb, offset+ 4);
2131 proto_tree_add_uint(tree, hf_nfs_readdir_cookie, tvb,
2132 offset+ 0, 4, cookie);
2133 proto_tree_add_uint(tree, hf_nfs_readdir_count, tvb,
2134 offset+ 4, 4, count);
2142 /* RFC 1094, Page 11 */
2144 dissect_readdir_entry(tvbuff_t *tvb, int offset, packet_info *pinfo,
2147 proto_item* entry_item = NULL;
2148 proto_tree* entry_tree = NULL;
2149 int old_offset = offset;
2155 entry_item = proto_tree_add_item(tree, hf_nfs_readdir_entry, tvb,
2156 offset+0, -1, FALSE);
2157 entry_tree = proto_item_add_subtree(entry_item, ett_nfs_readdir_entry);
2160 fileid = tvb_get_ntohl(tvb, offset + 0);
2162 proto_tree_add_uint(entry_tree, hf_nfs_readdir_entry_fileid, tvb,
2163 offset+0, 4, fileid);
2166 offset = dissect_filename(tvb, offset, pinfo, entry_tree,
2167 hf_nfs_readdir_entry_name, &name);
2169 proto_item_set_text(entry_item, "Entry: file ID %u, name %s",
2173 cookie = tvb_get_ntohl(tvb, offset + 0);
2175 proto_tree_add_uint(entry_tree, hf_nfs_readdir_entry_cookie, tvb,
2176 offset+0, 4, cookie);
2179 /* now we know, that a readdir entry is shorter */
2181 proto_item_set_len(entry_item, offset - old_offset);
2187 /* RFC 1094, Page 11 */
2189 dissect_nfs2_readdir_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
2195 offset = dissect_stat(tvb, offset, pinfo, tree, &status);
2198 offset = dissect_rpc_list(tvb, pinfo, tree, offset,
2199 dissect_readdir_entry);
2200 eof_value = tvb_get_ntohl(tvb, offset+0);
2202 proto_tree_add_uint(tree, hf_nfs_readdir_eof, tvb,
2203 offset+ 0, 4, eof_value);
2215 /* RFC 1094, Page 12 */
2217 dissect_nfs2_statfs_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
2227 offset = dissect_stat(tvb, offset, pinfo, tree, &status);
2230 tsize = tvb_get_ntohl(tvb, offset+ 0);
2231 bsize = tvb_get_ntohl(tvb, offset+ 4);
2232 blocks = tvb_get_ntohl(tvb, offset+ 8);
2233 bfree = tvb_get_ntohl(tvb, offset+12);
2234 bavail = tvb_get_ntohl(tvb, offset+16);
2236 proto_tree_add_uint(tree, hf_nfs_statfs_tsize, tvb,
2237 offset+ 0, 4, tsize);
2238 proto_tree_add_uint(tree, hf_nfs_statfs_bsize, tvb,
2239 offset+ 4, 4, bsize);
2240 proto_tree_add_uint(tree, hf_nfs_statfs_blocks, tvb,
2241 offset+ 8, 4, blocks);
2242 proto_tree_add_uint(tree, hf_nfs_statfs_bfree, tvb,
2243 offset+12, 4, bfree);
2244 proto_tree_add_uint(tree, hf_nfs_statfs_bavail, tvb,
2245 offset+16, 4, bavail);
2258 /* proc number, "proc name", dissect_request, dissect_reply */
2259 /* NULL as function pointer means: type of arguments is "void". */
2260 static const vsff nfs2_proc[] = {
2261 { 0, "NULL", /* OK */
2263 { 1, "GETATTR", /* OK */
2264 dissect_nfs2_fhandle_call, dissect_nfs2_attrstat_reply },
2265 { 2, "SETATTR", /* OK */
2266 dissect_nfs2_setattr_call, dissect_nfs2_attrstat_reply },
2267 { 3, "ROOT", /* OK */
2269 { 4, "LOOKUP", /* OK */
2270 dissect_nfs2_diropargs_call, dissect_nfs2_diropres_reply },
2271 { 5, "READLINK", /* OK */
2272 dissect_nfs2_fhandle_call, dissect_nfs2_readlink_reply },
2273 { 6, "READ", /* OK */
2274 dissect_nfs2_read_call, dissect_nfs2_read_reply },
2275 { 7, "WRITECACHE", /* OK */
2277 { 8, "WRITE", /* OK */
2278 dissect_nfs2_write_call, dissect_nfs2_attrstat_reply },
2279 { 9, "CREATE", /* OK */
2280 dissect_nfs2_createargs_call, dissect_nfs2_diropres_reply },
2281 { 10, "REMOVE", /* OK */
2282 dissect_nfs2_diropargs_call, dissect_nfs2_stat_reply },
2283 { 11, "RENAME", /* OK */
2284 dissect_nfs2_rename_call, dissect_nfs2_stat_reply },
2285 { 12, "LINK", /* OK */
2286 dissect_nfs2_link_call, dissect_nfs2_stat_reply },
2287 { 13, "SYMLINK", /* OK */
2288 dissect_nfs2_symlink_call, dissect_nfs2_stat_reply },
2289 { 14, "MKDIR", /* OK */
2290 dissect_nfs2_createargs_call, dissect_nfs2_diropres_reply },
2291 { 15, "RMDIR", /* OK */
2292 dissect_nfs2_diropargs_call, dissect_nfs2_stat_reply },
2293 { 16, "READDIR", /* OK */
2294 dissect_nfs2_readdir_call, dissect_nfs2_readdir_reply },
2295 { 17, "STATFS", /* OK */
2296 dissect_nfs2_fhandle_call, dissect_nfs2_statfs_reply },
2297 { 0,NULL,NULL,NULL }
2299 /* end of NFS Version 2 */
2302 /***************************/
2303 /* NFS Version 3, RFC 1813 */
2304 /***************************/
2307 /* RFC 1813, Page 15 */
2309 dissect_filename3(tvbuff_t *tvb, int offset, packet_info *pinfo,
2310 proto_tree *tree, int hf, char **string_ret)
2312 offset = dissect_rpc_string(tvb, pinfo, tree, hf, offset, string_ret);
2317 /* RFC 1813, Page 15 */
2319 dissect_nfspath3(tvbuff_t *tvb, int offset, packet_info *pinfo,
2320 proto_tree *tree, int hf)
2322 offset = dissect_rpc_string(tvb, pinfo, tree, hf, offset, NULL);
2326 /* RFC 1813, Page 15 */
2328 dissect_cookieverf3(tvbuff_t *tvb, int offset, packet_info *pinfo,
2331 proto_tree_add_text(tree, tvb, offset, NFS3_COOKIEVERFSIZE,
2332 "Verifier: Opaque Data");
2333 offset += NFS3_COOKIEVERFSIZE;
2338 /* RFC 1813, Page 16 */
2340 dissect_createverf3(tvbuff_t *tvb, int offset, packet_info *pinfo,
2343 proto_tree_add_text(tree, tvb, offset, NFS3_CREATEVERFSIZE,
2344 "Verifier: Opaque Data");
2345 offset += NFS3_CREATEVERFSIZE;
2350 /* RFC 1813, Page 16 */
2352 dissect_writeverf3(tvbuff_t *tvb, int offset, packet_info *pinfo,
2355 proto_tree_add_text(tree, tvb, offset, NFS3_WRITEVERFSIZE,
2356 "Verifier: Opaque Data");
2357 offset += NFS3_WRITEVERFSIZE;
2361 /* RFC 1813, Page 16 */
2363 dissect_mode3(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree,
2367 proto_item* mode3_item = NULL;
2368 proto_tree* mode3_tree = NULL;
2370 mode3 = tvb_get_ntohl(tvb, offset+0);
2373 mode3_item = proto_tree_add_text(tree, tvb, offset, 4,
2374 "%s: 0%o", name, mode3);
2376 mode3_tree = proto_item_add_subtree(mode3_item, ett_nfs_mode3);
2379 /* RFC 1813, Page 23 */
2381 proto_tree_add_text(mode3_tree, tvb, offset, 4, "%s",
2382 decode_boolean_bitfield(mode3, 0x800, 12, "Set user id on exec", "not SUID"));
2383 proto_tree_add_text(mode3_tree, tvb, offset, 4, "%s",
2384 decode_boolean_bitfield(mode3, 0x400, 12, "Set group id on exec", "not SGID"));
2385 proto_tree_add_text(mode3_tree, tvb, offset, 4, "%s",
2386 decode_boolean_bitfield(mode3, 0x200, 12, "Save swapped text even after use", "not save swapped text"));
2387 proto_tree_add_text(mode3_tree, tvb, offset, 4, "%s",
2388 decode_boolean_bitfield(mode3, 0x100, 12, "Read permission for owner", "no Read permission for owner"));
2389 proto_tree_add_text(mode3_tree, tvb, offset, 4, "%s",
2390 decode_boolean_bitfield(mode3, 0x80, 12, "Write permission for owner", "no Write permission for owner"));
2391 proto_tree_add_text(mode3_tree, tvb, offset, 4, "%s",
2392 decode_boolean_bitfield(mode3, 0x40, 12, "Execute permission for owner", "no Execute permission for owner"));
2393 proto_tree_add_text(mode3_tree, tvb, offset, 4, "%s",
2394 decode_boolean_bitfield(mode3, 0x20, 12, "Read permission for group", "no Read permission for group"));
2395 proto_tree_add_text(mode3_tree, tvb, offset, 4, "%s",
2396 decode_boolean_bitfield(mode3, 0x10, 12, "Write permission for group", "no Write permission for group"));
2397 proto_tree_add_text(mode3_tree, tvb, offset, 4, "%s",
2398 decode_boolean_bitfield(mode3, 0x8, 12, "Execute permission for group", "no Execute permission for group"));
2399 proto_tree_add_text(mode3_tree, tvb, offset, 4, "%s",
2400 decode_boolean_bitfield(mode3, 0x4, 12, "Read permission for others", "no Read permission for others"));
2401 proto_tree_add_text(mode3_tree, tvb, offset, 4, "%s",
2402 decode_boolean_bitfield(mode3, 0x2, 12, "Write permission for others", "no Write permission for others"));
2403 proto_tree_add_text(mode3_tree, tvb, offset, 4, "%s",
2404 decode_boolean_bitfield(mode3, 0x1, 12, "Execute permission for others", "no Execute permission for others"));
2411 /* RFC 1813, Page 16,17 */
2412 const value_string names_nfs_nfsstat3[] =
2419 { 13, "ERR_ACCES" },
2420 { 17, "ERR_EXIST" },
2422 { 19, "ERR_NODEV" },
2423 { 20, "ERR_NOTDIR" },
2424 { 21, "ERR_ISDIR" },
2425 { 22, "ERR_INVAL" },
2427 { 28, "ERR_NOSPC" },
2429 { 31, "ERR_MLINK" },
2430 { 63, "ERR_NAMETOOLONG" },
2431 { 66, "ERR_NOTEMPTY" },
2432 { 69, "ERR_DQUOT" },
2433 { 70, "ERR_STALE" },
2434 { 71, "ERR_REMOTE" },
2435 { 10001, "ERR_BADHANDLE" },
2436 { 10002, "ERR_NOT_SYNC" },
2437 { 10003, "ERR_BAD_COOKIE" },
2438 { 10004, "ERR_NOTSUPP" },
2439 { 10005, "ERR_TOOSMALL" },
2440 { 10006, "ERR_SERVERFAULT" },
2441 { 10007, "ERR_BADTYPE" },
2442 { 10008, "ERR_JUKEBOX" },
2447 /* RFC 1813, Page 16 */
2449 dissect_nfsstat3(tvbuff_t *tvb, int offset, packet_info *pinfo,
2450 proto_tree *tree,guint32 *status)
2454 nfsstat3 = tvb_get_ntohl(tvb, offset+0);
2457 proto_tree_add_uint(tree, hf_nfs_nfsstat3, tvb,
2458 offset, 4, nfsstat3);
2467 const value_string names_nfs_ftype3[] =
2469 { NF3REG, "Regular File" },
2470 { NF3DIR, "Directory" },
2471 { NF3BLK, "Block Special Device" },
2472 { NF3CHR, "Character Special Device" },
2473 { NF3LNK, "Symbolic Link" },
2474 { NF3SOCK,"Socket" },
2475 { NF3FIFO,"Named Pipe" },
2480 /* RFC 1813, Page 20 */
2482 dissect_ftype3(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree,
2483 int hf, guint32* ftype3)
2487 type = tvb_get_ntohl(tvb, offset+0);
2490 proto_tree_add_uint(tree, hf, tvb, offset, 4, type);
2499 /* RFC 1813, Page 20 */
2501 dissect_specdata3(tvbuff_t *tvb, int offset, packet_info *pinfo,
2502 proto_tree *tree, char* name)
2507 proto_item* specdata3_item;
2508 proto_tree* specdata3_tree = NULL;
2510 specdata1 = tvb_get_ntohl(tvb, offset+0);
2511 specdata2 = tvb_get_ntohl(tvb, offset+4);
2514 specdata3_item = proto_tree_add_text(tree, tvb, offset, 8,
2515 "%s: %u,%u", name, specdata1, specdata2);
2517 specdata3_tree = proto_item_add_subtree(specdata3_item,
2521 if (specdata3_tree) {
2522 proto_tree_add_text(specdata3_tree, tvb,offset+0,4,
2523 "specdata1: %u", specdata1);
2524 proto_tree_add_text(specdata3_tree, tvb,offset+4,4,
2525 "specdata2: %u", specdata2);
2533 /* RFC 1813, Page 21 */
2535 dissect_nfs_fh3(tvbuff_t *tvb, int offset, packet_info *pinfo,
2536 proto_tree *tree, char *name)
2541 proto_item* fitem = NULL;
2542 proto_tree* ftree = NULL;
2543 int fh_offset,fh_len;
2545 fh3_len = tvb_get_ntohl(tvb, offset+0);
2546 fh3_len_full = rpc_roundup(fh3_len);
2547 fh3_fill = fh3_len_full - fh3_len;
2550 fitem = proto_tree_add_text(tree, tvb, offset, 4+fh3_len_full,
2553 ftree = proto_item_add_subtree(fitem, ett_nfs_fh3);
2556 /* are we snooping fh to filenames ?*/
2557 if((!pinfo->fd->flags.visited) && nfs_file_name_snooping){
2558 rpc_call_info_value *civ=pinfo->private_data;
2560 /* NFS v3 LOOKUP, CREATE, MKDIR calls might give us a mapping*/
2561 if( (civ->prog==100003)
2564 &&((civ->proc==3)||(civ->proc==8)||(civ->proc==9))
2566 fh_len=tvb_get_ntohl(tvb, offset);
2568 nfs_name_snoop_add_fh(civ->xid, tvb,
2572 /* MOUNT v3 MNT replies might give us a filehandle */
2573 if( (civ->prog==100005)
2578 fh_len=tvb_get_ntohl(tvb, offset);
2580 nfs_name_snoop_add_fh(civ->xid, tvb,
2585 proto_tree_add_uint(ftree, hf_nfs_fh_length, tvb, offset+0, 4,
2587 dissect_fhandle_data(tvb, offset+4, pinfo, ftree, fh3_len);
2589 offset += 4 + fh3_len_full;
2594 /* RFC 1813, Page 21 */
2596 dissect_nfstime3(tvbuff_t *tvb, int offset, packet_info *pinfo,
2597 proto_tree *tree, int hf_time, int hf_time_sec, int hf_time_nsec)
2603 proto_item* time_item;
2604 proto_tree* time_tree = NULL;
2606 seconds = tvb_get_ntohl(tvb, offset+0);
2607 nseconds = tvb_get_ntohl(tvb, offset+4);
2609 ts.nsecs = nseconds;
2612 time_item = proto_tree_add_time(tree, hf_time, tvb, offset, 8,
2615 time_tree = proto_item_add_subtree(time_item, ett_nfs_nfstime3);
2619 proto_tree_add_uint(time_tree, hf_time_sec, tvb, offset, 4,
2621 proto_tree_add_uint(time_tree, hf_time_nsec, tvb, offset+4, 4,
2629 /* RFC 1813, Page 22 */
2631 dissect_fattr3(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree,
2634 proto_item* fattr3_item = NULL;
2635 proto_tree* fattr3_tree = NULL;
2636 int old_offset = offset;
2640 fattr3_item = proto_tree_add_text(tree, tvb, offset, -1,
2642 fattr3_tree = proto_item_add_subtree(fattr3_item, ett_nfs_fattr3);
2645 offset = dissect_ftype3(tvb,offset,pinfo,fattr3_tree,hf_nfs_fattr3_type,&type);
2646 offset = dissect_mode3(tvb,offset,pinfo,fattr3_tree,"mode");
2647 offset = dissect_rpc_uint32(tvb, pinfo, fattr3_tree, hf_nfs_fattr3_nlink,
2649 offset = dissect_rpc_uint32(tvb, pinfo, fattr3_tree, hf_nfs_fattr3_uid,
2651 offset = dissect_rpc_uint32(tvb, pinfo, fattr3_tree, hf_nfs_fattr3_gid,
2653 offset = dissect_rpc_uint64(tvb, pinfo, fattr3_tree, hf_nfs_fattr3_size,
2655 offset = dissect_rpc_uint64(tvb, pinfo, fattr3_tree, hf_nfs_fattr3_used,
2657 offset = dissect_specdata3(tvb,offset,pinfo,fattr3_tree,"rdev");
2658 offset = dissect_rpc_uint64(tvb, pinfo, fattr3_tree, hf_nfs_fattr3_fsid,
2660 offset = dissect_rpc_uint64(tvb, pinfo, fattr3_tree, hf_nfs_fattr3_fileid,
2662 offset = dissect_nfstime3 (tvb,offset,pinfo,fattr3_tree,hf_nfs_atime,hf_nfs_atime_sec,hf_nfs_atime_nsec);
2663 offset = dissect_nfstime3 (tvb,offset,pinfo,fattr3_tree,hf_nfs_mtime,hf_nfs_mtime_sec,hf_nfs_mtime_nsec);
2664 offset = dissect_nfstime3 (tvb,offset,pinfo,fattr3_tree,hf_nfs_ctime,hf_nfs_ctime_sec,hf_nfs_ctime_nsec);
2666 /* now we know, that fattr3 is shorter */
2668 proto_item_set_len(fattr3_item, offset - old_offset);
2675 const value_string value_follows[] =
2678 { 1, "value follows"},
2683 /* RFC 1813, Page 23 */
2685 dissect_post_op_attr(tvbuff_t *tvb, int offset, packet_info *pinfo,
2686 proto_tree *tree, char* name)
2688 proto_item* post_op_attr_item = NULL;
2689 proto_tree* post_op_attr_tree = NULL;
2690 int old_offset = offset;
2691 guint32 attributes_follow;
2694 post_op_attr_item = proto_tree_add_text(tree, tvb, offset, -1,
2696 post_op_attr_tree = proto_item_add_subtree(post_op_attr_item,
2697 ett_nfs_post_op_attr);
2700 attributes_follow = tvb_get_ntohl(tvb, offset+0);
2701 proto_tree_add_text(post_op_attr_tree, tvb, offset, 4,
2702 "attributes_follow: %s (%u)",
2703 val_to_str(attributes_follow,value_follows,"Unknown"), attributes_follow);
2705 switch (attributes_follow) {
2707 offset = dissect_fattr3(tvb, offset, pinfo, post_op_attr_tree,
2715 /* now we know, that post_op_attr_tree is shorter */
2716 if (post_op_attr_item) {
2717 proto_item_set_len(post_op_attr_item, offset - old_offset);
2724 /* RFC 1813, Page 24 */
2726 dissect_wcc_attr(tvbuff_t *tvb, int offset, packet_info *pinfo,
2727 proto_tree *tree, char* name)
2729 proto_item* wcc_attr_item = NULL;
2730 proto_tree* wcc_attr_tree = NULL;
2731 int old_offset = offset;
2734 wcc_attr_item = proto_tree_add_text(tree, tvb, offset, -1,
2736 wcc_attr_tree = proto_item_add_subtree(wcc_attr_item,
2740 offset = dissect_rpc_uint64(tvb, pinfo, wcc_attr_tree, hf_nfs_wcc_attr_size,
2742 offset = dissect_nfstime3(tvb, offset, pinfo, wcc_attr_tree, hf_nfs_mtime, hf_nfs_mtime_sec, hf_nfs_mtime_nsec);
2743 offset = dissect_nfstime3(tvb, offset, pinfo, wcc_attr_tree, hf_nfs_ctime, hf_nfs_ctime_sec, hf_nfs_ctime_nsec);
2744 /* now we know, that wcc_attr_tree is shorter */
2745 if (wcc_attr_item) {
2746 proto_item_set_len(wcc_attr_item, offset - old_offset);
2753 /* RFC 1813, Page 24 */
2755 dissect_pre_op_attr(tvbuff_t *tvb, int offset, packet_info *pinfo,
2756 proto_tree *tree, char* name)
2758 proto_item* pre_op_attr_item = NULL;
2759 proto_tree* pre_op_attr_tree = NULL;
2760 int old_offset = offset;
2761 guint32 attributes_follow;
2764 pre_op_attr_item = proto_tree_add_text(tree, tvb, offset, -1,
2766 pre_op_attr_tree = proto_item_add_subtree(pre_op_attr_item,
2767 ett_nfs_pre_op_attr);
2770 attributes_follow = tvb_get_ntohl(tvb, offset+0);
2771 proto_tree_add_text(pre_op_attr_tree, tvb, offset, 4,
2772 "attributes_follow: %s (%u)",
2773 val_to_str(attributes_follow,value_follows,"Unknown"), attributes_follow);
2775 switch (attributes_follow) {
2777 offset = dissect_wcc_attr(tvb, offset, pinfo, pre_op_attr_tree,
2785 /* now we know, that pre_op_attr_tree is shorter */
2786 if (pre_op_attr_item) {
2787 proto_item_set_len(pre_op_attr_item, offset - old_offset);
2794 /* RFC 1813, Page 24 */
2796 dissect_wcc_data(tvbuff_t *tvb, int offset, packet_info *pinfo,
2797 proto_tree *tree, char* name)
2799 proto_item* wcc_data_item = NULL;
2800 proto_tree* wcc_data_tree = NULL;
2801 int old_offset = offset;
2804 wcc_data_item = proto_tree_add_text(tree, tvb, offset, -1,
2806 wcc_data_tree = proto_item_add_subtree(wcc_data_item,
2810 offset = dissect_pre_op_attr (tvb, offset, pinfo, wcc_data_tree, "before");
2811 offset = dissect_post_op_attr(tvb, offset, pinfo, wcc_data_tree, "after" );
2813 /* now we know, that wcc_data is shorter */
2814 if (wcc_data_item) {
2815 proto_item_set_len(wcc_data_item, offset - old_offset);
2822 /* RFC 1813, Page 25 */
2824 dissect_post_op_fh3(tvbuff_t *tvb, int offset, packet_info *pinfo,
2825 proto_tree *tree, char* name)
2827 proto_item* post_op_fh3_item = NULL;
2828 proto_tree* post_op_fh3_tree = NULL;
2829 int old_offset = offset;
2830 guint32 handle_follows;
2833 post_op_fh3_item = proto_tree_add_text(tree, tvb, offset, -1,
2835 post_op_fh3_tree = proto_item_add_subtree(post_op_fh3_item,
2836 ett_nfs_post_op_fh3);
2839 handle_follows = tvb_get_ntohl(tvb, offset+0);
2840 proto_tree_add_text(post_op_fh3_tree, tvb, offset, 4,
2841 "handle_follows: %s (%u)",
2842 val_to_str(handle_follows,value_follows,"Unknown"), handle_follows);
2844 switch (handle_follows) {
2846 offset = dissect_nfs_fh3(tvb, offset, pinfo, post_op_fh3_tree,
2854 /* now we know, that post_op_fh3_tree is shorter */
2855 if (post_op_fh3_item) {
2856 proto_item_set_len(post_op_fh3_item, offset - old_offset);
2863 /* RFC 1813, Page 25 */
2865 dissect_set_mode3(tvbuff_t *tvb, int offset, packet_info *pinfo,
2866 proto_tree *tree, char* name)
2868 proto_item* set_mode3_item = NULL;
2869 proto_tree* set_mode3_tree = NULL;
2870 int old_offset = offset;
2874 set_it = tvb_get_ntohl(tvb, offset+0);
2875 set_it_name = val_to_str(set_it,value_follows,"Unknown");
2878 set_mode3_item = proto_tree_add_text(tree, tvb, offset, -1,
2879 "%s: %s", name, set_it_name);
2880 set_mode3_tree = proto_item_add_subtree(set_mode3_item,
2885 proto_tree_add_text(set_mode3_tree, tvb, offset, 4,
2886 "set_it: %s (%u)", set_it_name, set_it);
2892 offset = dissect_mode3(tvb, offset, pinfo, set_mode3_tree,
2900 /* now we know, that set_mode3 is shorter */
2901 if (set_mode3_item) {
2902 proto_item_set_len(set_mode3_item, offset - old_offset);
2909 /* RFC 1813, Page 26 */
2911 dissect_set_uid3(tvbuff_t *tvb, int offset, packet_info *pinfo,
2912 proto_tree *tree, char* name)
2914 proto_item* set_uid3_item = NULL;
2915 proto_tree* set_uid3_tree = NULL;
2916 int old_offset = offset;
2920 set_it = tvb_get_ntohl(tvb, offset+0);
2921 set_it_name = val_to_str(set_it,value_follows,"Unknown");
2924 set_uid3_item = proto_tree_add_text(tree, tvb, offset, -1,
2925 "%s: %s", name, set_it_name);
2926 set_uid3_tree = proto_item_add_subtree(set_uid3_item,
2931 proto_tree_add_text(set_uid3_tree, tvb, offset, 4,
2932 "set_it: %s (%u)", set_it_name, set_it);
2938 offset = dissect_rpc_uint32(tvb, pinfo, set_uid3_tree,
2939 hf_nfs_uid3, offset);
2946 /* now we know, that set_uid3 is shorter */
2947 if (set_uid3_item) {
2948 proto_item_set_len(set_uid3_item, offset - old_offset);
2955 /* RFC 1813, Page 26 */
2957 dissect_set_gid3(tvbuff_t *tvb, int offset, packet_info *pinfo,
2958 proto_tree *tree, char* name)
2960 proto_item* set_gid3_item = NULL;
2961 proto_tree* set_gid3_tree = NULL;
2962 int old_offset = offset;
2966 set_it = tvb_get_ntohl(tvb, offset+0);
2967 set_it_name = val_to_str(set_it,value_follows,"Unknown");
2970 set_gid3_item = proto_tree_add_text(tree, tvb, offset, -1,
2971 "%s: %s", name, set_it_name);
2972 set_gid3_tree = proto_item_add_subtree(set_gid3_item,
2977 proto_tree_add_text(set_gid3_tree, tvb, offset, 4,
2978 "set_it: %s (%u)", set_it_name, set_it);
2984 offset = dissect_rpc_uint32(tvb, pinfo, set_gid3_tree,
2985 hf_nfs_gid3, offset);
2992 /* now we know, that set_gid3 is shorter */
2993 if (set_gid3_item) {
2994 proto_item_set_len(set_gid3_item, offset - old_offset);
3001 /* RFC 1813, Page 26 */
3003 dissect_set_size3(tvbuff_t *tvb, int offset, packet_info *pinfo,
3004 proto_tree *tree, char* name)
3006 proto_item* set_size3_item = NULL;
3007 proto_tree* set_size3_tree = NULL;
3008 int old_offset = offset;
3012 set_it = tvb_get_ntohl(tvb, offset+0);
3013 set_it_name = val_to_str(set_it,value_follows,"Unknown");
3016 set_size3_item = proto_tree_add_text(tree, tvb, offset, -1,
3017 "%s: %s", name, set_it_name);
3018 set_size3_tree = proto_item_add_subtree(set_size3_item,
3023 proto_tree_add_text(set_size3_tree, tvb, offset, 4,
3024 "set_it: %s (%u)", set_it_name, set_it);
3030 offset = dissect_rpc_uint64(tvb, pinfo, set_size3_tree,
3031 hf_nfs_set_size3_size, offset);
3038 /* now we know, that set_size3 is shorter */
3039 if (set_size3_item) {
3040 proto_item_set_len(set_size3_item, offset - old_offset);
3047 /* RFC 1813, Page 25 */
3048 #define DONT_CHANGE 0
3049 #define SET_TO_SERVER_TIME 1
3050 #define SET_TO_CLIENT_TIME 2
3052 const value_string time_how[] =
3054 { DONT_CHANGE, "don't change" },
3055 { SET_TO_SERVER_TIME, "set to server time" },
3056 { SET_TO_CLIENT_TIME, "set to client time" },
3061 /* RFC 1813, Page 26 */
3063 dissect_set_atime(tvbuff_t *tvb, int offset, packet_info *pinfo,
3064 proto_tree *tree, char* name)
3066 proto_item* set_atime_item = NULL;
3067 proto_tree* set_atime_tree = NULL;
3068 int old_offset = offset;
3072 set_it = tvb_get_ntohl(tvb, offset+0);
3073 set_it_name = val_to_str(set_it,time_how,"Unknown");
3076 set_atime_item = proto_tree_add_text(tree, tvb, offset, -1,
3077 "%s: %s", name, set_it_name);
3078 set_atime_tree = proto_item_add_subtree(set_atime_item,
3083 proto_tree_add_text(set_atime_tree, tvb, offset, 4,
3084 "set_it: %s (%u)", set_it_name, set_it);
3089 case SET_TO_CLIENT_TIME:
3090 if (set_atime_item) {
3091 offset = dissect_nfstime3(tvb, offset, pinfo, set_atime_tree,
3092 hf_nfs_atime, hf_nfs_atime_sec, hf_nfs_atime_nsec);
3100 /* now we know, that set_atime is shorter */
3101 if (set_atime_item) {
3102 proto_item_set_len(set_atime_item, offset - old_offset);
3109 /* RFC 1813, Page 26 */
3111 dissect_set_mtime(tvbuff_t *tvb, int offset, packet_info *pinfo,
3112 proto_tree *tree, char* name)
3114 proto_item* set_mtime_item = NULL;
3115 proto_tree* set_mtime_tree = NULL;
3116 int old_offset = offset;
3120 set_it = tvb_get_ntohl(tvb, offset+0);
3121 set_it_name = val_to_str(set_it,time_how,"Unknown");
3124 set_mtime_item = proto_tree_add_text(tree, tvb, offset, -1,
3125 "%s: %s", name, set_it_name);
3126 set_mtime_tree = proto_item_add_subtree(set_mtime_item,
3131 proto_tree_add_text(set_mtime_tree, tvb, offset, 4,
3132 "set_it: %s (%u)", set_it_name, set_it);
3137 case SET_TO_CLIENT_TIME:
3138 if (set_mtime_item) {
3139 offset = dissect_nfstime3(tvb, offset, pinfo, set_mtime_tree,
3140 hf_nfs_atime, hf_nfs_atime_sec, hf_nfs_atime_nsec);
3148 /* now we know, that set_mtime is shorter */
3149 if (set_mtime_item) {
3150 proto_item_set_len(set_mtime_item, offset - old_offset);
3157 /* RFC 1813, Page 25..27 */
3159 dissect_sattr3(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree,
3162 proto_item* sattr3_item = NULL;
3163 proto_tree* sattr3_tree = NULL;
3164 int old_offset = offset;
3167 sattr3_item = proto_tree_add_text(tree, tvb, offset, -1,
3169 sattr3_tree = proto_item_add_subtree(sattr3_item, ett_nfs_sattr3);
3172 offset = dissect_set_mode3(tvb, offset, pinfo, sattr3_tree, "mode");
3173 offset = dissect_set_uid3 (tvb, offset, pinfo, sattr3_tree, "uid");
3174 offset = dissect_set_gid3 (tvb, offset, pinfo, sattr3_tree, "gid");
3175 offset = dissect_set_size3(tvb, offset, pinfo, sattr3_tree, "size");
3176 offset = dissect_set_atime(tvb, offset, pinfo, sattr3_tree, "atime");
3177 offset = dissect_set_mtime(tvb, offset, pinfo, sattr3_tree, "mtime");
3179 /* now we know, that sattr3 is shorter */
3181 proto_item_set_len(sattr3_item, offset - old_offset);
3188 /* RFC 1813, Page 27 */
3190 dissect_diropargs3(tvbuff_t *tvb, int offset, packet_info *pinfo,
3191 proto_tree *tree, char* name)
3193 proto_item* diropargs3_item = NULL;
3194 proto_tree* diropargs3_tree = NULL;
3195 int old_offset = offset;
3196 int parent_offset, parent_len;
3197 int name_offset, name_len;
3200 diropargs3_item = proto_tree_add_text(tree, tvb, offset, -1,
3202 diropargs3_tree = proto_item_add_subtree(diropargs3_item,
3203 ett_nfs_diropargs3);
3206 parent_offset=offset+4;
3207 parent_len=tvb_get_ntohl(tvb, offset);
3208 offset = dissect_nfs_fh3(tvb, offset, pinfo, diropargs3_tree, "dir");
3209 name_offset=offset+4;
3210 name_len=tvb_get_ntohl(tvb, offset);
3211 offset = dissect_filename3(tvb, offset, pinfo, diropargs3_tree,
3214 /* are we snooping fh to filenames ?*/
3215 if((!pinfo->fd->flags.visited) && nfs_file_name_snooping){
3216 /* v3 LOOKUP, CREATE, MKDIR calls might give us a mapping*/
3217 rpc_call_info_value *civ=pinfo->private_data;
3219 if( (civ->prog==100003)
3222 &&((civ->proc==3)||(civ->proc==8)||(civ->proc==9))
3224 nfs_name_snoop_add_name(civ->xid, tvb,
3225 name_offset, name_len,
3226 parent_offset, parent_len, NULL);
3231 /* now we know, that diropargs3 is shorter */
3232 if (diropargs3_item) {
3233 proto_item_set_len(diropargs3_item, offset - old_offset);
3240 /* RFC 1813, Page 27 */
3242 dissect_nfs3_diropargs3_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
3245 offset = dissect_diropargs3(tvb, offset, pinfo, tree, "object");
3251 /* RFC 1813, Page 40 */
3253 dissect_access(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree,
3257 proto_item* access_item = NULL;
3258 proto_tree* access_tree = NULL;
3260 access = tvb_get_ntohl(tvb, offset+0);
3263 access_item = proto_tree_add_text(tree, tvb, offset, 4,
3264 "%s: 0x%02x", name, access);
3266 access_tree = proto_item_add_subtree(access_item, ett_nfs_access);
3270 proto_tree_add_text(access_tree, tvb, offset, 4, "%s READ",
3271 decode_boolean_bitfield(access, 0x001, 6, "allow", "not allow"));
3272 proto_tree_add_text(access_tree, tvb, offset, 4, "%s LOOKUP",
3273 decode_boolean_bitfield(access, 0x002, 6, "allow", "not allow"));
3274 proto_tree_add_text(access_tree, tvb, offset, 4, "%s MODIFY",
3275 decode_boolean_bitfield(access, 0x004, 6, "allow", "not allow"));
3276 proto_tree_add_text(access_tree, tvb, offset, 4, "%s EXTEND",
3277 decode_boolean_bitfield(access, 0x008, 6, "allow", "not allow"));
3278 proto_tree_add_text(access_tree, tvb, offset, 4, "%s DELETE",
3279 decode_boolean_bitfield(access, 0x010, 6, "allow", "not allow"));
3280 proto_tree_add_text(access_tree, tvb, offset, 4, "%s EXECUTE",
3281 decode_boolean_bitfield(access, 0x020, 6, "allow", "not allow"));
3289 /* NFS3 file handle dissector */
3291 dissect_nfs3_nfs_fh3_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
3294 offset = dissect_nfs_fh3(tvb, offset, pinfo, tree, "object");
3299 /* generic NFS3 reply dissector */
3301 dissect_nfs3_any_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
3306 offset = dissect_nfsstat3(tvb, offset, pinfo, tree, &status);
3313 /* RFC 1813, Page 32,33 */
3315 dissect_nfs3_getattr_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
3318 offset = dissect_nfs_fh3(tvb, offset, pinfo, tree, "object");
3323 /* RFC 1813, Page 32,33 */
3325 dissect_nfs3_getattr_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
3330 offset = dissect_nfsstat3(tvb, offset, pinfo, tree, &status);
3333 offset = dissect_fattr3(tvb, offset, pinfo, tree, "obj_attributes");
3344 /* RFC 1813, Page 33 */
3346 dissect_sattrguard3(tvbuff_t *tvb, int offset, packet_info *pinfo,
3347 proto_tree* tree, char *name)
3349 proto_item* sattrguard3_item = NULL;
3350 proto_tree* sattrguard3_tree = NULL;
3351 int old_offset = offset;
3355 check = tvb_get_ntohl(tvb, offset+0);
3356 check_name = val_to_str(check,value_follows,"Unknown");
3359 sattrguard3_item = proto_tree_add_text(tree, tvb, offset, -1,
3360 "%s: %s", name, check_name);
3361 sattrguard3_tree = proto_item_add_subtree(sattrguard3_item,
3362 ett_nfs_sattrguard3);
3365 if (sattrguard3_tree)
3366 proto_tree_add_text(sattrguard3_tree, tvb, offset, 4,
3367 "check: %s (%u)", check_name, check);
3373 offset = dissect_nfstime3(tvb, offset, pinfo, sattrguard3_tree,
3374 hf_nfs_ctime, hf_nfs_ctime_sec, hf_nfs_ctime_nsec);
3381 /* now we know, that sattrguard3 is shorter */
3382 if (sattrguard3_item) {
3383 proto_item_set_len(sattrguard3_item, offset - old_offset);
3390 /* RFC 1813, Page 33..36 */
3392 dissect_nfs3_setattr_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
3395 offset = dissect_nfs_fh3 (tvb, offset, pinfo, tree, "object");
3396 offset = dissect_sattr3 (tvb, offset, pinfo, tree, "new_attributes");
3397 offset = dissect_sattrguard3(tvb, offset, pinfo, tree, "guard");
3402 /* RFC 1813, Page 33..36 */
3404 dissect_nfs3_setattr_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
3409 offset = dissect_nfsstat3(tvb, offset, pinfo, tree, &status);
3412 offset = dissect_wcc_data(tvb, offset, pinfo, tree, "obj_wcc");
3415 offset = dissect_wcc_data(tvb, offset, pinfo, tree, "obj_wcc");
3423 /* RFC 1813, Page 37..39 */
3425 dissect_nfs3_lookup_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
3428 offset = dissect_diropargs3 (tvb, offset, pinfo, tree, "what");
3433 /* RFC 1813, Page 37..39 */
3435 dissect_nfs3_lookup_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
3440 offset = dissect_nfsstat3(tvb, offset, pinfo, tree, &status);
3443 offset = dissect_nfs_fh3(tvb, offset, pinfo, tree, "object");
3444 offset = dissect_post_op_attr(tvb, offset, pinfo, tree,
3446 offset = dissect_post_op_attr(tvb, offset, pinfo, tree,
3450 offset = dissect_post_op_attr(tvb, offset, pinfo, tree,
3459 /* RFC 1813, Page 40..43 */
3461 dissect_nfs3_access_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
3464 offset = dissect_nfs_fh3(tvb, offset, pinfo, tree, "object");
3465 offset = dissect_access (tvb, offset, pinfo, tree, "access");
3471 /* RFC 1813, Page 40..43 */
3473 dissect_nfs3_access_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
3478 offset = dissect_nfsstat3(tvb, offset, pinfo, tree, &status);
3481 offset = dissect_post_op_attr(tvb, offset, pinfo, tree,
3483 offset = dissect_access(tvb, offset, pinfo, tree, "access");
3486 offset = dissect_post_op_attr(tvb, offset, pinfo, tree,
3495 /* RFC 1813, Page 44,45 */
3497 dissect_nfs3_readlink_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
3502 offset = dissect_nfsstat3(tvb, offset, pinfo, tree, &status);
3505 offset = dissect_post_op_attr(tvb, offset, pinfo, tree,
3506 "symlink_attributes");
3507 offset = dissect_nfspath3(tvb, offset, pinfo, tree,
3508 hf_nfs_readlink_data);
3511 offset = dissect_post_op_attr(tvb, offset, pinfo, tree,
3512 "symlink_attributes");
3520 /* RFC 1813, Page 46..48 */
3522 dissect_nfs3_read_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
3525 offset = dissect_nfs_fh3(tvb, offset, pinfo, tree, "file");
3526 offset = dissect_rpc_uint64(tvb, pinfo, tree, hf_nfs_offset3, offset);
3527 offset = dissect_rpc_uint32(tvb, pinfo, tree, hf_nfs_count3, offset);
3533 /* RFC 1813, Page 46..48 */
3535 dissect_nfs3_read_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
3540 offset = dissect_nfsstat3(tvb, offset, pinfo, tree, &status);
3543 offset = dissect_post_op_attr(tvb, offset, pinfo, tree,
3545 offset = dissect_rpc_uint32(tvb, pinfo, tree, hf_nfs_count3,
3547 offset = dissect_rpc_bool(tvb, pinfo, tree, hf_nfs_read_eof,
3549 offset = dissect_nfsdata(tvb, offset, pinfo, tree, hf_nfs_data);
3552 offset = dissect_post_op_attr(tvb, offset, pinfo, tree,
3561 /* RFC 1813, Page 49 */
3562 static const value_string names_stable_how[] = {
3563 { UNSTABLE, "UNSTABLE" },
3564 { DATA_SYNC, "DATA_SYNC" },
3565 { FILE_SYNC, "FILE_SYNC" },
3570 /* RFC 1813, Page 49 */
3572 dissect_stable_how(tvbuff_t *tvb, int offset, packet_info *pinfo,
3573 proto_tree* tree, int hfindex)
3577 stable_how = tvb_get_ntohl(tvb,offset+0);
3579 proto_tree_add_uint(tree, hfindex, tvb,
3580 offset, 4, stable_how);
3588 /* RFC 1813, Page 49..54 */
3590 dissect_nfs3_write_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
3593 offset = dissect_nfs_fh3 (tvb, offset, pinfo, tree, "file");
3594 offset = dissect_rpc_uint64(tvb, pinfo, tree, hf_nfs_offset3, offset);
3595 offset = dissect_rpc_uint32(tvb, pinfo, tree, hf_nfs_count3, offset);
3596 offset = dissect_stable_how(tvb, offset, pinfo, tree, hf_nfs_write_stable);
3597 offset = dissect_nfsdata (tvb, offset, pinfo, tree, hf_nfs_data);
3603 /* RFC 1813, Page 49..54 */
3605 dissect_nfs3_write_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
3610 offset = dissect_nfsstat3(tvb, offset, pinfo, tree, &status);
3613 offset = dissect_wcc_data (tvb, offset, pinfo, tree, "file_wcc");
3614 offset = dissect_rpc_uint32(tvb, pinfo, tree, hf_nfs_count3,
3616 offset = dissect_stable_how(tvb, offset, pinfo, tree,
3617 hf_nfs_write_committed);
3618 offset = dissect_writeverf3(tvb, offset, pinfo, tree);
3621 offset = dissect_wcc_data(tvb, offset, pinfo, tree, "file_wcc");
3629 /* RFC 1813, Page 54 */
3630 static const value_string names_createmode3[] = {
3631 { UNCHECKED, "UNCHECKED" },
3632 { GUARDED, "GUARDED" },
3633 { EXCLUSIVE, "EXCLUSIVE" },
3638 /* RFC 1813, Page 54 */
3640 dissect_createmode3(tvbuff_t *tvb, int offset, packet_info *pinfo,
3641 proto_tree* tree, guint32* mode)
3645 mode_value = tvb_get_ntohl(tvb, offset + 0);
3647 proto_tree_add_uint(tree, hf_nfs_createmode3, tvb,
3648 offset+0, 4, mode_value);
3657 /* RFC 1813, Page 54..58 */
3659 dissect_nfs3_create_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
3664 offset = dissect_diropargs3 (tvb, offset, pinfo, tree, "where");
3665 offset = dissect_createmode3(tvb, offset, pinfo, tree, &mode);
3669 offset = dissect_sattr3(tvb, offset, pinfo, tree, "obj_attributes");
3672 offset = dissect_createverf3(tvb, offset, pinfo, tree);
3680 /* RFC 1813, Page 54..58 */
3682 dissect_nfs3_create_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
3687 offset = dissect_nfsstat3(tvb, offset, pinfo, tree, &status);
3690 offset = dissect_post_op_fh3 (tvb, offset, pinfo, tree, "obj");
3691 offset = dissect_post_op_attr(tvb, offset, pinfo, tree,
3693 offset = dissect_wcc_data(tvb, offset, pinfo, tree, "dir_wcc");
3696 offset = dissect_wcc_data(tvb, offset, pinfo, tree, "dir_wcc");
3704 /* RFC 1813, Page 58..60 */
3706 dissect_nfs3_mkdir_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
3709 offset = dissect_diropargs3(tvb, offset, pinfo, tree, "where");
3710 offset = dissect_sattr3 (tvb, offset, pinfo, tree, "attributes");
3716 /* RFC 1813, Page 61..63 */
3718 dissect_nfs3_symlink_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
3721 offset = dissect_diropargs3(tvb, offset, pinfo, tree, "where");
3722 offset = dissect_sattr3 (tvb, offset, pinfo, tree, "symlink_attributes");
3723 offset = dissect_nfspath3 (tvb, offset, pinfo, tree, hf_nfs_symlink_to);
3729 /* RFC 1813, Page 63..66 */
3731 dissect_nfs3_mknod_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
3736 offset = dissect_diropargs3(tvb, offset, pinfo, tree, "where");
3737 offset = dissect_ftype3(tvb, offset, pinfo, tree, hf_nfs_ftype3, &type);
3741 offset = dissect_sattr3(tvb, offset, pinfo, tree, "dev_attributes");
3742 offset = dissect_specdata3(tvb, offset, pinfo, tree, "spec");
3746 offset = dissect_sattr3(tvb, offset, pinfo, tree, "pipe_attributes");
3757 /* RFC 1813, Page 67..69 */
3759 dissect_nfs3_remove_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
3764 offset = dissect_nfsstat3(tvb, offset, pinfo, tree, &status);
3767 offset = dissect_wcc_data (tvb, offset, pinfo, tree, "dir_wcc");
3770 offset = dissect_wcc_data (tvb, offset, pinfo, tree, "dir_wcc");
3778 /* RFC 1813, Page 71..74 */
3780 dissect_nfs3_rename_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
3783 offset = dissect_diropargs3(tvb, offset, pinfo, tree, "from");
3784 offset = dissect_diropargs3(tvb, offset, pinfo, tree, "to");
3790 /* RFC 1813, Page 71..74 */
3792 dissect_nfs3_rename_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
3797 offset = dissect_nfsstat3(tvb, offset, pinfo, tree, &status);
3800 offset = dissect_wcc_data(tvb, offset, pinfo, tree, "fromdir_wcc");
3801 offset = dissect_wcc_data(tvb, offset, pinfo, tree, "todir_wcc");
3804 offset = dissect_wcc_data(tvb, offset, pinfo, tree, "fromdir_wcc");
3805 offset = dissect_wcc_data(tvb, offset, pinfo, tree, "todir_wcc");
3813 /* RFC 1813, Page 74..76 */
3815 dissect_nfs3_link_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
3818 offset = dissect_nfs_fh3 (tvb, offset, pinfo, tree, "file");
3819 offset = dissect_diropargs3(tvb, offset, pinfo, tree, "link");
3825 /* RFC 1813, Page 74..76 */
3827 dissect_nfs3_link_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
3832 offset = dissect_nfsstat3(tvb, offset, pinfo, tree, &status);
3835 offset = dissect_post_op_attr(tvb, offset, pinfo, tree,
3837 offset = dissect_wcc_data(tvb, offset, pinfo, tree, "linkdir_wcc");
3840 offset = dissect_post_op_attr(tvb, offset, pinfo, tree,
3842 offset = dissect_wcc_data(tvb, offset, pinfo, tree, "linkdir_wcc");
3850 /* RFC 1813, Page 76..80 */
3852 dissect_nfs3_readdir_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
3855 offset = dissect_nfs_fh3 (tvb, offset, pinfo, tree, "dir");
3856 offset = dissect_rpc_uint64(tvb, pinfo, tree, hf_nfs_cookie3, offset);
3857 offset = dissect_cookieverf3(tvb, offset, pinfo, tree);
3858 offset = dissect_rpc_uint32(tvb, pinfo, tree, hf_nfs_count3, offset);
3864 /* RFC 1813, Page 76..80 */
3866 dissect_entry3(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree* tree)
3868 proto_item* entry_item = NULL;
3869 proto_tree* entry_tree = NULL;
3870 int old_offset = offset;
3874 entry_item = proto_tree_add_item(tree, hf_nfs_readdir_entry, tvb,
3875 offset+0, -1, FALSE);
3876 entry_tree = proto_item_add_subtree(entry_item, ett_nfs_readdir_entry);
3879 offset = dissect_rpc_uint64(tvb, pinfo, entry_tree, hf_nfs_readdir_entry3_fileid,
3882 offset = dissect_filename3(tvb, offset, pinfo, entry_tree,
3883 hf_nfs_readdir_entry3_name, &name);
3885 proto_item_set_text(entry_item, "Entry: name %s", name);
3888 offset = dissect_rpc_uint64(tvb, pinfo, entry_tree, hf_nfs_readdir_entry3_cookie,
3891 /* now we know, that a readdir entry is shorter */
3893 proto_item_set_len(entry_item, offset - old_offset);
3900 /* RFC 1813, Page 76..80 */
3902 dissect_nfs3_readdir_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
3908 offset = dissect_stat(tvb, offset, pinfo, tree, &status);
3911 offset = dissect_post_op_attr(tvb, offset, pinfo, tree,
3913 offset = dissect_cookieverf3(tvb, offset, pinfo, tree);
3914 offset = dissect_rpc_list(tvb, pinfo, tree, offset,
3916 eof_value = tvb_get_ntohl(tvb, offset+0);
3918 proto_tree_add_uint(tree, hf_nfs_readdir_eof, tvb,
3919 offset+ 0, 4, eof_value);
3923 offset = dissect_post_op_attr(tvb, offset, pinfo, tree,
3932 /* RFC 1813, Page 80..83 */
3934 dissect_nfs3_readdirplus_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
3937 offset = dissect_nfs_fh3 (tvb, offset, pinfo, tree, "dir");
3938 offset = dissect_rpc_uint64(tvb, pinfo, tree, hf_nfs_cookie3, offset);
3939 offset = dissect_cookieverf3(tvb, offset, pinfo, tree);
3940 offset = dissect_rpc_uint32(tvb, pinfo, tree, hf_nfs_count3_dircount,
3942 offset = dissect_rpc_uint32(tvb, pinfo, tree, hf_nfs_count3_maxcount,
3949 /* RFC 1813, Page 80..83 */
3951 dissect_entryplus3(tvbuff_t *tvb, int offset, packet_info *pinfo,
3954 proto_item* entry_item = NULL;
3955 proto_tree* entry_tree = NULL;
3956 int old_offset = offset;
3960 entry_item = proto_tree_add_item(tree, hf_nfs_readdir_entry, tvb,
3961 offset+0, -1, FALSE);
3962 entry_tree = proto_item_add_subtree(entry_item, ett_nfs_readdir_entry);
3965 offset = dissect_rpc_uint64(tvb, pinfo, entry_tree,
3966 hf_nfs_readdirplus_entry_fileid, offset);
3968 offset = dissect_filename3(tvb, offset, pinfo, entry_tree,
3969 hf_nfs_readdirplus_entry_name, &name);
3971 proto_item_set_text(entry_item, "Entry: name %s", name);
3974 offset = dissect_rpc_uint64(tvb, pinfo, entry_tree, hf_nfs_readdirplus_entry_cookie,
3977 offset = dissect_post_op_attr(tvb, offset, pinfo, entry_tree,
3979 offset = dissect_post_op_fh3(tvb, offset, pinfo, entry_tree, "name_handle");
3981 /* now we know, that a readdirplus entry is shorter */
3983 proto_item_set_len(entry_item, offset - old_offset);
3990 /* RFC 1813, Page 80..83 */
3992 dissect_nfs3_readdirplus_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
3998 offset = dissect_stat(tvb, offset, pinfo, tree, &status);
4001 offset = dissect_post_op_attr(tvb, offset, pinfo, tree,
4003 offset = dissect_cookieverf3(tvb, offset, pinfo, tree);
4004 offset = dissect_rpc_list(tvb, pinfo, tree, offset,
4005 dissect_entryplus3);
4006 eof_value = tvb_get_ntohl(tvb, offset+0);
4008 proto_tree_add_uint(tree, hf_nfs_readdir_eof, tvb,
4009 offset+ 0, 4, eof_value);
4013 offset = dissect_post_op_attr(tvb, offset, pinfo, tree,
4022 /* RFC 1813, Page 84..86 */
4024 dissect_nfs3_fsstat_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
4030 offset = dissect_nfsstat3(tvb, offset, pinfo, tree, &status);
4033 offset = dissect_post_op_attr(tvb, offset, pinfo, tree,
4035 offset = dissect_rpc_uint64(tvb, pinfo, tree, hf_nfs_fsstat3_resok_tbytes,
4037 offset = dissect_rpc_uint64(tvb, pinfo, tree, hf_nfs_fsstat3_resok_fbytes,
4039 offset = dissect_rpc_uint64(tvb, pinfo, tree, hf_nfs_fsstat3_resok_abytes,
4041 offset = dissect_rpc_uint64(tvb, pinfo, tree, hf_nfs_fsstat3_resok_tfiles,
4043 offset = dissect_rpc_uint64(tvb, pinfo, tree, hf_nfs_fsstat3_resok_ffiles,
4045 offset = dissect_rpc_uint64(tvb, pinfo, tree, hf_nfs_fsstat3_resok_afiles,
4047 invarsec = tvb_get_ntohl(tvb, offset + 0);
4049 proto_tree_add_uint(tree, hf_nfs_fsstat_invarsec, tvb,
4050 offset+0, 4, invarsec);
4054 offset = dissect_post_op_attr(tvb, offset, pinfo, tree,
4063 #define FSF3_LINK 0x0001
4064 #define FSF3_SYMLINK 0x0002
4065 #define FSF3_HOMOGENEOUS 0x0008
4066 #define FSF3_CANSETTIME 0x0010
4069 /* RFC 1813, Page 86..90 */
4071 dissect_nfs3_fsinfo_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
4083 proto_item* properties_item = NULL;
4084 proto_tree* properties_tree = NULL;
4086 offset = dissect_nfsstat3(tvb, offset, pinfo, tree, &status);
4089 offset = dissect_post_op_attr(tvb, offset, pinfo, tree,
4091 rtmax = tvb_get_ntohl(tvb, offset+0);
4093 proto_tree_add_uint(tree, hf_nfs_fsinfo_rtmax, tvb,
4094 offset+0, 4, rtmax);
4096 rtpref = tvb_get_ntohl(tvb, offset+0);
4098 proto_tree_add_uint(tree, hf_nfs_fsinfo_rtpref, tvb,
4099 offset+0, 4, rtpref);
4101 rtmult = tvb_get_ntohl(tvb, offset+0);
4103 proto_tree_add_uint(tree, hf_nfs_fsinfo_rtmult, tvb,
4104 offset+0, 4, rtmult);
4106 wtmax = tvb_get_ntohl(tvb, offset+0);
4108 proto_tree_add_uint(tree, hf_nfs_fsinfo_wtmax, tvb,
4109 offset+0, 4, wtmax);
4111 wtpref = tvb_get_ntohl(tvb, offset+0);
4113 proto_tree_add_uint(tree, hf_nfs_fsinfo_wtpref, tvb,
4114 offset+0, 4, wtpref);
4116 wtmult = tvb_get_ntohl(tvb, offset+0);
4118 proto_tree_add_uint(tree, hf_nfs_fsinfo_wtmult, tvb,
4119 offset+0, 4, wtmult);
4121 dtpref = tvb_get_ntohl(tvb, offset+0);
4123 proto_tree_add_uint(tree, hf_nfs_fsinfo_dtpref, tvb,
4124 offset+0, 4, dtpref);
4127 offset = dissect_rpc_uint64(tvb, pinfo, tree,
4128 hf_nfs_fsinfo_maxfilesize, offset);
4129 offset = dissect_nfstime3(tvb, offset, pinfo, tree, hf_nfs_dtime, hf_nfs_dtime_sec, hf_nfs_dtime_nsec);
4130 properties = tvb_get_ntohl(tvb, offset+0);
4132 properties_item = proto_tree_add_uint(tree,
4133 hf_nfs_fsinfo_properties,
4134 tvb, offset+0, 4, properties);
4135 if (properties_item)
4136 properties_tree = proto_item_add_subtree(properties_item,
4137 ett_nfs_fsinfo_properties);
4138 if (properties_tree) {
4139 proto_tree_add_text(properties_tree, tvb,
4141 decode_boolean_bitfield(properties,
4143 "SETATTR can set time on server",
4144 "SETATTR can't set time on server"));
4146 proto_tree_add_text(properties_tree, tvb,
4148 decode_boolean_bitfield(properties,
4150 "PATHCONF is valid for all files",
4151 "PATHCONF should be get for every single file"));
4153 proto_tree_add_text(properties_tree, tvb,
4155 decode_boolean_bitfield(properties,
4157 "File System supports symbolic links",
4158 "File System does not symbolic hard links"));
4160 proto_tree_add_text(properties_tree, tvb,
4162 decode_boolean_bitfield(properties,
4164 "File System supports hard links",
4165 "File System does not support hard links"));
4171 offset = dissect_post_op_attr(tvb, offset, pinfo, tree,
4180 /* RFC 1813, Page 90..92 */
4182 dissect_nfs3_pathconf_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
4189 offset = dissect_nfsstat3(tvb, offset, pinfo, tree, &status);
4192 offset = dissect_post_op_attr(tvb, offset, pinfo, tree,
4194 linkmax = tvb_get_ntohl(tvb, offset + 0);
4196 proto_tree_add_uint(tree, hf_nfs_pathconf_linkmax, tvb,
4197 offset+0, 4, linkmax);
4199 name_max = tvb_get_ntohl(tvb, offset + 0);
4201 proto_tree_add_uint(tree, hf_nfs_pathconf_name_max, tvb,
4202 offset+0, 4, name_max);
4204 offset = dissect_rpc_bool(tvb, pinfo, tree,
4205 hf_nfs_pathconf_no_trunc, offset);
4206 offset = dissect_rpc_bool(tvb, pinfo, tree,
4207 hf_nfs_pathconf_chown_restricted, offset);
4208 offset = dissect_rpc_bool(tvb, pinfo, tree,
4209 hf_nfs_pathconf_case_insensitive, offset);
4210 offset = dissect_rpc_bool(tvb, pinfo, tree,
4211 hf_nfs_pathconf_case_preserving, offset);
4214 offset = dissect_post_op_attr(tvb, offset, pinfo, tree,
4223 /* RFC 1813, Page 92..95 */
4225 dissect_nfs3_commit_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
4228 offset = dissect_nfs_fh3(tvb, offset, pinfo, tree, "file");
4229 offset = dissect_rpc_uint64(tvb, pinfo, tree, hf_nfs_offset3, offset);
4230 offset = dissect_rpc_uint32(tvb, pinfo, tree, hf_nfs_count3, offset);
4235 /* RFC 1813, Page 92..95 */
4237 dissect_nfs3_commit_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
4242 offset = dissect_nfsstat3(tvb, offset, pinfo, tree, &status);
4245 offset = dissect_wcc_data (tvb, offset, pinfo, tree, "file_wcc");
4246 offset = dissect_writeverf3(tvb, offset, pinfo, tree);
4249 offset = dissect_wcc_data(tvb, offset, pinfo, tree, "file_wcc");
4256 /**********************************************************/
4257 /* NFS Version 4, RFC 3010 with nfs4_prot.x 1.103 changes */
4258 /**********************************************************/
4261 dissect_nfs_utf8string(tvbuff_t *tvb, int offset, packet_info *pinfo,
4262 proto_tree *tree, int hf, char **string_ret)
4264 /* TODO: this needs to be fixed */
4265 return dissect_rpc_string(tvb, pinfo, tree, hf, offset, string_ret);
4269 dissect_nfs_linktext4(tvbuff_t *tvb, int offset, packet_info *pinfo,
4270 proto_tree *tree, char *name)
4272 return dissect_nfs_utf8string(tvb, offset, pinfo, tree, hf_nfs_linktext4,
4277 dissect_nfs_specdata4(tvbuff_t *tvb, int offset, packet_info *pinfo,
4278 proto_tree *tree, char *name)
4280 offset = dissect_rpc_uint32(tvb, pinfo, tree, hf_nfs_specdata1, offset);
4281 offset = dissect_rpc_uint32(tvb, pinfo, tree, hf_nfs_specdata2, offset);
4287 dissect_nfs_clientid4(tvbuff_t *tvb, int offset, packet_info *pinfo,
4290 offset = dissect_rpc_uint64(tvb, pinfo, tree, hf_nfs_clientid4, offset);
4295 static const value_string names_ftype4[] = {
4296 { NF4REG, "NF4REG" },
4297 { NF4DIR, "NF4DIR" },
4298 { NF4BLK, "NF4BLK" },
4299 { NF4CHR, "NF4CHR" },
4300 { NF4LNK, "NF4LNK" },
4301 { NF4SOCK, "NF4SOCK" },
4302 { NF4FIFO, "NF4FIFO" },
4303 { NF4ATTRDIR, "NF4ATTRDIR" },
4304 { NF4NAMEDATTR, "NF4NAMEDATTR" },
4309 dissect_nfs_component4(tvbuff_t *tvb, int offset, packet_info *pinfo,
4310 proto_tree *tree, char *name)
4312 return dissect_nfs_utf8string(tvb, offset, pinfo, tree, hf_nfs_component4,
4317 dissect_nfs_reclaim4(tvbuff_t *tvb, int offset, packet_info *pinfo,
4318 proto_tree *tree, char *name)
4320 offset = dissect_rpc_uint32(tvb, pinfo, tree, hf_nfs_reclaim4, offset);
4325 dissect_nfs_length4(tvbuff_t *tvb, int offset, packet_info *pinfo,
4326 proto_tree *tree, char *name)
4328 offset = dissect_rpc_uint64(tvb, pinfo, tree, hf_nfs_length4, offset);
4333 dissect_nfs_opaque4(tvbuff_t *tvb, int offset, packet_info *pinfo,
4334 proto_tree *tree, char *name);
4337 dissect_nfs_lock_owner4(tvbuff_t *tvb, int offset, packet_info *pinfo,
4338 proto_tree *tree, char *name)
4340 proto_tree *newftree = NULL;
4341 proto_item *fitem = NULL;
4343 fitem = proto_tree_add_text(tree, tvb, offset, 4, "Owner");
4346 newftree = proto_item_add_subtree(fitem, ett_nfs_lock_owner4);
4349 offset = dissect_rpc_uint64(tvb, pinfo, newftree, hf_nfs_clientid4,
4351 offset = dissect_nfs_opaque4(tvb, offset, pinfo, newftree, "Owner");
4359 dissect_nfs_pathname4(tvbuff_t *tvb, int offset, packet_info *pinfo,
4360 proto_tree *tree, char *name)
4362 guint comp_count, i;
4363 proto_item *fitem = NULL;
4364 proto_tree *newftree = NULL;
4366 comp_count=tvb_get_ntohl(tvb, offset);
4367 fitem = proto_tree_add_text(tree, tvb, offset, 4,
4368 "pathname components (%d)", comp_count);
4372 newftree = proto_item_add_subtree(fitem, ett_nfs_pathname4);
4375 for (i=0; i<comp_count; i++)
4376 offset=dissect_nfs_component4(tvb, offset, pinfo, newftree, "comp");
4384 dissect_nfs_changeid4(tvbuff_t *tvb, int offset, packet_info *pinfo,
4385 proto_tree *tree, char *name)
4387 offset = dissect_rpc_uint64(tvb, pinfo, tree, hf_nfs_changeid4, offset);
4392 dissect_nfs_nfstime4(tvbuff_t *tvb, int offset, packet_info *pinfo,
4393 proto_tree *tree, char *name)
4395 offset = dissect_rpc_uint64(tvb, pinfo, tree, hf_nfs_nfstime4_seconds,
4397 offset = dissect_rpc_uint32(tvb, pinfo, tree, hf_nfs_nfstime4_nseconds,
4402 static const value_string names_time_how4[] = {
4403 #define SET_TO_SERVER_TIME4 0
4404 { SET_TO_SERVER_TIME4, "SET_TO_SERVER_TIME4" },
4405 #define SET_TO_CLIENT_TIME4 1
4406 { SET_TO_CLIENT_TIME4, "SET_TO_CLIENT_TIME4" },
4411 dissect_nfs_settime4(tvbuff_t *tvb, int offset, packet_info *pinfo,
4412 proto_tree *tree, char *name)
4416 set_it = tvb_get_ntohl(tvb, offset);
4417 proto_tree_add_uint(tree, hf_nfs_time_how4, tvb, offset+0,
4421 if (set_it == SET_TO_CLIENT_TIME4)
4422 offset = dissect_nfs_nfstime4(tvb, offset, pinfo, tree, NULL);
4427 static const value_string names_fattr4_expire_type[] = {
4428 #define FH4_PERSISTENT 0x00000000
4429 { FH4_PERSISTENT, "FH4_PERSISTENT" },
4430 #define FH4_NOEXPIRE_WITH_OPEN 0x00000001
4431 { FH4_NOEXPIRE_WITH_OPEN, "FH4_NOEXPIRE_WITH_OPEN" },
4432 #define FH4_VOLATILE_ANY 0x00000002
4433 { FH4_NOEXPIRE_WITH_OPEN, "FH4_NOEXPIRE_WITH_OPEN" },
4434 #define FH4_VOL_MIGRATION 0x00000004
4435 { FH4_VOL_MIGRATION, "FH4_VOL_MIGRATION" },
4436 #define FH4_VOL_RENAME 0x00000008
4437 { FH4_VOL_RENAME, "FH4_VOL_RENAME" },
4442 dissect_nfs_fh_expire_type(tvbuff_t *tvb, int offset, packet_info *pinfo,
4445 guint32 fattr4_fh_expire_type;
4447 fattr4_fh_expire_type = tvb_get_ntohl(tvb, offset);
4448 proto_tree_add_uint(tree, hf_nfs_fattr4_expire_type, tvb, offset+0,
4449 4, fattr4_fh_expire_type);
4456 dissect_nfs_fsid4(tvbuff_t *tvb, int offset, packet_info *pinfo,
4457 proto_tree *tree, char *name)
4459 proto_tree *newftree = NULL;
4460 proto_item *fitem = NULL;
4462 fitem = proto_tree_add_text(tree, tvb, offset, 0, "%s", name);
4464 if (fitem == NULL) return offset;
4466 newftree = proto_item_add_subtree(fitem, ett_nfs_fsid4);
4468 if (newftree == NULL) return offset;
4470 offset = dissect_rpc_uint64(tvb, pinfo, newftree, hf_nfs_fsid4_major,
4472 offset = dissect_rpc_uint64(tvb, pinfo, newftree, hf_nfs_fsid4_minor,
4479 dissect_nfs_acetype4(tvbuff_t *tvb, int offset, packet_info *pinfo,
4480 proto_tree *tree, char *name)
4482 offset = dissect_rpc_uint32(tvb, pinfo, tree, hf_nfs_acetype4, offset);
4487 dissect_nfs_aceflag4(tvbuff_t *tvb, int offset, packet_info *pinfo,
4488 proto_tree *tree, char *name)
4490 offset = dissect_rpc_uint32(tvb, pinfo, tree, hf_nfs_aceflag4, offset);
4495 dissect_nfs_acemask4(tvbuff_t *tvb, int offset, packet_info *pinfo,
4496 proto_tree *tree, char *name)
4498 return dissect_rpc_uint32(tvb, pinfo, tree, hf_nfs_acemask4, offset);
4502 dissect_nfs_nfsace4(tvbuff_t *tvb, int offset, packet_info *pinfo,
4503 proto_tree *tree, char *name)
4505 proto_tree *newftree = NULL;
4506 proto_item *fitem = NULL;
4509 fitem = proto_tree_add_text(tree, tvb, offset, 0, "%s", name);
4511 if (fitem == NULL) return offset;
4513 newftree = proto_item_add_subtree(fitem, ett_nfs_fsid4);
4515 if (newftree == NULL) return offset;
4517 nextentry = tvb_get_ntohl(tvb, offset);
4518 offset = dissect_rpc_bool(tvb, pinfo, newftree, hf_nfs_data_follows,
4523 offset = dissect_nfs_acetype4(tvb, offset, pinfo, newftree, "type");
4524 offset = dissect_nfs_aceflag4(tvb, offset, pinfo, newftree, "flag");
4525 offset = dissect_nfs_acemask4(tvb, offset, pinfo, newftree,
4527 offset = dissect_nfs_utf8string(tvb, offset, pinfo, newftree,
4529 nextentry = tvb_get_ntohl(tvb, offset);
4537 dissect_nfs_fh4(tvbuff_t *tvb, int offset, packet_info *pinfo,
4538 proto_tree *tree, char *name)
4540 return dissect_nfs_fh3(tvb, offset, pinfo, tree, name);
4544 dissect_nfs_fs_location4(tvbuff_t *tvb, int offset, packet_info *pinfo,
4545 proto_tree *tree, char *name)
4547 proto_tree *newftree = NULL;
4548 proto_item *fitem = NULL;
4550 fitem = proto_tree_add_text(tree, tvb, offset, 0, "%s", name);
4552 if (fitem == NULL) return offset;
4554 newftree = proto_item_add_subtree(fitem, ett_nfs_fs_location4);
4556 if (newftree == NULL) return offset;
4558 offset = dissect_nfs_utf8string(tvb, offset, pinfo, tree, hf_nfs_server,
4565 dissect_nfs_fs_locations4(tvbuff_t *tvb, int offset, packet_info *pinfo,
4566 proto_tree *tree, char *name)
4568 proto_tree *newftree = NULL;
4569 proto_item *fitem = NULL;
4572 fitem = proto_tree_add_text(tree, tvb, offset, 0, "%s", name);
4574 if (fitem == NULL) return offset;
4576 newftree = proto_item_add_subtree(fitem, ett_nfs_fs_locations4);
4578 if (newftree == NULL) return offset;
4580 offset = dissect_nfs_pathname4(tvb, offset, pinfo, newftree, "fs_root");
4582 nextentry = tvb_get_ntohl(tvb, offset);
4583 offset = dissect_rpc_bool(tvb, pinfo, newftree, hf_nfs_data_follows,
4588 offset = dissect_nfs_fs_location4(tvb, offset, pinfo, newftree,
4590 nextentry = tvb_get_ntohl(tvb, offset);
4598 dissect_nfs_mode4(tvbuff_t *tvb, int offset, packet_info *pinfo,
4599 proto_tree *tree, char *name)
4601 return dissect_mode(tvb, offset, pinfo, tree, name);
4604 static const value_string names_fattr4[] = {
4605 #define FATTR4_SUPPORTED_ATTRS 0
4606 { FATTR4_SUPPORTED_ATTRS, "FATTR4_SUPPORTED_ATTRS" },
4607 #define FATTR4_TYPE 1
4608 { FATTR4_TYPE, "FATTR4_TYPE" },
4609 #define FATTR4_FH_EXPIRE_TYPE 2
4610 { FATTR4_FH_EXPIRE_TYPE, "FATTR4_FH_EXPIRE_TYPE" },
4611 #define FATTR4_CHANGE 3
4612 { FATTR4_CHANGE, "FATTR4_CHANGE" },
4613 #define FATTR4_SIZE 4
4614 { FATTR4_SIZE, "FATTR4_SIZE" },
4615 #define FATTR4_LINK_SUPPORT 5
4616 { FATTR4_LINK_SUPPORT, "FATTR4_LINK_SUPPORT" },
4617 #define FATTR4_SYMLINK_SUPPORT 6
4618 { FATTR4_SYMLINK_SUPPORT, "FATTR4_SYMLINK_SUPPORT" },
4619 #define FATTR4_NAMED_ATTR 7
4620 { FATTR4_NAMED_ATTR, "FATTR4_NAMED_ATTR" },
4621 #define FATTR4_FSID 8
4622 { FATTR4_FSID, "FATTR4_FSID" },
4623 #define FATTR4_UNIQUE_HANDLES 9
4624 { FATTR4_UNIQUE_HANDLES, "FATTR4_UNIQUE_HANDLES" },
4625 #define FATTR4_LEASE_TIME 10
4626 { FATTR4_LEASE_TIME, "FATTR4_LEASE_TIME" },
4627 #define FATTR4_RDATTR_ERROR 11
4628 { FATTR4_RDATTR_ERROR, "FATTR4_RDATTR_ERROR" },
4629 #define FATTR4_ACL 12
4630 { FATTR4_ACL, "FATTR4_ACL" },
4631 #define FATTR4_ACLSUPPORT 13
4632 { FATTR4_ACLSUPPORT, "FATTR4_ACLSUPPORT" },
4633 #define FATTR4_ARCHIVE 14
4634 { FATTR4_ARCHIVE, "FATTR4_ARCHIVE" },
4635 #define FATTR4_CANSETTIME 15
4636 { FATTR4_CANSETTIME, "FATTR4_CANSETTIME" },
4637 #define FATTR4_CASE_INSENSITIVE 16
4638 { FATTR4_CASE_INSENSITIVE, "FATTR4_CASE_INSENSITIVE" },
4639 #define FATTR4_CASE_PRESERVING 17
4640 { FATTR4_CASE_PRESERVING, "FATTR4_CASE_PRESERVING" },
4641 #define FATTR4_CHOWN_RESTRICTED 18
4642 { FATTR4_CHOWN_RESTRICTED, "FATTR4_CHOWN_RESTRICTED" },
4643 #define FATTR4_FILEHANDLE 19
4644 { FATTR4_FILEHANDLE, "FATTR4_FILEHANDLE" },
4645 #define FATTR4_FILEID 20
4646 { FATTR4_FILEID, "FATTR4_FILEID" },
4647 #define FATTR4_FILES_AVAIL 21
4648 { FATTR4_FILES_AVAIL, "FATTR4_FILES_AVAIL" },
4649 #define FATTR4_FILES_FREE 22
4650 { FATTR4_FILES_FREE, "FATTR4_FILES_FREE" },
4651 #define FATTR4_FILES_TOTAL 23
4652 { FATTR4_FILES_TOTAL, "FATTR4_FILES_TOTAL" },
4653 #define FATTR4_FS_LOCATIONS 24
4654 { FATTR4_FS_LOCATIONS, "FATTR4_FS_LOCATIONS" },
4655 #define FATTR4_HIDDEN 25
4656 { FATTR4_HIDDEN, "FATTR4_HIDDEN" },
4657 #define FATTR4_HOMOGENEOUS 26
4658 { FATTR4_HOMOGENEOUS, "FATTR4_HOMOGENEOUS" },
4659 #define FATTR4_MAXFILESIZE 27
4660 { FATTR4_MAXFILESIZE, "FATTR4_MAXFILESIZE" },
4661 #define FATTR4_MAXLINK 28
4662 { FATTR4_MAXLINK, "FATTR4_MAXLINK" },
4663 #define FATTR4_MAXNAME 29
4664 { FATTR4_MAXNAME, "FATTR4_MAXNAME" },
4665 #define FATTR4_MAXREAD 30
4666 { FATTR4_MAXREAD, "FATTR4_MAXREAD" },
4667 #define FATTR4_MAXWRITE 31
4668 { FATTR4_MAXWRITE, "FATTR4_MAXWRITE" },
4669 #define FATTR4_MIMETYPE 32
4670 { FATTR4_MIMETYPE, "FATTR4_MIMETYPE" },
4671 #define FATTR4_MODE 33
4672 { FATTR4_MODE, "FATTR4_MODE" },
4673 #define FATTR4_NO_TRUNC 34
4674 { FATTR4_NO_TRUNC, "FATTR4_NO_TRUNC" },
4675 #define FATTR4_NUMLINKS 35
4676 { FATTR4_NUMLINKS, "FATTR4_NUMLINKS" },
4677 #define FATTR4_OWNER 36
4678 { FATTR4_OWNER, "FATTR4_OWNER" },
4679 #define FATTR4_OWNER_GROUP 37
4680 { FATTR4_OWNER_GROUP, "FATTR4_OWNER_GROUP" },
4681 #define FATTR4_QUOTA_AVAIL_HARD 38
4682 { FATTR4_QUOTA_AVAIL_HARD, "FATTR4_QUOTA_AVAIL_HARD" },
4683 #define FATTR4_QUOTA_AVAIL_SOFT 39
4684 { FATTR4_QUOTA_AVAIL_SOFT, "FATTR4_QUOTA_AVAIL_SOFT" },
4685 #define FATTR4_QUOTA_USED 40
4686 { FATTR4_QUOTA_USED, "FATTR4_QUOTA_USED" },
4687 #define FATTR4_RAWDEV 41
4688 { FATTR4_RAWDEV, "FATTR4_RAWDEV" },
4689 #define FATTR4_SPACE_AVAIL 42
4690 { FATTR4_SPACE_AVAIL, "FATTR4_SPACE_AVAIL" },
4691 #define FATTR4_SPACE_FREE 43
4692 { FATTR4_SPACE_FREE, "FATTR4_SPACE_FREE" },
4693 #define FATTR4_SPACE_TOTAL 44
4694 { FATTR4_SPACE_TOTAL, "FATTR4_SPACE_TOTAL" },
4695 #define FATTR4_SPACE_USED 45
4696 { FATTR4_SPACE_USED, "FATTR4_SPACE_USED" },
4697 #define FATTR4_SYSTEM 46
4698 { FATTR4_SYSTEM, "FATTR4_SYSTEM" },
4699 #define FATTR4_TIME_ACCESS 47
4700 { FATTR4_TIME_ACCESS, "FATTR4_TIME_ACCESS" },
4701 #define FATTR4_TIME_ACCESS_SET 48
4702 { FATTR4_TIME_ACCESS_SET, "FATTR4_TIME_ACCESS_SET" },
4703 #define FATTR4_TIME_BACKUP 49
4704 { FATTR4_TIME_BACKUP, "FATTR4_TIME_BACKUP" },
4705 #define FATTR4_TIME_CREATE 50
4706 { FATTR4_TIME_CREATE, "FATTR4_TIME_CREATE" },
4707 #define FATTR4_TIME_DELTA 51
4708 { FATTR4_TIME_DELTA, "FATTR4_TIME_DELTA" },
4709 #define FATTR4_TIME_METADATA 52
4710 { FATTR4_TIME_METADATA, "FATTR4_TIME_METADATA" },
4711 #define FATTR4_TIME_MODIFY 53
4712 { FATTR4_TIME_MODIFY, "FATTR4_TIME_MODIFY" },
4713 #define FATTR4_TIME_MODIFY_SET 54
4714 { FATTR4_TIME_MODIFY_SET, "FATTR4_TIME_MODIFY_SET" },
4718 #define FATTR4_BITMAP_ONLY 0
4719 #define FATTR4_FULL_DISSECT 1
4722 dissect_nfs_attributes(tvbuff_t *tvb, int offset, packet_info *pinfo,
4723 proto_tree *tree, char *name, int type)
4726 proto_item *fitem = NULL;
4727 proto_tree *newftree = NULL;
4728 proto_item *attr_fitem = NULL;
4729 proto_tree *attr_newftree = NULL;
4734 int attr_vals_offset;
4736 bitmap_len = tvb_get_ntohl(tvb, offset);
4737 fitem = proto_tree_add_text(tree, tvb, offset, 4 + bitmap_len * 4,
4741 if (fitem == NULL) return offset;
4743 newftree = proto_item_add_subtree(fitem, ett_nfs_bitmap4);
4745 if (newftree == NULL) return offset;
4747 attr_vals_offset = offset + 4 + bitmap_len * 4;
4749 bitmap = g_malloc(bitmap_len * sizeof(guint32));
4750 if (bitmap == NULL) return offset;
4752 for (i = 0; i < bitmap_len; i++)
4754 if (!tvb_bytes_exist(tvb, offset, 4))
4760 bitmap[i] = tvb_get_ntohl(tvb, offset);
4764 for (j = 0; j < 32; j++)
4770 /* switch label if attribute is recommended vs. mandatory */
4771 attr_fitem = proto_tree_add_uint(newftree,
4772 (fattr < FATTR4_ACL)? hf_nfs_mand_attr: hf_nfs_recc_attr,
4773 tvb, offset, 4, fattr);
4775 if (attr_fitem == NULL) break;
4777 attr_newftree = proto_item_add_subtree(attr_fitem, ett_nfs_bitmap4);
4779 if (attr_newftree == NULL) break;
4781 if (type == FATTR4_FULL_DISSECT)
4783 /* do a full decode of the arguments for the set flag */
4786 case FATTR4_SUPPORTED_ATTRS:
4787 attr_vals_offset = dissect_nfs_attributes(tvb,
4788 attr_vals_offset, pinfo, attr_newftree,
4789 "fattr4_supported_attrs", FATTR4_BITMAP_ONLY);
4793 attr_vals_offset = dissect_rpc_uint32(tvb, pinfo,
4794 attr_newftree, hf_nfs_ftype4, attr_vals_offset);
4797 case FATTR4_FH_EXPIRE_TYPE:
4798 attr_vals_offset = dissect_rpc_uint32(tvb, pinfo,
4799 attr_newftree, hf_nfs_fattr4_expire_type,
4804 attr_vals_offset = dissect_nfs_changeid4(tvb,
4805 attr_vals_offset, pinfo, attr_newftree, "fattr4_change");
4809 attr_vals_offset = dissect_rpc_uint64(tvb, pinfo,
4810 attr_newftree, hf_nfs_fattr4_size, attr_vals_offset);
4813 case FATTR4_LINK_SUPPORT:
4814 attr_vals_offset = dissect_rpc_bool(tvb, pinfo,
4815 attr_newftree, hf_nfs_fattr4_link_support,
4819 case FATTR4_SYMLINK_SUPPORT:
4820 attr_vals_offset = dissect_rpc_bool(tvb, pinfo,
4821 attr_newftree, hf_nfs_fattr4_symlink_support,
4825 case FATTR4_NAMED_ATTR:
4826 attr_vals_offset = dissect_rpc_bool(tvb, pinfo,
4827 attr_newftree, hf_nfs_fattr4_named_attr, attr_vals_offset);
4831 attr_vals_offset = dissect_nfs_fsid4(tvb, attr_vals_offset,
4832 pinfo, attr_newftree, "fattr4_fsid");
4835 case FATTR4_UNIQUE_HANDLES:
4836 attr_vals_offset = dissect_rpc_bool(tvb, pinfo,
4837 attr_newftree, hf_nfs_fattr4_unique_handles,
4841 case FATTR4_LEASE_TIME:
4842 attr_vals_offset = dissect_rpc_uint32(tvb, pinfo,
4843 attr_newftree, hf_nfs_fattr4_lease_time,
4847 case FATTR4_RDATTR_ERROR:
4848 attr_vals_offset = dissect_nfs_nfsstat4(tvb, attr_vals_offset,
4849 pinfo, attr_newftree, NULL);
4853 attr_vals_offset = dissect_nfs_nfsace4(tvb, attr_vals_offset,
4854 pinfo, attr_newftree, "fattr4_acl");
4857 case FATTR4_ACLSUPPORT:
4858 attr_vals_offset = dissect_rpc_uint32(tvb, pinfo,
4859 attr_newftree, hf_nfs_fattr4_aclsupport, offset);
4862 case FATTR4_ARCHIVE:
4863 attr_vals_offset = dissect_rpc_bool(tvb,
4864 pinfo, attr_newftree, hf_nfs_fattr4_archive,
4868 case FATTR4_CANSETTIME:
4869 attr_vals_offset = dissect_rpc_bool(tvb, pinfo,
4870 attr_newftree, hf_nfs_fattr4_cansettime, attr_vals_offset);
4873 case FATTR4_CASE_INSENSITIVE:
4874 attr_vals_offset = dissect_rpc_bool(tvb, pinfo,
4875 attr_newftree, hf_nfs_fattr4_case_insensitive,
4879 case FATTR4_CASE_PRESERVING:
4880 attr_vals_offset = dissect_rpc_bool(tvb, pinfo,
4881 attr_newftree, hf_nfs_fattr4_case_preserving,
4885 case FATTR4_CHOWN_RESTRICTED:
4886 attr_vals_offset = dissect_rpc_bool(tvb, pinfo,
4887 attr_newftree, hf_nfs_fattr4_chown_restricted,
4892 attr_vals_offset = dissect_rpc_uint64(tvb, pinfo,
4893 attr_newftree, hf_nfs_fattr4_fileid, attr_vals_offset);
4896 case FATTR4_FILES_AVAIL:
4897 attr_vals_offset = dissect_rpc_uint64(tvb, pinfo,
4898 attr_newftree, hf_nfs_fattr4_files_avail,
4902 case FATTR4_FILEHANDLE:
4903 attr_vals_offset = dissect_nfs_fh4(tvb, attr_vals_offset,
4904 pinfo, attr_newftree, "fattr4_filehandle");
4907 case FATTR4_FILES_FREE:
4908 attr_vals_offset = dissect_rpc_uint64(tvb, pinfo,
4909 attr_newftree, hf_nfs_fattr4_files_free, attr_vals_offset);
4912 case FATTR4_FILES_TOTAL:
4913 attr_vals_offset = dissect_rpc_uint64(tvb, pinfo,
4914 attr_newftree, hf_nfs_fattr4_files_total,
4918 case FATTR4_FS_LOCATIONS:
4919 attr_vals_offset = dissect_nfs_fs_locations4(tvb,
4920 attr_vals_offset, pinfo, attr_newftree,
4921 "fattr4_fs_locations");
4925 attr_vals_offset = dissect_rpc_bool(tvb, pinfo,
4926 attr_newftree, hf_nfs_fattr4_hidden, attr_vals_offset);
4929 case FATTR4_HOMOGENEOUS:
4930 attr_vals_offset = dissect_rpc_bool(tvb, pinfo,
4931 attr_newftree, hf_nfs_fattr4_homogeneous,
4935 case FATTR4_MAXFILESIZE:
4936 attr_vals_offset = dissect_rpc_uint64(tvb, pinfo,
4937 attr_newftree, hf_nfs_fattr4_maxfilesize,
4941 case FATTR4_MAXLINK:
4942 attr_vals_offset = dissect_rpc_uint32(tvb, pinfo,
4943 attr_newftree, hf_nfs_fattr4_maxlink, attr_vals_offset);
4946 case FATTR4_MAXNAME:
4947 attr_vals_offset = dissect_rpc_uint32(tvb, pinfo,
4948 attr_newftree, hf_nfs_fattr4_maxname, attr_vals_offset);
4951 case FATTR4_MAXREAD:
4952 attr_vals_offset = dissect_rpc_uint64(tvb, pinfo,
4953 attr_newftree, hf_nfs_fattr4_maxread, attr_vals_offset);
4956 case FATTR4_MAXWRITE:
4957 attr_vals_offset = dissect_rpc_uint64(tvb, pinfo,
4958 attr_newftree, hf_nfs_fattr4_maxwrite, attr_vals_offset);
4961 case FATTR4_MIMETYPE:
4962 attr_vals_offset = dissect_nfs_utf8string(tvb,
4963 attr_vals_offset, pinfo, attr_newftree,
4964 hf_nfs_fattr4_mimetype, NULL);
4968 attr_vals_offset = dissect_nfs_mode4(tvb,
4969 attr_vals_offset, pinfo, attr_newftree, "fattr4_mode");
4972 case FATTR4_NO_TRUNC:
4973 attr_vals_offset = dissect_rpc_bool(tvb, pinfo,
4974 attr_newftree, hf_nfs_fattr4_no_trunc, attr_vals_offset);
4977 case FATTR4_NUMLINKS:
4978 attr_vals_offset = dissect_rpc_uint32(tvb, pinfo,
4979 attr_newftree, hf_nfs_fattr4_numlinks, attr_vals_offset);
4983 attr_vals_offset = dissect_nfs_utf8string(tvb,
4984 attr_vals_offset, pinfo, attr_newftree,
4985 hf_nfs_fattr4_owner,
4989 case FATTR4_OWNER_GROUP:
4990 attr_vals_offset = dissect_nfs_utf8string(tvb,
4991 attr_vals_offset, pinfo, attr_newftree,
4992 hf_nfs_fattr4_owner_group, NULL);
4995 case FATTR4_QUOTA_AVAIL_HARD:
4996 attr_vals_offset = dissect_rpc_uint64(tvb, pinfo,
4997 attr_newftree, hf_nfs_fattr4_quota_hard, attr_vals_offset);
5000 case FATTR4_QUOTA_AVAIL_SOFT:
5001 attr_vals_offset = dissect_rpc_uint64(tvb, pinfo,
5002 attr_newftree, hf_nfs_fattr4_quota_soft, attr_vals_offset);
5005 case FATTR4_QUOTA_USED:
5006 attr_vals_offset = dissect_rpc_uint64(tvb, pinfo,
5007 attr_newftree, hf_nfs_fattr4_quota_used, attr_vals_offset);
5011 attr_vals_offset = dissect_nfs_specdata4(tvb,
5012 attr_vals_offset, pinfo, attr_newftree, "fattr4_rawdev");
5015 case FATTR4_SPACE_AVAIL:
5016 attr_vals_offset = dissect_rpc_uint64(tvb, pinfo,
5017 attr_newftree, hf_nfs_fattr4_space_avail,
5021 case FATTR4_SPACE_FREE:
5022 attr_vals_offset = dissect_rpc_uint64(tvb, pinfo,
5023 attr_newftree, hf_nfs_fattr4_space_free, attr_vals_offset);
5026 case FATTR4_SPACE_TOTAL:
5027 attr_vals_offset = dissect_rpc_uint64(tvb, pinfo,
5028 attr_newftree, hf_nfs_fattr4_space_total,
5032 case FATTR4_SPACE_USED:
5033 attr_vals_offset = dissect_rpc_uint64(tvb, pinfo,
5034 attr_newftree, hf_nfs_fattr4_space_used, attr_vals_offset);
5038 attr_vals_offset = dissect_rpc_bool(tvb, pinfo,
5039 attr_newftree, hf_nfs_fattr4_system, attr_vals_offset);
5042 case FATTR4_TIME_ACCESS:
5043 case FATTR4_TIME_BACKUP:
5044 case FATTR4_TIME_CREATE:
5045 case FATTR4_TIME_DELTA:
5046 case FATTR4_TIME_METADATA:
5047 case FATTR4_TIME_MODIFY:
5048 attr_vals_offset = dissect_nfs_nfstime4(tvb, attr_vals_offset,
5049 pinfo, attr_newftree, "nfstime4");
5052 case FATTR4_TIME_ACCESS_SET:
5053 case FATTR4_TIME_MODIFY_SET:
5054 attr_vals_offset = dissect_nfs_settime4(tvb,
5055 attr_vals_offset, pinfo, attr_newftree, "settime4");
5076 dissect_nfs_fattr4(tvbuff_t *tvb, int offset, packet_info *pinfo,
5077 proto_tree *tree, char *name)
5079 proto_tree *newftree = NULL;
5080 proto_item *fitem = NULL;
5082 fitem = proto_tree_add_text(tree, tvb, offset, 4, "obj_attributes");
5084 if (fitem == NULL) return offset;
5086 newftree = proto_item_add_subtree(fitem, ett_nfs_fattr4);
5088 if (newftree == NULL) return offset;
5090 offset = dissect_nfs_attributes(tvb, offset, pinfo, newftree, name,
5091 FATTR4_FULL_DISSECT);
5093 offset = dissect_nfsdata(tvb, offset, pinfo, tree, hf_nfs_attrlist4);
5098 static const value_string names_open4_share_access[] = {
5099 #define OPEN4_SHARE_ACCESS_READ 0x00000001
5100 { OPEN4_SHARE_ACCESS_READ, "OPEN4_SHARE_ACCESS_READ" },
5101 #define OPEN4_SHARE_ACCESS_WRITE 0x00000002
5102 { OPEN4_SHARE_ACCESS_WRITE, "OPEN4_SHARE_ACCESS_WRITE" },
5103 #define OPEN4_SHARE_ACCESS_BOTH 0x00000003
5104 { OPEN4_SHARE_ACCESS_BOTH, "OPEN4_SHARE_ACCESS_BOTH" },
5109 dissect_nfs_open4_share_access(tvbuff_t *tvb, int offset, packet_info *pinfo,
5114 share_access = tvb_get_ntohl(tvb, offset);
5115 proto_tree_add_uint(tree, hf_nfs_open4_share_access, tvb, offset, 4,
5122 static const value_string names_open4_share_deny[] = {
5123 #define OPEN4_SHARE_DENY_NONE 0x00000000
5124 { OPEN4_SHARE_DENY_NONE, "OPEN4_SHARE_DENY_NONE" },
5125 #define OPEN4_SHARE_DENY_READ 0x00000001
5126 { OPEN4_SHARE_DENY_READ, "OPEN4_SHARE_DENY_READ" },
5127 #define OPEN4_SHARE_DENY_WRITE 0x00000002
5128 { OPEN4_SHARE_DENY_WRITE, "OPEN4_SHARE_DENY_WRITE" },
5129 #define OPEN4_SHARE_DENY_BOTH 0x00000003
5130 { OPEN4_SHARE_DENY_BOTH, "OPEN4_SHARE_DENY_BOTH" },
5135 dissect_nfs_open4_share_deny(tvbuff_t *tvb, int offset, packet_info *pinfo,
5140 deny_access = tvb_get_ntohl(tvb, offset);
5141 proto_tree_add_uint(tree, hf_nfs_open4_share_deny, tvb, offset, 4,
5149 dissect_nfs_open_owner4(tvbuff_t *tvb, int offset, packet_info *pinfo,
5152 offset = dissect_nfs_clientid4(tvb, offset, pinfo, tree);
5153 offset = dissect_nfsdata(tvb, offset, pinfo, tree, hf_nfs_open_owner4);
5159 dissect_nfs_open_claim_delegate_cur4(tvbuff_t *tvb, int offset,
5160 packet_info *pinfo, proto_tree *tree, char *name)
5162 offset = dissect_rpc_uint64(tvb, pinfo, tree,
5163 hf_nfs_stateid4_delegate_stateid, offset);
5164 offset = dissect_nfs_component4(tvb, offset, pinfo, tree, "file");
5168 #define CLAIM_NULL 0
5169 #define CLAIM_PREVIOUS 1
5170 #define CLAIM_DELEGATE_CUR 2
5171 #define CLAIM_DELEGATE_PREV 3
5173 static const value_string names_claim_type4[] = {
5174 { CLAIM_NULL, "CLAIM_NULL" },
5175 { CLAIM_PREVIOUS, "CLAIM_PREVIOUS" },
5176 { CLAIM_DELEGATE_CUR, "CLAIM_DELEGATE_CUR" },
5177 { CLAIM_DELEGATE_PREV, "CLAIM_DELEGATE_PREV" },
5182 dissect_nfs_open_claim4(tvbuff_t *tvb, int offset, packet_info *pinfo,
5183 proto_tree *tree, char *name)
5185 guint open_claim_type4;
5186 proto_item *fitem = NULL;
5187 proto_tree *newftree = NULL;
5189 open_claim_type4 = tvb_get_ntohl(tvb, offset);
5190 fitem = proto_tree_add_uint(tree, hf_nfs_open_claim_type4, tvb,
5191 offset+0, 4, open_claim_type4);
5195 newftree = proto_item_add_subtree(fitem, ett_nfs_open_claim4);
5199 switch(open_claim_type4)
5202 offset = dissect_nfs_component4(tvb, offset, pinfo, newftree,
5206 case CLAIM_PREVIOUS:
5207 offset = dissect_rpc_uint32(tvb, pinfo, newftree,
5208 hf_nfs_delegate_type, offset);
5211 case CLAIM_DELEGATE_CUR:
5212 offset = dissect_nfs_open_claim_delegate_cur4(tvb, offset, pinfo,
5213 newftree, "delegate_cur_info");
5216 case CLAIM_DELEGATE_PREV:
5217 offset = dissect_nfs_component4(tvb, offset, pinfo, newftree,
5218 "file_delegate_prev");
5231 dissect_nfs_createhow4(tvbuff_t *tvb, int offset, packet_info *pinfo,
5232 proto_tree *tree, char *name)
5236 /* This is intentional; we're using the same flags as NFSv3 */
5237 mode = tvb_get_ntohl(tvb, offset);
5238 proto_tree_add_uint(tree, hf_nfs_createmode3, tvb, offset, 4, mode);
5243 case UNCHECKED: /* UNCHECKED4 */
5244 case GUARDED: /* GUARDED4 */
5245 offset = dissect_nfs_fattr4(tvb, offset, pinfo, tree, "createattrs");
5248 case EXCLUSIVE: /* EXCLUSIVE4 */
5249 offset = dissect_rpc_uint64(tvb, pinfo, tree, hf_nfs_verifier4, offset);
5259 #define OPEN4_NOCREATE 0
5260 #define OPEN4_CREATE 1
5261 static const value_string names_opentype4[] = {
5262 { OPEN4_NOCREATE, "OPEN4_NOCREATE" },
5263 { OPEN4_CREATE, "OPEN4_CREATE" },
5268 dissect_nfs_openflag4(tvbuff_t *tvb, int offset, packet_info *pinfo,
5272 proto_item *fitem = NULL;
5273 proto_tree *newftree = NULL;
5275 opentype4 = tvb_get_ntohl(tvb, offset);
5276 fitem = proto_tree_add_uint(tree, hf_nfs_opentype4, tvb,
5277 offset+0, 4, opentype4);
5281 newftree = proto_item_add_subtree(fitem, ett_nfs_opentype4);
5288 offset = dissect_nfs_createhow4(tvb, offset, pinfo, newftree,
5302 dissect_nfs_clientaddr4(tvbuff_t *tvb, int offset, packet_info *pinfo,
5303 proto_tree *tree, char *name)
5305 offset = dissect_nfs_opaque4(tvb, offset, pinfo, tree, "network id");
5306 offset = dissect_nfs_opaque4(tvb, offset, pinfo, tree, "universal address");
5313 dissect_nfs_cb_client4(tvbuff_t *tvb, int offset, packet_info *pinfo,
5314 proto_tree *tree, char *name)
5316 offset = dissect_rpc_uint32(tvb, pinfo, tree, hf_nfs_cb_program,
5318 offset = dissect_nfs_clientaddr4(tvb, offset, pinfo, tree, "cb_location");
5322 static const value_string names_stable_how4[] = {
5324 { UNSTABLE4, "UNSTABLE4" },
5325 #define DATA_SYNC4 1
5326 { DATA_SYNC4, "DATA_SYNC4" },
5327 #define FILE_SYNC4 2
5328 { FILE_SYNC4, "FILE_SYNC4" },
5333 dissect_nfs_stable_how4(tvbuff_t *tvb, int offset, packet_info *pinfo,
5334 proto_tree *tree, char *name)
5338 stable_how4 = tvb_get_ntohl(tvb, offset);
5339 proto_tree_add_uint_format(tree, hf_nfs_stable_how4, tvb,
5340 offset+0, 4, stable_how4, "%s: %s (%u)", name,
5341 val_to_str(stable_how4, names_stable_how4, "%u"), stable_how4);
5348 dissect_nfs_opaque4(tvbuff_t *tvb, int offset, packet_info *pinfo,
5349 proto_tree *tree, char *name)
5351 return dissect_nfsdata(tvb, offset, pinfo, tree, hf_nfs_data);
5354 /* There is probably a better (built-in?) way to do this, but this works
5358 static const value_string names_nfsv4_operation[] = {
5359 { NFS4_OP_ACCESS, "ACCESS" },
5360 { NFS4_OP_CLOSE, "CLOSE" },
5361 { NFS4_OP_COMMIT, "COMMIT" },
5362 { NFS4_OP_CREATE, "CREATE" },
5363 { NFS4_OP_DELEGPURGE, "DELEGPURGE" },
5364 { NFS4_OP_DELEGRETURN, "DELEGRETURN" },
5365 { NFS4_OP_GETATTR, "GETATTR" },
5366 { NFS4_OP_GETFH, "GETFH" },
5367 { NFS4_OP_LINK, "LINK" },
5368 { NFS4_OP_LOCK, "LOCK" },
5369 { NFS4_OP_LOCKT, "LOCKT" },
5370 { NFS4_OP_LOCKU, "LOCKU" },
5371 { NFS4_OP_LOOKUP, "LOOKUP" },
5372 { NFS4_OP_NVERIFY, "NVERIFY" },
5373 { NFS4_OP_OPEN, "OPEN" },
5374 { NFS4_OP_OPENATTR, "OPENATTR" },
5375 { NFS4_OP_OPEN_CONFIRM, "OPEN_CONFIRM" },
5376 { NFS4_OP_OPEN_DOWNGRADE, "OPEN_DOWNGRADE" },
5377 { NFS4_OP_PUTFH, "PUTFH" },
5378 { NFS4_OP_PUTPUBFH, "PUTPUBFH" },
5379 { NFS4_OP_PUTROOTFH, "PUTROOTFH" },
5380 { NFS4_OP_READ, "READ" },
5381 { NFS4_OP_READDIR, "READDIR" },
5382 { NFS4_OP_READLINK, "READLINK" },
5383 { NFS4_OP_REMOVE, "REMOVE" },
5384 { NFS4_OP_RENAME, "RENAME" },
5385 { NFS4_OP_RENEW, "RENEW" },
5386 { NFS4_OP_RESTOREFH, "RESTOREFH" },
5387 { NFS4_OP_SAVEFH, "SAVEFH" },
5388 { NFS4_OP_SECINFO, "SECINFO" },
5389 { NFS4_OP_SETATTR, "SETATTR" },
5390 { NFS4_OP_SETCLIENTID, "SETCLIENTID" },
5391 { NFS4_OP_SETCLIENTID_CONFIRM, "SETCLIENTID_CONFIRM" },
5392 { NFS4_OP_VERIFY, "VERIFY" },
5393 { NFS4_OP_WRITE, "WRITE" },
5397 gint *nfsv4_operation_ett[] =
5403 &ett_nfs_delegpurge4 ,
5404 &ett_nfs_delegreturn4 ,
5415 &ett_nfs_openattr4 ,
5416 &ett_nfs_open_confirm4 ,
5417 &ett_nfs_open_downgrade4 ,
5419 &ett_nfs_putpubfh4 ,
5420 &ett_nfs_putrootfh4 ,
5423 &ett_nfs_readlink4 ,
5427 &ett_nfs_restorefh4 ,
5431 &ett_nfs_setclientid4 ,
5432 &ett_nfs_setclientid_confirm4 ,
5438 dissect_nfs_dirlist4(tvbuff_t *tvb, int offset, packet_info *pinfo,
5439 proto_tree *tree, char *name)
5441 proto_tree *newftree = NULL;
5444 newftree = proto_item_add_subtree(tree, ett_nfs_dirlist4);
5445 if (newftree==NULL) return offset;
5447 nextentry = tvb_get_ntohl(tvb, offset);
5449 offset = dissect_rpc_bool(tvb, pinfo, newftree, hf_nfs_data_follows,
5454 /* offset = dissect_nfs_cookie4(tvb, offset, pinfo, newftree); */
5455 offset = dissect_rpc_uint64(tvb, pinfo, newftree, hf_nfs_cookie4, offset);
5456 offset = dissect_nfs_component4(tvb, offset, pinfo, newftree, "name");
5457 offset = dissect_nfs_fattr4(tvb, offset, pinfo, newftree, "attrs");
5458 nextentry = tvb_get_ntohl(tvb, offset);
5462 offset = dissect_rpc_bool(tvb, pinfo, newftree, hf_nfs_dirlist4_eof,
5469 dissect_nfs_change_info4(tvbuff_t *tvb, int offset, packet_info *pinfo,
5470 proto_tree *tree, char *name)
5472 proto_tree *newftree = NULL;
5473 proto_tree *fitem = NULL;
5475 fitem = proto_tree_add_text(tree, tvb, offset, 0, "%s", name);
5478 newftree = proto_item_add_subtree(fitem, ett_nfs_change_info4);
5481 offset = dissect_rpc_bool(tvb, pinfo, newftree,
5482 hf_nfs_change_info4_atomic, offset);
5483 offset = dissect_nfs_changeid4(tvb, offset, pinfo, newftree, "before");
5484 offset = dissect_nfs_changeid4(tvb, offset, pinfo, newftree, "after");
5491 static const value_string names_nfs_lock_type4[] =
5494 { READ_LT, "READ_LT" },
5496 { WRITE_LT, "WRITE_LT" },
5498 { READW_LT, "READW_LT" },
5500 { WRITEW_LT, "WRITEW_LT" },
5501 #define RELEASE_STATE 5
5502 { RELEASE_STATE, "RELEASE_STATE" },
5507 dissect_nfs_lock4denied(tvbuff_t *tvb, int offset, packet_info *pinfo,
5508 proto_tree *tree, char *name)
5510 offset = dissect_rpc_uint64(tvb, pinfo, tree, hf_nfs_offset4, offset);
5511 offset = dissect_nfs_length4(tvb, offset, pinfo, tree, "length");
5512 offset = dissect_rpc_uint32(tvb, pinfo, tree, hf_nfs_lock_type4, offset);
5513 offset = dissect_nfs_lock_owner4(tvb, offset, pinfo, tree, "owner");
5519 dissect_nfs_ace4(tvbuff_t *tvb, int offset, packet_info *pinfo,
5520 proto_tree *tree, char *name)
5522 offset = dissect_nfs_acetype4(tvb, offset, pinfo, tree, "type");
5523 offset = dissect_nfs_aceflag4(tvb, offset, pinfo, tree, "flag");
5524 offset = dissect_nfs_acemask4(tvb, offset, pinfo, tree, "access_mask");
5525 return dissect_nfs_utf8string(tvb, offset, pinfo, tree, hf_nfs_ace4, NULL);
5528 static const value_string names_open4_result_flags[] = {
5529 #define OPEN4_RESULT_MLOCK 0x00000001
5530 { OPEN4_RESULT_MLOCK, "OPEN4_RESULT_MLOCK" },
5531 #define OPEN4_RESULT_CONFIRM 0x00000002
5532 { OPEN4_RESULT_CONFIRM, "OPEN4_RESULT_CONFIRM" },
5537 dissect_nfs_open4_rflags(tvbuff_t *tvb, int offset, packet_info *pinfo,
5538 proto_tree *tree, char *name)
5541 proto_item *rflags_item = NULL;
5542 proto_item *rflags_tree = NULL;
5544 rflags = tvb_get_ntohl(tvb, offset);
5548 rflags_item = proto_tree_add_text(tree, tvb, offset, 4,
5549 "%s: 0x%08x", name, rflags);
5553 rflags_tree = proto_item_add_subtree(rflags_item,
5554 ett_nfs_open4_result_flags);
5558 proto_tree_add_text(rflags_tree, tvb, offset, 4, "%s",
5559 decode_enumerated_bitfield(rflags, OPEN4_RESULT_MLOCK, 2,
5560 names_open4_result_flags, "%s"));
5562 proto_tree_add_text(rflags_tree, tvb, offset, 4, "%s",
5563 decode_enumerated_bitfield(rflags, OPEN4_RESULT_CONFIRM, 2,
5564 names_open4_result_flags, "%s"));
5575 dissect_nfs_stateid4(tvbuff_t *tvb, int offset, packet_info *pinfo,
5578 proto_item *fitem = NULL;
5579 proto_tree *newftree = NULL;
5582 gboolean first_line;
5584 fitem = proto_tree_add_text(tree, tvb, offset, 4, "stateid");
5587 newftree = proto_item_add_subtree(fitem, ett_nfs_stateid4);
5589 offset = dissect_rpc_uint32(tvb, pinfo, newftree, hf_nfs_seqid4,
5595 while (bytes_left != 0)
5598 if (sublen > bytes_left)
5599 sublen = bytes_left;
5601 proto_tree_add_text(newftree, tvb, offset, sublen, "%s%s",
5602 first_line ? "other: " : " ",
5603 tvb_bytes_to_str(tvb, offset, sublen));
5605 bytes_left -= sublen;
5616 dissect_nfs_open_read_delegation4(tvbuff_t *tvb, int offset, packet_info *pinfo,
5619 offset = dissect_nfs_stateid4(tvb, offset, pinfo, tree);
5620 offset = dissect_rpc_bool(tvb, pinfo, tree, hf_nfs_recall4, offset);
5621 offset = dissect_nfs_ace4(tvb, offset, pinfo, tree, "permissions");
5627 dissect_nfs_modified_limit4(tvbuff_t *tvb, int offset, packet_info *pinfo,
5628 proto_tree *tree, char *name)
5630 offset = dissect_rpc_uint32(tvb, pinfo, tree, hf_nfs_num_blocks,
5632 offset = dissect_rpc_uint32(tvb, pinfo, tree, hf_nfs_bytes_per_block,
5637 #define NFS_LIMIT_SIZE 1
5638 #define NFS_LIMIT_BLOCKS 2
5639 static const value_string names_limit_by4[] = {
5640 { NFS_LIMIT_SIZE, "NFS_LIMIT_SIZE" },
5641 { NFS_LIMIT_BLOCKS, "NFS_LIMIT_BLOCKS" },
5646 dissect_nfs_space_limit4(tvbuff_t *tvb, int offset, packet_info *pinfo,
5647 proto_tree *tree, char *name)
5651 limitby = tvb_get_ntohl(tvb, offset);
5652 proto_tree_add_uint(tree, hf_nfs_limit_by4, tvb, offset+0, 4, limitby);
5657 case NFS_LIMIT_SIZE:
5658 offset = dissect_rpc_uint64(tvb, pinfo, tree, hf_nfs_filesize,
5662 case NFS_LIMIT_BLOCKS:
5663 offset = dissect_nfs_modified_limit4(tvb, offset, pinfo, tree,
5675 dissect_nfs_open_write_delegation4(tvbuff_t *tvb, int offset,
5676 packet_info *pinfo, proto_tree *tree)
5678 offset = dissect_nfs_stateid4(tvb, offset, pinfo, tree);
5679 offset = dissect_rpc_bool(tvb, pinfo, tree, hf_nfs_recall, offset);
5680 offset = dissect_nfs_space_limit4(tvb, offset, pinfo, tree, "space_limit");
5681 return dissect_nfs_ace4(tvb, offset, pinfo, tree, "permissions");
5684 #define OPEN_DELEGATE_NONE 0
5685 #define OPEN_DELEGATE_READ 1
5686 #define OPEN_DELEGATE_WRITE 2
5687 static const value_string names_open_delegation_type4[] = {
5688 { OPEN_DELEGATE_NONE, "OPEN_DELEGATE_NONE" },
5689 { OPEN_DELEGATE_READ, "OPEN_DELEGATE_READ" },
5690 { OPEN_DELEGATE_WRITE, "OPEN_DELEGATE_WRITE" },
5695 dissect_nfs_open_delegation4(tvbuff_t *tvb, int offset, packet_info *pinfo,
5696 proto_tree *tree, char *name)
5698 guint delegation_type;
5699 proto_tree *newftree = NULL;
5700 proto_item *fitem = NULL;
5702 delegation_type = tvb_get_ntohl(tvb, offset);
5703 proto_tree_add_uint(tree, hf_nfs_open_delegation_type4, tvb, offset+0,
5704 4, delegation_type);
5708 newftree = proto_item_add_subtree(fitem, ett_nfs_open_delegation4);
5710 switch(delegation_type)
5712 case OPEN_DELEGATE_NONE:
5715 case OPEN_DELEGATE_READ:
5716 offset = dissect_nfs_open_read_delegation4(tvb, offset, pinfo,
5720 case OPEN_DELEGATE_WRITE:
5721 offset = dissect_nfs_open_write_delegation4(tvb, offset, pinfo,
5734 dissect_nfs_rpcsec_gss_info(tvbuff_t *tvb, int offset, packet_info *pinfo,
5739 while ((data_follows = tvb_get_ntohl(tvb, offset)))
5742 offset = dissect_nfsdata(tvb, offset, pinfo, tree, hf_nfs_sec_oid4);
5743 offset = dissect_rpc_uint32(tvb, pinfo, tree, hf_nfs_qop4, offset);
5744 offset = dissect_rpc_uint32(tvb, pinfo, tree,
5745 hf_nfs_secinfo_rpcsec_gss_info_service, offset);
5752 dissect_nfs_open_to_lock_owner4(tvbuff_t *tvb, int offset, packet_info *pinfo,
5755 offset = dissect_rpc_uint32(tvb, pinfo, tree, hf_nfs_seqid4, offset);
5756 offset = dissect_nfs_stateid4(tvb, offset, pinfo, tree);
5757 offset = dissect_rpc_uint32(tvb, pinfo, tree, hf_nfs_lock_seqid4, offset);
5758 offset = dissect_nfs_lock_owner4(tvb, offset, pinfo, tree, "owner");
5764 dissect_nfs_exist_lock_owner4(tvbuff_t *tvb, int offset, packet_info *pinfo,
5767 offset = dissect_nfs_stateid4(tvb, offset, pinfo, tree);
5768 offset = dissect_rpc_uint32(tvb, pinfo, tree, hf_nfs_lock_seqid4, offset);
5774 dissect_nfs_locker4(tvbuff_t *tvb, int offset, packet_info *pinfo,
5777 guint new_lock_owner;
5779 new_lock_owner = tvb_get_ntohl(tvb, offset);
5780 offset = dissect_rpc_bool(tvb, pinfo, tree, hf_nfs_new_lock_owner, offset);
5783 offset = dissect_nfs_open_to_lock_owner4(tvb, offset, pinfo, tree);
5785 offset = dissect_nfs_exist_lock_owner4(tvb, offset, pinfo, tree);
5791 dissect_nfs_argop4(tvbuff_t *tvb, int offset, packet_info *pinfo,
5794 guint ops, ops_counter;
5797 proto_tree *ftree = NULL;
5798 proto_tree *newftree = NULL;
5800 ops = tvb_get_ntohl(tvb, offset+0);
5802 fitem = proto_tree_add_text(tree, tvb, offset, 4,
5803 "Operations (count: %d)", ops);
5806 if (fitem == NULL) return offset;
5808 ftree = proto_item_add_subtree(fitem, ett_nfs_argop4);
5810 if (ftree == NULL) return offset;
5812 for (ops_counter=0; ops_counter<ops; ops_counter++)
5814 opcode = tvb_get_ntohl(tvb, offset);
5816 printf("Call Opcode: %d\n", opcode);
5818 fitem = proto_tree_add_uint(ftree, hf_nfs_argop4, tvb, offset, 4,
5822 if (opcode < NFS4_OP_ACCESS || opcode > NFS4_OP_WRITE)
5825 if (fitem == NULL) break;
5827 newftree = proto_item_add_subtree(fitem, *nfsv4_operation_ett[opcode-3]);
5828 if (newftree == NULL) break;
5832 case NFS4_OP_ACCESS:
5833 offset = dissect_access(tvb, offset, pinfo, newftree, "access");
5837 offset = dissect_rpc_uint32(tvb, pinfo, newftree, hf_nfs_seqid4,
5839 offset = dissect_nfs_stateid4(tvb, offset, pinfo, newftree);
5842 case NFS4_OP_COMMIT:
5843 offset = dissect_rpc_uint64(tvb, pinfo, newftree, hf_nfs_offset4,
5845 offset = dissect_rpc_uint32(tvb, pinfo, newftree, hf_nfs_count4,
5849 case NFS4_OP_CREATE:
5853 create_type = tvb_get_ntohl(tvb, offset);
5854 offset = dissect_rpc_uint32(tvb, pinfo, newftree, hf_nfs_ftype4,
5860 offset = dissect_nfs_linktext4(tvb, offset, pinfo, newftree,
5866 offset = dissect_nfs_specdata4(tvb, offset, pinfo,
5867 newftree, "devdata");
5879 offset = dissect_nfs_component4(tvb, offset, pinfo, newftree,
5882 offset = dissect_nfs_fattr4(tvb, offset, pinfo, newftree,
5887 case NFS4_OP_DELEGPURGE:
5888 offset = dissect_rpc_uint64(tvb, pinfo, newftree,
5889 hf_nfs_clientid4, offset);
5892 case NFS4_OP_DELEGRETURN:
5893 offset = dissect_nfs_stateid4(tvb, offset, pinfo, newftree);
5896 case NFS4_OP_GETATTR:
5897 offset = dissect_nfs_attributes(tvb, offset, pinfo, newftree,
5898 "attr_request", FATTR4_BITMAP_ONLY);
5905 offset = dissect_nfs_component4(tvb, offset, pinfo, newftree,
5910 offset = dissect_rpc_uint32(tvb, pinfo, newftree, hf_nfs_lock_type4,
5912 offset = dissect_rpc_bool(tvb, pinfo, newftree, hf_nfs_lock4_reclaim,
5914 offset = dissect_rpc_uint64(tvb, pinfo, newftree, hf_nfs_offset4,
5916 offset = dissect_nfs_length4(tvb, offset, pinfo, newftree, "length");
5917 offset = dissect_nfs_locker4(tvb, offset, pinfo, newftree);
5921 offset = dissect_rpc_uint32(tvb, pinfo, newftree, hf_nfs_lock_type4,
5923 offset = dissect_nfs_lock_owner4(tvb, offset, pinfo, newftree,
5925 offset = dissect_rpc_uint64(tvb, pinfo, newftree, hf_nfs_offset4,
5927 offset = dissect_nfs_length4(tvb, offset, pinfo, newftree, "length");
5931 offset = dissect_rpc_uint32(tvb, pinfo, newftree, hf_nfs_lock_type4,
5933 offset = dissect_rpc_uint32(tvb, pinfo, tree, hf_nfs_seqid4, offset);
5934 offset = dissect_nfs_stateid4(tvb, offset, pinfo, newftree);
5935 offset = dissect_rpc_uint64(tvb, pinfo, newftree, hf_nfs_offset4,
5937 offset = dissect_nfs_length4(tvb, offset, pinfo, newftree, "length");
5940 case NFS4_OP_LOOKUP:
5941 offset = dissect_nfs_component4(tvb, offset, pinfo, newftree,
5945 case NFS4_OP_LOOKUPP:
5948 case NFS4_OP_NVERIFY:
5949 offset = dissect_nfs_fattr4(tvb, offset, pinfo, newftree,
5954 offset = dissect_rpc_uint32(tvb, pinfo, tree, hf_nfs_seqid4, offset);
5955 offset = dissect_nfs_open4_share_access(tvb, offset, pinfo, newftree);
5956 offset = dissect_nfs_open4_share_deny(tvb, offset, pinfo, newftree);
5957 offset = dissect_nfs_open_owner4(tvb, offset, pinfo, newftree);
5958 offset = dissect_nfs_openflag4(tvb, offset, pinfo, newftree);
5959 offset = dissect_nfs_open_claim4(tvb, offset, pinfo, newftree,
5963 case NFS4_OP_OPENATTR:
5964 offset = dissect_rpc_bool(tvb, pinfo, newftree, hf_nfs_attrdircreate,
5968 case NFS4_OP_OPEN_CONFIRM:
5969 offset = dissect_nfs_stateid4(tvb, offset, pinfo, newftree);
5970 offset = dissect_rpc_uint32(tvb, pinfo, tree, hf_nfs_seqid4, offset);
5973 case NFS4_OP_OPEN_DOWNGRADE:
5974 offset = dissect_nfs_stateid4(tvb, offset, pinfo, newftree);
5975 offset = dissect_rpc_uint32(tvb, pinfo, tree, hf_nfs_seqid4, offset);
5976 offset = dissect_nfs_open4_share_access(tvb, offset, pinfo, newftree);
5977 offset = dissect_nfs_open4_share_deny(tvb, offset, pinfo, newftree);
5981 offset = dissect_nfs_fh4(tvb, offset, pinfo, newftree, "filehandle");
5984 case NFS4_OP_PUTPUBFH:
5985 case NFS4_OP_PUTROOTFH:
5989 offset = dissect_nfs_stateid4(tvb, offset, pinfo, newftree);
5990 offset = dissect_rpc_uint64(tvb, pinfo, newftree, hf_nfs_offset4,
5992 offset = dissect_rpc_uint32(tvb, pinfo, newftree, hf_nfs_count4,
5996 case NFS4_OP_READDIR:
5997 offset = dissect_rpc_uint64(tvb, pinfo, newftree, hf_nfs_cookie4,
5999 offset = dissect_rpc_uint64(tvb, pinfo, newftree, hf_nfs_cookieverf4,
6001 offset = dissect_rpc_uint32(tvb, pinfo, newftree,
6002 hf_nfs_count4_dircount, offset);
6003 offset = dissect_rpc_uint32(tvb, pinfo, newftree,
6004 hf_nfs_count4_maxcount, offset);
6005 offset = dissect_nfs_attributes(tvb, offset, pinfo, newftree, "attr",
6006 FATTR4_BITMAP_ONLY);
6009 case NFS4_OP_READLINK:
6012 case NFS4_OP_REMOVE:
6013 offset = dissect_nfs_component4(tvb, offset, pinfo, newftree,
6017 case NFS4_OP_RENAME:
6018 offset = dissect_nfs_component4(tvb, offset, pinfo, newftree,
6020 offset = dissect_nfs_component4(tvb, offset, pinfo, newftree,
6025 offset = dissect_nfs_clientid4(tvb, offset, pinfo, newftree);
6028 case NFS4_OP_RESTOREFH:
6029 case NFS4_OP_SAVEFH:
6032 case NFS4_OP_SECINFO:
6033 offset = dissect_nfs_component4(tvb, offset, pinfo, newftree, "name");
6036 case NFS4_OP_SETATTR:
6037 offset = dissect_nfs_stateid4(tvb, offset, pinfo, newftree);
6038 offset = dissect_nfs_fattr4(tvb, offset, pinfo, newftree,
6042 case NFS4_OP_SETCLIENTID:
6044 proto_tree *client_tree = NULL;
6046 fitem = proto_tree_add_text(newftree, tvb, offset, 0, "client");
6049 client_tree = proto_item_add_subtree(fitem,
6050 ett_nfs_client_id4);
6054 offset = dissect_nfs_clientid4(tvb, offset, pinfo,
6057 offset = dissect_nfsdata(tvb, offset, pinfo, client_tree,
6058 hf_nfs_client_id4_id);
6062 fitem = proto_tree_add_text(newftree, tvb, offset, 0, "callback");
6064 newftree = proto_item_add_subtree(fitem, ett_nfs_cb_client4);
6066 offset = dissect_nfs_cb_client4(tvb, offset, pinfo, newftree,
6072 case NFS4_OP_SETCLIENTID_CONFIRM:
6073 offset = dissect_nfs_clientid4(tvb, offset, pinfo, newftree);
6076 case NFS4_OP_VERIFY:
6077 offset = dissect_nfs_fattr4(tvb, offset, pinfo, newftree,
6082 offset = dissect_nfs_stateid4(tvb, offset, pinfo, newftree);
6083 offset = dissect_rpc_uint64(tvb, pinfo, newftree, hf_nfs_offset4,
6085 offset = dissect_nfs_stable_how4(tvb, offset, pinfo, newftree,
6087 offset = dissect_nfs_opaque4(tvb, offset, pinfo, newftree, "data");
6099 dissect_nfs4_compound_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
6102 offset = dissect_nfs_utf8string(tvb, offset, pinfo, tree, hf_nfs_tag4, NULL);
6103 offset = dissect_rpc_uint32(tvb, pinfo, tree, hf_nfs_minorversion,
6105 offset = dissect_nfs_argop4(tvb, offset, pinfo, tree);
6111 dissect_nfs_resop4(tvbuff_t *tvb, int offset, packet_info *pinfo,
6112 proto_tree *tree, char *name)
6114 guint ops, ops_counter;
6117 proto_tree *ftree = NULL;
6118 proto_tree *newftree = NULL;
6121 ops = tvb_get_ntohl(tvb, offset+0);
6122 fitem = proto_tree_add_text(tree, tvb, offset, 4,
6123 "Operations (count: %d)", ops);
6126 if (fitem == NULL) return offset;
6128 ftree = proto_item_add_subtree(fitem, ett_nfs_resop4);
6130 if (ftree == NULL) return offset; /* error adding new subtree */
6132 for (ops_counter = 0; ops_counter < ops; ops_counter++)
6134 opcode = tvb_get_ntohl(tvb, offset);
6136 printf("Reply opcode: %d\n", opcode);
6138 /* sanity check for bogus packets */
6139 if (opcode < NFS4_OP_ACCESS || opcode > NFS4_OP_WRITE) break;
6141 fitem = proto_tree_add_uint(ftree, hf_nfs_resop4, tvb, offset, 4,
6145 if (fitem == NULL) break; /* error adding new item to tree */
6147 newftree = proto_item_add_subtree(fitem, *nfsv4_operation_ett[opcode-3]);
6149 if (newftree == NULL)
6150 break; /* error adding new subtree to operation item */
6152 offset = dissect_nfs_nfsstat4(tvb, offset, pinfo, newftree, &status);
6155 * With the exception of NFS4_OP_LOCK, NFS4_OP_LOCKT, and
6156 * NFS4_OP_SETATTR, all other ops do *not* return data with the
6157 * failed status code.
6159 if ((status != NFS4_OK) &&
6160 ((opcode != NFS4_OP_LOCK) && (opcode != NFS4_OP_LOCKT) &&
6161 (opcode != NFS4_OP_SETATTR)))
6164 /* These parsing routines are only executed if the status is NFS4_OK */
6167 case NFS4_OP_ACCESS:
6168 offset = dissect_access(tvb, offset, pinfo, newftree, "Supported");
6169 offset = dissect_access(tvb, offset, pinfo, newftree, "Access");
6173 offset = dissect_nfs_stateid4(tvb, offset, pinfo, newftree);
6176 case NFS4_OP_COMMIT:
6177 offset = dissect_rpc_uint64(tvb, pinfo, newftree, hf_nfs_verifier4,
6181 case NFS4_OP_CREATE:
6182 offset = dissect_nfs_change_info4(tvb, offset, pinfo, newftree,
6184 offset = dissect_nfs_fattr4(tvb, offset, pinfo, newftree,
6188 case NFS4_OP_GETATTR:
6189 offset = dissect_nfs_fattr4(tvb, offset, pinfo, newftree,
6194 offset = dissect_nfs_fh4(tvb, offset, pinfo, newftree, "Filehandle");
6198 offset = dissect_nfs_change_info4(tvb, offset, pinfo, newftree,
6204 if (status == NFS4_OK)
6205 offset = dissect_nfs_stateid4(tvb, offset, pinfo, newftree);
6207 if (status == NFS4ERR_DENIED)
6208 offset = dissect_nfs_lock4denied(tvb, offset, pinfo, newftree,
6213 offset = dissect_nfs_stateid4(tvb, offset, pinfo, newftree);
6217 offset = dissect_nfs_stateid4(tvb, offset, pinfo, newftree);
6218 offset = dissect_nfs_change_info4(tvb, offset, pinfo, newftree,
6220 offset = dissect_nfs_open4_rflags(tvb, offset, pinfo, newftree,
6222 offset = dissect_nfs_attributes(tvb, offset, pinfo, newftree,
6223 "attrsset", FATTR4_BITMAP_ONLY);
6224 offset = dissect_nfs_open_delegation4(tvb, offset, pinfo, newftree,
6228 case NFS4_OP_OPEN_CONFIRM:
6229 case NFS4_OP_OPEN_DOWNGRADE:
6230 offset = dissect_nfs_stateid4(tvb, offset, pinfo, newftree);
6234 offset = dissect_rpc_uint32(tvb, pinfo, newftree, hf_nfs_eof,
6236 offset = dissect_nfs_opaque4(tvb, offset, pinfo, newftree, "data");
6239 case NFS4_OP_READDIR:
6240 offset = dissect_rpc_uint64(tvb, pinfo, newftree, hf_nfs_verifier4,
6242 offset = dissect_nfs_dirlist4(tvb, offset, pinfo, newftree, "reply");
6245 case NFS4_OP_READLINK:
6246 offset = dissect_nfs_linktext4(tvb, offset, pinfo, newftree, "link");
6249 case NFS4_OP_REMOVE:
6250 offset = dissect_nfs_change_info4(tvb, offset, pinfo, newftree,
6254 case NFS4_OP_RENAME:
6255 offset = dissect_nfs_change_info4(tvb, offset, pinfo, newftree,
6257 offset = dissect_nfs_change_info4(tvb, offset, pinfo, newftree,
6261 case NFS4_OP_SECINFO:
6266 proto_tree *secftree;
6268 while ((data_follows = tvb_get_ntohl(tvb, offset)))
6272 flavor = tvb_get_ntohl(tvb, offset);
6273 fitem = proto_tree_add_uint(tree, hf_nfs_secinfo_flavor, tvb,
6282 secftree = proto_item_add_subtree(fitem,
6283 ett_nfs_secinfo4_flavor_info);
6285 offset = dissect_nfs_rpcsec_gss_info(tvb, offset,
6297 case NFS4_OP_SETATTR:
6298 offset = dissect_nfs_attributes(tvb, offset, pinfo, newftree,
6299 "attrsset", FATTR4_BITMAP_ONLY);
6302 case NFS4_OP_SETCLIENTID:
6303 if (status == NFS4_OK)
6304 offset = dissect_rpc_uint64(tvb, pinfo, newftree,
6305 hf_nfs_clientid4, offset);
6307 if (status == NFS4ERR_CLID_INUSE)
6308 offset = dissect_nfs_clientaddr4(tvb, offset, pinfo, newftree,
6313 offset = dissect_rpc_uint32(tvb, pinfo, newftree, hf_nfs_count4,
6315 offset = dissect_nfs_stable_how4(tvb, offset, pinfo, newftree,
6317 offset = dissect_rpc_uint64(tvb, pinfo, newftree, hf_nfs_verifier4,
6330 dissect_nfs4_compound_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
6335 offset = dissect_nfs_nfsstat4(tvb, offset, pinfo, tree, &status);
6336 offset = dissect_nfs_utf8string(tvb, offset, pinfo, tree, hf_nfs_tag4, NULL);
6337 offset = dissect_nfs_resop4(tvb, offset, pinfo, tree, "arguments");
6343 /* proc number, "proc name", dissect_request, dissect_reply */
6344 /* NULL as function pointer means: type of arguments is "void". */
6345 static const vsff nfs3_proc[] = {
6346 { 0, "NULL", /* OK */
6348 { 1, "GETATTR", /* OK */
6349 dissect_nfs3_getattr_call, dissect_nfs3_getattr_reply },
6350 { 2, "SETATTR", /* OK */
6351 dissect_nfs3_setattr_call, dissect_nfs3_setattr_reply },
6352 { 3, "LOOKUP", /* OK */
6353 dissect_nfs3_lookup_call, dissect_nfs3_lookup_reply },
6354 { 4, "ACCESS", /* OK */
6355 dissect_nfs3_access_call, dissect_nfs3_access_reply },
6356 { 5, "READLINK", /* OK */
6357 dissect_nfs3_nfs_fh3_call, dissect_nfs3_readlink_reply },
6358 { 6, "READ", /* OK */
6359 dissect_nfs3_read_call, dissect_nfs3_read_reply },
6360 { 7, "WRITE", /* OK */
6361 dissect_nfs3_write_call, dissect_nfs3_write_reply },
6362 { 8, "CREATE", /* OK */
6363 dissect_nfs3_create_call, dissect_nfs3_create_reply },
6364 { 9, "MKDIR", /* OK */
6365 dissect_nfs3_mkdir_call, dissect_nfs3_create_reply },
6366 { 10, "SYMLINK", /* OK */
6367 dissect_nfs3_symlink_call, dissect_nfs3_create_reply },
6368 { 11, "MKNOD", /* OK */
6369 dissect_nfs3_mknod_call, dissect_nfs3_create_reply },
6370 { 12, "REMOVE", /* OK */
6371 dissect_nfs3_diropargs3_call, dissect_nfs3_remove_reply },
6372 { 13, "RMDIR", /* OK */
6373 dissect_nfs3_diropargs3_call, dissect_nfs3_remove_reply },
6374 { 14, "RENAME", /* OK */
6375 dissect_nfs3_rename_call, dissect_nfs3_rename_reply },
6376 { 15, "LINK", /* OK */
6377 dissect_nfs3_link_call, dissect_nfs3_link_reply },
6378 { 16, "READDIR", /* OK */
6379 dissect_nfs3_readdir_call, dissect_nfs3_readdir_reply },
6380 { 17, "READDIRPLUS", /* OK */
6381 dissect_nfs3_readdirplus_call, dissect_nfs3_readdirplus_reply },
6382 { 18, "FSSTAT", /* OK */
6383 dissect_nfs3_nfs_fh3_call, dissect_nfs3_fsstat_reply },
6384 { 19, "FSINFO", /* OK */
6385 dissect_nfs3_nfs_fh3_call, dissect_nfs3_fsinfo_reply },
6386 { 20, "PATHCONF", /* OK */
6387 dissect_nfs3_nfs_fh3_call, dissect_nfs3_pathconf_reply },
6388 { 21, "COMMIT", /* OK */
6389 dissect_nfs3_commit_call, dissect_nfs3_commit_reply },
6390 { 0,NULL,NULL,NULL }
6392 /* end of NFS Version 3 */
6394 static const vsff nfs4_proc[] = {
6398 dissect_nfs4_compound_call, dissect_nfs4_compound_reply },
6399 { 0, NULL, NULL, NULL }
6403 static struct true_false_string yesno = { "Yes", "No" };
6407 proto_register_nfs(void)
6409 static hf_register_info hf[] = {
6410 { &hf_nfs_fh_length, {
6411 "length", "nfs.fh.length", FT_UINT32, BASE_DEC,
6412 NULL, 0, "file handle length", HFILL }},
6413 { &hf_nfs_fh_hash, {
6414 "hash", "nfs.fh.hash", FT_UINT32, BASE_HEX,
6415 NULL, 0, "file handle hash", HFILL }},
6416 { &hf_nfs_fh_fsid_major, {
6417 "major", "nfs.fh.fsid.major", FT_UINT32, BASE_DEC,
6418 NULL, 0, "major file system ID", HFILL }},
6419 { &hf_nfs_fh_fsid_minor, {
6420 "minor", "nfs.fh.fsid.minor", FT_UINT32, BASE_DEC,
6421 NULL, 0, "minor file system ID", HFILL }},
6422 { &hf_nfs_fh_fsid_inode, {
6423 "inode", "nfs.fh.fsid.inode", FT_UINT32, BASE_DEC,
6424 NULL, 0, "file system inode", HFILL }},
6425 { &hf_nfs_fh_xfsid_major, {
6426 "exported major", "nfs.fh.xfsid.major", FT_UINT32, BASE_DEC,
6427 NULL, 0, "exported major file system ID", HFILL }},
6428 { &hf_nfs_fh_xfsid_minor, {
6429 "exported minor", "nfs.fh.xfsid.minor", FT_UINT32, BASE_DEC,
6430 NULL, 0, "exported minor file system ID", HFILL }},
6431 { &hf_nfs_fh_fstype, {
6432 "file system type", "nfs.fh.fstype", FT_UINT32, BASE_DEC,
6433 NULL, 0, "file system type", HFILL }},
6435 "file number", "nfs.fh.fn", FT_UINT32, BASE_DEC,
6436 NULL, 0, "file number", HFILL }},
6437 { &hf_nfs_fh_fn_len, {
6438 "length", "nfs.fh.fn.len", FT_UINT32, BASE_DEC,
6439 NULL, 0, "file number length", HFILL }},
6440 { &hf_nfs_fh_fn_inode, {
6441 "inode", "nfs.fh.fn.inode", FT_UINT32, BASE_DEC,
6442 NULL, 0, "file number inode", HFILL }},
6443 { &hf_nfs_fh_fn_generation, {
6444 "generation", "nfs.fh.fn.generation", FT_UINT32, BASE_DEC,
6445 NULL, 0, "file number generation", HFILL }},
6447 "exported file number", "nfs.fh.xfn", FT_UINT32, BASE_DEC,
6448 NULL, 0, "exported file number", HFILL }},
6449 { &hf_nfs_fh_xfn_len, {
6450 "length", "nfs.fh.xfn.len", FT_UINT32, BASE_DEC,
6451 NULL, 0, "exported file number length", HFILL }},
6452 { &hf_nfs_fh_xfn_inode, {
6453 "exported inode", "nfs.fh.xfn.inode", FT_UINT32, BASE_DEC,
6454 NULL, 0, "exported file number inode", HFILL }},
6455 { &hf_nfs_fh_xfn_generation, {
6456 "generation", "nfs.fh.xfn.generation", FT_UINT32, BASE_DEC,
6457 NULL, 0, "exported file number generation", HFILL }},
6458 { &hf_nfs_fh_dentry, {
6459 "dentry", "nfs.fh.dentry", FT_UINT32, BASE_HEX,
6460 NULL, 0, "dentry (cookie)", HFILL }},
6462 "device", "nfs.fh.dev", FT_UINT32, BASE_DEC,
6463 NULL, 0, "device", HFILL }},
6464 { &hf_nfs_fh_xdev, {
6465 "exported device", "nfs.fh.xdev", FT_UINT32, BASE_DEC,
6466 NULL, 0, "exported device", HFILL }},
6467 { &hf_nfs_fh_dirinode, {
6468 "directory inode", "nfs.fh.dirinode", FT_UINT32, BASE_DEC,
6469 NULL, 0, "directory inode", HFILL }},
6470 { &hf_nfs_fh_pinode, {
6471 "pseudo inode", "nfs.fh.pinode", FT_UINT32, BASE_HEX,
6472 NULL, 0, "pseudo inode", HFILL }},
6473 { &hf_nfs_fh_hp_len, {
6474 "length", "nfs.fh.hp.len", FT_UINT32, BASE_DEC,
6475 NULL, 0, "hash path length", HFILL }},
6476 { &hf_nfs_fh_version, {
6477 "version", "nfs.fh.version", FT_UINT8, BASE_DEC,
6478 NULL, 0, "file handle layout version", HFILL }},
6479 { &hf_nfs_fh_auth_type, {
6480 "auth_type", "nfs.fh.auth_type", FT_UINT8, BASE_DEC,
6481 VALS(auth_type_names), 0, "authentication type", HFILL }},
6482 { &hf_nfs_fh_fsid_type, {
6483 "fsid_type", "nfs.fh.fsid_type", FT_UINT8, BASE_DEC,
6484 VALS(fsid_type_names), 0, "file system ID type", HFILL }},
6485 { &hf_nfs_fh_fileid_type, {
6486 "fileid_type", "nfs.fh.fileid_type", FT_UINT8, BASE_DEC,
6487 VALS(fileid_type_names), 0, "file ID type", HFILL }},
6489 "Status", "nfs.status2", FT_UINT32, BASE_DEC,
6490 VALS(names_nfs_stat), 0, "Reply status", HFILL }},
6491 { &hf_nfs_full_name, {
6492 "Full Name", "nfs.full_name", FT_STRING, BASE_DEC,
6493 NULL, 0, "Full Name", HFILL }},
6495 "Name", "nfs.name", FT_STRING, BASE_DEC,
6496 NULL, 0, "Name", HFILL }},
6497 { &hf_nfs_readlink_data, {
6498 "Data", "nfs.readlink.data", FT_STRING, BASE_DEC,
6499 NULL, 0, "Symbolic Link Data", HFILL }},
6500 { &hf_nfs_read_offset, {
6501 "Offset", "nfs.read.offset", FT_UINT32, BASE_DEC,
6502 NULL, 0, "Read Offset", HFILL }},
6503 { &hf_nfs_read_count, {
6504 "Count", "nfs.read.count", FT_UINT32, BASE_DEC,
6505 NULL, 0, "Read Count", HFILL }},
6506 { &hf_nfs_read_totalcount, {
6507 "Total Count", "nfs.read.totalcount", FT_UINT32, BASE_DEC,
6508 NULL, 0, "Total Count (obsolete)", HFILL }},
6510 "Data", "nfs.data", FT_BYTES, BASE_DEC,
6511 NULL, 0, "Data", HFILL }},
6512 { &hf_nfs_write_beginoffset, {
6513 "Begin Offset", "nfs.write.beginoffset", FT_UINT32, BASE_DEC,
6514 NULL, 0, "Begin offset (obsolete)", HFILL }},
6515 { &hf_nfs_write_offset, {
6516 "Offset", "nfs.write.offset", FT_UINT32, BASE_DEC,
6517 NULL, 0, "Offset", HFILL }},
6518 { &hf_nfs_write_totalcount, {
6519 "Total Count", "nfs.write.totalcount", FT_UINT32, BASE_DEC,
6520 NULL, 0, "Total Count (obsolete)", HFILL }},
6521 { &hf_nfs_symlink_to, {
6522 "To", "nfs.symlink.to", FT_STRING, BASE_DEC,
6523 NULL, 0, "Symbolic link destination name", HFILL }},
6524 { &hf_nfs_readdir_cookie, {
6525 "Cookie", "nfs.readdir.cookie", FT_UINT32, BASE_DEC,
6526 NULL, 0, "Directory Cookie", HFILL }},
6527 { &hf_nfs_readdir_count, {
6528 "Count", "nfs.readdir.count", FT_UINT32, BASE_DEC,
6529 NULL, 0, "Directory Count", HFILL }},
6531 { &hf_nfs_readdir_entry, {
6532 "Entry", "nfs.readdir.entry", FT_NONE, 0,
6533 NULL, 0, "Directory Entry", HFILL }},
6535 { &hf_nfs_readdir_entry_fileid, {
6536 "File ID", "nfs.readdir.entry.fileid", FT_UINT32, BASE_DEC,
6537 NULL, 0, "File ID", HFILL }},
6539 { &hf_nfs_readdir_entry_name, {
6540 "Name", "nfs.readdir.entry.name", FT_STRING, BASE_DEC,
6541 NULL, 0, "Name", HFILL }},
6543 { &hf_nfs_readdir_entry_cookie, {
6544 "Cookie", "nfs.readdir.entry.cookie", FT_UINT32, BASE_DEC,
6545 NULL, 0, "Directory Cookie", HFILL }},
6547 { &hf_nfs_readdir_entry3_fileid, {
6548 "File ID", "nfs.readdir.entry3.fileid", FT_UINT64, BASE_DEC,
6549 NULL, 0, "File ID", HFILL }},
6551 { &hf_nfs_readdir_entry3_name, {
6552 "Name", "nfs.readdir.entry3.name", FT_STRING, BASE_DEC,
6553 NULL, 0, "Name", HFILL }},
6555 { &hf_nfs_readdir_entry3_cookie, {
6556 "Cookie", "nfs.readdir.entry3.cookie", FT_UINT64, BASE_DEC,
6557 NULL, 0, "Directory Cookie", HFILL }},
6559 { &hf_nfs_readdirplus_entry_fileid, {
6560 "File ID", "nfs.readdirplus.entry.fileid", FT_UINT64, BASE_DEC,
6561 NULL, 0, "Name", HFILL }},
6563 { &hf_nfs_readdirplus_entry_name, {
6564 "Name", "nfs.readdirplus.entry.name", FT_STRING, BASE_DEC,
6565 NULL, 0, "Name", HFILL }},
6567 { &hf_nfs_readdirplus_entry_cookie, {
6568 "Cookie", "nfs.readdirplus.entry.cookie", FT_UINT64, BASE_DEC,
6569 NULL, 0, "Directory Cookie", HFILL }},
6571 { &hf_nfs_readdir_eof, {
6572 "EOF", "nfs.readdir.eof", FT_UINT32, BASE_DEC,
6573 NULL, 0, "EOF", HFILL }},
6575 { &hf_nfs_statfs_tsize, {
6576 "Transfer Size", "nfs.statfs.tsize", FT_UINT32, BASE_DEC,
6577 NULL, 0, "Transfer Size", HFILL }},
6578 { &hf_nfs_statfs_bsize, {
6579 "Block Size", "nfs.statfs.bsize", FT_UINT32, BASE_DEC,
6580 NULL, 0, "Block Size", HFILL }},
6581 { &hf_nfs_statfs_blocks, {
6582 "Total Blocks", "nfs.statfs.blocks", FT_UINT32, BASE_DEC,
6583 NULL, 0, "Total Blocks", HFILL }},
6584 { &hf_nfs_statfs_bfree, {
6585 "Free Blocks", "nfs.statfs.bfree", FT_UINT32, BASE_DEC,
6586 NULL, 0, "Free Blocks", HFILL }},
6587 { &hf_nfs_statfs_bavail, {
6588 "Available Blocks", "nfs.statfs.bavail", FT_UINT32, BASE_DEC,
6589 NULL, 0, "Available Blocks", HFILL }},
6591 "Type", "nfs.type", FT_UINT32, BASE_DEC,
6592 VALS(names_nfs_ftype3), 0, "File Type", HFILL }},
6593 { &hf_nfs_nfsstat3, {
6594 "Status", "nfs.status", FT_UINT32, BASE_DEC,
6595 VALS(names_nfs_nfsstat3), 0, "Reply status", HFILL }},
6596 { &hf_nfs_read_eof, {
6597 "EOF", "nfs.read.eof", FT_BOOLEAN, BASE_NONE,
6598 &yesno, 0, "EOF", HFILL }},
6599 { &hf_nfs_write_stable, {
6600 "Stable", "nfs.write.stable", FT_UINT32, BASE_DEC,
6601 VALS(names_stable_how), 0, "Stable", HFILL }},
6602 { &hf_nfs_write_committed, {
6603 "Committed", "nfs.write.committed", FT_UINT32, BASE_DEC,
6604 VALS(names_stable_how), 0, "Committed", HFILL }},
6605 { &hf_nfs_createmode3, {
6606 "Create Mode", "nfs.createmode", FT_UINT32, BASE_DEC,
6607 VALS(names_createmode3), 0, "Create Mode", HFILL }},
6608 { &hf_nfs_fsstat_invarsec, {
6609 "invarsec", "nfs.fsstat.invarsec", FT_UINT32, BASE_DEC,
6610 NULL, 0, "probable number of seconds of file system invariance", HFILL }},
6611 { &hf_nfs_fsinfo_rtmax, {
6612 "rtmax", "nfs.fsinfo.rtmax", FT_UINT32, BASE_DEC,
6613 NULL, 0, "maximum READ request", HFILL }},
6614 { &hf_nfs_fsinfo_rtpref, {
6615 "rtpref", "nfs.fsinfo.rtpref", FT_UINT32, BASE_DEC,
6616 NULL, 0, "Preferred READ request size", HFILL }},
6617 { &hf_nfs_fsinfo_rtmult, {
6618 "rtmult", "nfs.fsinfo.rtmult", FT_UINT32, BASE_DEC,
6619 NULL, 0, "Suggested READ multiple", HFILL }},
6620 { &hf_nfs_fsinfo_wtmax, {
6621 "wtmax", "nfs.fsinfo.wtmax", FT_UINT32, BASE_DEC,
6622 NULL, 0, "Maximum WRITE request size", HFILL }},
6623 { &hf_nfs_fsinfo_wtpref, {
6624 "wtpref", "nfs.fsinfo.wtpref", FT_UINT32, BASE_DEC,
6625 NULL, 0, "Preferred WRITE request size", HFILL }},
6626 { &hf_nfs_fsinfo_wtmult, {
6627 "wtmult", "nfs.fsinfo.wtmult", FT_UINT32, BASE_DEC,
6628 NULL, 0, "Suggested WRITE multiple", HFILL }},
6629 { &hf_nfs_fsinfo_dtpref, {
6630 "dtpref", "nfs.fsinfo.dtpref", FT_UINT32, BASE_DEC,
6631 NULL, 0, "Preferred READDIR request", HFILL }},
6632 { &hf_nfs_fsinfo_maxfilesize, {
6633 "maxfilesize", "nfs.fsinfo.maxfilesize", FT_UINT64, BASE_DEC,
6634 NULL, 0, "Maximum file size", HFILL }},
6635 { &hf_nfs_fsinfo_properties, {
6636 "Properties", "nfs.fsinfo.propeties", FT_UINT32, BASE_HEX,
6637 NULL, 0, "File System Properties", HFILL }},
6638 { &hf_nfs_pathconf_linkmax, {
6639 "linkmax", "nfs.pathconf.linkmax", FT_UINT32, BASE_DEC,
6640 NULL, 0, "Maximum number of hard links", HFILL }},
6641 { &hf_nfs_pathconf_name_max, {
6642 "name_max", "nfs.pathconf.name_max", FT_UINT32, BASE_DEC,
6643 NULL, 0, "Maximum file name length", HFILL }},
6644 { &hf_nfs_pathconf_no_trunc, {
6645 "no_trunc", "nfs.pathconf.no_trunc", FT_BOOLEAN, BASE_NONE,
6646 &yesno, 0, "No long file name truncation", HFILL }},
6647 { &hf_nfs_pathconf_chown_restricted, {
6648 "chown_restricted", "nfs.pathconf.chown_restricted", FT_BOOLEAN,
6649 BASE_NONE, &yesno, 0, "chown is restricted to root", HFILL }},
6650 { &hf_nfs_pathconf_case_insensitive, {
6651 "case_insensitive", "nfs.pathconf.case_insensitive", FT_BOOLEAN,
6652 BASE_NONE, &yesno, 0, "file names are treated case insensitive", HFILL }},
6653 { &hf_nfs_pathconf_case_preserving, {
6654 "case_preserving", "nfs.pathconf.case_preserving", FT_BOOLEAN,
6655 BASE_NONE, &yesno, 0, "file name cases are preserved", HFILL }},
6657 { &hf_nfs_fattr_type, {
6658 "type", "nfs.fattr.type", FT_UINT32, BASE_DEC,
6659 NULL, 0, "nfs.fattr.type", HFILL }},
6661 { &hf_nfs_fattr_nlink, {
6662 "nlink", "nfs.fattr.nlink", FT_UINT32, BASE_DEC,
6663 NULL, 0, "nfs.fattr.nlink", HFILL }},
6665 { &hf_nfs_fattr_uid, {
6666 "uid", "nfs.fattr.uid", FT_UINT32, BASE_DEC,
6667 NULL, 0, "nfs.fattr.uid", HFILL }},
6669 { &hf_nfs_fattr_gid, {
6670 "gid", "nfs.fattr.gid", FT_UINT32, BASE_DEC,
6671 NULL, 0, "nfs.fattr.gid", HFILL }},
6673 { &hf_nfs_fattr_size, {
6674 "size", "nfs.fattr.size", FT_UINT32, BASE_DEC,
6675 NULL, 0, "nfs.fattr.size", HFILL }},
6677 { &hf_nfs_fattr_blocksize, {
6678 "blocksize", "nfs.fattr.blocksize", FT_UINT32, BASE_DEC,
6679 NULL, 0, "nfs.fattr.blocksize", HFILL }},
6681 { &hf_nfs_fattr_rdev, {
6682 "rdev", "nfs.fattr.rdev", FT_UINT32, BASE_DEC,
6683 NULL, 0, "nfs.fattr.rdev", HFILL }},
6685 { &hf_nfs_fattr_blocks, {
6686 "blocks", "nfs.fattr.blocks", FT_UINT32, BASE_DEC,
6687 NULL, 0, "nfs.fattr.blocks", HFILL }},
6689 { &hf_nfs_fattr_fsid, {
6690 "fsid", "nfs.fattr.fsid", FT_UINT32, BASE_DEC,
6691 NULL, 0, "nfs.fattr.fsid", HFILL }},
6693 { &hf_nfs_fattr_fileid, {
6694 "fileid", "nfs.fattr.fileid", FT_UINT32, BASE_DEC,
6695 NULL, 0, "nfs.fattr.fileid", HFILL }},
6697 { &hf_nfs_fattr3_type, {
6698 "Type", "nfs.fattr3.type", FT_UINT32, BASE_DEC,
6699 VALS(names_nfs_ftype3), 0, "nfs.fattr3.type", HFILL }},
6701 { &hf_nfs_fattr3_nlink, {
6702 "nlink", "nfs.fattr3.nlink", FT_UINT32, BASE_DEC,
6703 NULL, 0, "nfs.fattr3.nlink", HFILL }},
6705 { &hf_nfs_fattr3_uid, {
6706 "uid", "nfs.fattr3.uid", FT_UINT32, BASE_DEC,
6707 NULL, 0, "nfs.fattr3.uid", HFILL }},
6709 { &hf_nfs_fattr3_gid, {
6710 "gid", "nfs.fattr3.gid", FT_UINT32, BASE_DEC,
6711 NULL, 0, "nfs.fattr3.gid", HFILL }},
6713 { &hf_nfs_fattr3_size, {
6714 "size", "nfs.fattr3.size", FT_UINT64, BASE_DEC,
6715 NULL, 0, "nfs.fattr3.size", HFILL }},
6717 { &hf_nfs_fattr3_used, {
6718 "used", "nfs.fattr3.used", FT_UINT64, BASE_DEC,
6719 NULL, 0, "nfs.fattr3.used", HFILL }},
6721 { &hf_nfs_fattr3_rdev, {
6722 "rdev", "nfs.fattr3.rdev", FT_UINT32, BASE_DEC,
6723 NULL, 0, "nfs.fattr3.rdev", HFILL }},
6725 { &hf_nfs_fattr3_fsid, {
6726 "fsid", "nfs.fattr3.fsid", FT_UINT64, BASE_DEC,
6727 NULL, 0, "nfs.fattr3.fsid", HFILL }},
6729 { &hf_nfs_fattr3_fileid, {
6730 "fileid", "nfs.fattr3.fileid", FT_UINT64, BASE_DEC,
6731 NULL, 0, "nfs.fattr3.fileid", HFILL }},
6733 { &hf_nfs_wcc_attr_size, {
6734 "size", "nfs.wcc_attr.size", FT_UINT64, BASE_DEC,
6735 NULL, 0, "nfs.wcc_attr.size", HFILL }},
6737 { &hf_nfs_set_size3_size, {
6738 "size", "nfs.set_size3.size", FT_UINT64, BASE_DEC,
6739 NULL, 0, "nfs.set_size3.size", HFILL }},
6742 "uid", "nfs.uid3", FT_UINT32, BASE_DEC,
6743 NULL, 0, "nfs.uid3", HFILL }},
6746 "gid", "nfs.gid3", FT_UINT32, BASE_DEC,
6747 NULL, 0, "nfs.gid3", HFILL }},
6749 { &hf_nfs_cookie3, {
6750 "cookie", "nfs.cookie3", FT_UINT64, BASE_DEC,
6751 NULL, 0, "nfs.cookie3", HFILL }},
6753 { &hf_nfs_offset3, {
6754 "offset", "nfs.offset3", FT_UINT64, BASE_DEC,
6755 NULL, 0, "nfs.offset3", HFILL }},
6758 "count", "nfs.count3", FT_UINT32, BASE_DEC,
6759 NULL, 0, "nfs.count3", HFILL }},
6761 { &hf_nfs_count3_maxcount, {
6762 "maxcount", "nfs.count3_maxcount", FT_UINT32, BASE_DEC,
6763 NULL, 0, "nfs.count3_maxcount", HFILL }},
6765 { &hf_nfs_count3_dircount, {
6766 "dircount", "nfs.count3_dircount", FT_UINT32, BASE_DEC,
6767 NULL, 0, "nfs.count3_dircount", HFILL }},
6769 { &hf_nfs_fsstat3_resok_tbytes, {
6770 "Total bytes", "nfs.fsstat3_resok.tbytes", FT_UINT64, BASE_DEC,
6771 NULL, 0, "Total bytes", HFILL }},
6773 { &hf_nfs_fsstat3_resok_fbytes, {
6774 "Free bytes", "nfs.fsstat3_resok.fbytes", FT_UINT64, BASE_DEC,
6775 NULL, 0, "Free bytes", HFILL }},
6777 { &hf_nfs_fsstat3_resok_abytes, {
6778 "Available free bytes", "nfs.fsstat3_resok.abytes", FT_UINT64, BASE_DEC,
6779 NULL, 0, "Available free bytes", HFILL }},
6781 { &hf_nfs_fsstat3_resok_tfiles, {
6782 "Total file slots", "nfs.fsstat3_resok.tfiles", FT_UINT64, BASE_DEC,
6783 NULL, 0, "Total file slots", HFILL }},
6785 { &hf_nfs_fsstat3_resok_ffiles, {
6786 "Free file slots", "nfs.fsstat3_resok.ffiles", FT_UINT64, BASE_DEC,
6787 NULL, 0, "Free file slots", HFILL }},
6789 { &hf_nfs_fsstat3_resok_afiles, {
6790 "Available free file slots", "nfs.fsstat3_resok.afiles", FT_UINT64, BASE_DEC,
6791 NULL, 0, "Available free file slots", HFILL }},
6796 "Opcode", "nfs.call.operation", FT_UINT32, BASE_DEC,
6797 VALS(names_nfsv4_operation), 0, "Opcode", HFILL }},
6800 "Opcode", "nfs.reply.operation", FT_UINT32, BASE_DEC,
6801 VALS(names_nfsv4_operation), 0, "Opcode", HFILL }},
6803 { &hf_nfs_linktext4, {
6804 "Name", "nfs.symlink.linktext", FT_STRING, BASE_DEC,
6805 NULL, 0, "Symbolic link contents", HFILL }},
6807 { &hf_nfs_component4, {
6808 "Filename", "nfs.pathname.component", FT_STRING, BASE_DEC,
6809 NULL, 0, "Pathname component", HFILL }},
6812 "Tag", "nfs.tag", FT_STRING, BASE_DEC,
6813 NULL, 0, "Tag", HFILL }},
6815 { &hf_nfs_clientid4, {
6816 "clientid", "nfs.clientid", FT_UINT64, BASE_DEC,
6817 NULL, 0, "Client ID", HFILL }},
6820 "ace", "nfs.ace", FT_STRING, BASE_DEC,
6821 NULL, 0, "Access Control Entry", HFILL }},
6824 "EOF", "nfs.recall", FT_BOOLEAN, BASE_NONE,
6825 &yesno, 0, "Recall", HFILL }},
6827 { &hf_nfs_open_claim_type4, {
6828 "Claim Type", "nfs.open.claim_type", FT_UINT32, BASE_DEC,
6829 VALS(names_claim_type4), 0, "Claim Type", HFILL }},
6831 { &hf_nfs_opentype4, {
6832 "Open Type", "nfs.open.opentype", FT_UINT32, BASE_DEC,
6833 VALS(names_opentype4), 0, "Open Type", HFILL }},
6835 { &hf_nfs_limit_by4, {
6836 "Space Limit", "nfs.open.limit_by", FT_UINT32, BASE_DEC,
6837 VALS(names_limit_by4), 0, "Limit By", HFILL }},
6839 { &hf_nfs_open_delegation_type4, {
6840 "Delegation Type", "nfs.open.delegation_type", FT_UINT32, BASE_DEC,
6841 VALS(names_open_delegation_type4), 0, "Delegation Type", HFILL }},
6844 "nfs_ftype4", "nfs.nfs_ftype4", FT_UINT32, BASE_DEC,
6845 VALS(names_ftype4), 0, "nfs.nfs_ftype4", HFILL }},
6847 { &hf_nfs_change_info4_atomic, {
6848 "Atomic", "nfs.change_info.atomic", FT_BOOLEAN, BASE_NONE,
6849 &yesno, 0, "Atomic", HFILL }},
6851 { &hf_nfs_open4_share_access, {
6852 "share_access", "nfs.open4.share_access", FT_UINT32, BASE_DEC,
6853 VALS(names_open4_share_access), 0, "Share Access", HFILL }},
6855 { &hf_nfs_open4_share_deny, {
6856 "share_deny", "nfs.open4.share_deny", FT_UINT32, BASE_DEC,
6857 VALS(names_open4_share_deny), 0, "Share Deny", HFILL }},
6860 "seqid", "nfs.seqid", FT_UINT32, BASE_HEX,
6861 NULL, 0, "Sequence ID", HFILL }},
6863 { &hf_nfs_lock_seqid4, {
6864 "lock_seqid", "nfs.lock_seqid", FT_UINT32, BASE_HEX,
6865 NULL, 0, "Lock Sequence ID", HFILL }},
6867 { &hf_nfs_mand_attr, {
6868 "mand_attr", "nfs.attr", FT_UINT32, BASE_DEC,
6869 VALS(names_fattr4), 0, "Mandatory Attribute", HFILL }},
6871 { &hf_nfs_recc_attr, {
6872 "recc_attr", "nfs.attr", FT_UINT32, BASE_DEC,
6873 VALS(names_fattr4), 0, "Recommended Attribute", HFILL }},
6875 { &hf_nfs_time_how4, {
6876 "set_it", "nfs.set_it", FT_UINT32, BASE_DEC,
6877 VALS(names_time_how4), 0, "How To Set Time", HFILL }},
6879 { &hf_nfs_attrlist4, {
6880 "attr_vals", "nfs.fattr4.attr_vals", FT_BYTES, BASE_DEC,
6881 NULL, 0, "attr_vals", HFILL }},
6883 { &hf_nfs_fattr4_expire_type, {
6884 "fattr4_expire_type", "nfs.fattr4_expire_type", FT_UINT32, BASE_DEC,
6885 VALS(names_fattr4_expire_type), 0, "fattr4_expire_type", HFILL }},
6887 { &hf_nfs_fattr4_link_support, {
6888 "fattr4_link_support", "nfs.fattr4_link_support", FT_BOOLEAN,
6889 BASE_NONE, &yesno, 0, "nfs.fattr4_link_support", HFILL }},
6891 { &hf_nfs_fattr4_symlink_support, {
6892 "fattr4_symlink_support", "nfs.fattr4_symlink_support", FT_BOOLEAN,
6893 BASE_NONE, &yesno, 0, "nfs.fattr4_symlink_support", HFILL }},
6895 { &hf_nfs_fattr4_named_attr, {
6896 "fattr4_named_attr", "nfs.fattr4_named_attr", FT_BOOLEAN, BASE_NONE,
6897 &yesno, 0, "nfs.fattr4_named_attr", HFILL }},
6899 { &hf_nfs_fattr4_unique_handles, {
6900 "fattr4_unique_handles", "nfs.fattr4_unique_handles", FT_BOOLEAN,
6901 BASE_NONE, &yesno, 0, "nfs.fattr4_unique_handles", HFILL }},
6903 { &hf_nfs_fattr4_archive, {
6904 "fattr4_archive", "nfs.fattr4_archive", FT_BOOLEAN,
6905 BASE_NONE, &yesno, 0, "nfs.fattr4_archive", HFILL }},
6907 { &hf_nfs_fattr4_cansettime, {
6908 "fattr4_cansettime", "nfs.fattr4_cansettime", FT_BOOLEAN,
6909 BASE_NONE, &yesno, 0, "nfs.fattr4_cansettime", HFILL }},
6911 { &hf_nfs_fattr4_case_insensitive, {
6912 "fattr4_case_insensitive", "nfs.fattr4_case_insensitive", FT_BOOLEAN,
6913 BASE_NONE, &yesno, 0, "nfs.fattr4_case_insensitive", HFILL }},
6915 { &hf_nfs_fattr4_case_preserving, {
6916 "fattr4_case_preserving", "nfs.fattr4_case_preserving", FT_BOOLEAN,
6917 BASE_NONE, &yesno, 0, "nfs.fattr4_case_preserving", HFILL }},
6919 { &hf_nfs_fattr4_chown_restricted, {
6920 "fattr4_chown_restricted", "nfs.fattr4_chown_restricted", FT_BOOLEAN,
6921 BASE_NONE, &yesno, 0, "nfs.fattr4_chown_restricted", HFILL }},
6923 { &hf_nfs_fattr4_hidden, {
6924 "fattr4_hidden", "nfs.fattr4_hidden", FT_BOOLEAN,
6925 BASE_NONE, &yesno, 0, "nfs.fattr4_hidden", HFILL }},
6927 { &hf_nfs_fattr4_homogeneous, {
6928 "fattr4_homogeneous", "nfs.fattr4_homogeneous", FT_BOOLEAN,
6929 BASE_NONE, &yesno, 0, "nfs.fattr4_homogeneous", HFILL }},
6931 { &hf_nfs_fattr4_mimetype, {
6932 "fattr4_mimetype", "nfs.fattr4_mimetype", FT_STRING, BASE_DEC,
6933 NULL, 0, "nfs.fattr4_mimetype", HFILL }},
6935 { &hf_nfs_fattr4_no_trunc, {
6936 "fattr4_no_trunc", "nfs.fattr4_no_trunc", FT_BOOLEAN,
6937 BASE_NONE, &yesno, 0, "nfs.fattr4_no_trunc", HFILL }},
6939 { &hf_nfs_fattr4_system, {
6940 "fattr4_system", "nfs.fattr4_system", FT_BOOLEAN,
6941 BASE_NONE, &yesno, 0, "nfs.fattr4_system", HFILL }},
6944 "who", "nfs.who", FT_STRING, BASE_DEC,
6945 NULL, 0, "nfs.who", HFILL }},
6948 "server", "nfs.server", FT_STRING, BASE_DEC,
6949 NULL, 0, "nfs.server", HFILL }},
6951 { &hf_nfs_fattr4_owner, {
6952 "fattr4_owner", "nfs.fattr4_owner", FT_STRING, BASE_DEC,
6953 NULL, 0, "nfs.fattr4_owner", HFILL }},
6955 { &hf_nfs_fattr4_owner_group, {
6956 "fattr4_owner_group", "nfs.fattr4_owner_group", FT_STRING, BASE_DEC,
6957 NULL, 0, "nfs.fattr4_owner_group", HFILL }},
6959 { &hf_nfs_stable_how4, {
6960 "stable_how4", "nfs.stable_how4", FT_UINT32, BASE_DEC,
6961 VALS(names_stable_how4), 0, "nfs.stable_how4", HFILL }},
6963 { &hf_nfs_dirlist4_eof, {
6964 "eof", "nfs.dirlist4.eof", FT_BOOLEAN,
6965 BASE_NONE, &yesno, 0, "nfs.dirlist4.eof", HFILL }},
6967 { &hf_nfs_data_follows, {
6968 "data_follows", "nfs.data_follows", FT_BOOLEAN,
6969 BASE_NONE, &yesno, 0, "nfs.data_follows", HFILL }},
6971 { &hf_nfs_stateid4, {
6972 "stateid", "nfs.stateid4", FT_UINT64, BASE_DEC,
6973 NULL, 0, "nfs.stateid4", HFILL }},
6975 { &hf_nfs_offset4, {
6976 "offset", "nfs.offset4", FT_UINT64, BASE_DEC,
6977 NULL, 0, "nfs.offset4", HFILL }},
6979 { &hf_nfs_specdata1, {
6980 "specdata1", "nfs.specdata1", FT_UINT32, BASE_DEC,
6981 NULL, 0, "nfs.specdata1", HFILL }},
6983 { &hf_nfs_specdata2, {
6984 "specdata2", "nfs.specdata2", FT_UINT32, BASE_DEC,
6985 NULL, 0, "nfs.specdata2", HFILL }},
6987 { &hf_nfs_lock_type4, {
6988 "locktype", "nfs.locktype4", FT_UINT32, BASE_DEC,
6989 VALS(names_nfs_lock_type4), 0, "nfs.locktype4", HFILL }},
6991 { &hf_nfs_reclaim4, {
6992 "reclaim", "nfs.reclaim4", FT_UINT32, BASE_DEC,
6993 NULL, 0, "nfs.reclaim4", HFILL }},
6995 { &hf_nfs_length4, {
6996 "length", "nfs.length4", FT_UINT64, BASE_DEC,
6997 NULL, 0, "nfs.length4", HFILL }},
6999 { &hf_nfs_changeid4, {
7000 "changeid", "nfs.changeid4", FT_UINT64, BASE_DEC,
7001 NULL, 0, "nfs.changeid4", HFILL }},
7003 { &hf_nfs_nfstime4_seconds, {
7004 "seconds", "nfs.nfstime4.seconds", FT_UINT64, BASE_DEC,
7005 NULL, 0, "nfs.nfstime4.seconds", HFILL }},
7007 { &hf_nfs_nfstime4_nseconds, {
7008 "nseconds", "nfs.nfstime4.nseconds", FT_UINT32, BASE_DEC,
7009 NULL, 0, "nfs.nfstime4.nseconds", HFILL }},
7011 { &hf_nfs_fsid4_major, {
7012 "fsid4.major", "nfs.fsid4.major", FT_UINT64, BASE_DEC,
7013 NULL, 0, "nfs.nfstime4.fsid4.major", HFILL }},
7015 { &hf_nfs_fsid4_minor, {
7016 "fsid4.minor", "nfs.fsid4.minor", FT_UINT64, BASE_DEC,
7017 NULL, 0, "nfs.fsid4.minor", HFILL }},
7019 { &hf_nfs_acetype4, {
7020 "acetype", "nfs.acetype4", FT_UINT32, BASE_DEC,
7021 NULL, 0, "nfs.acetype4", HFILL }},
7023 { &hf_nfs_aceflag4, {
7024 "aceflag", "nfs.aceflag4", FT_UINT32, BASE_DEC,
7025 NULL, 0, "nfs.aceflag4", HFILL }},
7027 { &hf_nfs_acemask4, {
7028 "acemask", "nfs.acemask4", FT_UINT32, BASE_DEC,
7029 NULL, 0, "nfs.acemask4", HFILL }},
7031 { &hf_nfs_fattr4_size, {
7032 "size", "nfs.fattr4.size", FT_UINT64, BASE_DEC,
7033 NULL, 0, "nfs.fattr4.size", HFILL }},
7035 { &hf_nfs_fattr4_lease_time, {
7036 "lease_time", "nfs.fattr4.lease_time", FT_UINT32, BASE_DEC,
7037 NULL, 0, "nfs.fattr4.lease_time", HFILL }},
7039 { &hf_nfs_fattr4_aclsupport, {
7040 "aclsupport", "nfs.fattr4.aclsupport", FT_UINT32, BASE_DEC,
7041 NULL, 0, "nfs.fattr4.aclsupport", HFILL }},
7043 { &hf_nfs_fattr4_fileid, {
7044 "fileid", "nfs.fattr4.fileid", FT_UINT64, BASE_DEC,
7045 NULL, 0, "nfs.fattr4.fileid", HFILL }},
7047 { &hf_nfs_fattr4_files_avail, {
7048 "files_avail", "nfs.fattr4.files_avail", FT_UINT64, BASE_DEC,
7049 NULL, 0, "nfs.fattr4.files_avail", HFILL }},
7051 { &hf_nfs_fattr4_files_free, {
7052 "files_free", "nfs.fattr4.files_free", FT_UINT64, BASE_DEC,
7053 NULL, 0, "nfs.fattr4.files_free", HFILL }},
7055 { &hf_nfs_fattr4_files_total, {
7056 "files_total", "nfs.fattr4.files_total", FT_UINT64, BASE_DEC,
7057 NULL, 0, "nfs.fattr4.files_total", HFILL }},
7059 { &hf_nfs_fattr4_maxfilesize, {
7060 "maxfilesize", "nfs.fattr4.maxfilesize", FT_UINT64, BASE_DEC,
7061 NULL, 0, "nfs.fattr4.maxfilesize", HFILL }},
7063 { &hf_nfs_fattr4_maxlink, {
7064 "maxlink", "nfs.fattr4.maxlink", FT_UINT32, BASE_DEC,
7065 NULL, 0, "nfs.fattr4.maxlink", HFILL }},
7067 { &hf_nfs_fattr4_maxname, {
7068 "maxname", "nfs.fattr4.maxname", FT_UINT32, BASE_DEC,
7069 NULL, 0, "nfs.fattr4.maxname", HFILL }},
7071 { &hf_nfs_fattr4_numlinks, {
7072 "numlinks", "nfs.fattr4.numlinks", FT_UINT32, BASE_DEC,
7073 NULL, 0, "nfs.fattr4.numlinks", HFILL }},
7075 { &hf_nfs_delegate_type, {
7076 "delegate_type", "nfs.delegate_type", FT_UINT32, BASE_DEC,
7077 NULL, 0, "nfs.delegate_type", HFILL }},
7079 { &hf_nfs_secinfo_flavor, {
7080 "flavor", "nfs.secinfo.flavor", FT_UINT32, BASE_DEC,
7081 VALS(rpc_auth_flavor), 0, "nfs.secinfo.flavor", HFILL }},
7083 { &hf_nfs_num_blocks, {
7084 "num_blocks", "nfs.num_blocks", FT_UINT32, BASE_DEC,
7085 NULL, 0, "nfs.num_blocks", HFILL }},
7087 { &hf_nfs_bytes_per_block, {
7088 "bytes_per_block", "nfs.bytes_per_block", FT_UINT32, BASE_DEC,
7089 NULL, 0, "nfs.bytes_per_block", HFILL }},
7092 "eof", "nfs.eof", FT_UINT32, BASE_DEC,
7093 NULL, 0, "nfs.eof", HFILL }},
7095 { &hf_nfs_fattr4_maxread, {
7096 "maxread", "nfs.fattr4.maxread", FT_UINT64, BASE_DEC,
7097 NULL, 0, "nfs.fattr4.maxread", HFILL }},
7099 { &hf_nfs_fattr4_maxwrite, {
7100 "maxwrite", "nfs.fattr4.maxwrite", FT_UINT64, BASE_DEC,
7101 NULL, 0, "nfs.fattr4.maxwrite", HFILL }},
7103 { &hf_nfs_fattr4_quota_hard, {
7104 "quota_hard", "nfs.fattr4.quota_hard", FT_UINT64, BASE_DEC,
7105 NULL, 0, "nfs.fattr4.quota_hard", HFILL }},
7107 { &hf_nfs_fattr4_quota_soft, {
7108 "quota_soft", "nfs.fattr4.quota_soft", FT_UINT64, BASE_DEC,
7109 NULL, 0, "nfs.fattr4.quota_soft", HFILL }},
7111 { &hf_nfs_fattr4_quota_used, {
7112 "quota_used", "nfs.fattr4.quota_used", FT_UINT64, BASE_DEC,
7113 NULL, 0, "nfs.fattr4.quota_used", HFILL }},
7115 { &hf_nfs_fattr4_space_avail, {
7116 "space_avail", "nfs.fattr4.space_avail", FT_UINT64, BASE_DEC,
7117 NULL, 0, "nfs.fattr4.space_avail", HFILL }},
7119 { &hf_nfs_fattr4_space_free, {
7120 "space_free", "nfs.fattr4.space_free", FT_UINT64, BASE_DEC,
7121 NULL, 0, "nfs.fattr4.space_free", HFILL }},
7123 { &hf_nfs_fattr4_space_total, {
7124 "space_total", "nfs.fattr4.space_total", FT_UINT64, BASE_DEC,
7125 NULL, 0, "nfs.fattr4.space_total", HFILL }},
7127 { &hf_nfs_fattr4_space_used, {
7128 "space_used", "nfs.fattr4.space_used", FT_UINT64, BASE_DEC,
7129 NULL, 0, "nfs.fattr4.space_used", HFILL }},
7131 { &hf_nfs_stateid4_delegate_stateid, {
7132 "delegate_stateid", "nfs.delegate_stateid", FT_UINT64, BASE_DEC,
7133 NULL, 0, "nfs.delegate_stateid", HFILL }},
7135 { &hf_nfs_verifier4, {
7136 "verifier", "nfs.verifier4", FT_UINT64, BASE_DEC,
7137 NULL, 0, "nfs.verifier4", HFILL }},
7139 { &hf_nfs_cookie4, {
7140 "cookie", "nfs.cookie4", FT_UINT64, BASE_DEC,
7141 NULL, 0, "nfs.cookie4", HFILL }},
7143 { &hf_nfs_cookieverf4, {
7144 "cookieverf", "nfs.cookieverf4", FT_UINT64, BASE_DEC,
7145 NULL, 0, "nfs.cookieverf4", HFILL }},
7147 { &hf_nfs_cb_location, {
7148 "cb_location", "nfs.cb_location", FT_UINT32, BASE_DEC,
7149 NULL, 0, "nfs.cb_location", HFILL }},
7151 { &hf_nfs_cb_program, {
7152 "cb_program", "nfs.cb_program", FT_UINT32, BASE_DEC,
7153 NULL, 0, "nfs.cb_program", HFILL }},
7155 { &hf_nfs_recall4, {
7156 "recall", "nfs.recall4", FT_BOOLEAN,
7157 BASE_NONE, &yesno, 0, "nfs.recall4", HFILL }},
7159 { &hf_nfs_filesize, {
7160 "filesize", "nfs.filesize", FT_UINT64, BASE_DEC,
7161 NULL, 0, "nfs.filesize", HFILL }},
7164 "count", "nfs.count4", FT_UINT32, BASE_DEC,
7165 NULL, 0, "nfs.count4", HFILL }},
7167 { &hf_nfs_count4_dircount, {
7168 "dircount", "nfs.dircount", FT_UINT32, BASE_DEC,
7169 NULL, 0, "nfs.dircount", HFILL }},
7171 { &hf_nfs_count4_maxcount, {
7172 "maxcount", "nfs.maxcount", FT_UINT32, BASE_DEC,
7173 NULL, 0, "nfs.maxcount", HFILL }},
7175 { &hf_nfs_minorversion, {
7176 "minorversion", "nfs.minorversion", FT_UINT32, BASE_DEC,
7177 NULL, 0, "nfs.minorversion", HFILL }},
7180 "atime", "nfs.atime", FT_ABSOLUTE_TIME, BASE_NONE,
7181 NULL, 0, "Access Time", HFILL }},
7183 { &hf_nfs_atime_sec, {
7184 "seconds", "nfs.atime.sec", FT_UINT32, BASE_DEC,
7185 NULL, 0, "Access Time, Seconds", HFILL }},
7187 { &hf_nfs_atime_nsec, {
7188 "nano seconds", "nfs.atime.nsec", FT_UINT32, BASE_DEC,
7189 NULL, 0, "Access Time, Nano-seconds", HFILL }},
7191 { &hf_nfs_atime_usec, {
7192 "micro seconds", "nfs.atime.usec", FT_UINT32, BASE_DEC,
7193 NULL, 0, "Access Time, Micro-seconds", HFILL }},
7196 "mtime", "nfs.mtime", FT_ABSOLUTE_TIME, BASE_NONE,
7197 NULL, 0, "Modify Time", HFILL }},
7199 { &hf_nfs_mtime_sec, {
7200 "seconds", "nfs.mtime.sec", FT_UINT32, BASE_DEC,
7201 NULL, 0, "Modify Seconds", HFILL }},
7203 { &hf_nfs_mtime_nsec, {
7204 "nano seconds", "nfs.mtime.nsec", FT_UINT32, BASE_DEC,
7205 NULL, 0, "Modify Time, Nano-seconds", HFILL }},
7207 { &hf_nfs_mtime_usec, {
7208 "micro seconds", "nfs.mtime.usec", FT_UINT32, BASE_DEC,
7209 NULL, 0, "Modify Time, Micro-seconds", HFILL }},
7212 "ctime", "nfs.ctime", FT_ABSOLUTE_TIME, BASE_NONE,
7213 NULL, 0, "Creation Time", HFILL }},
7215 { &hf_nfs_ctime_sec, {
7216 "seconds", "nfs.ctime.sec", FT_UINT32, BASE_DEC,
7217 NULL, 0, "Creation Time, Seconds", HFILL }},
7219 { &hf_nfs_ctime_nsec, {
7220 "nano seconds", "nfs.ctime.nsec", FT_UINT32, BASE_DEC,
7221 NULL, 0, "Creation Time, Nano-seconds", HFILL }},
7223 { &hf_nfs_ctime_usec, {
7224 "micro seconds", "nfs.ctime.usec", FT_UINT32, BASE_DEC,
7225 NULL, 0, "Creation Time, Micro-seconds", HFILL }},
7228 "time delta", "nfs.dtime", FT_RELATIVE_TIME, BASE_NONE,
7229 NULL, 0, "Time Delta", HFILL }},
7231 { &hf_nfs_dtime_sec, {
7232 "seconds", "nfs.dtime.sec", FT_UINT32, BASE_DEC,
7233 NULL, 0, "Time Delta, Seconds", HFILL }},
7235 { &hf_nfs_dtime_nsec, {
7236 "nano seconds", "nfs.dtime.nsec", FT_UINT32, BASE_DEC,
7237 NULL, 0, "Time Delta, Nano-seconds", HFILL }},
7239 { &hf_nfs_open_owner4, {
7240 "owner", "nfs.open_owner4", FT_BYTES, BASE_DEC,
7241 NULL, 0, "owner", HFILL }},
7243 { &hf_nfs_lock_owner4, {
7244 "owner", "nfs.lock_owner4", FT_BYTES, BASE_DEC,
7245 NULL, 0, "owner", HFILL }},
7247 { &hf_nfs_secinfo_rpcsec_gss_info_service, {
7248 "service", "nfs.secinfo.rpcsec_gss_info.service", FT_UINT32,
7249 BASE_DEC, VALS(rpc_authgss_svc), 0, "service", HFILL }},
7251 { &hf_nfs_attrdircreate, {
7252 "attribute dir create", "nfs.openattr4.createdir", FT_BOOLEAN,
7253 BASE_NONE, &yesno, 0, "nfs.openattr4.createdir", HFILL }},
7255 { &hf_nfs_new_lock_owner, {
7256 "new lock owner?", "nfs.lock.locker.new_lock_owner", FT_BOOLEAN,
7257 BASE_NONE, &yesno, 0, "nfs.lock.locker.new_lock_owner", HFILL }},
7259 { &hf_nfs_lock4_reclaim, {
7260 "reclaim?", "nfs.lock.reclaim", FT_BOOLEAN,
7261 BASE_NONE, &yesno, 0, "nfs.lock.reclaim", HFILL }},
7263 { &hf_nfs_sec_oid4, {
7264 "oid", "nfs.secinfo.flavor_info.rpcsec_gss_info.oid", FT_BYTES,
7265 BASE_DEC, NULL, 0, "oid", HFILL }},
7268 "qop", "nfs.secinfo.flavor_info.rpcsec_gss_info.qop", FT_UINT32,
7269 BASE_DEC, NULL, 0, "qop", HFILL }},
7271 { &hf_nfs_client_id4_id, {
7272 "Data", "nfs.nfs_client_id4.id", FT_BYTES, BASE_DEC,
7273 NULL, 0, "Data", HFILL }},
7275 { &hf_nfs_stateid4_other, {
7276 "Data", "nfs.stateid4.other", FT_BYTES, BASE_DEC,
7277 NULL, 0, "Data", HFILL }},
7280 static gint *ett[] = {
7282 &ett_nfs_fh_encoding,
7295 &ett_nfs_readdir_entry,
7301 &ett_nfs_post_op_fh3,
7303 &ett_nfs_diropargs3,
7304 &ett_nfs_sattrguard3,
7311 &ett_nfs_pre_op_attr,
7312 &ett_nfs_post_op_attr,
7316 &ett_nfs_fsinfo_properties,
7317 &ett_nfs_compound_call4,
7318 &ett_nfs_utf8string,
7325 &ett_nfs_delegpurge4,
7326 &ett_nfs_delegreturn4,
7338 &ett_nfs_open_confirm4,
7339 &ett_nfs_open_downgrade4,
7342 &ett_nfs_putrootfh4,
7349 &ett_nfs_restorefh4,
7352 &ett_nfs_setclientid4,
7353 &ett_nfs_setclientid_confirm4,
7360 &ett_nfs_change_info4,
7361 &ett_nfs_open_delegation4,
7362 &ett_nfs_open_claim4,
7364 &ett_nfs_lock_owner4,
7365 &ett_nfs_cb_client4,
7366 &ett_nfs_client_id4,
7370 &ett_nfs_fs_locations4,
7371 &ett_nfs_fs_location4,
7372 &ett_nfs_open4_result_flags,
7373 &ett_nfs_secinfo4_flavor_info,
7376 module_t *nfs_module;
7378 proto_nfs = proto_register_protocol("Network File System", "NFS", "nfs");
7379 proto_register_field_array(proto_nfs, hf, array_length(hf));
7380 proto_register_subtree_array(ett, array_length(ett));
7382 nfs_module=prefs_register_protocol(proto_nfs, NULL);
7383 prefs_register_bool_preference(nfs_module, "file_name_snooping",
7384 "Snoop FH to filename mappings",
7385 "Whether the dissector should snoop the FH to filename mappings by looking inside certain packets",
7386 &nfs_file_name_snooping);
7387 prefs_register_bool_preference(nfs_module, "file_full_name_snooping",
7388 "Snoop full path to filenames",
7389 "Whether the dissector should snoop the full pathname for files for matching FH's",
7390 &nfs_file_name_full_snooping);
7391 register_init_routine(nfs_name_snoop_init);
7395 proto_reg_handoff_nfs(void)
7397 /* Register the protocol as RPC */
7398 rpc_init_prog(proto_nfs, NFS_PROGRAM, ett_nfs);
7399 /* Register the procedure tables */
7400 rpc_init_proc_table(NFS_PROGRAM, 2, nfs2_proc);
7401 rpc_init_proc_table(NFS_PROGRAM, 3, nfs3_proc);
7402 rpc_init_proc_table(NFS_PROGRAM, 4, nfs4_proc);