2 * Routines for nfs dissection
3 * Copyright 1999, Uwe Girlich <Uwe.Girlich@philosys.de>
4 * Copyright 2000-2002, Mike Frisch <frisch@hummingbird.com> (NFSv4 decoding)
5 * $Id: packet-nfs.c,v 1.90 2003/06/10 17:14:28 guy Exp $
7 * Ethereal - Network traffic analyzer
8 * By Gerald Combs <gerald@ethereal.com>
9 * Copyright 1998 Gerald Combs
11 * Copied from packet-smb.c
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version 2
16 * of the License, or (at your option) any later version.
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
36 #include "packet-rpc.h"
37 #include "packet-nfs.h"
41 static int proto_nfs = -1;
43 static int hf_nfs_procedure_v2 = -1;
44 static int hf_nfs_procedure_v3 = -1;
45 static int hf_nfs_procedure_v4 = -1;
46 static int hf_nfs_fh_length = -1;
47 static int hf_nfs_fh_hash = -1;
48 static int hf_nfs_fh_fsid_major = -1;
49 static int hf_nfs_fh_fsid_minor = -1;
50 static int hf_nfs_fh_fsid_inode = -1;
51 static int hf_nfs_fh_xfsid_major = -1;
52 static int hf_nfs_fh_xfsid_minor = -1;
53 static int hf_nfs_fh_fstype = -1;
54 static int hf_nfs_fh_fn = -1;
55 static int hf_nfs_fh_fn_len = -1;
56 static int hf_nfs_fh_fn_inode = -1;
57 static int hf_nfs_fh_fn_generation = -1;
58 static int hf_nfs_fh_xfn = -1;
59 static int hf_nfs_fh_xfn_len = -1;
60 static int hf_nfs_fh_xfn_inode = -1;
61 static int hf_nfs_fh_xfn_generation = -1;
62 static int hf_nfs_fh_dentry = -1;
63 static int hf_nfs_fh_dev = -1;
64 static int hf_nfs_fh_xdev = -1;
65 static int hf_nfs_fh_dirinode = -1;
66 static int hf_nfs_fh_pinode = -1;
67 static int hf_nfs_fh_hp_len = -1;
68 static int hf_nfs_fh_version = -1;
69 static int hf_nfs_fh_auth_type = -1;
70 static int hf_nfs_fh_fsid_type = -1;
71 static int hf_nfs_fh_fileid_type = -1;
72 static int hf_nfs_stat = -1;
73 static int hf_nfs_name = -1;
74 static int hf_nfs_full_name = -1;
75 static int hf_nfs_readlink_data = -1;
76 static int hf_nfs_read_offset = -1;
77 static int hf_nfs_read_count = -1;
78 static int hf_nfs_read_totalcount = -1;
79 static int hf_nfs_data = -1;
80 static int hf_nfs_write_beginoffset = -1;
81 static int hf_nfs_write_offset = -1;
82 static int hf_nfs_write_totalcount = -1;
83 static int hf_nfs_symlink_to = -1;
84 static int hf_nfs_readdir_cookie = -1;
85 static int hf_nfs_readdir_count = -1;
86 static int hf_nfs_readdir_entry = -1;
87 static int hf_nfs_readdir_entry_fileid = -1;
88 static int hf_nfs_readdir_entry_name = -1;
89 static int hf_nfs_readdir_entry_cookie = -1;
90 static int hf_nfs_readdir_entry3_fileid = -1;
91 static int hf_nfs_readdir_entry3_name = -1;
92 static int hf_nfs_readdir_entry3_cookie = -1;
93 static int hf_nfs_readdirplus_entry_fileid = -1;
94 static int hf_nfs_readdirplus_entry_name = -1;
95 static int hf_nfs_readdirplus_entry_cookie = -1;
96 static int hf_nfs_readdir_eof = -1;
97 static int hf_nfs_statfs_tsize = -1;
98 static int hf_nfs_statfs_bsize = -1;
99 static int hf_nfs_statfs_blocks = -1;
100 static int hf_nfs_statfs_bfree = -1;
101 static int hf_nfs_statfs_bavail = -1;
102 static int hf_nfs_ftype3 = -1;
103 static int hf_nfs_nfsstat3 = -1;
104 static int hf_nfs_read_eof = -1;
105 static int hf_nfs_write_stable = -1;
106 static int hf_nfs_write_committed = -1;
107 static int hf_nfs_createmode3 = -1;
108 static int hf_nfs_fsstat_invarsec = -1;
109 static int hf_nfs_fsinfo_rtmax = -1;
110 static int hf_nfs_fsinfo_rtpref = -1;
111 static int hf_nfs_fsinfo_rtmult = -1;
112 static int hf_nfs_fsinfo_wtmax = -1;
113 static int hf_nfs_fsinfo_wtpref = -1;
114 static int hf_nfs_fsinfo_wtmult = -1;
115 static int hf_nfs_fsinfo_dtpref = -1;
116 static int hf_nfs_fsinfo_maxfilesize = -1;
117 static int hf_nfs_fsinfo_properties = -1;
118 static int hf_nfs_pathconf_linkmax = -1;
119 static int hf_nfs_pathconf_name_max = -1;
120 static int hf_nfs_pathconf_no_trunc = -1;
121 static int hf_nfs_pathconf_chown_restricted = -1;
122 static int hf_nfs_pathconf_case_insensitive = -1;
123 static int hf_nfs_pathconf_case_preserving = -1;
125 static int hf_nfs_atime = -1;
126 static int hf_nfs_atime_sec = -1;
127 static int hf_nfs_atime_nsec = -1;
128 static int hf_nfs_atime_usec = -1;
129 static int hf_nfs_mtime = -1;
130 static int hf_nfs_mtime_sec = -1;
131 static int hf_nfs_mtime_nsec = -1;
132 static int hf_nfs_mtime_usec = -1;
133 static int hf_nfs_ctime = -1;
134 static int hf_nfs_ctime_sec = -1;
135 static int hf_nfs_ctime_nsec = -1;
136 static int hf_nfs_ctime_usec = -1;
137 static int hf_nfs_dtime = -1;
138 static int hf_nfs_dtime_sec = -1;
139 static int hf_nfs_dtime_nsec = -1;
141 static int hf_nfs_fattr_type = -1;
142 static int hf_nfs_fattr_nlink = -1;
143 static int hf_nfs_fattr_uid = -1;
144 static int hf_nfs_fattr_gid = -1;
145 static int hf_nfs_fattr_size = -1;
146 static int hf_nfs_fattr_blocksize = -1;
147 static int hf_nfs_fattr_rdev = -1;
148 static int hf_nfs_fattr_blocks = -1;
149 static int hf_nfs_fattr_fsid = -1;
150 static int hf_nfs_fattr_fileid = -1;
151 static int hf_nfs_fattr3_type = -1;
152 static int hf_nfs_fattr3_nlink = -1;
153 static int hf_nfs_fattr3_uid = -1;
154 static int hf_nfs_fattr3_gid = -1;
155 static int hf_nfs_fattr3_size = -1;
156 static int hf_nfs_fattr3_used = -1;
157 static int hf_nfs_fattr3_rdev = -1;
158 static int hf_nfs_fattr3_fsid = -1;
159 static int hf_nfs_fattr3_fileid = -1;
160 static int hf_nfs_wcc_attr_size = -1;
161 static int hf_nfs_set_size3_size = -1;
162 static int hf_nfs_cookie3 = -1;
163 static int hf_nfs_fsstat3_resok_tbytes = -1;
164 static int hf_nfs_fsstat3_resok_fbytes = -1;
165 static int hf_nfs_fsstat3_resok_abytes = -1;
166 static int hf_nfs_fsstat3_resok_tfiles = -1;
167 static int hf_nfs_fsstat3_resok_ffiles = -1;
168 static int hf_nfs_fsstat3_resok_afiles = -1;
169 static int hf_nfs_uid3 = -1;
170 static int hf_nfs_gid3 = -1;
171 static int hf_nfs_offset3 = -1;
172 static int hf_nfs_count3 = -1;
173 static int hf_nfs_count3_maxcount = -1;
174 static int hf_nfs_count3_dircount= -1;
177 static int hf_nfs_argop4 = -1;
178 static int hf_nfs_resop4 = -1;
179 static int hf_nfs_linktext4 = -1;
180 static int hf_nfs_tag4 = -1;
181 static int hf_nfs_component4 = -1;
182 static int hf_nfs_clientid4 = -1;
183 static int hf_nfs_ace4 = -1;
184 static int hf_nfs_recall = -1;
185 static int hf_nfs_open_claim_type4 = -1;
186 static int hf_nfs_opentype4 = -1;
187 static int hf_nfs_limit_by4 = -1;
188 static int hf_nfs_open_delegation_type4 = -1;
189 static int hf_nfs_ftype4 = -1;
190 static int hf_nfs_change_info4_atomic = -1;
191 static int hf_nfs_open4_share_access = -1;
192 static int hf_nfs_open4_share_deny = -1;
193 static int hf_nfs_seqid4 = -1;
194 static int hf_nfs_lock_seqid4 = -1;
195 static int hf_nfs_mand_attr = -1;
196 static int hf_nfs_recc_attr = -1;
197 static int hf_nfs_time_how4 = -1;
198 static int hf_nfs_attrlist4 = -1;
199 static int hf_nfs_fattr4_link_support = -1;
200 static int hf_nfs_fattr4_symlink_support = -1;
201 static int hf_nfs_fattr4_named_attr = -1;
202 static int hf_nfs_fattr4_unique_handles = -1;
203 static int hf_nfs_fattr4_archive = -1;
204 static int hf_nfs_fattr4_cansettime = -1;
205 static int hf_nfs_fattr4_case_insensitive = -1;
206 static int hf_nfs_fattr4_case_preserving = -1;
207 static int hf_nfs_fattr4_chown_restricted = -1;
208 static int hf_nfs_fattr4_hidden = -1;
209 static int hf_nfs_fattr4_homogeneous = -1;
210 static int hf_nfs_fattr4_mimetype = -1;
211 static int hf_nfs_fattr4_no_trunc = -1;
212 static int hf_nfs_fattr4_system = -1;
213 static int hf_nfs_fattr4_owner = -1;
214 static int hf_nfs_fattr4_owner_group = -1;
215 static int hf_nfs_fattr4_size = -1;
216 static int hf_nfs_fattr4_aclsupport = -1;
217 static int hf_nfs_fattr4_lease_time = -1;
218 static int hf_nfs_fattr4_fileid = -1;
219 static int hf_nfs_fattr4_files_avail = -1;
220 static int hf_nfs_fattr4_files_free = -1;
221 static int hf_nfs_fattr4_files_total = -1;
222 static int hf_nfs_fattr4_maxfilesize = -1;
223 static int hf_nfs_fattr4_maxlink = -1;
224 static int hf_nfs_fattr4_maxname = -1;
225 static int hf_nfs_fattr4_numlinks = -1;
226 static int hf_nfs_fattr4_maxread = -1;
227 static int hf_nfs_fattr4_maxwrite = -1;
228 static int hf_nfs_fattr4_quota_hard = -1;
229 static int hf_nfs_fattr4_quota_soft = -1;
230 static int hf_nfs_fattr4_quota_used = -1;
231 static int hf_nfs_fattr4_space_avail = -1;
232 static int hf_nfs_fattr4_space_free = -1;
233 static int hf_nfs_fattr4_space_total = -1;
234 static int hf_nfs_fattr4_space_used = -1;
235 static int hf_nfs_who = -1;
236 static int hf_nfs_server = -1;
237 static int hf_nfs_stable_how4 = -1;
238 static int hf_nfs_dirlist4_eof = -1;
239 static int hf_nfs_stateid4 = -1;
240 static int hf_nfs_offset4 = -1;
241 static int hf_nfs_specdata1 = -1;
242 static int hf_nfs_specdata2 = -1;
243 static int hf_nfs_lock_type4 = -1;
244 static int hf_nfs_reclaim4 = -1;
245 static int hf_nfs_length4 = -1;
246 static int hf_nfs_changeid4 = -1;
247 static int hf_nfs_changeid4_before = -1;
248 static int hf_nfs_changeid4_after = -1;
249 static int hf_nfs_nfstime4_seconds = -1;
250 static int hf_nfs_nfstime4_nseconds = -1;
251 static int hf_nfs_fsid4_major = -1;
252 static int hf_nfs_fsid4_minor = -1;
253 static int hf_nfs_acetype4 = -1;
254 static int hf_nfs_aceflag4 = -1;
255 static int hf_nfs_acemask4 = -1;
256 static int hf_nfs_delegate_type = -1;
257 static int hf_nfs_secinfo_flavor = -1;
258 static int hf_nfs_secinfo_arr4 = -1;
259 static int hf_nfs_num_blocks = -1;
260 static int hf_nfs_bytes_per_block = -1;
261 static int hf_nfs_eof = -1;
262 static int hf_nfs_stateid4_delegate_stateid = -1;
263 static int hf_nfs_verifier4 = -1;
264 static int hf_nfs_cookie4 = -1;
265 static int hf_nfs_cookieverf4 = -1;
266 static int hf_nfs_cb_program = -1;
267 static int hf_nfs_cb_location = -1;
268 static int hf_nfs_recall4 = -1;
269 static int hf_nfs_filesize = -1;
270 static int hf_nfs_count4 = -1;
271 static int hf_nfs_count4_dircount = -1;
272 static int hf_nfs_count4_maxcount = -1;
273 static int hf_nfs_minorversion = -1;
274 static int hf_nfs_open_owner4 = -1;
275 static int hf_nfs_lock_owner4 = -1;
276 static int hf_nfs_new_lock_owner = -1;
277 static int hf_nfs_sec_oid4 = -1;
278 static int hf_nfs_qop4 = -1;
279 static int hf_nfs_secinfo_rpcsec_gss_info_service = -1;
280 static int hf_nfs_attrdircreate = -1;
281 static int hf_nfs_client_id4_id = -1;
282 static int hf_nfs_stateid4_other = -1;
283 static int hf_nfs_lock4_reclaim = -1;
284 static int hf_nfs_acl4 = -1;
285 static int hf_nfs_callback_ident = -1;
286 static int hf_nfs_r_netid = -1;
287 static int hf_nfs_r_addr = -1;
289 static gint ett_nfs = -1;
290 static gint ett_nfs_fh_encoding = -1;
291 static gint ett_nfs_fh_fsid = -1;
292 static gint ett_nfs_fh_xfsid = -1;
293 static gint ett_nfs_fh_fn = -1;
294 static gint ett_nfs_fh_xfn = -1;
295 static gint ett_nfs_fh_hp = -1;
296 static gint ett_nfs_fh_auth = -1;
297 static gint ett_nfs_fhandle = -1;
298 static gint ett_nfs_timeval = -1;
299 static gint ett_nfs_mode = -1;
300 static gint ett_nfs_fattr = -1;
301 static gint ett_nfs_sattr = -1;
302 static gint ett_nfs_diropargs = -1;
303 static gint ett_nfs_readdir_entry = -1;
304 static gint ett_nfs_mode3 = -1;
305 static gint ett_nfs_specdata3 = -1;
306 static gint ett_nfs_fh3 = -1;
307 static gint ett_nfs_nfstime3 = -1;
308 static gint ett_nfs_fattr3 = -1;
309 static gint ett_nfs_post_op_fh3 = -1;
310 static gint ett_nfs_sattr3 = -1;
311 static gint ett_nfs_diropargs3 = -1;
312 static gint ett_nfs_sattrguard3 = -1;
313 static gint ett_nfs_set_mode3 = -1;
314 static gint ett_nfs_set_uid3 = -1;
315 static gint ett_nfs_set_gid3 = -1;
316 static gint ett_nfs_set_size3 = -1;
317 static gint ett_nfs_set_atime = -1;
318 static gint ett_nfs_set_mtime = -1;
319 static gint ett_nfs_pre_op_attr = -1;
320 static gint ett_nfs_post_op_attr = -1;
321 static gint ett_nfs_wcc_attr = -1;
322 static gint ett_nfs_wcc_data = -1;
323 static gint ett_nfs_access = -1;
324 static gint ett_nfs_fsinfo_properties = -1;
327 static gint ett_nfs_compound_call4 = -1;
328 static gint ett_nfs_utf8string = -1;
329 static gint ett_nfs_argop4 = -1;
330 static gint ett_nfs_resop4 = -1;
331 static gint ett_nfs_access4 = -1;
332 static gint ett_nfs_close4 = -1;
333 static gint ett_nfs_commit4 = -1;
334 static gint ett_nfs_create4 = -1;
335 static gint ett_nfs_delegpurge4 = -1;
336 static gint ett_nfs_delegreturn4 = -1;
337 static gint ett_nfs_getattr4 = -1;
338 static gint ett_nfs_getfh4 = -1;
339 static gint ett_nfs_link4 = -1;
340 static gint ett_nfs_lock4 = -1;
341 static gint ett_nfs_lockt4 = -1;
342 static gint ett_nfs_locku4 = -1;
343 static gint ett_nfs_lookup4 = -1;
344 static gint ett_nfs_lookupp4 = -1;
345 static gint ett_nfs_nverify4 = -1;
346 static gint ett_nfs_open4 = -1;
347 static gint ett_nfs_openattr4 = -1;
348 static gint ett_nfs_open_confirm4 = -1;
349 static gint ett_nfs_open_downgrade4 = -1;
350 static gint ett_nfs_putfh4 = -1;
351 static gint ett_nfs_putpubfh4 = -1;
352 static gint ett_nfs_putrootfh4 = -1;
353 static gint ett_nfs_read4 = -1;
354 static gint ett_nfs_readdir4 = -1;
355 static gint ett_nfs_readlink4 = -1;
356 static gint ett_nfs_remove4 = -1;
357 static gint ett_nfs_rename4 = -1;
358 static gint ett_nfs_renew4 = -1;
359 static gint ett_nfs_restorefh4 = -1;
360 static gint ett_nfs_savefh4 = -1;
361 static gint ett_nfs_secinfo4 = -1;
362 static gint ett_nfs_setattr4 = -1;
363 static gint ett_nfs_setclientid4 = -1;
364 static gint ett_nfs_setclientid_confirm4 = -1;
365 static gint ett_nfs_verify4 = -1;
366 static gint ett_nfs_write4 = -1;
367 static gint ett_nfs_verifier4 = -1;
368 static gint ett_nfs_opaque = -1;
369 static gint ett_nfs_dirlist4 = -1;
370 static gint ett_nfs_pathname4 = -1;
371 static gint ett_nfs_change_info4 = -1;
372 static gint ett_nfs_open_delegation4 = -1;
373 static gint ett_nfs_open_claim4 = -1;
374 static gint ett_nfs_opentype4 = -1;
375 static gint ett_nfs_lock_owner4 = -1;
376 static gint ett_nfs_cb_client4 = -1;
377 static gint ett_nfs_client_id4 = -1;
378 static gint ett_nfs_bitmap4 = -1;
379 static gint ett_nfs_fattr4 = -1;
380 static gint ett_nfs_fsid4 = -1;
381 static gint ett_nfs_fs_locations4 = -1;
382 static gint ett_nfs_fs_location4 = -1;
383 static gint ett_nfs_open4_result_flags = -1;
384 static gint ett_nfs_secinfo4_flavor_info = -1;
385 static gint ett_nfs_stateid4 = -1;
386 static gint ett_nfs_fattr4_fh_expire_type = -1;
387 static gint ett_nfs_ace4 = -1;
388 static gint ett_nfs_clientaddr4 = -1;
389 static gint ett_nfs_aceflag4 = -1;
390 static gint ett_nfs_acemask4 = -1;
393 /* fhandle displayfilters to match also corresponding request/response
394 packet in addition to the one containing the actual filehandle */
395 gboolean nfs_fhandle_reqrep_matching = FALSE;
396 static GMemChunk *nfs_fhandle_data_chunk = NULL;
397 static int nfs_fhandle_data_init_count = 100;
398 static GHashTable *nfs_fhandle_data_table = NULL;
399 GHashTable *nfs_fhandle_frame_table = NULL;
402 nfs_fhandle_data_equal(gconstpointer k1, gconstpointer k2)
404 const nfs_fhandle_data_t *key1 = (const nfs_fhandle_data_t *)k1;
405 const nfs_fhandle_data_t *key2 = (const nfs_fhandle_data_t *)k2;
407 return (key1->len==key2->len)
408 &&(!memcmp(key1->fh, key2->fh, key1->len));
411 nfs_fhandle_data_hash(gconstpointer k)
413 const nfs_fhandle_data_t *key = (const nfs_fhandle_data_t *)k;
418 for(i=0;i<key->len;i++)
424 nfs_fhandle_data_free_all(gpointer key_arg _U_, gpointer value, gpointer user_data _U_)
426 nfs_fhandle_data_t *nns = (nfs_fhandle_data_t *)value;
431 g_free((gpointer)nns->fh);
439 nfs_fhandle_frame_equal(gconstpointer k1, gconstpointer k2)
441 guint32 key1 = (guint32)k1;
442 guint32 key2 = (guint32)k2;
447 nfs_fhandle_frame_hash(gconstpointer k)
449 guint32 key = (guint32)k;
454 nfs_fhandle_frame_free_all(gpointer key_arg _U_, gpointer value _U_, gpointer user_data _U_)
459 nfs_fhandle_reqrep_matching_init(void)
461 if (nfs_fhandle_frame_table != NULL) {
462 g_hash_table_foreach_remove(nfs_fhandle_frame_table,
463 nfs_fhandle_frame_free_all, NULL);
465 nfs_fhandle_frame_table=g_hash_table_new(nfs_fhandle_frame_hash,
466 nfs_fhandle_frame_equal);
470 if (nfs_fhandle_data_table != NULL) {
471 g_hash_table_foreach_remove(nfs_fhandle_data_table,
472 nfs_fhandle_data_free_all, NULL);
474 nfs_fhandle_data_table=g_hash_table_new(nfs_fhandle_data_hash,
475 nfs_fhandle_data_equal);
478 if(nfs_fhandle_data_chunk){
479 g_mem_chunk_destroy(nfs_fhandle_data_chunk);
480 nfs_fhandle_data_chunk = NULL;
483 if(nfs_fhandle_reqrep_matching){
484 nfs_fhandle_data_chunk = g_mem_chunk_new("nfs_fhandle_data_chunk",
485 sizeof(nfs_fhandle_data_t),
486 nfs_fhandle_data_init_count * sizeof(nfs_fhandle_data_t),
493 /* file name snooping */
494 gboolean nfs_file_name_snooping = FALSE;
495 gboolean nfs_file_name_full_snooping = FALSE;
496 typedef struct nfs_name_snoop {
502 unsigned char *parent;
504 unsigned char *full_name;
507 typedef struct nfs_name_snoop_key {
510 const unsigned char *fh;
511 } nfs_name_snoop_key_t;
513 static GMemChunk *nfs_name_snoop_chunk = NULL;
514 static int nfs_name_snoop_init_count = 100;
515 static GHashTable *nfs_name_snoop_unmatched = NULL;
517 static GMemChunk *nfs_name_snoop_key_chunk = NULL;
518 static int nfs_name_snoop_key_init_count = 100;
519 static GHashTable *nfs_name_snoop_matched = NULL;
521 static GHashTable *nfs_name_snoop_known = NULL;
524 nfs_name_snoop_matched_equal(gconstpointer k1, gconstpointer k2)
526 const nfs_name_snoop_key_t *key1 = (const nfs_name_snoop_key_t *)k1;
527 const nfs_name_snoop_key_t *key2 = (const nfs_name_snoop_key_t *)k2;
529 return (key1->key==key2->key)
530 &&(key1->fh_length==key2->fh_length)
531 &&(!memcmp(key1->fh, key2->fh, key1->fh_length));
534 nfs_name_snoop_matched_hash(gconstpointer k)
536 const nfs_name_snoop_key_t *key = (const nfs_name_snoop_key_t *)k;
541 for(i=0;i<key->fh_length;i++)
547 nfs_name_snoop_unmatched_equal(gconstpointer k1, gconstpointer k2)
549 guint32 key1 = (guint32)k1;
550 guint32 key2 = (guint32)k2;
555 nfs_name_snoop_unmatched_hash(gconstpointer k)
557 guint32 key = (guint32)k;
562 nfs_name_snoop_unmatched_free_all(gpointer key_arg _U_, gpointer value, gpointer user_data _U_)
564 nfs_name_snoop_t *nns = (nfs_name_snoop_t *)value;
567 g_free((gpointer)nns->name);
572 g_free((gpointer)nns->full_name);
574 nns->full_name_len=0;
577 g_free((gpointer)nns->parent);
582 g_free((gpointer)nns->fh);
590 nfs_name_snoop_init(void)
592 if (nfs_name_snoop_unmatched != NULL) {
593 g_hash_table_foreach_remove(nfs_name_snoop_unmatched,
594 nfs_name_snoop_unmatched_free_all, NULL);
596 /* The fragment table does not exist. Create it */
597 nfs_name_snoop_unmatched=g_hash_table_new(nfs_name_snoop_unmatched_hash,
598 nfs_name_snoop_unmatched_equal);
600 if (nfs_name_snoop_matched != NULL) {
601 g_hash_table_foreach_remove(nfs_name_snoop_matched,
602 nfs_name_snoop_unmatched_free_all, NULL);
604 /* The fragment table does not exist. Create it */
605 nfs_name_snoop_matched=g_hash_table_new(nfs_name_snoop_matched_hash,
606 nfs_name_snoop_matched_equal);
608 if (nfs_name_snoop_known != NULL) {
609 g_hash_table_foreach_remove(nfs_name_snoop_known,
610 nfs_name_snoop_unmatched_free_all, NULL);
612 /* The fragment table does not exist. Create it */
613 nfs_name_snoop_known=g_hash_table_new(nfs_name_snoop_matched_hash,
614 nfs_name_snoop_matched_equal);
617 if(nfs_name_snoop_chunk){
618 g_mem_chunk_destroy(nfs_name_snoop_chunk);
619 nfs_name_snoop_chunk = NULL;
621 if(nfs_name_snoop_key_chunk){
622 g_mem_chunk_destroy(nfs_name_snoop_key_chunk);
623 nfs_name_snoop_key_chunk = NULL;
626 if(nfs_file_name_snooping){
627 nfs_name_snoop_chunk = g_mem_chunk_new("nfs_name_snoop_chunk",
628 sizeof(nfs_name_snoop_t),
629 nfs_name_snoop_init_count * sizeof(nfs_name_snoop_t),
631 nfs_name_snoop_key_chunk = g_mem_chunk_new("nfs_name_snoop_key_chunk",
632 sizeof(nfs_name_snoop_key_t),
633 nfs_name_snoop_key_init_count * sizeof(nfs_name_snoop_key_t),
640 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)
642 nfs_name_snoop_t *nns, *old_nns;
643 const unsigned char *ptr=NULL;
645 /* filter out all '.' and '..' names */
647 ptr=(const unsigned char *)tvb_get_ptr(tvb, name_offset, name_len);
660 nns=g_mem_chunk_alloc(nfs_name_snoop_chunk);
666 nns->parent_len=parent_len;
667 nns->parent=g_malloc(parent_len);
668 memcpy(nns->parent, tvb_get_ptr(tvb, parent_offset, parent_len), parent_len);
674 nns->name_len=name_len;
678 nns->name=g_malloc(name_len+1);
679 memcpy(nns->name, ptr, name_len);
681 nns->name[name_len]=0;
683 nns->full_name_len=0;
686 /* remove any old entry for this */
687 old_nns=g_hash_table_lookup(nfs_name_snoop_unmatched, (gconstpointer)xid);
689 /* if we haven't seen the reply yet, then there are no
690 matched entries for it, thus we can dealloc the arrays*/
692 g_free(old_nns->name);
696 g_free(old_nns->parent);
697 old_nns->parent=NULL;
698 old_nns->parent_len=0;
700 g_mem_chunk_free(nfs_name_snoop_chunk, old_nns);
702 g_hash_table_remove(nfs_name_snoop_unmatched, (gconstpointer)xid);
705 g_hash_table_insert(nfs_name_snoop_unmatched, (gpointer)xid, nns);
709 nfs_name_snoop_add_fh(int xid, tvbuff_t *tvb, int fh_offset, int fh_length)
712 nfs_name_snoop_t *nns, *old_nns;
713 nfs_name_snoop_key_t *key;
715 /* find which request we correspond to */
716 nns=g_hash_table_lookup(nfs_name_snoop_unmatched, (gconstpointer)xid);
718 /* oops couldnt find matching request, bail out */
722 /* if we have already seen this response earlier */
727 /* oki, we have a new entry */
728 fh=g_malloc(fh_length);
729 memcpy(fh, tvb_get_ptr(tvb, fh_offset, fh_length), fh_length);
731 nns->fh_length=fh_length;
733 key=g_mem_chunk_alloc(nfs_name_snoop_key_chunk);
735 key->fh_length=nns->fh_length;
738 /* already have something matched for this fh, remove it from
740 old_nns=g_hash_table_lookup(nfs_name_snoop_matched, key);
742 g_hash_table_remove(nfs_name_snoop_matched, key);
745 g_hash_table_remove(nfs_name_snoop_unmatched, (gconstpointer)xid);
746 g_hash_table_insert(nfs_name_snoop_matched, key, nns);
750 nfs_full_name_snoop(nfs_name_snoop_t *nns, int *len, unsigned char **name, unsigned char **pos)
752 nfs_name_snoop_t *parent_nns = NULL;
753 nfs_name_snoop_key_t key;
755 /* check if the nns component ends with a '/' else we just allocate
756 an extra byte to len to accommodate for it later */
757 if(nns->name[nns->name_len-1]!='/'){
761 (*len) += nns->name_len;
763 if(nns->parent==NULL){
764 *name = g_malloc((*len)+1);
767 strcpy(*pos, nns->name);
768 *pos += nns->name_len;
773 key.fh_length=nns->parent_len;
776 parent_nns=g_hash_table_lookup(nfs_name_snoop_matched, &key);
779 nfs_full_name_snoop(parent_nns, len, name, pos);
781 /* make sure components are '/' separated */
782 if( (*pos)[-1] != '/'){
787 strcpy(*pos, nns->name);
788 *pos += nns->name_len;
797 nfs_name_snoop_fh(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int fh_offset, int fh_length, gboolean hidden)
799 nfs_name_snoop_key_t key;
800 nfs_name_snoop_t *nns = NULL;
802 /* if this is a new packet, see if we can register the mapping */
803 if(!pinfo->fd->flags.visited){
805 key.fh_length=fh_length;
806 key.fh=(const unsigned char *)tvb_get_ptr(tvb, fh_offset, fh_length);
808 nns=g_hash_table_lookup(nfs_name_snoop_matched, &key);
810 nfs_name_snoop_key_t *k;
811 k=g_mem_chunk_alloc(nfs_name_snoop_key_chunk);
812 k->key=pinfo->fd->num;
813 k->fh_length=nns->fh_length;
815 g_hash_table_insert(nfs_name_snoop_known, k, nns);
817 if(nfs_file_name_full_snooping){
818 unsigned char *name=NULL, *pos=NULL;
821 nfs_full_name_snoop(nns, &len, &name, &pos);
824 nns->full_name_len=len;
830 /* see if we know this mapping */
832 key.key=pinfo->fd->num;
833 key.fh_length=fh_length;
834 key.fh=(const unsigned char *)tvb_get_ptr(tvb, fh_offset, fh_length);
836 nns=g_hash_table_lookup(nfs_name_snoop_known, &key);
839 /* if we know the mapping, print the filename */
842 proto_tree_add_string_hidden(tree, hf_nfs_name, tvb,
843 fh_offset, 0, nns->name);
845 proto_tree_add_string_format(tree, hf_nfs_name, tvb,
846 fh_offset, 0, nns->name, "Name: %s", nns->name);
850 proto_tree_add_string_hidden(tree, hf_nfs_full_name, tvb,
851 fh_offset, 0, nns->name);
853 proto_tree_add_string_format(tree, hf_nfs_full_name, tvb,
854 fh_offset, 0, nns->name, "Full Name: %s", nns->full_name);
860 /* file handle dissection */
862 #define FHT_UNKNOWN 0
864 #define FHT_LINUX_KNFSD_LE 2
865 #define FHT_LINUX_NFSD_LE 3
866 #define FHT_LINUX_KNFSD_NEW 4
868 static const value_string names_fhtype[] =
870 { FHT_UNKNOWN, "unknown" },
871 { FHT_SVR4, "System V R4" },
872 { FHT_LINUX_KNFSD_LE, "Linux knfsd (little-endian)" },
873 { FHT_LINUX_NFSD_LE, "Linux user-land nfsd (little-endian)" },
874 { FHT_LINUX_KNFSD_NEW, "Linux knfsd (new)" },
879 /* SVR4: checked with ReliantUNIX (5.43, 5.44, 5.45) */
882 dissect_fhandle_data_SVR4(tvbuff_t* tvb, int offset, proto_tree *tree,
885 guint32 nof = offset;
897 temp = tvb_get_ntohl(tvb, fsid_O);
898 fsid_major = ( temp>>18 ) & 0x3fff; /* 14 bits */
899 fsid_minor = ( temp ) & 0x3ffff; /* 18 bits */
901 proto_item* fsid_item = NULL;
902 proto_tree* fsid_tree = NULL;
904 fsid_item = proto_tree_add_text(tree, tvb,
906 "file system ID: %d,%d", fsid_major, fsid_minor);
908 fsid_tree = proto_item_add_subtree(fsid_item,
910 proto_tree_add_uint(fsid_tree, hf_nfs_fh_fsid_major,
911 tvb, fsid_O, 2, fsid_major);
912 proto_tree_add_uint(fsid_tree, hf_nfs_fh_fsid_minor,
913 tvb, fsid_O+1, 3, fsid_minor);
916 nof = fsid_O + fsid_L;
919 /* file system type */
927 fstype = tvb_get_ntohl(tvb, fstype_O);
929 proto_tree_add_uint(tree, hf_nfs_fh_fstype, tvb,
930 fstype_O, fstype_L, fstype);
932 nof = fstype_O + fstype_L;
942 guint32 fn_data_inode_O;
943 guint32 fn_data_inode_L;
945 guint32 fn_data_gen_O;
946 guint32 fn_data_gen_L;
953 fn_len = tvb_get_ntohs(tvb, fn_len_O);
954 fn_data_O = fn_O + fn_len_L;
955 fn_data_inode_O = fn_data_O + 2;
957 inode = tvb_get_ntohl(tvb, fn_data_inode_O);
958 fn_data_gen_O = fn_data_inode_O + fn_data_inode_L;
960 gen = tvb_get_ntohl(tvb, fn_data_gen_O);
961 fn_L = fn_len_L + fn_len;
963 proto_item* fn_item = NULL;
964 proto_tree* fn_tree = NULL;
966 fn_item = proto_tree_add_uint(tree, hf_nfs_fh_fn, tvb,
969 fn_tree = proto_item_add_subtree(fn_item,
971 proto_tree_add_uint(fn_tree, hf_nfs_fh_fn_len,
972 tvb, fn_len_O, fn_len_L, fn_len);
973 proto_tree_add_uint(fn_tree, hf_nfs_fh_fn_inode,
974 tvb, fn_data_inode_O, fn_data_inode_L, inode);
975 proto_tree_add_uint(fn_tree, hf_nfs_fh_fn_generation,
976 tvb, fn_data_gen_O, fn_data_gen_L, gen);
979 nof = fn_O + fn_len_L + fn_len;
982 /* exported file number */
989 guint32 xfn_data_inode_O;
990 guint32 xfn_data_inode_L;
992 guint32 xfn_data_gen_O;
993 guint32 xfn_data_gen_L;
1000 xfn_len = tvb_get_ntohs(tvb, xfn_len_O);
1001 xfn_data_O = xfn_O + xfn_len_L;
1002 xfn_data_inode_O = xfn_data_O + 2;
1003 xfn_data_inode_L = 4;
1004 xinode = tvb_get_ntohl(tvb, xfn_data_inode_O);
1005 xfn_data_gen_O = xfn_data_inode_O + xfn_data_inode_L;
1007 xgen = tvb_get_ntohl(tvb, xfn_data_gen_O);
1008 xfn_L = xfn_len_L + xfn_len;
1010 proto_item* xfn_item = NULL;
1011 proto_tree* xfn_tree = NULL;
1013 xfn_item = proto_tree_add_uint(tree, hf_nfs_fh_xfn, tvb,
1014 xfn_O, xfn_L, xinode);
1016 xfn_tree = proto_item_add_subtree(xfn_item,
1018 proto_tree_add_uint(xfn_tree, hf_nfs_fh_xfn_len,
1019 tvb, xfn_len_O, xfn_len_L, xfn_len);
1020 proto_tree_add_uint(xfn_tree, hf_nfs_fh_xfn_inode,
1021 tvb, xfn_data_inode_O, xfn_data_inode_L, xinode);
1022 proto_tree_add_uint(xfn_tree, hf_nfs_fh_xfn_generation,
1023 tvb, xfn_data_gen_O, xfn_data_gen_L, xgen);
1030 /* Checked with RedHat Linux 6.2 (kernel 2.2.14 knfsd) */
1033 dissect_fhandle_data_LINUX_KNFSD_LE(tvbuff_t* tvb, int offset, proto_tree *tree,
1042 guint32 xfsid_major;
1043 guint32 xfsid_minor;
1047 dentry = tvb_get_letohl(tvb, offset+0);
1048 inode = tvb_get_letohl(tvb, offset+4);
1049 dirinode = tvb_get_letohl(tvb, offset+8);
1050 temp = tvb_get_letohs (tvb,offset+12);
1051 fsid_major = (temp >> 8) & 0xff;
1052 fsid_minor = (temp ) & 0xff;
1053 temp = tvb_get_letohs(tvb,offset+16);
1054 xfsid_major = (temp >> 8) & 0xff;
1055 xfsid_minor = (temp ) & 0xff;
1056 xinode = tvb_get_letohl(tvb,offset+20);
1057 gen = tvb_get_letohl(tvb,offset+24);
1060 proto_tree_add_uint(tree, hf_nfs_fh_dentry,
1061 tvb, offset+0, 4, dentry);
1062 proto_tree_add_uint(tree, hf_nfs_fh_fn_inode,
1063 tvb, offset+4, 4, inode);
1064 proto_tree_add_uint(tree, hf_nfs_fh_dirinode,
1065 tvb, offset+8, 4, dirinode);
1067 /* file system id (device) */
1069 proto_item* fsid_item = NULL;
1070 proto_tree* fsid_tree = NULL;
1072 fsid_item = proto_tree_add_text(tree, tvb,
1074 "file system ID: %d,%d", fsid_major, fsid_minor);
1076 fsid_tree = proto_item_add_subtree(fsid_item,
1078 proto_tree_add_uint(fsid_tree, hf_nfs_fh_fsid_major,
1079 tvb, offset+13, 1, fsid_major);
1080 proto_tree_add_uint(fsid_tree, hf_nfs_fh_fsid_minor,
1081 tvb, offset+12, 1, fsid_minor);
1085 /* exported file system id (device) */
1087 proto_item* xfsid_item = NULL;
1088 proto_tree* xfsid_tree = NULL;
1090 xfsid_item = proto_tree_add_text(tree, tvb,
1092 "exported file system ID: %d,%d", xfsid_major, xfsid_minor);
1094 xfsid_tree = proto_item_add_subtree(xfsid_item,
1096 proto_tree_add_uint(xfsid_tree, hf_nfs_fh_xfsid_major,
1097 tvb, offset+17, 1, xfsid_major);
1098 proto_tree_add_uint(xfsid_tree, hf_nfs_fh_xfsid_minor,
1099 tvb, offset+16, 1, xfsid_minor);
1103 proto_tree_add_uint(tree, hf_nfs_fh_xfn_inode,
1104 tvb, offset+20, 4, xinode);
1105 proto_tree_add_uint(tree, hf_nfs_fh_fn_generation,
1106 tvb, offset+24, 4, gen);
1111 /* Checked with RedHat Linux 5.2 (nfs-server 2.2beta47 user-land nfsd) */
1114 dissect_fhandle_data_LINUX_NFSD_LE(tvbuff_t* tvb, int offset, proto_tree *tree,
1120 pinode = tvb_get_letohl(tvb, offset+0);
1122 proto_tree_add_uint(tree, hf_nfs_fh_pinode,
1123 tvb, offset+0, 4, pinode);
1131 hashlen = tvb_get_guint8(tvb, offset+4);
1133 proto_item* hash_item = NULL;
1134 proto_tree* hash_tree = NULL;
1136 hash_item = proto_tree_add_text(tree, tvb, offset+4,
1139 tvb_bytes_to_str(tvb,offset+5,hashlen));
1141 hash_tree = proto_item_add_subtree(hash_item,
1144 proto_tree_add_uint(hash_tree,
1145 hf_nfs_fh_hp_len, tvb, offset+4, 1,
1147 proto_tree_add_text(hash_tree, tvb, offset+5,
1150 tvb_bytes_to_str(tvb,offset+5,hashlen));
1158 /* Checked with SuSE 7.1 (kernel 2.4.0 knfsd) */
1159 /* read linux-2.4.5/include/linux/nfsd/nfsfh.h for more details */
1161 #define AUTH_TYPE_NONE 0
1162 static const value_string auth_type_names[] = {
1163 { AUTH_TYPE_NONE, "no authentication" },
1167 #define FSID_TYPE_MAJOR_MINOR_INODE 0
1168 static const value_string fsid_type_names[] = {
1169 { FSID_TYPE_MAJOR_MINOR_INODE, "major/minor/inode" },
1173 #define FILEID_TYPE_ROOT 0
1174 #define FILEID_TYPE_INODE_GENERATION 1
1175 #define FILEID_TYPE_INODE_GENERATION_PARENT 2
1176 static const value_string fileid_type_names[] = {
1177 { FILEID_TYPE_ROOT, "root" },
1178 { FILEID_TYPE_INODE_GENERATION, "inode/generation" },
1179 { FILEID_TYPE_INODE_GENERATION_PARENT, "inode/generation/parent" },
1184 dissect_fhandle_data_LINUX_KNFSD_NEW(tvbuff_t* tvb, int offset, proto_tree *tree,
1192 version = tvb_get_guint8(tvb, offset + 0);
1194 proto_tree_add_uint(tree, hf_nfs_fh_version,
1195 tvb, offset+0, 1, version);
1200 auth_type = tvb_get_guint8(tvb, offset + 1);
1201 fsid_type = tvb_get_guint8(tvb, offset + 2);
1202 fileid_type = tvb_get_guint8(tvb, offset + 3);
1204 proto_item* encoding_item = proto_tree_add_text(tree, tvb,
1206 "encoding: %u %u %u",
1207 auth_type, fsid_type, fileid_type);
1208 if (encoding_item) {
1209 proto_tree* encoding_tree = proto_item_add_subtree(encoding_item,
1210 ett_nfs_fh_encoding);
1211 if (encoding_tree) {
1212 proto_tree_add_uint(encoding_tree, hf_nfs_fh_auth_type,
1213 tvb, offset+1, 1, auth_type);
1214 proto_tree_add_uint(encoding_tree, hf_nfs_fh_fsid_type,
1215 tvb, offset+2, 1, fsid_type);
1216 proto_tree_add_uint(encoding_tree, hf_nfs_fh_fileid_type,
1217 tvb, offset+3, 1, fileid_type);
1224 /* unknown version */
1229 switch (auth_type) {
1231 /* no authentication */
1233 proto_tree_add_text(tree, tvb,
1235 "authentication: none");
1239 /* unknown authentication type */
1244 switch (fsid_type) {
1250 fsid_major = tvb_get_ntohs(tvb, offset + 0);
1251 fsid_minor = tvb_get_ntohs(tvb, offset + 2);
1252 fsid_inode = tvb_get_letohl(tvb, offset + 4);
1254 proto_item* fsid_item = proto_tree_add_text(tree, tvb,
1256 "file system ID: %u,%u (inode %u)",
1257 fsid_major, fsid_minor, fsid_inode);
1259 proto_tree* fsid_tree = proto_item_add_subtree(fsid_item,
1262 proto_tree_add_uint(fsid_tree, hf_nfs_fh_fsid_major,
1263 tvb, offset+0, 2, fsid_major);
1264 proto_tree_add_uint(fsid_tree, hf_nfs_fh_fsid_minor,
1265 tvb, offset+2, 2, fsid_minor);
1266 proto_tree_add_uint(fsid_tree, hf_nfs_fh_fsid_inode,
1267 tvb, offset+4, 4, fsid_inode);
1274 /* unknown fsid type */
1279 switch (fileid_type) {
1282 proto_tree_add_text(tree, tvb,
1284 "file ID: root inode");
1291 inode = tvb_get_letohl(tvb, offset + 0);
1292 generation = tvb_get_letohl(tvb, offset + 4);
1295 proto_item* fileid_item = proto_tree_add_text(tree, tvb,
1300 proto_tree* fileid_tree = proto_item_add_subtree(
1301 fileid_item, ett_nfs_fh_fn);
1303 proto_tree_add_uint(fileid_tree, hf_nfs_fh_fn_inode,
1304 tvb, offset+0, 4, inode);
1305 proto_tree_add_uint(fileid_tree, hf_nfs_fh_fn_generation,
1306 tvb, offset+4, 4, generation);
1316 guint32 parent_inode;
1318 inode = tvb_get_letohl(tvb, offset + 0);
1319 generation = tvb_get_letohl(tvb, offset + 4);
1320 parent_inode = tvb_get_letohl(tvb, offset + 8);
1323 proto_item* fileid_item = proto_tree_add_text(tree, tvb,
1328 proto_tree* fileid_tree = proto_item_add_subtree(
1329 fileid_item, ett_nfs_fh_fn);
1331 proto_tree_add_uint(fileid_tree, hf_nfs_fh_fn_inode,
1332 tvb, offset+0, 4, inode);
1333 proto_tree_add_uint(fileid_tree, hf_nfs_fh_fn_generation,
1334 tvb, offset+4, 4, generation);
1335 proto_tree_add_uint(fileid_tree, hf_nfs_fh_dirinode,
1336 tvb, offset+8, 4, parent_inode);
1344 /* unknown fileid type */
1355 dissect_fhandle_data_unknown(tvbuff_t *tvb, int offset, proto_tree *tree,
1360 gboolean first_line;
1364 while (bytes_left != 0) {
1366 if (sublen > bytes_left)
1367 sublen = bytes_left;
1368 proto_tree_add_text(tree, tvb, offset, sublen,
1370 first_line ? "data: " :
1372 tvb_bytes_to_str(tvb,offset,sublen));
1373 bytes_left -= sublen;
1381 dissect_fhandle_data(tvbuff_t *tvb, int offset, packet_info *pinfo,
1382 proto_tree *tree, unsigned int fhlen, gboolean hidden)
1384 unsigned int fhtype = FHT_UNKNOWN;
1386 /* filehandle too long */
1387 if (fhlen>64) goto type_ready;
1388 /* Not all bytes there. Any attempt to deduce the type would be
1390 if (!tvb_bytes_exist(tvb,offset,fhlen)) goto type_ready;
1392 /* this is to set up fhandle display filters to find both packets
1394 if(nfs_fhandle_reqrep_matching && (!hidden) ){
1395 nfs_fhandle_data_t *old_fhd=NULL;
1398 if( !pinfo->fd->flags.visited ){
1399 nfs_fhandle_data_t fhd;
1401 /* first check if we have seen this fhandle before */
1403 fhd.fh=(const unsigned char *)tvb_get_ptr(tvb, offset, fhlen);
1404 old_fhd=g_hash_table_lookup(nfs_fhandle_data_table,
1405 (gconstpointer)&fhd);
1407 /* oh, a new fhandle, alloc struct and store it in the table*/
1408 old_fhd=g_mem_chunk_alloc(nfs_fhandle_data_chunk);
1411 memcpy(fh, fhd.fh, fhlen);
1413 old_fhd->tvb=tvb_new_real_data(old_fhd->fh, old_fhd->len, old_fhd->len);
1414 g_hash_table_insert(nfs_fhandle_data_table,
1415 (gpointer)old_fhd, (gpointer)old_fhd);
1418 /* XXX here we should really check that we havent stored
1419 this fhandle for this frame number already.
1420 We should also make sure we can handle when we have multiple
1421 fhandles seen for the same frame, which WILL happen for certain
1422 nfs calls. For now, we dont handle this and those calls will
1423 not work properly with this feature
1425 g_hash_table_insert(nfs_fhandle_frame_table,
1426 (gpointer)pinfo->fd->num,
1431 /* create a semiunique hash value for the filehandle */
1436 for(fhhash=0,i=0;i<(fhlen-3);i+=4){
1438 val = tvb_get_ntohl(tvb, offset+i);
1443 proto_tree_add_uint_hidden(tree, hf_nfs_fh_hash, tvb, offset,
1446 proto_tree_add_uint(tree, hf_nfs_fh_hash, tvb, offset,
1450 if(nfs_file_name_snooping){
1451 nfs_name_snoop_fh(pinfo, tree, tvb, offset, fhlen, hidden);
1455 /* calculate (heuristically) fhtype */
1458 if (tvb_get_ntohl(tvb,offset) == 0x01000000) {
1459 fhtype=FHT_LINUX_KNFSD_NEW;
1463 if (tvb_get_ntohl(tvb,offset) == 0x01000001) {
1464 fhtype=FHT_LINUX_KNFSD_NEW;
1468 if (tvb_get_ntohl(tvb,offset) == 0x01000002) {
1469 fhtype=FHT_LINUX_KNFSD_NEW;
1475 if (tvb_get_ntohs(tvb,offset+4) == 0) {
1476 len1=tvb_get_ntohs(tvb,offset+8);
1477 if (tvb_bytes_exist(tvb,offset+10+len1,2)) {
1478 len2=tvb_get_ntohs(tvb,
1480 if (fhlen==12+len1+len2) {
1486 len1 = tvb_get_guint8(tvb,offset+4);
1487 if (len1<28 && tvb_bytes_exist(tvb,offset+5,len1)) {
1489 for (len2=5+len1;len2<32;len2++) {
1490 if (tvb_get_guint8(tvb,offset+len2)) {
1496 fhtype=FHT_LINUX_NFSD_LE;
1500 if (tvb_get_ntohl(tvb,offset+28) == 0) {
1501 if (tvb_get_ntohs(tvb,offset+14) == 0) {
1502 if (tvb_get_ntohs(tvb,offset+18) == 0) {
1503 fhtype=FHT_LINUX_KNFSD_LE;
1515 proto_tree_add_text(tree, tvb, offset, 0,
1516 "type: %s", val_to_str(fhtype, names_fhtype, "Unknown"));
1521 dissect_fhandle_data_SVR4 (tvb, offset, tree,
1524 case FHT_LINUX_KNFSD_LE:
1525 dissect_fhandle_data_LINUX_KNFSD_LE(tvb, offset, tree,
1528 case FHT_LINUX_NFSD_LE:
1529 dissect_fhandle_data_LINUX_NFSD_LE (tvb, offset, tree,
1532 case FHT_LINUX_KNFSD_NEW:
1533 dissect_fhandle_data_LINUX_KNFSD_NEW (tvb, offset, tree,
1538 dissect_fhandle_data_unknown(tvb, offset, tree, fhlen);
1545 dissect_fhandle_hidden(packet_info *pinfo, proto_tree *tree, nfs_fhandle_data_t *nfd)
1547 if(nfd && nfd->len){
1548 dissect_fhandle_data(nfd->tvb, 0, pinfo, tree, nfd->len, TRUE);
1553 /***************************/
1554 /* NFS Version 2, RFC 1094 */
1555 /***************************/
1558 /* RFC 1094, Page 12..14 */
1559 static const value_string names_nfs_stat[] =
1566 { 13, "ERR_ACCES" },
1567 { 17, "ERR_EXIST" },
1568 { 18, "ERR_XDEV" }, /* not in spec, but can happen */
1569 { 19, "ERR_NODEV" },
1570 { 20, "ERR_NOTDIR" },
1571 { 21, "ERR_ISDIR" },
1572 { 22, "ERR_INVAL" }, /* not in spec, but I think it can happen */
1573 { 26, "ERR_TXTBSY" }, /* not in spec, but I think it can happen */
1575 { 28, "ERR_NOSPC" },
1577 { 31, "ERR_MLINK" }, /* not in spec, but can happen */
1578 { 45, "ERR_OPNOTSUPP" }, /* not in spec, but I think it can happen */
1579 { 63, "ERR_NAMETOOLONG" },
1580 { 66, "ERR_NOTEMPTY" },
1581 { 69, "ERR_DQUOT" },
1582 { 70, "ERR_STALE" },
1583 { 99, "ERR_WFLUSH" },
1587 /* NFSv4 Draft Specification, Page 198-199 */
1588 static const value_string names_nfs_stat4[] = {
1590 { 1, "NFS4ERR_PERM" },
1591 { 2, "NFS4ERR_NOENT" },
1592 { 5, "NFS4ERR_IO" },
1593 { 6, "NFS4ERR_NXIO" },
1594 { 13, "NFS4ERR_ACCES" },
1595 { 17, "NFS4ERR_EXIST" },
1596 { 18, "NFS4ERR_XDEV" },
1597 { 19, "NFS4ERR_NODEV" },
1598 { 20, "NFS4ERR_NOTDIR" },
1599 { 21, "NFS4ERR_ISDIR" },
1600 { 22, "NFS4ERR_INVAL" },
1601 { 27, "NFS4ERR_FBIG" },
1602 { 28, "NFS4ERR_NOSPC" },
1603 { 30, "NFS4ERR_ROFS" },
1604 { 31, "NFS4ERR_MLINK" },
1605 { 63, "NFS4ERR_NAMETOOLONG" },
1606 { 66, "NFS4ERR_NOTEMPTY" },
1607 { 69, "NFS4ERR_DQUOT" },
1608 { 70, "NFS4ERR_STALE" },
1609 { 10001, "NFS4ERR_BADHANDLE" },
1610 { 10003, "NFS4ERR_BAD_COOKIE" },
1611 { 10004, "NFS4ERR_NOTSUPP" },
1612 { 10005, "NFS4ERR_TOOSMALL" },
1613 { 10006, "NFS4ERR_SERVERFAULT" },
1614 { 10007, "NFS4ERR_BADTYPE" },
1615 { 10008, "NFS4ERR_DELAY" },
1616 { 10009, "NFS4ERR_SAME" },
1617 { 10010, "NFS4ERR_DENIED" },
1618 { 10011, "NFS4ERR_EXPIRED" },
1619 { 10012, "NFS4ERR_LOCKED" },
1620 { 10013, "NFS4ERR_GRACE" },
1621 { 10014, "NFS4ERR_FHEXPIRED" },
1622 { 10015, "NFS4ERR_SHARE_DENIED" },
1623 { 10016, "NFS4ERR_WRONGSEC" },
1624 { 10017, "NFS4ERR_CLID_INUSE" },
1625 { 10018, "NFS4ERR_RESOURCE" },
1626 { 10019, "NFS4ERR_MOVED" },
1627 { 10020, "NFS4ERR_NOFILEHANDLE" },
1628 { 10021, "NFS4ERR_MINOR_VERS_MISMATCH" },
1629 { 10022, "NFS4ERR_STALE_CLIENTID" },
1630 { 10023, "NFS4ERR_STALE_STATEID" },
1631 { 10024, "NFS4ERR_OLD_STATEID" },
1632 { 10025, "NFS4ERR_BAD_STATEID" },
1633 { 10026, "NFS4ERR_BAD_SEQID" },
1634 { 10027, "NFS4ERR_NOT_SAME" },
1635 { 10028, "NFS4ERR_LOCK_RANGE" },
1636 { 10029, "NFS4ERR_SYMLINK" },
1637 { 10030, "NFS4ERR_READDIR_NOSPC" },
1638 { 10031, "NFS4ERR_LEASE_MOVED" },
1639 { 10032, "NFS4ERR_ATTRNOTSUPP" },
1640 { 10033, "NFS4ERR_NO_GRACE" },
1641 { 10034, "NFS4ERR_RECLAIM_BAD" },
1642 { 10035, "NFS4ERR_RECLAIM_CONFLICT" },
1643 { 10036, "NFS4ERR_BADXDR" },
1644 { 10037, "NFS4ERR_LOCKS_HELD" },
1645 { 10038, "NFS4ERR_OPENMODE" },
1646 { 10039, "NFS4ERR_BADOWNER" },
1647 { 10040, "NFS4ERR_BADCHAR" },
1648 { 10041, "NFS4ERR_BADNAME" },
1649 { 10042, "NFS4ERR_BAD_RANGE" },
1650 { 10043, "NFS4ERR_LOCK_NOTSUPP" },
1651 { 10044, "NFS4ERR_OP_ILLEGAL" },
1652 { 10045, "NFS4ERR_DEADLOCK" },
1653 { 10046, "NFS4ERR_FILE_OPEN" },
1654 { 10047, "NFS4ERR_ADMIN_REVOKED" },
1655 { 10048, "NFS4ERR_CB_PATH_DOWN" },
1660 /* This function has been modified to support NFSv4 style error codes as
1661 * well as being backwards compatible with NFSv2 and NFSv3.
1664 dissect_stat_internal(tvbuff_t *tvb, int offset,
1665 proto_tree *tree, guint32* status, int nfsvers)
1669 stat = tvb_get_ntohl(tvb, offset+0);
1672 /* this gives the right NFSv2 number<->message relation */
1673 /* and makes it searchable via "nfs.status" */
1674 proto_tree_add_uint_format(tree, hf_nfs_nfsstat3, tvb,
1675 offset+0, 4, stat, "Status: %s (%u)",
1677 (nfsvers != 4)? names_nfs_stat: names_nfs_stat4,"%u"), stat);
1682 if (status) *status = stat;
1688 /* RFC 1094, Page 12..14 */
1690 dissect_stat(tvbuff_t *tvb, int offset, proto_tree *tree,
1693 return dissect_stat_internal(tvb, offset, tree, status, !4);
1697 /* RFC 1094, Page 12..14 */
1699 dissect_nfs2_stat_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree* tree)
1703 offset = dissect_stat(tvb, offset, tree, &status);
1710 dissect_nfs_nfsstat4(tvbuff_t *tvb, int offset,
1711 proto_tree *tree, guint32 *status)
1713 return dissect_stat_internal(tvb, offset, tree, status, 4);
1717 /* RFC 1094, Page 15 */
1719 dissect_ftype(tvbuff_t *tvb, int offset, proto_tree *tree, char* name)
1722 char* ftype_name = NULL;
1724 const value_string nfs2_ftype[] =
1727 { 1, "Regular File" },
1729 { 3, "Block Special Device" },
1730 { 4, "Character Special Device" },
1731 { 5, "Symbolic Link" },
1735 ftype = tvb_get_ntohl(tvb, offset+0);
1736 ftype_name = val_to_str(ftype, nfs2_ftype, "%u");
1739 proto_tree_add_text(tree, tvb, offset, 4,
1740 "%s: %s (%u)", name, ftype_name, ftype);
1748 /* RFC 1094, Page 15 */
1750 dissect_fhandle(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree,
1754 proto_tree* ftree = NULL;
1757 fitem = proto_tree_add_text(tree, tvb, offset, FHSIZE,
1760 ftree = proto_item_add_subtree(fitem, ett_nfs_fhandle);
1763 /* are we snooping fh to filenames ?*/
1764 if((!pinfo->fd->flags.visited) && nfs_file_name_snooping){
1765 rpc_call_info_value *civ=pinfo->private_data;
1767 /* NFS v2 LOOKUP, CREATE, MKDIR calls might give us a mapping*/
1768 if( (civ->prog==100003)
1771 &&((civ->proc==4)||(civ->proc==9)||(civ->proc==14))
1773 nfs_name_snoop_add_fh(civ->xid, tvb,
1777 /* MOUNT v1,v2 MNT replies might give us a filehandle*/
1778 if( (civ->prog==100005)
1780 &&((civ->vers==1)||(civ->vers==2))
1783 nfs_name_snoop_add_fh(civ->xid, tvb,
1788 dissect_fhandle_data(tvb, offset, pinfo, ftree, FHSIZE, FALSE);
1794 /* RFC 1094, Page 15 */
1796 dissect_nfs2_fhandle_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
1798 offset = dissect_fhandle(tvb, offset, pinfo, tree, "object");
1804 /* RFC 1094, Page 15 */
1806 dissect_timeval(tvbuff_t *tvb, int offset, proto_tree *tree, int hf_time, int hf_time_sec, int hf_time_usec)
1812 proto_item* time_item;
1813 proto_tree* time_tree = NULL;
1815 seconds = tvb_get_ntohl(tvb, offset+0);
1816 useconds = tvb_get_ntohl(tvb, offset+4);
1818 ts.nsecs = useconds*1000;
1821 time_item = proto_tree_add_time(tree, hf_time, tvb, offset, 8,
1824 time_tree = proto_item_add_subtree(time_item, ett_nfs_timeval);
1828 proto_tree_add_uint(time_tree, hf_time_sec, tvb, offset, 4,
1830 proto_tree_add_uint(time_tree, hf_time_usec, tvb, offset+4, 4,
1838 /* RFC 1094, Page 16 */
1839 static const value_string nfs2_mode_names[] = {
1840 { 0040000, "Directory" },
1841 { 0020000, "Character Special Device" },
1842 { 0060000, "Block Special Device" },
1843 { 0100000, "Regular File" },
1844 { 0120000, "Symbolic Link" },
1845 { 0140000, "Named Socket" },
1850 dissect_mode(tvbuff_t *tvb, int offset, proto_tree *tree, char* name)
1853 proto_item* mode_item = NULL;
1854 proto_tree* mode_tree = NULL;
1856 mode = tvb_get_ntohl(tvb, offset+0);
1859 mode_item = proto_tree_add_text(tree, tvb, offset, 4,
1860 "%s: 0%o", name, mode);
1862 mode_tree = proto_item_add_subtree(mode_item, ett_nfs_mode);
1866 proto_tree_add_text(mode_tree, tvb, offset, 4, "%s",
1867 decode_enumerated_bitfield(mode, 0160000, 16,
1868 nfs2_mode_names, "%s"));
1869 proto_tree_add_text(mode_tree, tvb, offset, 4, "%s",
1870 decode_boolean_bitfield(mode, 04000, 16, "Set user id on exec", "not SUID"));
1871 proto_tree_add_text(mode_tree, tvb, offset, 4, "%s",
1872 decode_boolean_bitfield(mode, 02000, 16, "Set group id on exec", "not SGID"));
1873 proto_tree_add_text(mode_tree, tvb, offset, 4, "%s",
1874 decode_boolean_bitfield(mode, 01000, 16, "Save swapped text even after use", "not save swapped text"));
1875 proto_tree_add_text(mode_tree, tvb, offset, 4, "%s",
1876 decode_boolean_bitfield(mode, 0400, 16, "Read permission for owner", "no Read permission for owner"));
1877 proto_tree_add_text(mode_tree, tvb, offset, 4, "%s",
1878 decode_boolean_bitfield(mode, 0200, 16, "Write permission for owner", "no Write permission for owner"));
1879 proto_tree_add_text(mode_tree, tvb, offset, 4, "%s",
1880 decode_boolean_bitfield(mode, 0100, 16, "Execute permission for owner", "no Execute permission for owner"));
1881 proto_tree_add_text(mode_tree, tvb, offset, 4, "%s",
1882 decode_boolean_bitfield(mode, 040, 16, "Read permission for group", "no Read permission for group"));
1883 proto_tree_add_text(mode_tree, tvb, offset, 4, "%s",
1884 decode_boolean_bitfield(mode, 020, 16, "Write permission for group", "no Write permission for group"));
1885 proto_tree_add_text(mode_tree, tvb, offset, 4, "%s",
1886 decode_boolean_bitfield(mode, 010, 16, "Execute permission for group", "no Execute permission for group"));
1887 proto_tree_add_text(mode_tree, tvb, offset, 4, "%s",
1888 decode_boolean_bitfield(mode, 04, 16, "Read permission for others", "no Read permission for others"));
1889 proto_tree_add_text(mode_tree, tvb, offset, 4, "%s",
1890 decode_boolean_bitfield(mode, 02, 16, "Write permission for others", "no Write permission for others"));
1891 proto_tree_add_text(mode_tree, tvb, offset, 4, "%s",
1892 decode_boolean_bitfield(mode, 01, 16, "Execute permission for others", "no Execute permission for others"));
1900 /* RFC 1094, Page 15 */
1902 dissect_fattr(tvbuff_t *tvb, int offset, proto_tree *tree, char* name)
1904 proto_item* fattr_item = NULL;
1905 proto_tree* fattr_tree = NULL;
1906 int old_offset = offset;
1909 fattr_item = proto_tree_add_text(tree, tvb, offset, -1,
1911 fattr_tree = proto_item_add_subtree(fattr_item, ett_nfs_fattr);
1914 offset = dissect_ftype(tvb, offset, fattr_tree, "type");
1915 offset = dissect_mode(tvb, offset, fattr_tree, "mode");
1916 offset = dissect_rpc_uint32(tvb, fattr_tree, hf_nfs_fattr_nlink, offset);
1917 offset = dissect_rpc_uint32(tvb, fattr_tree, hf_nfs_fattr_uid, offset);
1918 offset = dissect_rpc_uint32(tvb, fattr_tree, hf_nfs_fattr_gid, offset);
1919 offset = dissect_rpc_uint32(tvb, fattr_tree, hf_nfs_fattr_size, offset);
1920 offset = dissect_rpc_uint32(tvb, fattr_tree, hf_nfs_fattr_blocksize, offset);
1921 offset = dissect_rpc_uint32(tvb, fattr_tree, hf_nfs_fattr_rdev, offset);
1922 offset = dissect_rpc_uint32(tvb, fattr_tree, hf_nfs_fattr_blocks, offset);
1923 offset = dissect_rpc_uint32(tvb, fattr_tree, hf_nfs_fattr_fsid, offset);
1924 offset = dissect_rpc_uint32(tvb, fattr_tree, hf_nfs_fattr_fileid, offset);
1926 offset = dissect_timeval(tvb, offset, fattr_tree, hf_nfs_atime, hf_nfs_atime_sec, hf_nfs_atime_usec);
1927 offset = dissect_timeval(tvb, offset, fattr_tree, hf_nfs_mtime, hf_nfs_mtime_sec, hf_nfs_mtime_usec);
1928 offset = dissect_timeval(tvb, offset, fattr_tree, hf_nfs_ctime, hf_nfs_ctime_sec, hf_nfs_ctime_usec);
1930 /* now we know, that fattr is shorter */
1932 proto_item_set_len(fattr_item, offset - old_offset);
1939 /* RFC 1094, Page 17 */
1941 dissect_sattr(tvbuff_t *tvb, int offset, proto_tree *tree, char* name)
1943 proto_item* sattr_item = NULL;
1944 proto_tree* sattr_tree = NULL;
1945 int old_offset = offset;
1948 sattr_item = proto_tree_add_text(tree, tvb, offset, -1,
1950 sattr_tree = proto_item_add_subtree(sattr_item, ett_nfs_sattr);
1953 if (tvb_get_ntohl(tvb, offset+0) != 0xffffffff)
1954 offset = dissect_mode(tvb, offset, sattr_tree, "mode");
1956 proto_tree_add_text(sattr_tree, tvb, offset, 4, "mode: no value");
1960 if (tvb_get_ntohl(tvb, offset+0) != 0xffffffff)
1961 offset = dissect_rpc_uint32(tvb, sattr_tree, hf_nfs_fattr_uid,
1964 proto_tree_add_text(sattr_tree, tvb, offset, 4, "uid: no value");
1968 if (tvb_get_ntohl(tvb, offset+0) != 0xffffffff)
1969 offset = dissect_rpc_uint32(tvb, sattr_tree, hf_nfs_fattr_gid,
1972 proto_tree_add_text(sattr_tree, tvb, offset, 4, "gid: no value");
1976 if (tvb_get_ntohl(tvb, offset+0) != 0xffffffff)
1977 offset = dissect_rpc_uint32(tvb, sattr_tree, hf_nfs_fattr_size,
1980 proto_tree_add_text(sattr_tree, tvb, offset, 4, "size: no value");
1984 if (tvb_get_ntohl(tvb, offset+0) != 0xffffffff) {
1985 offset = dissect_timeval(tvb, offset, sattr_tree, hf_nfs_atime, hf_nfs_atime_sec, hf_nfs_atime_usec);
1987 proto_tree_add_text(sattr_tree, tvb, offset, 8, "atime: no value");
1991 if (tvb_get_ntohl(tvb, offset+0) != 0xffffffff) {
1992 offset = dissect_timeval(tvb, offset, sattr_tree, hf_nfs_mtime, hf_nfs_mtime_sec, hf_nfs_mtime_usec);
1994 proto_tree_add_text(sattr_tree, tvb, offset, 8, "mtime: no value");
1998 /* now we know, that sattr is shorter */
2000 proto_item_set_len(sattr_item, offset - old_offset);
2007 /* RFC 1094, Page 17 */
2009 dissect_filename(tvbuff_t *tvb, int offset,
2010 proto_tree *tree, int hf, char **string_ret)
2012 offset = dissect_rpc_string(tvb, tree, hf, offset, string_ret);
2017 /* RFC 1094, Page 17 */
2019 dissect_path(tvbuff_t *tvb, int offset, proto_tree *tree, int hf)
2021 offset = dissect_rpc_string(tvb, tree, hf, offset, NULL);
2026 /* RFC 1094, Page 17,18 */
2028 dissect_attrstat(tvbuff_t *tvb, int offset, proto_tree *tree)
2032 offset = dissect_stat(tvb, offset, tree, &status);
2035 offset = dissect_fattr(tvb, offset, tree, "attributes");
2046 /* RFC 1094, Page 17,18 */
2048 dissect_nfs2_attrstat_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree* tree)
2050 offset = dissect_attrstat(tvb, offset, tree);
2056 /* RFC 1094, Page 18 */
2058 dissect_diropargs(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, char* name)
2060 proto_item* diropargs_item = NULL;
2061 proto_tree* diropargs_tree = NULL;
2062 int old_offset = offset;
2065 diropargs_item = proto_tree_add_text(tree, tvb, offset, -1,
2067 diropargs_tree = proto_item_add_subtree(diropargs_item, ett_nfs_diropargs);
2070 /* are we snooping fh to filenames ?*/
2071 if((!pinfo->fd->flags.visited) && nfs_file_name_snooping){
2072 /* v2 LOOKUP, CREATE, MKDIR calls might give us a mapping*/
2073 rpc_call_info_value *civ=pinfo->private_data;
2075 if( (civ->prog==100003)
2078 &&((civ->proc==4)||(civ->proc==9)||(civ->proc==14))
2080 nfs_name_snoop_add_name(civ->xid, tvb,
2081 offset+36, tvb_get_ntohl(tvb, offset+32),
2086 offset = dissect_fhandle (tvb,offset,pinfo,diropargs_tree,"dir");
2087 offset = dissect_filename(tvb,offset, diropargs_tree,hf_nfs_name,NULL);
2089 /* now we know, that diropargs is shorter */
2090 if (diropargs_item) {
2091 proto_item_set_len(diropargs_item, offset - old_offset);
2098 /* RFC 1094, Page 18 */
2100 dissect_nfs2_diropargs_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
2102 offset = dissect_diropargs(tvb, offset, pinfo, tree, "where");
2108 /* RFC 1094, Page 18 */
2110 dissect_diropres(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
2114 offset = dissect_stat(tvb, offset, tree, &status);
2117 offset = dissect_fhandle(tvb, offset, pinfo, tree, "file");
2118 offset = dissect_fattr (tvb, offset, tree, "attributes");
2129 /* nfsdata is simply a chunk of RPC opaque data (length, data, fill bytes) */
2131 dissect_nfsdata(tvbuff_t *tvb, int offset, proto_tree *tree, int hf)
2133 offset = dissect_rpc_data(tvb, tree, hf, offset);
2138 /* RFC 1094, Page 18 */
2140 dissect_nfs2_diropres_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
2143 offset = dissect_diropres(tvb, offset, pinfo, tree);
2148 /* RFC 1094, Page 6 */
2150 dissect_nfs2_setattr_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
2153 offset = dissect_fhandle(tvb, offset, pinfo, tree, "file" );
2154 offset = dissect_sattr (tvb, offset, tree, "attributes");
2160 /* RFC 1094, Page 6 */
2162 dissect_nfs2_readlink_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
2167 offset = dissect_stat(tvb, offset, tree, &status);
2170 offset = dissect_path(tvb, offset, tree, hf_nfs_readlink_data);
2181 /* RFC 1094, Page 7 */
2183 dissect_nfs2_read_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
2186 guint32 offset_value;
2190 offset = dissect_fhandle(tvb, offset, pinfo, tree, "file" );
2191 offset_value = tvb_get_ntohl(tvb, offset+0);
2192 count = tvb_get_ntohl(tvb, offset+4);
2193 totalcount = tvb_get_ntohl(tvb, offset+8);
2195 proto_tree_add_uint(tree, hf_nfs_read_offset, tvb,
2196 offset+0, 4, offset_value);
2197 proto_tree_add_uint(tree, hf_nfs_read_count, tvb,
2198 offset+4, 4, count);
2199 proto_tree_add_uint(tree, hf_nfs_read_totalcount, tvb,
2200 offset+8, 4, totalcount);
2208 /* RFC 1094, Page 7 */
2210 dissect_nfs2_read_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
2215 offset = dissect_stat(tvb, offset, tree, &status);
2218 offset = dissect_fattr(tvb, offset, tree, "attributes");
2219 offset = dissect_nfsdata(tvb, offset, tree, hf_nfs_data);
2230 /* RFC 1094, Page 8 */
2232 dissect_nfs2_write_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
2235 guint32 beginoffset;
2236 guint32 offset_value;
2239 offset = dissect_fhandle(tvb, offset, pinfo, tree, "file" );
2240 beginoffset = tvb_get_ntohl(tvb, offset+0);
2241 offset_value = tvb_get_ntohl(tvb, offset+4);
2242 totalcount = tvb_get_ntohl(tvb, offset+8);
2244 proto_tree_add_uint(tree, hf_nfs_write_beginoffset, tvb,
2245 offset+0, 4, beginoffset);
2246 proto_tree_add_uint(tree, hf_nfs_write_offset, tvb,
2247 offset+4, 4, offset_value);
2248 proto_tree_add_uint(tree, hf_nfs_write_totalcount, tvb,
2249 offset+8, 4, totalcount);
2253 offset = dissect_nfsdata(tvb, offset, tree, hf_nfs_data);
2259 /* RFC 1094, Page 8 */
2261 dissect_nfs2_createargs_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
2264 offset = dissect_diropargs(tvb, offset, pinfo, tree, "where" );
2265 offset = dissect_sattr (tvb, offset, tree, "attributes");
2271 /* RFC 1094, Page 9 */
2273 dissect_nfs2_rename_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
2276 offset = dissect_diropargs(tvb, offset, pinfo, tree, "from");
2277 offset = dissect_diropargs(tvb, offset, pinfo, tree, "to" );
2283 /* RFC 1094, Page 9 */
2285 dissect_nfs2_link_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
2288 offset = dissect_fhandle (tvb, offset, pinfo, tree, "from");
2289 offset = dissect_diropargs(tvb, offset, pinfo, tree, "to" );
2295 /* RFC 1094, Page 10 */
2297 dissect_nfs2_symlink_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
2300 offset = dissect_diropargs(tvb, offset, pinfo, tree, "from" );
2301 offset = dissect_path (tvb, offset, tree, hf_nfs_symlink_to);
2302 offset = dissect_sattr (tvb, offset, tree, "attributes" );
2308 /* RFC 1094, Page 11 */
2310 dissect_nfs2_readdir_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
2316 offset = dissect_fhandle (tvb, offset, pinfo, tree, "dir");
2317 cookie = tvb_get_ntohl(tvb, offset+ 0);
2318 count = tvb_get_ntohl(tvb, offset+ 4);
2320 proto_tree_add_uint(tree, hf_nfs_readdir_cookie, tvb,
2321 offset+ 0, 4, cookie);
2322 proto_tree_add_uint(tree, hf_nfs_readdir_count, tvb,
2323 offset+ 4, 4, count);
2331 /* RFC 1094, Page 11 */
2333 dissect_readdir_entry(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
2336 proto_item* entry_item = NULL;
2337 proto_tree* entry_tree = NULL;
2338 int old_offset = offset;
2344 entry_item = proto_tree_add_item(tree, hf_nfs_readdir_entry, tvb,
2345 offset+0, -1, FALSE);
2346 entry_tree = proto_item_add_subtree(entry_item, ett_nfs_readdir_entry);
2349 fileid = tvb_get_ntohl(tvb, offset + 0);
2351 proto_tree_add_uint(entry_tree, hf_nfs_readdir_entry_fileid, tvb,
2352 offset+0, 4, fileid);
2355 offset = dissect_filename(tvb, offset, entry_tree,
2356 hf_nfs_readdir_entry_name, &name);
2358 proto_item_set_text(entry_item, "Entry: file ID %u, name %s",
2362 cookie = tvb_get_ntohl(tvb, offset + 0);
2364 proto_tree_add_uint(entry_tree, hf_nfs_readdir_entry_cookie, tvb,
2365 offset+0, 4, cookie);
2368 /* now we know, that a readdir entry is shorter */
2370 proto_item_set_len(entry_item, offset - old_offset);
2376 /* RFC 1094, Page 11 */
2378 dissect_nfs2_readdir_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
2384 offset = dissect_stat(tvb, offset, tree, &status);
2387 offset = dissect_rpc_list(tvb, pinfo, tree, offset,
2388 dissect_readdir_entry);
2389 eof_value = tvb_get_ntohl(tvb, offset+0);
2391 proto_tree_add_uint(tree, hf_nfs_readdir_eof, tvb,
2392 offset+ 0, 4, eof_value);
2404 /* RFC 1094, Page 12 */
2406 dissect_nfs2_statfs_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
2416 offset = dissect_stat(tvb, offset, tree, &status);
2419 tsize = tvb_get_ntohl(tvb, offset+ 0);
2420 bsize = tvb_get_ntohl(tvb, offset+ 4);
2421 blocks = tvb_get_ntohl(tvb, offset+ 8);
2422 bfree = tvb_get_ntohl(tvb, offset+12);
2423 bavail = tvb_get_ntohl(tvb, offset+16);
2425 proto_tree_add_uint(tree, hf_nfs_statfs_tsize, tvb,
2426 offset+ 0, 4, tsize);
2427 proto_tree_add_uint(tree, hf_nfs_statfs_bsize, tvb,
2428 offset+ 4, 4, bsize);
2429 proto_tree_add_uint(tree, hf_nfs_statfs_blocks, tvb,
2430 offset+ 8, 4, blocks);
2431 proto_tree_add_uint(tree, hf_nfs_statfs_bfree, tvb,
2432 offset+12, 4, bfree);
2433 proto_tree_add_uint(tree, hf_nfs_statfs_bavail, tvb,
2434 offset+16, 4, bavail);
2447 /* proc number, "proc name", dissect_request, dissect_reply */
2448 /* NULL as function pointer means: type of arguments is "void". */
2449 static const vsff nfs2_proc[] = {
2450 { 0, "NULL", /* OK */
2452 { 1, "GETATTR", /* OK */
2453 dissect_nfs2_fhandle_call, dissect_nfs2_attrstat_reply },
2454 { 2, "SETATTR", /* OK */
2455 dissect_nfs2_setattr_call, dissect_nfs2_attrstat_reply },
2456 { 3, "ROOT", /* OK */
2458 { 4, "LOOKUP", /* OK */
2459 dissect_nfs2_diropargs_call, dissect_nfs2_diropres_reply },
2460 { 5, "READLINK", /* OK */
2461 dissect_nfs2_fhandle_call, dissect_nfs2_readlink_reply },
2462 { 6, "READ", /* OK */
2463 dissect_nfs2_read_call, dissect_nfs2_read_reply },
2464 { 7, "WRITECACHE", /* OK */
2466 { 8, "WRITE", /* OK */
2467 dissect_nfs2_write_call, dissect_nfs2_attrstat_reply },
2468 { 9, "CREATE", /* OK */
2469 dissect_nfs2_createargs_call, dissect_nfs2_diropres_reply },
2470 { 10, "REMOVE", /* OK */
2471 dissect_nfs2_diropargs_call, dissect_nfs2_stat_reply },
2472 { 11, "RENAME", /* OK */
2473 dissect_nfs2_rename_call, dissect_nfs2_stat_reply },
2474 { 12, "LINK", /* OK */
2475 dissect_nfs2_link_call, dissect_nfs2_stat_reply },
2476 { 13, "SYMLINK", /* OK */
2477 dissect_nfs2_symlink_call, dissect_nfs2_stat_reply },
2478 { 14, "MKDIR", /* OK */
2479 dissect_nfs2_createargs_call, dissect_nfs2_diropres_reply },
2480 { 15, "RMDIR", /* OK */
2481 dissect_nfs2_diropargs_call, dissect_nfs2_stat_reply },
2482 { 16, "READDIR", /* OK */
2483 dissect_nfs2_readdir_call, dissect_nfs2_readdir_reply },
2484 { 17, "STATFS", /* OK */
2485 dissect_nfs2_fhandle_call, dissect_nfs2_statfs_reply },
2486 { 0,NULL,NULL,NULL }
2489 static const value_string nfsv2_proc_vals[] = {
2497 { 7, "WRITECACHE" },
2511 /* end of NFS Version 2 */
2514 /***************************/
2515 /* NFS Version 3, RFC 1813 */
2516 /***************************/
2519 /* RFC 1813, Page 15 */
2521 dissect_filename3(tvbuff_t *tvb, int offset,
2522 proto_tree *tree, int hf, char **string_ret)
2524 offset = dissect_rpc_string(tvb, tree, hf, offset, string_ret);
2529 /* RFC 1813, Page 15 */
2531 dissect_nfspath3(tvbuff_t *tvb, int offset, proto_tree *tree, int hf)
2533 offset = dissect_rpc_string(tvb, tree, hf, offset, NULL);
2537 /* RFC 1813, Page 15 */
2539 dissect_cookieverf3(tvbuff_t *tvb, int offset, proto_tree *tree)
2541 proto_tree_add_text(tree, tvb, offset, NFS3_COOKIEVERFSIZE,
2542 "Verifier: Opaque Data");
2543 offset += NFS3_COOKIEVERFSIZE;
2548 /* RFC 1813, Page 16 */
2550 dissect_createverf3(tvbuff_t *tvb, int offset, proto_tree *tree)
2552 proto_tree_add_text(tree, tvb, offset, NFS3_CREATEVERFSIZE,
2553 "Verifier: Opaque Data");
2554 offset += NFS3_CREATEVERFSIZE;
2559 /* RFC 1813, Page 16 */
2561 dissect_writeverf3(tvbuff_t *tvb, int offset, proto_tree *tree)
2563 proto_tree_add_text(tree, tvb, offset, NFS3_WRITEVERFSIZE,
2564 "Verifier: Opaque Data");
2565 offset += NFS3_WRITEVERFSIZE;
2569 /* RFC 1813, Page 16 */
2571 dissect_mode3(tvbuff_t *tvb, int offset, proto_tree *tree, char* name)
2574 proto_item* mode3_item = NULL;
2575 proto_tree* mode3_tree = NULL;
2577 mode3 = tvb_get_ntohl(tvb, offset+0);
2580 mode3_item = proto_tree_add_text(tree, tvb, offset, 4,
2581 "%s: 0%o", name, mode3);
2583 mode3_tree = proto_item_add_subtree(mode3_item, ett_nfs_mode3);
2586 /* RFC 1813, Page 23 */
2588 proto_tree_add_text(mode3_tree, tvb, offset, 4, "%s",
2589 decode_boolean_bitfield(mode3, 0x800, 12, "Set user id on exec", "not SUID"));
2590 proto_tree_add_text(mode3_tree, tvb, offset, 4, "%s",
2591 decode_boolean_bitfield(mode3, 0x400, 12, "Set group id on exec", "not SGID"));
2592 proto_tree_add_text(mode3_tree, tvb, offset, 4, "%s",
2593 decode_boolean_bitfield(mode3, 0x200, 12, "Save swapped text even after use", "not save swapped text"));
2594 proto_tree_add_text(mode3_tree, tvb, offset, 4, "%s",
2595 decode_boolean_bitfield(mode3, 0x100, 12, "Read permission for owner", "no Read permission for owner"));
2596 proto_tree_add_text(mode3_tree, tvb, offset, 4, "%s",
2597 decode_boolean_bitfield(mode3, 0x80, 12, "Write permission for owner", "no Write permission for owner"));
2598 proto_tree_add_text(mode3_tree, tvb, offset, 4, "%s",
2599 decode_boolean_bitfield(mode3, 0x40, 12, "Execute permission for owner", "no Execute permission for owner"));
2600 proto_tree_add_text(mode3_tree, tvb, offset, 4, "%s",
2601 decode_boolean_bitfield(mode3, 0x20, 12, "Read permission for group", "no Read permission for group"));
2602 proto_tree_add_text(mode3_tree, tvb, offset, 4, "%s",
2603 decode_boolean_bitfield(mode3, 0x10, 12, "Write permission for group", "no Write permission for group"));
2604 proto_tree_add_text(mode3_tree, tvb, offset, 4, "%s",
2605 decode_boolean_bitfield(mode3, 0x8, 12, "Execute permission for group", "no Execute permission for group"));
2606 proto_tree_add_text(mode3_tree, tvb, offset, 4, "%s",
2607 decode_boolean_bitfield(mode3, 0x4, 12, "Read permission for others", "no Read permission for others"));
2608 proto_tree_add_text(mode3_tree, tvb, offset, 4, "%s",
2609 decode_boolean_bitfield(mode3, 0x2, 12, "Write permission for others", "no Write permission for others"));
2610 proto_tree_add_text(mode3_tree, tvb, offset, 4, "%s",
2611 decode_boolean_bitfield(mode3, 0x1, 12, "Execute permission for others", "no Execute permission for others"));
2618 /* RFC 1813, Page 16,17 */
2619 static const value_string names_nfs_nfsstat3[] =
2626 { 13, "ERR_ACCES" },
2627 { 17, "ERR_EXIST" },
2629 { 19, "ERR_NODEV" },
2630 { 20, "ERR_NOTDIR" },
2631 { 21, "ERR_ISDIR" },
2632 { 22, "ERR_INVAL" },
2634 { 28, "ERR_NOSPC" },
2636 { 31, "ERR_MLINK" },
2637 { 63, "ERR_NAMETOOLONG" },
2638 { 66, "ERR_NOTEMPTY" },
2639 { 69, "ERR_DQUOT" },
2640 { 70, "ERR_STALE" },
2641 { 71, "ERR_REMOTE" },
2642 { 10001, "ERR_BADHANDLE" },
2643 { 10002, "ERR_NOT_SYNC" },
2644 { 10003, "ERR_BAD_COOKIE" },
2645 { 10004, "ERR_NOTSUPP" },
2646 { 10005, "ERR_TOOSMALL" },
2647 { 10006, "ERR_SERVERFAULT" },
2648 { 10007, "ERR_BADTYPE" },
2649 { 10008, "ERR_JUKEBOX" },
2654 /* RFC 1813, Page 16 */
2656 dissect_nfsstat3(tvbuff_t *tvb, int offset,
2657 proto_tree *tree,guint32 *status)
2661 nfsstat3 = tvb_get_ntohl(tvb, offset+0);
2664 proto_tree_add_uint(tree, hf_nfs_nfsstat3, tvb,
2665 offset, 4, nfsstat3);
2674 static const value_string names_nfs_ftype3[] =
2676 { NF3REG, "Regular File" },
2677 { NF3DIR, "Directory" },
2678 { NF3BLK, "Block Special Device" },
2679 { NF3CHR, "Character Special Device" },
2680 { NF3LNK, "Symbolic Link" },
2681 { NF3SOCK,"Socket" },
2682 { NF3FIFO,"Named Pipe" },
2687 /* RFC 1813, Page 20 */
2689 dissect_ftype3(tvbuff_t *tvb, int offset, proto_tree *tree,
2690 int hf, guint32* ftype3)
2694 type = tvb_get_ntohl(tvb, offset+0);
2697 proto_tree_add_uint(tree, hf, tvb, offset, 4, type);
2706 /* RFC 1813, Page 20 */
2708 dissect_specdata3(tvbuff_t *tvb, int offset, proto_tree *tree, char* name)
2713 proto_item* specdata3_item;
2714 proto_tree* specdata3_tree = NULL;
2716 specdata1 = tvb_get_ntohl(tvb, offset+0);
2717 specdata2 = tvb_get_ntohl(tvb, offset+4);
2720 specdata3_item = proto_tree_add_text(tree, tvb, offset, 8,
2721 "%s: %u,%u", name, specdata1, specdata2);
2723 specdata3_tree = proto_item_add_subtree(specdata3_item,
2727 if (specdata3_tree) {
2728 proto_tree_add_text(specdata3_tree, tvb,offset+0,4,
2729 "specdata1: %u", specdata1);
2730 proto_tree_add_text(specdata3_tree, tvb,offset+4,4,
2731 "specdata2: %u", specdata2);
2739 /* RFC 1813, Page 21 */
2741 dissect_nfs_fh3(tvbuff_t *tvb, int offset, packet_info *pinfo,
2742 proto_tree *tree, char *name)
2747 proto_item* fitem = NULL;
2748 proto_tree* ftree = NULL;
2749 int fh_offset,fh_length;
2751 fh3_len = tvb_get_ntohl(tvb, offset+0);
2752 fh3_len_full = rpc_roundup(fh3_len);
2753 fh3_fill = fh3_len_full - fh3_len;
2756 fitem = proto_tree_add_text(tree, tvb, offset, 4+fh3_len_full,
2759 ftree = proto_item_add_subtree(fitem, ett_nfs_fh3);
2762 /* are we snooping fh to filenames ?*/
2763 if((!pinfo->fd->flags.visited) && nfs_file_name_snooping){
2764 rpc_call_info_value *civ=pinfo->private_data;
2766 /* NFS v3 LOOKUP, CREATE, MKDIR calls might give us a mapping*/
2767 if( (civ->prog==100003)
2770 &&((civ->proc==3)||(civ->proc==8)||(civ->proc==9))
2772 fh_length=tvb_get_ntohl(tvb, offset);
2774 nfs_name_snoop_add_fh(civ->xid, tvb,
2775 fh_offset, fh_length);
2778 /* MOUNT v3 MNT replies might give us a filehandle */
2779 if( (civ->prog==100005)
2784 fh_length=tvb_get_ntohl(tvb, offset);
2786 nfs_name_snoop_add_fh(civ->xid, tvb,
2787 fh_offset, fh_length);
2791 proto_tree_add_uint(ftree, hf_nfs_fh_length, tvb, offset+0, 4,
2794 /* Handle WebNFS requests where filehandle may be 0 length */
2797 dissect_fhandle_data(tvb, offset+4, pinfo, ftree, fh3_len, FALSE);
2799 offset += fh3_len_full;
2808 /* RFC 1813, Page 21 */
2810 dissect_nfstime3(tvbuff_t *tvb, int offset,
2811 proto_tree *tree, int hf_time, int hf_time_sec, int hf_time_nsec)
2817 proto_item* time_item;
2818 proto_tree* time_tree = NULL;
2820 seconds = tvb_get_ntohl(tvb, offset+0);
2821 nseconds = tvb_get_ntohl(tvb, offset+4);
2823 ts.nsecs = nseconds;
2826 time_item = proto_tree_add_time(tree, hf_time, tvb, offset, 8,
2829 time_tree = proto_item_add_subtree(time_item, ett_nfs_nfstime3);
2833 proto_tree_add_uint(time_tree, hf_time_sec, tvb, offset, 4,
2835 proto_tree_add_uint(time_tree, hf_time_nsec, tvb, offset+4, 4,
2843 /* RFC 1813, Page 22 */
2845 dissect_nfs_fattr3(tvbuff_t *tvb, int offset, proto_tree *tree, char* name)
2847 proto_item* fattr3_item = NULL;
2848 proto_tree* fattr3_tree = NULL;
2849 int old_offset = offset;
2853 fattr3_item = proto_tree_add_text(tree, tvb, offset, -1,
2855 fattr3_tree = proto_item_add_subtree(fattr3_item, ett_nfs_fattr3);
2858 offset = dissect_ftype3(tvb,offset,fattr3_tree,hf_nfs_fattr3_type,&type);
2859 offset = dissect_mode3(tvb,offset,fattr3_tree,"mode");
2860 offset = dissect_rpc_uint32(tvb, fattr3_tree, hf_nfs_fattr3_nlink,
2862 offset = dissect_rpc_uint32(tvb, fattr3_tree, hf_nfs_fattr3_uid,
2864 offset = dissect_rpc_uint32(tvb, fattr3_tree, hf_nfs_fattr3_gid,
2866 offset = dissect_rpc_uint64(tvb, fattr3_tree, hf_nfs_fattr3_size,
2868 offset = dissect_rpc_uint64(tvb, fattr3_tree, hf_nfs_fattr3_used,
2870 offset = dissect_specdata3(tvb,offset,fattr3_tree,"rdev");
2871 offset = dissect_rpc_uint64(tvb, fattr3_tree, hf_nfs_fattr3_fsid,
2873 offset = dissect_rpc_uint64(tvb, fattr3_tree, hf_nfs_fattr3_fileid,
2875 offset = dissect_nfstime3 (tvb,offset,fattr3_tree,hf_nfs_atime,hf_nfs_atime_sec,hf_nfs_atime_nsec);
2876 offset = dissect_nfstime3 (tvb,offset,fattr3_tree,hf_nfs_mtime,hf_nfs_mtime_sec,hf_nfs_mtime_nsec);
2877 offset = dissect_nfstime3 (tvb,offset,fattr3_tree,hf_nfs_ctime,hf_nfs_ctime_sec,hf_nfs_ctime_nsec);
2879 /* now we know, that fattr3 is shorter */
2881 proto_item_set_len(fattr3_item, offset - old_offset);
2888 static const value_string value_follows[] =
2891 { 1, "value follows"},
2896 /* RFC 1813, Page 23 */
2898 dissect_nfs_post_op_attr(tvbuff_t *tvb, int offset, proto_tree *tree,
2901 proto_item* post_op_attr_item = NULL;
2902 proto_tree* post_op_attr_tree = NULL;
2903 int old_offset = offset;
2904 guint32 attributes_follow;
2907 post_op_attr_item = proto_tree_add_text(tree, tvb, offset, -1,
2909 post_op_attr_tree = proto_item_add_subtree(post_op_attr_item,
2910 ett_nfs_post_op_attr);
2913 attributes_follow = tvb_get_ntohl(tvb, offset+0);
2914 proto_tree_add_text(post_op_attr_tree, tvb, offset, 4,
2915 "attributes_follow: %s (%u)",
2916 val_to_str(attributes_follow,value_follows,"Unknown"), attributes_follow);
2918 switch (attributes_follow) {
2920 offset = dissect_nfs_fattr3(tvb, offset, post_op_attr_tree,
2928 /* now we know, that post_op_attr_tree is shorter */
2929 if (post_op_attr_item) {
2930 proto_item_set_len(post_op_attr_item, offset - old_offset);
2937 /* RFC 1813, Page 24 */
2939 dissect_wcc_attr(tvbuff_t *tvb, int offset, proto_tree *tree, char* name)
2941 proto_item* wcc_attr_item = NULL;
2942 proto_tree* wcc_attr_tree = NULL;
2943 int old_offset = offset;
2946 wcc_attr_item = proto_tree_add_text(tree, tvb, offset, -1,
2948 wcc_attr_tree = proto_item_add_subtree(wcc_attr_item,
2952 offset = dissect_rpc_uint64(tvb, wcc_attr_tree, hf_nfs_wcc_attr_size,
2954 offset = dissect_nfstime3(tvb, offset, wcc_attr_tree, hf_nfs_mtime, hf_nfs_mtime_sec, hf_nfs_mtime_nsec);
2955 offset = dissect_nfstime3(tvb, offset, wcc_attr_tree, hf_nfs_ctime, hf_nfs_ctime_sec, hf_nfs_ctime_nsec);
2956 /* now we know, that wcc_attr_tree is shorter */
2957 if (wcc_attr_item) {
2958 proto_item_set_len(wcc_attr_item, offset - old_offset);
2965 /* RFC 1813, Page 24 */
2967 dissect_pre_op_attr(tvbuff_t *tvb, int offset, proto_tree *tree, char* name)
2969 proto_item* pre_op_attr_item = NULL;
2970 proto_tree* pre_op_attr_tree = NULL;
2971 int old_offset = offset;
2972 guint32 attributes_follow;
2975 pre_op_attr_item = proto_tree_add_text(tree, tvb, offset, -1,
2977 pre_op_attr_tree = proto_item_add_subtree(pre_op_attr_item,
2978 ett_nfs_pre_op_attr);
2981 attributes_follow = tvb_get_ntohl(tvb, offset+0);
2982 proto_tree_add_text(pre_op_attr_tree, tvb, offset, 4,
2983 "attributes_follow: %s (%u)",
2984 val_to_str(attributes_follow,value_follows,"Unknown"), attributes_follow);
2986 switch (attributes_follow) {
2988 offset = dissect_wcc_attr(tvb, offset, pre_op_attr_tree,
2996 /* now we know, that pre_op_attr_tree is shorter */
2997 if (pre_op_attr_item) {
2998 proto_item_set_len(pre_op_attr_item, offset - old_offset);
3005 /* RFC 1813, Page 24 */
3007 dissect_wcc_data(tvbuff_t *tvb, int offset, proto_tree *tree, char* name)
3009 proto_item* wcc_data_item = NULL;
3010 proto_tree* wcc_data_tree = NULL;
3011 int old_offset = offset;
3014 wcc_data_item = proto_tree_add_text(tree, tvb, offset, -1,
3016 wcc_data_tree = proto_item_add_subtree(wcc_data_item,
3020 offset = dissect_pre_op_attr (tvb, offset, wcc_data_tree, "before");
3021 offset = dissect_nfs_post_op_attr(tvb, offset, wcc_data_tree, "after" );
3023 /* now we know, that wcc_data is shorter */
3024 if (wcc_data_item) {
3025 proto_item_set_len(wcc_data_item, offset - old_offset);
3032 /* RFC 1813, Page 25 */
3034 dissect_post_op_fh3(tvbuff_t *tvb, int offset, packet_info *pinfo,
3035 proto_tree *tree, char* name)
3037 proto_item* post_op_fh3_item = NULL;
3038 proto_tree* post_op_fh3_tree = NULL;
3039 int old_offset = offset;
3040 guint32 handle_follows;
3043 post_op_fh3_item = proto_tree_add_text(tree, tvb, offset, -1,
3045 post_op_fh3_tree = proto_item_add_subtree(post_op_fh3_item,
3046 ett_nfs_post_op_fh3);
3049 handle_follows = tvb_get_ntohl(tvb, offset+0);
3050 proto_tree_add_text(post_op_fh3_tree, tvb, offset, 4,
3051 "handle_follows: %s (%u)",
3052 val_to_str(handle_follows,value_follows,"Unknown"), handle_follows);
3054 switch (handle_follows) {
3056 offset = dissect_nfs_fh3(tvb, offset, pinfo, post_op_fh3_tree,
3064 /* now we know, that post_op_fh3_tree is shorter */
3065 if (post_op_fh3_item) {
3066 proto_item_set_len(post_op_fh3_item, offset - old_offset);
3073 /* RFC 1813, Page 25 */
3075 dissect_set_mode3(tvbuff_t *tvb, int offset, proto_tree *tree, char* name)
3077 proto_item* set_mode3_item = NULL;
3078 proto_tree* set_mode3_tree = NULL;
3079 int old_offset = offset;
3083 set_it = tvb_get_ntohl(tvb, offset+0);
3084 set_it_name = val_to_str(set_it,value_follows,"Unknown");
3087 set_mode3_item = proto_tree_add_text(tree, tvb, offset, -1,
3088 "%s: %s", name, set_it_name);
3089 set_mode3_tree = proto_item_add_subtree(set_mode3_item,
3094 proto_tree_add_text(set_mode3_tree, tvb, offset, 4,
3095 "set_it: %s (%u)", set_it_name, set_it);
3101 offset = dissect_mode3(tvb, offset, set_mode3_tree,
3109 /* now we know, that set_mode3 is shorter */
3110 if (set_mode3_item) {
3111 proto_item_set_len(set_mode3_item, offset - old_offset);
3118 /* RFC 1813, Page 26 */
3120 dissect_set_uid3(tvbuff_t *tvb, int offset, proto_tree *tree, char* name)
3122 proto_item* set_uid3_item = NULL;
3123 proto_tree* set_uid3_tree = NULL;
3124 int old_offset = offset;
3128 set_it = tvb_get_ntohl(tvb, offset+0);
3129 set_it_name = val_to_str(set_it,value_follows,"Unknown");
3132 set_uid3_item = proto_tree_add_text(tree, tvb, offset, -1,
3133 "%s: %s", name, set_it_name);
3134 set_uid3_tree = proto_item_add_subtree(set_uid3_item,
3139 proto_tree_add_text(set_uid3_tree, tvb, offset, 4,
3140 "set_it: %s (%u)", set_it_name, set_it);
3146 offset = dissect_rpc_uint32(tvb, set_uid3_tree,
3147 hf_nfs_uid3, offset);
3154 /* now we know, that set_uid3 is shorter */
3155 if (set_uid3_item) {
3156 proto_item_set_len(set_uid3_item, offset - old_offset);
3163 /* RFC 1813, Page 26 */
3165 dissect_set_gid3(tvbuff_t *tvb, int offset, proto_tree *tree, char* name)
3167 proto_item* set_gid3_item = NULL;
3168 proto_tree* set_gid3_tree = NULL;
3169 int old_offset = offset;
3173 set_it = tvb_get_ntohl(tvb, offset+0);
3174 set_it_name = val_to_str(set_it,value_follows,"Unknown");
3177 set_gid3_item = proto_tree_add_text(tree, tvb, offset, -1,
3178 "%s: %s", name, set_it_name);
3179 set_gid3_tree = proto_item_add_subtree(set_gid3_item,
3184 proto_tree_add_text(set_gid3_tree, tvb, offset, 4,
3185 "set_it: %s (%u)", set_it_name, set_it);
3191 offset = dissect_rpc_uint32(tvb, set_gid3_tree,
3192 hf_nfs_gid3, offset);
3199 /* now we know, that set_gid3 is shorter */
3200 if (set_gid3_item) {
3201 proto_item_set_len(set_gid3_item, offset - old_offset);
3208 /* RFC 1813, Page 26 */
3210 dissect_set_size3(tvbuff_t *tvb, int offset, proto_tree *tree, char* name)
3212 proto_item* set_size3_item = NULL;
3213 proto_tree* set_size3_tree = NULL;
3214 int old_offset = offset;
3218 set_it = tvb_get_ntohl(tvb, offset+0);
3219 set_it_name = val_to_str(set_it,value_follows,"Unknown");
3222 set_size3_item = proto_tree_add_text(tree, tvb, offset, -1,
3223 "%s: %s", name, set_it_name);
3224 set_size3_tree = proto_item_add_subtree(set_size3_item,
3229 proto_tree_add_text(set_size3_tree, tvb, offset, 4,
3230 "set_it: %s (%u)", set_it_name, set_it);
3236 offset = dissect_rpc_uint64(tvb, set_size3_tree,
3237 hf_nfs_set_size3_size, offset);
3244 /* now we know, that set_size3 is shorter */
3245 if (set_size3_item) {
3246 proto_item_set_len(set_size3_item, offset - old_offset);
3253 /* RFC 1813, Page 25 */
3254 #define DONT_CHANGE 0
3255 #define SET_TO_SERVER_TIME 1
3256 #define SET_TO_CLIENT_TIME 2
3258 static const value_string time_how[] =
3260 { DONT_CHANGE, "don't change" },
3261 { SET_TO_SERVER_TIME, "set to server time" },
3262 { SET_TO_CLIENT_TIME, "set to client time" },
3267 /* RFC 1813, Page 26 */
3269 dissect_set_atime(tvbuff_t *tvb, int offset, proto_tree *tree, char* name)
3271 proto_item* set_atime_item = NULL;
3272 proto_tree* set_atime_tree = NULL;
3273 int old_offset = offset;
3277 set_it = tvb_get_ntohl(tvb, offset+0);
3278 set_it_name = val_to_str(set_it,time_how,"Unknown");
3281 set_atime_item = proto_tree_add_text(tree, tvb, offset, -1,
3282 "%s: %s", name, set_it_name);
3283 set_atime_tree = proto_item_add_subtree(set_atime_item,
3288 proto_tree_add_text(set_atime_tree, tvb, offset, 4,
3289 "set_it: %s (%u)", set_it_name, set_it);
3294 case SET_TO_CLIENT_TIME:
3295 if (set_atime_item) {
3296 offset = dissect_nfstime3(tvb, offset, set_atime_tree,
3297 hf_nfs_atime, hf_nfs_atime_sec, hf_nfs_atime_nsec);
3305 /* now we know, that set_atime is shorter */
3306 if (set_atime_item) {
3307 proto_item_set_len(set_atime_item, offset - old_offset);
3314 /* RFC 1813, Page 26 */
3316 dissect_set_mtime(tvbuff_t *tvb, int offset, proto_tree *tree, char* name)
3318 proto_item* set_mtime_item = NULL;
3319 proto_tree* set_mtime_tree = NULL;
3320 int old_offset = offset;
3324 set_it = tvb_get_ntohl(tvb, offset+0);
3325 set_it_name = val_to_str(set_it,time_how,"Unknown");
3328 set_mtime_item = proto_tree_add_text(tree, tvb, offset, -1,
3329 "%s: %s", name, set_it_name);
3330 set_mtime_tree = proto_item_add_subtree(set_mtime_item,
3335 proto_tree_add_text(set_mtime_tree, tvb, offset, 4,
3336 "set_it: %s (%u)", set_it_name, set_it);
3341 case SET_TO_CLIENT_TIME:
3342 if (set_mtime_item) {
3343 offset = dissect_nfstime3(tvb, offset, set_mtime_tree,
3344 hf_nfs_atime, hf_nfs_atime_sec, hf_nfs_atime_nsec);
3352 /* now we know, that set_mtime is shorter */
3353 if (set_mtime_item) {
3354 proto_item_set_len(set_mtime_item, offset - old_offset);
3361 /* RFC 1813, Page 25..27 */
3363 dissect_sattr3(tvbuff_t *tvb, int offset, proto_tree *tree, char* name)
3365 proto_item* sattr3_item = NULL;
3366 proto_tree* sattr3_tree = NULL;
3367 int old_offset = offset;
3370 sattr3_item = proto_tree_add_text(tree, tvb, offset, -1,
3372 sattr3_tree = proto_item_add_subtree(sattr3_item, ett_nfs_sattr3);
3375 offset = dissect_set_mode3(tvb, offset, sattr3_tree, "mode");
3376 offset = dissect_set_uid3 (tvb, offset, sattr3_tree, "uid");
3377 offset = dissect_set_gid3 (tvb, offset, sattr3_tree, "gid");
3378 offset = dissect_set_size3(tvb, offset, sattr3_tree, "size");
3379 offset = dissect_set_atime(tvb, offset, sattr3_tree, "atime");
3380 offset = dissect_set_mtime(tvb, offset, sattr3_tree, "mtime");
3382 /* now we know, that sattr3 is shorter */
3384 proto_item_set_len(sattr3_item, offset - old_offset);
3391 /* RFC 1813, Page 27 */
3393 dissect_diropargs3(tvbuff_t *tvb, int offset, packet_info *pinfo,
3394 proto_tree *tree, char* name)
3396 proto_item* diropargs3_item = NULL;
3397 proto_tree* diropargs3_tree = NULL;
3398 int old_offset = offset;
3399 int parent_offset, parent_len;
3400 int name_offset, name_len;
3403 diropargs3_item = proto_tree_add_text(tree, tvb, offset, -1,
3405 diropargs3_tree = proto_item_add_subtree(diropargs3_item,
3406 ett_nfs_diropargs3);
3409 parent_offset=offset+4;
3410 parent_len=tvb_get_ntohl(tvb, offset);
3411 offset = dissect_nfs_fh3(tvb, offset, pinfo, diropargs3_tree, "dir");
3412 name_offset=offset+4;
3413 name_len=tvb_get_ntohl(tvb, offset);
3414 offset = dissect_filename3(tvb, offset, diropargs3_tree,
3417 /* are we snooping fh to filenames ?*/
3418 if((!pinfo->fd->flags.visited) && nfs_file_name_snooping){
3419 /* v3 LOOKUP, CREATE, MKDIR calls might give us a mapping*/
3420 rpc_call_info_value *civ=pinfo->private_data;
3422 if( (civ->prog==100003)
3425 &&((civ->proc==3)||(civ->proc==8)||(civ->proc==9))
3427 nfs_name_snoop_add_name(civ->xid, tvb,
3428 name_offset, name_len,
3429 parent_offset, parent_len, NULL);
3434 /* now we know, that diropargs3 is shorter */
3435 if (diropargs3_item) {
3436 proto_item_set_len(diropargs3_item, offset - old_offset);
3443 /* RFC 1813, Page 27 */
3445 dissect_nfs3_diropargs3_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
3448 offset = dissect_diropargs3(tvb, offset, pinfo, tree, "object");
3454 /* RFC 1813, Page 40 */
3456 dissect_access(tvbuff_t *tvb, int offset, proto_tree *tree,
3460 proto_item* access_item = NULL;
3461 proto_tree* access_tree = NULL;
3463 access = tvb_get_ntohl(tvb, offset+0);
3466 access_item = proto_tree_add_text(tree, tvb, offset, 4,
3467 "%s: 0x%02x", name, access);
3469 access_tree = proto_item_add_subtree(access_item, ett_nfs_access);
3473 proto_tree_add_text(access_tree, tvb, offset, 4, "%s READ",
3474 decode_boolean_bitfield(access, 0x001, 6, "allow", "not allow"));
3475 proto_tree_add_text(access_tree, tvb, offset, 4, "%s LOOKUP",
3476 decode_boolean_bitfield(access, 0x002, 6, "allow", "not allow"));
3477 proto_tree_add_text(access_tree, tvb, offset, 4, "%s MODIFY",
3478 decode_boolean_bitfield(access, 0x004, 6, "allow", "not allow"));
3479 proto_tree_add_text(access_tree, tvb, offset, 4, "%s EXTEND",
3480 decode_boolean_bitfield(access, 0x008, 6, "allow", "not allow"));
3481 proto_tree_add_text(access_tree, tvb, offset, 4, "%s DELETE",
3482 decode_boolean_bitfield(access, 0x010, 6, "allow", "not allow"));
3483 proto_tree_add_text(access_tree, tvb, offset, 4, "%s EXECUTE",
3484 decode_boolean_bitfield(access, 0x020, 6, "allow", "not allow"));
3492 /* NFS3 file handle dissector */
3494 dissect_nfs3_nfs_fh3_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
3497 offset = dissect_nfs_fh3(tvb, offset, pinfo, tree, "object");
3502 /* RFC 1813, Page 32,33 */
3504 dissect_nfs3_getattr_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
3507 offset = dissect_nfs_fh3(tvb, offset, pinfo, tree, "object");
3512 /* RFC 1813, Page 32,33 */
3514 dissect_nfs3_getattr_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
3519 offset = dissect_nfsstat3(tvb, offset, tree, &status);
3522 offset = dissect_nfs_fattr3(tvb, offset, tree, "obj_attributes");
3533 /* RFC 1813, Page 33 */
3535 dissect_sattrguard3(tvbuff_t *tvb, int offset, proto_tree* tree, char *name)
3537 proto_item* sattrguard3_item = NULL;
3538 proto_tree* sattrguard3_tree = NULL;
3539 int old_offset = offset;
3543 check = tvb_get_ntohl(tvb, offset+0);
3544 check_name = val_to_str(check,value_follows,"Unknown");
3547 sattrguard3_item = proto_tree_add_text(tree, tvb, offset, -1,
3548 "%s: %s", name, check_name);
3549 sattrguard3_tree = proto_item_add_subtree(sattrguard3_item,
3550 ett_nfs_sattrguard3);
3553 if (sattrguard3_tree)
3554 proto_tree_add_text(sattrguard3_tree, tvb, offset, 4,
3555 "check: %s (%u)", check_name, check);
3561 offset = dissect_nfstime3(tvb, offset, sattrguard3_tree,
3562 hf_nfs_ctime, hf_nfs_ctime_sec, hf_nfs_ctime_nsec);
3569 /* now we know, that sattrguard3 is shorter */
3570 if (sattrguard3_item) {
3571 proto_item_set_len(sattrguard3_item, offset - old_offset);
3578 /* RFC 1813, Page 33..36 */
3580 dissect_nfs3_setattr_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
3583 offset = dissect_nfs_fh3 (tvb, offset, pinfo, tree, "object");
3584 offset = dissect_sattr3 (tvb, offset, tree, "new_attributes");
3585 offset = dissect_sattrguard3(tvb, offset, tree, "guard");
3590 /* RFC 1813, Page 33..36 */
3592 dissect_nfs3_setattr_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
3597 offset = dissect_nfsstat3(tvb, offset, tree, &status);
3600 offset = dissect_wcc_data(tvb, offset, tree, "obj_wcc");
3603 offset = dissect_wcc_data(tvb, offset, tree, "obj_wcc");
3611 /* RFC 1813, Page 37..39 */
3613 dissect_nfs3_lookup_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
3616 offset = dissect_diropargs3 (tvb, offset, pinfo, tree, "what");
3621 /* RFC 1813, Page 37..39 */
3623 dissect_nfs3_lookup_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
3628 offset = dissect_nfsstat3(tvb, offset, tree, &status);
3631 offset = dissect_nfs_fh3(tvb, offset, pinfo, tree, "object");
3632 offset = dissect_nfs_post_op_attr(tvb, offset, tree,
3634 offset = dissect_nfs_post_op_attr(tvb, offset, tree,
3638 offset = dissect_nfs_post_op_attr(tvb, offset, tree,
3647 /* RFC 1813, Page 40..43 */
3649 dissect_nfs3_access_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
3652 offset = dissect_nfs_fh3(tvb, offset, pinfo, tree, "object");
3653 offset = dissect_access (tvb, offset, tree, "access");
3659 /* RFC 1813, Page 40..43 */
3661 dissect_nfs3_access_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
3666 offset = dissect_nfsstat3(tvb, offset, tree, &status);
3669 offset = dissect_nfs_post_op_attr(tvb, offset, tree,
3671 offset = dissect_access(tvb, offset, tree, "access");
3674 offset = dissect_nfs_post_op_attr(tvb, offset, tree,
3683 /* RFC 1813, Page 44,45 */
3685 dissect_nfs3_readlink_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
3690 offset = dissect_nfsstat3(tvb, offset, tree, &status);
3693 offset = dissect_nfs_post_op_attr(tvb, offset, tree,
3694 "symlink_attributes");
3695 offset = dissect_nfspath3(tvb, offset, tree,
3696 hf_nfs_readlink_data);
3699 offset = dissect_nfs_post_op_attr(tvb, offset, tree,
3700 "symlink_attributes");
3708 /* RFC 1813, Page 46..48 */
3710 dissect_nfs3_read_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
3713 offset = dissect_nfs_fh3(tvb, offset, pinfo, tree, "file");
3714 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_offset3, offset);
3715 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_count3, offset);
3721 /* RFC 1813, Page 46..48 */
3723 dissect_nfs3_read_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
3728 offset = dissect_nfsstat3(tvb, offset, tree, &status);
3731 offset = dissect_nfs_post_op_attr(tvb, offset, tree,
3733 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_count3,
3735 offset = dissect_rpc_bool(tvb, tree, hf_nfs_read_eof,
3737 offset = dissect_nfsdata(tvb, offset, tree, hf_nfs_data);
3740 offset = dissect_nfs_post_op_attr(tvb, offset, tree,
3749 /* RFC 1813, Page 49 */
3750 static const value_string names_stable_how[] = {
3751 { UNSTABLE, "UNSTABLE" },
3752 { DATA_SYNC, "DATA_SYNC" },
3753 { FILE_SYNC, "FILE_SYNC" },
3758 /* RFC 1813, Page 49 */
3760 dissect_stable_how(tvbuff_t *tvb, int offset, proto_tree* tree, int hfindex)
3764 stable_how = tvb_get_ntohl(tvb,offset+0);
3766 proto_tree_add_uint(tree, hfindex, tvb,
3767 offset, 4, stable_how);
3775 /* RFC 1813, Page 49..54 */
3777 dissect_nfs3_write_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
3780 offset = dissect_nfs_fh3 (tvb, offset, pinfo, tree, "file");
3781 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_offset3, offset);
3782 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_count3, offset);
3783 offset = dissect_stable_how(tvb, offset, tree, hf_nfs_write_stable);
3784 offset = dissect_nfsdata (tvb, offset, tree, hf_nfs_data);
3790 /* RFC 1813, Page 49..54 */
3792 dissect_nfs3_write_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
3797 offset = dissect_nfsstat3(tvb, offset, tree, &status);
3800 offset = dissect_wcc_data (tvb, offset, tree, "file_wcc");
3801 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_count3,
3803 offset = dissect_stable_how(tvb, offset, tree,
3804 hf_nfs_write_committed);
3805 offset = dissect_writeverf3(tvb, offset, tree);
3808 offset = dissect_wcc_data(tvb, offset, tree, "file_wcc");
3816 /* RFC 1813, Page 54 */
3817 static const value_string names_createmode3[] = {
3818 { UNCHECKED, "UNCHECKED" },
3819 { GUARDED, "GUARDED" },
3820 { EXCLUSIVE, "EXCLUSIVE" },
3825 /* RFC 1813, Page 54 */
3827 dissect_createmode3(tvbuff_t *tvb, int offset, proto_tree* tree, guint32* mode)
3831 mode_value = tvb_get_ntohl(tvb, offset + 0);
3833 proto_tree_add_uint(tree, hf_nfs_createmode3, tvb,
3834 offset+0, 4, mode_value);
3843 /* RFC 1813, Page 54..58 */
3845 dissect_nfs3_create_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
3850 offset = dissect_diropargs3 (tvb, offset, pinfo, tree, "where");
3851 offset = dissect_createmode3(tvb, offset, tree, &mode);
3855 offset = dissect_sattr3(tvb, offset, tree, "obj_attributes");
3858 offset = dissect_createverf3(tvb, offset, tree);
3866 /* RFC 1813, Page 54..58 */
3868 dissect_nfs3_create_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
3873 offset = dissect_nfsstat3(tvb, offset, tree, &status);
3876 offset = dissect_post_op_fh3 (tvb, offset, pinfo, tree, "obj");
3877 offset = dissect_nfs_post_op_attr(tvb, offset, tree,
3879 offset = dissect_wcc_data(tvb, offset, tree, "dir_wcc");
3882 offset = dissect_wcc_data(tvb, offset, tree, "dir_wcc");
3890 /* RFC 1813, Page 58..60 */
3892 dissect_nfs3_mkdir_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
3895 offset = dissect_diropargs3(tvb, offset, pinfo, tree, "where");
3896 offset = dissect_sattr3 (tvb, offset, tree, "attributes");
3902 /* RFC 1813, Page 61..63 */
3904 dissect_nfs3_symlink_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
3907 offset = dissect_diropargs3(tvb, offset, pinfo, tree, "where");
3908 offset = dissect_sattr3 (tvb, offset, tree, "symlink_attributes");
3909 offset = dissect_nfspath3 (tvb, offset, tree, hf_nfs_symlink_to);
3915 /* RFC 1813, Page 63..66 */
3917 dissect_nfs3_mknod_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
3922 offset = dissect_diropargs3(tvb, offset, pinfo, tree, "where");
3923 offset = dissect_ftype3(tvb, offset, tree, hf_nfs_ftype3, &type);
3927 offset = dissect_sattr3(tvb, offset, tree, "dev_attributes");
3928 offset = dissect_specdata3(tvb, offset, tree, "spec");
3932 offset = dissect_sattr3(tvb, offset, tree, "pipe_attributes");
3943 /* RFC 1813, Page 67..69 */
3945 dissect_nfs3_remove_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
3950 offset = dissect_nfsstat3(tvb, offset, tree, &status);
3953 offset = dissect_wcc_data(tvb, offset, tree, "dir_wcc");
3956 offset = dissect_wcc_data(tvb, offset, tree, "dir_wcc");
3964 /* RFC 1813, Page 71..74 */
3966 dissect_nfs3_rename_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
3969 offset = dissect_diropargs3(tvb, offset, pinfo, tree, "from");
3970 offset = dissect_diropargs3(tvb, offset, pinfo, tree, "to");
3976 /* RFC 1813, Page 71..74 */
3978 dissect_nfs3_rename_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
3983 offset = dissect_nfsstat3(tvb, offset, tree, &status);
3986 offset = dissect_wcc_data(tvb, offset, tree, "fromdir_wcc");
3987 offset = dissect_wcc_data(tvb, offset, tree, "todir_wcc");
3990 offset = dissect_wcc_data(tvb, offset, tree, "fromdir_wcc");
3991 offset = dissect_wcc_data(tvb, offset, tree, "todir_wcc");
3999 /* RFC 1813, Page 74..76 */
4001 dissect_nfs3_link_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
4004 offset = dissect_nfs_fh3 (tvb, offset, pinfo, tree, "file");
4005 offset = dissect_diropargs3(tvb, offset, pinfo, tree, "link");
4011 /* RFC 1813, Page 74..76 */
4013 dissect_nfs3_link_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
4018 offset = dissect_nfsstat3(tvb, offset, tree, &status);
4021 offset = dissect_nfs_post_op_attr(tvb, offset, tree,
4023 offset = dissect_wcc_data(tvb, offset, tree, "linkdir_wcc");
4026 offset = dissect_nfs_post_op_attr(tvb, offset, tree,
4028 offset = dissect_wcc_data(tvb, offset, tree, "linkdir_wcc");
4036 /* RFC 1813, Page 76..80 */
4038 dissect_nfs3_readdir_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
4041 offset = dissect_nfs_fh3 (tvb, offset, pinfo, tree, "dir");
4042 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_cookie3, offset);
4043 offset = dissect_cookieverf3(tvb, offset, tree);
4044 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_count3, offset);
4050 /* RFC 1813, Page 76..80 */
4052 dissect_entry3(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
4055 proto_item* entry_item = NULL;
4056 proto_tree* entry_tree = NULL;
4057 int old_offset = offset;
4061 entry_item = proto_tree_add_item(tree, hf_nfs_readdir_entry, tvb,
4062 offset+0, -1, FALSE);
4063 entry_tree = proto_item_add_subtree(entry_item, ett_nfs_readdir_entry);
4066 offset = dissect_rpc_uint64(tvb, entry_tree, hf_nfs_readdir_entry3_fileid,
4069 offset = dissect_filename3(tvb, offset, entry_tree,
4070 hf_nfs_readdir_entry3_name, &name);
4072 proto_item_set_text(entry_item, "Entry: name %s", name);
4075 offset = dissect_rpc_uint64(tvb, entry_tree, hf_nfs_readdir_entry3_cookie,
4078 /* now we know, that a readdir entry is shorter */
4080 proto_item_set_len(entry_item, offset - old_offset);
4087 /* RFC 1813, Page 76..80 */
4089 dissect_nfs3_readdir_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
4095 offset = dissect_stat(tvb, offset, tree, &status);
4098 offset = dissect_nfs_post_op_attr(tvb, offset, tree,
4100 offset = dissect_cookieverf3(tvb, offset, tree);
4101 offset = dissect_rpc_list(tvb, pinfo, tree, offset,
4103 eof_value = tvb_get_ntohl(tvb, offset+0);
4105 proto_tree_add_uint(tree, hf_nfs_readdir_eof, tvb,
4106 offset+ 0, 4, eof_value);
4110 offset = dissect_nfs_post_op_attr(tvb, offset, tree,
4119 /* RFC 1813, Page 80..83 */
4121 dissect_nfs3_readdirplus_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
4124 offset = dissect_nfs_fh3 (tvb, offset, pinfo, tree, "dir");
4125 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_cookie3, offset);
4126 offset = dissect_cookieverf3(tvb, offset, tree);
4127 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_count3_dircount,
4129 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_count3_maxcount,
4136 /* RFC 1813, Page 80..83 */
4138 dissect_entryplus3(tvbuff_t *tvb, int offset, packet_info *pinfo,
4141 proto_item* entry_item = NULL;
4142 proto_tree* entry_tree = NULL;
4143 int old_offset = offset;
4147 entry_item = proto_tree_add_item(tree, hf_nfs_readdir_entry, tvb,
4148 offset+0, -1, FALSE);
4149 entry_tree = proto_item_add_subtree(entry_item, ett_nfs_readdir_entry);
4152 offset = dissect_rpc_uint64(tvb, entry_tree,
4153 hf_nfs_readdirplus_entry_fileid, offset);
4155 offset = dissect_filename3(tvb, offset, entry_tree,
4156 hf_nfs_readdirplus_entry_name, &name);
4158 proto_item_set_text(entry_item, "Entry: name %s", name);
4161 offset = dissect_rpc_uint64(tvb, entry_tree, hf_nfs_readdirplus_entry_cookie,
4164 offset = dissect_nfs_post_op_attr(tvb, offset, entry_tree,
4166 offset = dissect_post_op_fh3(tvb, offset, pinfo, entry_tree, "name_handle");
4168 /* now we know, that a readdirplus entry is shorter */
4170 proto_item_set_len(entry_item, offset - old_offset);
4177 /* RFC 1813, Page 80..83 */
4179 dissect_nfs3_readdirplus_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
4185 offset = dissect_stat(tvb, offset, tree, &status);
4188 offset = dissect_nfs_post_op_attr(tvb, offset, tree,
4190 offset = dissect_cookieverf3(tvb, offset, tree);
4191 offset = dissect_rpc_list(tvb, pinfo, tree, offset,
4192 dissect_entryplus3);
4193 eof_value = tvb_get_ntohl(tvb, offset+0);
4195 proto_tree_add_uint(tree, hf_nfs_readdir_eof, tvb,
4196 offset+ 0, 4, eof_value);
4200 offset = dissect_nfs_post_op_attr(tvb, offset, tree,
4209 /* RFC 1813, Page 84..86 */
4211 dissect_nfs3_fsstat_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
4217 offset = dissect_nfsstat3(tvb, offset, tree, &status);
4220 offset = dissect_nfs_post_op_attr(tvb, offset, tree,
4222 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_fsstat3_resok_tbytes,
4224 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_fsstat3_resok_fbytes,
4226 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_fsstat3_resok_abytes,
4228 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_fsstat3_resok_tfiles,
4230 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_fsstat3_resok_ffiles,
4232 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_fsstat3_resok_afiles,
4234 invarsec = tvb_get_ntohl(tvb, offset + 0);
4236 proto_tree_add_uint(tree, hf_nfs_fsstat_invarsec, tvb,
4237 offset+0, 4, invarsec);
4241 offset = dissect_nfs_post_op_attr(tvb, offset, tree,
4250 #define FSF3_LINK 0x0001
4251 #define FSF3_SYMLINK 0x0002
4252 #define FSF3_HOMOGENEOUS 0x0008
4253 #define FSF3_CANSETTIME 0x0010
4256 /* RFC 1813, Page 86..90 */
4258 dissect_nfs3_fsinfo_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
4270 proto_item* properties_item = NULL;
4271 proto_tree* properties_tree = NULL;
4273 offset = dissect_nfsstat3(tvb, offset, tree, &status);
4276 offset = dissect_nfs_post_op_attr(tvb, offset, tree,
4278 rtmax = tvb_get_ntohl(tvb, offset+0);
4280 proto_tree_add_uint(tree, hf_nfs_fsinfo_rtmax, tvb,
4281 offset+0, 4, rtmax);
4283 rtpref = tvb_get_ntohl(tvb, offset+0);
4285 proto_tree_add_uint(tree, hf_nfs_fsinfo_rtpref, tvb,
4286 offset+0, 4, rtpref);
4288 rtmult = tvb_get_ntohl(tvb, offset+0);
4290 proto_tree_add_uint(tree, hf_nfs_fsinfo_rtmult, tvb,
4291 offset+0, 4, rtmult);
4293 wtmax = tvb_get_ntohl(tvb, offset+0);
4295 proto_tree_add_uint(tree, hf_nfs_fsinfo_wtmax, tvb,
4296 offset+0, 4, wtmax);
4298 wtpref = tvb_get_ntohl(tvb, offset+0);
4300 proto_tree_add_uint(tree, hf_nfs_fsinfo_wtpref, tvb,
4301 offset+0, 4, wtpref);
4303 wtmult = tvb_get_ntohl(tvb, offset+0);
4305 proto_tree_add_uint(tree, hf_nfs_fsinfo_wtmult, tvb,
4306 offset+0, 4, wtmult);
4308 dtpref = tvb_get_ntohl(tvb, offset+0);
4310 proto_tree_add_uint(tree, hf_nfs_fsinfo_dtpref, tvb,
4311 offset+0, 4, dtpref);
4314 offset = dissect_rpc_uint64(tvb, tree,
4315 hf_nfs_fsinfo_maxfilesize, offset);
4316 offset = dissect_nfstime3(tvb, offset, tree, hf_nfs_dtime, hf_nfs_dtime_sec, hf_nfs_dtime_nsec);
4317 properties = tvb_get_ntohl(tvb, offset+0);
4319 properties_item = proto_tree_add_uint(tree,
4320 hf_nfs_fsinfo_properties,
4321 tvb, offset+0, 4, properties);
4322 if (properties_item)
4323 properties_tree = proto_item_add_subtree(properties_item,
4324 ett_nfs_fsinfo_properties);
4325 if (properties_tree) {
4326 proto_tree_add_text(properties_tree, tvb,
4328 decode_boolean_bitfield(properties,
4330 "SETATTR can set time on server",
4331 "SETATTR can't set time on server"));
4333 proto_tree_add_text(properties_tree, tvb,
4335 decode_boolean_bitfield(properties,
4337 "PATHCONF is valid for all files",
4338 "PATHCONF should be get for every single file"));
4340 proto_tree_add_text(properties_tree, tvb,
4342 decode_boolean_bitfield(properties,
4344 "File System supports symbolic links",
4345 "File System does not symbolic hard links"));
4347 proto_tree_add_text(properties_tree, tvb,
4349 decode_boolean_bitfield(properties,
4351 "File System supports hard links",
4352 "File System does not support hard links"));
4358 offset = dissect_nfs_post_op_attr(tvb, offset, tree,
4367 /* RFC 1813, Page 90..92 */
4369 dissect_nfs3_pathconf_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
4376 offset = dissect_nfsstat3(tvb, offset, tree, &status);
4379 offset = dissect_nfs_post_op_attr(tvb, offset, tree,
4381 linkmax = tvb_get_ntohl(tvb, offset + 0);
4383 proto_tree_add_uint(tree, hf_nfs_pathconf_linkmax, tvb,
4384 offset+0, 4, linkmax);
4386 name_max = tvb_get_ntohl(tvb, offset + 0);
4388 proto_tree_add_uint(tree, hf_nfs_pathconf_name_max, tvb,
4389 offset+0, 4, name_max);
4391 offset = dissect_rpc_bool(tvb, tree,
4392 hf_nfs_pathconf_no_trunc, offset);
4393 offset = dissect_rpc_bool(tvb, tree,
4394 hf_nfs_pathconf_chown_restricted, offset);
4395 offset = dissect_rpc_bool(tvb, tree,
4396 hf_nfs_pathconf_case_insensitive, offset);
4397 offset = dissect_rpc_bool(tvb, tree,
4398 hf_nfs_pathconf_case_preserving, offset);
4401 offset = dissect_nfs_post_op_attr(tvb, offset, tree,
4410 /* RFC 1813, Page 92..95 */
4412 dissect_nfs3_commit_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
4415 offset = dissect_nfs_fh3(tvb, offset, pinfo, tree, "file");
4416 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_offset3, offset);
4417 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_count3, offset);
4422 /* RFC 1813, Page 92..95 */
4424 dissect_nfs3_commit_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
4429 offset = dissect_nfsstat3(tvb, offset, tree, &status);
4432 offset = dissect_wcc_data (tvb, offset, tree, "file_wcc");
4433 offset = dissect_writeverf3(tvb, offset, tree);
4436 offset = dissect_wcc_data(tvb, offset, tree, "file_wcc");
4443 /**********************************************************/
4444 /* NFS Version 4, RFC 3010 with nfs4_prot.x 1.103 changes */
4445 /**********************************************************/
4448 dissect_nfs_utf8string(tvbuff_t *tvb, int offset,
4449 proto_tree *tree, int hf, char **string_ret)
4451 /* TODO: this dissector is subject to change; do not remove */
4452 return dissect_rpc_string(tvb, tree, hf, offset, string_ret);
4456 dissect_nfs_specdata4(tvbuff_t *tvb, int offset, proto_tree *tree)
4458 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_specdata1, offset);
4459 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_specdata2, offset);
4464 static const value_string names_ftype4[] = {
4465 { NF4REG, "NF4REG" },
4466 { NF4DIR, "NF4DIR" },
4467 { NF4BLK, "NF4BLK" },
4468 { NF4CHR, "NF4CHR" },
4469 { NF4LNK, "NF4LNK" },
4470 { NF4SOCK, "NF4SOCK" },
4471 { NF4FIFO, "NF4FIFO" },
4472 { NF4ATTRDIR, "NF4ATTRDIR" },
4473 { NF4NAMEDATTR, "NF4NAMEDATTR" },
4478 dissect_nfs_lock_owner4(tvbuff_t *tvb, int offset, proto_tree *tree)
4480 proto_tree *newftree = NULL;
4481 proto_item *fitem = NULL;
4483 fitem = proto_tree_add_text(tree, tvb, offset, 4, "Owner");
4487 newftree = proto_item_add_subtree(fitem, ett_nfs_lock_owner4);
4491 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_clientid4, offset);
4492 offset = dissect_nfsdata(tvb, offset, newftree, hf_nfs_data);
4500 dissect_nfs_pathname4(tvbuff_t *tvb, int offset, proto_tree *tree)
4502 guint32 comp_count, i;
4503 proto_item *fitem = NULL;
4504 proto_tree *newftree = NULL;
4506 comp_count=tvb_get_ntohl(tvb, offset);
4507 fitem = proto_tree_add_text(tree, tvb, offset, 4,
4508 "pathname components (%u)", comp_count);
4513 newftree = proto_item_add_subtree(fitem, ett_nfs_pathname4);
4517 for (i = 0; i < comp_count; i++)
4518 offset = dissect_nfs_utf8string(tvb, offset, newftree,
4519 hf_nfs_component4, NULL);
4527 dissect_nfs_nfstime4(tvbuff_t *tvb, int offset, proto_tree *tree)
4529 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_nfstime4_seconds, offset);
4530 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_nfstime4_nseconds, offset);
4535 static const value_string names_time_how4[] = {
4536 #define SET_TO_SERVER_TIME4 0
4537 { SET_TO_SERVER_TIME4, "SET_TO_SERVER_TIME4" },
4538 #define SET_TO_CLIENT_TIME4 1
4539 { SET_TO_CLIENT_TIME4, "SET_TO_CLIENT_TIME4" },
4544 dissect_nfs_settime4(tvbuff_t *tvb, int offset,
4545 proto_tree *tree, char *name _U_)
4549 set_it = tvb_get_ntohl(tvb, offset);
4550 proto_tree_add_uint(tree, hf_nfs_time_how4, tvb, offset+0,
4554 if (set_it == SET_TO_CLIENT_TIME4)
4555 offset = dissect_nfs_nfstime4(tvb, offset, tree);
4561 dissect_nfs_fsid4(tvbuff_t *tvb, int offset, proto_tree *tree, char *name)
4563 proto_tree *newftree = NULL;
4564 proto_item *fitem = NULL;
4566 fitem = proto_tree_add_text(tree, tvb, offset, 0, "%s", name);
4568 if (fitem == NULL) return offset;
4570 newftree = proto_item_add_subtree(fitem, ett_nfs_fsid4);
4572 if (newftree == NULL) return offset;
4574 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_fsid4_major,
4576 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_fsid4_minor,
4582 static const value_string names_acetype4[] = {
4583 #define ACE4_ACCESS_ALLOWED_ACE_TYPE 0x00000000
4584 { ACE4_ACCESS_ALLOWED_ACE_TYPE, "ACE4_ACCESS_ALLOWED_ACE_TYPE" },
4585 #define ACE4_ACCESS_DENIED_ACE_TYPE 0x00000001
4586 { ACE4_ACCESS_DENIED_ACE_TYPE, "ACE4_ACCESS_DENIED_ACE_TYPE" },
4587 #define ACE4_SYSTEM_AUDIT_ACE_TYPE 0x00000002
4588 { ACE4_SYSTEM_AUDIT_ACE_TYPE, "ACE4_SYSTEM_AUDIT_ACE_TYPE" },
4589 #define ACE4_SYSTEM_ALARM_ACE_TYPE 0x00000003
4590 { ACE4_SYSTEM_ALARM_ACE_TYPE, "ACE4_SYSTEM_ALARM_ACE_TYPE" },
4594 /* ACE mask values */
4595 #define ACE4_READ_DATA 0x00000001
4596 #define ACE4_LIST_DIRECTORY 0x00000001
4597 #define ACE4_WRITE_DATA 0x00000002
4598 #define ACE4_ADD_FILE 0x00000002
4599 #define ACE4_APPEND_DATA 0x00000004
4600 #define ACE4_ADD_SUBDIRECTORY 0x00000004
4601 #define ACE4_READ_NAMED_ATTRS 0x00000008
4602 #define ACE4_WRITE_NAMED_ATTRS 0x00000010
4603 #define ACE4_EXECUTE 0x00000020
4604 #define ACE4_DELETE_CHILD 0x00000040
4605 #define ACE4_READ_ATTRIBUTES 0x00000080
4606 #define ACE4_WRITE_ATTRIBUTES 0x00000100
4607 #define ACE4_DELETE 0x00010000
4608 #define ACE4_READ_ACL 0x00020000
4609 #define ACE4_WRITE_ACL 0x00040000
4610 #define ACE4_WRITE_OWNER 0x00080000
4611 #define ACE4_SYNCHRONIZE 0x00100000
4614 dissect_nfs_acemask4(tvbuff_t *tvb, int offset, proto_tree *tree)
4617 proto_item *acemask_item = NULL;
4618 proto_tree *acemask_tree = NULL;
4620 acemask = tvb_get_ntohl(tvb, offset);
4622 acemask_item = proto_tree_add_text(tree, tvb, offset, 4,
4623 "acemask: 0x%08x", acemask);
4626 acemask_tree = proto_item_add_subtree(acemask_item, ett_nfs_acemask4);
4630 if (acemask & ACE4_READ_DATA)
4631 proto_tree_add_text(acemask_tree, tvb, offset, 4,
4632 "ACE4_READ_DATA/ACE4_LIST_DIRECTORY (0x%08x)",
4635 if (acemask & ACE4_WRITE_DATA)
4636 proto_tree_add_text(acemask_tree, tvb, offset, 4,
4637 "ACE4_WRITE_DATA/ACE4_ADD_FILE (0x%08x)",
4640 if (acemask & ACE4_APPEND_DATA)
4641 proto_tree_add_text(acemask_tree, tvb, offset, 4,
4642 "ACE4_ADD_FILE/ACE4_ADD_SUBDIRECTORY (0x%08x)",
4645 if (acemask & ACE4_READ_NAMED_ATTRS)
4646 proto_tree_add_text(acemask_tree, tvb, offset, 4,
4647 "ACE4_READ_NAMED_ATTRS (0x%08x)",
4648 ACE4_READ_NAMED_ATTRS);
4650 if (acemask & ACE4_WRITE_NAMED_ATTRS)
4651 proto_tree_add_text(acemask_tree, tvb, offset, 4,
4652 "ACE4_WRITE_NAMED_ATTRS (0x%08x)",
4653 ACE4_WRITE_NAMED_ATTRS);
4655 if (acemask & ACE4_EXECUTE)
4656 proto_tree_add_text(acemask_tree, tvb, offset, 4,
4657 "ACE4_EXECUTE (0x%08x)",
4660 if (acemask & ACE4_DELETE_CHILD)
4661 proto_tree_add_text(acemask_tree, tvb, offset, 4,
4662 "ACE4_DELETE_CHILD (0x%08x)",
4665 if (acemask & ACE4_READ_ATTRIBUTES)
4666 proto_tree_add_text(acemask_tree, tvb, offset, 4,
4667 "ACE4_READ_ATTRIBUTES (0x%08x)",
4668 ACE4_READ_ATTRIBUTES);
4670 if (acemask & ACE4_WRITE_ATTRIBUTES)
4671 proto_tree_add_text(acemask_tree, tvb, offset, 4,
4672 "ACE4_WRITE_ATTRIBUTES (0x%08x)",
4673 ACE4_WRITE_ATTRIBUTES);
4675 if (acemask & ACE4_DELETE)
4676 proto_tree_add_text(acemask_tree, tvb, offset, 4,
4677 "ACE4_DELETE (0x%08x)",
4680 if (acemask & ACE4_READ_ACL)
4681 proto_tree_add_text(acemask_tree, tvb, offset, 4,
4682 "ACE4_READ_ACL (0x%08x)",
4685 if (acemask & ACE4_WRITE_ACL)
4686 proto_tree_add_text(acemask_tree, tvb, offset, 4,
4687 "ACE4_WRITE_ACL (0x%08x)",
4690 if (acemask & ACE4_WRITE_OWNER)
4691 proto_tree_add_text(acemask_tree, tvb, offset, 4,
4692 "ACE4_WRITE_OWNER (0x%08x)",
4695 if (acemask & ACE4_SYNCHRONIZE)
4696 proto_tree_add_text(acemask_tree, tvb, offset, 4,
4697 "ACE4_SYNCHRONIZE (0x%08x)",
4706 /* ACE flag values */
4707 #define ACE4_FILE_INHERIT_ACE 0x00000001
4708 #define ACE4_DIRECTORY_INHERIT_ACE 0x00000002
4709 #define ACE4_NO_PROPAGATE_INHERIT_ACE 0x00000004
4710 #define ACE4_INHERIT_ONLY_ACE 0x00000008
4711 #define ACE4_SUCCESSFUL_ACCESS_ACE_FLAG 0x00000010
4712 #define ACE4_FAILED_ACCESS_ACE_FLAG 0x00000020
4713 #define ACE4_IDENTIFIER_GROUP 0x00000040
4717 dissect_nfs_ace4(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
4720 proto_item* ace_item = NULL;
4721 proto_tree* ace_tree = NULL;
4722 proto_item *aceflag_item = NULL;
4723 proto_tree *aceflag_tree = NULL;
4727 ace_item = proto_tree_add_text(tree, tvb, offset, 4,
4731 ace_tree = proto_item_add_subtree(ace_item, ett_nfs_ace4);
4735 offset = dissect_rpc_uint32(tvb, ace_tree, hf_nfs_acetype4, offset);
4737 aceflag4 = tvb_get_ntohl(tvb, offset);
4739 aceflag_item = proto_tree_add_text(ace_tree, tvb, offset, 4,
4740 "aceflag: 0x%08x", aceflag4);
4744 aceflag_tree = proto_item_add_subtree(aceflag_item, ett_nfs_aceflag4);
4748 if (aceflag4 & ACE4_FILE_INHERIT_ACE)
4749 proto_tree_add_text(aceflag_tree, tvb, offset, 4,
4750 "ACE4_FILE_INHERIT_ACE (0x%08x)", ACE4_FILE_INHERIT_ACE);
4752 if (aceflag4 & ACE4_DIRECTORY_INHERIT_ACE)
4753 proto_tree_add_text(aceflag_tree, tvb, offset, 4,
4754 "ACE4_DIRECTORY_INHERIT_ACE (0x%08x)",
4755 ACE4_DIRECTORY_INHERIT_ACE);
4757 if (aceflag4 & ACE4_INHERIT_ONLY_ACE)
4758 proto_tree_add_text(aceflag_tree, tvb, offset, 4,
4759 "ACE4_INHERIT_ONLY_ACE (0x%08x)",
4760 ACE4_INHERIT_ONLY_ACE);
4762 if (aceflag4 & ACE4_SUCCESSFUL_ACCESS_ACE_FLAG)
4763 proto_tree_add_text(aceflag_tree, tvb, offset, 4,
4764 "ACE4_SUCCESSFUL_ACCESS_ACE_FLAG (0x%08x)",
4765 ACE4_SUCCESSFUL_ACCESS_ACE_FLAG);
4767 if (aceflag4 & ACE4_FAILED_ACCESS_ACE_FLAG)
4768 proto_tree_add_text(aceflag_tree, tvb, offset, 4,
4769 "ACE4_FAILED_ACCESS_ACE_FLAG (0x%08x)",
4770 ACE4_FAILED_ACCESS_ACE_FLAG);
4772 if (aceflag4 & ACE4_IDENTIFIER_GROUP)
4773 proto_tree_add_text(aceflag_tree, tvb, offset, 4,
4774 "ACE4_IDENTIFIER_GROUP (0x%08x)",
4775 ACE4_IDENTIFIER_GROUP);
4781 offset = dissect_nfs_acemask4(tvb, offset, ace_tree);
4783 offset = dissect_nfs_utf8string(tvb, offset, ace_tree, hf_nfs_who, NULL);
4790 dissect_nfs_fattr4_acl(tvbuff_t *tvb, int offset, packet_info *pinfo,
4793 return dissect_rpc_array(tvb, pinfo, tree, offset, dissect_nfs_ace4,
4798 dissect_nfs_fh4(tvbuff_t *tvb, int offset, packet_info *pinfo,
4799 proto_tree *tree, char *name)
4801 return dissect_nfs_fh3(tvb, offset, pinfo, tree, name);
4805 dissect_nfs_fs_location4(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
4808 proto_tree *newftree = NULL;
4809 proto_item *fitem = NULL;
4811 fitem = proto_tree_add_text(tree, tvb, offset, 0, "rootpath");
4813 if (fitem == NULL) return offset;
4815 newftree = proto_item_add_subtree(fitem, ett_nfs_fs_location4);
4817 if (newftree == NULL) return offset;
4819 offset = dissect_nfs_utf8string(tvb, offset, tree, hf_nfs_server, NULL);
4825 dissect_nfs_fs_locations4(tvbuff_t *tvb, packet_info *pinfo, int offset,
4826 proto_tree *tree, char *name)
4828 proto_tree *newftree = NULL;
4829 proto_item *fitem = NULL;
4831 fitem = proto_tree_add_text(tree, tvb, offset, 0, "%s", name);
4833 if (fitem == NULL) return offset;
4835 newftree = proto_item_add_subtree(fitem, ett_nfs_fs_locations4);
4837 if (newftree == NULL) return offset;
4839 offset = dissect_nfs_pathname4(tvb, offset, newftree);
4841 offset = dissect_rpc_list(tvb, pinfo, tree, offset,
4842 dissect_nfs_fs_location4);
4848 dissect_nfs_mode4(tvbuff_t *tvb, int offset,
4849 proto_tree *tree, char *name)
4851 return dissect_mode(tvb, offset, tree, name);
4854 static const value_string nfs4_fattr4_fh_expire_type_names[] = {
4855 #define FH4_PERSISTENT 0x00000000
4856 { FH4_PERSISTENT, "FH4_PERSISTENT" },
4857 #define FH4_NOEXPIRE_WITH_OPEN 0x00000001
4858 { FH4_NOEXPIRE_WITH_OPEN, "FH4_NOEXPIRE_WITH_OPEN" },
4859 #define FH4_VOLATILE_ANY 0x00000002
4860 { FH4_VOLATILE_ANY, "FH4_VOLATILE_ANY" },
4861 #define FH4_VOL_MIGRATION 0x00000004
4862 { FH4_VOL_MIGRATION, "FH4_VOL_MIGRATION" },
4863 #define FH4_VOL_RENAME 0x00000008
4864 { FH4_VOL_RENAME, "FH4_VOL_RENAME" },
4870 dissect_nfs_fattr4_fh_expire_type(tvbuff_t *tvb, int offset, proto_tree *tree)
4872 guint32 expire_type;
4873 proto_item *expire_type_item = NULL;
4874 proto_tree *expire_type_tree = NULL;
4876 expire_type = tvb_get_ntohl(tvb, offset + 0);
4880 expire_type_item = proto_tree_add_text(tree, tvb, offset, 4,
4881 "fattr4_fh_expire_type: 0x%08x", expire_type);
4882 if (expire_type_item)
4883 expire_type_tree = proto_item_add_subtree(expire_type_item,
4884 ett_nfs_fattr4_fh_expire_type);
4887 if (expire_type_tree)
4889 if (expire_type == FH4_PERSISTENT)
4891 proto_tree_add_text(expire_type_tree, tvb, offset, 4, "%s",
4892 decode_enumerated_bitfield(expire_type, FH4_PERSISTENT, 8,
4893 nfs4_fattr4_fh_expire_type_names, "%s"));
4897 if (expire_type & FH4_NOEXPIRE_WITH_OPEN)
4898 proto_tree_add_text(expire_type_tree, tvb, offset, 4,
4899 "FH4_NOEXPIRE_WITH_OPEN (0x%08x)", FH4_NOEXPIRE_WITH_OPEN);
4901 if (expire_type & FH4_VOLATILE_ANY)
4902 proto_tree_add_text(expire_type_tree, tvb, offset, 4,
4903 "FH4_VOLATILE_ANY (0x%08x)", FH4_VOLATILE_ANY);
4905 if (expire_type & FH4_VOL_MIGRATION)
4906 proto_tree_add_text(expire_type_tree, tvb, offset, 4,
4907 "FH4_VOL_MIGRATION (0x%08x)", FH4_VOL_MIGRATION);
4909 if (expire_type & FH4_VOL_RENAME)
4910 proto_tree_add_text(expire_type_tree, tvb, offset, 4,
4911 "FH4_VOL_RENAME (0x%08x)", FH4_VOL_RENAME);
4920 static const value_string names_fattr4[] = {
4921 #define FATTR4_SUPPORTED_ATTRS 0
4922 { FATTR4_SUPPORTED_ATTRS, "FATTR4_SUPPORTED_ATTRS" },
4923 #define FATTR4_TYPE 1
4924 { FATTR4_TYPE, "FATTR4_TYPE" },
4925 #define FATTR4_FH_EXPIRE_TYPE 2
4926 { FATTR4_FH_EXPIRE_TYPE, "FATTR4_FH_EXPIRE_TYPE" },
4927 #define FATTR4_CHANGE 3
4928 { FATTR4_CHANGE, "FATTR4_CHANGE" },
4929 #define FATTR4_SIZE 4
4930 { FATTR4_SIZE, "FATTR4_SIZE" },
4931 #define FATTR4_LINK_SUPPORT 5
4932 { FATTR4_LINK_SUPPORT, "FATTR4_LINK_SUPPORT" },
4933 #define FATTR4_SYMLINK_SUPPORT 6
4934 { FATTR4_SYMLINK_SUPPORT, "FATTR4_SYMLINK_SUPPORT" },
4935 #define FATTR4_NAMED_ATTR 7
4936 { FATTR4_NAMED_ATTR, "FATTR4_NAMED_ATTR" },
4937 #define FATTR4_FSID 8
4938 { FATTR4_FSID, "FATTR4_FSID" },
4939 #define FATTR4_UNIQUE_HANDLES 9
4940 { FATTR4_UNIQUE_HANDLES, "FATTR4_UNIQUE_HANDLES" },
4941 #define FATTR4_LEASE_TIME 10
4942 { FATTR4_LEASE_TIME, "FATTR4_LEASE_TIME" },
4943 #define FATTR4_RDATTR_ERROR 11
4944 { FATTR4_RDATTR_ERROR, "FATTR4_RDATTR_ERROR" },
4945 #define FATTR4_ACL 12
4946 { FATTR4_ACL, "FATTR4_ACL" },
4947 #define FATTR4_ACLSUPPORT 13
4948 { FATTR4_ACLSUPPORT, "FATTR4_ACLSUPPORT" },
4949 #define FATTR4_ARCHIVE 14
4950 { FATTR4_ARCHIVE, "FATTR4_ARCHIVE" },
4951 #define FATTR4_CANSETTIME 15
4952 { FATTR4_CANSETTIME, "FATTR4_CANSETTIME" },
4953 #define FATTR4_CASE_INSENSITIVE 16
4954 { FATTR4_CASE_INSENSITIVE, "FATTR4_CASE_INSENSITIVE" },
4955 #define FATTR4_CASE_PRESERVING 17
4956 { FATTR4_CASE_PRESERVING, "FATTR4_CASE_PRESERVING" },
4957 #define FATTR4_CHOWN_RESTRICTED 18
4958 { FATTR4_CHOWN_RESTRICTED, "FATTR4_CHOWN_RESTRICTED" },
4959 #define FATTR4_FILEHANDLE 19
4960 { FATTR4_FILEHANDLE, "FATTR4_FILEHANDLE" },
4961 #define FATTR4_FILEID 20
4962 { FATTR4_FILEID, "FATTR4_FILEID" },
4963 #define FATTR4_FILES_AVAIL 21
4964 { FATTR4_FILES_AVAIL, "FATTR4_FILES_AVAIL" },
4965 #define FATTR4_FILES_FREE 22
4966 { FATTR4_FILES_FREE, "FATTR4_FILES_FREE" },
4967 #define FATTR4_FILES_TOTAL 23
4968 { FATTR4_FILES_TOTAL, "FATTR4_FILES_TOTAL" },
4969 #define FATTR4_FS_LOCATIONS 24
4970 { FATTR4_FS_LOCATIONS, "FATTR4_FS_LOCATIONS" },
4971 #define FATTR4_HIDDEN 25
4972 { FATTR4_HIDDEN, "FATTR4_HIDDEN" },
4973 #define FATTR4_HOMOGENEOUS 26
4974 { FATTR4_HOMOGENEOUS, "FATTR4_HOMOGENEOUS" },
4975 #define FATTR4_MAXFILESIZE 27
4976 { FATTR4_MAXFILESIZE, "FATTR4_MAXFILESIZE" },
4977 #define FATTR4_MAXLINK 28
4978 { FATTR4_MAXLINK, "FATTR4_MAXLINK" },
4979 #define FATTR4_MAXNAME 29
4980 { FATTR4_MAXNAME, "FATTR4_MAXNAME" },
4981 #define FATTR4_MAXREAD 30
4982 { FATTR4_MAXREAD, "FATTR4_MAXREAD" },
4983 #define FATTR4_MAXWRITE 31
4984 { FATTR4_MAXWRITE, "FATTR4_MAXWRITE" },
4985 #define FATTR4_MIMETYPE 32
4986 { FATTR4_MIMETYPE, "FATTR4_MIMETYPE" },
4987 #define FATTR4_MODE 33
4988 { FATTR4_MODE, "FATTR4_MODE" },
4989 #define FATTR4_NO_TRUNC 34
4990 { FATTR4_NO_TRUNC, "FATTR4_NO_TRUNC" },
4991 #define FATTR4_NUMLINKS 35
4992 { FATTR4_NUMLINKS, "FATTR4_NUMLINKS" },
4993 #define FATTR4_OWNER 36
4994 { FATTR4_OWNER, "FATTR4_OWNER" },
4995 #define FATTR4_OWNER_GROUP 37
4996 { FATTR4_OWNER_GROUP, "FATTR4_OWNER_GROUP" },
4997 #define FATTR4_QUOTA_AVAIL_HARD 38
4998 { FATTR4_QUOTA_AVAIL_HARD, "FATTR4_QUOTA_AVAIL_HARD" },
4999 #define FATTR4_QUOTA_AVAIL_SOFT 39
5000 { FATTR4_QUOTA_AVAIL_SOFT, "FATTR4_QUOTA_AVAIL_SOFT" },
5001 #define FATTR4_QUOTA_USED 40
5002 { FATTR4_QUOTA_USED, "FATTR4_QUOTA_USED" },
5003 #define FATTR4_RAWDEV 41
5004 { FATTR4_RAWDEV, "FATTR4_RAWDEV" },
5005 #define FATTR4_SPACE_AVAIL 42
5006 { FATTR4_SPACE_AVAIL, "FATTR4_SPACE_AVAIL" },
5007 #define FATTR4_SPACE_FREE 43
5008 { FATTR4_SPACE_FREE, "FATTR4_SPACE_FREE" },
5009 #define FATTR4_SPACE_TOTAL 44
5010 { FATTR4_SPACE_TOTAL, "FATTR4_SPACE_TOTAL" },
5011 #define FATTR4_SPACE_USED 45
5012 { FATTR4_SPACE_USED, "FATTR4_SPACE_USED" },
5013 #define FATTR4_SYSTEM 46
5014 { FATTR4_SYSTEM, "FATTR4_SYSTEM" },
5015 #define FATTR4_TIME_ACCESS 47
5016 { FATTR4_TIME_ACCESS, "FATTR4_TIME_ACCESS" },
5017 #define FATTR4_TIME_ACCESS_SET 48
5018 { FATTR4_TIME_ACCESS_SET, "FATTR4_TIME_ACCESS_SET" },
5019 #define FATTR4_TIME_BACKUP 49
5020 { FATTR4_TIME_BACKUP, "FATTR4_TIME_BACKUP" },
5021 #define FATTR4_TIME_CREATE 50
5022 { FATTR4_TIME_CREATE, "FATTR4_TIME_CREATE" },
5023 #define FATTR4_TIME_DELTA 51
5024 { FATTR4_TIME_DELTA, "FATTR4_TIME_DELTA" },
5025 #define FATTR4_TIME_METADATA 52
5026 { FATTR4_TIME_METADATA, "FATTR4_TIME_METADATA" },
5027 #define FATTR4_TIME_MODIFY 53
5028 { FATTR4_TIME_MODIFY, "FATTR4_TIME_MODIFY" },
5029 #define FATTR4_TIME_MODIFY_SET 54
5030 { FATTR4_TIME_MODIFY_SET, "FATTR4_TIME_MODIFY_SET" },
5031 #define FATTR4_MOUNTED_ON_FILEID 55
5032 { FATTR4_MOUNTED_ON_FILEID, "FATTR4_MOUNTED_ON_FILEID" },
5036 #define FATTR4_BITMAP_ONLY 0
5037 #define FATTR4_FULL_DISSECT 1
5040 dissect_nfs_attributes(tvbuff_t *tvb, int offset, packet_info *pinfo,
5041 proto_tree *tree, int type)
5044 proto_item *fitem = NULL;
5045 proto_tree *newftree = NULL;
5046 proto_item *attr_fitem = NULL;
5047 proto_tree *attr_newftree = NULL;
5053 int attr_vals_offset;
5055 bitmap_len = tvb_get_ntohl(tvb, offset);
5056 fitem = proto_tree_add_text(tree, tvb, offset, 4 + bitmap_len * 4,
5060 if (fitem == NULL) return offset;
5062 newftree = proto_item_add_subtree(fitem, ett_nfs_bitmap4);
5064 if (newftree == NULL) return offset;
5066 attr_vals_offset = offset + 4 + bitmap_len * 4;
5068 bitmap = g_malloc(bitmap_len * sizeof(guint32));
5069 if (bitmap == NULL) return offset;
5071 for (i = 0; i < bitmap_len; i++)
5073 if (!tvb_bytes_exist(tvb, offset, 4))
5079 bitmap[i] = tvb_get_ntohl(tvb, offset);
5083 for (j = 0; j < 32; j++)
5089 /* switch label if attribute is recommended vs. mandatory */
5090 attr_fitem = proto_tree_add_uint(newftree,
5091 (fattr < FATTR4_ACL)? hf_nfs_mand_attr: hf_nfs_recc_attr,
5092 tvb, offset, 4, fattr);
5094 if (attr_fitem == NULL) break;
5096 attr_newftree = proto_item_add_subtree(attr_fitem, ett_nfs_bitmap4);
5098 if (attr_newftree == NULL) break;
5100 if (type == FATTR4_FULL_DISSECT)
5102 /* do a full decode of the arguments for the set flag */
5105 case FATTR4_SUPPORTED_ATTRS:
5106 attr_vals_offset = dissect_nfs_attributes(tvb,
5107 attr_vals_offset, pinfo, attr_newftree,
5108 FATTR4_BITMAP_ONLY);
5112 attr_vals_offset = dissect_rpc_uint32(tvb,
5113 attr_newftree, hf_nfs_ftype4, attr_vals_offset);
5116 case FATTR4_FH_EXPIRE_TYPE:
5117 attr_vals_offset = dissect_nfs_fattr4_fh_expire_type(tvb,
5118 attr_vals_offset, attr_newftree);
5122 attr_vals_offset = dissect_rpc_uint64(tvb, attr_newftree,
5123 hf_nfs_changeid4, attr_vals_offset);
5127 attr_vals_offset = dissect_rpc_uint64(tvb,
5128 attr_newftree, hf_nfs_fattr4_size, attr_vals_offset);
5131 case FATTR4_LINK_SUPPORT:
5132 attr_vals_offset = dissect_rpc_bool(tvb,
5133 attr_newftree, hf_nfs_fattr4_link_support,
5137 case FATTR4_SYMLINK_SUPPORT:
5138 attr_vals_offset = dissect_rpc_bool(tvb,
5139 attr_newftree, hf_nfs_fattr4_symlink_support,
5143 case FATTR4_NAMED_ATTR:
5144 attr_vals_offset = dissect_rpc_bool(tvb,
5145 attr_newftree, hf_nfs_fattr4_named_attr, attr_vals_offset);
5149 attr_vals_offset = dissect_nfs_fsid4(tvb, attr_vals_offset,
5150 attr_newftree, "fattr4_fsid");
5153 case FATTR4_UNIQUE_HANDLES:
5154 attr_vals_offset = dissect_rpc_bool(tvb,
5155 attr_newftree, hf_nfs_fattr4_unique_handles,
5159 case FATTR4_LEASE_TIME:
5160 attr_vals_offset = dissect_rpc_uint32(tvb,
5161 attr_newftree, hf_nfs_fattr4_lease_time,
5165 case FATTR4_RDATTR_ERROR:
5166 attr_vals_offset = dissect_nfs_nfsstat4(tvb,
5167 attr_vals_offset, attr_newftree, NULL);
5171 attr_vals_offset = dissect_nfs_fattr4_acl(tvb,
5172 attr_vals_offset, pinfo, attr_newftree);
5175 case FATTR4_ACLSUPPORT:
5176 attr_vals_offset = dissect_rpc_uint32(tvb,
5177 attr_newftree, hf_nfs_fattr4_aclsupport,
5181 case FATTR4_ARCHIVE:
5182 attr_vals_offset = dissect_rpc_bool(tvb,
5183 attr_newftree, hf_nfs_fattr4_archive,
5187 case FATTR4_CANSETTIME:
5188 attr_vals_offset = dissect_rpc_bool(tvb,
5189 attr_newftree, hf_nfs_fattr4_cansettime, attr_vals_offset);
5192 case FATTR4_CASE_INSENSITIVE:
5193 attr_vals_offset = dissect_rpc_bool(tvb,
5194 attr_newftree, hf_nfs_fattr4_case_insensitive,
5198 case FATTR4_CASE_PRESERVING:
5199 attr_vals_offset = dissect_rpc_bool(tvb,
5200 attr_newftree, hf_nfs_fattr4_case_preserving,
5204 case FATTR4_CHOWN_RESTRICTED:
5205 attr_vals_offset = dissect_rpc_bool(tvb,
5206 attr_newftree, hf_nfs_fattr4_chown_restricted,
5211 attr_vals_offset = dissect_rpc_uint64(tvb,
5212 attr_newftree, hf_nfs_fattr4_fileid, attr_vals_offset);
5215 case FATTR4_FILES_AVAIL:
5216 attr_vals_offset = dissect_rpc_uint64(tvb,
5217 attr_newftree, hf_nfs_fattr4_files_avail,
5221 case FATTR4_FILEHANDLE:
5222 attr_vals_offset = dissect_nfs_fh4(tvb, attr_vals_offset,
5223 pinfo, attr_newftree, "fattr4_filehandle");
5226 case FATTR4_FILES_FREE:
5227 attr_vals_offset = dissect_rpc_uint64(tvb,
5228 attr_newftree, hf_nfs_fattr4_files_free, attr_vals_offset);
5231 case FATTR4_FILES_TOTAL:
5232 attr_vals_offset = dissect_rpc_uint64(tvb,
5233 attr_newftree, hf_nfs_fattr4_files_total,
5237 case FATTR4_FS_LOCATIONS:
5238 attr_vals_offset = dissect_nfs_fs_locations4(tvb, pinfo,
5239 attr_vals_offset, attr_newftree,
5240 "fattr4_fs_locations");
5244 attr_vals_offset = dissect_rpc_bool(tvb,
5245 attr_newftree, hf_nfs_fattr4_hidden, attr_vals_offset);
5248 case FATTR4_HOMOGENEOUS:
5249 attr_vals_offset = dissect_rpc_bool(tvb,
5250 attr_newftree, hf_nfs_fattr4_homogeneous,
5254 case FATTR4_MAXFILESIZE:
5255 attr_vals_offset = dissect_rpc_uint64(tvb,
5256 attr_newftree, hf_nfs_fattr4_maxfilesize,
5260 case FATTR4_MAXLINK:
5261 attr_vals_offset = dissect_rpc_uint32(tvb,
5262 attr_newftree, hf_nfs_fattr4_maxlink, attr_vals_offset);
5265 case FATTR4_MAXNAME:
5266 attr_vals_offset = dissect_rpc_uint32(tvb,
5267 attr_newftree, hf_nfs_fattr4_maxname, attr_vals_offset);
5270 case FATTR4_MAXREAD:
5271 attr_vals_offset = dissect_rpc_uint64(tvb,
5272 attr_newftree, hf_nfs_fattr4_maxread, attr_vals_offset);
5275 case FATTR4_MAXWRITE:
5276 attr_vals_offset = dissect_rpc_uint64(tvb,
5277 attr_newftree, hf_nfs_fattr4_maxwrite, attr_vals_offset);
5280 case FATTR4_MIMETYPE:
5281 attr_vals_offset = dissect_nfs_utf8string(tvb,
5282 attr_vals_offset, attr_newftree,
5283 hf_nfs_fattr4_mimetype, NULL);
5287 attr_vals_offset = dissect_nfs_mode4(tvb,
5288 attr_vals_offset, attr_newftree, "fattr4_mode");
5291 case FATTR4_NO_TRUNC:
5292 attr_vals_offset = dissect_rpc_bool(tvb,
5293 attr_newftree, hf_nfs_fattr4_no_trunc, attr_vals_offset);
5296 case FATTR4_NUMLINKS:
5297 attr_vals_offset = dissect_rpc_uint32(tvb,
5298 attr_newftree, hf_nfs_fattr4_numlinks, attr_vals_offset);
5302 attr_vals_offset = dissect_nfs_utf8string(tvb,
5303 attr_vals_offset, attr_newftree,
5304 hf_nfs_fattr4_owner,
5308 case FATTR4_OWNER_GROUP:
5309 attr_vals_offset = dissect_nfs_utf8string(tvb,
5310 attr_vals_offset, attr_newftree,
5311 hf_nfs_fattr4_owner_group, NULL);
5314 case FATTR4_QUOTA_AVAIL_HARD:
5315 attr_vals_offset = dissect_rpc_uint64(tvb,
5316 attr_newftree, hf_nfs_fattr4_quota_hard, attr_vals_offset);
5319 case FATTR4_QUOTA_AVAIL_SOFT:
5320 attr_vals_offset = dissect_rpc_uint64(tvb,
5321 attr_newftree, hf_nfs_fattr4_quota_soft, attr_vals_offset);
5324 case FATTR4_QUOTA_USED:
5325 attr_vals_offset = dissect_rpc_uint64(tvb,
5326 attr_newftree, hf_nfs_fattr4_quota_used, attr_vals_offset);
5330 attr_vals_offset = dissect_nfs_specdata4(tvb,
5331 attr_vals_offset, attr_newftree);
5334 case FATTR4_SPACE_AVAIL:
5335 attr_vals_offset = dissect_rpc_uint64(tvb,
5336 attr_newftree, hf_nfs_fattr4_space_avail,
5340 case FATTR4_SPACE_FREE:
5341 attr_vals_offset = dissect_rpc_uint64(tvb,
5342 attr_newftree, hf_nfs_fattr4_space_free, attr_vals_offset);
5345 case FATTR4_SPACE_TOTAL:
5346 attr_vals_offset = dissect_rpc_uint64(tvb,
5347 attr_newftree, hf_nfs_fattr4_space_total,
5351 case FATTR4_SPACE_USED:
5352 attr_vals_offset = dissect_rpc_uint64(tvb,
5353 attr_newftree, hf_nfs_fattr4_space_used, attr_vals_offset);
5357 attr_vals_offset = dissect_rpc_bool(tvb,
5358 attr_newftree, hf_nfs_fattr4_system, attr_vals_offset);
5361 case FATTR4_TIME_ACCESS:
5362 case FATTR4_TIME_BACKUP:
5363 case FATTR4_TIME_CREATE:
5364 case FATTR4_TIME_DELTA:
5365 case FATTR4_TIME_METADATA:
5366 case FATTR4_TIME_MODIFY:
5367 attr_vals_offset = dissect_nfs_nfstime4(tvb, attr_vals_offset,
5371 case FATTR4_TIME_ACCESS_SET:
5372 case FATTR4_TIME_MODIFY_SET:
5373 attr_vals_offset = dissect_nfs_settime4(tvb,
5374 attr_vals_offset, attr_newftree, "settime4");
5395 dissect_nfs_fattr4(tvbuff_t *tvb, int offset, packet_info *pinfo,
5398 proto_tree *newftree = NULL;
5399 proto_item *fitem = NULL;
5401 fitem = proto_tree_add_text(tree, tvb, offset, 4, "obj_attributes");
5403 if (fitem == NULL) return offset;
5405 newftree = proto_item_add_subtree(fitem, ett_nfs_fattr4);
5407 if (newftree == NULL) return offset;
5409 offset = dissect_nfs_attributes(tvb, offset, pinfo, newftree,
5410 FATTR4_FULL_DISSECT);
5412 offset = dissect_nfsdata(tvb, offset, tree, hf_nfs_attrlist4);
5417 static const value_string names_open4_share_access[] = {
5418 #define OPEN4_SHARE_ACCESS_READ 0x00000001
5419 { OPEN4_SHARE_ACCESS_READ, "OPEN4_SHARE_ACCESS_READ" },
5420 #define OPEN4_SHARE_ACCESS_WRITE 0x00000002
5421 { OPEN4_SHARE_ACCESS_WRITE, "OPEN4_SHARE_ACCESS_WRITE" },
5422 #define OPEN4_SHARE_ACCESS_BOTH 0x00000003
5423 { OPEN4_SHARE_ACCESS_BOTH, "OPEN4_SHARE_ACCESS_BOTH" },
5428 dissect_nfs_open4_share_access(tvbuff_t *tvb, int offset,
5433 share_access = tvb_get_ntohl(tvb, offset);
5434 proto_tree_add_uint(tree, hf_nfs_open4_share_access, tvb, offset, 4,
5441 static const value_string names_open4_share_deny[] = {
5442 #define OPEN4_SHARE_DENY_NONE 0x00000000
5443 { OPEN4_SHARE_DENY_NONE, "OPEN4_SHARE_DENY_NONE" },
5444 #define OPEN4_SHARE_DENY_READ 0x00000001
5445 { OPEN4_SHARE_DENY_READ, "OPEN4_SHARE_DENY_READ" },
5446 #define OPEN4_SHARE_DENY_WRITE 0x00000002
5447 { OPEN4_SHARE_DENY_WRITE, "OPEN4_SHARE_DENY_WRITE" },
5448 #define OPEN4_SHARE_DENY_BOTH 0x00000003
5449 { OPEN4_SHARE_DENY_BOTH, "OPEN4_SHARE_DENY_BOTH" },
5454 dissect_nfs_open4_share_deny(tvbuff_t *tvb, int offset,
5459 deny_access = tvb_get_ntohl(tvb, offset);
5460 proto_tree_add_uint(tree, hf_nfs_open4_share_deny, tvb, offset, 4,
5468 dissect_nfs_open_owner4(tvbuff_t *tvb, int offset, proto_tree *tree)
5470 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_clientid4, offset);
5471 offset = dissect_nfsdata(tvb, offset, tree, hf_nfs_open_owner4);
5477 dissect_nfs_open_claim_delegate_cur4(tvbuff_t *tvb, int offset,
5480 offset = dissect_rpc_uint64(tvb, tree,
5481 hf_nfs_stateid4_delegate_stateid, offset);
5482 offset = dissect_nfs_utf8string(tvb, offset, tree, hf_nfs_component4, NULL);
5487 #define CLAIM_NULL 0
5488 #define CLAIM_PREVIOUS 1
5489 #define CLAIM_DELEGATE_CUR 2
5490 #define CLAIM_DELEGATE_PREV 3
5492 static const value_string names_claim_type4[] = {
5493 { CLAIM_NULL, "CLAIM_NULL" },
5494 { CLAIM_PREVIOUS, "CLAIM_PREVIOUS" },
5495 { CLAIM_DELEGATE_CUR, "CLAIM_DELEGATE_CUR" },
5496 { CLAIM_DELEGATE_PREV, "CLAIM_DELEGATE_PREV" },
5501 dissect_nfs_open_claim4(tvbuff_t *tvb, int offset,
5504 guint open_claim_type4;
5505 proto_item *fitem = NULL;
5506 proto_tree *newftree = NULL;
5508 open_claim_type4 = tvb_get_ntohl(tvb, offset);
5509 fitem = proto_tree_add_uint(tree, hf_nfs_open_claim_type4, tvb,
5510 offset+0, 4, open_claim_type4);
5514 newftree = proto_item_add_subtree(fitem, ett_nfs_open_claim4);
5518 switch(open_claim_type4)
5521 offset = dissect_nfs_utf8string(tvb, offset, newftree, hf_nfs_component4, NULL);
5524 case CLAIM_PREVIOUS:
5525 offset = dissect_rpc_uint32(tvb, newftree,
5526 hf_nfs_delegate_type, offset);
5529 case CLAIM_DELEGATE_CUR:
5530 offset = dissect_nfs_open_claim_delegate_cur4(tvb, offset,
5534 case CLAIM_DELEGATE_PREV:
5535 offset = dissect_nfs_utf8string(tvb, offset, newftree, hf_nfs_component4, NULL);
5548 dissect_nfs_createhow4(tvbuff_t *tvb, int offset, packet_info *pinfo,
5553 /* This is intentional; we're using the same flags as NFSv3 */
5554 mode = tvb_get_ntohl(tvb, offset);
5555 proto_tree_add_uint(tree, hf_nfs_createmode3, tvb, offset, 4, mode);
5560 case UNCHECKED: /* UNCHECKED4 */
5561 case GUARDED: /* GUARDED4 */
5562 offset = dissect_nfs_fattr4(tvb, offset, pinfo, tree);
5565 case EXCLUSIVE: /* EXCLUSIVE4 */
5566 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_verifier4, offset);
5576 #define OPEN4_NOCREATE 0
5577 #define OPEN4_CREATE 1
5578 static const value_string names_opentype4[] = {
5579 { OPEN4_NOCREATE, "OPEN4_NOCREATE" },
5580 { OPEN4_CREATE, "OPEN4_CREATE" },
5585 dissect_nfs_openflag4(tvbuff_t *tvb, int offset, packet_info *pinfo,
5589 proto_item *fitem = NULL;
5590 proto_tree *newftree = NULL;
5592 opentype4 = tvb_get_ntohl(tvb, offset);
5593 fitem = proto_tree_add_uint(tree, hf_nfs_opentype4, tvb,
5594 offset+0, 4, opentype4);
5598 newftree = proto_item_add_subtree(fitem, ett_nfs_opentype4);
5605 offset = dissect_nfs_createhow4(tvb, offset, pinfo, newftree);
5618 dissect_nfs_clientaddr4(tvbuff_t *tvb, int offset, proto_tree *tree)
5620 offset = dissect_nfsdata(tvb, offset, tree, hf_nfs_r_netid);
5621 offset = dissect_nfsdata(tvb, offset, tree, hf_nfs_r_addr);
5628 dissect_nfs_cb_client4(tvbuff_t *tvb, int offset, proto_tree *tree)
5630 proto_tree *cb_location = NULL;
5631 proto_item *fitem = NULL;
5633 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_cb_program, offset);
5635 fitem = proto_tree_add_text(tree, tvb, offset, 0, "cb_location");
5639 cb_location = proto_item_add_subtree(fitem, ett_nfs_clientaddr4);
5641 offset = dissect_nfs_clientaddr4(tvb, offset, cb_location);
5647 static const value_string names_stable_how4[] = {
5649 { UNSTABLE4, "UNSTABLE4" },
5650 #define DATA_SYNC4 1
5651 { DATA_SYNC4, "DATA_SYNC4" },
5652 #define FILE_SYNC4 2
5653 { FILE_SYNC4, "FILE_SYNC4" },
5658 dissect_nfs_stable_how4(tvbuff_t *tvb, int offset,
5659 proto_tree *tree, char *name)
5663 stable_how4 = tvb_get_ntohl(tvb, offset);
5664 proto_tree_add_uint_format(tree, hf_nfs_stable_how4, tvb,
5665 offset+0, 4, stable_how4, "%s: %s (%u)", name,
5666 val_to_str(stable_how4, names_stable_how4, "%u"), stable_how4);
5672 static const value_string names_nfsv4_operation[] = {
5673 { NFS4_OP_ACCESS, "ACCESS" },
5674 { NFS4_OP_CLOSE, "CLOSE" },
5675 { NFS4_OP_COMMIT, "COMMIT" },
5676 { NFS4_OP_CREATE, "CREATE" },
5677 { NFS4_OP_DELEGPURGE, "DELEGPURGE" },
5678 { NFS4_OP_DELEGRETURN, "DELEGRETURN" },
5679 { NFS4_OP_GETATTR, "GETATTR" },
5680 { NFS4_OP_GETFH, "GETFH" },
5681 { NFS4_OP_LINK, "LINK" },
5682 { NFS4_OP_LOCK, "LOCK" },
5683 { NFS4_OP_LOCKT, "LOCKT" },
5684 { NFS4_OP_LOCKU, "LOCKU" },
5685 { NFS4_OP_LOOKUP, "LOOKUP" },
5686 { NFS4_OP_LOOKUPP, "LOOKUPP" },
5687 { NFS4_OP_NVERIFY, "NVERIFY" },
5688 { NFS4_OP_OPEN, "OPEN" },
5689 { NFS4_OP_OPENATTR, "OPENATTR" },
5690 { NFS4_OP_OPEN_CONFIRM, "OPEN_CONFIRM" },
5691 { NFS4_OP_OPEN_DOWNGRADE, "OPEN_DOWNGRADE" },
5692 { NFS4_OP_PUTFH, "PUTFH" },
5693 { NFS4_OP_PUTPUBFH, "PUTPUBFH" },
5694 { NFS4_OP_PUTROOTFH, "PUTROOTFH" },
5695 { NFS4_OP_READ, "READ" },
5696 { NFS4_OP_READDIR, "READDIR" },
5697 { NFS4_OP_READLINK, "READLINK" },
5698 { NFS4_OP_REMOVE, "REMOVE" },
5699 { NFS4_OP_RENAME, "RENAME" },
5700 { NFS4_OP_RENEW, "RENEW" },
5701 { NFS4_OP_RESTOREFH, "RESTOREFH" },
5702 { NFS4_OP_SAVEFH, "SAVEFH" },
5703 { NFS4_OP_SECINFO, "SECINFO" },
5704 { NFS4_OP_SETATTR, "SETATTR" },
5705 { NFS4_OP_SETCLIENTID, "SETCLIENTID" },
5706 { NFS4_OP_SETCLIENTID_CONFIRM, "SETCLIENTID_CONFIRM" },
5707 { NFS4_OP_VERIFY, "VERIFY" },
5708 { NFS4_OP_WRITE, "WRITE" },
5712 gint *nfsv4_operation_ett[] =
5718 &ett_nfs_delegpurge4 ,
5719 &ett_nfs_delegreturn4 ,
5730 &ett_nfs_openattr4 ,
5731 &ett_nfs_open_confirm4 ,
5732 &ett_nfs_open_downgrade4 ,
5734 &ett_nfs_putpubfh4 ,
5735 &ett_nfs_putrootfh4 ,
5738 &ett_nfs_readlink4 ,
5742 &ett_nfs_restorefh4 ,
5746 &ett_nfs_setclientid4 ,
5747 &ett_nfs_setclientid_confirm4 ,
5753 dissect_nfs_entry4(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
5756 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_cookie4, offset);
5757 offset = dissect_nfs_utf8string(tvb, offset, tree, hf_nfs_component4, NULL);
5758 offset = dissect_nfs_fattr4(tvb, offset, pinfo, tree);
5764 dissect_nfs_dirlist4(tvbuff_t *tvb, int offset, packet_info *pinfo,
5767 proto_tree *newftree = NULL;
5769 newftree = proto_item_add_subtree(tree, ett_nfs_dirlist4);
5770 if (newftree==NULL) return offset;
5772 offset = dissect_rpc_list(tvb, pinfo, tree, offset, dissect_nfs_entry4);
5773 offset = dissect_rpc_bool(tvb, newftree, hf_nfs_dirlist4_eof, offset);
5779 dissect_nfs_change_info4(tvbuff_t *tvb, int offset,
5780 proto_tree *tree, char *name)
5782 proto_tree *newftree = NULL;
5783 proto_tree *fitem = NULL;
5785 fitem = proto_tree_add_text(tree, tvb, offset, 0, "%s", name);
5788 newftree = proto_item_add_subtree(fitem, ett_nfs_change_info4);
5791 offset = dissect_rpc_bool(tvb, newftree,
5792 hf_nfs_change_info4_atomic, offset);
5793 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_changeid4_before,
5795 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_changeid4_after,
5803 static const value_string names_nfs_lock_type4[] =
5806 { READ_LT, "READ_LT" },
5808 { WRITE_LT, "WRITE_LT" },
5810 { READW_LT, "READW_LT" },
5812 { WRITEW_LT, "WRITEW_LT" },
5813 #define RELEASE_STATE 5
5814 { RELEASE_STATE, "RELEASE_STATE" },
5819 dissect_nfs_lock4denied(tvbuff_t *tvb, int offset, proto_tree *tree)
5821 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_offset4, offset);
5822 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_length4, offset);
5823 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_lock_type4, offset);
5824 offset = dissect_nfs_lock_owner4(tvb, offset, tree);
5830 static const value_string names_open4_result_flags[] = {
5831 #define OPEN4_RESULT_MLOCK 0x00000001
5832 { OPEN4_RESULT_MLOCK, "OPEN4_RESULT_MLOCK" },
5833 #define OPEN4_RESULT_CONFIRM 0x00000002
5834 { OPEN4_RESULT_CONFIRM, "OPEN4_RESULT_CONFIRM" },
5839 dissect_nfs_open4_rflags(tvbuff_t *tvb, int offset,
5840 proto_tree *tree, char *name)
5843 proto_item *rflags_item = NULL;
5844 proto_item *rflags_tree = NULL;
5846 rflags = tvb_get_ntohl(tvb, offset);
5850 rflags_item = proto_tree_add_text(tree, tvb, offset, 4,
5851 "%s: 0x%08x", name, rflags);
5855 rflags_tree = proto_item_add_subtree(rflags_item,
5856 ett_nfs_open4_result_flags);
5860 proto_tree_add_text(rflags_tree, tvb, offset, 4, "%s",
5861 decode_enumerated_bitfield(rflags, OPEN4_RESULT_MLOCK, 2,
5862 names_open4_result_flags, "%s"));
5864 proto_tree_add_text(rflags_tree, tvb, offset, 4, "%s",
5865 decode_enumerated_bitfield(rflags, OPEN4_RESULT_CONFIRM, 2,
5866 names_open4_result_flags, "%s"));
5877 dissect_nfs_stateid4(tvbuff_t *tvb, int offset,
5880 proto_item *fitem = NULL;
5881 proto_tree *newftree = NULL;
5884 gboolean first_line;
5886 fitem = proto_tree_add_text(tree, tvb, offset, 4, "stateid");
5889 newftree = proto_item_add_subtree(fitem, ett_nfs_stateid4);
5891 offset = dissect_rpc_uint32(tvb, newftree, hf_nfs_seqid4,
5897 while (bytes_left != 0)
5900 if (sublen > bytes_left)
5901 sublen = bytes_left;
5903 proto_tree_add_text(newftree, tvb, offset, sublen, "%s%s",
5904 first_line ? "other: " : " ",
5905 tvb_bytes_to_str(tvb, offset, sublen));
5907 bytes_left -= sublen;
5918 dissect_nfs_open_read_delegation4(tvbuff_t *tvb, int offset,
5919 packet_info *pinfo, proto_tree *tree)
5921 offset = dissect_nfs_stateid4(tvb, offset, tree);
5922 offset = dissect_rpc_bool(tvb, tree, hf_nfs_recall4, offset);
5923 offset = dissect_nfs_ace4(tvb, offset, pinfo, tree);
5929 dissect_nfs_modified_limit4(tvbuff_t *tvb, int offset, proto_tree *tree)
5931 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_num_blocks, offset);
5932 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_bytes_per_block, offset);
5937 #define NFS_LIMIT_SIZE 1
5938 #define NFS_LIMIT_BLOCKS 2
5939 static const value_string names_limit_by4[] = {
5940 { NFS_LIMIT_SIZE, "NFS_LIMIT_SIZE" },
5941 { NFS_LIMIT_BLOCKS, "NFS_LIMIT_BLOCKS" },
5946 dissect_nfs_space_limit4(tvbuff_t *tvb, int offset,
5951 limitby = tvb_get_ntohl(tvb, offset);
5952 proto_tree_add_uint(tree, hf_nfs_limit_by4, tvb, offset+0, 4, limitby);
5957 case NFS_LIMIT_SIZE:
5958 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_filesize,
5962 case NFS_LIMIT_BLOCKS:
5963 offset = dissect_nfs_modified_limit4(tvb, offset, tree);
5974 dissect_nfs_open_write_delegation4(tvbuff_t *tvb, int offset,
5975 packet_info *pinfo, proto_tree *tree)
5977 offset = dissect_nfs_stateid4(tvb, offset, tree);
5978 offset = dissect_rpc_bool(tvb, tree, hf_nfs_recall, offset);
5979 offset = dissect_nfs_space_limit4(tvb, offset, tree);
5980 offset = dissect_nfs_ace4(tvb, offset, pinfo, tree);
5985 #define OPEN_DELEGATE_NONE 0
5986 #define OPEN_DELEGATE_READ 1
5987 #define OPEN_DELEGATE_WRITE 2
5988 static const value_string names_open_delegation_type4[] = {
5989 { OPEN_DELEGATE_NONE, "OPEN_DELEGATE_NONE" },
5990 { OPEN_DELEGATE_READ, "OPEN_DELEGATE_READ" },
5991 { OPEN_DELEGATE_WRITE, "OPEN_DELEGATE_WRITE" },
5996 dissect_nfs_open_delegation4(tvbuff_t *tvb, int offset, packet_info *pinfo,
5999 guint delegation_type;
6000 proto_tree *newftree = NULL;
6001 proto_item *fitem = NULL;
6003 delegation_type = tvb_get_ntohl(tvb, offset);
6004 proto_tree_add_uint(tree, hf_nfs_open_delegation_type4, tvb, offset+0,
6005 4, delegation_type);
6009 newftree = proto_item_add_subtree(fitem, ett_nfs_open_delegation4);
6011 switch(delegation_type)
6013 case OPEN_DELEGATE_NONE:
6016 case OPEN_DELEGATE_READ:
6017 offset = dissect_nfs_open_read_delegation4(tvb, offset, pinfo,
6021 case OPEN_DELEGATE_WRITE:
6022 offset = dissect_nfs_open_write_delegation4(tvb, offset, pinfo,
6035 dissect_nfs_rpcsec_gss_info(tvbuff_t *tvb, int offset, proto_tree *tree)
6037 offset = dissect_rpc_opaque_data(tvb, offset, tree, NULL,
6038 hf_nfs_sec_oid4, FALSE, 0, FALSE, NULL, NULL);
6039 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_qop4, offset);
6040 offset = dissect_rpc_uint32(tvb, tree,
6041 hf_nfs_secinfo_rpcsec_gss_info_service, offset);
6047 dissect_nfs_open_to_lock_owner4(tvbuff_t *tvb, int offset, proto_tree *tree)
6049 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_seqid4, offset);
6050 offset = dissect_nfs_stateid4(tvb, offset, tree);
6051 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_lock_seqid4, offset);
6052 offset = dissect_nfs_lock_owner4(tvb, offset, tree);
6058 dissect_nfs_exist_lock_owner4(tvbuff_t *tvb, int offset, proto_tree *tree)
6060 offset = dissect_nfs_stateid4(tvb, offset, tree);
6061 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_lock_seqid4, offset);
6067 dissect_nfs_locker4(tvbuff_t *tvb, int offset, proto_tree *tree)
6069 guint new_lock_owner;
6071 new_lock_owner = tvb_get_ntohl(tvb, offset);
6072 offset = dissect_rpc_bool(tvb, tree, hf_nfs_new_lock_owner, offset);
6075 offset = dissect_nfs_open_to_lock_owner4(tvb, offset, tree);
6077 offset = dissect_nfs_exist_lock_owner4(tvb, offset, tree);
6083 dissect_nfs_client_id4(tvbuff_t *tvb, int offset, proto_tree *tree)
6085 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_verifier4, offset);
6086 offset = dissect_rpc_data(tvb, tree, hf_nfs_client_id4_id, offset);
6092 dissect_nfs_argop4(tvbuff_t *tvb, int offset, packet_info *pinfo,
6095 guint32 ops, ops_counter;
6098 proto_tree *ftree = NULL;
6099 proto_tree *newftree = NULL;
6101 ops = tvb_get_ntohl(tvb, offset+0);
6103 fitem = proto_tree_add_text(tree, tvb, offset, 4,
6104 "Operations (count: %u)", ops);
6107 if (fitem == NULL) return offset;
6109 ftree = proto_item_add_subtree(fitem, ett_nfs_argop4);
6111 if (ftree == NULL) return offset;
6113 for (ops_counter=0; ops_counter<ops; ops_counter++)
6115 opcode = tvb_get_ntohl(tvb, offset);
6117 fitem = proto_tree_add_uint(ftree, hf_nfs_argop4, tvb, offset, 4,
6121 if (opcode < NFS4_OP_ACCESS || opcode > NFS4_OP_WRITE)
6124 if (fitem == NULL) break;
6126 newftree = proto_item_add_subtree(fitem, *nfsv4_operation_ett[opcode-3]);
6127 if (newftree == NULL) break;
6131 case NFS4_OP_ACCESS:
6132 offset = dissect_access(tvb, offset, newftree, "access");
6136 offset = dissect_rpc_uint32(tvb, newftree, hf_nfs_seqid4,
6138 offset = dissect_nfs_stateid4(tvb, offset, newftree);
6141 case NFS4_OP_COMMIT:
6142 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_offset4,
6144 offset = dissect_rpc_uint32(tvb, newftree, hf_nfs_count4,
6148 case NFS4_OP_CREATE:
6152 create_type = tvb_get_ntohl(tvb, offset);
6153 offset = dissect_rpc_uint32(tvb, newftree, hf_nfs_ftype4,
6159 offset = dissect_nfs_utf8string(tvb, offset, newftree,
6160 hf_nfs_linktext4, NULL);
6165 offset = dissect_nfs_specdata4(tvb, offset, newftree);
6177 offset = dissect_nfs_utf8string(tvb, offset, newftree, hf_nfs_component4, NULL);
6179 offset = dissect_nfs_fattr4(tvb, offset, pinfo, newftree);
6183 case NFS4_OP_DELEGPURGE:
6184 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_clientid4, offset);
6187 case NFS4_OP_DELEGRETURN:
6188 offset = dissect_nfs_stateid4(tvb, offset, newftree);
6191 case NFS4_OP_GETATTR:
6192 offset = dissect_nfs_attributes(tvb, offset, pinfo, newftree,
6193 FATTR4_BITMAP_ONLY);
6200 offset = dissect_nfs_utf8string(tvb, offset, newftree,
6201 hf_nfs_component4, NULL);
6205 offset = dissect_rpc_uint32(tvb, newftree, hf_nfs_lock_type4, offset);
6206 offset = dissect_rpc_bool(tvb, newftree, hf_nfs_lock4_reclaim, offset);
6207 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_offset4, offset);
6208 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_length4, offset);
6209 offset = dissect_nfs_locker4(tvb, offset, newftree);
6213 offset = dissect_rpc_uint32(tvb, newftree, hf_nfs_lock_type4, offset);
6214 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_offset4, offset);
6215 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_length4, offset);
6216 offset = dissect_nfs_lock_owner4(tvb, offset, newftree);
6220 offset = dissect_rpc_uint32(tvb, newftree, hf_nfs_lock_type4, offset);
6221 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_seqid4, offset);
6222 offset = dissect_nfs_stateid4(tvb, offset, newftree);
6223 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_offset4, offset);
6224 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_length4, offset);
6227 case NFS4_OP_LOOKUP:
6228 offset = dissect_nfs_utf8string(tvb, offset, newftree,
6229 hf_nfs_component4, NULL);
6232 case NFS4_OP_LOOKUPP:
6235 case NFS4_OP_NVERIFY:
6236 offset = dissect_nfs_fattr4(tvb, offset, pinfo, newftree);
6240 offset = dissect_rpc_uint32(tvb, newftree, hf_nfs_seqid4,
6242 offset = dissect_nfs_open4_share_access(tvb, offset, newftree);
6243 offset = dissect_nfs_open4_share_deny(tvb, offset, newftree);
6244 offset = dissect_nfs_open_owner4(tvb, offset, newftree);
6245 offset = dissect_nfs_openflag4(tvb, offset, pinfo, newftree);
6246 offset = dissect_nfs_open_claim4(tvb, offset, newftree);
6249 case NFS4_OP_OPENATTR:
6250 offset = dissect_rpc_bool(tvb, newftree, hf_nfs_attrdircreate,
6254 case NFS4_OP_OPEN_CONFIRM:
6255 offset = dissect_nfs_stateid4(tvb, offset, newftree);
6256 offset = dissect_rpc_uint32(tvb, newftree, hf_nfs_seqid4,
6260 case NFS4_OP_OPEN_DOWNGRADE:
6261 offset = dissect_nfs_stateid4(tvb, offset, newftree);
6262 offset = dissect_rpc_uint32(tvb, newftree, hf_nfs_seqid4,
6264 offset = dissect_nfs_open4_share_access(tvb, offset, newftree);
6265 offset = dissect_nfs_open4_share_deny(tvb, offset, newftree);
6269 offset = dissect_nfs_fh4(tvb, offset, pinfo, newftree, "filehandle");
6272 case NFS4_OP_PUTPUBFH:
6273 case NFS4_OP_PUTROOTFH:
6277 offset = dissect_nfs_stateid4(tvb, offset, newftree);
6278 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_offset4,
6280 offset = dissect_rpc_uint32(tvb, newftree, hf_nfs_count4,
6284 case NFS4_OP_READDIR:
6285 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_cookie4,
6287 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_cookieverf4,
6289 offset = dissect_rpc_uint32(tvb, newftree,
6290 hf_nfs_count4_dircount, offset);
6291 offset = dissect_rpc_uint32(tvb, newftree,
6292 hf_nfs_count4_maxcount, offset);
6293 offset = dissect_nfs_attributes(tvb, offset, pinfo, newftree,
6294 FATTR4_BITMAP_ONLY);
6297 case NFS4_OP_READLINK:
6300 case NFS4_OP_REMOVE:
6301 offset = dissect_nfs_utf8string(tvb, offset, newftree,
6302 hf_nfs_component4, NULL);
6305 case NFS4_OP_RENAME:
6306 offset = dissect_nfs_utf8string(tvb, offset, newftree,
6307 hf_nfs_component4, NULL);
6308 offset = dissect_nfs_utf8string(tvb, offset, newftree,
6309 hf_nfs_component4, NULL);
6313 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_clientid4, offset);
6316 case NFS4_OP_RESTOREFH:
6317 case NFS4_OP_SAVEFH:
6320 case NFS4_OP_SECINFO:
6321 offset = dissect_nfs_utf8string(tvb, offset, newftree,
6322 hf_nfs_component4, NULL);
6325 case NFS4_OP_SETATTR:
6326 offset = dissect_nfs_stateid4(tvb, offset, newftree);
6327 offset = dissect_nfs_fattr4(tvb, offset, pinfo, newftree);
6330 case NFS4_OP_SETCLIENTID:
6332 proto_tree *client_tree = NULL;
6333 proto_tree *callback_tree = NULL;
6335 fitem = proto_tree_add_text(newftree, tvb, offset, 0, "client");
6338 client_tree = proto_item_add_subtree(fitem, ett_nfs_client_id4);
6341 offset = dissect_nfs_client_id4(tvb, offset, client_tree);
6344 fitem = proto_tree_add_text(newftree, tvb, offset, 0, "callback");
6347 callback_tree = proto_item_add_subtree(fitem,
6348 ett_nfs_cb_client4);
6351 offset = dissect_nfs_cb_client4(tvb, offset, callback_tree);
6354 offset = dissect_rpc_uint32(tvb, newftree, hf_nfs_callback_ident,
6359 case NFS4_OP_SETCLIENTID_CONFIRM:
6360 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_clientid4, offset);
6361 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_verifier4, offset);
6364 case NFS4_OP_VERIFY:
6365 offset = dissect_nfs_fattr4(tvb, offset, pinfo, newftree);
6369 offset = dissect_nfs_stateid4(tvb, offset, newftree);
6370 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_offset4, offset);
6371 offset = dissect_nfs_stable_how4(tvb, offset, newftree, "stable");
6372 offset = dissect_nfsdata(tvb, offset, newftree, hf_nfs_data);
6384 dissect_nfs4_compound_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
6387 offset = dissect_nfs_utf8string(tvb, offset, tree, hf_nfs_tag4, NULL);
6388 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_minorversion, offset);
6389 offset = dissect_nfs_argop4(tvb, offset, pinfo, tree);
6395 dissect_nfs_secinfo4_res(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
6400 proto_tree *secftree;
6402 flavor = tvb_get_ntohl(tvb, offset);
6403 fitem = proto_tree_add_uint(tree, hf_nfs_secinfo_flavor, tvb, offset, 4,
6412 secftree = proto_item_add_subtree(fitem, ett_nfs_secinfo4_flavor_info);
6414 offset = dissect_nfs_rpcsec_gss_info(tvb, offset, secftree);
6426 dissect_nfs_resop4(tvbuff_t *tvb, int offset, packet_info *pinfo,
6429 guint32 ops, ops_counter;
6432 proto_tree *ftree = NULL;
6433 proto_tree *newftree = NULL;
6436 ops = tvb_get_ntohl(tvb, offset+0);
6438 fitem = proto_tree_add_text(tree, tvb, offset, 4,
6439 "Operations (count: %u)", ops);
6442 if (fitem == NULL) return offset;
6444 ftree = proto_item_add_subtree(fitem, ett_nfs_resop4);
6446 if (ftree == NULL) return offset; /* error adding new subtree */
6448 for (ops_counter = 0; ops_counter < ops; ops_counter++)
6450 opcode = tvb_get_ntohl(tvb, offset);
6452 /* sanity check for bogus packets */
6453 if (opcode < NFS4_OP_ACCESS || opcode > NFS4_OP_WRITE) break;
6455 fitem = proto_tree_add_uint(ftree, hf_nfs_resop4, tvb, offset, 4,
6459 if (fitem == NULL) break; /* error adding new item to tree */
6461 newftree = proto_item_add_subtree(fitem, *nfsv4_operation_ett[opcode-3]);
6463 if (newftree == NULL)
6464 break; /* error adding new subtree to operation item */
6466 offset = dissect_nfs_nfsstat4(tvb, offset, newftree, &status);
6469 * With the exception of NFS4_OP_LOCK, NFS4_OP_LOCKT, and
6470 * NFS4_OP_SETATTR, all other ops do *not* return data with the
6471 * failed status code.
6473 if ((status != NFS4_OK) &&
6474 ((opcode != NFS4_OP_LOCK) && (opcode != NFS4_OP_LOCKT) &&
6475 (opcode != NFS4_OP_SETATTR)))
6478 /* These parsing routines are only executed if the status is NFS4_OK */
6481 case NFS4_OP_ACCESS:
6482 offset = dissect_access(tvb, offset, newftree, "Supported");
6483 offset = dissect_access(tvb, offset, newftree, "Access");
6487 offset = dissect_nfs_stateid4(tvb, offset, newftree);
6490 case NFS4_OP_COMMIT:
6491 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_verifier4,
6495 case NFS4_OP_CREATE:
6496 offset = dissect_nfs_change_info4(tvb, offset, newftree,
6498 offset = dissect_nfs_attributes(tvb, offset, pinfo, newftree,
6499 FATTR4_BITMAP_ONLY);
6502 case NFS4_OP_GETATTR:
6503 offset = dissect_nfs_fattr4(tvb, offset, pinfo, newftree);
6507 offset = dissect_nfs_fh4(tvb, offset, pinfo, newftree, "Filehandle");
6511 offset = dissect_nfs_change_info4(tvb, offset, newftree,
6517 if (status == NFS4_OK)
6519 if (opcode == NFS4_OP_LOCK)
6520 offset = dissect_nfs_stateid4(tvb, offset, newftree);
6523 if (status == NFS4ERR_DENIED)
6524 offset = dissect_nfs_lock4denied(tvb, offset, newftree);
6528 offset = dissect_nfs_stateid4(tvb, offset, newftree);
6532 offset = dissect_nfs_stateid4(tvb, offset, newftree);
6533 offset = dissect_nfs_change_info4(tvb, offset, newftree,
6535 offset = dissect_nfs_open4_rflags(tvb, offset, newftree,
6537 offset = dissect_nfs_attributes(tvb, offset, pinfo, newftree,
6538 FATTR4_BITMAP_ONLY);
6539 offset = dissect_nfs_open_delegation4(tvb, offset, pinfo, newftree);
6542 case NFS4_OP_OPEN_CONFIRM:
6543 case NFS4_OP_OPEN_DOWNGRADE:
6544 offset = dissect_nfs_stateid4(tvb, offset, newftree);
6548 offset = dissect_rpc_uint32(tvb, newftree, hf_nfs_eof, offset);
6549 offset = dissect_nfsdata(tvb, offset, newftree, hf_nfs_data);
6552 case NFS4_OP_READDIR:
6553 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_verifier4, offset);
6554 offset = dissect_nfs_dirlist4(tvb, offset, pinfo, newftree);
6557 case NFS4_OP_READLINK:
6558 offset = dissect_nfs_utf8string(tvb, offset, newftree,
6559 hf_nfs_linktext4, NULL);
6562 case NFS4_OP_REMOVE:
6563 offset = dissect_nfs_change_info4(tvb, offset, newftree,
6567 case NFS4_OP_RENAME:
6568 offset = dissect_nfs_change_info4(tvb, offset, newftree,
6570 offset = dissect_nfs_change_info4(tvb, offset, newftree,
6574 case NFS4_OP_SECINFO:
6575 offset = dissect_rpc_array(tvb, pinfo, newftree, offset,
6576 dissect_nfs_secinfo4_res, hf_nfs_secinfo_arr4);
6579 case NFS4_OP_SETATTR:
6580 offset = dissect_nfs_attributes(tvb, offset, pinfo, newftree,
6581 FATTR4_BITMAP_ONLY);
6584 case NFS4_OP_SETCLIENTID:
6585 if (status == NFS4_OK)
6587 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_clientid4,
6589 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_verifier4,
6593 if (status == NFS4ERR_CLID_INUSE)
6594 offset = dissect_nfs_clientaddr4(tvb, offset, newftree);
6598 offset = dissect_rpc_uint32(tvb, newftree, hf_nfs_count4,
6600 offset = dissect_nfs_stable_how4(tvb, offset, newftree,
6602 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_verifier4,
6615 dissect_nfs4_compound_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
6620 offset = dissect_nfs_nfsstat4(tvb, offset, tree, &status);
6621 offset = dissect_nfs_utf8string(tvb, offset, tree, hf_nfs_tag4, NULL);
6622 offset = dissect_nfs_resop4(tvb, offset, pinfo, tree);
6628 /* proc number, "proc name", dissect_request, dissect_reply */
6629 /* NULL as function pointer means: type of arguments is "void". */
6630 static const vsff nfs3_proc[] = {
6631 { 0, "NULL", /* OK */
6633 { 1, "GETATTR", /* OK */
6634 dissect_nfs3_getattr_call, dissect_nfs3_getattr_reply },
6635 { 2, "SETATTR", /* OK */
6636 dissect_nfs3_setattr_call, dissect_nfs3_setattr_reply },
6637 { 3, "LOOKUP", /* OK */
6638 dissect_nfs3_lookup_call, dissect_nfs3_lookup_reply },
6639 { 4, "ACCESS", /* OK */
6640 dissect_nfs3_access_call, dissect_nfs3_access_reply },
6641 { 5, "READLINK", /* OK */
6642 dissect_nfs3_nfs_fh3_call, dissect_nfs3_readlink_reply },
6643 { 6, "READ", /* OK */
6644 dissect_nfs3_read_call, dissect_nfs3_read_reply },
6645 { 7, "WRITE", /* OK */
6646 dissect_nfs3_write_call, dissect_nfs3_write_reply },
6647 { 8, "CREATE", /* OK */
6648 dissect_nfs3_create_call, dissect_nfs3_create_reply },
6649 { 9, "MKDIR", /* OK */
6650 dissect_nfs3_mkdir_call, dissect_nfs3_create_reply },
6651 { 10, "SYMLINK", /* OK */
6652 dissect_nfs3_symlink_call, dissect_nfs3_create_reply },
6653 { 11, "MKNOD", /* OK */
6654 dissect_nfs3_mknod_call, dissect_nfs3_create_reply },
6655 { 12, "REMOVE", /* OK */
6656 dissect_nfs3_diropargs3_call, dissect_nfs3_remove_reply },
6657 { 13, "RMDIR", /* OK */
6658 dissect_nfs3_diropargs3_call, dissect_nfs3_remove_reply },
6659 { 14, "RENAME", /* OK */
6660 dissect_nfs3_rename_call, dissect_nfs3_rename_reply },
6661 { 15, "LINK", /* OK */
6662 dissect_nfs3_link_call, dissect_nfs3_link_reply },
6663 { 16, "READDIR", /* OK */
6664 dissect_nfs3_readdir_call, dissect_nfs3_readdir_reply },
6665 { 17, "READDIRPLUS", /* OK */
6666 dissect_nfs3_readdirplus_call, dissect_nfs3_readdirplus_reply },
6667 { 18, "FSSTAT", /* OK */
6668 dissect_nfs3_nfs_fh3_call, dissect_nfs3_fsstat_reply },
6669 { 19, "FSINFO", /* OK */
6670 dissect_nfs3_nfs_fh3_call, dissect_nfs3_fsinfo_reply },
6671 { 20, "PATHCONF", /* OK */
6672 dissect_nfs3_nfs_fh3_call, dissect_nfs3_pathconf_reply },
6673 { 21, "COMMIT", /* OK */
6674 dissect_nfs3_commit_call, dissect_nfs3_commit_reply },
6675 { 0,NULL,NULL,NULL }
6678 static const value_string nfsv3_proc_vals[] = {
6696 { 17, "READDIRPLUS" },
6704 /* end of NFS Version 3 */
6706 static const vsff nfs4_proc[] = {
6710 dissect_nfs4_compound_call, dissect_nfs4_compound_reply },
6711 { 0, NULL, NULL, NULL }
6714 static const value_string nfsv4_proc_vals[] = {
6720 static struct true_false_string yesno = { "Yes", "No" };
6724 proto_register_nfs(void)
6726 static hf_register_info hf[] = {
6727 { &hf_nfs_procedure_v2, {
6728 "V2 Procedure", "nfs.procedure_v2", FT_UINT32, BASE_DEC,
6729 VALS(nfsv2_proc_vals), 0, "V2 Procedure", HFILL }},
6730 { &hf_nfs_procedure_v3, {
6731 "V3 Procedure", "nfs.procedure_v3", FT_UINT32, BASE_DEC,
6732 VALS(nfsv3_proc_vals), 0, "V3 Procedure", HFILL }},
6733 { &hf_nfs_procedure_v4, {
6734 "V4 Procedure", "nfs.procedure_v4", FT_UINT32, BASE_DEC,
6735 VALS(nfsv4_proc_vals), 0, "V4 Procedure", HFILL }},
6736 { &hf_nfs_fh_length, {
6737 "length", "nfs.fh.length", FT_UINT32, BASE_DEC,
6738 NULL, 0, "file handle length", HFILL }},
6739 { &hf_nfs_fh_hash, {
6740 "hash", "nfs.fh.hash", FT_UINT32, BASE_HEX,
6741 NULL, 0, "file handle hash", HFILL }},
6742 { &hf_nfs_fh_fsid_major, {
6743 "major", "nfs.fh.fsid.major", FT_UINT32, BASE_DEC,
6744 NULL, 0, "major file system ID", HFILL }},
6745 { &hf_nfs_fh_fsid_minor, {
6746 "minor", "nfs.fh.fsid.minor", FT_UINT32, BASE_DEC,
6747 NULL, 0, "minor file system ID", HFILL }},
6748 { &hf_nfs_fh_fsid_inode, {
6749 "inode", "nfs.fh.fsid.inode", FT_UINT32, BASE_DEC,
6750 NULL, 0, "file system inode", HFILL }},
6751 { &hf_nfs_fh_xfsid_major, {
6752 "exported major", "nfs.fh.xfsid.major", FT_UINT32, BASE_DEC,
6753 NULL, 0, "exported major file system ID", HFILL }},
6754 { &hf_nfs_fh_xfsid_minor, {
6755 "exported minor", "nfs.fh.xfsid.minor", FT_UINT32, BASE_DEC,
6756 NULL, 0, "exported minor file system ID", HFILL }},
6757 { &hf_nfs_fh_fstype, {
6758 "file system type", "nfs.fh.fstype", FT_UINT32, BASE_DEC,
6759 NULL, 0, "file system type", HFILL }},
6761 "file number", "nfs.fh.fn", FT_UINT32, BASE_DEC,
6762 NULL, 0, "file number", HFILL }},
6763 { &hf_nfs_fh_fn_len, {
6764 "length", "nfs.fh.fn.len", FT_UINT32, BASE_DEC,
6765 NULL, 0, "file number length", HFILL }},
6766 { &hf_nfs_fh_fn_inode, {
6767 "inode", "nfs.fh.fn.inode", FT_UINT32, BASE_DEC,
6768 NULL, 0, "file number inode", HFILL }},
6769 { &hf_nfs_fh_fn_generation, {
6770 "generation", "nfs.fh.fn.generation", FT_UINT32, BASE_DEC,
6771 NULL, 0, "file number generation", HFILL }},
6773 "exported file number", "nfs.fh.xfn", FT_UINT32, BASE_DEC,
6774 NULL, 0, "exported file number", HFILL }},
6775 { &hf_nfs_fh_xfn_len, {
6776 "length", "nfs.fh.xfn.len", FT_UINT32, BASE_DEC,
6777 NULL, 0, "exported file number length", HFILL }},
6778 { &hf_nfs_fh_xfn_inode, {
6779 "exported inode", "nfs.fh.xfn.inode", FT_UINT32, BASE_DEC,
6780 NULL, 0, "exported file number inode", HFILL }},
6781 { &hf_nfs_fh_xfn_generation, {
6782 "generation", "nfs.fh.xfn.generation", FT_UINT32, BASE_DEC,
6783 NULL, 0, "exported file number generation", HFILL }},
6784 { &hf_nfs_fh_dentry, {
6785 "dentry", "nfs.fh.dentry", FT_UINT32, BASE_HEX,
6786 NULL, 0, "dentry (cookie)", HFILL }},
6788 "device", "nfs.fh.dev", FT_UINT32, BASE_DEC,
6789 NULL, 0, "device", HFILL }},
6790 { &hf_nfs_fh_xdev, {
6791 "exported device", "nfs.fh.xdev", FT_UINT32, BASE_DEC,
6792 NULL, 0, "exported device", HFILL }},
6793 { &hf_nfs_fh_dirinode, {
6794 "directory inode", "nfs.fh.dirinode", FT_UINT32, BASE_DEC,
6795 NULL, 0, "directory inode", HFILL }},
6796 { &hf_nfs_fh_pinode, {
6797 "pseudo inode", "nfs.fh.pinode", FT_UINT32, BASE_HEX,
6798 NULL, 0, "pseudo inode", HFILL }},
6799 { &hf_nfs_fh_hp_len, {
6800 "length", "nfs.fh.hp.len", FT_UINT32, BASE_DEC,
6801 NULL, 0, "hash path length", HFILL }},
6802 { &hf_nfs_fh_version, {
6803 "version", "nfs.fh.version", FT_UINT8, BASE_DEC,
6804 NULL, 0, "file handle layout version", HFILL }},
6805 { &hf_nfs_fh_auth_type, {
6806 "auth_type", "nfs.fh.auth_type", FT_UINT8, BASE_DEC,
6807 VALS(auth_type_names), 0, "authentication type", HFILL }},
6808 { &hf_nfs_fh_fsid_type, {
6809 "fsid_type", "nfs.fh.fsid_type", FT_UINT8, BASE_DEC,
6810 VALS(fsid_type_names), 0, "file system ID type", HFILL }},
6811 { &hf_nfs_fh_fileid_type, {
6812 "fileid_type", "nfs.fh.fileid_type", FT_UINT8, BASE_DEC,
6813 VALS(fileid_type_names), 0, "file ID type", HFILL }},
6815 "Status", "nfs.status2", FT_UINT32, BASE_DEC,
6816 VALS(names_nfs_stat), 0, "Reply status", HFILL }},
6817 { &hf_nfs_full_name, {
6818 "Full Name", "nfs.full_name", FT_STRING, BASE_DEC,
6819 NULL, 0, "Full Name", HFILL }},
6821 "Name", "nfs.name", FT_STRING, BASE_DEC,
6822 NULL, 0, "Name", HFILL }},
6823 { &hf_nfs_readlink_data, {
6824 "Data", "nfs.readlink.data", FT_STRING, BASE_DEC,
6825 NULL, 0, "Symbolic Link Data", HFILL }},
6826 { &hf_nfs_read_offset, {
6827 "Offset", "nfs.read.offset", FT_UINT32, BASE_DEC,
6828 NULL, 0, "Read Offset", HFILL }},
6829 { &hf_nfs_read_count, {
6830 "Count", "nfs.read.count", FT_UINT32, BASE_DEC,
6831 NULL, 0, "Read Count", HFILL }},
6832 { &hf_nfs_read_totalcount, {
6833 "Total Count", "nfs.read.totalcount", FT_UINT32, BASE_DEC,
6834 NULL, 0, "Total Count (obsolete)", HFILL }},
6836 "Data", "nfs.data", FT_BYTES, BASE_DEC,
6837 NULL, 0, "Data", HFILL }},
6838 { &hf_nfs_write_beginoffset, {
6839 "Begin Offset", "nfs.write.beginoffset", FT_UINT32, BASE_DEC,
6840 NULL, 0, "Begin offset (obsolete)", HFILL }},
6841 { &hf_nfs_write_offset, {
6842 "Offset", "nfs.write.offset", FT_UINT32, BASE_DEC,
6843 NULL, 0, "Offset", HFILL }},
6844 { &hf_nfs_write_totalcount, {
6845 "Total Count", "nfs.write.totalcount", FT_UINT32, BASE_DEC,
6846 NULL, 0, "Total Count (obsolete)", HFILL }},
6847 { &hf_nfs_symlink_to, {
6848 "To", "nfs.symlink.to", FT_STRING, BASE_DEC,
6849 NULL, 0, "Symbolic link destination name", HFILL }},
6850 { &hf_nfs_readdir_cookie, {
6851 "Cookie", "nfs.readdir.cookie", FT_UINT32, BASE_DEC,
6852 NULL, 0, "Directory Cookie", HFILL }},
6853 { &hf_nfs_readdir_count, {
6854 "Count", "nfs.readdir.count", FT_UINT32, BASE_DEC,
6855 NULL, 0, "Directory Count", HFILL }},
6857 { &hf_nfs_readdir_entry, {
6858 "Entry", "nfs.readdir.entry", FT_NONE, 0,
6859 NULL, 0, "Directory Entry", HFILL }},
6861 { &hf_nfs_readdir_entry_fileid, {
6862 "File ID", "nfs.readdir.entry.fileid", FT_UINT32, BASE_DEC,
6863 NULL, 0, "File ID", HFILL }},
6865 { &hf_nfs_readdir_entry_name, {
6866 "Name", "nfs.readdir.entry.name", FT_STRING, BASE_DEC,
6867 NULL, 0, "Name", HFILL }},
6869 { &hf_nfs_readdir_entry_cookie, {
6870 "Cookie", "nfs.readdir.entry.cookie", FT_UINT32, BASE_DEC,
6871 NULL, 0, "Directory Cookie", HFILL }},
6873 { &hf_nfs_readdir_entry3_fileid, {
6874 "File ID", "nfs.readdir.entry3.fileid", FT_UINT64, BASE_DEC,
6875 NULL, 0, "File ID", HFILL }},
6877 { &hf_nfs_readdir_entry3_name, {
6878 "Name", "nfs.readdir.entry3.name", FT_STRING, BASE_DEC,
6879 NULL, 0, "Name", HFILL }},
6881 { &hf_nfs_readdir_entry3_cookie, {
6882 "Cookie", "nfs.readdir.entry3.cookie", FT_UINT64, BASE_DEC,
6883 NULL, 0, "Directory Cookie", HFILL }},
6885 { &hf_nfs_readdirplus_entry_fileid, {
6886 "File ID", "nfs.readdirplus.entry.fileid", FT_UINT64, BASE_DEC,
6887 NULL, 0, "Name", HFILL }},
6889 { &hf_nfs_readdirplus_entry_name, {
6890 "Name", "nfs.readdirplus.entry.name", FT_STRING, BASE_DEC,
6891 NULL, 0, "Name", HFILL }},
6893 { &hf_nfs_readdirplus_entry_cookie, {
6894 "Cookie", "nfs.readdirplus.entry.cookie", FT_UINT64, BASE_DEC,
6895 NULL, 0, "Directory Cookie", HFILL }},
6897 { &hf_nfs_readdir_eof, {
6898 "EOF", "nfs.readdir.eof", FT_UINT32, BASE_DEC,
6899 NULL, 0, "EOF", HFILL }},
6901 { &hf_nfs_statfs_tsize, {
6902 "Transfer Size", "nfs.statfs.tsize", FT_UINT32, BASE_DEC,
6903 NULL, 0, "Transfer Size", HFILL }},
6904 { &hf_nfs_statfs_bsize, {
6905 "Block Size", "nfs.statfs.bsize", FT_UINT32, BASE_DEC,
6906 NULL, 0, "Block Size", HFILL }},
6907 { &hf_nfs_statfs_blocks, {
6908 "Total Blocks", "nfs.statfs.blocks", FT_UINT32, BASE_DEC,
6909 NULL, 0, "Total Blocks", HFILL }},
6910 { &hf_nfs_statfs_bfree, {
6911 "Free Blocks", "nfs.statfs.bfree", FT_UINT32, BASE_DEC,
6912 NULL, 0, "Free Blocks", HFILL }},
6913 { &hf_nfs_statfs_bavail, {
6914 "Available Blocks", "nfs.statfs.bavail", FT_UINT32, BASE_DEC,
6915 NULL, 0, "Available Blocks", HFILL }},
6917 "Type", "nfs.type", FT_UINT32, BASE_DEC,
6918 VALS(names_nfs_ftype3), 0, "File Type", HFILL }},
6919 { &hf_nfs_nfsstat3, {
6920 "Status", "nfs.status", FT_UINT32, BASE_DEC,
6921 VALS(names_nfs_nfsstat3), 0, "Reply status", HFILL }},
6922 { &hf_nfs_read_eof, {
6923 "EOF", "nfs.read.eof", FT_BOOLEAN, BASE_NONE,
6924 &yesno, 0, "EOF", HFILL }},
6925 { &hf_nfs_write_stable, {
6926 "Stable", "nfs.write.stable", FT_UINT32, BASE_DEC,
6927 VALS(names_stable_how), 0, "Stable", HFILL }},
6928 { &hf_nfs_write_committed, {
6929 "Committed", "nfs.write.committed", FT_UINT32, BASE_DEC,
6930 VALS(names_stable_how), 0, "Committed", HFILL }},
6931 { &hf_nfs_createmode3, {
6932 "Create Mode", "nfs.createmode", FT_UINT32, BASE_DEC,
6933 VALS(names_createmode3), 0, "Create Mode", HFILL }},
6934 { &hf_nfs_fsstat_invarsec, {
6935 "invarsec", "nfs.fsstat.invarsec", FT_UINT32, BASE_DEC,
6936 NULL, 0, "probable number of seconds of file system invariance", HFILL }},
6937 { &hf_nfs_fsinfo_rtmax, {
6938 "rtmax", "nfs.fsinfo.rtmax", FT_UINT32, BASE_DEC,
6939 NULL, 0, "maximum READ request", HFILL }},
6940 { &hf_nfs_fsinfo_rtpref, {
6941 "rtpref", "nfs.fsinfo.rtpref", FT_UINT32, BASE_DEC,
6942 NULL, 0, "Preferred READ request size", HFILL }},
6943 { &hf_nfs_fsinfo_rtmult, {
6944 "rtmult", "nfs.fsinfo.rtmult", FT_UINT32, BASE_DEC,
6945 NULL, 0, "Suggested READ multiple", HFILL }},
6946 { &hf_nfs_fsinfo_wtmax, {
6947 "wtmax", "nfs.fsinfo.wtmax", FT_UINT32, BASE_DEC,
6948 NULL, 0, "Maximum WRITE request size", HFILL }},
6949 { &hf_nfs_fsinfo_wtpref, {
6950 "wtpref", "nfs.fsinfo.wtpref", FT_UINT32, BASE_DEC,
6951 NULL, 0, "Preferred WRITE request size", HFILL }},
6952 { &hf_nfs_fsinfo_wtmult, {
6953 "wtmult", "nfs.fsinfo.wtmult", FT_UINT32, BASE_DEC,
6954 NULL, 0, "Suggested WRITE multiple", HFILL }},
6955 { &hf_nfs_fsinfo_dtpref, {
6956 "dtpref", "nfs.fsinfo.dtpref", FT_UINT32, BASE_DEC,
6957 NULL, 0, "Preferred READDIR request", HFILL }},
6958 { &hf_nfs_fsinfo_maxfilesize, {
6959 "maxfilesize", "nfs.fsinfo.maxfilesize", FT_UINT64, BASE_DEC,
6960 NULL, 0, "Maximum file size", HFILL }},
6961 { &hf_nfs_fsinfo_properties, {
6962 "Properties", "nfs.fsinfo.propeties", FT_UINT32, BASE_HEX,
6963 NULL, 0, "File System Properties", HFILL }},
6964 { &hf_nfs_pathconf_linkmax, {
6965 "linkmax", "nfs.pathconf.linkmax", FT_UINT32, BASE_DEC,
6966 NULL, 0, "Maximum number of hard links", HFILL }},
6967 { &hf_nfs_pathconf_name_max, {
6968 "name_max", "nfs.pathconf.name_max", FT_UINT32, BASE_DEC,
6969 NULL, 0, "Maximum file name length", HFILL }},
6970 { &hf_nfs_pathconf_no_trunc, {
6971 "no_trunc", "nfs.pathconf.no_trunc", FT_BOOLEAN, BASE_NONE,
6972 &yesno, 0, "No long file name truncation", HFILL }},
6973 { &hf_nfs_pathconf_chown_restricted, {
6974 "chown_restricted", "nfs.pathconf.chown_restricted", FT_BOOLEAN,
6975 BASE_NONE, &yesno, 0, "chown is restricted to root", HFILL }},
6976 { &hf_nfs_pathconf_case_insensitive, {
6977 "case_insensitive", "nfs.pathconf.case_insensitive", FT_BOOLEAN,
6978 BASE_NONE, &yesno, 0, "file names are treated case insensitive", HFILL }},
6979 { &hf_nfs_pathconf_case_preserving, {
6980 "case_preserving", "nfs.pathconf.case_preserving", FT_BOOLEAN,
6981 BASE_NONE, &yesno, 0, "file name cases are preserved", HFILL }},
6983 { &hf_nfs_fattr_type, {
6984 "type", "nfs.fattr.type", FT_UINT32, BASE_DEC,
6985 NULL, 0, "nfs.fattr.type", HFILL }},
6987 { &hf_nfs_fattr_nlink, {
6988 "nlink", "nfs.fattr.nlink", FT_UINT32, BASE_DEC,
6989 NULL, 0, "nfs.fattr.nlink", HFILL }},
6991 { &hf_nfs_fattr_uid, {
6992 "uid", "nfs.fattr.uid", FT_UINT32, BASE_DEC,
6993 NULL, 0, "nfs.fattr.uid", HFILL }},
6995 { &hf_nfs_fattr_gid, {
6996 "gid", "nfs.fattr.gid", FT_UINT32, BASE_DEC,
6997 NULL, 0, "nfs.fattr.gid", HFILL }},
6999 { &hf_nfs_fattr_size, {
7000 "size", "nfs.fattr.size", FT_UINT32, BASE_DEC,
7001 NULL, 0, "nfs.fattr.size", HFILL }},
7003 { &hf_nfs_fattr_blocksize, {
7004 "blocksize", "nfs.fattr.blocksize", FT_UINT32, BASE_DEC,
7005 NULL, 0, "nfs.fattr.blocksize", HFILL }},
7007 { &hf_nfs_fattr_rdev, {
7008 "rdev", "nfs.fattr.rdev", FT_UINT32, BASE_DEC,
7009 NULL, 0, "nfs.fattr.rdev", HFILL }},
7011 { &hf_nfs_fattr_blocks, {
7012 "blocks", "nfs.fattr.blocks", FT_UINT32, BASE_DEC,
7013 NULL, 0, "nfs.fattr.blocks", HFILL }},
7015 { &hf_nfs_fattr_fsid, {
7016 "fsid", "nfs.fattr.fsid", FT_UINT32, BASE_DEC,
7017 NULL, 0, "nfs.fattr.fsid", HFILL }},
7019 { &hf_nfs_fattr_fileid, {
7020 "fileid", "nfs.fattr.fileid", FT_UINT32, BASE_DEC,
7021 NULL, 0, "nfs.fattr.fileid", HFILL }},
7023 { &hf_nfs_fattr3_type, {
7024 "Type", "nfs.fattr3.type", FT_UINT32, BASE_DEC,
7025 VALS(names_nfs_ftype3), 0, "nfs.fattr3.type", HFILL }},
7027 { &hf_nfs_fattr3_nlink, {
7028 "nlink", "nfs.fattr3.nlink", FT_UINT32, BASE_DEC,
7029 NULL, 0, "nfs.fattr3.nlink", HFILL }},
7031 { &hf_nfs_fattr3_uid, {
7032 "uid", "nfs.fattr3.uid", FT_UINT32, BASE_DEC,
7033 NULL, 0, "nfs.fattr3.uid", HFILL }},
7035 { &hf_nfs_fattr3_gid, {
7036 "gid", "nfs.fattr3.gid", FT_UINT32, BASE_DEC,
7037 NULL, 0, "nfs.fattr3.gid", HFILL }},
7039 { &hf_nfs_fattr3_size, {
7040 "size", "nfs.fattr3.size", FT_UINT64, BASE_DEC,
7041 NULL, 0, "nfs.fattr3.size", HFILL }},
7043 { &hf_nfs_fattr3_used, {
7044 "used", "nfs.fattr3.used", FT_UINT64, BASE_DEC,
7045 NULL, 0, "nfs.fattr3.used", HFILL }},
7047 { &hf_nfs_fattr3_rdev, {
7048 "rdev", "nfs.fattr3.rdev", FT_UINT32, BASE_DEC,
7049 NULL, 0, "nfs.fattr3.rdev", HFILL }},
7051 { &hf_nfs_fattr3_fsid, {
7052 "fsid", "nfs.fattr3.fsid", FT_UINT64, BASE_DEC,
7053 NULL, 0, "nfs.fattr3.fsid", HFILL }},
7055 { &hf_nfs_fattr3_fileid, {
7056 "fileid", "nfs.fattr3.fileid", FT_UINT64, BASE_DEC,
7057 NULL, 0, "nfs.fattr3.fileid", HFILL }},
7059 { &hf_nfs_wcc_attr_size, {
7060 "size", "nfs.wcc_attr.size", FT_UINT64, BASE_DEC,
7061 NULL, 0, "nfs.wcc_attr.size", HFILL }},
7063 { &hf_nfs_set_size3_size, {
7064 "size", "nfs.set_size3.size", FT_UINT64, BASE_DEC,
7065 NULL, 0, "nfs.set_size3.size", HFILL }},
7068 "uid", "nfs.uid3", FT_UINT32, BASE_DEC,
7069 NULL, 0, "nfs.uid3", HFILL }},
7072 "gid", "nfs.gid3", FT_UINT32, BASE_DEC,
7073 NULL, 0, "nfs.gid3", HFILL }},
7075 { &hf_nfs_cookie3, {
7076 "cookie", "nfs.cookie3", FT_UINT64, BASE_DEC,
7077 NULL, 0, "nfs.cookie3", HFILL }},
7079 { &hf_nfs_offset3, {
7080 "offset", "nfs.offset3", FT_UINT64, BASE_DEC,
7081 NULL, 0, "nfs.offset3", HFILL }},
7084 "count", "nfs.count3", FT_UINT32, BASE_DEC,
7085 NULL, 0, "nfs.count3", HFILL }},
7087 { &hf_nfs_count3_maxcount, {
7088 "maxcount", "nfs.count3_maxcount", FT_UINT32, BASE_DEC,
7089 NULL, 0, "nfs.count3_maxcount", HFILL }},
7091 { &hf_nfs_count3_dircount, {
7092 "dircount", "nfs.count3_dircount", FT_UINT32, BASE_DEC,
7093 NULL, 0, "nfs.count3_dircount", HFILL }},
7095 { &hf_nfs_fsstat3_resok_tbytes, {
7096 "Total bytes", "nfs.fsstat3_resok.tbytes", FT_UINT64, BASE_DEC,
7097 NULL, 0, "Total bytes", HFILL }},
7099 { &hf_nfs_fsstat3_resok_fbytes, {
7100 "Free bytes", "nfs.fsstat3_resok.fbytes", FT_UINT64, BASE_DEC,
7101 NULL, 0, "Free bytes", HFILL }},
7103 { &hf_nfs_fsstat3_resok_abytes, {
7104 "Available free bytes", "nfs.fsstat3_resok.abytes", FT_UINT64, BASE_DEC,
7105 NULL, 0, "Available free bytes", HFILL }},
7107 { &hf_nfs_fsstat3_resok_tfiles, {
7108 "Total file slots", "nfs.fsstat3_resok.tfiles", FT_UINT64, BASE_DEC,
7109 NULL, 0, "Total file slots", HFILL }},
7111 { &hf_nfs_fsstat3_resok_ffiles, {
7112 "Free file slots", "nfs.fsstat3_resok.ffiles", FT_UINT64, BASE_DEC,
7113 NULL, 0, "Free file slots", HFILL }},
7115 { &hf_nfs_fsstat3_resok_afiles, {
7116 "Available free file slots", "nfs.fsstat3_resok.afiles", FT_UINT64, BASE_DEC,
7117 NULL, 0, "Available free file slots", HFILL }},
7122 "Opcode", "nfs.call.operation", FT_UINT32, BASE_DEC,
7123 VALS(names_nfsv4_operation), 0, "Opcode", HFILL }},
7126 "Opcode", "nfs.reply.operation", FT_UINT32, BASE_DEC,
7127 VALS(names_nfsv4_operation), 0, "Opcode", HFILL }},
7129 { &hf_nfs_linktext4, {
7130 "Name", "nfs.symlink.linktext", FT_STRING, BASE_DEC,
7131 NULL, 0, "Symbolic link contents", HFILL }},
7133 { &hf_nfs_component4, {
7134 "Filename", "nfs.pathname.component", FT_STRING, BASE_DEC,
7135 NULL, 0, "Pathname component", HFILL }},
7138 "Tag", "nfs.tag", FT_STRING, BASE_DEC,
7139 NULL, 0, "Tag", HFILL }},
7141 { &hf_nfs_clientid4, {
7142 "clientid", "nfs.clientid", FT_UINT64, BASE_HEX,
7143 NULL, 0, "Client ID", HFILL }},
7146 "ace", "nfs.ace", FT_STRING, BASE_DEC,
7147 NULL, 0, "Access Control Entry", HFILL }},
7150 "EOF", "nfs.recall", FT_BOOLEAN, BASE_NONE,
7151 &yesno, 0, "Recall", HFILL }},
7153 { &hf_nfs_open_claim_type4, {
7154 "Claim Type", "nfs.open.claim_type", FT_UINT32, BASE_DEC,
7155 VALS(names_claim_type4), 0, "Claim Type", HFILL }},
7157 { &hf_nfs_opentype4, {
7158 "Open Type", "nfs.open.opentype", FT_UINT32, BASE_DEC,
7159 VALS(names_opentype4), 0, "Open Type", HFILL }},
7161 { &hf_nfs_limit_by4, {
7162 "Space Limit", "nfs.open.limit_by", FT_UINT32, BASE_DEC,
7163 VALS(names_limit_by4), 0, "Limit By", HFILL }},
7165 { &hf_nfs_open_delegation_type4, {
7166 "Delegation Type", "nfs.open.delegation_type", FT_UINT32, BASE_DEC,
7167 VALS(names_open_delegation_type4), 0, "Delegation Type", HFILL }},
7170 "nfs_ftype4", "nfs.nfs_ftype4", FT_UINT32, BASE_DEC,
7171 VALS(names_ftype4), 0, "nfs.nfs_ftype4", HFILL }},
7173 { &hf_nfs_change_info4_atomic, {
7174 "Atomic", "nfs.change_info.atomic", FT_BOOLEAN, BASE_NONE,
7175 &yesno, 0, "Atomic", HFILL }},
7177 { &hf_nfs_open4_share_access, {
7178 "share_access", "nfs.open4.share_access", FT_UINT32, BASE_DEC,
7179 VALS(names_open4_share_access), 0, "Share Access", HFILL }},
7181 { &hf_nfs_open4_share_deny, {
7182 "share_deny", "nfs.open4.share_deny", FT_UINT32, BASE_DEC,
7183 VALS(names_open4_share_deny), 0, "Share Deny", HFILL }},
7186 "seqid", "nfs.seqid", FT_UINT32, BASE_HEX,
7187 NULL, 0, "Sequence ID", HFILL }},
7189 { &hf_nfs_lock_seqid4, {
7190 "lock_seqid", "nfs.lock_seqid", FT_UINT32, BASE_HEX,
7191 NULL, 0, "Lock Sequence ID", HFILL }},
7193 { &hf_nfs_mand_attr, {
7194 "mand_attr", "nfs.attr", FT_UINT32, BASE_DEC,
7195 VALS(names_fattr4), 0, "Mandatory Attribute", HFILL }},
7197 { &hf_nfs_recc_attr, {
7198 "recc_attr", "nfs.attr", FT_UINT32, BASE_DEC,
7199 VALS(names_fattr4), 0, "Recommended Attribute", HFILL }},
7201 { &hf_nfs_time_how4, {
7202 "set_it", "nfs.set_it", FT_UINT32, BASE_DEC,
7203 VALS(names_time_how4), 0, "How To Set Time", HFILL }},
7205 { &hf_nfs_attrlist4, {
7206 "attr_vals", "nfs.fattr4.attr_vals", FT_BYTES, BASE_DEC,
7207 NULL, 0, "attr_vals", HFILL }},
7209 { &hf_nfs_fattr4_link_support, {
7210 "fattr4_link_support", "nfs.fattr4_link_support", FT_BOOLEAN,
7211 BASE_NONE, &yesno, 0, "nfs.fattr4_link_support", HFILL }},
7213 { &hf_nfs_fattr4_symlink_support, {
7214 "fattr4_symlink_support", "nfs.fattr4_symlink_support", FT_BOOLEAN,
7215 BASE_NONE, &yesno, 0, "nfs.fattr4_symlink_support", HFILL }},
7217 { &hf_nfs_fattr4_named_attr, {
7218 "fattr4_named_attr", "nfs.fattr4_named_attr", FT_BOOLEAN, BASE_NONE,
7219 &yesno, 0, "nfs.fattr4_named_attr", HFILL }},
7221 { &hf_nfs_fattr4_unique_handles, {
7222 "fattr4_unique_handles", "nfs.fattr4_unique_handles", FT_BOOLEAN,
7223 BASE_NONE, &yesno, 0, "nfs.fattr4_unique_handles", HFILL }},
7225 { &hf_nfs_fattr4_archive, {
7226 "fattr4_archive", "nfs.fattr4_archive", FT_BOOLEAN,
7227 BASE_NONE, &yesno, 0, "nfs.fattr4_archive", HFILL }},
7229 { &hf_nfs_fattr4_cansettime, {
7230 "fattr4_cansettime", "nfs.fattr4_cansettime", FT_BOOLEAN,
7231 BASE_NONE, &yesno, 0, "nfs.fattr4_cansettime", HFILL }},
7233 { &hf_nfs_fattr4_case_insensitive, {
7234 "fattr4_case_insensitive", "nfs.fattr4_case_insensitive", FT_BOOLEAN,
7235 BASE_NONE, &yesno, 0, "nfs.fattr4_case_insensitive", HFILL }},
7237 { &hf_nfs_fattr4_case_preserving, {
7238 "fattr4_case_preserving", "nfs.fattr4_case_preserving", FT_BOOLEAN,
7239 BASE_NONE, &yesno, 0, "nfs.fattr4_case_preserving", HFILL }},
7241 { &hf_nfs_fattr4_chown_restricted, {
7242 "fattr4_chown_restricted", "nfs.fattr4_chown_restricted", FT_BOOLEAN,
7243 BASE_NONE, &yesno, 0, "nfs.fattr4_chown_restricted", HFILL }},
7245 { &hf_nfs_fattr4_hidden, {
7246 "fattr4_hidden", "nfs.fattr4_hidden", FT_BOOLEAN,
7247 BASE_NONE, &yesno, 0, "nfs.fattr4_hidden", HFILL }},
7249 { &hf_nfs_fattr4_homogeneous, {
7250 "fattr4_homogeneous", "nfs.fattr4_homogeneous", FT_BOOLEAN,
7251 BASE_NONE, &yesno, 0, "nfs.fattr4_homogeneous", HFILL }},
7253 { &hf_nfs_fattr4_mimetype, {
7254 "fattr4_mimetype", "nfs.fattr4_mimetype", FT_STRING, BASE_DEC,
7255 NULL, 0, "nfs.fattr4_mimetype", HFILL }},
7257 { &hf_nfs_fattr4_no_trunc, {
7258 "fattr4_no_trunc", "nfs.fattr4_no_trunc", FT_BOOLEAN,
7259 BASE_NONE, &yesno, 0, "nfs.fattr4_no_trunc", HFILL }},
7261 { &hf_nfs_fattr4_system, {
7262 "fattr4_system", "nfs.fattr4_system", FT_BOOLEAN,
7263 BASE_NONE, &yesno, 0, "nfs.fattr4_system", HFILL }},
7266 "who", "nfs.who", FT_STRING, BASE_DEC,
7267 NULL, 0, "nfs.who", HFILL }},
7270 "server", "nfs.server", FT_STRING, BASE_DEC,
7271 NULL, 0, "nfs.server", HFILL }},
7273 { &hf_nfs_fattr4_owner, {
7274 "fattr4_owner", "nfs.fattr4_owner", FT_STRING, BASE_DEC,
7275 NULL, 0, "nfs.fattr4_owner", HFILL }},
7277 { &hf_nfs_fattr4_owner_group, {
7278 "fattr4_owner_group", "nfs.fattr4_owner_group", FT_STRING, BASE_DEC,
7279 NULL, 0, "nfs.fattr4_owner_group", HFILL }},
7281 { &hf_nfs_stable_how4, {
7282 "stable_how4", "nfs.stable_how4", FT_UINT32, BASE_DEC,
7283 VALS(names_stable_how4), 0, "nfs.stable_how4", HFILL }},
7285 { &hf_nfs_dirlist4_eof, {
7286 "eof", "nfs.dirlist4.eof", FT_BOOLEAN,
7287 BASE_NONE, &yesno, 0, "nfs.dirlist4.eof", HFILL }},
7289 { &hf_nfs_stateid4, {
7290 "stateid", "nfs.stateid4", FT_UINT64, BASE_DEC,
7291 NULL, 0, "nfs.stateid4", HFILL }},
7293 { &hf_nfs_offset4, {
7294 "offset", "nfs.offset4", FT_UINT64, BASE_DEC,
7295 NULL, 0, "nfs.offset4", HFILL }},
7297 { &hf_nfs_specdata1, {
7298 "specdata1", "nfs.specdata1", FT_UINT32, BASE_DEC,
7299 NULL, 0, "nfs.specdata1", HFILL }},
7301 { &hf_nfs_specdata2, {
7302 "specdata2", "nfs.specdata2", FT_UINT32, BASE_DEC,
7303 NULL, 0, "nfs.specdata2", HFILL }},
7305 { &hf_nfs_lock_type4, {
7306 "locktype", "nfs.locktype4", FT_UINT32, BASE_DEC,
7307 VALS(names_nfs_lock_type4), 0, "nfs.locktype4", HFILL }},
7309 { &hf_nfs_reclaim4, {
7310 "reclaim", "nfs.reclaim4", FT_BOOLEAN,
7311 BASE_NONE, &yesno, 0, "Reclaim", HFILL }},
7313 { &hf_nfs_length4, {
7314 "length", "nfs.length4", FT_UINT64, BASE_DEC,
7315 NULL, 0, "nfs.length4", HFILL }},
7317 { &hf_nfs_changeid4, {
7318 "changeid", "nfs.changeid4", FT_UINT64, BASE_DEC,
7319 NULL, 0, "nfs.changeid4", HFILL }},
7321 { &hf_nfs_changeid4_before, {
7322 "changeid", "nfs.changeid4.before", FT_UINT64, BASE_DEC,
7323 NULL, 0, "nfs.changeid4.before", HFILL }},
7325 { &hf_nfs_changeid4_after, {
7326 "changeid", "nfs.changeid4.after", FT_UINT64, BASE_DEC,
7327 NULL, 0, "nfs.changeid4.after", HFILL }},
7329 { &hf_nfs_nfstime4_seconds, {
7330 "seconds", "nfs.nfstime4.seconds", FT_UINT64, BASE_DEC,
7331 NULL, 0, "nfs.nfstime4.seconds", HFILL }},
7333 { &hf_nfs_nfstime4_nseconds, {
7334 "nseconds", "nfs.nfstime4.nseconds", FT_UINT32, BASE_DEC,
7335 NULL, 0, "nfs.nfstime4.nseconds", HFILL }},
7337 { &hf_nfs_fsid4_major, {
7338 "fsid4.major", "nfs.fsid4.major", FT_UINT64, BASE_DEC,
7339 NULL, 0, "nfs.nfstime4.fsid4.major", HFILL }},
7341 { &hf_nfs_fsid4_minor, {
7342 "fsid4.minor", "nfs.fsid4.minor", FT_UINT64, BASE_DEC,
7343 NULL, 0, "nfs.fsid4.minor", HFILL }},
7345 { &hf_nfs_acetype4, {
7346 "acetype", "nfs.acetype4", FT_UINT32, BASE_DEC,
7347 VALS(names_acetype4), 0, "nfs.acetype4", HFILL }},
7349 { &hf_nfs_aceflag4, {
7350 "aceflag", "nfs.aceflag4", FT_UINT32, BASE_DEC,
7351 NULL, 0, "nfs.aceflag4", HFILL }},
7353 { &hf_nfs_acemask4, {
7354 "acemask", "nfs.acemask4", FT_UINT32, BASE_DEC,
7355 NULL, 0, "nfs.acemask4", HFILL }},
7357 { &hf_nfs_fattr4_size, {
7358 "size", "nfs.fattr4.size", FT_UINT64, BASE_DEC,
7359 NULL, 0, "nfs.fattr4.size", HFILL }},
7361 { &hf_nfs_fattr4_lease_time, {
7362 "lease_time", "nfs.fattr4.lease_time", FT_UINT32, BASE_DEC,
7363 NULL, 0, "nfs.fattr4.lease_time", HFILL }},
7365 { &hf_nfs_fattr4_aclsupport, {
7366 "aclsupport", "nfs.fattr4.aclsupport", FT_UINT32, BASE_DEC,
7367 NULL, 0, "nfs.fattr4.aclsupport", HFILL }},
7369 { &hf_nfs_fattr4_fileid, {
7370 "fileid", "nfs.fattr4.fileid", FT_UINT64, BASE_DEC,
7371 NULL, 0, "nfs.fattr4.fileid", HFILL }},
7373 { &hf_nfs_fattr4_files_avail, {
7374 "files_avail", "nfs.fattr4.files_avail", FT_UINT64, BASE_DEC,
7375 NULL, 0, "nfs.fattr4.files_avail", HFILL }},
7377 { &hf_nfs_fattr4_files_free, {
7378 "files_free", "nfs.fattr4.files_free", FT_UINT64, BASE_DEC,
7379 NULL, 0, "nfs.fattr4.files_free", HFILL }},
7381 { &hf_nfs_fattr4_files_total, {
7382 "files_total", "nfs.fattr4.files_total", FT_UINT64, BASE_DEC,
7383 NULL, 0, "nfs.fattr4.files_total", HFILL }},
7385 { &hf_nfs_fattr4_maxfilesize, {
7386 "maxfilesize", "nfs.fattr4.maxfilesize", FT_UINT64, BASE_DEC,
7387 NULL, 0, "nfs.fattr4.maxfilesize", HFILL }},
7389 { &hf_nfs_fattr4_maxlink, {
7390 "maxlink", "nfs.fattr4.maxlink", FT_UINT32, BASE_DEC,
7391 NULL, 0, "nfs.fattr4.maxlink", HFILL }},
7393 { &hf_nfs_fattr4_maxname, {
7394 "maxname", "nfs.fattr4.maxname", FT_UINT32, BASE_DEC,
7395 NULL, 0, "nfs.fattr4.maxname", HFILL }},
7397 { &hf_nfs_fattr4_numlinks, {
7398 "numlinks", "nfs.fattr4.numlinks", FT_UINT32, BASE_DEC,
7399 NULL, 0, "nfs.fattr4.numlinks", HFILL }},
7401 { &hf_nfs_delegate_type, {
7402 "delegate_type", "nfs.delegate_type", FT_UINT32, BASE_DEC,
7403 NULL, 0, "nfs.delegate_type", HFILL }},
7405 { &hf_nfs_secinfo_flavor, {
7406 "flavor", "nfs.secinfo.flavor", FT_UINT32, BASE_DEC,
7407 VALS(rpc_auth_flavor), 0, "nfs.secinfo.flavor", HFILL }},
7409 { &hf_nfs_num_blocks, {
7410 "num_blocks", "nfs.num_blocks", FT_UINT32, BASE_DEC,
7411 NULL, 0, "nfs.num_blocks", HFILL }},
7413 { &hf_nfs_bytes_per_block, {
7414 "bytes_per_block", "nfs.bytes_per_block", FT_UINT32, BASE_DEC,
7415 NULL, 0, "nfs.bytes_per_block", HFILL }},
7418 "eof", "nfs.eof", FT_UINT32, BASE_DEC,
7419 NULL, 0, "nfs.eof", HFILL }},
7421 { &hf_nfs_fattr4_maxread, {
7422 "maxread", "nfs.fattr4.maxread", FT_UINT64, BASE_DEC,
7423 NULL, 0, "nfs.fattr4.maxread", HFILL }},
7425 { &hf_nfs_fattr4_maxwrite, {
7426 "maxwrite", "nfs.fattr4.maxwrite", FT_UINT64, BASE_DEC,
7427 NULL, 0, "nfs.fattr4.maxwrite", HFILL }},
7429 { &hf_nfs_fattr4_quota_hard, {
7430 "quota_hard", "nfs.fattr4.quota_hard", FT_UINT64, BASE_DEC,
7431 NULL, 0, "nfs.fattr4.quota_hard", HFILL }},
7433 { &hf_nfs_fattr4_quota_soft, {
7434 "quota_soft", "nfs.fattr4.quota_soft", FT_UINT64, BASE_DEC,
7435 NULL, 0, "nfs.fattr4.quota_soft", HFILL }},
7437 { &hf_nfs_fattr4_quota_used, {
7438 "quota_used", "nfs.fattr4.quota_used", FT_UINT64, BASE_DEC,
7439 NULL, 0, "nfs.fattr4.quota_used", HFILL }},
7441 { &hf_nfs_fattr4_space_avail, {
7442 "space_avail", "nfs.fattr4.space_avail", FT_UINT64, BASE_DEC,
7443 NULL, 0, "nfs.fattr4.space_avail", HFILL }},
7445 { &hf_nfs_fattr4_space_free, {
7446 "space_free", "nfs.fattr4.space_free", FT_UINT64, BASE_DEC,
7447 NULL, 0, "nfs.fattr4.space_free", HFILL }},
7449 { &hf_nfs_fattr4_space_total, {
7450 "space_total", "nfs.fattr4.space_total", FT_UINT64, BASE_DEC,
7451 NULL, 0, "nfs.fattr4.space_total", HFILL }},
7453 { &hf_nfs_fattr4_space_used, {
7454 "space_used", "nfs.fattr4.space_used", FT_UINT64, BASE_DEC,
7455 NULL, 0, "nfs.fattr4.space_used", HFILL }},
7457 { &hf_nfs_stateid4_delegate_stateid, {
7458 "delegate_stateid", "nfs.delegate_stateid", FT_UINT64, BASE_DEC,
7459 NULL, 0, "nfs.delegate_stateid", HFILL }},
7461 { &hf_nfs_verifier4, {
7462 "verifier", "nfs.verifier4", FT_UINT64, BASE_HEX,
7463 NULL, 0, "nfs.verifier4", HFILL }},
7465 { &hf_nfs_cookie4, {
7466 "cookie", "nfs.cookie4", FT_UINT64, BASE_DEC,
7467 NULL, 0, "nfs.cookie4", HFILL }},
7469 { &hf_nfs_cookieverf4, {
7470 "cookieverf", "nfs.cookieverf4", FT_UINT64, BASE_DEC,
7471 NULL, 0, "nfs.cookieverf4", HFILL }},
7473 { &hf_nfs_cb_location, {
7474 "cb_location", "nfs.cb_location", FT_UINT32, BASE_DEC,
7475 NULL, 0, "nfs.cb_location", HFILL }},
7477 { &hf_nfs_cb_program, {
7478 "cb_program", "nfs.cb_program", FT_UINT32, BASE_HEX,
7479 NULL, 0, "nfs.cb_program", HFILL }},
7481 { &hf_nfs_recall4, {
7482 "recall", "nfs.recall4", FT_BOOLEAN,
7483 BASE_NONE, &yesno, 0, "nfs.recall4", HFILL }},
7485 { &hf_nfs_filesize, {
7486 "filesize", "nfs.filesize", FT_UINT64, BASE_DEC,
7487 NULL, 0, "nfs.filesize", HFILL }},
7490 "count", "nfs.count4", FT_UINT32, BASE_DEC,
7491 NULL, 0, "nfs.count4", HFILL }},
7493 { &hf_nfs_count4_dircount, {
7494 "dircount", "nfs.dircount", FT_UINT32, BASE_DEC,
7495 NULL, 0, "nfs.dircount", HFILL }},
7497 { &hf_nfs_count4_maxcount, {
7498 "maxcount", "nfs.maxcount", FT_UINT32, BASE_DEC,
7499 NULL, 0, "nfs.maxcount", HFILL }},
7501 { &hf_nfs_minorversion, {
7502 "minorversion", "nfs.minorversion", FT_UINT32, BASE_DEC,
7503 NULL, 0, "nfs.minorversion", HFILL }},
7506 "atime", "nfs.atime", FT_ABSOLUTE_TIME, BASE_NONE,
7507 NULL, 0, "Access Time", HFILL }},
7509 { &hf_nfs_atime_sec, {
7510 "seconds", "nfs.atime.sec", FT_UINT32, BASE_DEC,
7511 NULL, 0, "Access Time, Seconds", HFILL }},
7513 { &hf_nfs_atime_nsec, {
7514 "nano seconds", "nfs.atime.nsec", FT_UINT32, BASE_DEC,
7515 NULL, 0, "Access Time, Nano-seconds", HFILL }},
7517 { &hf_nfs_atime_usec, {
7518 "micro seconds", "nfs.atime.usec", FT_UINT32, BASE_DEC,
7519 NULL, 0, "Access Time, Micro-seconds", HFILL }},
7522 "mtime", "nfs.mtime", FT_ABSOLUTE_TIME, BASE_NONE,
7523 NULL, 0, "Modify Time", HFILL }},
7525 { &hf_nfs_mtime_sec, {
7526 "seconds", "nfs.mtime.sec", FT_UINT32, BASE_DEC,
7527 NULL, 0, "Modify Seconds", HFILL }},
7529 { &hf_nfs_mtime_nsec, {
7530 "nano seconds", "nfs.mtime.nsec", FT_UINT32, BASE_DEC,
7531 NULL, 0, "Modify Time, Nano-seconds", HFILL }},
7533 { &hf_nfs_mtime_usec, {
7534 "micro seconds", "nfs.mtime.usec", FT_UINT32, BASE_DEC,
7535 NULL, 0, "Modify Time, Micro-seconds", HFILL }},
7538 "ctime", "nfs.ctime", FT_ABSOLUTE_TIME, BASE_NONE,
7539 NULL, 0, "Creation Time", HFILL }},
7541 { &hf_nfs_ctime_sec, {
7542 "seconds", "nfs.ctime.sec", FT_UINT32, BASE_DEC,
7543 NULL, 0, "Creation Time, Seconds", HFILL }},
7545 { &hf_nfs_ctime_nsec, {
7546 "nano seconds", "nfs.ctime.nsec", FT_UINT32, BASE_DEC,
7547 NULL, 0, "Creation Time, Nano-seconds", HFILL }},
7549 { &hf_nfs_ctime_usec, {
7550 "micro seconds", "nfs.ctime.usec", FT_UINT32, BASE_DEC,
7551 NULL, 0, "Creation Time, Micro-seconds", HFILL }},
7554 "time delta", "nfs.dtime", FT_RELATIVE_TIME, BASE_NONE,
7555 NULL, 0, "Time Delta", HFILL }},
7557 { &hf_nfs_dtime_sec, {
7558 "seconds", "nfs.dtime.sec", FT_UINT32, BASE_DEC,
7559 NULL, 0, "Time Delta, Seconds", HFILL }},
7561 { &hf_nfs_dtime_nsec, {
7562 "nano seconds", "nfs.dtime.nsec", FT_UINT32, BASE_DEC,
7563 NULL, 0, "Time Delta, Nano-seconds", HFILL }},
7565 { &hf_nfs_open_owner4, {
7566 "owner", "nfs.open_owner4", FT_BYTES, BASE_DEC,
7567 NULL, 0, "owner", HFILL }},
7569 { &hf_nfs_lock_owner4, {
7570 "owner", "nfs.lock_owner4", FT_BYTES, BASE_DEC,
7571 NULL, 0, "owner", HFILL }},
7573 { &hf_nfs_secinfo_rpcsec_gss_info_service, {
7574 "service", "nfs.secinfo.rpcsec_gss_info.service", FT_UINT32,
7575 BASE_DEC, VALS(rpc_authgss_svc), 0, "service", HFILL }},
7577 { &hf_nfs_attrdircreate, {
7578 "attribute dir create", "nfs.openattr4.createdir", FT_BOOLEAN,
7579 BASE_NONE, &yesno, 0, "nfs.openattr4.createdir", HFILL }},
7581 { &hf_nfs_new_lock_owner, {
7582 "new lock owner?", "nfs.lock.locker.new_lock_owner", FT_BOOLEAN,
7583 BASE_NONE, &yesno, 0, "nfs.lock.locker.new_lock_owner", HFILL }},
7585 { &hf_nfs_lock4_reclaim, {
7586 "reclaim?", "nfs.lock.reclaim", FT_BOOLEAN,
7587 BASE_NONE, &yesno, 0, "nfs.lock.reclaim", HFILL }},
7589 { &hf_nfs_sec_oid4, {
7590 "oid", "nfs.secinfo.flavor_info.rpcsec_gss_info.oid", FT_BYTES,
7591 BASE_DEC, NULL, 0, "oid", HFILL }},
7594 "qop", "nfs.secinfo.flavor_info.rpcsec_gss_info.qop", FT_UINT32,
7595 BASE_DEC, NULL, 0, "qop", HFILL }},
7597 { &hf_nfs_client_id4_id, {
7598 "id", "nfs.nfs_client_id4.id", FT_BYTES, BASE_DEC,
7599 NULL, 0, "nfs.nfs_client_id4.id", HFILL }},
7601 { &hf_nfs_stateid4_other, {
7602 "Data", "nfs.stateid4.other", FT_BYTES, BASE_DEC,
7603 NULL, 0, "Data", HFILL }},
7606 "ACL", "nfs.acl", FT_NONE, BASE_NONE,
7607 NULL, 0, "Access Control List", HFILL }},
7609 { &hf_nfs_callback_ident, {
7610 "callback_ident", "nfs.callback.ident", FT_UINT32, BASE_HEX,
7611 NULL, 0, "Callback Identifier", HFILL }},
7613 { &hf_nfs_r_netid, {
7614 "r_netid", "nfs.r_netid", FT_BYTES, BASE_DEC, NULL, 0,
7615 "r_netid", HFILL }},
7618 "r_addr", "nfs.r_addr", FT_BYTES, BASE_DEC, NULL, 0,
7621 { &hf_nfs_secinfo_arr4, {
7622 "Flavors Info", "nfs.flavors.info", FT_NONE, BASE_NONE,
7623 NULL, 0, "Flavors Info", HFILL }},
7626 static gint *ett[] = {
7628 &ett_nfs_fh_encoding,
7641 &ett_nfs_readdir_entry,
7647 &ett_nfs_post_op_fh3,
7649 &ett_nfs_diropargs3,
7650 &ett_nfs_sattrguard3,
7657 &ett_nfs_pre_op_attr,
7658 &ett_nfs_post_op_attr,
7662 &ett_nfs_fsinfo_properties,
7663 &ett_nfs_compound_call4,
7664 &ett_nfs_utf8string,
7671 &ett_nfs_delegpurge4,
7672 &ett_nfs_delegreturn4,
7684 &ett_nfs_open_confirm4,
7685 &ett_nfs_open_downgrade4,
7688 &ett_nfs_putrootfh4,
7695 &ett_nfs_restorefh4,
7698 &ett_nfs_setclientid4,
7699 &ett_nfs_setclientid_confirm4,
7706 &ett_nfs_change_info4,
7707 &ett_nfs_open_delegation4,
7708 &ett_nfs_open_claim4,
7710 &ett_nfs_lock_owner4,
7711 &ett_nfs_cb_client4,
7712 &ett_nfs_client_id4,
7716 &ett_nfs_fs_locations4,
7717 &ett_nfs_fs_location4,
7718 &ett_nfs_open4_result_flags,
7720 &ett_nfs_secinfo4_flavor_info,
7722 &ett_nfs_fattr4_fh_expire_type,
7724 &ett_nfs_clientaddr4,
7728 module_t *nfs_module;
7730 proto_nfs = proto_register_protocol("Network File System", "NFS", "nfs");
7731 proto_register_field_array(proto_nfs, hf, array_length(hf));
7732 proto_register_subtree_array(ett, array_length(ett));
7734 nfs_module=prefs_register_protocol(proto_nfs, NULL);
7735 prefs_register_bool_preference(nfs_module, "file_name_snooping",
7736 "Snoop FH to filename mappings",
7737 "Whether the dissector should snoop the FH to filename mappings by looking inside certain packets",
7738 &nfs_file_name_snooping);
7739 prefs_register_bool_preference(nfs_module, "file_full_name_snooping",
7740 "Snoop full path to filenames",
7741 "Whether the dissector should snoop the full pathname for files for matching FH's",
7742 &nfs_file_name_full_snooping);
7743 prefs_register_bool_preference(nfs_module, "fhandle_find_both_reqrep",
7744 "Fhandle filters finds both request/response",
7745 "With this option display filters for nfs fhandles (nfs.fh.{name|full_name|hash}) will find both the request and response packets for a RPC call, even if the actual fhandle is only present in one of the packets",
7746 &nfs_fhandle_reqrep_matching);
7747 register_init_routine(nfs_name_snoop_init);
7748 register_init_routine(nfs_fhandle_reqrep_matching_init);
7752 proto_reg_handoff_nfs(void)
7754 /* Register the protocol as RPC */
7755 rpc_init_prog(proto_nfs, NFS_PROGRAM, ett_nfs);
7756 /* Register the procedure tables */
7757 rpc_init_proc_table(NFS_PROGRAM, 2, nfs2_proc, hf_nfs_procedure_v2);
7758 rpc_init_proc_table(NFS_PROGRAM, 3, nfs3_proc, hf_nfs_procedure_v3);
7759 rpc_init_proc_table(NFS_PROGRAM, 4, nfs4_proc, hf_nfs_procedure_v4);