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.85 2003/02/14 19:51:54 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_num_blocks = -1;
259 static int hf_nfs_bytes_per_block = -1;
260 static int hf_nfs_eof = -1;
261 static int hf_nfs_stateid4_delegate_stateid = -1;
262 static int hf_nfs_verifier4 = -1;
263 static int hf_nfs_cookie4 = -1;
264 static int hf_nfs_cookieverf4 = -1;
265 static int hf_nfs_cb_program = -1;
266 static int hf_nfs_cb_location = -1;
267 static int hf_nfs_recall4 = -1;
268 static int hf_nfs_filesize = -1;
269 static int hf_nfs_count4 = -1;
270 static int hf_nfs_count4_dircount = -1;
271 static int hf_nfs_count4_maxcount = -1;
272 static int hf_nfs_minorversion = -1;
273 static int hf_nfs_open_owner4 = -1;
274 static int hf_nfs_lock_owner4 = -1;
275 static int hf_nfs_new_lock_owner = -1;
276 static int hf_nfs_sec_oid4 = -1;
277 static int hf_nfs_qop4 = -1;
278 static int hf_nfs_secinfo_rpcsec_gss_info_service = -1;
279 static int hf_nfs_attrdircreate = -1;
280 static int hf_nfs_client_id4_id = -1;
281 static int hf_nfs_stateid4_other = -1;
282 static int hf_nfs_lock4_reclaim = -1;
283 static int hf_nfs_acl4 = -1;
284 static int hf_nfs_callback_ident = -1;
285 static int hf_nfs_r_netid = -1;
286 static int hf_nfs_r_addr = -1;
288 static gint ett_nfs = -1;
289 static gint ett_nfs_fh_encoding = -1;
290 static gint ett_nfs_fh_fsid = -1;
291 static gint ett_nfs_fh_xfsid = -1;
292 static gint ett_nfs_fh_fn = -1;
293 static gint ett_nfs_fh_xfn = -1;
294 static gint ett_nfs_fh_hp = -1;
295 static gint ett_nfs_fh_auth = -1;
296 static gint ett_nfs_fhandle = -1;
297 static gint ett_nfs_timeval = -1;
298 static gint ett_nfs_mode = -1;
299 static gint ett_nfs_fattr = -1;
300 static gint ett_nfs_sattr = -1;
301 static gint ett_nfs_diropargs = -1;
302 static gint ett_nfs_readdir_entry = -1;
303 static gint ett_nfs_mode3 = -1;
304 static gint ett_nfs_specdata3 = -1;
305 static gint ett_nfs_fh3 = -1;
306 static gint ett_nfs_nfstime3 = -1;
307 static gint ett_nfs_fattr3 = -1;
308 static gint ett_nfs_post_op_fh3 = -1;
309 static gint ett_nfs_sattr3 = -1;
310 static gint ett_nfs_diropargs3 = -1;
311 static gint ett_nfs_sattrguard3 = -1;
312 static gint ett_nfs_set_mode3 = -1;
313 static gint ett_nfs_set_uid3 = -1;
314 static gint ett_nfs_set_gid3 = -1;
315 static gint ett_nfs_set_size3 = -1;
316 static gint ett_nfs_set_atime = -1;
317 static gint ett_nfs_set_mtime = -1;
318 static gint ett_nfs_pre_op_attr = -1;
319 static gint ett_nfs_post_op_attr = -1;
320 static gint ett_nfs_wcc_attr = -1;
321 static gint ett_nfs_wcc_data = -1;
322 static gint ett_nfs_access = -1;
323 static gint ett_nfs_fsinfo_properties = -1;
326 static gint ett_nfs_compound_call4 = -1;
327 static gint ett_nfs_utf8string = -1;
328 static gint ett_nfs_argop4 = -1;
329 static gint ett_nfs_resop4 = -1;
330 static gint ett_nfs_access4 = -1;
331 static gint ett_nfs_close4 = -1;
332 static gint ett_nfs_commit4 = -1;
333 static gint ett_nfs_create4 = -1;
334 static gint ett_nfs_delegpurge4 = -1;
335 static gint ett_nfs_delegreturn4 = -1;
336 static gint ett_nfs_getattr4 = -1;
337 static gint ett_nfs_getfh4 = -1;
338 static gint ett_nfs_link4 = -1;
339 static gint ett_nfs_lock4 = -1;
340 static gint ett_nfs_lockt4 = -1;
341 static gint ett_nfs_locku4 = -1;
342 static gint ett_nfs_lookup4 = -1;
343 static gint ett_nfs_lookupp4 = -1;
344 static gint ett_nfs_nverify4 = -1;
345 static gint ett_nfs_open4 = -1;
346 static gint ett_nfs_openattr4 = -1;
347 static gint ett_nfs_open_confirm4 = -1;
348 static gint ett_nfs_open_downgrade4 = -1;
349 static gint ett_nfs_putfh4 = -1;
350 static gint ett_nfs_putpubfh4 = -1;
351 static gint ett_nfs_putrootfh4 = -1;
352 static gint ett_nfs_read4 = -1;
353 static gint ett_nfs_readdir4 = -1;
354 static gint ett_nfs_readlink4 = -1;
355 static gint ett_nfs_remove4 = -1;
356 static gint ett_nfs_rename4 = -1;
357 static gint ett_nfs_renew4 = -1;
358 static gint ett_nfs_restorefh4 = -1;
359 static gint ett_nfs_savefh4 = -1;
360 static gint ett_nfs_secinfo4 = -1;
361 static gint ett_nfs_setattr4 = -1;
362 static gint ett_nfs_setclientid4 = -1;
363 static gint ett_nfs_setclientid_confirm4 = -1;
364 static gint ett_nfs_verify4 = -1;
365 static gint ett_nfs_write4 = -1;
366 static gint ett_nfs_verifier4 = -1;
367 static gint ett_nfs_opaque = -1;
368 static gint ett_nfs_dirlist4 = -1;
369 static gint ett_nfs_pathname4 = -1;
370 static gint ett_nfs_change_info4 = -1;
371 static gint ett_nfs_open_delegation4 = -1;
372 static gint ett_nfs_open_claim4 = -1;
373 static gint ett_nfs_opentype4 = -1;
374 static gint ett_nfs_lock_owner4 = -1;
375 static gint ett_nfs_cb_client4 = -1;
376 static gint ett_nfs_client_id4 = -1;
377 static gint ett_nfs_bitmap4 = -1;
378 static gint ett_nfs_fattr4 = -1;
379 static gint ett_nfs_fsid4 = -1;
380 static gint ett_nfs_fs_locations4 = -1;
381 static gint ett_nfs_fs_location4 = -1;
382 static gint ett_nfs_open4_result_flags = -1;
383 static gint ett_nfs_secinfo4_flavor_info = -1;
384 static gint ett_nfs_stateid4 = -1;
385 static gint ett_nfs_fattr4_fh_expire_type = -1;
386 static gint ett_nfs_ace4 = -1;
387 static gint ett_nfs_clientaddr4 = -1;
388 static gint ett_nfs_aceflag4 = -1;
389 static gint ett_nfs_acemask4 = -1;
392 /* fhandle displayfilters to match also corresponding request/response
393 packet in addition to the one containing the actual filehandle */
394 gboolean nfs_fhandle_reqrep_matching = FALSE;
395 static GMemChunk *nfs_fhandle_data_chunk = NULL;
396 static int nfs_fhandle_data_init_count = 100;
397 static GHashTable *nfs_fhandle_data_table = NULL;
398 GHashTable *nfs_fhandle_frame_table = NULL;
401 nfs_fhandle_data_equal(gconstpointer k1, gconstpointer k2)
403 const nfs_fhandle_data_t *key1 = (const nfs_fhandle_data_t *)k1;
404 const nfs_fhandle_data_t *key2 = (const nfs_fhandle_data_t *)k2;
406 return (key1->len==key2->len)
407 &&(!memcmp(key1->fh, key2->fh, key1->len));
410 nfs_fhandle_data_hash(gconstpointer k)
412 const nfs_fhandle_data_t *key = (const nfs_fhandle_data_t *)k;
417 for(i=0;i<key->len;i++)
423 nfs_fhandle_data_free_all(gpointer key_arg _U_, gpointer value, gpointer user_data _U_)
425 nfs_fhandle_data_t *nns = (nfs_fhandle_data_t *)value;
430 g_free((gpointer)nns->fh);
438 nfs_fhandle_frame_equal(gconstpointer k1, gconstpointer k2)
440 guint32 key1 = (guint32)k1;
441 guint32 key2 = (guint32)k2;
446 nfs_fhandle_frame_hash(gconstpointer k)
448 guint32 key = (guint32)k;
453 nfs_fhandle_frame_free_all(gpointer key_arg _U_, gpointer value _U_, gpointer user_data _U_)
458 nfs_fhandle_reqrep_matching_init(void)
460 if (nfs_fhandle_frame_table != NULL) {
461 g_hash_table_foreach_remove(nfs_fhandle_frame_table,
462 nfs_fhandle_frame_free_all, NULL);
464 nfs_fhandle_frame_table=g_hash_table_new(nfs_fhandle_frame_hash,
465 nfs_fhandle_frame_equal);
469 if (nfs_fhandle_data_table != NULL) {
470 g_hash_table_foreach_remove(nfs_fhandle_data_table,
471 nfs_fhandle_data_free_all, NULL);
473 nfs_fhandle_data_table=g_hash_table_new(nfs_fhandle_data_hash,
474 nfs_fhandle_data_equal);
477 if(nfs_fhandle_data_chunk){
478 g_mem_chunk_destroy(nfs_fhandle_data_chunk);
479 nfs_fhandle_data_chunk = NULL;
482 if(nfs_fhandle_reqrep_matching){
483 nfs_fhandle_data_chunk = g_mem_chunk_new("nfs_fhandle_data_chunk",
484 sizeof(nfs_fhandle_data_t),
485 nfs_fhandle_data_init_count * sizeof(nfs_fhandle_data_t),
492 /* file name snooping */
493 gboolean nfs_file_name_snooping = FALSE;
494 gboolean nfs_file_name_full_snooping = FALSE;
495 typedef struct nfs_name_snoop {
501 unsigned char *parent;
503 unsigned char *full_name;
506 typedef struct nfs_name_snoop_key {
509 const unsigned char *fh;
510 } nfs_name_snoop_key_t;
512 static GMemChunk *nfs_name_snoop_chunk = NULL;
513 static int nfs_name_snoop_init_count = 100;
514 static GHashTable *nfs_name_snoop_unmatched = NULL;
516 static GMemChunk *nfs_name_snoop_key_chunk = NULL;
517 static int nfs_name_snoop_key_init_count = 100;
518 static GHashTable *nfs_name_snoop_matched = NULL;
520 static GHashTable *nfs_name_snoop_known = NULL;
523 nfs_name_snoop_matched_equal(gconstpointer k1, gconstpointer k2)
525 const nfs_name_snoop_key_t *key1 = (const nfs_name_snoop_key_t *)k1;
526 const nfs_name_snoop_key_t *key2 = (const nfs_name_snoop_key_t *)k2;
528 return (key1->key==key2->key)
529 &&(key1->fh_length==key2->fh_length)
530 &&(!memcmp(key1->fh, key2->fh, key1->fh_length));
533 nfs_name_snoop_matched_hash(gconstpointer k)
535 const nfs_name_snoop_key_t *key = (const nfs_name_snoop_key_t *)k;
540 for(i=0;i<key->fh_length;i++)
546 nfs_name_snoop_unmatched_equal(gconstpointer k1, gconstpointer k2)
548 guint32 key1 = (guint32)k1;
549 guint32 key2 = (guint32)k2;
554 nfs_name_snoop_unmatched_hash(gconstpointer k)
556 guint32 key = (guint32)k;
561 nfs_name_snoop_unmatched_free_all(gpointer key_arg _U_, gpointer value, gpointer user_data _U_)
563 nfs_name_snoop_t *nns = (nfs_name_snoop_t *)value;
566 g_free((gpointer)nns->name);
571 g_free((gpointer)nns->full_name);
573 nns->full_name_len=0;
576 g_free((gpointer)nns->parent);
581 g_free((gpointer)nns->fh);
589 nfs_name_snoop_init(void)
591 if (nfs_name_snoop_unmatched != NULL) {
592 g_hash_table_foreach_remove(nfs_name_snoop_unmatched,
593 nfs_name_snoop_unmatched_free_all, NULL);
595 /* The fragment table does not exist. Create it */
596 nfs_name_snoop_unmatched=g_hash_table_new(nfs_name_snoop_unmatched_hash,
597 nfs_name_snoop_unmatched_equal);
599 if (nfs_name_snoop_matched != NULL) {
600 g_hash_table_foreach_remove(nfs_name_snoop_matched,
601 nfs_name_snoop_unmatched_free_all, NULL);
603 /* The fragment table does not exist. Create it */
604 nfs_name_snoop_matched=g_hash_table_new(nfs_name_snoop_matched_hash,
605 nfs_name_snoop_matched_equal);
607 if (nfs_name_snoop_known != NULL) {
608 g_hash_table_foreach_remove(nfs_name_snoop_known,
609 nfs_name_snoop_unmatched_free_all, NULL);
611 /* The fragment table does not exist. Create it */
612 nfs_name_snoop_known=g_hash_table_new(nfs_name_snoop_matched_hash,
613 nfs_name_snoop_matched_equal);
616 if(nfs_name_snoop_chunk){
617 g_mem_chunk_destroy(nfs_name_snoop_chunk);
618 nfs_name_snoop_chunk = NULL;
620 if(nfs_name_snoop_key_chunk){
621 g_mem_chunk_destroy(nfs_name_snoop_key_chunk);
622 nfs_name_snoop_key_chunk = NULL;
625 if(nfs_file_name_snooping){
626 nfs_name_snoop_chunk = g_mem_chunk_new("nfs_name_snoop_chunk",
627 sizeof(nfs_name_snoop_t),
628 nfs_name_snoop_init_count * sizeof(nfs_name_snoop_t),
630 nfs_name_snoop_key_chunk = g_mem_chunk_new("nfs_name_snoop_key_chunk",
631 sizeof(nfs_name_snoop_key_t),
632 nfs_name_snoop_key_init_count * sizeof(nfs_name_snoop_key_t),
639 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)
641 nfs_name_snoop_t *nns, *old_nns;
642 const unsigned char *ptr=NULL;
644 /* filter out all '.' and '..' names */
646 ptr=(const unsigned char *)tvb_get_ptr(tvb, name_offset, name_len);
659 nns=g_mem_chunk_alloc(nfs_name_snoop_chunk);
665 nns->parent_len=parent_len;
666 nns->parent=g_malloc(parent_len);
667 memcpy(nns->parent, tvb_get_ptr(tvb, parent_offset, parent_len), parent_len);
673 nns->name_len=name_len;
677 nns->name=g_malloc(name_len+1);
678 memcpy(nns->name, ptr, name_len);
680 nns->name[name_len]=0;
682 nns->full_name_len=0;
685 /* remove any old entry for this */
686 old_nns=g_hash_table_lookup(nfs_name_snoop_unmatched, (gconstpointer)xid);
688 /* if we haven't seen the reply yet, then there are no
689 matched entries for it, thus we can dealloc the arrays*/
691 g_free(old_nns->name);
695 g_free(old_nns->parent);
696 old_nns->parent=NULL;
697 old_nns->parent_len=0;
699 g_mem_chunk_free(nfs_name_snoop_chunk, old_nns);
701 g_hash_table_remove(nfs_name_snoop_unmatched, (gconstpointer)xid);
704 g_hash_table_insert(nfs_name_snoop_unmatched, (gpointer)xid, nns);
708 nfs_name_snoop_add_fh(int xid, tvbuff_t *tvb, int fh_offset, int fh_length)
711 nfs_name_snoop_t *nns, *old_nns;
712 nfs_name_snoop_key_t *key;
714 /* find which request we correspond to */
715 nns=g_hash_table_lookup(nfs_name_snoop_unmatched, (gconstpointer)xid);
717 /* oops couldnt find matching request, bail out */
721 /* if we have already seen this response earlier */
726 /* oki, we have a new entry */
727 fh=g_malloc(fh_length);
728 memcpy(fh, tvb_get_ptr(tvb, fh_offset, fh_length), fh_length);
730 nns->fh_length=fh_length;
732 key=g_mem_chunk_alloc(nfs_name_snoop_key_chunk);
734 key->fh_length=nns->fh_length;
737 /* already have something matched for this fh, remove it from
739 old_nns=g_hash_table_lookup(nfs_name_snoop_matched, key);
741 g_hash_table_remove(nfs_name_snoop_matched, key);
744 g_hash_table_remove(nfs_name_snoop_unmatched, (gconstpointer)xid);
745 g_hash_table_insert(nfs_name_snoop_matched, key, nns);
749 nfs_full_name_snoop(nfs_name_snoop_t *nns, int *len, unsigned char **name, unsigned char **pos)
751 nfs_name_snoop_t *parent_nns = NULL;
752 nfs_name_snoop_key_t key;
754 /* check if the nns component ends with a '/' else we just allocate
755 an extra byte to len to accommodate for it later */
756 if(nns->name[nns->name_len-1]!='/'){
760 (*len) += nns->name_len;
762 if(nns->parent==NULL){
763 *name = g_malloc((*len)+1);
766 strcpy(*pos, nns->name);
767 *pos += nns->name_len;
772 key.fh_length=nns->parent_len;
775 parent_nns=g_hash_table_lookup(nfs_name_snoop_matched, &key);
778 nfs_full_name_snoop(parent_nns, len, name, pos);
780 /* make sure components are '/' separated */
781 if( (*pos)[-1] != '/'){
786 strcpy(*pos, nns->name);
787 *pos += nns->name_len;
796 nfs_name_snoop_fh(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int fh_offset, int fh_length, gboolean hidden)
798 nfs_name_snoop_key_t key;
799 nfs_name_snoop_t *nns = NULL;
801 /* if this is a new packet, see if we can register the mapping */
802 if(!pinfo->fd->flags.visited){
804 key.fh_length=fh_length;
805 key.fh=(const unsigned char *)tvb_get_ptr(tvb, fh_offset, fh_length);
807 nns=g_hash_table_lookup(nfs_name_snoop_matched, &key);
809 nfs_name_snoop_key_t *k;
810 k=g_mem_chunk_alloc(nfs_name_snoop_key_chunk);
811 k->key=pinfo->fd->num;
812 k->fh_length=nns->fh_length;
814 g_hash_table_insert(nfs_name_snoop_known, k, nns);
816 if(nfs_file_name_full_snooping){
817 unsigned char *name=NULL, *pos=NULL;
820 nfs_full_name_snoop(nns, &len, &name, &pos);
823 nns->full_name_len=len;
829 /* see if we know this mapping */
831 key.key=pinfo->fd->num;
832 key.fh_length=fh_length;
833 key.fh=(const unsigned char *)tvb_get_ptr(tvb, fh_offset, fh_length);
835 nns=g_hash_table_lookup(nfs_name_snoop_known, &key);
838 /* if we know the mapping, print the filename */
841 proto_tree_add_string_hidden(tree, hf_nfs_name, tvb,
842 fh_offset, 0, nns->name);
844 proto_tree_add_string_format(tree, hf_nfs_name, tvb,
845 fh_offset, 0, nns->name, "Name: %s", nns->name);
849 proto_tree_add_string_hidden(tree, hf_nfs_full_name, tvb,
850 fh_offset, 0, nns->name);
852 proto_tree_add_string_format(tree, hf_nfs_full_name, tvb,
853 fh_offset, 0, nns->name, "Full Name: %s", nns->full_name);
859 /* file handle dissection */
861 #define FHT_UNKNOWN 0
863 #define FHT_LINUX_KNFSD_LE 2
864 #define FHT_LINUX_NFSD_LE 3
865 #define FHT_LINUX_KNFSD_NEW 4
867 static const value_string names_fhtype[] =
869 { FHT_UNKNOWN, "unknown" },
870 { FHT_SVR4, "System V R4" },
871 { FHT_LINUX_KNFSD_LE, "Linux knfsd (little-endian)" },
872 { FHT_LINUX_NFSD_LE, "Linux user-land nfsd (little-endian)" },
873 { FHT_LINUX_KNFSD_NEW, "Linux knfsd (new)" },
878 /* SVR4: checked with ReliantUNIX (5.43, 5.44, 5.45) */
881 dissect_fhandle_data_SVR4(tvbuff_t* tvb, int offset, proto_tree *tree,
884 guint32 nof = offset;
896 temp = tvb_get_ntohl(tvb, fsid_O);
897 fsid_major = ( temp>>18 ) & 0x3fff; /* 14 bits */
898 fsid_minor = ( temp ) & 0x3ffff; /* 18 bits */
900 proto_item* fsid_item = NULL;
901 proto_tree* fsid_tree = NULL;
903 fsid_item = proto_tree_add_text(tree, tvb,
905 "file system ID: %d,%d", fsid_major, fsid_minor);
907 fsid_tree = proto_item_add_subtree(fsid_item,
909 proto_tree_add_uint(fsid_tree, hf_nfs_fh_fsid_major,
910 tvb, fsid_O, 2, fsid_major);
911 proto_tree_add_uint(fsid_tree, hf_nfs_fh_fsid_minor,
912 tvb, fsid_O+1, 3, fsid_minor);
915 nof = fsid_O + fsid_L;
918 /* file system type */
926 fstype = tvb_get_ntohl(tvb, fstype_O);
928 proto_tree_add_uint(tree, hf_nfs_fh_fstype, tvb,
929 fstype_O, fstype_L, fstype);
931 nof = fstype_O + fstype_L;
941 guint32 fn_data_inode_O;
942 guint32 fn_data_inode_L;
944 guint32 fn_data_gen_O;
945 guint32 fn_data_gen_L;
952 fn_len = tvb_get_ntohs(tvb, fn_len_O);
953 fn_data_O = fn_O + fn_len_L;
954 fn_data_inode_O = fn_data_O + 2;
956 inode = tvb_get_ntohl(tvb, fn_data_inode_O);
957 fn_data_gen_O = fn_data_inode_O + fn_data_inode_L;
959 gen = tvb_get_ntohl(tvb, fn_data_gen_O);
960 fn_L = fn_len_L + fn_len;
962 proto_item* fn_item = NULL;
963 proto_tree* fn_tree = NULL;
965 fn_item = proto_tree_add_uint(tree, hf_nfs_fh_fn, tvb,
968 fn_tree = proto_item_add_subtree(fn_item,
970 proto_tree_add_uint(fn_tree, hf_nfs_fh_fn_len,
971 tvb, fn_len_O, fn_len_L, fn_len);
972 proto_tree_add_uint(fn_tree, hf_nfs_fh_fn_inode,
973 tvb, fn_data_inode_O, fn_data_inode_L, inode);
974 proto_tree_add_uint(fn_tree, hf_nfs_fh_fn_generation,
975 tvb, fn_data_gen_O, fn_data_gen_L, gen);
978 nof = fn_O + fn_len_L + fn_len;
981 /* exported file number */
988 guint32 xfn_data_inode_O;
989 guint32 xfn_data_inode_L;
991 guint32 xfn_data_gen_O;
992 guint32 xfn_data_gen_L;
999 xfn_len = tvb_get_ntohs(tvb, xfn_len_O);
1000 xfn_data_O = xfn_O + xfn_len_L;
1001 xfn_data_inode_O = xfn_data_O + 2;
1002 xfn_data_inode_L = 4;
1003 xinode = tvb_get_ntohl(tvb, xfn_data_inode_O);
1004 xfn_data_gen_O = xfn_data_inode_O + xfn_data_inode_L;
1006 xgen = tvb_get_ntohl(tvb, xfn_data_gen_O);
1007 xfn_L = xfn_len_L + xfn_len;
1009 proto_item* xfn_item = NULL;
1010 proto_tree* xfn_tree = NULL;
1012 xfn_item = proto_tree_add_uint(tree, hf_nfs_fh_xfn, tvb,
1013 xfn_O, xfn_L, xinode);
1015 xfn_tree = proto_item_add_subtree(xfn_item,
1017 proto_tree_add_uint(xfn_tree, hf_nfs_fh_xfn_len,
1018 tvb, xfn_len_O, xfn_len_L, xfn_len);
1019 proto_tree_add_uint(xfn_tree, hf_nfs_fh_xfn_inode,
1020 tvb, xfn_data_inode_O, xfn_data_inode_L, xinode);
1021 proto_tree_add_uint(xfn_tree, hf_nfs_fh_xfn_generation,
1022 tvb, xfn_data_gen_O, xfn_data_gen_L, xgen);
1029 /* Checked with RedHat Linux 6.2 (kernel 2.2.14 knfsd) */
1032 dissect_fhandle_data_LINUX_KNFSD_LE(tvbuff_t* tvb, int offset, proto_tree *tree,
1041 guint32 xfsid_major;
1042 guint32 xfsid_minor;
1046 dentry = tvb_get_letohl(tvb, offset+0);
1047 inode = tvb_get_letohl(tvb, offset+4);
1048 dirinode = tvb_get_letohl(tvb, offset+8);
1049 temp = tvb_get_letohs (tvb,offset+12);
1050 fsid_major = (temp >> 8) & 0xff;
1051 fsid_minor = (temp ) & 0xff;
1052 temp = tvb_get_letohs(tvb,offset+16);
1053 xfsid_major = (temp >> 8) & 0xff;
1054 xfsid_minor = (temp ) & 0xff;
1055 xinode = tvb_get_letohl(tvb,offset+20);
1056 gen = tvb_get_letohl(tvb,offset+24);
1059 proto_tree_add_uint(tree, hf_nfs_fh_dentry,
1060 tvb, offset+0, 4, dentry);
1061 proto_tree_add_uint(tree, hf_nfs_fh_fn_inode,
1062 tvb, offset+4, 4, inode);
1063 proto_tree_add_uint(tree, hf_nfs_fh_dirinode,
1064 tvb, offset+8, 4, dirinode);
1066 /* file system id (device) */
1068 proto_item* fsid_item = NULL;
1069 proto_tree* fsid_tree = NULL;
1071 fsid_item = proto_tree_add_text(tree, tvb,
1073 "file system ID: %d,%d", fsid_major, fsid_minor);
1075 fsid_tree = proto_item_add_subtree(fsid_item,
1077 proto_tree_add_uint(fsid_tree, hf_nfs_fh_fsid_major,
1078 tvb, offset+13, 1, fsid_major);
1079 proto_tree_add_uint(fsid_tree, hf_nfs_fh_fsid_minor,
1080 tvb, offset+12, 1, fsid_minor);
1084 /* exported file system id (device) */
1086 proto_item* xfsid_item = NULL;
1087 proto_tree* xfsid_tree = NULL;
1089 xfsid_item = proto_tree_add_text(tree, tvb,
1091 "exported file system ID: %d,%d", xfsid_major, xfsid_minor);
1093 xfsid_tree = proto_item_add_subtree(xfsid_item,
1095 proto_tree_add_uint(xfsid_tree, hf_nfs_fh_xfsid_major,
1096 tvb, offset+17, 1, xfsid_major);
1097 proto_tree_add_uint(xfsid_tree, hf_nfs_fh_xfsid_minor,
1098 tvb, offset+16, 1, xfsid_minor);
1102 proto_tree_add_uint(tree, hf_nfs_fh_xfn_inode,
1103 tvb, offset+20, 4, xinode);
1104 proto_tree_add_uint(tree, hf_nfs_fh_fn_generation,
1105 tvb, offset+24, 4, gen);
1110 /* Checked with RedHat Linux 5.2 (nfs-server 2.2beta47 user-land nfsd) */
1113 dissect_fhandle_data_LINUX_NFSD_LE(tvbuff_t* tvb, int offset, proto_tree *tree,
1119 pinode = tvb_get_letohl(tvb, offset+0);
1121 proto_tree_add_uint(tree, hf_nfs_fh_pinode,
1122 tvb, offset+0, 4, pinode);
1130 hashlen = tvb_get_guint8(tvb, offset+4);
1132 proto_item* hash_item = NULL;
1133 proto_tree* hash_tree = NULL;
1135 hash_item = proto_tree_add_text(tree, tvb, offset+4,
1138 tvb_bytes_to_str(tvb,offset+5,hashlen));
1140 hash_tree = proto_item_add_subtree(hash_item,
1143 proto_tree_add_uint(hash_tree,
1144 hf_nfs_fh_hp_len, tvb, offset+4, 1,
1146 proto_tree_add_text(hash_tree, tvb, offset+5,
1149 tvb_bytes_to_str(tvb,offset+5,hashlen));
1157 /* Checked with SuSE 7.1 (kernel 2.4.0 knfsd) */
1158 /* read linux-2.4.5/include/linux/nfsd/nfsfh.h for more details */
1160 #define AUTH_TYPE_NONE 0
1161 static const value_string auth_type_names[] = {
1162 { AUTH_TYPE_NONE, "no authentication" },
1166 #define FSID_TYPE_MAJOR_MINOR_INODE 0
1167 static const value_string fsid_type_names[] = {
1168 { FSID_TYPE_MAJOR_MINOR_INODE, "major/minor/inode" },
1172 #define FILEID_TYPE_ROOT 0
1173 #define FILEID_TYPE_INODE_GENERATION 1
1174 #define FILEID_TYPE_INODE_GENERATION_PARENT 2
1175 static const value_string fileid_type_names[] = {
1176 { FILEID_TYPE_ROOT, "root" },
1177 { FILEID_TYPE_INODE_GENERATION, "inode/generation" },
1178 { FILEID_TYPE_INODE_GENERATION_PARENT, "inode/generation/parent" },
1183 dissect_fhandle_data_LINUX_KNFSD_NEW(tvbuff_t* tvb, int offset, proto_tree *tree,
1191 version = tvb_get_guint8(tvb, offset + 0);
1193 proto_tree_add_uint(tree, hf_nfs_fh_version,
1194 tvb, offset+0, 1, version);
1199 auth_type = tvb_get_guint8(tvb, offset + 1);
1200 fsid_type = tvb_get_guint8(tvb, offset + 2);
1201 fileid_type = tvb_get_guint8(tvb, offset + 3);
1203 proto_item* encoding_item = proto_tree_add_text(tree, tvb,
1205 "encoding: %u %u %u",
1206 auth_type, fsid_type, fileid_type);
1207 if (encoding_item) {
1208 proto_tree* encoding_tree = proto_item_add_subtree(encoding_item,
1209 ett_nfs_fh_encoding);
1210 if (encoding_tree) {
1211 proto_tree_add_uint(encoding_tree, hf_nfs_fh_auth_type,
1212 tvb, offset+1, 1, auth_type);
1213 proto_tree_add_uint(encoding_tree, hf_nfs_fh_fsid_type,
1214 tvb, offset+2, 1, fsid_type);
1215 proto_tree_add_uint(encoding_tree, hf_nfs_fh_fileid_type,
1216 tvb, offset+3, 1, fileid_type);
1223 /* unknown version */
1228 switch (auth_type) {
1230 /* no authentication */
1232 proto_tree_add_text(tree, tvb,
1234 "authentication: none");
1238 /* unknown authentication type */
1243 switch (fsid_type) {
1249 fsid_major = tvb_get_ntohs(tvb, offset + 0);
1250 fsid_minor = tvb_get_ntohs(tvb, offset + 2);
1251 fsid_inode = tvb_get_letohl(tvb, offset + 4);
1253 proto_item* fsid_item = proto_tree_add_text(tree, tvb,
1255 "file system ID: %u,%u (inode %u)",
1256 fsid_major, fsid_minor, fsid_inode);
1258 proto_tree* fsid_tree = proto_item_add_subtree(fsid_item,
1261 proto_tree_add_uint(fsid_tree, hf_nfs_fh_fsid_major,
1262 tvb, offset+0, 2, fsid_major);
1263 proto_tree_add_uint(fsid_tree, hf_nfs_fh_fsid_minor,
1264 tvb, offset+2, 2, fsid_minor);
1265 proto_tree_add_uint(fsid_tree, hf_nfs_fh_fsid_inode,
1266 tvb, offset+4, 4, fsid_inode);
1273 /* unknown fsid type */
1278 switch (fileid_type) {
1281 proto_tree_add_text(tree, tvb,
1283 "file ID: root inode");
1290 inode = tvb_get_letohl(tvb, offset + 0);
1291 generation = tvb_get_letohl(tvb, offset + 4);
1294 proto_item* fileid_item = proto_tree_add_text(tree, tvb,
1299 proto_tree* fileid_tree = proto_item_add_subtree(
1300 fileid_item, ett_nfs_fh_fn);
1302 proto_tree_add_uint(fileid_tree, hf_nfs_fh_fn_inode,
1303 tvb, offset+0, 4, inode);
1304 proto_tree_add_uint(fileid_tree, hf_nfs_fh_fn_generation,
1305 tvb, offset+4, 4, generation);
1315 guint32 parent_inode;
1317 inode = tvb_get_letohl(tvb, offset + 0);
1318 generation = tvb_get_letohl(tvb, offset + 4);
1319 parent_inode = tvb_get_letohl(tvb, offset + 8);
1322 proto_item* fileid_item = proto_tree_add_text(tree, tvb,
1327 proto_tree* fileid_tree = proto_item_add_subtree(
1328 fileid_item, ett_nfs_fh_fn);
1330 proto_tree_add_uint(fileid_tree, hf_nfs_fh_fn_inode,
1331 tvb, offset+0, 4, inode);
1332 proto_tree_add_uint(fileid_tree, hf_nfs_fh_fn_generation,
1333 tvb, offset+4, 4, generation);
1334 proto_tree_add_uint(fileid_tree, hf_nfs_fh_dirinode,
1335 tvb, offset+8, 4, parent_inode);
1343 /* unknown fileid type */
1354 dissect_fhandle_data_unknown(tvbuff_t *tvb, int offset, proto_tree *tree,
1359 gboolean first_line;
1363 while (bytes_left != 0) {
1365 if (sublen > bytes_left)
1366 sublen = bytes_left;
1367 proto_tree_add_text(tree, tvb, offset, sublen,
1369 first_line ? "data: " :
1371 tvb_bytes_to_str(tvb,offset,sublen));
1372 bytes_left -= sublen;
1380 dissect_fhandle_data(tvbuff_t *tvb, int offset, packet_info *pinfo,
1381 proto_tree *tree, unsigned int fhlen, gboolean hidden)
1383 unsigned int fhtype = FHT_UNKNOWN;
1385 /* filehandle too long */
1386 if (fhlen>64) goto type_ready;
1387 /* Not all bytes there. Any attempt to deduce the type would be
1389 if (!tvb_bytes_exist(tvb,offset,fhlen)) goto type_ready;
1391 /* this is to set up fhandle display filters to find both packets
1393 if(nfs_fhandle_reqrep_matching && (!hidden) ){
1394 nfs_fhandle_data_t *old_fhd=NULL;
1397 if( !pinfo->fd->flags.visited ){
1398 nfs_fhandle_data_t fhd;
1400 /* first check if we have seen this fhandle before */
1402 fhd.fh=(const unsigned char *)tvb_get_ptr(tvb, offset, fhlen);
1403 old_fhd=g_hash_table_lookup(nfs_fhandle_data_table,
1404 (gconstpointer)&fhd);
1406 /* oh, a new fhandle, alloc struct and store it in the table*/
1407 old_fhd=g_mem_chunk_alloc(nfs_fhandle_data_chunk);
1410 memcpy(fh, fhd.fh, fhlen);
1412 old_fhd->tvb=tvb_new_real_data(old_fhd->fh, old_fhd->len, old_fhd->len);
1413 g_hash_table_insert(nfs_fhandle_data_table,
1414 (gpointer)old_fhd, (gpointer)old_fhd);
1417 /* XXX here we should really check that we havent stored
1418 this fhandle for this frame number already.
1419 We should also make sure we can handle when we have multiple
1420 fhandles seen for the same frame, which WILL happen for certain
1421 nfs calls. For now, we dont handle this and those calls will
1422 not work properly with this feature
1424 g_hash_table_insert(nfs_fhandle_frame_table,
1425 (gpointer)pinfo->fd->num,
1430 /* create a semiunique hash value for the filehandle */
1435 for(fhhash=0,i=0;i<(fhlen-3);i+=4){
1437 val = tvb_get_ntohl(tvb, offset+i);
1442 proto_tree_add_uint_hidden(tree, hf_nfs_fh_hash, tvb, offset,
1445 proto_tree_add_uint(tree, hf_nfs_fh_hash, tvb, offset,
1449 if(nfs_file_name_snooping){
1450 nfs_name_snoop_fh(pinfo, tree, tvb, offset, fhlen, hidden);
1454 /* calculate (heuristically) fhtype */
1457 if (tvb_get_ntohl(tvb,offset) == 0x01000000) {
1458 fhtype=FHT_LINUX_KNFSD_NEW;
1462 if (tvb_get_ntohl(tvb,offset) == 0x01000001) {
1463 fhtype=FHT_LINUX_KNFSD_NEW;
1467 if (tvb_get_ntohl(tvb,offset) == 0x01000002) {
1468 fhtype=FHT_LINUX_KNFSD_NEW;
1474 if (tvb_get_ntohs(tvb,offset+4) == 0) {
1475 len1=tvb_get_ntohs(tvb,offset+8);
1476 if (tvb_bytes_exist(tvb,offset+10+len1,2)) {
1477 len2=tvb_get_ntohs(tvb,
1479 if (fhlen==12+len1+len2) {
1485 len1 = tvb_get_guint8(tvb,offset+4);
1486 if (len1<28 && tvb_bytes_exist(tvb,offset+5,len1)) {
1488 for (len2=5+len1;len2<32;len2++) {
1489 if (tvb_get_guint8(tvb,offset+len2)) {
1495 fhtype=FHT_LINUX_NFSD_LE;
1499 if (tvb_get_ntohl(tvb,offset+28) == 0) {
1500 if (tvb_get_ntohs(tvb,offset+14) == 0) {
1501 if (tvb_get_ntohs(tvb,offset+18) == 0) {
1502 fhtype=FHT_LINUX_KNFSD_LE;
1514 proto_tree_add_text(tree, tvb, offset, 0,
1515 "type: %s", val_to_str(fhtype, names_fhtype, "Unknown"));
1520 dissect_fhandle_data_SVR4 (tvb, offset, tree,
1523 case FHT_LINUX_KNFSD_LE:
1524 dissect_fhandle_data_LINUX_KNFSD_LE(tvb, offset, tree,
1527 case FHT_LINUX_NFSD_LE:
1528 dissect_fhandle_data_LINUX_NFSD_LE (tvb, offset, tree,
1531 case FHT_LINUX_KNFSD_NEW:
1532 dissect_fhandle_data_LINUX_KNFSD_NEW (tvb, offset, tree,
1537 dissect_fhandle_data_unknown(tvb, offset, tree, fhlen);
1544 dissect_fhandle_hidden(packet_info *pinfo, proto_tree *tree, nfs_fhandle_data_t *nfd)
1546 if(nfd && nfd->len){
1547 dissect_fhandle_data(nfd->tvb, 0, pinfo, tree, nfd->len, TRUE);
1552 /***************************/
1553 /* NFS Version 2, RFC 1094 */
1554 /***************************/
1557 /* RFC 1094, Page 12..14 */
1558 static const value_string names_nfs_stat[] =
1565 { 13, "ERR_ACCES" },
1566 { 17, "ERR_EXIST" },
1567 { 18, "ERR_XDEV" }, /* not in spec, but can happen */
1568 { 19, "ERR_NODEV" },
1569 { 20, "ERR_NOTDIR" },
1570 { 21, "ERR_ISDIR" },
1571 { 22, "ERR_INVAL" }, /* not in spec, but I think it can happen */
1572 { 26, "ERR_TXTBSY" }, /* not in spec, but I think it can happen */
1574 { 28, "ERR_NOSPC" },
1576 { 31, "ERR_MLINK" }, /* not in spec, but can happen */
1577 { 45, "ERR_OPNOTSUPP" }, /* not in spec, but I think it can happen */
1578 { 63, "ERR_NAMETOOLONG" },
1579 { 66, "ERR_NOTEMPTY" },
1580 { 69, "ERR_DQUOT" },
1581 { 70, "ERR_STALE" },
1582 { 99, "ERR_WFLUSH" },
1586 /* NFSv4 Draft Specification, Page 198-199 */
1587 static const value_string names_nfs_stat4[] = {
1589 { 1, "NFS4ERR_PERM" },
1590 { 2, "NFS4ERR_NOENT" },
1591 { 5, "NFS4ERR_IO" },
1592 { 6, "NFS4ERR_NXIO" },
1593 { 13, "NFS4ERR_ACCES" },
1594 { 17, "NFS4ERR_EXIST" },
1595 { 18, "NFS4ERR_XDEV" },
1596 { 19, "NFS4ERR_NODEV" },
1597 { 20, "NFS4ERR_NOTDIR" },
1598 { 21, "NFS4ERR_ISDIR" },
1599 { 22, "NFS4ERR_INVAL" },
1600 { 27, "NFS4ERR_FBIG" },
1601 { 28, "NFS4ERR_NOSPC" },
1602 { 30, "NFS4ERR_ROFS" },
1603 { 31, "NFS4ERR_MLINK" },
1604 { 63, "NFS4ERR_NAMETOOLONG" },
1605 { 66, "NFS4ERR_NOTEMPTY" },
1606 { 69, "NFS4ERR_DQUOT" },
1607 { 70, "NFS4ERR_STALE" },
1608 { 10001, "NFS4ERR_BADHANDLE" },
1609 { 10003, "NFS4ERR_BAD_COOKIE" },
1610 { 10004, "NFS4ERR_NOTSUPP" },
1611 { 10005, "NFS4ERR_TOOSMALL" },
1612 { 10006, "NFS4ERR_SERVERFAULT" },
1613 { 10007, "NFS4ERR_BADTYPE" },
1614 { 10008, "NFS4ERR_DELAY" },
1615 { 10009, "NFS4ERR_SAME" },
1616 { 10010, "NFS4ERR_DENIED" },
1617 { 10011, "NFS4ERR_EXPIRED" },
1618 { 10012, "NFS4ERR_LOCKED" },
1619 { 10013, "NFS4ERR_GRACE" },
1620 { 10014, "NFS4ERR_FHEXPIRED" },
1621 { 10015, "NFS4ERR_SHARE_DENIED" },
1622 { 10016, "NFS4ERR_WRONGSEC" },
1623 { 10017, "NFS4ERR_CLID_INUSE" },
1624 { 10018, "NFS4ERR_RESOURCE" },
1625 { 10019, "NFS4ERR_MOVED" },
1626 { 10020, "NFS4ERR_NOFILEHANDLE" },
1627 { 10021, "NFS4ERR_MINOR_VERS_MISMATCH" },
1628 { 10022, "NFS4ERR_STALE_CLIENTID" },
1629 { 10023, "NFS4ERR_STALE_STATEID" },
1630 { 10024, "NFS4ERR_OLD_STATEID" },
1631 { 10025, "NFS4ERR_BAD_STATEID" },
1632 { 10026, "NFS4ERR_BAD_SEQID" },
1633 { 10027, "NFS4ERR_NOT_SAME" },
1634 { 10028, "NFS4ERR_LOCK_RANGE" },
1635 { 10029, "NFS4ERR_SYMLINK" },
1636 { 10030, "NFS4ERR_READDIR_NOSPC" },
1637 { 10031, "NFS4ERR_LEASE_MOVED" },
1638 { 10032, "NFS4ERR_ATTRNOTSUPP" },
1639 { 10033, "NFS4ERR_NO_GRACE" },
1640 { 10034, "NFS4ERR_RECLAIM_BAD" },
1641 { 10035, "NFS4ERR_RECLAIM_CONFLICT" },
1642 { 10036, "NFS4ERR_BADXDR" },
1643 { 10037, "NFS4ERR_LOCKS_HELD" },
1644 { 10038, "NFS4ERR_OPENMODE" },
1645 { 10039, "NFS4ERR_BADOWNER" },
1650 /* This function has been modified to support NFSv4 style error codes as
1651 * well as being backwards compatible with NFSv2 and NFSv3.
1654 dissect_stat_internal(tvbuff_t *tvb, int offset,
1655 proto_tree *tree, guint32* status, int nfsvers)
1659 stat = tvb_get_ntohl(tvb, offset+0);
1662 /* this gives the right NFSv2 number<->message relation */
1663 /* and makes it searchable via "nfs.status" */
1664 proto_tree_add_uint_format(tree, hf_nfs_nfsstat3, tvb,
1665 offset+0, 4, stat, "Status: %s (%u)",
1667 (nfsvers != 4)? names_nfs_stat: names_nfs_stat4,"%u"), stat);
1672 if (status) *status = stat;
1678 /* RFC 1094, Page 12..14 */
1680 dissect_stat(tvbuff_t *tvb, int offset, proto_tree *tree,
1683 return dissect_stat_internal(tvb, offset, tree, status, !4);
1687 /* RFC 1094, Page 12..14 */
1689 dissect_nfs2_stat_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree* tree)
1693 offset = dissect_stat(tvb, offset, tree, &status);
1700 dissect_nfs_nfsstat4(tvbuff_t *tvb, int offset,
1701 proto_tree *tree, guint32 *status)
1703 return dissect_stat_internal(tvb, offset, tree, status, 4);
1707 /* RFC 1094, Page 15 */
1709 dissect_ftype(tvbuff_t *tvb, int offset, proto_tree *tree, char* name)
1712 char* ftype_name = NULL;
1714 const value_string nfs2_ftype[] =
1717 { 1, "Regular File" },
1719 { 3, "Block Special Device" },
1720 { 4, "Character Special Device" },
1721 { 5, "Symbolic Link" },
1725 ftype = tvb_get_ntohl(tvb, offset+0);
1726 ftype_name = val_to_str(ftype, nfs2_ftype, "%u");
1729 proto_tree_add_text(tree, tvb, offset, 4,
1730 "%s: %s (%u)", name, ftype_name, ftype);
1738 /* RFC 1094, Page 15 */
1740 dissect_fhandle(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree,
1744 proto_tree* ftree = NULL;
1747 fitem = proto_tree_add_text(tree, tvb, offset, FHSIZE,
1750 ftree = proto_item_add_subtree(fitem, ett_nfs_fhandle);
1753 /* are we snooping fh to filenames ?*/
1754 if((!pinfo->fd->flags.visited) && nfs_file_name_snooping){
1755 rpc_call_info_value *civ=pinfo->private_data;
1757 /* NFS v2 LOOKUP, CREATE, MKDIR calls might give us a mapping*/
1758 if( (civ->prog==100003)
1761 &&((civ->proc==4)||(civ->proc==9)||(civ->proc==14))
1763 nfs_name_snoop_add_fh(civ->xid, tvb,
1767 /* MOUNT v1,v2 MNT replies might give us a filehandle*/
1768 if( (civ->prog==100005)
1770 &&((civ->vers==1)||(civ->vers==2))
1773 nfs_name_snoop_add_fh(civ->xid, tvb,
1778 dissect_fhandle_data(tvb, offset, pinfo, ftree, FHSIZE, FALSE);
1784 /* RFC 1094, Page 15 */
1786 dissect_nfs2_fhandle_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
1788 offset = dissect_fhandle(tvb, offset, pinfo, tree, "object");
1794 /* RFC 1094, Page 15 */
1796 dissect_timeval(tvbuff_t *tvb, int offset, proto_tree *tree, int hf_time, int hf_time_sec, int hf_time_usec)
1802 proto_item* time_item;
1803 proto_tree* time_tree = NULL;
1805 seconds = tvb_get_ntohl(tvb, offset+0);
1806 useconds = tvb_get_ntohl(tvb, offset+4);
1808 ts.nsecs = useconds*1000;
1811 time_item = proto_tree_add_time(tree, hf_time, tvb, offset, 8,
1814 time_tree = proto_item_add_subtree(time_item, ett_nfs_timeval);
1818 proto_tree_add_uint(time_tree, hf_time_sec, tvb, offset, 4,
1820 proto_tree_add_uint(time_tree, hf_time_usec, tvb, offset+4, 4,
1828 /* RFC 1094, Page 16 */
1829 static const value_string nfs2_mode_names[] = {
1830 { 0040000, "Directory" },
1831 { 0020000, "Character Special Device" },
1832 { 0060000, "Block Special Device" },
1833 { 0100000, "Regular File" },
1834 { 0120000, "Symbolic Link" },
1835 { 0140000, "Named Socket" },
1840 dissect_mode(tvbuff_t *tvb, int offset, proto_tree *tree, char* name)
1843 proto_item* mode_item = NULL;
1844 proto_tree* mode_tree = NULL;
1846 mode = tvb_get_ntohl(tvb, offset+0);
1849 mode_item = proto_tree_add_text(tree, tvb, offset, 4,
1850 "%s: 0%o", name, mode);
1852 mode_tree = proto_item_add_subtree(mode_item, ett_nfs_mode);
1856 proto_tree_add_text(mode_tree, tvb, offset, 4, "%s",
1857 decode_enumerated_bitfield(mode, 0160000, 16,
1858 nfs2_mode_names, "%s"));
1859 proto_tree_add_text(mode_tree, tvb, offset, 4, "%s",
1860 decode_boolean_bitfield(mode, 04000, 16, "Set user id on exec", "not SUID"));
1861 proto_tree_add_text(mode_tree, tvb, offset, 4, "%s",
1862 decode_boolean_bitfield(mode, 02000, 16, "Set group id on exec", "not SGID"));
1863 proto_tree_add_text(mode_tree, tvb, offset, 4, "%s",
1864 decode_boolean_bitfield(mode, 01000, 16, "Save swapped text even after use", "not save swapped text"));
1865 proto_tree_add_text(mode_tree, tvb, offset, 4, "%s",
1866 decode_boolean_bitfield(mode, 0400, 16, "Read permission for owner", "no Read permission for owner"));
1867 proto_tree_add_text(mode_tree, tvb, offset, 4, "%s",
1868 decode_boolean_bitfield(mode, 0200, 16, "Write permission for owner", "no Write permission for owner"));
1869 proto_tree_add_text(mode_tree, tvb, offset, 4, "%s",
1870 decode_boolean_bitfield(mode, 0100, 16, "Execute permission for owner", "no Execute permission for owner"));
1871 proto_tree_add_text(mode_tree, tvb, offset, 4, "%s",
1872 decode_boolean_bitfield(mode, 040, 16, "Read permission for group", "no Read permission for group"));
1873 proto_tree_add_text(mode_tree, tvb, offset, 4, "%s",
1874 decode_boolean_bitfield(mode, 020, 16, "Write permission for group", "no Write permission for group"));
1875 proto_tree_add_text(mode_tree, tvb, offset, 4, "%s",
1876 decode_boolean_bitfield(mode, 010, 16, "Execute permission for group", "no Execute permission for group"));
1877 proto_tree_add_text(mode_tree, tvb, offset, 4, "%s",
1878 decode_boolean_bitfield(mode, 04, 16, "Read permission for others", "no Read permission for others"));
1879 proto_tree_add_text(mode_tree, tvb, offset, 4, "%s",
1880 decode_boolean_bitfield(mode, 02, 16, "Write permission for others", "no Write permission for others"));
1881 proto_tree_add_text(mode_tree, tvb, offset, 4, "%s",
1882 decode_boolean_bitfield(mode, 01, 16, "Execute permission for others", "no Execute permission for others"));
1890 /* RFC 1094, Page 15 */
1892 dissect_fattr(tvbuff_t *tvb, int offset, proto_tree *tree, char* name)
1894 proto_item* fattr_item = NULL;
1895 proto_tree* fattr_tree = NULL;
1896 int old_offset = offset;
1899 fattr_item = proto_tree_add_text(tree, tvb, offset, -1,
1901 fattr_tree = proto_item_add_subtree(fattr_item, ett_nfs_fattr);
1904 offset = dissect_ftype(tvb, offset, fattr_tree, "type");
1905 offset = dissect_mode(tvb, offset, fattr_tree, "mode");
1906 offset = dissect_rpc_uint32(tvb, fattr_tree, hf_nfs_fattr_nlink, offset);
1907 offset = dissect_rpc_uint32(tvb, fattr_tree, hf_nfs_fattr_uid, offset);
1908 offset = dissect_rpc_uint32(tvb, fattr_tree, hf_nfs_fattr_gid, offset);
1909 offset = dissect_rpc_uint32(tvb, fattr_tree, hf_nfs_fattr_size, offset);
1910 offset = dissect_rpc_uint32(tvb, fattr_tree, hf_nfs_fattr_blocksize, offset);
1911 offset = dissect_rpc_uint32(tvb, fattr_tree, hf_nfs_fattr_rdev, offset);
1912 offset = dissect_rpc_uint32(tvb, fattr_tree, hf_nfs_fattr_blocks, offset);
1913 offset = dissect_rpc_uint32(tvb, fattr_tree, hf_nfs_fattr_fsid, offset);
1914 offset = dissect_rpc_uint32(tvb, fattr_tree, hf_nfs_fattr_fileid, offset);
1916 offset = dissect_timeval(tvb, offset, fattr_tree, hf_nfs_atime, hf_nfs_atime_sec, hf_nfs_atime_usec);
1917 offset = dissect_timeval(tvb, offset, fattr_tree, hf_nfs_mtime, hf_nfs_mtime_sec, hf_nfs_mtime_usec);
1918 offset = dissect_timeval(tvb, offset, fattr_tree, hf_nfs_ctime, hf_nfs_ctime_sec, hf_nfs_ctime_usec);
1920 /* now we know, that fattr is shorter */
1922 proto_item_set_len(fattr_item, offset - old_offset);
1929 /* RFC 1094, Page 17 */
1931 dissect_sattr(tvbuff_t *tvb, int offset, proto_tree *tree, char* name)
1933 proto_item* sattr_item = NULL;
1934 proto_tree* sattr_tree = NULL;
1935 int old_offset = offset;
1938 sattr_item = proto_tree_add_text(tree, tvb, offset, -1,
1940 sattr_tree = proto_item_add_subtree(sattr_item, ett_nfs_sattr);
1943 if (tvb_get_ntohl(tvb, offset+0) != 0xffffffff)
1944 offset = dissect_mode(tvb, offset, sattr_tree, "mode");
1946 proto_tree_add_text(sattr_tree, tvb, offset, 4, "mode: no value");
1950 if (tvb_get_ntohl(tvb, offset+0) != 0xffffffff)
1951 offset = dissect_rpc_uint32(tvb, sattr_tree, hf_nfs_fattr_uid,
1954 proto_tree_add_text(sattr_tree, tvb, offset, 4, "uid: no value");
1958 if (tvb_get_ntohl(tvb, offset+0) != 0xffffffff)
1959 offset = dissect_rpc_uint32(tvb, sattr_tree, hf_nfs_fattr_gid,
1962 proto_tree_add_text(sattr_tree, tvb, offset, 4, "gid: no value");
1966 if (tvb_get_ntohl(tvb, offset+0) != 0xffffffff)
1967 offset = dissect_rpc_uint32(tvb, sattr_tree, hf_nfs_fattr_size,
1970 proto_tree_add_text(sattr_tree, tvb, offset, 4, "size: no value");
1974 if (tvb_get_ntohl(tvb, offset+0) != 0xffffffff) {
1975 offset = dissect_timeval(tvb, offset, sattr_tree, hf_nfs_atime, hf_nfs_atime_sec, hf_nfs_atime_usec);
1977 proto_tree_add_text(sattr_tree, tvb, offset, 8, "atime: no value");
1981 if (tvb_get_ntohl(tvb, offset+0) != 0xffffffff) {
1982 offset = dissect_timeval(tvb, offset, sattr_tree, hf_nfs_mtime, hf_nfs_mtime_sec, hf_nfs_mtime_usec);
1984 proto_tree_add_text(sattr_tree, tvb, offset, 8, "mtime: no value");
1988 /* now we know, that sattr is shorter */
1990 proto_item_set_len(sattr_item, offset - old_offset);
1997 /* RFC 1094, Page 17 */
1999 dissect_filename(tvbuff_t *tvb, int offset,
2000 proto_tree *tree, int hf, char **string_ret)
2002 offset = dissect_rpc_string(tvb, tree, hf, offset, string_ret);
2007 /* RFC 1094, Page 17 */
2009 dissect_path(tvbuff_t *tvb, int offset, proto_tree *tree, int hf)
2011 offset = dissect_rpc_string(tvb, tree, hf, offset, NULL);
2016 /* RFC 1094, Page 17,18 */
2018 dissect_attrstat(tvbuff_t *tvb, int offset, proto_tree *tree)
2022 offset = dissect_stat(tvb, offset, tree, &status);
2025 offset = dissect_fattr(tvb, offset, tree, "attributes");
2036 /* RFC 1094, Page 17,18 */
2038 dissect_nfs2_attrstat_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree* tree)
2040 offset = dissect_attrstat(tvb, offset, tree);
2046 /* RFC 1094, Page 18 */
2048 dissect_diropargs(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, char* name)
2050 proto_item* diropargs_item = NULL;
2051 proto_tree* diropargs_tree = NULL;
2052 int old_offset = offset;
2055 diropargs_item = proto_tree_add_text(tree, tvb, offset, -1,
2057 diropargs_tree = proto_item_add_subtree(diropargs_item, ett_nfs_diropargs);
2060 /* are we snooping fh to filenames ?*/
2061 if((!pinfo->fd->flags.visited) && nfs_file_name_snooping){
2062 /* v2 LOOKUP, CREATE, MKDIR calls might give us a mapping*/
2063 rpc_call_info_value *civ=pinfo->private_data;
2065 if( (civ->prog==100003)
2068 &&((civ->proc==4)||(civ->proc==9)||(civ->proc==14))
2070 nfs_name_snoop_add_name(civ->xid, tvb,
2071 offset+36, tvb_get_ntohl(tvb, offset+32),
2076 offset = dissect_fhandle (tvb,offset,pinfo,diropargs_tree,"dir");
2077 offset = dissect_filename(tvb,offset, diropargs_tree,hf_nfs_name,NULL);
2079 /* now we know, that diropargs is shorter */
2080 if (diropargs_item) {
2081 proto_item_set_len(diropargs_item, offset - old_offset);
2088 /* RFC 1094, Page 18 */
2090 dissect_nfs2_diropargs_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
2092 offset = dissect_diropargs(tvb, offset, pinfo, tree, "where");
2098 /* RFC 1094, Page 18 */
2100 dissect_diropres(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
2104 offset = dissect_stat(tvb, offset, tree, &status);
2107 offset = dissect_fhandle(tvb, offset, pinfo, tree, "file");
2108 offset = dissect_fattr (tvb, offset, tree, "attributes");
2119 /* nfsdata is simply a chunk of RPC opaque data (length, data, fill bytes) */
2121 dissect_nfsdata(tvbuff_t *tvb, int offset, proto_tree *tree, int hf)
2123 offset = dissect_rpc_data(tvb, tree, hf, offset);
2128 /* RFC 1094, Page 18 */
2130 dissect_nfs2_diropres_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
2133 offset = dissect_diropres(tvb, offset, pinfo, tree);
2138 /* RFC 1094, Page 6 */
2140 dissect_nfs2_setattr_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
2143 offset = dissect_fhandle(tvb, offset, pinfo, tree, "file" );
2144 offset = dissect_sattr (tvb, offset, tree, "attributes");
2150 /* RFC 1094, Page 6 */
2152 dissect_nfs2_readlink_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
2157 offset = dissect_stat(tvb, offset, tree, &status);
2160 offset = dissect_path(tvb, offset, tree, hf_nfs_readlink_data);
2171 /* RFC 1094, Page 7 */
2173 dissect_nfs2_read_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
2176 guint32 offset_value;
2180 offset = dissect_fhandle(tvb, offset, pinfo, tree, "file" );
2181 offset_value = tvb_get_ntohl(tvb, offset+0);
2182 count = tvb_get_ntohl(tvb, offset+4);
2183 totalcount = tvb_get_ntohl(tvb, offset+8);
2185 proto_tree_add_uint(tree, hf_nfs_read_offset, tvb,
2186 offset+0, 4, offset_value);
2187 proto_tree_add_uint(tree, hf_nfs_read_count, tvb,
2188 offset+4, 4, count);
2189 proto_tree_add_uint(tree, hf_nfs_read_totalcount, tvb,
2190 offset+8, 4, totalcount);
2198 /* RFC 1094, Page 7 */
2200 dissect_nfs2_read_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
2205 offset = dissect_stat(tvb, offset, tree, &status);
2208 offset = dissect_fattr(tvb, offset, tree, "attributes");
2209 offset = dissect_nfsdata(tvb, offset, tree, hf_nfs_data);
2220 /* RFC 1094, Page 8 */
2222 dissect_nfs2_write_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
2225 guint32 beginoffset;
2226 guint32 offset_value;
2229 offset = dissect_fhandle(tvb, offset, pinfo, tree, "file" );
2230 beginoffset = tvb_get_ntohl(tvb, offset+0);
2231 offset_value = tvb_get_ntohl(tvb, offset+4);
2232 totalcount = tvb_get_ntohl(tvb, offset+8);
2234 proto_tree_add_uint(tree, hf_nfs_write_beginoffset, tvb,
2235 offset+0, 4, beginoffset);
2236 proto_tree_add_uint(tree, hf_nfs_write_offset, tvb,
2237 offset+4, 4, offset_value);
2238 proto_tree_add_uint(tree, hf_nfs_write_totalcount, tvb,
2239 offset+8, 4, totalcount);
2243 offset = dissect_nfsdata(tvb, offset, tree, hf_nfs_data);
2249 /* RFC 1094, Page 8 */
2251 dissect_nfs2_createargs_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
2254 offset = dissect_diropargs(tvb, offset, pinfo, tree, "where" );
2255 offset = dissect_sattr (tvb, offset, tree, "attributes");
2261 /* RFC 1094, Page 9 */
2263 dissect_nfs2_rename_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
2266 offset = dissect_diropargs(tvb, offset, pinfo, tree, "from");
2267 offset = dissect_diropargs(tvb, offset, pinfo, tree, "to" );
2273 /* RFC 1094, Page 9 */
2275 dissect_nfs2_link_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
2278 offset = dissect_fhandle (tvb, offset, pinfo, tree, "from");
2279 offset = dissect_diropargs(tvb, offset, pinfo, tree, "to" );
2285 /* RFC 1094, Page 10 */
2287 dissect_nfs2_symlink_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
2290 offset = dissect_diropargs(tvb, offset, pinfo, tree, "from" );
2291 offset = dissect_path (tvb, offset, tree, hf_nfs_symlink_to);
2292 offset = dissect_sattr (tvb, offset, tree, "attributes" );
2298 /* RFC 1094, Page 11 */
2300 dissect_nfs2_readdir_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
2306 offset = dissect_fhandle (tvb, offset, pinfo, tree, "dir");
2307 cookie = tvb_get_ntohl(tvb, offset+ 0);
2308 count = tvb_get_ntohl(tvb, offset+ 4);
2310 proto_tree_add_uint(tree, hf_nfs_readdir_cookie, tvb,
2311 offset+ 0, 4, cookie);
2312 proto_tree_add_uint(tree, hf_nfs_readdir_count, tvb,
2313 offset+ 4, 4, count);
2321 /* RFC 1094, Page 11 */
2323 dissect_readdir_entry(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
2326 proto_item* entry_item = NULL;
2327 proto_tree* entry_tree = NULL;
2328 int old_offset = offset;
2334 entry_item = proto_tree_add_item(tree, hf_nfs_readdir_entry, tvb,
2335 offset+0, -1, FALSE);
2336 entry_tree = proto_item_add_subtree(entry_item, ett_nfs_readdir_entry);
2339 fileid = tvb_get_ntohl(tvb, offset + 0);
2341 proto_tree_add_uint(entry_tree, hf_nfs_readdir_entry_fileid, tvb,
2342 offset+0, 4, fileid);
2345 offset = dissect_filename(tvb, offset, entry_tree,
2346 hf_nfs_readdir_entry_name, &name);
2348 proto_item_set_text(entry_item, "Entry: file ID %u, name %s",
2352 cookie = tvb_get_ntohl(tvb, offset + 0);
2354 proto_tree_add_uint(entry_tree, hf_nfs_readdir_entry_cookie, tvb,
2355 offset+0, 4, cookie);
2358 /* now we know, that a readdir entry is shorter */
2360 proto_item_set_len(entry_item, offset - old_offset);
2366 /* RFC 1094, Page 11 */
2368 dissect_nfs2_readdir_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
2374 offset = dissect_stat(tvb, offset, tree, &status);
2377 offset = dissect_rpc_list(tvb, pinfo, tree, offset,
2378 dissect_readdir_entry);
2379 eof_value = tvb_get_ntohl(tvb, offset+0);
2381 proto_tree_add_uint(tree, hf_nfs_readdir_eof, tvb,
2382 offset+ 0, 4, eof_value);
2394 /* RFC 1094, Page 12 */
2396 dissect_nfs2_statfs_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
2406 offset = dissect_stat(tvb, offset, tree, &status);
2409 tsize = tvb_get_ntohl(tvb, offset+ 0);
2410 bsize = tvb_get_ntohl(tvb, offset+ 4);
2411 blocks = tvb_get_ntohl(tvb, offset+ 8);
2412 bfree = tvb_get_ntohl(tvb, offset+12);
2413 bavail = tvb_get_ntohl(tvb, offset+16);
2415 proto_tree_add_uint(tree, hf_nfs_statfs_tsize, tvb,
2416 offset+ 0, 4, tsize);
2417 proto_tree_add_uint(tree, hf_nfs_statfs_bsize, tvb,
2418 offset+ 4, 4, bsize);
2419 proto_tree_add_uint(tree, hf_nfs_statfs_blocks, tvb,
2420 offset+ 8, 4, blocks);
2421 proto_tree_add_uint(tree, hf_nfs_statfs_bfree, tvb,
2422 offset+12, 4, bfree);
2423 proto_tree_add_uint(tree, hf_nfs_statfs_bavail, tvb,
2424 offset+16, 4, bavail);
2437 /* proc number, "proc name", dissect_request, dissect_reply */
2438 /* NULL as function pointer means: type of arguments is "void". */
2439 static const vsff nfs2_proc[] = {
2440 { 0, "NULL", /* OK */
2442 { 1, "GETATTR", /* OK */
2443 dissect_nfs2_fhandle_call, dissect_nfs2_attrstat_reply },
2444 { 2, "SETATTR", /* OK */
2445 dissect_nfs2_setattr_call, dissect_nfs2_attrstat_reply },
2446 { 3, "ROOT", /* OK */
2448 { 4, "LOOKUP", /* OK */
2449 dissect_nfs2_diropargs_call, dissect_nfs2_diropres_reply },
2450 { 5, "READLINK", /* OK */
2451 dissect_nfs2_fhandle_call, dissect_nfs2_readlink_reply },
2452 { 6, "READ", /* OK */
2453 dissect_nfs2_read_call, dissect_nfs2_read_reply },
2454 { 7, "WRITECACHE", /* OK */
2456 { 8, "WRITE", /* OK */
2457 dissect_nfs2_write_call, dissect_nfs2_attrstat_reply },
2458 { 9, "CREATE", /* OK */
2459 dissect_nfs2_createargs_call, dissect_nfs2_diropres_reply },
2460 { 10, "REMOVE", /* OK */
2461 dissect_nfs2_diropargs_call, dissect_nfs2_stat_reply },
2462 { 11, "RENAME", /* OK */
2463 dissect_nfs2_rename_call, dissect_nfs2_stat_reply },
2464 { 12, "LINK", /* OK */
2465 dissect_nfs2_link_call, dissect_nfs2_stat_reply },
2466 { 13, "SYMLINK", /* OK */
2467 dissect_nfs2_symlink_call, dissect_nfs2_stat_reply },
2468 { 14, "MKDIR", /* OK */
2469 dissect_nfs2_createargs_call, dissect_nfs2_diropres_reply },
2470 { 15, "RMDIR", /* OK */
2471 dissect_nfs2_diropargs_call, dissect_nfs2_stat_reply },
2472 { 16, "READDIR", /* OK */
2473 dissect_nfs2_readdir_call, dissect_nfs2_readdir_reply },
2474 { 17, "STATFS", /* OK */
2475 dissect_nfs2_fhandle_call, dissect_nfs2_statfs_reply },
2476 { 0,NULL,NULL,NULL }
2479 static const value_string nfsv2_proc_vals[] = {
2487 { 7, "WRITECACHE" },
2501 /* end of NFS Version 2 */
2504 /***************************/
2505 /* NFS Version 3, RFC 1813 */
2506 /***************************/
2509 /* RFC 1813, Page 15 */
2511 dissect_filename3(tvbuff_t *tvb, int offset,
2512 proto_tree *tree, int hf, char **string_ret)
2514 offset = dissect_rpc_string(tvb, tree, hf, offset, string_ret);
2519 /* RFC 1813, Page 15 */
2521 dissect_nfspath3(tvbuff_t *tvb, int offset, proto_tree *tree, int hf)
2523 offset = dissect_rpc_string(tvb, tree, hf, offset, NULL);
2527 /* RFC 1813, Page 15 */
2529 dissect_cookieverf3(tvbuff_t *tvb, int offset, proto_tree *tree)
2531 proto_tree_add_text(tree, tvb, offset, NFS3_COOKIEVERFSIZE,
2532 "Verifier: Opaque Data");
2533 offset += NFS3_COOKIEVERFSIZE;
2538 /* RFC 1813, Page 16 */
2540 dissect_createverf3(tvbuff_t *tvb, int offset, proto_tree *tree)
2542 proto_tree_add_text(tree, tvb, offset, NFS3_CREATEVERFSIZE,
2543 "Verifier: Opaque Data");
2544 offset += NFS3_CREATEVERFSIZE;
2549 /* RFC 1813, Page 16 */
2551 dissect_writeverf3(tvbuff_t *tvb, int offset, proto_tree *tree)
2553 proto_tree_add_text(tree, tvb, offset, NFS3_WRITEVERFSIZE,
2554 "Verifier: Opaque Data");
2555 offset += NFS3_WRITEVERFSIZE;
2559 /* RFC 1813, Page 16 */
2561 dissect_mode3(tvbuff_t *tvb, int offset, proto_tree *tree, char* name)
2564 proto_item* mode3_item = NULL;
2565 proto_tree* mode3_tree = NULL;
2567 mode3 = tvb_get_ntohl(tvb, offset+0);
2570 mode3_item = proto_tree_add_text(tree, tvb, offset, 4,
2571 "%s: 0%o", name, mode3);
2573 mode3_tree = proto_item_add_subtree(mode3_item, ett_nfs_mode3);
2576 /* RFC 1813, Page 23 */
2578 proto_tree_add_text(mode3_tree, tvb, offset, 4, "%s",
2579 decode_boolean_bitfield(mode3, 0x800, 12, "Set user id on exec", "not SUID"));
2580 proto_tree_add_text(mode3_tree, tvb, offset, 4, "%s",
2581 decode_boolean_bitfield(mode3, 0x400, 12, "Set group id on exec", "not SGID"));
2582 proto_tree_add_text(mode3_tree, tvb, offset, 4, "%s",
2583 decode_boolean_bitfield(mode3, 0x200, 12, "Save swapped text even after use", "not save swapped text"));
2584 proto_tree_add_text(mode3_tree, tvb, offset, 4, "%s",
2585 decode_boolean_bitfield(mode3, 0x100, 12, "Read permission for owner", "no Read permission for owner"));
2586 proto_tree_add_text(mode3_tree, tvb, offset, 4, "%s",
2587 decode_boolean_bitfield(mode3, 0x80, 12, "Write permission for owner", "no Write permission for owner"));
2588 proto_tree_add_text(mode3_tree, tvb, offset, 4, "%s",
2589 decode_boolean_bitfield(mode3, 0x40, 12, "Execute permission for owner", "no Execute permission for owner"));
2590 proto_tree_add_text(mode3_tree, tvb, offset, 4, "%s",
2591 decode_boolean_bitfield(mode3, 0x20, 12, "Read permission for group", "no Read permission for group"));
2592 proto_tree_add_text(mode3_tree, tvb, offset, 4, "%s",
2593 decode_boolean_bitfield(mode3, 0x10, 12, "Write permission for group", "no Write permission for group"));
2594 proto_tree_add_text(mode3_tree, tvb, offset, 4, "%s",
2595 decode_boolean_bitfield(mode3, 0x8, 12, "Execute permission for group", "no Execute permission for group"));
2596 proto_tree_add_text(mode3_tree, tvb, offset, 4, "%s",
2597 decode_boolean_bitfield(mode3, 0x4, 12, "Read permission for others", "no Read permission for others"));
2598 proto_tree_add_text(mode3_tree, tvb, offset, 4, "%s",
2599 decode_boolean_bitfield(mode3, 0x2, 12, "Write permission for others", "no Write permission for others"));
2600 proto_tree_add_text(mode3_tree, tvb, offset, 4, "%s",
2601 decode_boolean_bitfield(mode3, 0x1, 12, "Execute permission for others", "no Execute permission for others"));
2608 /* RFC 1813, Page 16,17 */
2609 static const value_string names_nfs_nfsstat3[] =
2616 { 13, "ERR_ACCES" },
2617 { 17, "ERR_EXIST" },
2619 { 19, "ERR_NODEV" },
2620 { 20, "ERR_NOTDIR" },
2621 { 21, "ERR_ISDIR" },
2622 { 22, "ERR_INVAL" },
2624 { 28, "ERR_NOSPC" },
2626 { 31, "ERR_MLINK" },
2627 { 63, "ERR_NAMETOOLONG" },
2628 { 66, "ERR_NOTEMPTY" },
2629 { 69, "ERR_DQUOT" },
2630 { 70, "ERR_STALE" },
2631 { 71, "ERR_REMOTE" },
2632 { 10001, "ERR_BADHANDLE" },
2633 { 10002, "ERR_NOT_SYNC" },
2634 { 10003, "ERR_BAD_COOKIE" },
2635 { 10004, "ERR_NOTSUPP" },
2636 { 10005, "ERR_TOOSMALL" },
2637 { 10006, "ERR_SERVERFAULT" },
2638 { 10007, "ERR_BADTYPE" },
2639 { 10008, "ERR_JUKEBOX" },
2644 /* RFC 1813, Page 16 */
2646 dissect_nfsstat3(tvbuff_t *tvb, int offset,
2647 proto_tree *tree,guint32 *status)
2651 nfsstat3 = tvb_get_ntohl(tvb, offset+0);
2654 proto_tree_add_uint(tree, hf_nfs_nfsstat3, tvb,
2655 offset, 4, nfsstat3);
2664 static const value_string names_nfs_ftype3[] =
2666 { NF3REG, "Regular File" },
2667 { NF3DIR, "Directory" },
2668 { NF3BLK, "Block Special Device" },
2669 { NF3CHR, "Character Special Device" },
2670 { NF3LNK, "Symbolic Link" },
2671 { NF3SOCK,"Socket" },
2672 { NF3FIFO,"Named Pipe" },
2677 /* RFC 1813, Page 20 */
2679 dissect_ftype3(tvbuff_t *tvb, int offset, proto_tree *tree,
2680 int hf, guint32* ftype3)
2684 type = tvb_get_ntohl(tvb, offset+0);
2687 proto_tree_add_uint(tree, hf, tvb, offset, 4, type);
2696 /* RFC 1813, Page 20 */
2698 dissect_specdata3(tvbuff_t *tvb, int offset, proto_tree *tree, char* name)
2703 proto_item* specdata3_item;
2704 proto_tree* specdata3_tree = NULL;
2706 specdata1 = tvb_get_ntohl(tvb, offset+0);
2707 specdata2 = tvb_get_ntohl(tvb, offset+4);
2710 specdata3_item = proto_tree_add_text(tree, tvb, offset, 8,
2711 "%s: %u,%u", name, specdata1, specdata2);
2713 specdata3_tree = proto_item_add_subtree(specdata3_item,
2717 if (specdata3_tree) {
2718 proto_tree_add_text(specdata3_tree, tvb,offset+0,4,
2719 "specdata1: %u", specdata1);
2720 proto_tree_add_text(specdata3_tree, tvb,offset+4,4,
2721 "specdata2: %u", specdata2);
2729 /* RFC 1813, Page 21 */
2731 dissect_nfs_fh3(tvbuff_t *tvb, int offset, packet_info *pinfo,
2732 proto_tree *tree, char *name)
2737 proto_item* fitem = NULL;
2738 proto_tree* ftree = NULL;
2739 int fh_offset,fh_length;
2741 fh3_len = tvb_get_ntohl(tvb, offset+0);
2742 fh3_len_full = rpc_roundup(fh3_len);
2743 fh3_fill = fh3_len_full - fh3_len;
2746 fitem = proto_tree_add_text(tree, tvb, offset, 4+fh3_len_full,
2749 ftree = proto_item_add_subtree(fitem, ett_nfs_fh3);
2752 /* are we snooping fh to filenames ?*/
2753 if((!pinfo->fd->flags.visited) && nfs_file_name_snooping){
2754 rpc_call_info_value *civ=pinfo->private_data;
2756 /* NFS v3 LOOKUP, CREATE, MKDIR calls might give us a mapping*/
2757 if( (civ->prog==100003)
2760 &&((civ->proc==3)||(civ->proc==8)||(civ->proc==9))
2762 fh_length=tvb_get_ntohl(tvb, offset);
2764 nfs_name_snoop_add_fh(civ->xid, tvb,
2765 fh_offset, fh_length);
2768 /* MOUNT v3 MNT replies might give us a filehandle */
2769 if( (civ->prog==100005)
2774 fh_length=tvb_get_ntohl(tvb, offset);
2776 nfs_name_snoop_add_fh(civ->xid, tvb,
2777 fh_offset, fh_length);
2781 proto_tree_add_uint(ftree, hf_nfs_fh_length, tvb, offset+0, 4,
2784 /* Handle WebNFS requests where filehandle may be 0 length */
2787 dissect_fhandle_data(tvb, offset+4, pinfo, ftree, fh3_len, FALSE);
2789 offset += fh3_len_full;
2798 /* RFC 1813, Page 21 */
2800 dissect_nfstime3(tvbuff_t *tvb, int offset,
2801 proto_tree *tree, int hf_time, int hf_time_sec, int hf_time_nsec)
2807 proto_item* time_item;
2808 proto_tree* time_tree = NULL;
2810 seconds = tvb_get_ntohl(tvb, offset+0);
2811 nseconds = tvb_get_ntohl(tvb, offset+4);
2813 ts.nsecs = nseconds;
2816 time_item = proto_tree_add_time(tree, hf_time, tvb, offset, 8,
2819 time_tree = proto_item_add_subtree(time_item, ett_nfs_nfstime3);
2823 proto_tree_add_uint(time_tree, hf_time_sec, tvb, offset, 4,
2825 proto_tree_add_uint(time_tree, hf_time_nsec, tvb, offset+4, 4,
2833 /* RFC 1813, Page 22 */
2835 dissect_fattr3(tvbuff_t *tvb, int offset, proto_tree *tree, char* name)
2837 proto_item* fattr3_item = NULL;
2838 proto_tree* fattr3_tree = NULL;
2839 int old_offset = offset;
2843 fattr3_item = proto_tree_add_text(tree, tvb, offset, -1,
2845 fattr3_tree = proto_item_add_subtree(fattr3_item, ett_nfs_fattr3);
2848 offset = dissect_ftype3(tvb,offset,fattr3_tree,hf_nfs_fattr3_type,&type);
2849 offset = dissect_mode3(tvb,offset,fattr3_tree,"mode");
2850 offset = dissect_rpc_uint32(tvb, fattr3_tree, hf_nfs_fattr3_nlink,
2852 offset = dissect_rpc_uint32(tvb, fattr3_tree, hf_nfs_fattr3_uid,
2854 offset = dissect_rpc_uint32(tvb, fattr3_tree, hf_nfs_fattr3_gid,
2856 offset = dissect_rpc_uint64(tvb, fattr3_tree, hf_nfs_fattr3_size,
2858 offset = dissect_rpc_uint64(tvb, fattr3_tree, hf_nfs_fattr3_used,
2860 offset = dissect_specdata3(tvb,offset,fattr3_tree,"rdev");
2861 offset = dissect_rpc_uint64(tvb, fattr3_tree, hf_nfs_fattr3_fsid,
2863 offset = dissect_rpc_uint64(tvb, fattr3_tree, hf_nfs_fattr3_fileid,
2865 offset = dissect_nfstime3 (tvb,offset,fattr3_tree,hf_nfs_atime,hf_nfs_atime_sec,hf_nfs_atime_nsec);
2866 offset = dissect_nfstime3 (tvb,offset,fattr3_tree,hf_nfs_mtime,hf_nfs_mtime_sec,hf_nfs_mtime_nsec);
2867 offset = dissect_nfstime3 (tvb,offset,fattr3_tree,hf_nfs_ctime,hf_nfs_ctime_sec,hf_nfs_ctime_nsec);
2869 /* now we know, that fattr3 is shorter */
2871 proto_item_set_len(fattr3_item, offset - old_offset);
2878 static const value_string value_follows[] =
2881 { 1, "value follows"},
2886 /* RFC 1813, Page 23 */
2888 dissect_post_op_attr(tvbuff_t *tvb, int offset, proto_tree *tree, char* name)
2890 proto_item* post_op_attr_item = NULL;
2891 proto_tree* post_op_attr_tree = NULL;
2892 int old_offset = offset;
2893 guint32 attributes_follow;
2896 post_op_attr_item = proto_tree_add_text(tree, tvb, offset, -1,
2898 post_op_attr_tree = proto_item_add_subtree(post_op_attr_item,
2899 ett_nfs_post_op_attr);
2902 attributes_follow = tvb_get_ntohl(tvb, offset+0);
2903 proto_tree_add_text(post_op_attr_tree, tvb, offset, 4,
2904 "attributes_follow: %s (%u)",
2905 val_to_str(attributes_follow,value_follows,"Unknown"), attributes_follow);
2907 switch (attributes_follow) {
2909 offset = dissect_fattr3(tvb, offset, post_op_attr_tree,
2917 /* now we know, that post_op_attr_tree is shorter */
2918 if (post_op_attr_item) {
2919 proto_item_set_len(post_op_attr_item, offset - old_offset);
2926 /* RFC 1813, Page 24 */
2928 dissect_wcc_attr(tvbuff_t *tvb, int offset, proto_tree *tree, char* name)
2930 proto_item* wcc_attr_item = NULL;
2931 proto_tree* wcc_attr_tree = NULL;
2932 int old_offset = offset;
2935 wcc_attr_item = proto_tree_add_text(tree, tvb, offset, -1,
2937 wcc_attr_tree = proto_item_add_subtree(wcc_attr_item,
2941 offset = dissect_rpc_uint64(tvb, wcc_attr_tree, hf_nfs_wcc_attr_size,
2943 offset = dissect_nfstime3(tvb, offset, wcc_attr_tree, hf_nfs_mtime, hf_nfs_mtime_sec, hf_nfs_mtime_nsec);
2944 offset = dissect_nfstime3(tvb, offset, wcc_attr_tree, hf_nfs_ctime, hf_nfs_ctime_sec, hf_nfs_ctime_nsec);
2945 /* now we know, that wcc_attr_tree is shorter */
2946 if (wcc_attr_item) {
2947 proto_item_set_len(wcc_attr_item, offset - old_offset);
2954 /* RFC 1813, Page 24 */
2956 dissect_pre_op_attr(tvbuff_t *tvb, int offset, proto_tree *tree, char* name)
2958 proto_item* pre_op_attr_item = NULL;
2959 proto_tree* pre_op_attr_tree = NULL;
2960 int old_offset = offset;
2961 guint32 attributes_follow;
2964 pre_op_attr_item = proto_tree_add_text(tree, tvb, offset, -1,
2966 pre_op_attr_tree = proto_item_add_subtree(pre_op_attr_item,
2967 ett_nfs_pre_op_attr);
2970 attributes_follow = tvb_get_ntohl(tvb, offset+0);
2971 proto_tree_add_text(pre_op_attr_tree, tvb, offset, 4,
2972 "attributes_follow: %s (%u)",
2973 val_to_str(attributes_follow,value_follows,"Unknown"), attributes_follow);
2975 switch (attributes_follow) {
2977 offset = dissect_wcc_attr(tvb, offset, pre_op_attr_tree,
2985 /* now we know, that pre_op_attr_tree is shorter */
2986 if (pre_op_attr_item) {
2987 proto_item_set_len(pre_op_attr_item, offset - old_offset);
2994 /* RFC 1813, Page 24 */
2996 dissect_wcc_data(tvbuff_t *tvb, int offset, proto_tree *tree, char* name)
2998 proto_item* wcc_data_item = NULL;
2999 proto_tree* wcc_data_tree = NULL;
3000 int old_offset = offset;
3003 wcc_data_item = proto_tree_add_text(tree, tvb, offset, -1,
3005 wcc_data_tree = proto_item_add_subtree(wcc_data_item,
3009 offset = dissect_pre_op_attr (tvb, offset, wcc_data_tree, "before");
3010 offset = dissect_post_op_attr(tvb, offset, wcc_data_tree, "after" );
3012 /* now we know, that wcc_data is shorter */
3013 if (wcc_data_item) {
3014 proto_item_set_len(wcc_data_item, offset - old_offset);
3021 /* RFC 1813, Page 25 */
3023 dissect_post_op_fh3(tvbuff_t *tvb, int offset, packet_info *pinfo,
3024 proto_tree *tree, char* name)
3026 proto_item* post_op_fh3_item = NULL;
3027 proto_tree* post_op_fh3_tree = NULL;
3028 int old_offset = offset;
3029 guint32 handle_follows;
3032 post_op_fh3_item = proto_tree_add_text(tree, tvb, offset, -1,
3034 post_op_fh3_tree = proto_item_add_subtree(post_op_fh3_item,
3035 ett_nfs_post_op_fh3);
3038 handle_follows = tvb_get_ntohl(tvb, offset+0);
3039 proto_tree_add_text(post_op_fh3_tree, tvb, offset, 4,
3040 "handle_follows: %s (%u)",
3041 val_to_str(handle_follows,value_follows,"Unknown"), handle_follows);
3043 switch (handle_follows) {
3045 offset = dissect_nfs_fh3(tvb, offset, pinfo, post_op_fh3_tree,
3053 /* now we know, that post_op_fh3_tree is shorter */
3054 if (post_op_fh3_item) {
3055 proto_item_set_len(post_op_fh3_item, offset - old_offset);
3062 /* RFC 1813, Page 25 */
3064 dissect_set_mode3(tvbuff_t *tvb, int offset, proto_tree *tree, char* name)
3066 proto_item* set_mode3_item = NULL;
3067 proto_tree* set_mode3_tree = NULL;
3068 int old_offset = offset;
3072 set_it = tvb_get_ntohl(tvb, offset+0);
3073 set_it_name = val_to_str(set_it,value_follows,"Unknown");
3076 set_mode3_item = proto_tree_add_text(tree, tvb, offset, -1,
3077 "%s: %s", name, set_it_name);
3078 set_mode3_tree = proto_item_add_subtree(set_mode3_item,
3083 proto_tree_add_text(set_mode3_tree, tvb, offset, 4,
3084 "set_it: %s (%u)", set_it_name, set_it);
3090 offset = dissect_mode3(tvb, offset, set_mode3_tree,
3098 /* now we know, that set_mode3 is shorter */
3099 if (set_mode3_item) {
3100 proto_item_set_len(set_mode3_item, offset - old_offset);
3107 /* RFC 1813, Page 26 */
3109 dissect_set_uid3(tvbuff_t *tvb, int offset, proto_tree *tree, char* name)
3111 proto_item* set_uid3_item = NULL;
3112 proto_tree* set_uid3_tree = NULL;
3113 int old_offset = offset;
3117 set_it = tvb_get_ntohl(tvb, offset+0);
3118 set_it_name = val_to_str(set_it,value_follows,"Unknown");
3121 set_uid3_item = proto_tree_add_text(tree, tvb, offset, -1,
3122 "%s: %s", name, set_it_name);
3123 set_uid3_tree = proto_item_add_subtree(set_uid3_item,
3128 proto_tree_add_text(set_uid3_tree, tvb, offset, 4,
3129 "set_it: %s (%u)", set_it_name, set_it);
3135 offset = dissect_rpc_uint32(tvb, set_uid3_tree,
3136 hf_nfs_uid3, offset);
3143 /* now we know, that set_uid3 is shorter */
3144 if (set_uid3_item) {
3145 proto_item_set_len(set_uid3_item, offset - old_offset);
3152 /* RFC 1813, Page 26 */
3154 dissect_set_gid3(tvbuff_t *tvb, int offset, proto_tree *tree, char* name)
3156 proto_item* set_gid3_item = NULL;
3157 proto_tree* set_gid3_tree = NULL;
3158 int old_offset = offset;
3162 set_it = tvb_get_ntohl(tvb, offset+0);
3163 set_it_name = val_to_str(set_it,value_follows,"Unknown");
3166 set_gid3_item = proto_tree_add_text(tree, tvb, offset, -1,
3167 "%s: %s", name, set_it_name);
3168 set_gid3_tree = proto_item_add_subtree(set_gid3_item,
3173 proto_tree_add_text(set_gid3_tree, tvb, offset, 4,
3174 "set_it: %s (%u)", set_it_name, set_it);
3180 offset = dissect_rpc_uint32(tvb, set_gid3_tree,
3181 hf_nfs_gid3, offset);
3188 /* now we know, that set_gid3 is shorter */
3189 if (set_gid3_item) {
3190 proto_item_set_len(set_gid3_item, offset - old_offset);
3197 /* RFC 1813, Page 26 */
3199 dissect_set_size3(tvbuff_t *tvb, int offset, proto_tree *tree, char* name)
3201 proto_item* set_size3_item = NULL;
3202 proto_tree* set_size3_tree = NULL;
3203 int old_offset = offset;
3207 set_it = tvb_get_ntohl(tvb, offset+0);
3208 set_it_name = val_to_str(set_it,value_follows,"Unknown");
3211 set_size3_item = proto_tree_add_text(tree, tvb, offset, -1,
3212 "%s: %s", name, set_it_name);
3213 set_size3_tree = proto_item_add_subtree(set_size3_item,
3218 proto_tree_add_text(set_size3_tree, tvb, offset, 4,
3219 "set_it: %s (%u)", set_it_name, set_it);
3225 offset = dissect_rpc_uint64(tvb, set_size3_tree,
3226 hf_nfs_set_size3_size, offset);
3233 /* now we know, that set_size3 is shorter */
3234 if (set_size3_item) {
3235 proto_item_set_len(set_size3_item, offset - old_offset);
3242 /* RFC 1813, Page 25 */
3243 #define DONT_CHANGE 0
3244 #define SET_TO_SERVER_TIME 1
3245 #define SET_TO_CLIENT_TIME 2
3247 static const value_string time_how[] =
3249 { DONT_CHANGE, "don't change" },
3250 { SET_TO_SERVER_TIME, "set to server time" },
3251 { SET_TO_CLIENT_TIME, "set to client time" },
3256 /* RFC 1813, Page 26 */
3258 dissect_set_atime(tvbuff_t *tvb, int offset, proto_tree *tree, char* name)
3260 proto_item* set_atime_item = NULL;
3261 proto_tree* set_atime_tree = NULL;
3262 int old_offset = offset;
3266 set_it = tvb_get_ntohl(tvb, offset+0);
3267 set_it_name = val_to_str(set_it,time_how,"Unknown");
3270 set_atime_item = proto_tree_add_text(tree, tvb, offset, -1,
3271 "%s: %s", name, set_it_name);
3272 set_atime_tree = proto_item_add_subtree(set_atime_item,
3277 proto_tree_add_text(set_atime_tree, tvb, offset, 4,
3278 "set_it: %s (%u)", set_it_name, set_it);
3283 case SET_TO_CLIENT_TIME:
3284 if (set_atime_item) {
3285 offset = dissect_nfstime3(tvb, offset, set_atime_tree,
3286 hf_nfs_atime, hf_nfs_atime_sec, hf_nfs_atime_nsec);
3294 /* now we know, that set_atime is shorter */
3295 if (set_atime_item) {
3296 proto_item_set_len(set_atime_item, offset - old_offset);
3303 /* RFC 1813, Page 26 */
3305 dissect_set_mtime(tvbuff_t *tvb, int offset, proto_tree *tree, char* name)
3307 proto_item* set_mtime_item = NULL;
3308 proto_tree* set_mtime_tree = NULL;
3309 int old_offset = offset;
3313 set_it = tvb_get_ntohl(tvb, offset+0);
3314 set_it_name = val_to_str(set_it,time_how,"Unknown");
3317 set_mtime_item = proto_tree_add_text(tree, tvb, offset, -1,
3318 "%s: %s", name, set_it_name);
3319 set_mtime_tree = proto_item_add_subtree(set_mtime_item,
3324 proto_tree_add_text(set_mtime_tree, tvb, offset, 4,
3325 "set_it: %s (%u)", set_it_name, set_it);
3330 case SET_TO_CLIENT_TIME:
3331 if (set_mtime_item) {
3332 offset = dissect_nfstime3(tvb, offset, set_mtime_tree,
3333 hf_nfs_atime, hf_nfs_atime_sec, hf_nfs_atime_nsec);
3341 /* now we know, that set_mtime is shorter */
3342 if (set_mtime_item) {
3343 proto_item_set_len(set_mtime_item, offset - old_offset);
3350 /* RFC 1813, Page 25..27 */
3352 dissect_sattr3(tvbuff_t *tvb, int offset, proto_tree *tree, char* name)
3354 proto_item* sattr3_item = NULL;
3355 proto_tree* sattr3_tree = NULL;
3356 int old_offset = offset;
3359 sattr3_item = proto_tree_add_text(tree, tvb, offset, -1,
3361 sattr3_tree = proto_item_add_subtree(sattr3_item, ett_nfs_sattr3);
3364 offset = dissect_set_mode3(tvb, offset, sattr3_tree, "mode");
3365 offset = dissect_set_uid3 (tvb, offset, sattr3_tree, "uid");
3366 offset = dissect_set_gid3 (tvb, offset, sattr3_tree, "gid");
3367 offset = dissect_set_size3(tvb, offset, sattr3_tree, "size");
3368 offset = dissect_set_atime(tvb, offset, sattr3_tree, "atime");
3369 offset = dissect_set_mtime(tvb, offset, sattr3_tree, "mtime");
3371 /* now we know, that sattr3 is shorter */
3373 proto_item_set_len(sattr3_item, offset - old_offset);
3380 /* RFC 1813, Page 27 */
3382 dissect_diropargs3(tvbuff_t *tvb, int offset, packet_info *pinfo,
3383 proto_tree *tree, char* name)
3385 proto_item* diropargs3_item = NULL;
3386 proto_tree* diropargs3_tree = NULL;
3387 int old_offset = offset;
3388 int parent_offset, parent_len;
3389 int name_offset, name_len;
3392 diropargs3_item = proto_tree_add_text(tree, tvb, offset, -1,
3394 diropargs3_tree = proto_item_add_subtree(diropargs3_item,
3395 ett_nfs_diropargs3);
3398 parent_offset=offset+4;
3399 parent_len=tvb_get_ntohl(tvb, offset);
3400 offset = dissect_nfs_fh3(tvb, offset, pinfo, diropargs3_tree, "dir");
3401 name_offset=offset+4;
3402 name_len=tvb_get_ntohl(tvb, offset);
3403 offset = dissect_filename3(tvb, offset, diropargs3_tree,
3406 /* are we snooping fh to filenames ?*/
3407 if((!pinfo->fd->flags.visited) && nfs_file_name_snooping){
3408 /* v3 LOOKUP, CREATE, MKDIR calls might give us a mapping*/
3409 rpc_call_info_value *civ=pinfo->private_data;
3411 if( (civ->prog==100003)
3414 &&((civ->proc==3)||(civ->proc==8)||(civ->proc==9))
3416 nfs_name_snoop_add_name(civ->xid, tvb,
3417 name_offset, name_len,
3418 parent_offset, parent_len, NULL);
3423 /* now we know, that diropargs3 is shorter */
3424 if (diropargs3_item) {
3425 proto_item_set_len(diropargs3_item, offset - old_offset);
3432 /* RFC 1813, Page 27 */
3434 dissect_nfs3_diropargs3_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
3437 offset = dissect_diropargs3(tvb, offset, pinfo, tree, "object");
3443 /* RFC 1813, Page 40 */
3445 dissect_access(tvbuff_t *tvb, int offset, proto_tree *tree,
3449 proto_item* access_item = NULL;
3450 proto_tree* access_tree = NULL;
3452 access = tvb_get_ntohl(tvb, offset+0);
3455 access_item = proto_tree_add_text(tree, tvb, offset, 4,
3456 "%s: 0x%02x", name, access);
3458 access_tree = proto_item_add_subtree(access_item, ett_nfs_access);
3462 proto_tree_add_text(access_tree, tvb, offset, 4, "%s READ",
3463 decode_boolean_bitfield(access, 0x001, 6, "allow", "not allow"));
3464 proto_tree_add_text(access_tree, tvb, offset, 4, "%s LOOKUP",
3465 decode_boolean_bitfield(access, 0x002, 6, "allow", "not allow"));
3466 proto_tree_add_text(access_tree, tvb, offset, 4, "%s MODIFY",
3467 decode_boolean_bitfield(access, 0x004, 6, "allow", "not allow"));
3468 proto_tree_add_text(access_tree, tvb, offset, 4, "%s EXTEND",
3469 decode_boolean_bitfield(access, 0x008, 6, "allow", "not allow"));
3470 proto_tree_add_text(access_tree, tvb, offset, 4, "%s DELETE",
3471 decode_boolean_bitfield(access, 0x010, 6, "allow", "not allow"));
3472 proto_tree_add_text(access_tree, tvb, offset, 4, "%s EXECUTE",
3473 decode_boolean_bitfield(access, 0x020, 6, "allow", "not allow"));
3481 /* NFS3 file handle dissector */
3483 dissect_nfs3_nfs_fh3_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
3486 offset = dissect_nfs_fh3(tvb, offset, pinfo, tree, "object");
3491 /* RFC 1813, Page 32,33 */
3493 dissect_nfs3_getattr_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
3496 offset = dissect_nfs_fh3(tvb, offset, pinfo, tree, "object");
3501 /* RFC 1813, Page 32,33 */
3503 dissect_nfs3_getattr_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
3508 offset = dissect_nfsstat3(tvb, offset, tree, &status);
3511 offset = dissect_fattr3(tvb, offset, tree, "obj_attributes");
3522 /* RFC 1813, Page 33 */
3524 dissect_sattrguard3(tvbuff_t *tvb, int offset, proto_tree* tree, char *name)
3526 proto_item* sattrguard3_item = NULL;
3527 proto_tree* sattrguard3_tree = NULL;
3528 int old_offset = offset;
3532 check = tvb_get_ntohl(tvb, offset+0);
3533 check_name = val_to_str(check,value_follows,"Unknown");
3536 sattrguard3_item = proto_tree_add_text(tree, tvb, offset, -1,
3537 "%s: %s", name, check_name);
3538 sattrguard3_tree = proto_item_add_subtree(sattrguard3_item,
3539 ett_nfs_sattrguard3);
3542 if (sattrguard3_tree)
3543 proto_tree_add_text(sattrguard3_tree, tvb, offset, 4,
3544 "check: %s (%u)", check_name, check);
3550 offset = dissect_nfstime3(tvb, offset, sattrguard3_tree,
3551 hf_nfs_ctime, hf_nfs_ctime_sec, hf_nfs_ctime_nsec);
3558 /* now we know, that sattrguard3 is shorter */
3559 if (sattrguard3_item) {
3560 proto_item_set_len(sattrguard3_item, offset - old_offset);
3567 /* RFC 1813, Page 33..36 */
3569 dissect_nfs3_setattr_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
3572 offset = dissect_nfs_fh3 (tvb, offset, pinfo, tree, "object");
3573 offset = dissect_sattr3 (tvb, offset, tree, "new_attributes");
3574 offset = dissect_sattrguard3(tvb, offset, tree, "guard");
3579 /* RFC 1813, Page 33..36 */
3581 dissect_nfs3_setattr_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
3586 offset = dissect_nfsstat3(tvb, offset, tree, &status);
3589 offset = dissect_wcc_data(tvb, offset, tree, "obj_wcc");
3592 offset = dissect_wcc_data(tvb, offset, tree, "obj_wcc");
3600 /* RFC 1813, Page 37..39 */
3602 dissect_nfs3_lookup_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
3605 offset = dissect_diropargs3 (tvb, offset, pinfo, tree, "what");
3610 /* RFC 1813, Page 37..39 */
3612 dissect_nfs3_lookup_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
3617 offset = dissect_nfsstat3(tvb, offset, tree, &status);
3620 offset = dissect_nfs_fh3(tvb, offset, pinfo, tree, "object");
3621 offset = dissect_post_op_attr(tvb, offset, tree,
3623 offset = dissect_post_op_attr(tvb, offset, tree,
3627 offset = dissect_post_op_attr(tvb, offset, tree,
3636 /* RFC 1813, Page 40..43 */
3638 dissect_nfs3_access_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
3641 offset = dissect_nfs_fh3(tvb, offset, pinfo, tree, "object");
3642 offset = dissect_access (tvb, offset, tree, "access");
3648 /* RFC 1813, Page 40..43 */
3650 dissect_nfs3_access_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
3655 offset = dissect_nfsstat3(tvb, offset, tree, &status);
3658 offset = dissect_post_op_attr(tvb, offset, tree,
3660 offset = dissect_access(tvb, offset, tree, "access");
3663 offset = dissect_post_op_attr(tvb, offset, tree,
3672 /* RFC 1813, Page 44,45 */
3674 dissect_nfs3_readlink_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
3679 offset = dissect_nfsstat3(tvb, offset, tree, &status);
3682 offset = dissect_post_op_attr(tvb, offset, tree,
3683 "symlink_attributes");
3684 offset = dissect_nfspath3(tvb, offset, tree,
3685 hf_nfs_readlink_data);
3688 offset = dissect_post_op_attr(tvb, offset, tree,
3689 "symlink_attributes");
3697 /* RFC 1813, Page 46..48 */
3699 dissect_nfs3_read_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
3702 offset = dissect_nfs_fh3(tvb, offset, pinfo, tree, "file");
3703 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_offset3, offset);
3704 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_count3, offset);
3710 /* RFC 1813, Page 46..48 */
3712 dissect_nfs3_read_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
3717 offset = dissect_nfsstat3(tvb, offset, tree, &status);
3720 offset = dissect_post_op_attr(tvb, offset, tree,
3722 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_count3,
3724 offset = dissect_rpc_bool(tvb, tree, hf_nfs_read_eof,
3726 offset = dissect_nfsdata(tvb, offset, tree, hf_nfs_data);
3729 offset = dissect_post_op_attr(tvb, offset, tree,
3738 /* RFC 1813, Page 49 */
3739 static const value_string names_stable_how[] = {
3740 { UNSTABLE, "UNSTABLE" },
3741 { DATA_SYNC, "DATA_SYNC" },
3742 { FILE_SYNC, "FILE_SYNC" },
3747 /* RFC 1813, Page 49 */
3749 dissect_stable_how(tvbuff_t *tvb, int offset, proto_tree* tree, int hfindex)
3753 stable_how = tvb_get_ntohl(tvb,offset+0);
3755 proto_tree_add_uint(tree, hfindex, tvb,
3756 offset, 4, stable_how);
3764 /* RFC 1813, Page 49..54 */
3766 dissect_nfs3_write_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
3769 offset = dissect_nfs_fh3 (tvb, offset, pinfo, tree, "file");
3770 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_offset3, offset);
3771 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_count3, offset);
3772 offset = dissect_stable_how(tvb, offset, tree, hf_nfs_write_stable);
3773 offset = dissect_nfsdata (tvb, offset, tree, hf_nfs_data);
3779 /* RFC 1813, Page 49..54 */
3781 dissect_nfs3_write_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
3786 offset = dissect_nfsstat3(tvb, offset, tree, &status);
3789 offset = dissect_wcc_data (tvb, offset, tree, "file_wcc");
3790 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_count3,
3792 offset = dissect_stable_how(tvb, offset, tree,
3793 hf_nfs_write_committed);
3794 offset = dissect_writeverf3(tvb, offset, tree);
3797 offset = dissect_wcc_data(tvb, offset, tree, "file_wcc");
3805 /* RFC 1813, Page 54 */
3806 static const value_string names_createmode3[] = {
3807 { UNCHECKED, "UNCHECKED" },
3808 { GUARDED, "GUARDED" },
3809 { EXCLUSIVE, "EXCLUSIVE" },
3814 /* RFC 1813, Page 54 */
3816 dissect_createmode3(tvbuff_t *tvb, int offset, proto_tree* tree, guint32* mode)
3820 mode_value = tvb_get_ntohl(tvb, offset + 0);
3822 proto_tree_add_uint(tree, hf_nfs_createmode3, tvb,
3823 offset+0, 4, mode_value);
3832 /* RFC 1813, Page 54..58 */
3834 dissect_nfs3_create_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
3839 offset = dissect_diropargs3 (tvb, offset, pinfo, tree, "where");
3840 offset = dissect_createmode3(tvb, offset, tree, &mode);
3844 offset = dissect_sattr3(tvb, offset, tree, "obj_attributes");
3847 offset = dissect_createverf3(tvb, offset, tree);
3855 /* RFC 1813, Page 54..58 */
3857 dissect_nfs3_create_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
3862 offset = dissect_nfsstat3(tvb, offset, tree, &status);
3865 offset = dissect_post_op_fh3 (tvb, offset, pinfo, tree, "obj");
3866 offset = dissect_post_op_attr(tvb, offset, tree,
3868 offset = dissect_wcc_data(tvb, offset, tree, "dir_wcc");
3871 offset = dissect_wcc_data(tvb, offset, tree, "dir_wcc");
3879 /* RFC 1813, Page 58..60 */
3881 dissect_nfs3_mkdir_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
3884 offset = dissect_diropargs3(tvb, offset, pinfo, tree, "where");
3885 offset = dissect_sattr3 (tvb, offset, tree, "attributes");
3891 /* RFC 1813, Page 61..63 */
3893 dissect_nfs3_symlink_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
3896 offset = dissect_diropargs3(tvb, offset, pinfo, tree, "where");
3897 offset = dissect_sattr3 (tvb, offset, tree, "symlink_attributes");
3898 offset = dissect_nfspath3 (tvb, offset, tree, hf_nfs_symlink_to);
3904 /* RFC 1813, Page 63..66 */
3906 dissect_nfs3_mknod_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
3911 offset = dissect_diropargs3(tvb, offset, pinfo, tree, "where");
3912 offset = dissect_ftype3(tvb, offset, tree, hf_nfs_ftype3, &type);
3916 offset = dissect_sattr3(tvb, offset, tree, "dev_attributes");
3917 offset = dissect_specdata3(tvb, offset, tree, "spec");
3921 offset = dissect_sattr3(tvb, offset, tree, "pipe_attributes");
3932 /* RFC 1813, Page 67..69 */
3934 dissect_nfs3_remove_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
3939 offset = dissect_nfsstat3(tvb, offset, tree, &status);
3942 offset = dissect_wcc_data(tvb, offset, tree, "dir_wcc");
3945 offset = dissect_wcc_data(tvb, offset, tree, "dir_wcc");
3953 /* RFC 1813, Page 71..74 */
3955 dissect_nfs3_rename_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
3958 offset = dissect_diropargs3(tvb, offset, pinfo, tree, "from");
3959 offset = dissect_diropargs3(tvb, offset, pinfo, tree, "to");
3965 /* RFC 1813, Page 71..74 */
3967 dissect_nfs3_rename_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
3972 offset = dissect_nfsstat3(tvb, offset, tree, &status);
3975 offset = dissect_wcc_data(tvb, offset, tree, "fromdir_wcc");
3976 offset = dissect_wcc_data(tvb, offset, tree, "todir_wcc");
3979 offset = dissect_wcc_data(tvb, offset, tree, "fromdir_wcc");
3980 offset = dissect_wcc_data(tvb, offset, tree, "todir_wcc");
3988 /* RFC 1813, Page 74..76 */
3990 dissect_nfs3_link_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
3993 offset = dissect_nfs_fh3 (tvb, offset, pinfo, tree, "file");
3994 offset = dissect_diropargs3(tvb, offset, pinfo, tree, "link");
4000 /* RFC 1813, Page 74..76 */
4002 dissect_nfs3_link_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
4007 offset = dissect_nfsstat3(tvb, offset, tree, &status);
4010 offset = dissect_post_op_attr(tvb, offset, tree,
4012 offset = dissect_wcc_data(tvb, offset, tree, "linkdir_wcc");
4015 offset = dissect_post_op_attr(tvb, offset, tree,
4017 offset = dissect_wcc_data(tvb, offset, tree, "linkdir_wcc");
4025 /* RFC 1813, Page 76..80 */
4027 dissect_nfs3_readdir_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
4030 offset = dissect_nfs_fh3 (tvb, offset, pinfo, tree, "dir");
4031 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_cookie3, offset);
4032 offset = dissect_cookieverf3(tvb, offset, tree);
4033 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_count3, offset);
4039 /* RFC 1813, Page 76..80 */
4041 dissect_entry3(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
4044 proto_item* entry_item = NULL;
4045 proto_tree* entry_tree = NULL;
4046 int old_offset = offset;
4050 entry_item = proto_tree_add_item(tree, hf_nfs_readdir_entry, tvb,
4051 offset+0, -1, FALSE);
4052 entry_tree = proto_item_add_subtree(entry_item, ett_nfs_readdir_entry);
4055 offset = dissect_rpc_uint64(tvb, entry_tree, hf_nfs_readdir_entry3_fileid,
4058 offset = dissect_filename3(tvb, offset, entry_tree,
4059 hf_nfs_readdir_entry3_name, &name);
4061 proto_item_set_text(entry_item, "Entry: name %s", name);
4064 offset = dissect_rpc_uint64(tvb, entry_tree, hf_nfs_readdir_entry3_cookie,
4067 /* now we know, that a readdir entry is shorter */
4069 proto_item_set_len(entry_item, offset - old_offset);
4076 /* RFC 1813, Page 76..80 */
4078 dissect_nfs3_readdir_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
4084 offset = dissect_stat(tvb, offset, tree, &status);
4087 offset = dissect_post_op_attr(tvb, offset, tree,
4089 offset = dissect_cookieverf3(tvb, offset, tree);
4090 offset = dissect_rpc_list(tvb, pinfo, tree, offset,
4092 eof_value = tvb_get_ntohl(tvb, offset+0);
4094 proto_tree_add_uint(tree, hf_nfs_readdir_eof, tvb,
4095 offset+ 0, 4, eof_value);
4099 offset = dissect_post_op_attr(tvb, offset, tree,
4108 /* RFC 1813, Page 80..83 */
4110 dissect_nfs3_readdirplus_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
4113 offset = dissect_nfs_fh3 (tvb, offset, pinfo, tree, "dir");
4114 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_cookie3, offset);
4115 offset = dissect_cookieverf3(tvb, offset, tree);
4116 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_count3_dircount,
4118 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_count3_maxcount,
4125 /* RFC 1813, Page 80..83 */
4127 dissect_entryplus3(tvbuff_t *tvb, int offset, packet_info *pinfo,
4130 proto_item* entry_item = NULL;
4131 proto_tree* entry_tree = NULL;
4132 int old_offset = offset;
4136 entry_item = proto_tree_add_item(tree, hf_nfs_readdir_entry, tvb,
4137 offset+0, -1, FALSE);
4138 entry_tree = proto_item_add_subtree(entry_item, ett_nfs_readdir_entry);
4141 offset = dissect_rpc_uint64(tvb, entry_tree,
4142 hf_nfs_readdirplus_entry_fileid, offset);
4144 offset = dissect_filename3(tvb, offset, entry_tree,
4145 hf_nfs_readdirplus_entry_name, &name);
4147 proto_item_set_text(entry_item, "Entry: name %s", name);
4150 offset = dissect_rpc_uint64(tvb, entry_tree, hf_nfs_readdirplus_entry_cookie,
4153 offset = dissect_post_op_attr(tvb, offset, entry_tree,
4155 offset = dissect_post_op_fh3(tvb, offset, pinfo, entry_tree, "name_handle");
4157 /* now we know, that a readdirplus entry is shorter */
4159 proto_item_set_len(entry_item, offset - old_offset);
4166 /* RFC 1813, Page 80..83 */
4168 dissect_nfs3_readdirplus_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
4174 offset = dissect_stat(tvb, offset, tree, &status);
4177 offset = dissect_post_op_attr(tvb, offset, tree,
4179 offset = dissect_cookieverf3(tvb, offset, tree);
4180 offset = dissect_rpc_list(tvb, pinfo, tree, offset,
4181 dissect_entryplus3);
4182 eof_value = tvb_get_ntohl(tvb, offset+0);
4184 proto_tree_add_uint(tree, hf_nfs_readdir_eof, tvb,
4185 offset+ 0, 4, eof_value);
4189 offset = dissect_post_op_attr(tvb, offset, tree,
4198 /* RFC 1813, Page 84..86 */
4200 dissect_nfs3_fsstat_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
4206 offset = dissect_nfsstat3(tvb, offset, tree, &status);
4209 offset = dissect_post_op_attr(tvb, offset, tree,
4211 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_fsstat3_resok_tbytes,
4213 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_fsstat3_resok_fbytes,
4215 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_fsstat3_resok_abytes,
4217 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_fsstat3_resok_tfiles,
4219 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_fsstat3_resok_ffiles,
4221 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_fsstat3_resok_afiles,
4223 invarsec = tvb_get_ntohl(tvb, offset + 0);
4225 proto_tree_add_uint(tree, hf_nfs_fsstat_invarsec, tvb,
4226 offset+0, 4, invarsec);
4230 offset = dissect_post_op_attr(tvb, offset, tree,
4239 #define FSF3_LINK 0x0001
4240 #define FSF3_SYMLINK 0x0002
4241 #define FSF3_HOMOGENEOUS 0x0008
4242 #define FSF3_CANSETTIME 0x0010
4245 /* RFC 1813, Page 86..90 */
4247 dissect_nfs3_fsinfo_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
4259 proto_item* properties_item = NULL;
4260 proto_tree* properties_tree = NULL;
4262 offset = dissect_nfsstat3(tvb, offset, tree, &status);
4265 offset = dissect_post_op_attr(tvb, offset, tree,
4267 rtmax = tvb_get_ntohl(tvb, offset+0);
4269 proto_tree_add_uint(tree, hf_nfs_fsinfo_rtmax, tvb,
4270 offset+0, 4, rtmax);
4272 rtpref = tvb_get_ntohl(tvb, offset+0);
4274 proto_tree_add_uint(tree, hf_nfs_fsinfo_rtpref, tvb,
4275 offset+0, 4, rtpref);
4277 rtmult = tvb_get_ntohl(tvb, offset+0);
4279 proto_tree_add_uint(tree, hf_nfs_fsinfo_rtmult, tvb,
4280 offset+0, 4, rtmult);
4282 wtmax = tvb_get_ntohl(tvb, offset+0);
4284 proto_tree_add_uint(tree, hf_nfs_fsinfo_wtmax, tvb,
4285 offset+0, 4, wtmax);
4287 wtpref = tvb_get_ntohl(tvb, offset+0);
4289 proto_tree_add_uint(tree, hf_nfs_fsinfo_wtpref, tvb,
4290 offset+0, 4, wtpref);
4292 wtmult = tvb_get_ntohl(tvb, offset+0);
4294 proto_tree_add_uint(tree, hf_nfs_fsinfo_wtmult, tvb,
4295 offset+0, 4, wtmult);
4297 dtpref = tvb_get_ntohl(tvb, offset+0);
4299 proto_tree_add_uint(tree, hf_nfs_fsinfo_dtpref, tvb,
4300 offset+0, 4, dtpref);
4303 offset = dissect_rpc_uint64(tvb, tree,
4304 hf_nfs_fsinfo_maxfilesize, offset);
4305 offset = dissect_nfstime3(tvb, offset, tree, hf_nfs_dtime, hf_nfs_dtime_sec, hf_nfs_dtime_nsec);
4306 properties = tvb_get_ntohl(tvb, offset+0);
4308 properties_item = proto_tree_add_uint(tree,
4309 hf_nfs_fsinfo_properties,
4310 tvb, offset+0, 4, properties);
4311 if (properties_item)
4312 properties_tree = proto_item_add_subtree(properties_item,
4313 ett_nfs_fsinfo_properties);
4314 if (properties_tree) {
4315 proto_tree_add_text(properties_tree, tvb,
4317 decode_boolean_bitfield(properties,
4319 "SETATTR can set time on server",
4320 "SETATTR can't set time on server"));
4322 proto_tree_add_text(properties_tree, tvb,
4324 decode_boolean_bitfield(properties,
4326 "PATHCONF is valid for all files",
4327 "PATHCONF should be get for every single file"));
4329 proto_tree_add_text(properties_tree, tvb,
4331 decode_boolean_bitfield(properties,
4333 "File System supports symbolic links",
4334 "File System does not symbolic hard links"));
4336 proto_tree_add_text(properties_tree, tvb,
4338 decode_boolean_bitfield(properties,
4340 "File System supports hard links",
4341 "File System does not support hard links"));
4347 offset = dissect_post_op_attr(tvb, offset, tree,
4356 /* RFC 1813, Page 90..92 */
4358 dissect_nfs3_pathconf_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
4365 offset = dissect_nfsstat3(tvb, offset, tree, &status);
4368 offset = dissect_post_op_attr(tvb, offset, tree,
4370 linkmax = tvb_get_ntohl(tvb, offset + 0);
4372 proto_tree_add_uint(tree, hf_nfs_pathconf_linkmax, tvb,
4373 offset+0, 4, linkmax);
4375 name_max = tvb_get_ntohl(tvb, offset + 0);
4377 proto_tree_add_uint(tree, hf_nfs_pathconf_name_max, tvb,
4378 offset+0, 4, name_max);
4380 offset = dissect_rpc_bool(tvb, tree,
4381 hf_nfs_pathconf_no_trunc, offset);
4382 offset = dissect_rpc_bool(tvb, tree,
4383 hf_nfs_pathconf_chown_restricted, offset);
4384 offset = dissect_rpc_bool(tvb, tree,
4385 hf_nfs_pathconf_case_insensitive, offset);
4386 offset = dissect_rpc_bool(tvb, tree,
4387 hf_nfs_pathconf_case_preserving, offset);
4390 offset = dissect_post_op_attr(tvb, offset, tree,
4399 /* RFC 1813, Page 92..95 */
4401 dissect_nfs3_commit_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
4404 offset = dissect_nfs_fh3(tvb, offset, pinfo, tree, "file");
4405 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_offset3, offset);
4406 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_count3, offset);
4411 /* RFC 1813, Page 92..95 */
4413 dissect_nfs3_commit_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
4418 offset = dissect_nfsstat3(tvb, offset, tree, &status);
4421 offset = dissect_wcc_data (tvb, offset, tree, "file_wcc");
4422 offset = dissect_writeverf3(tvb, offset, tree);
4425 offset = dissect_wcc_data(tvb, offset, tree, "file_wcc");
4432 /**********************************************************/
4433 /* NFS Version 4, RFC 3010 with nfs4_prot.x 1.103 changes */
4434 /**********************************************************/
4437 dissect_nfs_utf8string(tvbuff_t *tvb, int offset,
4438 proto_tree *tree, int hf, char **string_ret)
4440 /* TODO: this dissector is subject to change; do not remove */
4441 return dissect_rpc_string(tvb, tree, hf, offset, string_ret);
4445 dissect_nfs_specdata4(tvbuff_t *tvb, int offset, proto_tree *tree)
4447 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_specdata1, offset);
4448 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_specdata2, offset);
4453 static const value_string names_ftype4[] = {
4454 { NF4REG, "NF4REG" },
4455 { NF4DIR, "NF4DIR" },
4456 { NF4BLK, "NF4BLK" },
4457 { NF4CHR, "NF4CHR" },
4458 { NF4LNK, "NF4LNK" },
4459 { NF4SOCK, "NF4SOCK" },
4460 { NF4FIFO, "NF4FIFO" },
4461 { NF4ATTRDIR, "NF4ATTRDIR" },
4462 { NF4NAMEDATTR, "NF4NAMEDATTR" },
4467 dissect_nfs_lock_owner4(tvbuff_t *tvb, int offset, proto_tree *tree)
4469 proto_tree *newftree = NULL;
4470 proto_item *fitem = NULL;
4472 fitem = proto_tree_add_text(tree, tvb, offset, 4, "Owner");
4476 newftree = proto_item_add_subtree(fitem, ett_nfs_lock_owner4);
4480 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_clientid4, offset);
4481 offset = dissect_nfsdata(tvb, offset, newftree, hf_nfs_data);
4489 dissect_nfs_pathname4(tvbuff_t *tvb, int offset, proto_tree *tree)
4491 guint32 comp_count, i;
4492 proto_item *fitem = NULL;
4493 proto_tree *newftree = NULL;
4495 comp_count=tvb_get_ntohl(tvb, offset);
4496 fitem = proto_tree_add_text(tree, tvb, offset, 4,
4497 "pathname components (%u)", comp_count);
4502 newftree = proto_item_add_subtree(fitem, ett_nfs_pathname4);
4506 for (i = 0; i < comp_count; i++)
4507 offset = dissect_nfs_utf8string(tvb, offset, newftree,
4508 hf_nfs_component4, NULL);
4516 dissect_nfs_nfstime4(tvbuff_t *tvb, int offset, proto_tree *tree)
4518 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_nfstime4_seconds, offset);
4519 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_nfstime4_nseconds, offset);
4524 static const value_string names_time_how4[] = {
4525 #define SET_TO_SERVER_TIME4 0
4526 { SET_TO_SERVER_TIME4, "SET_TO_SERVER_TIME4" },
4527 #define SET_TO_CLIENT_TIME4 1
4528 { SET_TO_CLIENT_TIME4, "SET_TO_CLIENT_TIME4" },
4533 dissect_nfs_settime4(tvbuff_t *tvb, int offset,
4534 proto_tree *tree, char *name _U_)
4538 set_it = tvb_get_ntohl(tvb, offset);
4539 proto_tree_add_uint(tree, hf_nfs_time_how4, tvb, offset+0,
4543 if (set_it == SET_TO_CLIENT_TIME4)
4544 offset = dissect_nfs_nfstime4(tvb, offset, tree);
4550 dissect_nfs_fsid4(tvbuff_t *tvb, int offset, proto_tree *tree, char *name)
4552 proto_tree *newftree = NULL;
4553 proto_item *fitem = NULL;
4555 fitem = proto_tree_add_text(tree, tvb, offset, 0, "%s", name);
4557 if (fitem == NULL) return offset;
4559 newftree = proto_item_add_subtree(fitem, ett_nfs_fsid4);
4561 if (newftree == NULL) return offset;
4563 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_fsid4_major,
4565 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_fsid4_minor,
4571 static const value_string names_acetype4[] = {
4572 #define ACE4_ACCESS_ALLOWED_ACE_TYPE 0x00000000
4573 { ACE4_ACCESS_ALLOWED_ACE_TYPE, "ACE4_ACCESS_ALLOWED_ACE_TYPE" },
4574 #define ACE4_ACCESS_DENIED_ACE_TYPE 0x00000001
4575 { ACE4_ACCESS_DENIED_ACE_TYPE, "ACE4_ACCESS_DENIED_ACE_TYPE" },
4576 #define ACE4_SYSTEM_AUDIT_ACE_TYPE 0x00000002
4577 { ACE4_SYSTEM_AUDIT_ACE_TYPE, "ACE4_SYSTEM_AUDIT_ACE_TYPE" },
4578 #define ACE4_SYSTEM_ALARM_ACE_TYPE 0x00000003
4579 { ACE4_SYSTEM_ALARM_ACE_TYPE, "ACE4_SYSTEM_ALARM_ACE_TYPE" },
4583 /* ACE mask values */
4584 #define ACE4_READ_DATA 0x00000001
4585 #define ACE4_LIST_DIRECTORY 0x00000001
4586 #define ACE4_WRITE_DATA 0x00000002
4587 #define ACE4_ADD_FILE 0x00000002
4588 #define ACE4_APPEND_DATA 0x00000004
4589 #define ACE4_ADD_SUBDIRECTORY 0x00000004
4590 #define ACE4_READ_NAMED_ATTRS 0x00000008
4591 #define ACE4_WRITE_NAMED_ATTRS 0x00000010
4592 #define ACE4_EXECUTE 0x00000020
4593 #define ACE4_DELETE_CHILD 0x00000040
4594 #define ACE4_READ_ATTRIBUTES 0x00000080
4595 #define ACE4_WRITE_ATTRIBUTES 0x00000100
4596 #define ACE4_DELETE 0x00010000
4597 #define ACE4_READ_ACL 0x00020000
4598 #define ACE4_WRITE_ACL 0x00040000
4599 #define ACE4_WRITE_OWNER 0x00080000
4600 #define ACE4_SYNCHRONIZE 0x00100000
4603 dissect_nfs_acemask4(tvbuff_t *tvb, int offset, proto_tree *tree)
4606 proto_item *acemask_item = NULL;
4607 proto_tree *acemask_tree = NULL;
4609 acemask = tvb_get_ntohl(tvb, offset);
4611 acemask_item = proto_tree_add_text(tree, tvb, offset, 4,
4612 "acemask: 0x%08x", acemask);
4615 acemask_tree = proto_item_add_subtree(acemask_item, ett_nfs_acemask4);
4619 if (acemask & ACE4_READ_DATA)
4620 proto_tree_add_text(acemask_tree, tvb, offset, 4,
4621 "ACE4_READ_DATA/ACE4_LIST_DIRECTORY (0x%08x)",
4624 if (acemask & ACE4_WRITE_DATA)
4625 proto_tree_add_text(acemask_tree, tvb, offset, 4,
4626 "ACE4_WRITE_DATA/ACE4_ADD_FILE (0x%08x)",
4629 if (acemask & ACE4_APPEND_DATA)
4630 proto_tree_add_text(acemask_tree, tvb, offset, 4,
4631 "ACE4_ADD_FILE/ACE4_ADD_SUBDIRECTORY (0x%08x)",
4634 if (acemask & ACE4_READ_NAMED_ATTRS)
4635 proto_tree_add_text(acemask_tree, tvb, offset, 4,
4636 "ACE4_READ_NAMED_ATTRS (0x%08x)",
4637 ACE4_READ_NAMED_ATTRS);
4639 if (acemask & ACE4_WRITE_NAMED_ATTRS)
4640 proto_tree_add_text(acemask_tree, tvb, offset, 4,
4641 "ACE4_WRITE_NAMED_ATTRS (0x%08x)",
4642 ACE4_WRITE_NAMED_ATTRS);
4644 if (acemask & ACE4_EXECUTE)
4645 proto_tree_add_text(acemask_tree, tvb, offset, 4,
4646 "ACE4_EXECUTE (0x%08x)",
4649 if (acemask & ACE4_DELETE_CHILD)
4650 proto_tree_add_text(acemask_tree, tvb, offset, 4,
4651 "ACE4_DELETE_CHILD (0x%08x)",
4654 if (acemask & ACE4_READ_ATTRIBUTES)
4655 proto_tree_add_text(acemask_tree, tvb, offset, 4,
4656 "ACE4_READ_ATTRIBUTES (0x%08x)",
4657 ACE4_READ_ATTRIBUTES);
4659 if (acemask & ACE4_WRITE_ATTRIBUTES)
4660 proto_tree_add_text(acemask_tree, tvb, offset, 4,
4661 "ACE4_WRITE_ATTRIBUTES (0x%08x)",
4662 ACE4_WRITE_ATTRIBUTES);
4664 if (acemask & ACE4_DELETE)
4665 proto_tree_add_text(acemask_tree, tvb, offset, 4,
4666 "ACE4_DELETE (0x%08x)",
4669 if (acemask & ACE4_READ_ACL)
4670 proto_tree_add_text(acemask_tree, tvb, offset, 4,
4671 "ACE4_READ_ACL (0x%08x)",
4674 if (acemask & ACE4_WRITE_ACL)
4675 proto_tree_add_text(acemask_tree, tvb, offset, 4,
4676 "ACE4_WRITE_ACL (0x%08x)",
4679 if (acemask & ACE4_WRITE_OWNER)
4680 proto_tree_add_text(acemask_tree, tvb, offset, 4,
4681 "ACE4_WRITE_OWNER (0x%08x)",
4684 if (acemask & ACE4_SYNCHRONIZE)
4685 proto_tree_add_text(acemask_tree, tvb, offset, 4,
4686 "ACE4_SYNCHRONIZE (0x%08x)",
4695 /* ACE flag values */
4696 #define ACE4_FILE_INHERIT_ACE 0x00000001
4697 #define ACE4_DIRECTORY_INHERIT_ACE 0x00000002
4698 #define ACE4_NO_PROPAGATE_INHERIT_ACE 0x00000004
4699 #define ACE4_INHERIT_ONLY_ACE 0x00000008
4700 #define ACE4_SUCCESSFUL_ACCESS_ACE_FLAG 0x00000010
4701 #define ACE4_FAILED_ACCESS_ACE_FLAG 0x00000020
4702 #define ACE4_IDENTIFIER_GROUP 0x00000040
4706 dissect_nfs_ace4(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
4709 proto_item* ace_item = NULL;
4710 proto_tree* ace_tree = NULL;
4711 proto_item *aceflag_item = NULL;
4712 proto_tree *aceflag_tree = NULL;
4716 ace_item = proto_tree_add_text(tree, tvb, offset, 4,
4720 ace_tree = proto_item_add_subtree(ace_item, ett_nfs_ace4);
4724 offset = dissect_rpc_uint32(tvb, ace_tree, hf_nfs_acetype4, offset);
4726 aceflag4 = tvb_get_ntohl(tvb, offset);
4728 aceflag_item = proto_tree_add_text(ace_tree, tvb, offset, 4,
4729 "aceflag: 0x%08x", aceflag4);
4733 aceflag_tree = proto_item_add_subtree(aceflag_item, ett_nfs_aceflag4);
4737 if (aceflag4 & ACE4_FILE_INHERIT_ACE)
4738 proto_tree_add_text(aceflag_tree, tvb, offset, 4,
4739 "ACE4_FILE_INHERIT_ACE (0x%08x)", ACE4_FILE_INHERIT_ACE);
4741 if (aceflag4 & ACE4_DIRECTORY_INHERIT_ACE)
4742 proto_tree_add_text(aceflag_tree, tvb, offset, 4,
4743 "ACE4_DIRECTORY_INHERIT_ACE (0x%08x)",
4744 ACE4_DIRECTORY_INHERIT_ACE);
4746 if (aceflag4 & ACE4_INHERIT_ONLY_ACE)
4747 proto_tree_add_text(aceflag_tree, tvb, offset, 4,
4748 "ACE4_INHERIT_ONLY_ACE (0x%08x)",
4749 ACE4_INHERIT_ONLY_ACE);
4751 if (aceflag4 & ACE4_SUCCESSFUL_ACCESS_ACE_FLAG)
4752 proto_tree_add_text(aceflag_tree, tvb, offset, 4,
4753 "ACE4_SUCCESSFUL_ACCESS_ACE_FLAG (0x%08x)",
4754 ACE4_SUCCESSFUL_ACCESS_ACE_FLAG);
4756 if (aceflag4 & ACE4_FAILED_ACCESS_ACE_FLAG)
4757 proto_tree_add_text(aceflag_tree, tvb, offset, 4,
4758 "ACE4_FAILED_ACCESS_ACE_FLAG (0x%08x)",
4759 ACE4_FAILED_ACCESS_ACE_FLAG);
4761 if (aceflag4 & ACE4_IDENTIFIER_GROUP)
4762 proto_tree_add_text(aceflag_tree, tvb, offset, 4,
4763 "ACE4_IDENTIFIER_GROUP (0x%08x)",
4764 ACE4_IDENTIFIER_GROUP);
4770 offset = dissect_nfs_acemask4(tvb, offset, ace_tree);
4772 offset = dissect_nfs_utf8string(tvb, offset, ace_tree, hf_nfs_who, NULL);
4779 dissect_nfs_fattr4_acl(tvbuff_t *tvb, int offset, packet_info *pinfo,
4782 return dissect_rpc_array(tvb, pinfo, tree, offset, dissect_nfs_ace4,
4787 dissect_nfs_fh4(tvbuff_t *tvb, int offset, packet_info *pinfo,
4788 proto_tree *tree, char *name)
4790 return dissect_nfs_fh3(tvb, offset, pinfo, tree, name);
4794 dissect_nfs_fs_location4(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
4797 proto_tree *newftree = NULL;
4798 proto_item *fitem = NULL;
4800 fitem = proto_tree_add_text(tree, tvb, offset, 0, "rootpath");
4802 if (fitem == NULL) return offset;
4804 newftree = proto_item_add_subtree(fitem, ett_nfs_fs_location4);
4806 if (newftree == NULL) return offset;
4808 offset = dissect_nfs_utf8string(tvb, offset, tree, hf_nfs_server, NULL);
4814 dissect_nfs_fs_locations4(tvbuff_t *tvb, packet_info *pinfo, int offset,
4815 proto_tree *tree, char *name)
4817 proto_tree *newftree = NULL;
4818 proto_item *fitem = NULL;
4820 fitem = proto_tree_add_text(tree, tvb, offset, 0, "%s", name);
4822 if (fitem == NULL) return offset;
4824 newftree = proto_item_add_subtree(fitem, ett_nfs_fs_locations4);
4826 if (newftree == NULL) return offset;
4828 offset = dissect_nfs_pathname4(tvb, offset, newftree);
4830 offset = dissect_rpc_list(tvb, pinfo, tree, offset,
4831 dissect_nfs_fs_location4);
4837 dissect_nfs_mode4(tvbuff_t *tvb, int offset,
4838 proto_tree *tree, char *name)
4840 return dissect_mode(tvb, offset, tree, name);
4843 static const value_string nfs4_fattr4_fh_expire_type_names[] = {
4844 #define FH4_PERSISTENT 0x00000000
4845 { FH4_PERSISTENT, "FH4_PERSISTENT" },
4846 #define FH4_NOEXPIRE_WITH_OPEN 0x00000001
4847 { FH4_NOEXPIRE_WITH_OPEN, "FH4_NOEXPIRE_WITH_OPEN" },
4848 #define FH4_VOLATILE_ANY 0x00000002
4849 { FH4_VOLATILE_ANY, "FH4_VOLATILE_ANY" },
4850 #define FH4_VOL_MIGRATION 0x00000004
4851 { FH4_VOL_MIGRATION, "FH4_VOL_MIGRATION" },
4852 #define FH4_VOL_RENAME 0x00000008
4853 { FH4_VOL_RENAME, "FH4_VOL_RENAME" },
4859 dissect_nfs_fattr4_fh_expire_type(tvbuff_t *tvb, int offset, proto_tree *tree)
4861 guint32 expire_type;
4862 proto_item *expire_type_item = NULL;
4863 proto_tree *expire_type_tree = NULL;
4865 expire_type = tvb_get_ntohl(tvb, offset + 0);
4869 expire_type_item = proto_tree_add_text(tree, tvb, offset, 4,
4870 "fattr4_fh_expire_type: 0x%08x", expire_type);
4871 if (expire_type_item)
4872 expire_type_tree = proto_item_add_subtree(expire_type_item,
4873 ett_nfs_fattr4_fh_expire_type);
4876 if (expire_type_tree)
4878 if (expire_type == FH4_PERSISTENT)
4880 proto_tree_add_text(expire_type_tree, tvb, offset, 4, "%s",
4881 decode_enumerated_bitfield(expire_type, FH4_PERSISTENT, 8,
4882 nfs4_fattr4_fh_expire_type_names, "%s"));
4886 if (expire_type & FH4_NOEXPIRE_WITH_OPEN)
4887 proto_tree_add_text(expire_type_tree, tvb, offset, 4,
4888 "FH4_NOEXPIRE_WITH_OPEN (0x%08x)", FH4_NOEXPIRE_WITH_OPEN);
4890 if (expire_type & FH4_VOLATILE_ANY)
4891 proto_tree_add_text(expire_type_tree, tvb, offset, 4,
4892 "FH4_VOLATILE_ANY (0x%08x)", FH4_VOLATILE_ANY);
4894 if (expire_type & FH4_VOL_MIGRATION)
4895 proto_tree_add_text(expire_type_tree, tvb, offset, 4,
4896 "FH4_VOL_MIGRATION (0x%08x)", FH4_VOL_MIGRATION);
4898 if (expire_type & FH4_VOL_RENAME)
4899 proto_tree_add_text(expire_type_tree, tvb, offset, 4,
4900 "FH4_VOL_RENAME (0x%08x)", FH4_VOL_RENAME);
4909 static const value_string names_fattr4[] = {
4910 #define FATTR4_SUPPORTED_ATTRS 0
4911 { FATTR4_SUPPORTED_ATTRS, "FATTR4_SUPPORTED_ATTRS" },
4912 #define FATTR4_TYPE 1
4913 { FATTR4_TYPE, "FATTR4_TYPE" },
4914 #define FATTR4_FH_EXPIRE_TYPE 2
4915 { FATTR4_FH_EXPIRE_TYPE, "FATTR4_FH_EXPIRE_TYPE" },
4916 #define FATTR4_CHANGE 3
4917 { FATTR4_CHANGE, "FATTR4_CHANGE" },
4918 #define FATTR4_SIZE 4
4919 { FATTR4_SIZE, "FATTR4_SIZE" },
4920 #define FATTR4_LINK_SUPPORT 5
4921 { FATTR4_LINK_SUPPORT, "FATTR4_LINK_SUPPORT" },
4922 #define FATTR4_SYMLINK_SUPPORT 6
4923 { FATTR4_SYMLINK_SUPPORT, "FATTR4_SYMLINK_SUPPORT" },
4924 #define FATTR4_NAMED_ATTR 7
4925 { FATTR4_NAMED_ATTR, "FATTR4_NAMED_ATTR" },
4926 #define FATTR4_FSID 8
4927 { FATTR4_FSID, "FATTR4_FSID" },
4928 #define FATTR4_UNIQUE_HANDLES 9
4929 { FATTR4_UNIQUE_HANDLES, "FATTR4_UNIQUE_HANDLES" },
4930 #define FATTR4_LEASE_TIME 10
4931 { FATTR4_LEASE_TIME, "FATTR4_LEASE_TIME" },
4932 #define FATTR4_RDATTR_ERROR 11
4933 { FATTR4_RDATTR_ERROR, "FATTR4_RDATTR_ERROR" },
4934 #define FATTR4_ACL 12
4935 { FATTR4_ACL, "FATTR4_ACL" },
4936 #define FATTR4_ACLSUPPORT 13
4937 { FATTR4_ACLSUPPORT, "FATTR4_ACLSUPPORT" },
4938 #define FATTR4_ARCHIVE 14
4939 { FATTR4_ARCHIVE, "FATTR4_ARCHIVE" },
4940 #define FATTR4_CANSETTIME 15
4941 { FATTR4_CANSETTIME, "FATTR4_CANSETTIME" },
4942 #define FATTR4_CASE_INSENSITIVE 16
4943 { FATTR4_CASE_INSENSITIVE, "FATTR4_CASE_INSENSITIVE" },
4944 #define FATTR4_CASE_PRESERVING 17
4945 { FATTR4_CASE_PRESERVING, "FATTR4_CASE_PRESERVING" },
4946 #define FATTR4_CHOWN_RESTRICTED 18
4947 { FATTR4_CHOWN_RESTRICTED, "FATTR4_CHOWN_RESTRICTED" },
4948 #define FATTR4_FILEHANDLE 19
4949 { FATTR4_FILEHANDLE, "FATTR4_FILEHANDLE" },
4950 #define FATTR4_FILEID 20
4951 { FATTR4_FILEID, "FATTR4_FILEID" },
4952 #define FATTR4_FILES_AVAIL 21
4953 { FATTR4_FILES_AVAIL, "FATTR4_FILES_AVAIL" },
4954 #define FATTR4_FILES_FREE 22
4955 { FATTR4_FILES_FREE, "FATTR4_FILES_FREE" },
4956 #define FATTR4_FILES_TOTAL 23
4957 { FATTR4_FILES_TOTAL, "FATTR4_FILES_TOTAL" },
4958 #define FATTR4_FS_LOCATIONS 24
4959 { FATTR4_FS_LOCATIONS, "FATTR4_FS_LOCATIONS" },
4960 #define FATTR4_HIDDEN 25
4961 { FATTR4_HIDDEN, "FATTR4_HIDDEN" },
4962 #define FATTR4_HOMOGENEOUS 26
4963 { FATTR4_HOMOGENEOUS, "FATTR4_HOMOGENEOUS" },
4964 #define FATTR4_MAXFILESIZE 27
4965 { FATTR4_MAXFILESIZE, "FATTR4_MAXFILESIZE" },
4966 #define FATTR4_MAXLINK 28
4967 { FATTR4_MAXLINK, "FATTR4_MAXLINK" },
4968 #define FATTR4_MAXNAME 29
4969 { FATTR4_MAXNAME, "FATTR4_MAXNAME" },
4970 #define FATTR4_MAXREAD 30
4971 { FATTR4_MAXREAD, "FATTR4_MAXREAD" },
4972 #define FATTR4_MAXWRITE 31
4973 { FATTR4_MAXWRITE, "FATTR4_MAXWRITE" },
4974 #define FATTR4_MIMETYPE 32
4975 { FATTR4_MIMETYPE, "FATTR4_MIMETYPE" },
4976 #define FATTR4_MODE 33
4977 { FATTR4_MODE, "FATTR4_MODE" },
4978 #define FATTR4_NO_TRUNC 34
4979 { FATTR4_NO_TRUNC, "FATTR4_NO_TRUNC" },
4980 #define FATTR4_NUMLINKS 35
4981 { FATTR4_NUMLINKS, "FATTR4_NUMLINKS" },
4982 #define FATTR4_OWNER 36
4983 { FATTR4_OWNER, "FATTR4_OWNER" },
4984 #define FATTR4_OWNER_GROUP 37
4985 { FATTR4_OWNER_GROUP, "FATTR4_OWNER_GROUP" },
4986 #define FATTR4_QUOTA_AVAIL_HARD 38
4987 { FATTR4_QUOTA_AVAIL_HARD, "FATTR4_QUOTA_AVAIL_HARD" },
4988 #define FATTR4_QUOTA_AVAIL_SOFT 39
4989 { FATTR4_QUOTA_AVAIL_SOFT, "FATTR4_QUOTA_AVAIL_SOFT" },
4990 #define FATTR4_QUOTA_USED 40
4991 { FATTR4_QUOTA_USED, "FATTR4_QUOTA_USED" },
4992 #define FATTR4_RAWDEV 41
4993 { FATTR4_RAWDEV, "FATTR4_RAWDEV" },
4994 #define FATTR4_SPACE_AVAIL 42
4995 { FATTR4_SPACE_AVAIL, "FATTR4_SPACE_AVAIL" },
4996 #define FATTR4_SPACE_FREE 43
4997 { FATTR4_SPACE_FREE, "FATTR4_SPACE_FREE" },
4998 #define FATTR4_SPACE_TOTAL 44
4999 { FATTR4_SPACE_TOTAL, "FATTR4_SPACE_TOTAL" },
5000 #define FATTR4_SPACE_USED 45
5001 { FATTR4_SPACE_USED, "FATTR4_SPACE_USED" },
5002 #define FATTR4_SYSTEM 46
5003 { FATTR4_SYSTEM, "FATTR4_SYSTEM" },
5004 #define FATTR4_TIME_ACCESS 47
5005 { FATTR4_TIME_ACCESS, "FATTR4_TIME_ACCESS" },
5006 #define FATTR4_TIME_ACCESS_SET 48
5007 { FATTR4_TIME_ACCESS_SET, "FATTR4_TIME_ACCESS_SET" },
5008 #define FATTR4_TIME_BACKUP 49
5009 { FATTR4_TIME_BACKUP, "FATTR4_TIME_BACKUP" },
5010 #define FATTR4_TIME_CREATE 50
5011 { FATTR4_TIME_CREATE, "FATTR4_TIME_CREATE" },
5012 #define FATTR4_TIME_DELTA 51
5013 { FATTR4_TIME_DELTA, "FATTR4_TIME_DELTA" },
5014 #define FATTR4_TIME_METADATA 52
5015 { FATTR4_TIME_METADATA, "FATTR4_TIME_METADATA" },
5016 #define FATTR4_TIME_MODIFY 53
5017 { FATTR4_TIME_MODIFY, "FATTR4_TIME_MODIFY" },
5018 #define FATTR4_TIME_MODIFY_SET 54
5019 { FATTR4_TIME_MODIFY_SET, "FATTR4_TIME_MODIFY_SET" },
5020 #define FATTR4_MOUNTED_ON_FILEID 55
5021 { FATTR4_MOUNTED_ON_FILEID, "FATTR4_MOUNTED_ON_FILEID" },
5025 #define FATTR4_BITMAP_ONLY 0
5026 #define FATTR4_FULL_DISSECT 1
5029 dissect_nfs_attributes(tvbuff_t *tvb, int offset, packet_info *pinfo,
5030 proto_tree *tree, int type)
5033 proto_item *fitem = NULL;
5034 proto_tree *newftree = NULL;
5035 proto_item *attr_fitem = NULL;
5036 proto_tree *attr_newftree = NULL;
5042 int attr_vals_offset;
5044 bitmap_len = tvb_get_ntohl(tvb, offset);
5045 fitem = proto_tree_add_text(tree, tvb, offset, 4 + bitmap_len * 4,
5049 if (fitem == NULL) return offset;
5051 newftree = proto_item_add_subtree(fitem, ett_nfs_bitmap4);
5053 if (newftree == NULL) return offset;
5055 attr_vals_offset = offset + 4 + bitmap_len * 4;
5057 bitmap = g_malloc(bitmap_len * sizeof(guint32));
5058 if (bitmap == NULL) return offset;
5060 for (i = 0; i < bitmap_len; i++)
5062 if (!tvb_bytes_exist(tvb, offset, 4))
5068 bitmap[i] = tvb_get_ntohl(tvb, offset);
5072 for (j = 0; j < 32; j++)
5078 /* switch label if attribute is recommended vs. mandatory */
5079 attr_fitem = proto_tree_add_uint(newftree,
5080 (fattr < FATTR4_ACL)? hf_nfs_mand_attr: hf_nfs_recc_attr,
5081 tvb, offset, 4, fattr);
5083 if (attr_fitem == NULL) break;
5085 attr_newftree = proto_item_add_subtree(attr_fitem, ett_nfs_bitmap4);
5087 if (attr_newftree == NULL) break;
5089 if (type == FATTR4_FULL_DISSECT)
5091 /* do a full decode of the arguments for the set flag */
5094 case FATTR4_SUPPORTED_ATTRS:
5095 attr_vals_offset = dissect_nfs_attributes(tvb,
5096 attr_vals_offset, pinfo, attr_newftree,
5097 FATTR4_BITMAP_ONLY);
5101 attr_vals_offset = dissect_rpc_uint32(tvb,
5102 attr_newftree, hf_nfs_ftype4, attr_vals_offset);
5105 case FATTR4_FH_EXPIRE_TYPE:
5106 attr_vals_offset = dissect_nfs_fattr4_fh_expire_type(tvb,
5107 attr_vals_offset, attr_newftree);
5111 attr_vals_offset = dissect_rpc_uint64(tvb, attr_newftree,
5112 hf_nfs_changeid4, attr_vals_offset);
5116 attr_vals_offset = dissect_rpc_uint64(tvb,
5117 attr_newftree, hf_nfs_fattr4_size, attr_vals_offset);
5120 case FATTR4_LINK_SUPPORT:
5121 attr_vals_offset = dissect_rpc_bool(tvb,
5122 attr_newftree, hf_nfs_fattr4_link_support,
5126 case FATTR4_SYMLINK_SUPPORT:
5127 attr_vals_offset = dissect_rpc_bool(tvb,
5128 attr_newftree, hf_nfs_fattr4_symlink_support,
5132 case FATTR4_NAMED_ATTR:
5133 attr_vals_offset = dissect_rpc_bool(tvb,
5134 attr_newftree, hf_nfs_fattr4_named_attr, attr_vals_offset);
5138 attr_vals_offset = dissect_nfs_fsid4(tvb, attr_vals_offset,
5139 attr_newftree, "fattr4_fsid");
5142 case FATTR4_UNIQUE_HANDLES:
5143 attr_vals_offset = dissect_rpc_bool(tvb,
5144 attr_newftree, hf_nfs_fattr4_unique_handles,
5148 case FATTR4_LEASE_TIME:
5149 attr_vals_offset = dissect_rpc_uint32(tvb,
5150 attr_newftree, hf_nfs_fattr4_lease_time,
5154 case FATTR4_RDATTR_ERROR:
5155 attr_vals_offset = dissect_nfs_nfsstat4(tvb,
5156 attr_vals_offset, attr_newftree, NULL);
5160 attr_vals_offset = dissect_nfs_fattr4_acl(tvb,
5161 attr_vals_offset, pinfo, attr_newftree);
5164 case FATTR4_ACLSUPPORT:
5165 attr_vals_offset = dissect_rpc_uint32(tvb,
5166 attr_newftree, hf_nfs_fattr4_aclsupport,
5170 case FATTR4_ARCHIVE:
5171 attr_vals_offset = dissect_rpc_bool(tvb,
5172 attr_newftree, hf_nfs_fattr4_archive,
5176 case FATTR4_CANSETTIME:
5177 attr_vals_offset = dissect_rpc_bool(tvb,
5178 attr_newftree, hf_nfs_fattr4_cansettime, attr_vals_offset);
5181 case FATTR4_CASE_INSENSITIVE:
5182 attr_vals_offset = dissect_rpc_bool(tvb,
5183 attr_newftree, hf_nfs_fattr4_case_insensitive,
5187 case FATTR4_CASE_PRESERVING:
5188 attr_vals_offset = dissect_rpc_bool(tvb,
5189 attr_newftree, hf_nfs_fattr4_case_preserving,
5193 case FATTR4_CHOWN_RESTRICTED:
5194 attr_vals_offset = dissect_rpc_bool(tvb,
5195 attr_newftree, hf_nfs_fattr4_chown_restricted,
5200 attr_vals_offset = dissect_rpc_uint64(tvb,
5201 attr_newftree, hf_nfs_fattr4_fileid, attr_vals_offset);
5204 case FATTR4_FILES_AVAIL:
5205 attr_vals_offset = dissect_rpc_uint64(tvb,
5206 attr_newftree, hf_nfs_fattr4_files_avail,
5210 case FATTR4_FILEHANDLE:
5211 attr_vals_offset = dissect_nfs_fh4(tvb, attr_vals_offset,
5212 pinfo, attr_newftree, "fattr4_filehandle");
5215 case FATTR4_FILES_FREE:
5216 attr_vals_offset = dissect_rpc_uint64(tvb,
5217 attr_newftree, hf_nfs_fattr4_files_free, attr_vals_offset);
5220 case FATTR4_FILES_TOTAL:
5221 attr_vals_offset = dissect_rpc_uint64(tvb,
5222 attr_newftree, hf_nfs_fattr4_files_total,
5226 case FATTR4_FS_LOCATIONS:
5227 attr_vals_offset = dissect_nfs_fs_locations4(tvb, pinfo,
5228 attr_vals_offset, attr_newftree,
5229 "fattr4_fs_locations");
5233 attr_vals_offset = dissect_rpc_bool(tvb,
5234 attr_newftree, hf_nfs_fattr4_hidden, attr_vals_offset);
5237 case FATTR4_HOMOGENEOUS:
5238 attr_vals_offset = dissect_rpc_bool(tvb,
5239 attr_newftree, hf_nfs_fattr4_homogeneous,
5243 case FATTR4_MAXFILESIZE:
5244 attr_vals_offset = dissect_rpc_uint64(tvb,
5245 attr_newftree, hf_nfs_fattr4_maxfilesize,
5249 case FATTR4_MAXLINK:
5250 attr_vals_offset = dissect_rpc_uint32(tvb,
5251 attr_newftree, hf_nfs_fattr4_maxlink, attr_vals_offset);
5254 case FATTR4_MAXNAME:
5255 attr_vals_offset = dissect_rpc_uint32(tvb,
5256 attr_newftree, hf_nfs_fattr4_maxname, attr_vals_offset);
5259 case FATTR4_MAXREAD:
5260 attr_vals_offset = dissect_rpc_uint64(tvb,
5261 attr_newftree, hf_nfs_fattr4_maxread, attr_vals_offset);
5264 case FATTR4_MAXWRITE:
5265 attr_vals_offset = dissect_rpc_uint64(tvb,
5266 attr_newftree, hf_nfs_fattr4_maxwrite, attr_vals_offset);
5269 case FATTR4_MIMETYPE:
5270 attr_vals_offset = dissect_nfs_utf8string(tvb,
5271 attr_vals_offset, attr_newftree,
5272 hf_nfs_fattr4_mimetype, NULL);
5276 attr_vals_offset = dissect_nfs_mode4(tvb,
5277 attr_vals_offset, attr_newftree, "fattr4_mode");
5280 case FATTR4_NO_TRUNC:
5281 attr_vals_offset = dissect_rpc_bool(tvb,
5282 attr_newftree, hf_nfs_fattr4_no_trunc, attr_vals_offset);
5285 case FATTR4_NUMLINKS:
5286 attr_vals_offset = dissect_rpc_uint32(tvb,
5287 attr_newftree, hf_nfs_fattr4_numlinks, attr_vals_offset);
5291 attr_vals_offset = dissect_nfs_utf8string(tvb,
5292 attr_vals_offset, attr_newftree,
5293 hf_nfs_fattr4_owner,
5297 case FATTR4_OWNER_GROUP:
5298 attr_vals_offset = dissect_nfs_utf8string(tvb,
5299 attr_vals_offset, attr_newftree,
5300 hf_nfs_fattr4_owner_group, NULL);
5303 case FATTR4_QUOTA_AVAIL_HARD:
5304 attr_vals_offset = dissect_rpc_uint64(tvb,
5305 attr_newftree, hf_nfs_fattr4_quota_hard, attr_vals_offset);
5308 case FATTR4_QUOTA_AVAIL_SOFT:
5309 attr_vals_offset = dissect_rpc_uint64(tvb,
5310 attr_newftree, hf_nfs_fattr4_quota_soft, attr_vals_offset);
5313 case FATTR4_QUOTA_USED:
5314 attr_vals_offset = dissect_rpc_uint64(tvb,
5315 attr_newftree, hf_nfs_fattr4_quota_used, attr_vals_offset);
5319 attr_vals_offset = dissect_nfs_specdata4(tvb,
5320 attr_vals_offset, attr_newftree);
5323 case FATTR4_SPACE_AVAIL:
5324 attr_vals_offset = dissect_rpc_uint64(tvb,
5325 attr_newftree, hf_nfs_fattr4_space_avail,
5329 case FATTR4_SPACE_FREE:
5330 attr_vals_offset = dissect_rpc_uint64(tvb,
5331 attr_newftree, hf_nfs_fattr4_space_free, attr_vals_offset);
5334 case FATTR4_SPACE_TOTAL:
5335 attr_vals_offset = dissect_rpc_uint64(tvb,
5336 attr_newftree, hf_nfs_fattr4_space_total,
5340 case FATTR4_SPACE_USED:
5341 attr_vals_offset = dissect_rpc_uint64(tvb,
5342 attr_newftree, hf_nfs_fattr4_space_used, attr_vals_offset);
5346 attr_vals_offset = dissect_rpc_bool(tvb,
5347 attr_newftree, hf_nfs_fattr4_system, attr_vals_offset);
5350 case FATTR4_TIME_ACCESS:
5351 case FATTR4_TIME_BACKUP:
5352 case FATTR4_TIME_CREATE:
5353 case FATTR4_TIME_DELTA:
5354 case FATTR4_TIME_METADATA:
5355 case FATTR4_TIME_MODIFY:
5356 attr_vals_offset = dissect_nfs_nfstime4(tvb, attr_vals_offset,
5360 case FATTR4_TIME_ACCESS_SET:
5361 case FATTR4_TIME_MODIFY_SET:
5362 attr_vals_offset = dissect_nfs_settime4(tvb,
5363 attr_vals_offset, attr_newftree, "settime4");
5384 dissect_nfs_fattr4(tvbuff_t *tvb, int offset, packet_info *pinfo,
5387 proto_tree *newftree = NULL;
5388 proto_item *fitem = NULL;
5390 fitem = proto_tree_add_text(tree, tvb, offset, 4, "obj_attributes");
5392 if (fitem == NULL) return offset;
5394 newftree = proto_item_add_subtree(fitem, ett_nfs_fattr4);
5396 if (newftree == NULL) return offset;
5398 offset = dissect_nfs_attributes(tvb, offset, pinfo, newftree,
5399 FATTR4_FULL_DISSECT);
5401 offset = dissect_nfsdata(tvb, offset, tree, hf_nfs_attrlist4);
5406 static const value_string names_open4_share_access[] = {
5407 #define OPEN4_SHARE_ACCESS_READ 0x00000001
5408 { OPEN4_SHARE_ACCESS_READ, "OPEN4_SHARE_ACCESS_READ" },
5409 #define OPEN4_SHARE_ACCESS_WRITE 0x00000002
5410 { OPEN4_SHARE_ACCESS_WRITE, "OPEN4_SHARE_ACCESS_WRITE" },
5411 #define OPEN4_SHARE_ACCESS_BOTH 0x00000003
5412 { OPEN4_SHARE_ACCESS_BOTH, "OPEN4_SHARE_ACCESS_BOTH" },
5417 dissect_nfs_open4_share_access(tvbuff_t *tvb, int offset,
5422 share_access = tvb_get_ntohl(tvb, offset);
5423 proto_tree_add_uint(tree, hf_nfs_open4_share_access, tvb, offset, 4,
5430 static const value_string names_open4_share_deny[] = {
5431 #define OPEN4_SHARE_DENY_NONE 0x00000000
5432 { OPEN4_SHARE_DENY_NONE, "OPEN4_SHARE_DENY_NONE" },
5433 #define OPEN4_SHARE_DENY_READ 0x00000001
5434 { OPEN4_SHARE_DENY_READ, "OPEN4_SHARE_DENY_READ" },
5435 #define OPEN4_SHARE_DENY_WRITE 0x00000002
5436 { OPEN4_SHARE_DENY_WRITE, "OPEN4_SHARE_DENY_WRITE" },
5437 #define OPEN4_SHARE_DENY_BOTH 0x00000003
5438 { OPEN4_SHARE_DENY_BOTH, "OPEN4_SHARE_DENY_BOTH" },
5443 dissect_nfs_open4_share_deny(tvbuff_t *tvb, int offset,
5448 deny_access = tvb_get_ntohl(tvb, offset);
5449 proto_tree_add_uint(tree, hf_nfs_open4_share_deny, tvb, offset, 4,
5457 dissect_nfs_open_owner4(tvbuff_t *tvb, int offset, proto_tree *tree)
5459 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_clientid4, offset);
5460 offset = dissect_nfsdata(tvb, offset, tree, hf_nfs_open_owner4);
5466 dissect_nfs_open_claim_delegate_cur4(tvbuff_t *tvb, int offset,
5469 offset = dissect_rpc_uint64(tvb, tree,
5470 hf_nfs_stateid4_delegate_stateid, offset);
5471 offset = dissect_nfs_utf8string(tvb, offset, tree, hf_nfs_component4, NULL);
5476 #define CLAIM_NULL 0
5477 #define CLAIM_PREVIOUS 1
5478 #define CLAIM_DELEGATE_CUR 2
5479 #define CLAIM_DELEGATE_PREV 3
5481 static const value_string names_claim_type4[] = {
5482 { CLAIM_NULL, "CLAIM_NULL" },
5483 { CLAIM_PREVIOUS, "CLAIM_PREVIOUS" },
5484 { CLAIM_DELEGATE_CUR, "CLAIM_DELEGATE_CUR" },
5485 { CLAIM_DELEGATE_PREV, "CLAIM_DELEGATE_PREV" },
5490 dissect_nfs_open_claim4(tvbuff_t *tvb, int offset,
5493 guint open_claim_type4;
5494 proto_item *fitem = NULL;
5495 proto_tree *newftree = NULL;
5497 open_claim_type4 = tvb_get_ntohl(tvb, offset);
5498 fitem = proto_tree_add_uint(tree, hf_nfs_open_claim_type4, tvb,
5499 offset+0, 4, open_claim_type4);
5503 newftree = proto_item_add_subtree(fitem, ett_nfs_open_claim4);
5507 switch(open_claim_type4)
5510 offset = dissect_nfs_utf8string(tvb, offset, newftree, hf_nfs_component4, NULL);
5513 case CLAIM_PREVIOUS:
5514 offset = dissect_rpc_uint32(tvb, newftree,
5515 hf_nfs_delegate_type, offset);
5518 case CLAIM_DELEGATE_CUR:
5519 offset = dissect_nfs_open_claim_delegate_cur4(tvb, offset,
5523 case CLAIM_DELEGATE_PREV:
5524 offset = dissect_nfs_utf8string(tvb, offset, newftree, hf_nfs_component4, NULL);
5537 dissect_nfs_createhow4(tvbuff_t *tvb, int offset, packet_info *pinfo,
5542 /* This is intentional; we're using the same flags as NFSv3 */
5543 mode = tvb_get_ntohl(tvb, offset);
5544 proto_tree_add_uint(tree, hf_nfs_createmode3, tvb, offset, 4, mode);
5549 case UNCHECKED: /* UNCHECKED4 */
5550 case GUARDED: /* GUARDED4 */
5551 offset = dissect_nfs_fattr4(tvb, offset, pinfo, tree);
5554 case EXCLUSIVE: /* EXCLUSIVE4 */
5555 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_verifier4, offset);
5565 #define OPEN4_NOCREATE 0
5566 #define OPEN4_CREATE 1
5567 static const value_string names_opentype4[] = {
5568 { OPEN4_NOCREATE, "OPEN4_NOCREATE" },
5569 { OPEN4_CREATE, "OPEN4_CREATE" },
5574 dissect_nfs_openflag4(tvbuff_t *tvb, int offset, packet_info *pinfo,
5578 proto_item *fitem = NULL;
5579 proto_tree *newftree = NULL;
5581 opentype4 = tvb_get_ntohl(tvb, offset);
5582 fitem = proto_tree_add_uint(tree, hf_nfs_opentype4, tvb,
5583 offset+0, 4, opentype4);
5587 newftree = proto_item_add_subtree(fitem, ett_nfs_opentype4);
5594 offset = dissect_nfs_createhow4(tvb, offset, pinfo, newftree);
5607 dissect_nfs_clientaddr4(tvbuff_t *tvb, int offset, proto_tree *tree)
5609 offset = dissect_nfsdata(tvb, offset, tree, hf_nfs_r_netid);
5610 offset = dissect_nfsdata(tvb, offset, tree, hf_nfs_r_addr);
5617 dissect_nfs_cb_client4(tvbuff_t *tvb, int offset, proto_tree *tree)
5619 proto_tree *cb_location = NULL;
5620 proto_item *fitem = NULL;
5622 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_cb_program, offset);
5624 fitem = proto_tree_add_text(tree, tvb, offset, 0, "cb_location");
5628 cb_location = proto_item_add_subtree(fitem, ett_nfs_clientaddr4);
5630 offset = dissect_nfs_clientaddr4(tvb, offset, cb_location);
5636 static const value_string names_stable_how4[] = {
5638 { UNSTABLE4, "UNSTABLE4" },
5639 #define DATA_SYNC4 1
5640 { DATA_SYNC4, "DATA_SYNC4" },
5641 #define FILE_SYNC4 2
5642 { FILE_SYNC4, "FILE_SYNC4" },
5647 dissect_nfs_stable_how4(tvbuff_t *tvb, int offset,
5648 proto_tree *tree, char *name)
5652 stable_how4 = tvb_get_ntohl(tvb, offset);
5653 proto_tree_add_uint_format(tree, hf_nfs_stable_how4, tvb,
5654 offset+0, 4, stable_how4, "%s: %s (%u)", name,
5655 val_to_str(stable_how4, names_stable_how4, "%u"), stable_how4);
5661 static const value_string names_nfsv4_operation[] = {
5662 { NFS4_OP_ACCESS, "ACCESS" },
5663 { NFS4_OP_CLOSE, "CLOSE" },
5664 { NFS4_OP_COMMIT, "COMMIT" },
5665 { NFS4_OP_CREATE, "CREATE" },
5666 { NFS4_OP_DELEGPURGE, "DELEGPURGE" },
5667 { NFS4_OP_DELEGRETURN, "DELEGRETURN" },
5668 { NFS4_OP_GETATTR, "GETATTR" },
5669 { NFS4_OP_GETFH, "GETFH" },
5670 { NFS4_OP_LINK, "LINK" },
5671 { NFS4_OP_LOCK, "LOCK" },
5672 { NFS4_OP_LOCKT, "LOCKT" },
5673 { NFS4_OP_LOCKU, "LOCKU" },
5674 { NFS4_OP_LOOKUP, "LOOKUP" },
5675 { NFS4_OP_LOOKUPP, "LOOKUPP" },
5676 { NFS4_OP_NVERIFY, "NVERIFY" },
5677 { NFS4_OP_OPEN, "OPEN" },
5678 { NFS4_OP_OPENATTR, "OPENATTR" },
5679 { NFS4_OP_OPEN_CONFIRM, "OPEN_CONFIRM" },
5680 { NFS4_OP_OPEN_DOWNGRADE, "OPEN_DOWNGRADE" },
5681 { NFS4_OP_PUTFH, "PUTFH" },
5682 { NFS4_OP_PUTPUBFH, "PUTPUBFH" },
5683 { NFS4_OP_PUTROOTFH, "PUTROOTFH" },
5684 { NFS4_OP_READ, "READ" },
5685 { NFS4_OP_READDIR, "READDIR" },
5686 { NFS4_OP_READLINK, "READLINK" },
5687 { NFS4_OP_REMOVE, "REMOVE" },
5688 { NFS4_OP_RENAME, "RENAME" },
5689 { NFS4_OP_RENEW, "RENEW" },
5690 { NFS4_OP_RESTOREFH, "RESTOREFH" },
5691 { NFS4_OP_SAVEFH, "SAVEFH" },
5692 { NFS4_OP_SECINFO, "SECINFO" },
5693 { NFS4_OP_SETATTR, "SETATTR" },
5694 { NFS4_OP_SETCLIENTID, "SETCLIENTID" },
5695 { NFS4_OP_SETCLIENTID_CONFIRM, "SETCLIENTID_CONFIRM" },
5696 { NFS4_OP_VERIFY, "VERIFY" },
5697 { NFS4_OP_WRITE, "WRITE" },
5701 gint *nfsv4_operation_ett[] =
5707 &ett_nfs_delegpurge4 ,
5708 &ett_nfs_delegreturn4 ,
5719 &ett_nfs_openattr4 ,
5720 &ett_nfs_open_confirm4 ,
5721 &ett_nfs_open_downgrade4 ,
5723 &ett_nfs_putpubfh4 ,
5724 &ett_nfs_putrootfh4 ,
5727 &ett_nfs_readlink4 ,
5731 &ett_nfs_restorefh4 ,
5735 &ett_nfs_setclientid4 ,
5736 &ett_nfs_setclientid_confirm4 ,
5742 dissect_nfs_entry4(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
5745 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_cookie4, offset);
5746 offset = dissect_nfs_utf8string(tvb, offset, tree, hf_nfs_component4, NULL);
5747 offset = dissect_nfs_fattr4(tvb, offset, pinfo, tree);
5753 dissect_nfs_dirlist4(tvbuff_t *tvb, int offset, packet_info *pinfo,
5756 proto_tree *newftree = NULL;
5758 newftree = proto_item_add_subtree(tree, ett_nfs_dirlist4);
5759 if (newftree==NULL) return offset;
5761 offset = dissect_rpc_list(tvb, pinfo, tree, offset, dissect_nfs_entry4);
5762 offset = dissect_rpc_bool(tvb, newftree, hf_nfs_dirlist4_eof, offset);
5768 dissect_nfs_change_info4(tvbuff_t *tvb, int offset,
5769 proto_tree *tree, char *name)
5771 proto_tree *newftree = NULL;
5772 proto_tree *fitem = NULL;
5774 fitem = proto_tree_add_text(tree, tvb, offset, 0, "%s", name);
5777 newftree = proto_item_add_subtree(fitem, ett_nfs_change_info4);
5780 offset = dissect_rpc_bool(tvb, newftree,
5781 hf_nfs_change_info4_atomic, offset);
5782 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_changeid4_before,
5784 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_changeid4_after,
5792 static const value_string names_nfs_lock_type4[] =
5795 { READ_LT, "READ_LT" },
5797 { WRITE_LT, "WRITE_LT" },
5799 { READW_LT, "READW_LT" },
5801 { WRITEW_LT, "WRITEW_LT" },
5802 #define RELEASE_STATE 5
5803 { RELEASE_STATE, "RELEASE_STATE" },
5808 dissect_nfs_lock4denied(tvbuff_t *tvb, int offset, proto_tree *tree)
5810 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_offset4, offset);
5811 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_length4, offset);
5812 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_lock_type4, offset);
5813 offset = dissect_nfs_lock_owner4(tvb, offset, tree);
5819 static const value_string names_open4_result_flags[] = {
5820 #define OPEN4_RESULT_MLOCK 0x00000001
5821 { OPEN4_RESULT_MLOCK, "OPEN4_RESULT_MLOCK" },
5822 #define OPEN4_RESULT_CONFIRM 0x00000002
5823 { OPEN4_RESULT_CONFIRM, "OPEN4_RESULT_CONFIRM" },
5828 dissect_nfs_open4_rflags(tvbuff_t *tvb, int offset,
5829 proto_tree *tree, char *name)
5832 proto_item *rflags_item = NULL;
5833 proto_item *rflags_tree = NULL;
5835 rflags = tvb_get_ntohl(tvb, offset);
5839 rflags_item = proto_tree_add_text(tree, tvb, offset, 4,
5840 "%s: 0x%08x", name, rflags);
5844 rflags_tree = proto_item_add_subtree(rflags_item,
5845 ett_nfs_open4_result_flags);
5849 proto_tree_add_text(rflags_tree, tvb, offset, 4, "%s",
5850 decode_enumerated_bitfield(rflags, OPEN4_RESULT_MLOCK, 2,
5851 names_open4_result_flags, "%s"));
5853 proto_tree_add_text(rflags_tree, tvb, offset, 4, "%s",
5854 decode_enumerated_bitfield(rflags, OPEN4_RESULT_CONFIRM, 2,
5855 names_open4_result_flags, "%s"));
5866 dissect_nfs_stateid4(tvbuff_t *tvb, int offset,
5869 proto_item *fitem = NULL;
5870 proto_tree *newftree = NULL;
5873 gboolean first_line;
5875 fitem = proto_tree_add_text(tree, tvb, offset, 4, "stateid");
5878 newftree = proto_item_add_subtree(fitem, ett_nfs_stateid4);
5880 offset = dissect_rpc_uint32(tvb, newftree, hf_nfs_seqid4,
5886 while (bytes_left != 0)
5889 if (sublen > bytes_left)
5890 sublen = bytes_left;
5892 proto_tree_add_text(newftree, tvb, offset, sublen, "%s%s",
5893 first_line ? "other: " : " ",
5894 tvb_bytes_to_str(tvb, offset, sublen));
5896 bytes_left -= sublen;
5907 dissect_nfs_open_read_delegation4(tvbuff_t *tvb, int offset,
5908 packet_info *pinfo, proto_tree *tree)
5910 offset = dissect_nfs_stateid4(tvb, offset, tree);
5911 offset = dissect_rpc_bool(tvb, tree, hf_nfs_recall4, offset);
5912 offset = dissect_nfs_ace4(tvb, offset, pinfo, tree);
5918 dissect_nfs_modified_limit4(tvbuff_t *tvb, int offset, proto_tree *tree)
5920 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_num_blocks, offset);
5921 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_bytes_per_block, offset);
5926 #define NFS_LIMIT_SIZE 1
5927 #define NFS_LIMIT_BLOCKS 2
5928 static const value_string names_limit_by4[] = {
5929 { NFS_LIMIT_SIZE, "NFS_LIMIT_SIZE" },
5930 { NFS_LIMIT_BLOCKS, "NFS_LIMIT_BLOCKS" },
5935 dissect_nfs_space_limit4(tvbuff_t *tvb, int offset,
5940 limitby = tvb_get_ntohl(tvb, offset);
5941 proto_tree_add_uint(tree, hf_nfs_limit_by4, tvb, offset+0, 4, limitby);
5946 case NFS_LIMIT_SIZE:
5947 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_filesize,
5951 case NFS_LIMIT_BLOCKS:
5952 offset = dissect_nfs_modified_limit4(tvb, offset, tree);
5963 dissect_nfs_open_write_delegation4(tvbuff_t *tvb, int offset,
5964 packet_info *pinfo, proto_tree *tree)
5966 offset = dissect_nfs_stateid4(tvb, offset, tree);
5967 offset = dissect_rpc_bool(tvb, tree, hf_nfs_recall, offset);
5968 offset = dissect_nfs_space_limit4(tvb, offset, tree);
5969 offset = dissect_nfs_ace4(tvb, offset, pinfo, tree);
5974 #define OPEN_DELEGATE_NONE 0
5975 #define OPEN_DELEGATE_READ 1
5976 #define OPEN_DELEGATE_WRITE 2
5977 static const value_string names_open_delegation_type4[] = {
5978 { OPEN_DELEGATE_NONE, "OPEN_DELEGATE_NONE" },
5979 { OPEN_DELEGATE_READ, "OPEN_DELEGATE_READ" },
5980 { OPEN_DELEGATE_WRITE, "OPEN_DELEGATE_WRITE" },
5985 dissect_nfs_open_delegation4(tvbuff_t *tvb, int offset, packet_info *pinfo,
5988 guint delegation_type;
5989 proto_tree *newftree = NULL;
5990 proto_item *fitem = NULL;
5992 delegation_type = tvb_get_ntohl(tvb, offset);
5993 proto_tree_add_uint(tree, hf_nfs_open_delegation_type4, tvb, offset+0,
5994 4, delegation_type);
5998 newftree = proto_item_add_subtree(fitem, ett_nfs_open_delegation4);
6000 switch(delegation_type)
6002 case OPEN_DELEGATE_NONE:
6005 case OPEN_DELEGATE_READ:
6006 offset = dissect_nfs_open_read_delegation4(tvb, offset, pinfo,
6010 case OPEN_DELEGATE_WRITE:
6011 offset = dissect_nfs_open_write_delegation4(tvb, offset, pinfo,
6024 dissect_nfs_rpcsec_gss_info(tvbuff_t *tvb, int offset, proto_tree *tree)
6026 offset = dissect_nfsdata(tvb, offset, tree, hf_nfs_sec_oid4);
6027 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_qop4, offset);
6028 offset = dissect_rpc_uint32(tvb, tree,
6029 hf_nfs_secinfo_rpcsec_gss_info_service, offset);
6035 dissect_nfs_open_to_lock_owner4(tvbuff_t *tvb, int offset, proto_tree *tree)
6037 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_seqid4, offset);
6038 offset = dissect_nfs_stateid4(tvb, offset, tree);
6039 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_lock_seqid4, offset);
6040 offset = dissect_nfs_lock_owner4(tvb, offset, tree);
6046 dissect_nfs_exist_lock_owner4(tvbuff_t *tvb, int offset, proto_tree *tree)
6048 offset = dissect_nfs_stateid4(tvb, offset, tree);
6049 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_lock_seqid4, offset);
6055 dissect_nfs_locker4(tvbuff_t *tvb, int offset, proto_tree *tree)
6057 guint new_lock_owner;
6059 new_lock_owner = tvb_get_ntohl(tvb, offset);
6060 offset = dissect_rpc_bool(tvb, tree, hf_nfs_new_lock_owner, offset);
6063 offset = dissect_nfs_open_to_lock_owner4(tvb, offset, tree);
6065 offset = dissect_nfs_exist_lock_owner4(tvb, offset, tree);
6071 dissect_nfs_client_id4(tvbuff_t *tvb, int offset, proto_tree *tree)
6073 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_verifier4, offset);
6074 offset = dissect_rpc_data(tvb, tree, hf_nfs_client_id4_id, offset);
6080 dissect_nfs_argop4(tvbuff_t *tvb, int offset, packet_info *pinfo,
6083 guint32 ops, ops_counter;
6086 proto_tree *ftree = NULL;
6087 proto_tree *newftree = NULL;
6089 ops = tvb_get_ntohl(tvb, offset+0);
6091 fitem = proto_tree_add_text(tree, tvb, offset, 4,
6092 "Operations (count: %u)", ops);
6095 if (fitem == NULL) return offset;
6097 ftree = proto_item_add_subtree(fitem, ett_nfs_argop4);
6099 if (ftree == NULL) return offset;
6101 for (ops_counter=0; ops_counter<ops; ops_counter++)
6103 opcode = tvb_get_ntohl(tvb, offset);
6105 fitem = proto_tree_add_uint(ftree, hf_nfs_argop4, tvb, offset, 4,
6109 if (opcode < NFS4_OP_ACCESS || opcode > NFS4_OP_WRITE)
6112 if (fitem == NULL) break;
6114 newftree = proto_item_add_subtree(fitem, *nfsv4_operation_ett[opcode-3]);
6115 if (newftree == NULL) break;
6119 case NFS4_OP_ACCESS:
6120 offset = dissect_access(tvb, offset, newftree, "access");
6124 offset = dissect_rpc_uint32(tvb, newftree, hf_nfs_seqid4,
6126 offset = dissect_nfs_stateid4(tvb, offset, newftree);
6129 case NFS4_OP_COMMIT:
6130 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_offset4,
6132 offset = dissect_rpc_uint32(tvb, newftree, hf_nfs_count4,
6136 case NFS4_OP_CREATE:
6140 create_type = tvb_get_ntohl(tvb, offset);
6141 offset = dissect_rpc_uint32(tvb, newftree, hf_nfs_ftype4,
6147 offset = dissect_nfs_utf8string(tvb, offset, newftree,
6148 hf_nfs_linktext4, NULL);
6153 offset = dissect_nfs_specdata4(tvb, offset, newftree);
6165 offset = dissect_nfs_utf8string(tvb, offset, newftree, hf_nfs_component4, NULL);
6167 offset = dissect_nfs_fattr4(tvb, offset, pinfo, newftree);
6171 case NFS4_OP_DELEGPURGE:
6172 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_clientid4, offset);
6175 case NFS4_OP_DELEGRETURN:
6176 offset = dissect_nfs_stateid4(tvb, offset, newftree);
6179 case NFS4_OP_GETATTR:
6180 offset = dissect_nfs_attributes(tvb, offset, pinfo, newftree,
6181 FATTR4_BITMAP_ONLY);
6188 offset = dissect_nfs_utf8string(tvb, offset, newftree,
6189 hf_nfs_component4, NULL);
6193 offset = dissect_rpc_uint32(tvb, newftree, hf_nfs_lock_type4, offset);
6194 offset = dissect_rpc_bool(tvb, newftree, hf_nfs_lock4_reclaim, offset);
6195 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_offset4, offset);
6196 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_length4, offset);
6197 offset = dissect_nfs_locker4(tvb, offset, newftree);
6201 offset = dissect_rpc_uint32(tvb, newftree, hf_nfs_lock_type4, offset);
6202 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_offset4, offset);
6203 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_length4, offset);
6204 offset = dissect_nfs_lock_owner4(tvb, offset, newftree);
6208 offset = dissect_rpc_uint32(tvb, newftree, hf_nfs_lock_type4, offset);
6209 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_seqid4, offset);
6210 offset = dissect_nfs_stateid4(tvb, offset, newftree);
6211 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_offset4, offset);
6212 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_length4, offset);
6215 case NFS4_OP_LOOKUP:
6216 offset = dissect_nfs_utf8string(tvb, offset, newftree,
6217 hf_nfs_component4, NULL);
6220 case NFS4_OP_LOOKUPP:
6223 case NFS4_OP_NVERIFY:
6224 offset = dissect_nfs_fattr4(tvb, offset, pinfo, newftree);
6228 offset = dissect_rpc_uint32(tvb, newftree, hf_nfs_seqid4,
6230 offset = dissect_nfs_open4_share_access(tvb, offset, newftree);
6231 offset = dissect_nfs_open4_share_deny(tvb, offset, newftree);
6232 offset = dissect_nfs_open_owner4(tvb, offset, newftree);
6233 offset = dissect_nfs_openflag4(tvb, offset, pinfo, newftree);
6234 offset = dissect_nfs_open_claim4(tvb, offset, newftree);
6237 case NFS4_OP_OPENATTR:
6238 offset = dissect_rpc_bool(tvb, newftree, hf_nfs_attrdircreate,
6242 case NFS4_OP_OPEN_CONFIRM:
6243 offset = dissect_nfs_stateid4(tvb, offset, newftree);
6244 offset = dissect_rpc_uint32(tvb, newftree, hf_nfs_seqid4,
6248 case NFS4_OP_OPEN_DOWNGRADE:
6249 offset = dissect_nfs_stateid4(tvb, offset, newftree);
6250 offset = dissect_rpc_uint32(tvb, newftree, hf_nfs_seqid4,
6252 offset = dissect_nfs_open4_share_access(tvb, offset, newftree);
6253 offset = dissect_nfs_open4_share_deny(tvb, offset, newftree);
6257 offset = dissect_nfs_fh4(tvb, offset, pinfo, newftree, "filehandle");
6260 case NFS4_OP_PUTPUBFH:
6261 case NFS4_OP_PUTROOTFH:
6265 offset = dissect_nfs_stateid4(tvb, offset, newftree);
6266 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_offset4,
6268 offset = dissect_rpc_uint32(tvb, newftree, hf_nfs_count4,
6272 case NFS4_OP_READDIR:
6273 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_cookie4,
6275 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_cookieverf4,
6277 offset = dissect_rpc_uint32(tvb, newftree,
6278 hf_nfs_count4_dircount, offset);
6279 offset = dissect_rpc_uint32(tvb, newftree,
6280 hf_nfs_count4_maxcount, offset);
6281 offset = dissect_nfs_attributes(tvb, offset, pinfo, newftree,
6282 FATTR4_BITMAP_ONLY);
6285 case NFS4_OP_READLINK:
6288 case NFS4_OP_REMOVE:
6289 offset = dissect_nfs_utf8string(tvb, offset, newftree,
6290 hf_nfs_component4, NULL);
6293 case NFS4_OP_RENAME:
6294 offset = dissect_nfs_utf8string(tvb, offset, newftree,
6295 hf_nfs_component4, NULL);
6296 offset = dissect_nfs_utf8string(tvb, offset, newftree,
6297 hf_nfs_component4, NULL);
6301 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_clientid4, offset);
6304 case NFS4_OP_RESTOREFH:
6305 case NFS4_OP_SAVEFH:
6308 case NFS4_OP_SECINFO:
6309 offset = dissect_nfs_utf8string(tvb, offset, newftree,
6310 hf_nfs_component4, NULL);
6313 case NFS4_OP_SETATTR:
6314 offset = dissect_nfs_stateid4(tvb, offset, newftree);
6315 offset = dissect_nfs_fattr4(tvb, offset, pinfo, newftree);
6318 case NFS4_OP_SETCLIENTID:
6320 proto_tree *client_tree = NULL;
6321 proto_tree *callback_tree = NULL;
6323 fitem = proto_tree_add_text(newftree, tvb, offset, 0, "client");
6326 client_tree = proto_item_add_subtree(fitem, ett_nfs_client_id4);
6329 offset = dissect_nfs_client_id4(tvb, offset, client_tree);
6332 fitem = proto_tree_add_text(newftree, tvb, offset, 0, "callback");
6335 callback_tree = proto_item_add_subtree(fitem,
6336 ett_nfs_cb_client4);
6339 offset = dissect_nfs_cb_client4(tvb, offset, callback_tree);
6342 offset = dissect_rpc_uint32(tvb, newftree, hf_nfs_callback_ident,
6347 case NFS4_OP_SETCLIENTID_CONFIRM:
6348 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_clientid4, offset);
6349 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_verifier4, offset);
6352 case NFS4_OP_VERIFY:
6353 offset = dissect_nfs_fattr4(tvb, offset, pinfo, newftree);
6357 offset = dissect_nfs_stateid4(tvb, offset, newftree);
6358 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_offset4, offset);
6359 offset = dissect_nfs_stable_how4(tvb, offset, newftree, "stable");
6360 offset = dissect_nfsdata(tvb, offset, newftree, hf_nfs_data);
6372 dissect_nfs4_compound_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
6375 offset = dissect_nfs_utf8string(tvb, offset, tree, hf_nfs_tag4, NULL);
6376 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_minorversion, offset);
6377 offset = dissect_nfs_argop4(tvb, offset, pinfo, tree);
6383 dissect_nfs_secinfo4_res(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
6388 proto_tree *secftree;
6390 flavor = tvb_get_ntohl(tvb, offset);
6391 fitem = proto_tree_add_uint(tree, hf_nfs_secinfo_flavor, tvb, offset, 4,
6400 secftree = proto_item_add_subtree(fitem, ett_nfs_secinfo4_flavor_info);
6402 offset = dissect_nfs_rpcsec_gss_info(tvb, offset, secftree);
6414 dissect_nfs_resop4(tvbuff_t *tvb, int offset, packet_info *pinfo,
6417 guint32 ops, ops_counter;
6420 proto_tree *ftree = NULL;
6421 proto_tree *newftree = NULL;
6424 ops = tvb_get_ntohl(tvb, offset+0);
6426 fitem = proto_tree_add_text(tree, tvb, offset, 4,
6427 "Operations (count: %u)", ops);
6430 if (fitem == NULL) return offset;
6432 ftree = proto_item_add_subtree(fitem, ett_nfs_resop4);
6434 if (ftree == NULL) return offset; /* error adding new subtree */
6436 for (ops_counter = 0; ops_counter < ops; ops_counter++)
6438 opcode = tvb_get_ntohl(tvb, offset);
6440 /* sanity check for bogus packets */
6441 if (opcode < NFS4_OP_ACCESS || opcode > NFS4_OP_WRITE) break;
6443 fitem = proto_tree_add_uint(ftree, hf_nfs_resop4, tvb, offset, 4,
6447 if (fitem == NULL) break; /* error adding new item to tree */
6449 newftree = proto_item_add_subtree(fitem, *nfsv4_operation_ett[opcode-3]);
6451 if (newftree == NULL)
6452 break; /* error adding new subtree to operation item */
6454 offset = dissect_nfs_nfsstat4(tvb, offset, newftree, &status);
6457 * With the exception of NFS4_OP_LOCK, NFS4_OP_LOCKT, and
6458 * NFS4_OP_SETATTR, all other ops do *not* return data with the
6459 * failed status code.
6461 if ((status != NFS4_OK) &&
6462 ((opcode != NFS4_OP_LOCK) && (opcode != NFS4_OP_LOCKT) &&
6463 (opcode != NFS4_OP_SETATTR)))
6466 /* These parsing routines are only executed if the status is NFS4_OK */
6469 case NFS4_OP_ACCESS:
6470 offset = dissect_access(tvb, offset, newftree, "Supported");
6471 offset = dissect_access(tvb, offset, newftree, "Access");
6475 offset = dissect_nfs_stateid4(tvb, offset, newftree);
6478 case NFS4_OP_COMMIT:
6479 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_verifier4,
6483 case NFS4_OP_CREATE:
6484 offset = dissect_nfs_change_info4(tvb, offset, newftree,
6486 offset = dissect_nfs_attributes(tvb, offset, pinfo, newftree,
6487 FATTR4_BITMAP_ONLY);
6490 case NFS4_OP_GETATTR:
6491 offset = dissect_nfs_fattr4(tvb, offset, pinfo, newftree);
6495 offset = dissect_nfs_fh4(tvb, offset, pinfo, newftree, "Filehandle");
6499 offset = dissect_nfs_change_info4(tvb, offset, newftree,
6505 if (status == NFS4_OK)
6507 if (opcode == NFS4_OP_LOCK)
6508 offset = dissect_nfs_stateid4(tvb, offset, newftree);
6511 if (status == NFS4ERR_DENIED)
6512 offset = dissect_nfs_lock4denied(tvb, offset, newftree);
6516 offset = dissect_nfs_stateid4(tvb, offset, newftree);
6520 offset = dissect_nfs_stateid4(tvb, offset, newftree);
6521 offset = dissect_nfs_change_info4(tvb, offset, newftree,
6523 offset = dissect_nfs_open4_rflags(tvb, offset, newftree,
6525 offset = dissect_nfs_attributes(tvb, offset, pinfo, newftree,
6526 FATTR4_BITMAP_ONLY);
6527 offset = dissect_nfs_open_delegation4(tvb, offset, pinfo, newftree);
6530 case NFS4_OP_OPEN_CONFIRM:
6531 case NFS4_OP_OPEN_DOWNGRADE:
6532 offset = dissect_nfs_stateid4(tvb, offset, newftree);
6536 offset = dissect_rpc_uint32(tvb, newftree, hf_nfs_eof, offset);
6537 offset = dissect_nfsdata(tvb, offset, newftree, hf_nfs_data);
6540 case NFS4_OP_READDIR:
6541 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_verifier4, offset);
6542 offset = dissect_nfs_dirlist4(tvb, offset, pinfo, newftree);
6545 case NFS4_OP_READLINK:
6546 offset = dissect_nfs_utf8string(tvb, offset, newftree,
6547 hf_nfs_linktext4, NULL);
6550 case NFS4_OP_REMOVE:
6551 offset = dissect_nfs_change_info4(tvb, offset, newftree,
6555 case NFS4_OP_RENAME:
6556 offset = dissect_nfs_change_info4(tvb, offset, newftree,
6558 offset = dissect_nfs_change_info4(tvb, offset, newftree,
6562 case NFS4_OP_SECINFO:
6563 offset = dissect_rpc_list(tvb, pinfo, tree, offset,
6564 dissect_nfs_secinfo4_res);
6567 case NFS4_OP_SETATTR:
6568 offset = dissect_nfs_attributes(tvb, offset, pinfo, newftree,
6569 FATTR4_BITMAP_ONLY);
6572 case NFS4_OP_SETCLIENTID:
6573 if (status == NFS4_OK)
6575 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_clientid4,
6577 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_verifier4,
6581 if (status == NFS4ERR_CLID_INUSE)
6582 offset = dissect_nfs_clientaddr4(tvb, offset, newftree);
6586 offset = dissect_rpc_uint32(tvb, newftree, hf_nfs_count4,
6588 offset = dissect_nfs_stable_how4(tvb, offset, newftree,
6590 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_verifier4,
6603 dissect_nfs4_compound_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
6608 offset = dissect_nfs_nfsstat4(tvb, offset, tree, &status);
6609 offset = dissect_nfs_utf8string(tvb, offset, tree, hf_nfs_tag4, NULL);
6610 offset = dissect_nfs_resop4(tvb, offset, pinfo, tree);
6616 /* proc number, "proc name", dissect_request, dissect_reply */
6617 /* NULL as function pointer means: type of arguments is "void". */
6618 static const vsff nfs3_proc[] = {
6619 { 0, "NULL", /* OK */
6621 { 1, "GETATTR", /* OK */
6622 dissect_nfs3_getattr_call, dissect_nfs3_getattr_reply },
6623 { 2, "SETATTR", /* OK */
6624 dissect_nfs3_setattr_call, dissect_nfs3_setattr_reply },
6625 { 3, "LOOKUP", /* OK */
6626 dissect_nfs3_lookup_call, dissect_nfs3_lookup_reply },
6627 { 4, "ACCESS", /* OK */
6628 dissect_nfs3_access_call, dissect_nfs3_access_reply },
6629 { 5, "READLINK", /* OK */
6630 dissect_nfs3_nfs_fh3_call, dissect_nfs3_readlink_reply },
6631 { 6, "READ", /* OK */
6632 dissect_nfs3_read_call, dissect_nfs3_read_reply },
6633 { 7, "WRITE", /* OK */
6634 dissect_nfs3_write_call, dissect_nfs3_write_reply },
6635 { 8, "CREATE", /* OK */
6636 dissect_nfs3_create_call, dissect_nfs3_create_reply },
6637 { 9, "MKDIR", /* OK */
6638 dissect_nfs3_mkdir_call, dissect_nfs3_create_reply },
6639 { 10, "SYMLINK", /* OK */
6640 dissect_nfs3_symlink_call, dissect_nfs3_create_reply },
6641 { 11, "MKNOD", /* OK */
6642 dissect_nfs3_mknod_call, dissect_nfs3_create_reply },
6643 { 12, "REMOVE", /* OK */
6644 dissect_nfs3_diropargs3_call, dissect_nfs3_remove_reply },
6645 { 13, "RMDIR", /* OK */
6646 dissect_nfs3_diropargs3_call, dissect_nfs3_remove_reply },
6647 { 14, "RENAME", /* OK */
6648 dissect_nfs3_rename_call, dissect_nfs3_rename_reply },
6649 { 15, "LINK", /* OK */
6650 dissect_nfs3_link_call, dissect_nfs3_link_reply },
6651 { 16, "READDIR", /* OK */
6652 dissect_nfs3_readdir_call, dissect_nfs3_readdir_reply },
6653 { 17, "READDIRPLUS", /* OK */
6654 dissect_nfs3_readdirplus_call, dissect_nfs3_readdirplus_reply },
6655 { 18, "FSSTAT", /* OK */
6656 dissect_nfs3_nfs_fh3_call, dissect_nfs3_fsstat_reply },
6657 { 19, "FSINFO", /* OK */
6658 dissect_nfs3_nfs_fh3_call, dissect_nfs3_fsinfo_reply },
6659 { 20, "PATHCONF", /* OK */
6660 dissect_nfs3_nfs_fh3_call, dissect_nfs3_pathconf_reply },
6661 { 21, "COMMIT", /* OK */
6662 dissect_nfs3_commit_call, dissect_nfs3_commit_reply },
6663 { 0,NULL,NULL,NULL }
6666 static const value_string nfsv3_proc_vals[] = {
6684 { 17, "READDIRPLUS" },
6692 /* end of NFS Version 3 */
6694 static const vsff nfs4_proc[] = {
6698 dissect_nfs4_compound_call, dissect_nfs4_compound_reply },
6699 { 0, NULL, NULL, NULL }
6702 static const value_string nfsv4_proc_vals[] = {
6708 static struct true_false_string yesno = { "Yes", "No" };
6712 proto_register_nfs(void)
6714 static hf_register_info hf[] = {
6715 { &hf_nfs_procedure_v2, {
6716 "V2 Procedure", "nfs.procedure_v2", FT_UINT32, BASE_DEC,
6717 VALS(nfsv2_proc_vals), 0, "V2 Procedure", HFILL }},
6718 { &hf_nfs_procedure_v3, {
6719 "V3 Procedure", "nfs.procedure_v3", FT_UINT32, BASE_DEC,
6720 VALS(nfsv3_proc_vals), 0, "V3 Procedure", HFILL }},
6721 { &hf_nfs_procedure_v4, {
6722 "V4 Procedure", "nfs.procedure_v4", FT_UINT32, BASE_DEC,
6723 VALS(nfsv4_proc_vals), 0, "V4 Procedure", HFILL }},
6724 { &hf_nfs_fh_length, {
6725 "length", "nfs.fh.length", FT_UINT32, BASE_DEC,
6726 NULL, 0, "file handle length", HFILL }},
6727 { &hf_nfs_fh_hash, {
6728 "hash", "nfs.fh.hash", FT_UINT32, BASE_HEX,
6729 NULL, 0, "file handle hash", HFILL }},
6730 { &hf_nfs_fh_fsid_major, {
6731 "major", "nfs.fh.fsid.major", FT_UINT32, BASE_DEC,
6732 NULL, 0, "major file system ID", HFILL }},
6733 { &hf_nfs_fh_fsid_minor, {
6734 "minor", "nfs.fh.fsid.minor", FT_UINT32, BASE_DEC,
6735 NULL, 0, "minor file system ID", HFILL }},
6736 { &hf_nfs_fh_fsid_inode, {
6737 "inode", "nfs.fh.fsid.inode", FT_UINT32, BASE_DEC,
6738 NULL, 0, "file system inode", HFILL }},
6739 { &hf_nfs_fh_xfsid_major, {
6740 "exported major", "nfs.fh.xfsid.major", FT_UINT32, BASE_DEC,
6741 NULL, 0, "exported major file system ID", HFILL }},
6742 { &hf_nfs_fh_xfsid_minor, {
6743 "exported minor", "nfs.fh.xfsid.minor", FT_UINT32, BASE_DEC,
6744 NULL, 0, "exported minor file system ID", HFILL }},
6745 { &hf_nfs_fh_fstype, {
6746 "file system type", "nfs.fh.fstype", FT_UINT32, BASE_DEC,
6747 NULL, 0, "file system type", HFILL }},
6749 "file number", "nfs.fh.fn", FT_UINT32, BASE_DEC,
6750 NULL, 0, "file number", HFILL }},
6751 { &hf_nfs_fh_fn_len, {
6752 "length", "nfs.fh.fn.len", FT_UINT32, BASE_DEC,
6753 NULL, 0, "file number length", HFILL }},
6754 { &hf_nfs_fh_fn_inode, {
6755 "inode", "nfs.fh.fn.inode", FT_UINT32, BASE_DEC,
6756 NULL, 0, "file number inode", HFILL }},
6757 { &hf_nfs_fh_fn_generation, {
6758 "generation", "nfs.fh.fn.generation", FT_UINT32, BASE_DEC,
6759 NULL, 0, "file number generation", HFILL }},
6761 "exported file number", "nfs.fh.xfn", FT_UINT32, BASE_DEC,
6762 NULL, 0, "exported file number", HFILL }},
6763 { &hf_nfs_fh_xfn_len, {
6764 "length", "nfs.fh.xfn.len", FT_UINT32, BASE_DEC,
6765 NULL, 0, "exported file number length", HFILL }},
6766 { &hf_nfs_fh_xfn_inode, {
6767 "exported inode", "nfs.fh.xfn.inode", FT_UINT32, BASE_DEC,
6768 NULL, 0, "exported file number inode", HFILL }},
6769 { &hf_nfs_fh_xfn_generation, {
6770 "generation", "nfs.fh.xfn.generation", FT_UINT32, BASE_DEC,
6771 NULL, 0, "exported file number generation", HFILL }},
6772 { &hf_nfs_fh_dentry, {
6773 "dentry", "nfs.fh.dentry", FT_UINT32, BASE_HEX,
6774 NULL, 0, "dentry (cookie)", HFILL }},
6776 "device", "nfs.fh.dev", FT_UINT32, BASE_DEC,
6777 NULL, 0, "device", HFILL }},
6778 { &hf_nfs_fh_xdev, {
6779 "exported device", "nfs.fh.xdev", FT_UINT32, BASE_DEC,
6780 NULL, 0, "exported device", HFILL }},
6781 { &hf_nfs_fh_dirinode, {
6782 "directory inode", "nfs.fh.dirinode", FT_UINT32, BASE_DEC,
6783 NULL, 0, "directory inode", HFILL }},
6784 { &hf_nfs_fh_pinode, {
6785 "pseudo inode", "nfs.fh.pinode", FT_UINT32, BASE_HEX,
6786 NULL, 0, "pseudo inode", HFILL }},
6787 { &hf_nfs_fh_hp_len, {
6788 "length", "nfs.fh.hp.len", FT_UINT32, BASE_DEC,
6789 NULL, 0, "hash path length", HFILL }},
6790 { &hf_nfs_fh_version, {
6791 "version", "nfs.fh.version", FT_UINT8, BASE_DEC,
6792 NULL, 0, "file handle layout version", HFILL }},
6793 { &hf_nfs_fh_auth_type, {
6794 "auth_type", "nfs.fh.auth_type", FT_UINT8, BASE_DEC,
6795 VALS(auth_type_names), 0, "authentication type", HFILL }},
6796 { &hf_nfs_fh_fsid_type, {
6797 "fsid_type", "nfs.fh.fsid_type", FT_UINT8, BASE_DEC,
6798 VALS(fsid_type_names), 0, "file system ID type", HFILL }},
6799 { &hf_nfs_fh_fileid_type, {
6800 "fileid_type", "nfs.fh.fileid_type", FT_UINT8, BASE_DEC,
6801 VALS(fileid_type_names), 0, "file ID type", HFILL }},
6803 "Status", "nfs.status2", FT_UINT32, BASE_DEC,
6804 VALS(names_nfs_stat), 0, "Reply status", HFILL }},
6805 { &hf_nfs_full_name, {
6806 "Full Name", "nfs.full_name", FT_STRING, BASE_DEC,
6807 NULL, 0, "Full Name", HFILL }},
6809 "Name", "nfs.name", FT_STRING, BASE_DEC,
6810 NULL, 0, "Name", HFILL }},
6811 { &hf_nfs_readlink_data, {
6812 "Data", "nfs.readlink.data", FT_STRING, BASE_DEC,
6813 NULL, 0, "Symbolic Link Data", HFILL }},
6814 { &hf_nfs_read_offset, {
6815 "Offset", "nfs.read.offset", FT_UINT32, BASE_DEC,
6816 NULL, 0, "Read Offset", HFILL }},
6817 { &hf_nfs_read_count, {
6818 "Count", "nfs.read.count", FT_UINT32, BASE_DEC,
6819 NULL, 0, "Read Count", HFILL }},
6820 { &hf_nfs_read_totalcount, {
6821 "Total Count", "nfs.read.totalcount", FT_UINT32, BASE_DEC,
6822 NULL, 0, "Total Count (obsolete)", HFILL }},
6824 "Data", "nfs.data", FT_BYTES, BASE_DEC,
6825 NULL, 0, "Data", HFILL }},
6826 { &hf_nfs_write_beginoffset, {
6827 "Begin Offset", "nfs.write.beginoffset", FT_UINT32, BASE_DEC,
6828 NULL, 0, "Begin offset (obsolete)", HFILL }},
6829 { &hf_nfs_write_offset, {
6830 "Offset", "nfs.write.offset", FT_UINT32, BASE_DEC,
6831 NULL, 0, "Offset", HFILL }},
6832 { &hf_nfs_write_totalcount, {
6833 "Total Count", "nfs.write.totalcount", FT_UINT32, BASE_DEC,
6834 NULL, 0, "Total Count (obsolete)", HFILL }},
6835 { &hf_nfs_symlink_to, {
6836 "To", "nfs.symlink.to", FT_STRING, BASE_DEC,
6837 NULL, 0, "Symbolic link destination name", HFILL }},
6838 { &hf_nfs_readdir_cookie, {
6839 "Cookie", "nfs.readdir.cookie", FT_UINT32, BASE_DEC,
6840 NULL, 0, "Directory Cookie", HFILL }},
6841 { &hf_nfs_readdir_count, {
6842 "Count", "nfs.readdir.count", FT_UINT32, BASE_DEC,
6843 NULL, 0, "Directory Count", HFILL }},
6845 { &hf_nfs_readdir_entry, {
6846 "Entry", "nfs.readdir.entry", FT_NONE, 0,
6847 NULL, 0, "Directory Entry", HFILL }},
6849 { &hf_nfs_readdir_entry_fileid, {
6850 "File ID", "nfs.readdir.entry.fileid", FT_UINT32, BASE_DEC,
6851 NULL, 0, "File ID", HFILL }},
6853 { &hf_nfs_readdir_entry_name, {
6854 "Name", "nfs.readdir.entry.name", FT_STRING, BASE_DEC,
6855 NULL, 0, "Name", HFILL }},
6857 { &hf_nfs_readdir_entry_cookie, {
6858 "Cookie", "nfs.readdir.entry.cookie", FT_UINT32, BASE_DEC,
6859 NULL, 0, "Directory Cookie", HFILL }},
6861 { &hf_nfs_readdir_entry3_fileid, {
6862 "File ID", "nfs.readdir.entry3.fileid", FT_UINT64, BASE_DEC,
6863 NULL, 0, "File ID", HFILL }},
6865 { &hf_nfs_readdir_entry3_name, {
6866 "Name", "nfs.readdir.entry3.name", FT_STRING, BASE_DEC,
6867 NULL, 0, "Name", HFILL }},
6869 { &hf_nfs_readdir_entry3_cookie, {
6870 "Cookie", "nfs.readdir.entry3.cookie", FT_UINT64, BASE_DEC,
6871 NULL, 0, "Directory Cookie", HFILL }},
6873 { &hf_nfs_readdirplus_entry_fileid, {
6874 "File ID", "nfs.readdirplus.entry.fileid", FT_UINT64, BASE_DEC,
6875 NULL, 0, "Name", HFILL }},
6877 { &hf_nfs_readdirplus_entry_name, {
6878 "Name", "nfs.readdirplus.entry.name", FT_STRING, BASE_DEC,
6879 NULL, 0, "Name", HFILL }},
6881 { &hf_nfs_readdirplus_entry_cookie, {
6882 "Cookie", "nfs.readdirplus.entry.cookie", FT_UINT64, BASE_DEC,
6883 NULL, 0, "Directory Cookie", HFILL }},
6885 { &hf_nfs_readdir_eof, {
6886 "EOF", "nfs.readdir.eof", FT_UINT32, BASE_DEC,
6887 NULL, 0, "EOF", HFILL }},
6889 { &hf_nfs_statfs_tsize, {
6890 "Transfer Size", "nfs.statfs.tsize", FT_UINT32, BASE_DEC,
6891 NULL, 0, "Transfer Size", HFILL }},
6892 { &hf_nfs_statfs_bsize, {
6893 "Block Size", "nfs.statfs.bsize", FT_UINT32, BASE_DEC,
6894 NULL, 0, "Block Size", HFILL }},
6895 { &hf_nfs_statfs_blocks, {
6896 "Total Blocks", "nfs.statfs.blocks", FT_UINT32, BASE_DEC,
6897 NULL, 0, "Total Blocks", HFILL }},
6898 { &hf_nfs_statfs_bfree, {
6899 "Free Blocks", "nfs.statfs.bfree", FT_UINT32, BASE_DEC,
6900 NULL, 0, "Free Blocks", HFILL }},
6901 { &hf_nfs_statfs_bavail, {
6902 "Available Blocks", "nfs.statfs.bavail", FT_UINT32, BASE_DEC,
6903 NULL, 0, "Available Blocks", HFILL }},
6905 "Type", "nfs.type", FT_UINT32, BASE_DEC,
6906 VALS(names_nfs_ftype3), 0, "File Type", HFILL }},
6907 { &hf_nfs_nfsstat3, {
6908 "Status", "nfs.status", FT_UINT32, BASE_DEC,
6909 VALS(names_nfs_nfsstat3), 0, "Reply status", HFILL }},
6910 { &hf_nfs_read_eof, {
6911 "EOF", "nfs.read.eof", FT_BOOLEAN, BASE_NONE,
6912 &yesno, 0, "EOF", HFILL }},
6913 { &hf_nfs_write_stable, {
6914 "Stable", "nfs.write.stable", FT_UINT32, BASE_DEC,
6915 VALS(names_stable_how), 0, "Stable", HFILL }},
6916 { &hf_nfs_write_committed, {
6917 "Committed", "nfs.write.committed", FT_UINT32, BASE_DEC,
6918 VALS(names_stable_how), 0, "Committed", HFILL }},
6919 { &hf_nfs_createmode3, {
6920 "Create Mode", "nfs.createmode", FT_UINT32, BASE_DEC,
6921 VALS(names_createmode3), 0, "Create Mode", HFILL }},
6922 { &hf_nfs_fsstat_invarsec, {
6923 "invarsec", "nfs.fsstat.invarsec", FT_UINT32, BASE_DEC,
6924 NULL, 0, "probable number of seconds of file system invariance", HFILL }},
6925 { &hf_nfs_fsinfo_rtmax, {
6926 "rtmax", "nfs.fsinfo.rtmax", FT_UINT32, BASE_DEC,
6927 NULL, 0, "maximum READ request", HFILL }},
6928 { &hf_nfs_fsinfo_rtpref, {
6929 "rtpref", "nfs.fsinfo.rtpref", FT_UINT32, BASE_DEC,
6930 NULL, 0, "Preferred READ request size", HFILL }},
6931 { &hf_nfs_fsinfo_rtmult, {
6932 "rtmult", "nfs.fsinfo.rtmult", FT_UINT32, BASE_DEC,
6933 NULL, 0, "Suggested READ multiple", HFILL }},
6934 { &hf_nfs_fsinfo_wtmax, {
6935 "wtmax", "nfs.fsinfo.wtmax", FT_UINT32, BASE_DEC,
6936 NULL, 0, "Maximum WRITE request size", HFILL }},
6937 { &hf_nfs_fsinfo_wtpref, {
6938 "wtpref", "nfs.fsinfo.wtpref", FT_UINT32, BASE_DEC,
6939 NULL, 0, "Preferred WRITE request size", HFILL }},
6940 { &hf_nfs_fsinfo_wtmult, {
6941 "wtmult", "nfs.fsinfo.wtmult", FT_UINT32, BASE_DEC,
6942 NULL, 0, "Suggested WRITE multiple", HFILL }},
6943 { &hf_nfs_fsinfo_dtpref, {
6944 "dtpref", "nfs.fsinfo.dtpref", FT_UINT32, BASE_DEC,
6945 NULL, 0, "Preferred READDIR request", HFILL }},
6946 { &hf_nfs_fsinfo_maxfilesize, {
6947 "maxfilesize", "nfs.fsinfo.maxfilesize", FT_UINT64, BASE_DEC,
6948 NULL, 0, "Maximum file size", HFILL }},
6949 { &hf_nfs_fsinfo_properties, {
6950 "Properties", "nfs.fsinfo.propeties", FT_UINT32, BASE_HEX,
6951 NULL, 0, "File System Properties", HFILL }},
6952 { &hf_nfs_pathconf_linkmax, {
6953 "linkmax", "nfs.pathconf.linkmax", FT_UINT32, BASE_DEC,
6954 NULL, 0, "Maximum number of hard links", HFILL }},
6955 { &hf_nfs_pathconf_name_max, {
6956 "name_max", "nfs.pathconf.name_max", FT_UINT32, BASE_DEC,
6957 NULL, 0, "Maximum file name length", HFILL }},
6958 { &hf_nfs_pathconf_no_trunc, {
6959 "no_trunc", "nfs.pathconf.no_trunc", FT_BOOLEAN, BASE_NONE,
6960 &yesno, 0, "No long file name truncation", HFILL }},
6961 { &hf_nfs_pathconf_chown_restricted, {
6962 "chown_restricted", "nfs.pathconf.chown_restricted", FT_BOOLEAN,
6963 BASE_NONE, &yesno, 0, "chown is restricted to root", HFILL }},
6964 { &hf_nfs_pathconf_case_insensitive, {
6965 "case_insensitive", "nfs.pathconf.case_insensitive", FT_BOOLEAN,
6966 BASE_NONE, &yesno, 0, "file names are treated case insensitive", HFILL }},
6967 { &hf_nfs_pathconf_case_preserving, {
6968 "case_preserving", "nfs.pathconf.case_preserving", FT_BOOLEAN,
6969 BASE_NONE, &yesno, 0, "file name cases are preserved", HFILL }},
6971 { &hf_nfs_fattr_type, {
6972 "type", "nfs.fattr.type", FT_UINT32, BASE_DEC,
6973 NULL, 0, "nfs.fattr.type", HFILL }},
6975 { &hf_nfs_fattr_nlink, {
6976 "nlink", "nfs.fattr.nlink", FT_UINT32, BASE_DEC,
6977 NULL, 0, "nfs.fattr.nlink", HFILL }},
6979 { &hf_nfs_fattr_uid, {
6980 "uid", "nfs.fattr.uid", FT_UINT32, BASE_DEC,
6981 NULL, 0, "nfs.fattr.uid", HFILL }},
6983 { &hf_nfs_fattr_gid, {
6984 "gid", "nfs.fattr.gid", FT_UINT32, BASE_DEC,
6985 NULL, 0, "nfs.fattr.gid", HFILL }},
6987 { &hf_nfs_fattr_size, {
6988 "size", "nfs.fattr.size", FT_UINT32, BASE_DEC,
6989 NULL, 0, "nfs.fattr.size", HFILL }},
6991 { &hf_nfs_fattr_blocksize, {
6992 "blocksize", "nfs.fattr.blocksize", FT_UINT32, BASE_DEC,
6993 NULL, 0, "nfs.fattr.blocksize", HFILL }},
6995 { &hf_nfs_fattr_rdev, {
6996 "rdev", "nfs.fattr.rdev", FT_UINT32, BASE_DEC,
6997 NULL, 0, "nfs.fattr.rdev", HFILL }},
6999 { &hf_nfs_fattr_blocks, {
7000 "blocks", "nfs.fattr.blocks", FT_UINT32, BASE_DEC,
7001 NULL, 0, "nfs.fattr.blocks", HFILL }},
7003 { &hf_nfs_fattr_fsid, {
7004 "fsid", "nfs.fattr.fsid", FT_UINT32, BASE_DEC,
7005 NULL, 0, "nfs.fattr.fsid", HFILL }},
7007 { &hf_nfs_fattr_fileid, {
7008 "fileid", "nfs.fattr.fileid", FT_UINT32, BASE_DEC,
7009 NULL, 0, "nfs.fattr.fileid", HFILL }},
7011 { &hf_nfs_fattr3_type, {
7012 "Type", "nfs.fattr3.type", FT_UINT32, BASE_DEC,
7013 VALS(names_nfs_ftype3), 0, "nfs.fattr3.type", HFILL }},
7015 { &hf_nfs_fattr3_nlink, {
7016 "nlink", "nfs.fattr3.nlink", FT_UINT32, BASE_DEC,
7017 NULL, 0, "nfs.fattr3.nlink", HFILL }},
7019 { &hf_nfs_fattr3_uid, {
7020 "uid", "nfs.fattr3.uid", FT_UINT32, BASE_DEC,
7021 NULL, 0, "nfs.fattr3.uid", HFILL }},
7023 { &hf_nfs_fattr3_gid, {
7024 "gid", "nfs.fattr3.gid", FT_UINT32, BASE_DEC,
7025 NULL, 0, "nfs.fattr3.gid", HFILL }},
7027 { &hf_nfs_fattr3_size, {
7028 "size", "nfs.fattr3.size", FT_UINT64, BASE_DEC,
7029 NULL, 0, "nfs.fattr3.size", HFILL }},
7031 { &hf_nfs_fattr3_used, {
7032 "used", "nfs.fattr3.used", FT_UINT64, BASE_DEC,
7033 NULL, 0, "nfs.fattr3.used", HFILL }},
7035 { &hf_nfs_fattr3_rdev, {
7036 "rdev", "nfs.fattr3.rdev", FT_UINT32, BASE_DEC,
7037 NULL, 0, "nfs.fattr3.rdev", HFILL }},
7039 { &hf_nfs_fattr3_fsid, {
7040 "fsid", "nfs.fattr3.fsid", FT_UINT64, BASE_DEC,
7041 NULL, 0, "nfs.fattr3.fsid", HFILL }},
7043 { &hf_nfs_fattr3_fileid, {
7044 "fileid", "nfs.fattr3.fileid", FT_UINT64, BASE_DEC,
7045 NULL, 0, "nfs.fattr3.fileid", HFILL }},
7047 { &hf_nfs_wcc_attr_size, {
7048 "size", "nfs.wcc_attr.size", FT_UINT64, BASE_DEC,
7049 NULL, 0, "nfs.wcc_attr.size", HFILL }},
7051 { &hf_nfs_set_size3_size, {
7052 "size", "nfs.set_size3.size", FT_UINT64, BASE_DEC,
7053 NULL, 0, "nfs.set_size3.size", HFILL }},
7056 "uid", "nfs.uid3", FT_UINT32, BASE_DEC,
7057 NULL, 0, "nfs.uid3", HFILL }},
7060 "gid", "nfs.gid3", FT_UINT32, BASE_DEC,
7061 NULL, 0, "nfs.gid3", HFILL }},
7063 { &hf_nfs_cookie3, {
7064 "cookie", "nfs.cookie3", FT_UINT64, BASE_DEC,
7065 NULL, 0, "nfs.cookie3", HFILL }},
7067 { &hf_nfs_offset3, {
7068 "offset", "nfs.offset3", FT_UINT64, BASE_DEC,
7069 NULL, 0, "nfs.offset3", HFILL }},
7072 "count", "nfs.count3", FT_UINT32, BASE_DEC,
7073 NULL, 0, "nfs.count3", HFILL }},
7075 { &hf_nfs_count3_maxcount, {
7076 "maxcount", "nfs.count3_maxcount", FT_UINT32, BASE_DEC,
7077 NULL, 0, "nfs.count3_maxcount", HFILL }},
7079 { &hf_nfs_count3_dircount, {
7080 "dircount", "nfs.count3_dircount", FT_UINT32, BASE_DEC,
7081 NULL, 0, "nfs.count3_dircount", HFILL }},
7083 { &hf_nfs_fsstat3_resok_tbytes, {
7084 "Total bytes", "nfs.fsstat3_resok.tbytes", FT_UINT64, BASE_DEC,
7085 NULL, 0, "Total bytes", HFILL }},
7087 { &hf_nfs_fsstat3_resok_fbytes, {
7088 "Free bytes", "nfs.fsstat3_resok.fbytes", FT_UINT64, BASE_DEC,
7089 NULL, 0, "Free bytes", HFILL }},
7091 { &hf_nfs_fsstat3_resok_abytes, {
7092 "Available free bytes", "nfs.fsstat3_resok.abytes", FT_UINT64, BASE_DEC,
7093 NULL, 0, "Available free bytes", HFILL }},
7095 { &hf_nfs_fsstat3_resok_tfiles, {
7096 "Total file slots", "nfs.fsstat3_resok.tfiles", FT_UINT64, BASE_DEC,
7097 NULL, 0, "Total file slots", HFILL }},
7099 { &hf_nfs_fsstat3_resok_ffiles, {
7100 "Free file slots", "nfs.fsstat3_resok.ffiles", FT_UINT64, BASE_DEC,
7101 NULL, 0, "Free file slots", HFILL }},
7103 { &hf_nfs_fsstat3_resok_afiles, {
7104 "Available free file slots", "nfs.fsstat3_resok.afiles", FT_UINT64, BASE_DEC,
7105 NULL, 0, "Available free file slots", HFILL }},
7110 "Opcode", "nfs.call.operation", FT_UINT32, BASE_DEC,
7111 VALS(names_nfsv4_operation), 0, "Opcode", HFILL }},
7114 "Opcode", "nfs.reply.operation", FT_UINT32, BASE_DEC,
7115 VALS(names_nfsv4_operation), 0, "Opcode", HFILL }},
7117 { &hf_nfs_linktext4, {
7118 "Name", "nfs.symlink.linktext", FT_STRING, BASE_DEC,
7119 NULL, 0, "Symbolic link contents", HFILL }},
7121 { &hf_nfs_component4, {
7122 "Filename", "nfs.pathname.component", FT_STRING, BASE_DEC,
7123 NULL, 0, "Pathname component", HFILL }},
7126 "Tag", "nfs.tag", FT_STRING, BASE_DEC,
7127 NULL, 0, "Tag", HFILL }},
7129 { &hf_nfs_clientid4, {
7130 "clientid", "nfs.clientid", FT_UINT64, BASE_HEX,
7131 NULL, 0, "Client ID", HFILL }},
7134 "ace", "nfs.ace", FT_STRING, BASE_DEC,
7135 NULL, 0, "Access Control Entry", HFILL }},
7138 "EOF", "nfs.recall", FT_BOOLEAN, BASE_NONE,
7139 &yesno, 0, "Recall", HFILL }},
7141 { &hf_nfs_open_claim_type4, {
7142 "Claim Type", "nfs.open.claim_type", FT_UINT32, BASE_DEC,
7143 VALS(names_claim_type4), 0, "Claim Type", HFILL }},
7145 { &hf_nfs_opentype4, {
7146 "Open Type", "nfs.open.opentype", FT_UINT32, BASE_DEC,
7147 VALS(names_opentype4), 0, "Open Type", HFILL }},
7149 { &hf_nfs_limit_by4, {
7150 "Space Limit", "nfs.open.limit_by", FT_UINT32, BASE_DEC,
7151 VALS(names_limit_by4), 0, "Limit By", HFILL }},
7153 { &hf_nfs_open_delegation_type4, {
7154 "Delegation Type", "nfs.open.delegation_type", FT_UINT32, BASE_DEC,
7155 VALS(names_open_delegation_type4), 0, "Delegation Type", HFILL }},
7158 "nfs_ftype4", "nfs.nfs_ftype4", FT_UINT32, BASE_DEC,
7159 VALS(names_ftype4), 0, "nfs.nfs_ftype4", HFILL }},
7161 { &hf_nfs_change_info4_atomic, {
7162 "Atomic", "nfs.change_info.atomic", FT_BOOLEAN, BASE_NONE,
7163 &yesno, 0, "Atomic", HFILL }},
7165 { &hf_nfs_open4_share_access, {
7166 "share_access", "nfs.open4.share_access", FT_UINT32, BASE_DEC,
7167 VALS(names_open4_share_access), 0, "Share Access", HFILL }},
7169 { &hf_nfs_open4_share_deny, {
7170 "share_deny", "nfs.open4.share_deny", FT_UINT32, BASE_DEC,
7171 VALS(names_open4_share_deny), 0, "Share Deny", HFILL }},
7174 "seqid", "nfs.seqid", FT_UINT32, BASE_HEX,
7175 NULL, 0, "Sequence ID", HFILL }},
7177 { &hf_nfs_lock_seqid4, {
7178 "lock_seqid", "nfs.lock_seqid", FT_UINT32, BASE_HEX,
7179 NULL, 0, "Lock Sequence ID", HFILL }},
7181 { &hf_nfs_mand_attr, {
7182 "mand_attr", "nfs.attr", FT_UINT32, BASE_DEC,
7183 VALS(names_fattr4), 0, "Mandatory Attribute", HFILL }},
7185 { &hf_nfs_recc_attr, {
7186 "recc_attr", "nfs.attr", FT_UINT32, BASE_DEC,
7187 VALS(names_fattr4), 0, "Recommended Attribute", HFILL }},
7189 { &hf_nfs_time_how4, {
7190 "set_it", "nfs.set_it", FT_UINT32, BASE_DEC,
7191 VALS(names_time_how4), 0, "How To Set Time", HFILL }},
7193 { &hf_nfs_attrlist4, {
7194 "attr_vals", "nfs.fattr4.attr_vals", FT_BYTES, BASE_DEC,
7195 NULL, 0, "attr_vals", HFILL }},
7197 { &hf_nfs_fattr4_link_support, {
7198 "fattr4_link_support", "nfs.fattr4_link_support", FT_BOOLEAN,
7199 BASE_NONE, &yesno, 0, "nfs.fattr4_link_support", HFILL }},
7201 { &hf_nfs_fattr4_symlink_support, {
7202 "fattr4_symlink_support", "nfs.fattr4_symlink_support", FT_BOOLEAN,
7203 BASE_NONE, &yesno, 0, "nfs.fattr4_symlink_support", HFILL }},
7205 { &hf_nfs_fattr4_named_attr, {
7206 "fattr4_named_attr", "nfs.fattr4_named_attr", FT_BOOLEAN, BASE_NONE,
7207 &yesno, 0, "nfs.fattr4_named_attr", HFILL }},
7209 { &hf_nfs_fattr4_unique_handles, {
7210 "fattr4_unique_handles", "nfs.fattr4_unique_handles", FT_BOOLEAN,
7211 BASE_NONE, &yesno, 0, "nfs.fattr4_unique_handles", HFILL }},
7213 { &hf_nfs_fattr4_archive, {
7214 "fattr4_archive", "nfs.fattr4_archive", FT_BOOLEAN,
7215 BASE_NONE, &yesno, 0, "nfs.fattr4_archive", HFILL }},
7217 { &hf_nfs_fattr4_cansettime, {
7218 "fattr4_cansettime", "nfs.fattr4_cansettime", FT_BOOLEAN,
7219 BASE_NONE, &yesno, 0, "nfs.fattr4_cansettime", HFILL }},
7221 { &hf_nfs_fattr4_case_insensitive, {
7222 "fattr4_case_insensitive", "nfs.fattr4_case_insensitive", FT_BOOLEAN,
7223 BASE_NONE, &yesno, 0, "nfs.fattr4_case_insensitive", HFILL }},
7225 { &hf_nfs_fattr4_case_preserving, {
7226 "fattr4_case_preserving", "nfs.fattr4_case_preserving", FT_BOOLEAN,
7227 BASE_NONE, &yesno, 0, "nfs.fattr4_case_preserving", HFILL }},
7229 { &hf_nfs_fattr4_chown_restricted, {
7230 "fattr4_chown_restricted", "nfs.fattr4_chown_restricted", FT_BOOLEAN,
7231 BASE_NONE, &yesno, 0, "nfs.fattr4_chown_restricted", HFILL }},
7233 { &hf_nfs_fattr4_hidden, {
7234 "fattr4_hidden", "nfs.fattr4_hidden", FT_BOOLEAN,
7235 BASE_NONE, &yesno, 0, "nfs.fattr4_hidden", HFILL }},
7237 { &hf_nfs_fattr4_homogeneous, {
7238 "fattr4_homogeneous", "nfs.fattr4_homogeneous", FT_BOOLEAN,
7239 BASE_NONE, &yesno, 0, "nfs.fattr4_homogeneous", HFILL }},
7241 { &hf_nfs_fattr4_mimetype, {
7242 "fattr4_mimetype", "nfs.fattr4_mimetype", FT_STRING, BASE_DEC,
7243 NULL, 0, "nfs.fattr4_mimetype", HFILL }},
7245 { &hf_nfs_fattr4_no_trunc, {
7246 "fattr4_no_trunc", "nfs.fattr4_no_trunc", FT_BOOLEAN,
7247 BASE_NONE, &yesno, 0, "nfs.fattr4_no_trunc", HFILL }},
7249 { &hf_nfs_fattr4_system, {
7250 "fattr4_system", "nfs.fattr4_system", FT_BOOLEAN,
7251 BASE_NONE, &yesno, 0, "nfs.fattr4_system", HFILL }},
7254 "who", "nfs.who", FT_STRING, BASE_DEC,
7255 NULL, 0, "nfs.who", HFILL }},
7258 "server", "nfs.server", FT_STRING, BASE_DEC,
7259 NULL, 0, "nfs.server", HFILL }},
7261 { &hf_nfs_fattr4_owner, {
7262 "fattr4_owner", "nfs.fattr4_owner", FT_STRING, BASE_DEC,
7263 NULL, 0, "nfs.fattr4_owner", HFILL }},
7265 { &hf_nfs_fattr4_owner_group, {
7266 "fattr4_owner_group", "nfs.fattr4_owner_group", FT_STRING, BASE_DEC,
7267 NULL, 0, "nfs.fattr4_owner_group", HFILL }},
7269 { &hf_nfs_stable_how4, {
7270 "stable_how4", "nfs.stable_how4", FT_UINT32, BASE_DEC,
7271 VALS(names_stable_how4), 0, "nfs.stable_how4", HFILL }},
7273 { &hf_nfs_dirlist4_eof, {
7274 "eof", "nfs.dirlist4.eof", FT_BOOLEAN,
7275 BASE_NONE, &yesno, 0, "nfs.dirlist4.eof", HFILL }},
7277 { &hf_nfs_stateid4, {
7278 "stateid", "nfs.stateid4", FT_UINT64, BASE_DEC,
7279 NULL, 0, "nfs.stateid4", HFILL }},
7281 { &hf_nfs_offset4, {
7282 "offset", "nfs.offset4", FT_UINT64, BASE_DEC,
7283 NULL, 0, "nfs.offset4", HFILL }},
7285 { &hf_nfs_specdata1, {
7286 "specdata1", "nfs.specdata1", FT_UINT32, BASE_DEC,
7287 NULL, 0, "nfs.specdata1", HFILL }},
7289 { &hf_nfs_specdata2, {
7290 "specdata2", "nfs.specdata2", FT_UINT32, BASE_DEC,
7291 NULL, 0, "nfs.specdata2", HFILL }},
7293 { &hf_nfs_lock_type4, {
7294 "locktype", "nfs.locktype4", FT_UINT32, BASE_DEC,
7295 VALS(names_nfs_lock_type4), 0, "nfs.locktype4", HFILL }},
7297 { &hf_nfs_reclaim4, {
7298 "reclaim", "nfs.reclaim4", FT_BOOLEAN,
7299 BASE_NONE, &yesno, 0, "Reclaim", HFILL }},
7301 { &hf_nfs_length4, {
7302 "length", "nfs.length4", FT_UINT64, BASE_DEC,
7303 NULL, 0, "nfs.length4", HFILL }},
7305 { &hf_nfs_changeid4, {
7306 "changeid", "nfs.changeid4", FT_UINT64, BASE_DEC,
7307 NULL, 0, "nfs.changeid4", HFILL }},
7309 { &hf_nfs_changeid4_before, {
7310 "changeid", "nfs.changeid4.before", FT_UINT64, BASE_DEC,
7311 NULL, 0, "nfs.changeid4.before", HFILL }},
7313 { &hf_nfs_changeid4_after, {
7314 "changeid", "nfs.changeid4.after", FT_UINT64, BASE_DEC,
7315 NULL, 0, "nfs.changeid4.after", HFILL }},
7317 { &hf_nfs_nfstime4_seconds, {
7318 "seconds", "nfs.nfstime4.seconds", FT_UINT64, BASE_DEC,
7319 NULL, 0, "nfs.nfstime4.seconds", HFILL }},
7321 { &hf_nfs_nfstime4_nseconds, {
7322 "nseconds", "nfs.nfstime4.nseconds", FT_UINT32, BASE_DEC,
7323 NULL, 0, "nfs.nfstime4.nseconds", HFILL }},
7325 { &hf_nfs_fsid4_major, {
7326 "fsid4.major", "nfs.fsid4.major", FT_UINT64, BASE_DEC,
7327 NULL, 0, "nfs.nfstime4.fsid4.major", HFILL }},
7329 { &hf_nfs_fsid4_minor, {
7330 "fsid4.minor", "nfs.fsid4.minor", FT_UINT64, BASE_DEC,
7331 NULL, 0, "nfs.fsid4.minor", HFILL }},
7333 { &hf_nfs_acetype4, {
7334 "acetype", "nfs.acetype4", FT_UINT32, BASE_DEC,
7335 VALS(names_acetype4), 0, "nfs.acetype4", HFILL }},
7337 { &hf_nfs_aceflag4, {
7338 "aceflag", "nfs.aceflag4", FT_UINT32, BASE_DEC,
7339 NULL, 0, "nfs.aceflag4", HFILL }},
7341 { &hf_nfs_acemask4, {
7342 "acemask", "nfs.acemask4", FT_UINT32, BASE_DEC,
7343 NULL, 0, "nfs.acemask4", HFILL }},
7345 { &hf_nfs_fattr4_size, {
7346 "size", "nfs.fattr4.size", FT_UINT64, BASE_DEC,
7347 NULL, 0, "nfs.fattr4.size", HFILL }},
7349 { &hf_nfs_fattr4_lease_time, {
7350 "lease_time", "nfs.fattr4.lease_time", FT_UINT32, BASE_DEC,
7351 NULL, 0, "nfs.fattr4.lease_time", HFILL }},
7353 { &hf_nfs_fattr4_aclsupport, {
7354 "aclsupport", "nfs.fattr4.aclsupport", FT_UINT32, BASE_DEC,
7355 NULL, 0, "nfs.fattr4.aclsupport", HFILL }},
7357 { &hf_nfs_fattr4_fileid, {
7358 "fileid", "nfs.fattr4.fileid", FT_UINT64, BASE_DEC,
7359 NULL, 0, "nfs.fattr4.fileid", HFILL }},
7361 { &hf_nfs_fattr4_files_avail, {
7362 "files_avail", "nfs.fattr4.files_avail", FT_UINT64, BASE_DEC,
7363 NULL, 0, "nfs.fattr4.files_avail", HFILL }},
7365 { &hf_nfs_fattr4_files_free, {
7366 "files_free", "nfs.fattr4.files_free", FT_UINT64, BASE_DEC,
7367 NULL, 0, "nfs.fattr4.files_free", HFILL }},
7369 { &hf_nfs_fattr4_files_total, {
7370 "files_total", "nfs.fattr4.files_total", FT_UINT64, BASE_DEC,
7371 NULL, 0, "nfs.fattr4.files_total", HFILL }},
7373 { &hf_nfs_fattr4_maxfilesize, {
7374 "maxfilesize", "nfs.fattr4.maxfilesize", FT_UINT64, BASE_DEC,
7375 NULL, 0, "nfs.fattr4.maxfilesize", HFILL }},
7377 { &hf_nfs_fattr4_maxlink, {
7378 "maxlink", "nfs.fattr4.maxlink", FT_UINT32, BASE_DEC,
7379 NULL, 0, "nfs.fattr4.maxlink", HFILL }},
7381 { &hf_nfs_fattr4_maxname, {
7382 "maxname", "nfs.fattr4.maxname", FT_UINT32, BASE_DEC,
7383 NULL, 0, "nfs.fattr4.maxname", HFILL }},
7385 { &hf_nfs_fattr4_numlinks, {
7386 "numlinks", "nfs.fattr4.numlinks", FT_UINT32, BASE_DEC,
7387 NULL, 0, "nfs.fattr4.numlinks", HFILL }},
7389 { &hf_nfs_delegate_type, {
7390 "delegate_type", "nfs.delegate_type", FT_UINT32, BASE_DEC,
7391 NULL, 0, "nfs.delegate_type", HFILL }},
7393 { &hf_nfs_secinfo_flavor, {
7394 "flavor", "nfs.secinfo.flavor", FT_UINT32, BASE_DEC,
7395 VALS(rpc_auth_flavor), 0, "nfs.secinfo.flavor", HFILL }},
7397 { &hf_nfs_num_blocks, {
7398 "num_blocks", "nfs.num_blocks", FT_UINT32, BASE_DEC,
7399 NULL, 0, "nfs.num_blocks", HFILL }},
7401 { &hf_nfs_bytes_per_block, {
7402 "bytes_per_block", "nfs.bytes_per_block", FT_UINT32, BASE_DEC,
7403 NULL, 0, "nfs.bytes_per_block", HFILL }},
7406 "eof", "nfs.eof", FT_UINT32, BASE_DEC,
7407 NULL, 0, "nfs.eof", HFILL }},
7409 { &hf_nfs_fattr4_maxread, {
7410 "maxread", "nfs.fattr4.maxread", FT_UINT64, BASE_DEC,
7411 NULL, 0, "nfs.fattr4.maxread", HFILL }},
7413 { &hf_nfs_fattr4_maxwrite, {
7414 "maxwrite", "nfs.fattr4.maxwrite", FT_UINT64, BASE_DEC,
7415 NULL, 0, "nfs.fattr4.maxwrite", HFILL }},
7417 { &hf_nfs_fattr4_quota_hard, {
7418 "quota_hard", "nfs.fattr4.quota_hard", FT_UINT64, BASE_DEC,
7419 NULL, 0, "nfs.fattr4.quota_hard", HFILL }},
7421 { &hf_nfs_fattr4_quota_soft, {
7422 "quota_soft", "nfs.fattr4.quota_soft", FT_UINT64, BASE_DEC,
7423 NULL, 0, "nfs.fattr4.quota_soft", HFILL }},
7425 { &hf_nfs_fattr4_quota_used, {
7426 "quota_used", "nfs.fattr4.quota_used", FT_UINT64, BASE_DEC,
7427 NULL, 0, "nfs.fattr4.quota_used", HFILL }},
7429 { &hf_nfs_fattr4_space_avail, {
7430 "space_avail", "nfs.fattr4.space_avail", FT_UINT64, BASE_DEC,
7431 NULL, 0, "nfs.fattr4.space_avail", HFILL }},
7433 { &hf_nfs_fattr4_space_free, {
7434 "space_free", "nfs.fattr4.space_free", FT_UINT64, BASE_DEC,
7435 NULL, 0, "nfs.fattr4.space_free", HFILL }},
7437 { &hf_nfs_fattr4_space_total, {
7438 "space_total", "nfs.fattr4.space_total", FT_UINT64, BASE_DEC,
7439 NULL, 0, "nfs.fattr4.space_total", HFILL }},
7441 { &hf_nfs_fattr4_space_used, {
7442 "space_used", "nfs.fattr4.space_used", FT_UINT64, BASE_DEC,
7443 NULL, 0, "nfs.fattr4.space_used", HFILL }},
7445 { &hf_nfs_stateid4_delegate_stateid, {
7446 "delegate_stateid", "nfs.delegate_stateid", FT_UINT64, BASE_DEC,
7447 NULL, 0, "nfs.delegate_stateid", HFILL }},
7449 { &hf_nfs_verifier4, {
7450 "verifier", "nfs.verifier4", FT_UINT64, BASE_HEX,
7451 NULL, 0, "nfs.verifier4", HFILL }},
7453 { &hf_nfs_cookie4, {
7454 "cookie", "nfs.cookie4", FT_UINT64, BASE_DEC,
7455 NULL, 0, "nfs.cookie4", HFILL }},
7457 { &hf_nfs_cookieverf4, {
7458 "cookieverf", "nfs.cookieverf4", FT_UINT64, BASE_DEC,
7459 NULL, 0, "nfs.cookieverf4", HFILL }},
7461 { &hf_nfs_cb_location, {
7462 "cb_location", "nfs.cb_location", FT_UINT32, BASE_DEC,
7463 NULL, 0, "nfs.cb_location", HFILL }},
7465 { &hf_nfs_cb_program, {
7466 "cb_program", "nfs.cb_program", FT_UINT32, BASE_HEX,
7467 NULL, 0, "nfs.cb_program", HFILL }},
7469 { &hf_nfs_recall4, {
7470 "recall", "nfs.recall4", FT_BOOLEAN,
7471 BASE_NONE, &yesno, 0, "nfs.recall4", HFILL }},
7473 { &hf_nfs_filesize, {
7474 "filesize", "nfs.filesize", FT_UINT64, BASE_DEC,
7475 NULL, 0, "nfs.filesize", HFILL }},
7478 "count", "nfs.count4", FT_UINT32, BASE_DEC,
7479 NULL, 0, "nfs.count4", HFILL }},
7481 { &hf_nfs_count4_dircount, {
7482 "dircount", "nfs.dircount", FT_UINT32, BASE_DEC,
7483 NULL, 0, "nfs.dircount", HFILL }},
7485 { &hf_nfs_count4_maxcount, {
7486 "maxcount", "nfs.maxcount", FT_UINT32, BASE_DEC,
7487 NULL, 0, "nfs.maxcount", HFILL }},
7489 { &hf_nfs_minorversion, {
7490 "minorversion", "nfs.minorversion", FT_UINT32, BASE_DEC,
7491 NULL, 0, "nfs.minorversion", HFILL }},
7494 "atime", "nfs.atime", FT_ABSOLUTE_TIME, BASE_NONE,
7495 NULL, 0, "Access Time", HFILL }},
7497 { &hf_nfs_atime_sec, {
7498 "seconds", "nfs.atime.sec", FT_UINT32, BASE_DEC,
7499 NULL, 0, "Access Time, Seconds", HFILL }},
7501 { &hf_nfs_atime_nsec, {
7502 "nano seconds", "nfs.atime.nsec", FT_UINT32, BASE_DEC,
7503 NULL, 0, "Access Time, Nano-seconds", HFILL }},
7505 { &hf_nfs_atime_usec, {
7506 "micro seconds", "nfs.atime.usec", FT_UINT32, BASE_DEC,
7507 NULL, 0, "Access Time, Micro-seconds", HFILL }},
7510 "mtime", "nfs.mtime", FT_ABSOLUTE_TIME, BASE_NONE,
7511 NULL, 0, "Modify Time", HFILL }},
7513 { &hf_nfs_mtime_sec, {
7514 "seconds", "nfs.mtime.sec", FT_UINT32, BASE_DEC,
7515 NULL, 0, "Modify Seconds", HFILL }},
7517 { &hf_nfs_mtime_nsec, {
7518 "nano seconds", "nfs.mtime.nsec", FT_UINT32, BASE_DEC,
7519 NULL, 0, "Modify Time, Nano-seconds", HFILL }},
7521 { &hf_nfs_mtime_usec, {
7522 "micro seconds", "nfs.mtime.usec", FT_UINT32, BASE_DEC,
7523 NULL, 0, "Modify Time, Micro-seconds", HFILL }},
7526 "ctime", "nfs.ctime", FT_ABSOLUTE_TIME, BASE_NONE,
7527 NULL, 0, "Creation Time", HFILL }},
7529 { &hf_nfs_ctime_sec, {
7530 "seconds", "nfs.ctime.sec", FT_UINT32, BASE_DEC,
7531 NULL, 0, "Creation Time, Seconds", HFILL }},
7533 { &hf_nfs_ctime_nsec, {
7534 "nano seconds", "nfs.ctime.nsec", FT_UINT32, BASE_DEC,
7535 NULL, 0, "Creation Time, Nano-seconds", HFILL }},
7537 { &hf_nfs_ctime_usec, {
7538 "micro seconds", "nfs.ctime.usec", FT_UINT32, BASE_DEC,
7539 NULL, 0, "Creation Time, Micro-seconds", HFILL }},
7542 "time delta", "nfs.dtime", FT_RELATIVE_TIME, BASE_NONE,
7543 NULL, 0, "Time Delta", HFILL }},
7545 { &hf_nfs_dtime_sec, {
7546 "seconds", "nfs.dtime.sec", FT_UINT32, BASE_DEC,
7547 NULL, 0, "Time Delta, Seconds", HFILL }},
7549 { &hf_nfs_dtime_nsec, {
7550 "nano seconds", "nfs.dtime.nsec", FT_UINT32, BASE_DEC,
7551 NULL, 0, "Time Delta, Nano-seconds", HFILL }},
7553 { &hf_nfs_open_owner4, {
7554 "owner", "nfs.open_owner4", FT_BYTES, BASE_DEC,
7555 NULL, 0, "owner", HFILL }},
7557 { &hf_nfs_lock_owner4, {
7558 "owner", "nfs.lock_owner4", FT_BYTES, BASE_DEC,
7559 NULL, 0, "owner", HFILL }},
7561 { &hf_nfs_secinfo_rpcsec_gss_info_service, {
7562 "service", "nfs.secinfo.rpcsec_gss_info.service", FT_UINT32,
7563 BASE_DEC, VALS(rpc_authgss_svc), 0, "service", HFILL }},
7565 { &hf_nfs_attrdircreate, {
7566 "attribute dir create", "nfs.openattr4.createdir", FT_BOOLEAN,
7567 BASE_NONE, &yesno, 0, "nfs.openattr4.createdir", HFILL }},
7569 { &hf_nfs_new_lock_owner, {
7570 "new lock owner?", "nfs.lock.locker.new_lock_owner", FT_BOOLEAN,
7571 BASE_NONE, &yesno, 0, "nfs.lock.locker.new_lock_owner", HFILL }},
7573 { &hf_nfs_lock4_reclaim, {
7574 "reclaim?", "nfs.lock.reclaim", FT_BOOLEAN,
7575 BASE_NONE, &yesno, 0, "nfs.lock.reclaim", HFILL }},
7577 { &hf_nfs_sec_oid4, {
7578 "oid", "nfs.secinfo.flavor_info.rpcsec_gss_info.oid", FT_BYTES,
7579 BASE_DEC, NULL, 0, "oid", HFILL }},
7582 "qop", "nfs.secinfo.flavor_info.rpcsec_gss_info.qop", FT_UINT32,
7583 BASE_DEC, NULL, 0, "qop", HFILL }},
7585 { &hf_nfs_client_id4_id, {
7586 "id", "nfs.nfs_client_id4.id", FT_BYTES, BASE_DEC,
7587 NULL, 0, "nfs.nfs_client_id4.id", HFILL }},
7589 { &hf_nfs_stateid4_other, {
7590 "Data", "nfs.stateid4.other", FT_BYTES, BASE_DEC,
7591 NULL, 0, "Data", HFILL }},
7594 "ACL", "nfs.acl", FT_NONE, BASE_NONE,
7595 NULL, 0, "Access Control List", HFILL }},
7597 { &hf_nfs_callback_ident, {
7598 "callback_ident", "nfs.callback.ident", FT_UINT32, BASE_HEX,
7599 NULL, 0, "Callback Identifier", HFILL }},
7601 { &hf_nfs_r_netid, {
7602 "r_netid", "nfs.r_netid", FT_BYTES, BASE_DEC, NULL, 0,
7603 "r_netid", HFILL }},
7606 "r_addr", "nfs.r_addr", FT_BYTES, BASE_DEC, NULL, 0,
7610 static gint *ett[] = {
7612 &ett_nfs_fh_encoding,
7625 &ett_nfs_readdir_entry,
7631 &ett_nfs_post_op_fh3,
7633 &ett_nfs_diropargs3,
7634 &ett_nfs_sattrguard3,
7641 &ett_nfs_pre_op_attr,
7642 &ett_nfs_post_op_attr,
7646 &ett_nfs_fsinfo_properties,
7647 &ett_nfs_compound_call4,
7648 &ett_nfs_utf8string,
7655 &ett_nfs_delegpurge4,
7656 &ett_nfs_delegreturn4,
7668 &ett_nfs_open_confirm4,
7669 &ett_nfs_open_downgrade4,
7672 &ett_nfs_putrootfh4,
7679 &ett_nfs_restorefh4,
7682 &ett_nfs_setclientid4,
7683 &ett_nfs_setclientid_confirm4,
7690 &ett_nfs_change_info4,
7691 &ett_nfs_open_delegation4,
7692 &ett_nfs_open_claim4,
7694 &ett_nfs_lock_owner4,
7695 &ett_nfs_cb_client4,
7696 &ett_nfs_client_id4,
7700 &ett_nfs_fs_locations4,
7701 &ett_nfs_fs_location4,
7702 &ett_nfs_open4_result_flags,
7704 &ett_nfs_secinfo4_flavor_info,
7706 &ett_nfs_fattr4_fh_expire_type,
7708 &ett_nfs_clientaddr4,
7712 module_t *nfs_module;
7714 proto_nfs = proto_register_protocol("Network File System", "NFS", "nfs");
7715 proto_register_field_array(proto_nfs, hf, array_length(hf));
7716 proto_register_subtree_array(ett, array_length(ett));
7718 nfs_module=prefs_register_protocol(proto_nfs, NULL);
7719 prefs_register_bool_preference(nfs_module, "file_name_snooping",
7720 "Snoop FH to filename mappings",
7721 "Whether the dissector should snoop the FH to filename mappings by looking inside certain packets",
7722 &nfs_file_name_snooping);
7723 prefs_register_bool_preference(nfs_module, "file_full_name_snooping",
7724 "Snoop full path to filenames",
7725 "Whether the dissector should snoop the full pathname for files for matching FH's",
7726 &nfs_file_name_full_snooping);
7727 prefs_register_bool_preference(nfs_module, "fhandle_find_both_reqrep",
7728 "Fhandle filters finds both request/response",
7729 "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",
7730 &nfs_fhandle_reqrep_matching);
7731 register_init_routine(nfs_name_snoop_init);
7732 register_init_routine(nfs_fhandle_reqrep_matching_init);
7736 proto_reg_handoff_nfs(void)
7738 /* Register the protocol as RPC */
7739 rpc_init_prog(proto_nfs, NFS_PROGRAM, ett_nfs);
7740 /* Register the procedure tables */
7741 rpc_init_proc_table(NFS_PROGRAM, 2, nfs2_proc, hf_nfs_procedure_v2);
7742 rpc_init_proc_table(NFS_PROGRAM, 3, nfs3_proc, hf_nfs_procedure_v3);
7743 rpc_init_proc_table(NFS_PROGRAM, 4, nfs4_proc, hf_nfs_procedure_v4);