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.96 2004/02/25 09:31:06 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"
39 #include "epan/int-64bit.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_mount_fileid = -1;
49 static int hf_nfs_fh_mount_generation = -1;
50 static int hf_nfs_fh_snapid = -1;
51 static int hf_nfs_fh_unused = -1;
52 static int hf_nfs_fh_flags = -1;
53 static int hf_nfs_fh_fileid = -1;
54 static int hf_nfs_fh_generation = -1;
55 static int hf_nfs_fh_fsid = -1;
56 static int hf_nfs_fh_export_fileid = -1;
57 static int hf_nfs_fh_export_generation = -1;
58 static int hf_nfs_fh_export_snapid = -1;
59 static int hf_nfs_fh_fsid_major = -1;
60 static int hf_nfs_fh_fsid_minor = -1;
61 static int hf_nfs_fh_fsid_inode = -1;
62 static int hf_nfs_fh_xfsid_major = -1;
63 static int hf_nfs_fh_xfsid_minor = -1;
64 static int hf_nfs_fh_fstype = -1;
65 static int hf_nfs_fh_fn = -1;
66 static int hf_nfs_fh_fn_len = -1;
67 static int hf_nfs_fh_fn_inode = -1;
68 static int hf_nfs_fh_fn_generation = -1;
69 static int hf_nfs_fh_xfn = -1;
70 static int hf_nfs_fh_xfn_len = -1;
71 static int hf_nfs_fh_xfn_inode = -1;
72 static int hf_nfs_fh_xfn_generation = -1;
73 static int hf_nfs_fh_dentry = -1;
74 static int hf_nfs_fh_dev = -1;
75 static int hf_nfs_fh_xdev = -1;
76 static int hf_nfs_fh_dirinode = -1;
77 static int hf_nfs_fh_pinode = -1;
78 static int hf_nfs_fh_hp_len = -1;
79 static int hf_nfs_fh_version = -1;
80 static int hf_nfs_fh_auth_type = -1;
81 static int hf_nfs_fh_fsid_type = -1;
82 static int hf_nfs_fh_fileid_type = -1;
83 static int hf_nfs_stat = -1;
84 static int hf_nfs_name = -1;
85 static int hf_nfs_full_name = -1;
86 static int hf_nfs_readlink_data = -1;
87 static int hf_nfs_read_offset = -1;
88 static int hf_nfs_read_count = -1;
89 static int hf_nfs_read_totalcount = -1;
90 static int hf_nfs_data = -1;
91 static int hf_nfs_write_beginoffset = -1;
92 static int hf_nfs_write_offset = -1;
93 static int hf_nfs_write_totalcount = -1;
94 static int hf_nfs_symlink_to = -1;
95 static int hf_nfs_readdir_cookie = -1;
96 static int hf_nfs_readdir_count = -1;
97 static int hf_nfs_readdir_entry = -1;
98 static int hf_nfs_readdir_entry_fileid = -1;
99 static int hf_nfs_readdir_entry_name = -1;
100 static int hf_nfs_readdir_entry_cookie = -1;
101 static int hf_nfs_readdir_entry3_fileid = -1;
102 static int hf_nfs_readdir_entry3_name = -1;
103 static int hf_nfs_readdir_entry3_cookie = -1;
104 static int hf_nfs_readdirplus_entry_fileid = -1;
105 static int hf_nfs_readdirplus_entry_name = -1;
106 static int hf_nfs_readdirplus_entry_cookie = -1;
107 static int hf_nfs_readdir_eof = -1;
108 static int hf_nfs_statfs_tsize = -1;
109 static int hf_nfs_statfs_bsize = -1;
110 static int hf_nfs_statfs_blocks = -1;
111 static int hf_nfs_statfs_bfree = -1;
112 static int hf_nfs_statfs_bavail = -1;
113 static int hf_nfs_ftype3 = -1;
114 static int hf_nfs_nfsstat3 = -1;
115 static int hf_nfs_read_eof = -1;
116 static int hf_nfs_write_stable = -1;
117 static int hf_nfs_write_committed = -1;
118 static int hf_nfs_createmode3 = -1;
119 static int hf_nfs_fsstat_invarsec = -1;
120 static int hf_nfs_fsinfo_rtmax = -1;
121 static int hf_nfs_fsinfo_rtpref = -1;
122 static int hf_nfs_fsinfo_rtmult = -1;
123 static int hf_nfs_fsinfo_wtmax = -1;
124 static int hf_nfs_fsinfo_wtpref = -1;
125 static int hf_nfs_fsinfo_wtmult = -1;
126 static int hf_nfs_fsinfo_dtpref = -1;
127 static int hf_nfs_fsinfo_maxfilesize = -1;
128 static int hf_nfs_fsinfo_properties = -1;
129 static int hf_nfs_pathconf_linkmax = -1;
130 static int hf_nfs_pathconf_name_max = -1;
131 static int hf_nfs_pathconf_no_trunc = -1;
132 static int hf_nfs_pathconf_chown_restricted = -1;
133 static int hf_nfs_pathconf_case_insensitive = -1;
134 static int hf_nfs_pathconf_case_preserving = -1;
136 static int hf_nfs_atime = -1;
137 static int hf_nfs_atime_sec = -1;
138 static int hf_nfs_atime_nsec = -1;
139 static int hf_nfs_atime_usec = -1;
140 static int hf_nfs_mtime = -1;
141 static int hf_nfs_mtime_sec = -1;
142 static int hf_nfs_mtime_nsec = -1;
143 static int hf_nfs_mtime_usec = -1;
144 static int hf_nfs_ctime = -1;
145 static int hf_nfs_ctime_sec = -1;
146 static int hf_nfs_ctime_nsec = -1;
147 static int hf_nfs_ctime_usec = -1;
148 static int hf_nfs_dtime = -1;
149 static int hf_nfs_dtime_sec = -1;
150 static int hf_nfs_dtime_nsec = -1;
152 static int hf_nfs_fattr_type = -1;
153 static int hf_nfs_fattr_nlink = -1;
154 static int hf_nfs_fattr_uid = -1;
155 static int hf_nfs_fattr_gid = -1;
156 static int hf_nfs_fattr_size = -1;
157 static int hf_nfs_fattr_blocksize = -1;
158 static int hf_nfs_fattr_rdev = -1;
159 static int hf_nfs_fattr_blocks = -1;
160 static int hf_nfs_fattr_fsid = -1;
161 static int hf_nfs_fattr_fileid = -1;
162 static int hf_nfs_fattr3_type = -1;
163 static int hf_nfs_fattr3_nlink = -1;
164 static int hf_nfs_fattr3_uid = -1;
165 static int hf_nfs_fattr3_gid = -1;
166 static int hf_nfs_fattr3_size = -1;
167 static int hf_nfs_fattr3_used = -1;
168 static int hf_nfs_fattr3_rdev = -1;
169 static int hf_nfs_fattr3_fsid = -1;
170 static int hf_nfs_fattr3_fileid = -1;
171 static int hf_nfs_wcc_attr_size = -1;
172 static int hf_nfs_set_size3_size = -1;
173 static int hf_nfs_cookie3 = -1;
174 static int hf_nfs_fsstat3_resok_tbytes = -1;
175 static int hf_nfs_fsstat3_resok_fbytes = -1;
176 static int hf_nfs_fsstat3_resok_abytes = -1;
177 static int hf_nfs_fsstat3_resok_tfiles = -1;
178 static int hf_nfs_fsstat3_resok_ffiles = -1;
179 static int hf_nfs_fsstat3_resok_afiles = -1;
180 static int hf_nfs_uid3 = -1;
181 static int hf_nfs_gid3 = -1;
182 static int hf_nfs_offset3 = -1;
183 static int hf_nfs_count3 = -1;
184 static int hf_nfs_count3_maxcount = -1;
185 static int hf_nfs_count3_dircount= -1;
188 static int hf_nfs_argop4 = -1;
189 static int hf_nfs_resop4 = -1;
190 static int hf_nfs_linktext4 = -1;
191 static int hf_nfs_tag4 = -1;
192 static int hf_nfs_component4 = -1;
193 static int hf_nfs_clientid4 = -1;
194 static int hf_nfs_ace4 = -1;
195 static int hf_nfs_recall = -1;
196 static int hf_nfs_open_claim_type4 = -1;
197 static int hf_nfs_opentype4 = -1;
198 static int hf_nfs_limit_by4 = -1;
199 static int hf_nfs_open_delegation_type4 = -1;
200 static int hf_nfs_ftype4 = -1;
201 static int hf_nfs_change_info4_atomic = -1;
202 static int hf_nfs_open4_share_access = -1;
203 static int hf_nfs_open4_share_deny = -1;
204 static int hf_nfs_seqid4 = -1;
205 static int hf_nfs_lock_seqid4 = -1;
206 static int hf_nfs_mand_attr = -1;
207 static int hf_nfs_recc_attr = -1;
208 static int hf_nfs_time_how4 = -1;
209 static int hf_nfs_attrlist4 = -1;
210 static int hf_nfs_fattr4_link_support = -1;
211 static int hf_nfs_fattr4_symlink_support = -1;
212 static int hf_nfs_fattr4_named_attr = -1;
213 static int hf_nfs_fattr4_unique_handles = -1;
214 static int hf_nfs_fattr4_archive = -1;
215 static int hf_nfs_fattr4_cansettime = -1;
216 static int hf_nfs_fattr4_case_insensitive = -1;
217 static int hf_nfs_fattr4_case_preserving = -1;
218 static int hf_nfs_fattr4_chown_restricted = -1;
219 static int hf_nfs_fattr4_hidden = -1;
220 static int hf_nfs_fattr4_homogeneous = -1;
221 static int hf_nfs_fattr4_mimetype = -1;
222 static int hf_nfs_fattr4_no_trunc = -1;
223 static int hf_nfs_fattr4_system = -1;
224 static int hf_nfs_fattr4_owner = -1;
225 static int hf_nfs_fattr4_owner_group = -1;
226 static int hf_nfs_fattr4_size = -1;
227 static int hf_nfs_fattr4_aclsupport = -1;
228 static int hf_nfs_fattr4_lease_time = -1;
229 static int hf_nfs_fattr4_fileid = -1;
230 static int hf_nfs_fattr4_files_avail = -1;
231 static int hf_nfs_fattr4_files_free = -1;
232 static int hf_nfs_fattr4_files_total = -1;
233 static int hf_nfs_fattr4_maxfilesize = -1;
234 static int hf_nfs_fattr4_maxlink = -1;
235 static int hf_nfs_fattr4_maxname = -1;
236 static int hf_nfs_fattr4_numlinks = -1;
237 static int hf_nfs_fattr4_maxread = -1;
238 static int hf_nfs_fattr4_maxwrite = -1;
239 static int hf_nfs_fattr4_quota_hard = -1;
240 static int hf_nfs_fattr4_quota_soft = -1;
241 static int hf_nfs_fattr4_quota_used = -1;
242 static int hf_nfs_fattr4_space_avail = -1;
243 static int hf_nfs_fattr4_space_free = -1;
244 static int hf_nfs_fattr4_space_total = -1;
245 static int hf_nfs_fattr4_space_used = -1;
246 static int hf_nfs_who = -1;
247 static int hf_nfs_server = -1;
248 static int hf_nfs_stable_how4 = -1;
249 static int hf_nfs_dirlist4_eof = -1;
250 static int hf_nfs_stateid4 = -1;
251 static int hf_nfs_offset4 = -1;
252 static int hf_nfs_specdata1 = -1;
253 static int hf_nfs_specdata2 = -1;
254 static int hf_nfs_lock_type4 = -1;
255 static int hf_nfs_reclaim4 = -1;
256 static int hf_nfs_length4 = -1;
257 static int hf_nfs_changeid4 = -1;
258 static int hf_nfs_changeid4_before = -1;
259 static int hf_nfs_changeid4_after = -1;
260 static int hf_nfs_nfstime4_seconds = -1;
261 static int hf_nfs_nfstime4_nseconds = -1;
262 static int hf_nfs_fsid4_major = -1;
263 static int hf_nfs_fsid4_minor = -1;
264 static int hf_nfs_acetype4 = -1;
265 static int hf_nfs_aceflag4 = -1;
266 static int hf_nfs_acemask4 = -1;
267 static int hf_nfs_delegate_type = -1;
268 static int hf_nfs_secinfo_flavor = -1;
269 static int hf_nfs_secinfo_arr4 = -1;
270 static int hf_nfs_num_blocks = -1;
271 static int hf_nfs_bytes_per_block = -1;
272 static int hf_nfs_eof = -1;
273 static int hf_nfs_stateid4_delegate_stateid = -1;
274 static int hf_nfs_verifier4 = -1;
275 static int hf_nfs_cookie4 = -1;
276 static int hf_nfs_cookieverf4 = -1;
277 static int hf_nfs_cb_program = -1;
278 static int hf_nfs_cb_location = -1;
279 static int hf_nfs_recall4 = -1;
280 static int hf_nfs_filesize = -1;
281 static int hf_nfs_count4 = -1;
282 static int hf_nfs_count4_dircount = -1;
283 static int hf_nfs_count4_maxcount = -1;
284 static int hf_nfs_minorversion = -1;
285 static int hf_nfs_open_owner4 = -1;
286 static int hf_nfs_lock_owner4 = -1;
287 static int hf_nfs_new_lock_owner = -1;
288 static int hf_nfs_sec_oid4 = -1;
289 static int hf_nfs_qop4 = -1;
290 static int hf_nfs_secinfo_rpcsec_gss_info_service = -1;
291 static int hf_nfs_attrdircreate = -1;
292 static int hf_nfs_client_id4_id = -1;
293 static int hf_nfs_stateid4_other = -1;
294 static int hf_nfs_lock4_reclaim = -1;
295 static int hf_nfs_acl4 = -1;
296 static int hf_nfs_callback_ident = -1;
297 static int hf_nfs_r_netid = -1;
298 static int hf_nfs_r_addr = -1;
300 static gint ett_nfs = -1;
301 static gint ett_nfs_fh_encoding = -1;
302 static gint ett_nfs_fh_mount = -1;
303 static gint ett_nfs_fh_file = -1;
304 static gint ett_nfs_fh_export = -1;
305 static gint ett_nfs_fh_fsid = -1;
306 static gint ett_nfs_fh_xfsid = -1;
307 static gint ett_nfs_fh_fn = -1;
308 static gint ett_nfs_fh_xfn = -1;
309 static gint ett_nfs_fh_hp = -1;
310 static gint ett_nfs_fh_auth = -1;
311 static gint ett_nfs_fhandle = -1;
312 static gint ett_nfs_timeval = -1;
313 static gint ett_nfs_mode = -1;
314 static gint ett_nfs_fattr = -1;
315 static gint ett_nfs_sattr = -1;
316 static gint ett_nfs_diropargs = -1;
317 static gint ett_nfs_readdir_entry = -1;
318 static gint ett_nfs_mode3 = -1;
319 static gint ett_nfs_specdata3 = -1;
320 static gint ett_nfs_fh3 = -1;
321 static gint ett_nfs_nfstime3 = -1;
322 static gint ett_nfs_fattr3 = -1;
323 static gint ett_nfs_post_op_fh3 = -1;
324 static gint ett_nfs_sattr3 = -1;
325 static gint ett_nfs_diropargs3 = -1;
326 static gint ett_nfs_sattrguard3 = -1;
327 static gint ett_nfs_set_mode3 = -1;
328 static gint ett_nfs_set_uid3 = -1;
329 static gint ett_nfs_set_gid3 = -1;
330 static gint ett_nfs_set_size3 = -1;
331 static gint ett_nfs_set_atime = -1;
332 static gint ett_nfs_set_mtime = -1;
333 static gint ett_nfs_pre_op_attr = -1;
334 static gint ett_nfs_post_op_attr = -1;
335 static gint ett_nfs_wcc_attr = -1;
336 static gint ett_nfs_wcc_data = -1;
337 static gint ett_nfs_access = -1;
338 static gint ett_nfs_fsinfo_properties = -1;
341 static gint ett_nfs_compound_call4 = -1;
342 static gint ett_nfs_utf8string = -1;
343 static gint ett_nfs_argop4 = -1;
344 static gint ett_nfs_resop4 = -1;
345 static gint ett_nfs_access4 = -1;
346 static gint ett_nfs_close4 = -1;
347 static gint ett_nfs_commit4 = -1;
348 static gint ett_nfs_create4 = -1;
349 static gint ett_nfs_delegpurge4 = -1;
350 static gint ett_nfs_delegreturn4 = -1;
351 static gint ett_nfs_getattr4 = -1;
352 static gint ett_nfs_getfh4 = -1;
353 static gint ett_nfs_link4 = -1;
354 static gint ett_nfs_lock4 = -1;
355 static gint ett_nfs_lockt4 = -1;
356 static gint ett_nfs_locku4 = -1;
357 static gint ett_nfs_lookup4 = -1;
358 static gint ett_nfs_lookupp4 = -1;
359 static gint ett_nfs_nverify4 = -1;
360 static gint ett_nfs_open4 = -1;
361 static gint ett_nfs_openattr4 = -1;
362 static gint ett_nfs_open_confirm4 = -1;
363 static gint ett_nfs_open_downgrade4 = -1;
364 static gint ett_nfs_putfh4 = -1;
365 static gint ett_nfs_putpubfh4 = -1;
366 static gint ett_nfs_putrootfh4 = -1;
367 static gint ett_nfs_read4 = -1;
368 static gint ett_nfs_readdir4 = -1;
369 static gint ett_nfs_readlink4 = -1;
370 static gint ett_nfs_remove4 = -1;
371 static gint ett_nfs_rename4 = -1;
372 static gint ett_nfs_renew4 = -1;
373 static gint ett_nfs_restorefh4 = -1;
374 static gint ett_nfs_savefh4 = -1;
375 static gint ett_nfs_secinfo4 = -1;
376 static gint ett_nfs_setattr4 = -1;
377 static gint ett_nfs_setclientid4 = -1;
378 static gint ett_nfs_setclientid_confirm4 = -1;
379 static gint ett_nfs_verify4 = -1;
380 static gint ett_nfs_write4 = -1;
381 static gint ett_nfs_verifier4 = -1;
382 static gint ett_nfs_opaque = -1;
383 static gint ett_nfs_dirlist4 = -1;
384 static gint ett_nfs_pathname4 = -1;
385 static gint ett_nfs_change_info4 = -1;
386 static gint ett_nfs_open_delegation4 = -1;
387 static gint ett_nfs_open_claim4 = -1;
388 static gint ett_nfs_opentype4 = -1;
389 static gint ett_nfs_lock_owner4 = -1;
390 static gint ett_nfs_cb_client4 = -1;
391 static gint ett_nfs_client_id4 = -1;
392 static gint ett_nfs_bitmap4 = -1;
393 static gint ett_nfs_fattr4 = -1;
394 static gint ett_nfs_fsid4 = -1;
395 static gint ett_nfs_fs_locations4 = -1;
396 static gint ett_nfs_fs_location4 = -1;
397 static gint ett_nfs_open4_result_flags = -1;
398 static gint ett_nfs_secinfo4_flavor_info = -1;
399 static gint ett_nfs_stateid4 = -1;
400 static gint ett_nfs_fattr4_fh_expire_type = -1;
401 static gint ett_nfs_ace4 = -1;
402 static gint ett_nfs_clientaddr4 = -1;
403 static gint ett_nfs_aceflag4 = -1;
404 static gint ett_nfs_acemask4 = -1;
407 /* fhandle displayfilters to match also corresponding request/response
408 packet in addition to the one containing the actual filehandle */
409 gboolean nfs_fhandle_reqrep_matching = FALSE;
410 static GMemChunk *nfs_fhandle_data_chunk = NULL;
411 static int nfs_fhandle_data_init_count = 100;
412 static GHashTable *nfs_fhandle_data_table = NULL;
413 GHashTable *nfs_fhandle_frame_table = NULL;
416 nfs_fhandle_data_equal(gconstpointer k1, gconstpointer k2)
418 const nfs_fhandle_data_t *key1 = (const nfs_fhandle_data_t *)k1;
419 const nfs_fhandle_data_t *key2 = (const nfs_fhandle_data_t *)k2;
421 return (key1->len==key2->len)
422 &&(!memcmp(key1->fh, key2->fh, key1->len));
425 nfs_fhandle_data_hash(gconstpointer k)
427 const nfs_fhandle_data_t *key = (const nfs_fhandle_data_t *)k;
432 for(i=0;i<key->len;i++)
438 nfs_fhandle_data_free_all(gpointer key_arg _U_, gpointer value, gpointer user_data _U_)
440 nfs_fhandle_data_t *nns = (nfs_fhandle_data_t *)value;
445 g_free((gpointer)nns->fh);
453 nfs_fhandle_frame_equal(gconstpointer k1, gconstpointer k2)
455 guint32 key1 = (guint32)k1;
456 guint32 key2 = (guint32)k2;
461 nfs_fhandle_frame_hash(gconstpointer k)
463 guint32 key = (guint32)k;
468 nfs_fhandle_frame_free_all(gpointer key_arg _U_, gpointer value _U_, gpointer user_data _U_)
473 nfs_fhandle_reqrep_matching_init(void)
475 if (nfs_fhandle_frame_table != NULL) {
476 g_hash_table_foreach_remove(nfs_fhandle_frame_table,
477 nfs_fhandle_frame_free_all, NULL);
479 nfs_fhandle_frame_table=g_hash_table_new(nfs_fhandle_frame_hash,
480 nfs_fhandle_frame_equal);
484 if (nfs_fhandle_data_table != NULL) {
485 g_hash_table_foreach_remove(nfs_fhandle_data_table,
486 nfs_fhandle_data_free_all, NULL);
488 nfs_fhandle_data_table=g_hash_table_new(nfs_fhandle_data_hash,
489 nfs_fhandle_data_equal);
492 if(nfs_fhandle_data_chunk){
493 g_mem_chunk_destroy(nfs_fhandle_data_chunk);
494 nfs_fhandle_data_chunk = NULL;
497 if(nfs_fhandle_reqrep_matching){
498 nfs_fhandle_data_chunk = g_mem_chunk_new("nfs_fhandle_data_chunk",
499 sizeof(nfs_fhandle_data_t),
500 nfs_fhandle_data_init_count * sizeof(nfs_fhandle_data_t),
507 /* file name snooping */
508 gboolean nfs_file_name_snooping = FALSE;
509 gboolean nfs_file_name_full_snooping = FALSE;
510 typedef struct nfs_name_snoop {
516 unsigned char *parent;
518 unsigned char *full_name;
521 typedef struct nfs_name_snoop_key {
524 const unsigned char *fh;
525 } nfs_name_snoop_key_t;
527 static GMemChunk *nfs_name_snoop_chunk = NULL;
528 static int nfs_name_snoop_init_count = 100;
529 static GHashTable *nfs_name_snoop_unmatched = NULL;
531 static GMemChunk *nfs_name_snoop_key_chunk = NULL;
532 static int nfs_name_snoop_key_init_count = 100;
533 static GHashTable *nfs_name_snoop_matched = NULL;
535 static GHashTable *nfs_name_snoop_known = NULL;
538 nfs_name_snoop_matched_equal(gconstpointer k1, gconstpointer k2)
540 const nfs_name_snoop_key_t *key1 = (const nfs_name_snoop_key_t *)k1;
541 const nfs_name_snoop_key_t *key2 = (const nfs_name_snoop_key_t *)k2;
543 return (key1->key==key2->key)
544 &&(key1->fh_length==key2->fh_length)
545 &&(!memcmp(key1->fh, key2->fh, key1->fh_length));
548 nfs_name_snoop_matched_hash(gconstpointer k)
550 const nfs_name_snoop_key_t *key = (const nfs_name_snoop_key_t *)k;
555 for(i=0;i<key->fh_length;i++)
561 nfs_name_snoop_unmatched_equal(gconstpointer k1, gconstpointer k2)
563 guint32 key1 = (guint32)k1;
564 guint32 key2 = (guint32)k2;
569 nfs_name_snoop_unmatched_hash(gconstpointer k)
571 guint32 key = (guint32)k;
576 nfs_name_snoop_unmatched_free_all(gpointer key_arg _U_, gpointer value, gpointer user_data _U_)
578 nfs_name_snoop_t *nns = (nfs_name_snoop_t *)value;
581 g_free((gpointer)nns->name);
586 g_free((gpointer)nns->full_name);
588 nns->full_name_len=0;
591 g_free((gpointer)nns->parent);
596 g_free((gpointer)nns->fh);
604 nfs_name_snoop_init(void)
606 if (nfs_name_snoop_unmatched != NULL) {
607 g_hash_table_foreach_remove(nfs_name_snoop_unmatched,
608 nfs_name_snoop_unmatched_free_all, NULL);
610 /* The fragment table does not exist. Create it */
611 nfs_name_snoop_unmatched=g_hash_table_new(nfs_name_snoop_unmatched_hash,
612 nfs_name_snoop_unmatched_equal);
614 if (nfs_name_snoop_matched != NULL) {
615 g_hash_table_foreach_remove(nfs_name_snoop_matched,
616 nfs_name_snoop_unmatched_free_all, NULL);
618 /* The fragment table does not exist. Create it */
619 nfs_name_snoop_matched=g_hash_table_new(nfs_name_snoop_matched_hash,
620 nfs_name_snoop_matched_equal);
622 if (nfs_name_snoop_known != NULL) {
623 g_hash_table_foreach_remove(nfs_name_snoop_known,
624 nfs_name_snoop_unmatched_free_all, NULL);
626 /* The fragment table does not exist. Create it */
627 nfs_name_snoop_known=g_hash_table_new(nfs_name_snoop_matched_hash,
628 nfs_name_snoop_matched_equal);
631 if(nfs_name_snoop_chunk){
632 g_mem_chunk_destroy(nfs_name_snoop_chunk);
633 nfs_name_snoop_chunk = NULL;
635 if(nfs_name_snoop_key_chunk){
636 g_mem_chunk_destroy(nfs_name_snoop_key_chunk);
637 nfs_name_snoop_key_chunk = NULL;
640 if(nfs_file_name_snooping){
641 nfs_name_snoop_chunk = g_mem_chunk_new("nfs_name_snoop_chunk",
642 sizeof(nfs_name_snoop_t),
643 nfs_name_snoop_init_count * sizeof(nfs_name_snoop_t),
645 nfs_name_snoop_key_chunk = g_mem_chunk_new("nfs_name_snoop_key_chunk",
646 sizeof(nfs_name_snoop_key_t),
647 nfs_name_snoop_key_init_count * sizeof(nfs_name_snoop_key_t),
654 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)
656 nfs_name_snoop_t *nns, *old_nns;
657 const unsigned char *ptr=NULL;
659 /* filter out all '.' and '..' names */
661 ptr=(const unsigned char *)tvb_get_ptr(tvb, name_offset, name_len);
674 nns=g_mem_chunk_alloc(nfs_name_snoop_chunk);
680 nns->parent_len=parent_len;
681 nns->parent=tvb_memdup(tvb, parent_offset, parent_len);
687 nns->name_len=name_len;
691 nns->name=g_malloc(name_len+1);
692 memcpy(nns->name, ptr, name_len);
694 nns->name[name_len]=0;
696 nns->full_name_len=0;
699 /* remove any old entry for this */
700 old_nns=g_hash_table_lookup(nfs_name_snoop_unmatched, (gconstpointer)xid);
702 /* if we haven't seen the reply yet, then there are no
703 matched entries for it, thus we can dealloc the arrays*/
705 g_free(old_nns->name);
709 g_free(old_nns->parent);
710 old_nns->parent=NULL;
711 old_nns->parent_len=0;
713 g_mem_chunk_free(nfs_name_snoop_chunk, old_nns);
715 g_hash_table_remove(nfs_name_snoop_unmatched, (gconstpointer)xid);
718 g_hash_table_insert(nfs_name_snoop_unmatched, (gpointer)xid, nns);
722 nfs_name_snoop_add_fh(int xid, tvbuff_t *tvb, int fh_offset, int fh_length)
725 nfs_name_snoop_t *nns, *old_nns;
726 nfs_name_snoop_key_t *key;
728 /* find which request we correspond to */
729 nns=g_hash_table_lookup(nfs_name_snoop_unmatched, (gconstpointer)xid);
731 /* oops couldnt find matching request, bail out */
735 /* if we have already seen this response earlier */
740 /* oki, we have a new entry */
741 fh=tvb_memdup(tvb, fh_offset, fh_length);
743 nns->fh_length=fh_length;
745 key=g_mem_chunk_alloc(nfs_name_snoop_key_chunk);
747 key->fh_length=nns->fh_length;
750 /* already have something matched for this fh, remove it from
752 old_nns=g_hash_table_lookup(nfs_name_snoop_matched, key);
754 g_hash_table_remove(nfs_name_snoop_matched, key);
757 g_hash_table_remove(nfs_name_snoop_unmatched, (gconstpointer)xid);
758 g_hash_table_insert(nfs_name_snoop_matched, key, nns);
762 nfs_full_name_snoop(nfs_name_snoop_t *nns, int *len, unsigned char **name, unsigned char **pos)
764 nfs_name_snoop_t *parent_nns = NULL;
765 nfs_name_snoop_key_t key;
767 /* check if the nns component ends with a '/' else we just allocate
768 an extra byte to len to accommodate for it later */
769 if(nns->name[nns->name_len-1]!='/'){
773 (*len) += nns->name_len;
775 if(nns->parent==NULL){
776 *name = g_malloc((*len)+1);
779 strcpy(*pos, nns->name);
780 *pos += nns->name_len;
785 key.fh_length=nns->parent_len;
788 parent_nns=g_hash_table_lookup(nfs_name_snoop_matched, &key);
791 nfs_full_name_snoop(parent_nns, len, name, pos);
793 /* make sure components are '/' separated */
794 if( (*pos)[-1] != '/'){
799 strcpy(*pos, nns->name);
800 *pos += nns->name_len;
809 nfs_name_snoop_fh(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int fh_offset, int fh_length, gboolean hidden)
811 nfs_name_snoop_key_t key;
812 nfs_name_snoop_t *nns = NULL;
814 /* if this is a new packet, see if we can register the mapping */
815 if(!pinfo->fd->flags.visited){
817 key.fh_length=fh_length;
818 key.fh=(const unsigned char *)tvb_get_ptr(tvb, fh_offset, fh_length);
820 nns=g_hash_table_lookup(nfs_name_snoop_matched, &key);
822 nfs_name_snoop_key_t *k;
823 k=g_mem_chunk_alloc(nfs_name_snoop_key_chunk);
824 k->key=pinfo->fd->num;
825 k->fh_length=nns->fh_length;
827 g_hash_table_insert(nfs_name_snoop_known, k, nns);
829 if(nfs_file_name_full_snooping){
830 unsigned char *name=NULL, *pos=NULL;
833 nfs_full_name_snoop(nns, &len, &name, &pos);
836 nns->full_name_len=len;
842 /* see if we know this mapping */
844 key.key=pinfo->fd->num;
845 key.fh_length=fh_length;
846 key.fh=(const unsigned char *)tvb_get_ptr(tvb, fh_offset, fh_length);
848 nns=g_hash_table_lookup(nfs_name_snoop_known, &key);
851 /* if we know the mapping, print the filename */
854 proto_tree_add_string_hidden(tree, hf_nfs_name, tvb,
855 fh_offset, 0, nns->name);
857 proto_tree_add_string_format(tree, hf_nfs_name, tvb,
858 fh_offset, 0, nns->name, "Name: %s", nns->name);
862 proto_tree_add_string_hidden(tree, hf_nfs_full_name, tvb,
863 fh_offset, 0, nns->name);
865 proto_tree_add_string_format(tree, hf_nfs_full_name, tvb,
866 fh_offset, 0, nns->name, "Full Name: %s", nns->full_name);
872 /* file handle dissection */
874 #define FHT_UNKNOWN 0
876 #define FHT_LINUX_KNFSD_LE 2
877 #define FHT_LINUX_NFSD_LE 3
878 #define FHT_LINUX_KNFSD_NEW 4
881 static const value_string names_fhtype[] =
883 { FHT_UNKNOWN, "unknown" },
884 { FHT_SVR4, "System V R4" },
885 { FHT_LINUX_KNFSD_LE, "Linux knfsd (little-endian)" },
886 { FHT_LINUX_NFSD_LE, "Linux user-land nfsd (little-endian)" },
887 { FHT_LINUX_KNFSD_NEW, "Linux knfsd (new)" },
888 { FHT_NETAPP, "NetApp file handle" },
893 /* SVR4: checked with ReliantUNIX (5.43, 5.44, 5.45) */
896 dissect_fhandle_data_SVR4(tvbuff_t* tvb, int offset, proto_tree *tree,
899 guint32 nof = offset;
911 temp = tvb_get_ntohl(tvb, fsid_O);
912 fsid_major = ( temp>>18 ) & 0x3fff; /* 14 bits */
913 fsid_minor = ( temp ) & 0x3ffff; /* 18 bits */
915 proto_item* fsid_item = NULL;
916 proto_tree* fsid_tree = NULL;
918 fsid_item = proto_tree_add_text(tree, tvb,
920 "file system ID: %d,%d", fsid_major, fsid_minor);
922 fsid_tree = proto_item_add_subtree(fsid_item,
924 proto_tree_add_uint(fsid_tree, hf_nfs_fh_fsid_major,
925 tvb, fsid_O, 2, fsid_major);
926 proto_tree_add_uint(fsid_tree, hf_nfs_fh_fsid_minor,
927 tvb, fsid_O+1, 3, fsid_minor);
930 nof = fsid_O + fsid_L;
933 /* file system type */
941 fstype = tvb_get_ntohl(tvb, fstype_O);
943 proto_tree_add_uint(tree, hf_nfs_fh_fstype, tvb,
944 fstype_O, fstype_L, fstype);
946 nof = fstype_O + fstype_L;
956 guint32 fn_data_inode_O;
957 guint32 fn_data_inode_L;
959 guint32 fn_data_gen_O;
960 guint32 fn_data_gen_L;
967 fn_len = tvb_get_ntohs(tvb, fn_len_O);
968 fn_data_O = fn_O + fn_len_L;
969 fn_data_inode_O = fn_data_O + 2;
971 inode = tvb_get_ntohl(tvb, fn_data_inode_O);
972 fn_data_gen_O = fn_data_inode_O + fn_data_inode_L;
974 gen = tvb_get_ntohl(tvb, fn_data_gen_O);
975 fn_L = fn_len_L + fn_len;
977 proto_item* fn_item = NULL;
978 proto_tree* fn_tree = NULL;
980 fn_item = proto_tree_add_uint(tree, hf_nfs_fh_fn, tvb,
983 fn_tree = proto_item_add_subtree(fn_item,
985 proto_tree_add_uint(fn_tree, hf_nfs_fh_fn_len,
986 tvb, fn_len_O, fn_len_L, fn_len);
987 proto_tree_add_uint(fn_tree, hf_nfs_fh_fn_inode,
988 tvb, fn_data_inode_O, fn_data_inode_L, inode);
989 proto_tree_add_uint(fn_tree, hf_nfs_fh_fn_generation,
990 tvb, fn_data_gen_O, fn_data_gen_L, gen);
993 nof = fn_O + fn_len_L + fn_len;
996 /* exported file number */
1003 guint32 xfn_data_inode_O;
1004 guint32 xfn_data_inode_L;
1006 guint32 xfn_data_gen_O;
1007 guint32 xfn_data_gen_L;
1014 xfn_len = tvb_get_ntohs(tvb, xfn_len_O);
1015 xfn_data_O = xfn_O + xfn_len_L;
1016 xfn_data_inode_O = xfn_data_O + 2;
1017 xfn_data_inode_L = 4;
1018 xinode = tvb_get_ntohl(tvb, xfn_data_inode_O);
1019 xfn_data_gen_O = xfn_data_inode_O + xfn_data_inode_L;
1021 xgen = tvb_get_ntohl(tvb, xfn_data_gen_O);
1022 xfn_L = xfn_len_L + xfn_len;
1024 proto_item* xfn_item = NULL;
1025 proto_tree* xfn_tree = NULL;
1027 xfn_item = proto_tree_add_uint(tree, hf_nfs_fh_xfn, tvb,
1028 xfn_O, xfn_L, xinode);
1030 xfn_tree = proto_item_add_subtree(xfn_item,
1032 proto_tree_add_uint(xfn_tree, hf_nfs_fh_xfn_len,
1033 tvb, xfn_len_O, xfn_len_L, xfn_len);
1034 proto_tree_add_uint(xfn_tree, hf_nfs_fh_xfn_inode,
1035 tvb, xfn_data_inode_O, xfn_data_inode_L, xinode);
1036 proto_tree_add_uint(xfn_tree, hf_nfs_fh_xfn_generation,
1037 tvb, xfn_data_gen_O, xfn_data_gen_L, xgen);
1044 /* Checked with RedHat Linux 6.2 (kernel 2.2.14 knfsd) */
1047 dissect_fhandle_data_LINUX_KNFSD_LE(tvbuff_t* tvb, int offset, proto_tree *tree,
1056 guint32 xfsid_major;
1057 guint32 xfsid_minor;
1061 dentry = tvb_get_letohl(tvb, offset+0);
1062 inode = tvb_get_letohl(tvb, offset+4);
1063 dirinode = tvb_get_letohl(tvb, offset+8);
1064 temp = tvb_get_letohs (tvb,offset+12);
1065 fsid_major = (temp >> 8) & 0xff;
1066 fsid_minor = (temp ) & 0xff;
1067 temp = tvb_get_letohs(tvb,offset+16);
1068 xfsid_major = (temp >> 8) & 0xff;
1069 xfsid_minor = (temp ) & 0xff;
1070 xinode = tvb_get_letohl(tvb,offset+20);
1071 gen = tvb_get_letohl(tvb,offset+24);
1074 proto_tree_add_uint(tree, hf_nfs_fh_dentry,
1075 tvb, offset+0, 4, dentry);
1076 proto_tree_add_uint(tree, hf_nfs_fh_fn_inode,
1077 tvb, offset+4, 4, inode);
1078 proto_tree_add_uint(tree, hf_nfs_fh_dirinode,
1079 tvb, offset+8, 4, dirinode);
1081 /* file system id (device) */
1083 proto_item* fsid_item = NULL;
1084 proto_tree* fsid_tree = NULL;
1086 fsid_item = proto_tree_add_text(tree, tvb,
1088 "file system ID: %d,%d", fsid_major, fsid_minor);
1090 fsid_tree = proto_item_add_subtree(fsid_item,
1092 proto_tree_add_uint(fsid_tree, hf_nfs_fh_fsid_major,
1093 tvb, offset+13, 1, fsid_major);
1094 proto_tree_add_uint(fsid_tree, hf_nfs_fh_fsid_minor,
1095 tvb, offset+12, 1, fsid_minor);
1099 /* exported file system id (device) */
1101 proto_item* xfsid_item = NULL;
1102 proto_tree* xfsid_tree = NULL;
1104 xfsid_item = proto_tree_add_text(tree, tvb,
1106 "exported file system ID: %d,%d", xfsid_major, xfsid_minor);
1108 xfsid_tree = proto_item_add_subtree(xfsid_item,
1110 proto_tree_add_uint(xfsid_tree, hf_nfs_fh_xfsid_major,
1111 tvb, offset+17, 1, xfsid_major);
1112 proto_tree_add_uint(xfsid_tree, hf_nfs_fh_xfsid_minor,
1113 tvb, offset+16, 1, xfsid_minor);
1117 proto_tree_add_uint(tree, hf_nfs_fh_xfn_inode,
1118 tvb, offset+20, 4, xinode);
1119 proto_tree_add_uint(tree, hf_nfs_fh_fn_generation,
1120 tvb, offset+24, 4, gen);
1125 /* Checked with RedHat Linux 5.2 (nfs-server 2.2beta47 user-land nfsd) */
1128 dissect_fhandle_data_LINUX_NFSD_LE(tvbuff_t* tvb, int offset, proto_tree *tree,
1134 pinode = tvb_get_letohl(tvb, offset+0);
1136 proto_tree_add_uint(tree, hf_nfs_fh_pinode,
1137 tvb, offset+0, 4, pinode);
1145 hashlen = tvb_get_guint8(tvb, offset+4);
1147 proto_item* hash_item = NULL;
1148 proto_tree* hash_tree = NULL;
1150 hash_item = proto_tree_add_text(tree, tvb, offset+4,
1153 tvb_bytes_to_str(tvb,offset+5,hashlen));
1155 hash_tree = proto_item_add_subtree(hash_item,
1158 proto_tree_add_uint(hash_tree,
1159 hf_nfs_fh_hp_len, tvb, offset+4, 1,
1161 proto_tree_add_text(hash_tree, tvb, offset+5,
1164 tvb_bytes_to_str(tvb,offset+5,hashlen));
1172 /* Checked with SuSE 7.1 (kernel 2.4.0 knfsd) */
1173 /* read linux-2.4.5/include/linux/nfsd/nfsfh.h for more details */
1175 #define AUTH_TYPE_NONE 0
1176 static const value_string auth_type_names[] = {
1177 { AUTH_TYPE_NONE, "no authentication" },
1181 #define FSID_TYPE_MAJOR_MINOR_INODE 0
1182 static const value_string fsid_type_names[] = {
1183 { FSID_TYPE_MAJOR_MINOR_INODE, "major/minor/inode" },
1187 #define FILEID_TYPE_ROOT 0
1188 #define FILEID_TYPE_INODE_GENERATION 1
1189 #define FILEID_TYPE_INODE_GENERATION_PARENT 2
1190 static const value_string fileid_type_names[] = {
1191 { FILEID_TYPE_ROOT, "root" },
1192 { FILEID_TYPE_INODE_GENERATION, "inode/generation" },
1193 { FILEID_TYPE_INODE_GENERATION_PARENT, "inode/generation/parent" },
1198 dissect_fhandle_data_NETAPP(tvbuff_t* tvb, int offset, proto_tree *tree,
1202 guint32 mount = tvb_get_letohl(tvb, offset + 0);
1203 guint32 mount_gen = tvb_get_letohl(tvb, offset + 4);
1204 guint16 flags = tvb_get_letohs(tvb, offset + 8);
1205 guint8 snapid = tvb_get_guint8(tvb, offset + 10);
1206 guint8 unused = tvb_get_guint8(tvb, offset + 11);
1207 guint32 inum = tvb_get_ntohl(tvb, offset + 12);
1208 guint32 generation = tvb_get_letohl(tvb, offset + 16);
1209 guint32 fsid = tvb_get_letohl(tvb, offset + 20);
1210 guint32 export = tvb_get_letohl(tvb, offset + 24);
1211 guint32 export_snapgen = tvb_get_letohl(tvb, offset + 28);
1213 proto_tree *subtree;
1214 char flag_string[128] = "";
1215 char *strings[] = { " MNT_PNT", " SNAPDIR", " SNAPDIR_ENT",
1216 " EMPTY", " VBN_ACCESS", " MULTIVOLUME",
1218 guint16 bit = sizeof(strings) / sizeof(strings[0]);
1220 if (flags & (1<<bit))
1221 strcat(flag_string, strings[bit]);
1222 item = proto_tree_add_text(tree, tvb, offset + 0, 8,
1223 "mount (inode %u)", mount);
1224 subtree = proto_item_add_subtree(item, ett_nfs_fh_mount);
1225 item = proto_tree_add_uint(subtree, hf_nfs_fh_mount_fileid,
1226 tvb, offset + 0, 4, mount);
1227 item = proto_tree_add_uint(subtree, hf_nfs_fh_mount_generation,
1228 tvb, offset + 4, 4, mount_gen);
1229 item = proto_tree_add_text(tree, tvb, offset + 8, 16,
1230 "file (inode %u)", inum);
1231 subtree = proto_item_add_subtree(item, ett_nfs_fh_file);
1232 item = proto_tree_add_uint_format(subtree, hf_nfs_fh_flags,
1233 tvb, offset + 8, 2, flags,
1234 "Flags: %#02x%s", flags,
1236 item = proto_tree_add_uint(subtree, hf_nfs_fh_snapid, tvb,
1237 offset + 10, 1, snapid);
1238 item = proto_tree_add_uint(subtree, hf_nfs_fh_unused, tvb,
1239 offset + 11, 1, unused);
1240 item = proto_tree_add_uint(subtree, hf_nfs_fh_fileid, tvb,
1241 offset + 12, 4, inum);
1242 item = proto_tree_add_uint(subtree, hf_nfs_fh_generation, tvb,
1243 offset + 16, 4, generation);
1244 item = proto_tree_add_uint(subtree, hf_nfs_fh_fsid, tvb,
1245 offset + 20, 4, fsid);
1246 item = proto_tree_add_text(tree, tvb, offset + 24, 8,
1247 "export (inode %u)", export);
1248 subtree = proto_item_add_subtree(item, ett_nfs_fh_export);
1249 item = proto_tree_add_uint(subtree, hf_nfs_fh_export_fileid,
1250 tvb, offset + 24, 4, export);
1251 item = proto_tree_add_uint(subtree,
1252 hf_nfs_fh_export_generation,
1253 tvb, offset + 28, 3,
1254 export_snapgen & 0xffffff);
1255 item = proto_tree_add_uint(subtree, hf_nfs_fh_export_snapid,
1256 tvb, offset + 31, 1,
1257 export_snapgen >> 24);
1262 dissect_fhandle_data_LINUX_KNFSD_NEW(tvbuff_t* tvb, int offset, proto_tree *tree,
1270 version = tvb_get_guint8(tvb, offset + 0);
1272 proto_tree_add_uint(tree, hf_nfs_fh_version,
1273 tvb, offset+0, 1, version);
1278 auth_type = tvb_get_guint8(tvb, offset + 1);
1279 fsid_type = tvb_get_guint8(tvb, offset + 2);
1280 fileid_type = tvb_get_guint8(tvb, offset + 3);
1282 proto_item* encoding_item = proto_tree_add_text(tree, tvb,
1284 "encoding: %u %u %u",
1285 auth_type, fsid_type, fileid_type);
1286 if (encoding_item) {
1287 proto_tree* encoding_tree = proto_item_add_subtree(encoding_item,
1288 ett_nfs_fh_encoding);
1289 if (encoding_tree) {
1290 proto_tree_add_uint(encoding_tree, hf_nfs_fh_auth_type,
1291 tvb, offset+1, 1, auth_type);
1292 proto_tree_add_uint(encoding_tree, hf_nfs_fh_fsid_type,
1293 tvb, offset+2, 1, fsid_type);
1294 proto_tree_add_uint(encoding_tree, hf_nfs_fh_fileid_type,
1295 tvb, offset+3, 1, fileid_type);
1302 /* unknown version */
1307 switch (auth_type) {
1309 /* no authentication */
1311 proto_tree_add_text(tree, tvb,
1313 "authentication: none");
1317 /* unknown authentication type */
1322 switch (fsid_type) {
1328 fsid_major = tvb_get_ntohs(tvb, offset + 0);
1329 fsid_minor = tvb_get_ntohs(tvb, offset + 2);
1330 fsid_inode = tvb_get_letohl(tvb, offset + 4);
1332 proto_item* fsid_item = proto_tree_add_text(tree, tvb,
1334 "file system ID: %u,%u (inode %u)",
1335 fsid_major, fsid_minor, fsid_inode);
1337 proto_tree* fsid_tree = proto_item_add_subtree(fsid_item,
1340 proto_tree_add_uint(fsid_tree, hf_nfs_fh_fsid_major,
1341 tvb, offset+0, 2, fsid_major);
1342 proto_tree_add_uint(fsid_tree, hf_nfs_fh_fsid_minor,
1343 tvb, offset+2, 2, fsid_minor);
1344 proto_tree_add_uint(fsid_tree, hf_nfs_fh_fsid_inode,
1345 tvb, offset+4, 4, fsid_inode);
1352 /* unknown fsid type */
1357 switch (fileid_type) {
1360 proto_tree_add_text(tree, tvb,
1362 "file ID: root inode");
1369 inode = tvb_get_letohl(tvb, offset + 0);
1370 generation = tvb_get_letohl(tvb, offset + 4);
1373 proto_item* fileid_item = proto_tree_add_text(tree, tvb,
1378 proto_tree* fileid_tree = proto_item_add_subtree(
1379 fileid_item, ett_nfs_fh_fn);
1381 proto_tree_add_uint(fileid_tree, hf_nfs_fh_fn_inode,
1382 tvb, offset+0, 4, inode);
1383 proto_tree_add_uint(fileid_tree, hf_nfs_fh_fn_generation,
1384 tvb, offset+4, 4, generation);
1394 guint32 parent_inode;
1396 inode = tvb_get_letohl(tvb, offset + 0);
1397 generation = tvb_get_letohl(tvb, offset + 4);
1398 parent_inode = tvb_get_letohl(tvb, offset + 8);
1401 proto_item* fileid_item = proto_tree_add_text(tree, tvb,
1406 proto_tree* fileid_tree = proto_item_add_subtree(
1407 fileid_item, ett_nfs_fh_fn);
1409 proto_tree_add_uint(fileid_tree, hf_nfs_fh_fn_inode,
1410 tvb, offset+0, 4, inode);
1411 proto_tree_add_uint(fileid_tree, hf_nfs_fh_fn_generation,
1412 tvb, offset+4, 4, generation);
1413 proto_tree_add_uint(fileid_tree, hf_nfs_fh_dirinode,
1414 tvb, offset+8, 4, parent_inode);
1422 /* unknown fileid type */
1433 dissect_fhandle_data_unknown(tvbuff_t *tvb, int offset, proto_tree *tree,
1438 gboolean first_line;
1442 while (bytes_left != 0) {
1444 if (sublen > bytes_left)
1445 sublen = bytes_left;
1446 proto_tree_add_text(tree, tvb, offset, sublen,
1448 first_line ? "data: " :
1450 tvb_bytes_to_str(tvb,offset,sublen));
1451 bytes_left -= sublen;
1459 dissect_fhandle_data(tvbuff_t *tvb, int offset, packet_info *pinfo,
1460 proto_tree *tree, unsigned int fhlen, gboolean hidden, guint32 *hash)
1462 unsigned int fhtype = FHT_UNKNOWN;
1464 /* filehandle too long */
1465 if (fhlen>64) goto type_ready;
1466 /* Not all bytes there. Any attempt to deduce the type would be
1468 if (!tvb_bytes_exist(tvb,offset,fhlen)) goto type_ready;
1470 /* this is to set up fhandle display filters to find both packets
1472 if(nfs_fhandle_reqrep_matching && (!hidden) ){
1473 nfs_fhandle_data_t *old_fhd=NULL;
1476 if( !pinfo->fd->flags.visited ){
1477 nfs_fhandle_data_t fhd;
1479 /* first check if we have seen this fhandle before */
1481 fhd.fh=(const unsigned char *)tvb_get_ptr(tvb, offset, fhlen);
1482 old_fhd=g_hash_table_lookup(nfs_fhandle_data_table,
1483 (gconstpointer)&fhd);
1485 /* oh, a new fhandle, alloc struct and store it in the table*/
1486 old_fhd=g_mem_chunk_alloc(nfs_fhandle_data_chunk);
1489 memcpy(fh, fhd.fh, fhlen);
1491 old_fhd->tvb=tvb_new_real_data(old_fhd->fh, old_fhd->len, old_fhd->len);
1492 g_hash_table_insert(nfs_fhandle_data_table,
1493 (gpointer)old_fhd, (gpointer)old_fhd);
1496 /* XXX here we should really check that we havent stored
1497 this fhandle for this frame number already.
1498 We should also make sure we can handle when we have multiple
1499 fhandles seen for the same frame, which WILL happen for certain
1500 nfs calls. For now, we dont handle this and those calls will
1501 not work properly with this feature
1503 g_hash_table_insert(nfs_fhandle_frame_table,
1504 (gpointer)pinfo->fd->num,
1509 /* create a semiunique hash value for the filehandle */
1514 for(fhhash=0,i=0;i<(fhlen-3);i+=4){
1516 val = tvb_get_ntohl(tvb, offset+i);
1521 proto_tree_add_uint_hidden(tree, hf_nfs_fh_hash, tvb, offset,
1524 proto_tree_add_uint(tree, hf_nfs_fh_hash, tvb, offset,
1531 if(nfs_file_name_snooping){
1532 nfs_name_snoop_fh(pinfo, tree, tvb, offset, fhlen, hidden);
1536 /* calculate (heuristically) fhtype */
1539 if (tvb_get_ntohl(tvb,offset) == 0x01000000) {
1540 fhtype=FHT_LINUX_KNFSD_NEW;
1544 if (tvb_get_ntohl(tvb,offset) == 0x01000001) {
1545 fhtype=FHT_LINUX_KNFSD_NEW;
1549 if (tvb_get_ntohl(tvb,offset) == 0x01000002) {
1550 fhtype=FHT_LINUX_KNFSD_NEW;
1556 if (tvb_get_ntohs(tvb,offset+4) == 0) {
1557 len1=tvb_get_ntohs(tvb,offset+8);
1558 if (tvb_bytes_exist(tvb,offset+10+len1,2)) {
1559 len2=tvb_get_ntohs(tvb,
1561 if (fhlen==12+len1+len2) {
1567 /* For a NetApp filehandle, the flag bits must
1568 include WAFL_FH_MULTIVOLUME, and the fileid
1569 and generation number need to be nonzero in
1570 the mount point, file, and export. */
1571 if ((tvb_get_ntohl(tvb,offset+8) & 0x20000000)
1572 && tvb_get_ntohl(tvb,offset+0)
1573 && tvb_get_ntohl(tvb,offset+4)
1574 && tvb_get_ntohl(tvb,offset+12)
1575 && tvb_get_ntohl(tvb,offset+16)
1576 && tvb_get_ntohl(tvb,offset+24)
1577 && tvb_get_ntohl(tvb,offset+28)) {
1581 len1 = tvb_get_guint8(tvb,offset+4);
1582 if (len1<28 && tvb_bytes_exist(tvb,offset+5,len1)) {
1584 for (len2=5+len1;len2<32;len2++) {
1585 if (tvb_get_guint8(tvb,offset+len2)) {
1591 fhtype=FHT_LINUX_NFSD_LE;
1595 if (tvb_get_ntohl(tvb,offset+28) == 0) {
1596 if (tvb_get_ntohs(tvb,offset+14) == 0) {
1597 if (tvb_get_ntohs(tvb,offset+18) == 0) {
1598 fhtype=FHT_LINUX_KNFSD_LE;
1610 proto_tree_add_text(tree, tvb, offset, 0,
1611 "type: %s", val_to_str(fhtype, names_fhtype, "Unknown"));
1616 dissect_fhandle_data_SVR4 (tvb, offset, tree,
1619 case FHT_LINUX_KNFSD_LE:
1620 dissect_fhandle_data_LINUX_KNFSD_LE(tvb, offset, tree,
1623 case FHT_LINUX_NFSD_LE:
1624 dissect_fhandle_data_LINUX_NFSD_LE (tvb, offset, tree,
1627 case FHT_LINUX_KNFSD_NEW:
1628 dissect_fhandle_data_LINUX_KNFSD_NEW (tvb, offset, tree,
1632 dissect_fhandle_data_NETAPP (tvb, offset, tree,
1637 dissect_fhandle_data_unknown(tvb, offset, tree, fhlen);
1644 dissect_fhandle_hidden(packet_info *pinfo, proto_tree *tree, nfs_fhandle_data_t *nfd)
1646 if(nfd && nfd->len){
1647 dissect_fhandle_data(nfd->tvb, 0, pinfo, tree, nfd->len, TRUE, NULL);
1652 /***************************/
1653 /* NFS Version 2, RFC 1094 */
1654 /***************************/
1657 /* RFC 1094, Page 12..14 */
1658 static const value_string names_nfs_stat[] =
1665 { 13, "ERR_ACCES" },
1666 { 17, "ERR_EXIST" },
1667 { 18, "ERR_XDEV" }, /* not in spec, but can happen */
1668 { 19, "ERR_NODEV" },
1669 { 20, "ERR_NOTDIR" },
1670 { 21, "ERR_ISDIR" },
1671 { 22, "ERR_INVAL" }, /* not in spec, but I think it can happen */
1672 { 26, "ERR_TXTBSY" }, /* not in spec, but I think it can happen */
1674 { 28, "ERR_NOSPC" },
1676 { 31, "ERR_MLINK" }, /* not in spec, but can happen */
1677 { 45, "ERR_OPNOTSUPP" }, /* not in spec, but I think it can happen */
1678 { 63, "ERR_NAMETOOLONG" },
1679 { 66, "ERR_NOTEMPTY" },
1680 { 69, "ERR_DQUOT" },
1681 { 70, "ERR_STALE" },
1682 { 99, "ERR_WFLUSH" },
1686 /* NFSv4 Draft Specification, Page 198-199 */
1687 static const value_string names_nfs_stat4[] = {
1689 { 1, "NFS4ERR_PERM" },
1690 { 2, "NFS4ERR_NOENT" },
1691 { 5, "NFS4ERR_IO" },
1692 { 6, "NFS4ERR_NXIO" },
1693 { 13, "NFS4ERR_ACCES" },
1694 { 17, "NFS4ERR_EXIST" },
1695 { 18, "NFS4ERR_XDEV" },
1696 { 19, "NFS4ERR_NODEV" },
1697 { 20, "NFS4ERR_NOTDIR" },
1698 { 21, "NFS4ERR_ISDIR" },
1699 { 22, "NFS4ERR_INVAL" },
1700 { 27, "NFS4ERR_FBIG" },
1701 { 28, "NFS4ERR_NOSPC" },
1702 { 30, "NFS4ERR_ROFS" },
1703 { 31, "NFS4ERR_MLINK" },
1704 { 63, "NFS4ERR_NAMETOOLONG" },
1705 { 66, "NFS4ERR_NOTEMPTY" },
1706 { 69, "NFS4ERR_DQUOT" },
1707 { 70, "NFS4ERR_STALE" },
1708 { 10001, "NFS4ERR_BADHANDLE" },
1709 { 10003, "NFS4ERR_BAD_COOKIE" },
1710 { 10004, "NFS4ERR_NOTSUPP" },
1711 { 10005, "NFS4ERR_TOOSMALL" },
1712 { 10006, "NFS4ERR_SERVERFAULT" },
1713 { 10007, "NFS4ERR_BADTYPE" },
1714 { 10008, "NFS4ERR_DELAY" },
1715 { 10009, "NFS4ERR_SAME" },
1716 { 10010, "NFS4ERR_DENIED" },
1717 { 10011, "NFS4ERR_EXPIRED" },
1718 { 10012, "NFS4ERR_LOCKED" },
1719 { 10013, "NFS4ERR_GRACE" },
1720 { 10014, "NFS4ERR_FHEXPIRED" },
1721 { 10015, "NFS4ERR_SHARE_DENIED" },
1722 { 10016, "NFS4ERR_WRONGSEC" },
1723 { 10017, "NFS4ERR_CLID_INUSE" },
1724 { 10018, "NFS4ERR_RESOURCE" },
1725 { 10019, "NFS4ERR_MOVED" },
1726 { 10020, "NFS4ERR_NOFILEHANDLE" },
1727 { 10021, "NFS4ERR_MINOR_VERS_MISMATCH" },
1728 { 10022, "NFS4ERR_STALE_CLIENTID" },
1729 { 10023, "NFS4ERR_STALE_STATEID" },
1730 { 10024, "NFS4ERR_OLD_STATEID" },
1731 { 10025, "NFS4ERR_BAD_STATEID" },
1732 { 10026, "NFS4ERR_BAD_SEQID" },
1733 { 10027, "NFS4ERR_NOT_SAME" },
1734 { 10028, "NFS4ERR_LOCK_RANGE" },
1735 { 10029, "NFS4ERR_SYMLINK" },
1736 { 10030, "NFS4ERR_READDIR_NOSPC" },
1737 { 10031, "NFS4ERR_LEASE_MOVED" },
1738 { 10032, "NFS4ERR_ATTRNOTSUPP" },
1739 { 10033, "NFS4ERR_NO_GRACE" },
1740 { 10034, "NFS4ERR_RECLAIM_BAD" },
1741 { 10035, "NFS4ERR_RECLAIM_CONFLICT" },
1742 { 10036, "NFS4ERR_BADXDR" },
1743 { 10037, "NFS4ERR_LOCKS_HELD" },
1744 { 10038, "NFS4ERR_OPENMODE" },
1745 { 10039, "NFS4ERR_BADOWNER" },
1746 { 10040, "NFS4ERR_BADCHAR" },
1747 { 10041, "NFS4ERR_BADNAME" },
1748 { 10042, "NFS4ERR_BAD_RANGE" },
1749 { 10043, "NFS4ERR_LOCK_NOTSUPP" },
1750 { 10044, "NFS4ERR_OP_ILLEGAL" },
1751 { 10045, "NFS4ERR_DEADLOCK" },
1752 { 10046, "NFS4ERR_FILE_OPEN" },
1753 { 10047, "NFS4ERR_ADMIN_REVOKED" },
1754 { 10048, "NFS4ERR_CB_PATH_DOWN" },
1759 /* This function has been modified to support NFSv4 style error codes as
1760 * well as being backwards compatible with NFSv2 and NFSv3.
1763 dissect_stat_internal(tvbuff_t *tvb, int offset,
1764 proto_tree *tree, guint32* status, int nfsvers)
1768 stat = tvb_get_ntohl(tvb, offset+0);
1771 /* this gives the right NFSv2 number<->message relation */
1772 /* and makes it searchable via "nfs.status" */
1773 proto_tree_add_uint_format(tree, hf_nfs_nfsstat3, tvb,
1774 offset+0, 4, stat, "Status: %s (%u)",
1776 (nfsvers != 4)? names_nfs_stat: names_nfs_stat4,"%u"), stat);
1781 if (status) *status = stat;
1787 /* RFC 1094, Page 12..14 */
1789 dissect_stat(tvbuff_t *tvb, int offset, proto_tree *tree,
1792 return dissect_stat_internal(tvb, offset, tree, status, !4);
1796 /* RFC 1094, Page 12..14 */
1798 dissect_nfs2_rmdir_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree* tree)
1803 offset = dissect_stat(tvb, offset, tree, &status);
1806 proto_item_append_text(tree, ", RMDIR Reply");
1809 err=val_to_str(status, names_nfs_stat, "Unknown error:%u");
1810 if (check_col(pinfo->cinfo, COL_INFO)) {
1811 col_append_fstr(pinfo->cinfo, COL_INFO," Error:%s", err);
1813 proto_item_append_text(tree, ", RMDIR Reply Error:%s", err);
1820 dissect_nfs2_symlink_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree* tree)
1825 offset = dissect_stat(tvb, offset, tree, &status);
1828 proto_item_append_text(tree, ", SYMLINK Reply");
1831 err=val_to_str(status, names_nfs_stat, "Unknown error:%u");
1832 if (check_col(pinfo->cinfo, COL_INFO)) {
1833 col_append_fstr(pinfo->cinfo, COL_INFO," Error:%s", err);
1835 proto_item_append_text(tree, ", SYMLINK Reply Error:%s", err);
1842 dissect_nfs2_link_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree* tree)
1847 offset = dissect_stat(tvb, offset, tree, &status);
1850 proto_item_append_text(tree, ", LINK Reply");
1853 err=val_to_str(status, names_nfs_stat, "Unknown error:%u");
1854 if (check_col(pinfo->cinfo, COL_INFO)) {
1855 col_append_fstr(pinfo->cinfo, COL_INFO," Error:%s", err);
1857 proto_item_append_text(tree, ", LINK Reply Error:%s", err);
1864 dissect_nfs2_rename_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree* tree)
1869 offset = dissect_stat(tvb, offset, tree, &status);
1872 proto_item_append_text(tree, ", RENAME Reply");
1875 err=val_to_str(status, names_nfs_stat, "Unknown error:%u");
1876 if (check_col(pinfo->cinfo, COL_INFO)) {
1877 col_append_fstr(pinfo->cinfo, COL_INFO," Error:%s", err);
1879 proto_item_append_text(tree, ", RENAME Reply Error:%s", err);
1886 dissect_nfs2_remove_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree* tree)
1891 offset = dissect_stat(tvb, offset, tree, &status);
1894 proto_item_append_text(tree, ", REMOVE Reply");
1897 err=val_to_str(status, names_nfs_stat, "Unknown error:%u");
1898 if (check_col(pinfo->cinfo, COL_INFO)) {
1899 col_append_fstr(pinfo->cinfo, COL_INFO," Error:%s", err);
1901 proto_item_append_text(tree, ", REMOVE Reply Error:%s", err);
1909 dissect_nfs_nfsstat4(tvbuff_t *tvb, int offset,
1910 proto_tree *tree, guint32 *status)
1912 return dissect_stat_internal(tvb, offset, tree, status, 4);
1916 /* RFC 1094, Page 15 */
1918 dissect_ftype(tvbuff_t *tvb, int offset, proto_tree *tree, char* name)
1921 char* ftype_name = NULL;
1923 const value_string nfs2_ftype[] =
1926 { 1, "Regular File" },
1928 { 3, "Block Special Device" },
1929 { 4, "Character Special Device" },
1930 { 5, "Symbolic Link" },
1934 ftype = tvb_get_ntohl(tvb, offset+0);
1935 ftype_name = val_to_str(ftype, nfs2_ftype, "%u");
1938 proto_tree_add_text(tree, tvb, offset, 4,
1939 "%s: %s (%u)", name, ftype_name, ftype);
1947 /* RFC 1094, Page 15 */
1949 dissect_fhandle(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree,
1950 char *name, guint32 *hash)
1953 proto_tree* ftree = NULL;
1956 fitem = proto_tree_add_text(tree, tvb, offset, FHSIZE,
1959 ftree = proto_item_add_subtree(fitem, ett_nfs_fhandle);
1962 /* are we snooping fh to filenames ?*/
1963 if((!pinfo->fd->flags.visited) && nfs_file_name_snooping){
1964 rpc_call_info_value *civ=pinfo->private_data;
1966 /* NFS v2 LOOKUP, CREATE, MKDIR calls might give us a mapping*/
1967 if( (civ->prog==100003)
1970 &&((civ->proc==4)||(civ->proc==9)||(civ->proc==14))
1972 nfs_name_snoop_add_fh(civ->xid, tvb,
1976 /* MOUNT v1,v2 MNT replies might give us a filehandle*/
1977 if( (civ->prog==100005)
1979 &&((civ->vers==1)||(civ->vers==2))
1982 nfs_name_snoop_add_fh(civ->xid, tvb,
1987 dissect_fhandle_data(tvb, offset, pinfo, ftree, FHSIZE, FALSE, hash);
1993 /* RFC 1094, Page 15 */
1995 dissect_nfs2_statfs_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
1999 offset = dissect_fhandle(tvb, offset, pinfo, tree, "object", &hash);
2001 if (check_col(pinfo->cinfo, COL_INFO)) {
2002 col_append_fstr(pinfo->cinfo, COL_INFO,", FH:0x%08x", hash);
2004 proto_item_append_text(tree, ", STATFS Call FH:0x%08x", hash);
2010 dissect_nfs2_readlink_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
2014 offset = dissect_fhandle(tvb, offset, pinfo, tree, "object", &hash);
2016 if (check_col(pinfo->cinfo, COL_INFO)) {
2017 col_append_fstr(pinfo->cinfo, COL_INFO,", FH:0x%08x", hash);
2019 proto_item_append_text(tree, ", READLINK Call FH:0x%08x", hash);
2025 dissect_nfs2_getattr_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
2029 offset = dissect_fhandle(tvb, offset, pinfo, tree, "object", &hash);
2031 if (check_col(pinfo->cinfo, COL_INFO)) {
2032 col_append_fstr(pinfo->cinfo, COL_INFO,", FH:0x%08x", hash);
2034 proto_item_append_text(tree, ", GETATTR Call FH:0x%08x", hash);
2040 /* RFC 1094, Page 15 */
2042 dissect_timeval(tvbuff_t *tvb, int offset, proto_tree *tree, int hf_time, int hf_time_sec, int hf_time_usec)
2048 proto_item* time_item;
2049 proto_tree* time_tree = NULL;
2051 seconds = tvb_get_ntohl(tvb, offset+0);
2052 useconds = tvb_get_ntohl(tvb, offset+4);
2054 ts.nsecs = useconds*1000;
2057 time_item = proto_tree_add_time(tree, hf_time, tvb, offset, 8,
2060 time_tree = proto_item_add_subtree(time_item, ett_nfs_timeval);
2064 proto_tree_add_uint(time_tree, hf_time_sec, tvb, offset, 4,
2066 proto_tree_add_uint(time_tree, hf_time_usec, tvb, offset+4, 4,
2074 /* RFC 1094, Page 16 */
2075 static const value_string nfs2_mode_names[] = {
2076 { 0040000, "Directory" },
2077 { 0020000, "Character Special Device" },
2078 { 0060000, "Block Special Device" },
2079 { 0100000, "Regular File" },
2080 { 0120000, "Symbolic Link" },
2081 { 0140000, "Named Socket" },
2086 dissect_mode(tvbuff_t *tvb, int offset, proto_tree *tree, char* name)
2089 proto_item* mode_item = NULL;
2090 proto_tree* mode_tree = NULL;
2092 mode = tvb_get_ntohl(tvb, offset+0);
2095 mode_item = proto_tree_add_text(tree, tvb, offset, 4,
2096 "%s: 0%o", name, mode);
2098 mode_tree = proto_item_add_subtree(mode_item, ett_nfs_mode);
2102 proto_tree_add_text(mode_tree, tvb, offset, 4, "%s",
2103 decode_enumerated_bitfield(mode, 0160000, 16,
2104 nfs2_mode_names, "%s"));
2105 proto_tree_add_text(mode_tree, tvb, offset, 4, "%s",
2106 decode_boolean_bitfield(mode, 04000, 16, "Set user id on exec", "not SUID"));
2107 proto_tree_add_text(mode_tree, tvb, offset, 4, "%s",
2108 decode_boolean_bitfield(mode, 02000, 16, "Set group id on exec", "not SGID"));
2109 proto_tree_add_text(mode_tree, tvb, offset, 4, "%s",
2110 decode_boolean_bitfield(mode, 01000, 16, "Save swapped text even after use", "not save swapped text"));
2111 proto_tree_add_text(mode_tree, tvb, offset, 4, "%s",
2112 decode_boolean_bitfield(mode, 0400, 16, "Read permission for owner", "no Read permission for owner"));
2113 proto_tree_add_text(mode_tree, tvb, offset, 4, "%s",
2114 decode_boolean_bitfield(mode, 0200, 16, "Write permission for owner", "no Write permission for owner"));
2115 proto_tree_add_text(mode_tree, tvb, offset, 4, "%s",
2116 decode_boolean_bitfield(mode, 0100, 16, "Execute permission for owner", "no Execute permission for owner"));
2117 proto_tree_add_text(mode_tree, tvb, offset, 4, "%s",
2118 decode_boolean_bitfield(mode, 040, 16, "Read permission for group", "no Read permission for group"));
2119 proto_tree_add_text(mode_tree, tvb, offset, 4, "%s",
2120 decode_boolean_bitfield(mode, 020, 16, "Write permission for group", "no Write permission for group"));
2121 proto_tree_add_text(mode_tree, tvb, offset, 4, "%s",
2122 decode_boolean_bitfield(mode, 010, 16, "Execute permission for group", "no Execute permission for group"));
2123 proto_tree_add_text(mode_tree, tvb, offset, 4, "%s",
2124 decode_boolean_bitfield(mode, 04, 16, "Read permission for others", "no Read permission for others"));
2125 proto_tree_add_text(mode_tree, tvb, offset, 4, "%s",
2126 decode_boolean_bitfield(mode, 02, 16, "Write permission for others", "no Write permission for others"));
2127 proto_tree_add_text(mode_tree, tvb, offset, 4, "%s",
2128 decode_boolean_bitfield(mode, 01, 16, "Execute permission for others", "no Execute permission for others"));
2136 /* RFC 1094, Page 15 */
2138 dissect_fattr(tvbuff_t *tvb, int offset, proto_tree *tree, char* name)
2140 proto_item* fattr_item = NULL;
2141 proto_tree* fattr_tree = NULL;
2142 int old_offset = offset;
2145 fattr_item = proto_tree_add_text(tree, tvb, offset, -1,
2147 fattr_tree = proto_item_add_subtree(fattr_item, ett_nfs_fattr);
2150 offset = dissect_ftype(tvb, offset, fattr_tree, "type");
2151 offset = dissect_mode(tvb, offset, fattr_tree, "mode");
2152 offset = dissect_rpc_uint32(tvb, fattr_tree, hf_nfs_fattr_nlink, offset);
2153 offset = dissect_rpc_uint32(tvb, fattr_tree, hf_nfs_fattr_uid, offset);
2154 offset = dissect_rpc_uint32(tvb, fattr_tree, hf_nfs_fattr_gid, offset);
2155 offset = dissect_rpc_uint32(tvb, fattr_tree, hf_nfs_fattr_size, offset);
2156 offset = dissect_rpc_uint32(tvb, fattr_tree, hf_nfs_fattr_blocksize, offset);
2157 offset = dissect_rpc_uint32(tvb, fattr_tree, hf_nfs_fattr_rdev, offset);
2158 offset = dissect_rpc_uint32(tvb, fattr_tree, hf_nfs_fattr_blocks, offset);
2159 offset = dissect_rpc_uint32(tvb, fattr_tree, hf_nfs_fattr_fsid, offset);
2160 offset = dissect_rpc_uint32(tvb, fattr_tree, hf_nfs_fattr_fileid, offset);
2162 offset = dissect_timeval(tvb, offset, fattr_tree, hf_nfs_atime, hf_nfs_atime_sec, hf_nfs_atime_usec);
2163 offset = dissect_timeval(tvb, offset, fattr_tree, hf_nfs_mtime, hf_nfs_mtime_sec, hf_nfs_mtime_usec);
2164 offset = dissect_timeval(tvb, offset, fattr_tree, hf_nfs_ctime, hf_nfs_ctime_sec, hf_nfs_ctime_usec);
2166 /* now we know, that fattr is shorter */
2168 proto_item_set_len(fattr_item, offset - old_offset);
2175 /* RFC 1094, Page 17 */
2177 dissect_sattr(tvbuff_t *tvb, int offset, proto_tree *tree, char* name)
2179 proto_item* sattr_item = NULL;
2180 proto_tree* sattr_tree = NULL;
2181 int old_offset = offset;
2184 sattr_item = proto_tree_add_text(tree, tvb, offset, -1,
2186 sattr_tree = proto_item_add_subtree(sattr_item, ett_nfs_sattr);
2189 if (tvb_get_ntohl(tvb, offset+0) != 0xffffffff)
2190 offset = dissect_mode(tvb, offset, sattr_tree, "mode");
2192 proto_tree_add_text(sattr_tree, tvb, offset, 4, "mode: no value");
2196 if (tvb_get_ntohl(tvb, offset+0) != 0xffffffff)
2197 offset = dissect_rpc_uint32(tvb, sattr_tree, hf_nfs_fattr_uid,
2200 proto_tree_add_text(sattr_tree, tvb, offset, 4, "uid: no value");
2204 if (tvb_get_ntohl(tvb, offset+0) != 0xffffffff)
2205 offset = dissect_rpc_uint32(tvb, sattr_tree, hf_nfs_fattr_gid,
2208 proto_tree_add_text(sattr_tree, tvb, offset, 4, "gid: no value");
2212 if (tvb_get_ntohl(tvb, offset+0) != 0xffffffff)
2213 offset = dissect_rpc_uint32(tvb, sattr_tree, hf_nfs_fattr_size,
2216 proto_tree_add_text(sattr_tree, tvb, offset, 4, "size: no value");
2220 if (tvb_get_ntohl(tvb, offset+0) != 0xffffffff) {
2221 offset = dissect_timeval(tvb, offset, sattr_tree, hf_nfs_atime, hf_nfs_atime_sec, hf_nfs_atime_usec);
2223 proto_tree_add_text(sattr_tree, tvb, offset, 8, "atime: no value");
2227 if (tvb_get_ntohl(tvb, offset+0) != 0xffffffff) {
2228 offset = dissect_timeval(tvb, offset, sattr_tree, hf_nfs_mtime, hf_nfs_mtime_sec, hf_nfs_mtime_usec);
2230 proto_tree_add_text(sattr_tree, tvb, offset, 8, "mtime: no value");
2234 /* now we know, that sattr is shorter */
2236 proto_item_set_len(sattr_item, offset - old_offset);
2243 /* RFC 1094, Page 17 */
2245 dissect_filename(tvbuff_t *tvb, int offset,
2246 proto_tree *tree, int hf, char **string_ret)
2248 offset = dissect_rpc_string(tvb, tree, hf, offset, string_ret);
2253 /* RFC 1094, Page 17 */
2255 dissect_path(tvbuff_t *tvb, int offset, proto_tree *tree, int hf, char **name)
2257 offset = dissect_rpc_string(tvb, tree, hf, offset, name);
2262 /* RFC 1094, Page 17,18 */
2264 dissect_attrstat(tvbuff_t *tvb, int offset, proto_tree *tree, packet_info *pinfo, char *funcname)
2269 offset = dissect_stat(tvb, offset, tree, &status);
2272 offset = dissect_fattr(tvb, offset, tree, "attributes");
2273 proto_item_append_text(tree, ", %s Reply", funcname);
2276 err=val_to_str(status, names_nfs_stat, "Unknown error:%u");
2277 if (check_col(pinfo->cinfo, COL_INFO)) {
2278 col_append_fstr(pinfo->cinfo, COL_INFO," Error:%s", err);
2280 proto_item_append_text(tree, ", %s Reply Error:%s", funcname, err);
2288 /* RFC 1094, Page 17,18 */
2290 dissect_nfs2_write_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree* tree)
2292 offset = dissect_attrstat(tvb, offset, tree, pinfo, "WRITE");
2298 dissect_nfs2_setattr_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree* tree)
2300 offset = dissect_attrstat(tvb, offset, tree, pinfo, "SETATTR");
2306 dissect_nfs2_getattr_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree* tree)
2308 offset = dissect_attrstat(tvb, offset, tree, pinfo, "GETATTR");
2314 /* RFC 1094, Page 18 */
2316 dissect_diropargs(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, char* label, guint32 *hash, char **name)
2318 proto_item* diropargs_item = NULL;
2319 proto_tree* diropargs_tree = NULL;
2320 int old_offset = offset;
2323 diropargs_item = proto_tree_add_text(tree, tvb, offset, -1,
2325 diropargs_tree = proto_item_add_subtree(diropargs_item, ett_nfs_diropargs);
2328 /* are we snooping fh to filenames ?*/
2329 if((!pinfo->fd->flags.visited) && nfs_file_name_snooping){
2330 /* v2 LOOKUP, CREATE, MKDIR calls might give us a mapping*/
2331 rpc_call_info_value *civ=pinfo->private_data;
2333 if( (civ->prog==100003)
2336 &&((civ->proc==4)||(civ->proc==9)||(civ->proc==14))
2338 nfs_name_snoop_add_name(civ->xid, tvb,
2339 offset+36, tvb_get_ntohl(tvb, offset+32),
2344 offset = dissect_fhandle(tvb, offset, pinfo, diropargs_tree, "dir", hash);
2345 offset = dissect_filename(tvb, offset, diropargs_tree, hf_nfs_name, name);
2347 /* now we know, that diropargs is shorter */
2348 if (diropargs_item) {
2349 proto_item_set_len(diropargs_item, offset - old_offset);
2356 /* RFC 1094, Page 18 */
2358 dissect_nfs2_rmdir_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
2363 offset = dissect_diropargs(tvb, offset, pinfo, tree, "where", &hash, &name);
2365 if (check_col(pinfo->cinfo, COL_INFO)) {
2366 col_append_fstr(pinfo->cinfo, COL_INFO,", DH:0x%08x/%s", hash, name);
2368 proto_item_append_text(tree, ", RMDIR Call DH:0x%08x/%s", hash, name);
2375 dissect_nfs2_remove_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
2380 offset = dissect_diropargs(tvb, offset, pinfo, tree, "where", &hash, &name);
2382 if (check_col(pinfo->cinfo, COL_INFO)) {
2383 col_append_fstr(pinfo->cinfo, COL_INFO,", DH:0x%08x/%s", hash, name);
2385 proto_item_append_text(tree, ", REMOVE Call DH:0x%08x/%s", hash, name);
2392 dissect_nfs2_lookup_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
2397 offset = dissect_diropargs(tvb, offset, pinfo, tree, "where", &hash, &name);
2399 if (check_col(pinfo->cinfo, COL_INFO)) {
2400 col_append_fstr(pinfo->cinfo, COL_INFO,", DH:0x%08x/%s", hash, name);
2402 proto_item_append_text(tree, ", LOOKUP Call DH:0x%08x/%s", hash, name);
2409 /* RFC 1094, Page 18 */
2411 dissect_diropres(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, char *funcname)
2417 offset = dissect_stat(tvb, offset, tree, &status);
2420 offset = dissect_fhandle(tvb, offset, pinfo, tree, "file", &hash);
2421 offset = dissect_fattr (tvb, offset, tree, "attributes");
2422 if (check_col(pinfo->cinfo, COL_INFO)) {
2423 col_append_fstr(pinfo->cinfo, COL_INFO,", FH:0x%08x", hash);
2425 proto_item_append_text(tree, ", %s Reply FH:0x%08x", funcname, hash);
2428 err=val_to_str(status, names_nfs_stat, "Unknown error:%u");
2429 if (check_col(pinfo->cinfo, COL_INFO)) {
2430 col_append_fstr(pinfo->cinfo, COL_INFO," Error:%s", err);
2432 proto_item_append_text(tree, ", %s Reply Error:%s", funcname, err);
2440 /* nfsdata is simply a chunk of RPC opaque data (length, data, fill bytes) */
2442 dissect_nfsdata(tvbuff_t *tvb, int offset, proto_tree *tree, int hf)
2444 offset = dissect_rpc_data(tvb, tree, hf, offset);
2449 /* RFC 1094, Page 18 */
2451 dissect_nfs2_mkdir_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
2454 offset = dissect_diropres(tvb, offset, pinfo, tree, "MKDIR");
2459 dissect_nfs2_create_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
2462 offset = dissect_diropres(tvb, offset, pinfo, tree, "CREATE");
2467 dissect_nfs2_lookup_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
2470 offset = dissect_diropres(tvb, offset, pinfo, tree, "LOOKUP");
2475 /* RFC 1094, Page 6 */
2477 dissect_nfs2_setattr_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
2482 offset = dissect_fhandle(tvb, offset, pinfo, tree, "file", &hash);
2483 offset = dissect_sattr (tvb, offset, tree, "attributes");
2485 if (check_col(pinfo->cinfo, COL_INFO)) {
2486 col_append_fstr(pinfo->cinfo, COL_INFO,", FH:0x%08x", hash);
2488 proto_item_append_text(tree, ", SETATTR Call FH:0x%08x", hash);
2493 /* RFC 1094, Page 6 */
2495 dissect_nfs2_readlink_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
2502 offset = dissect_stat(tvb, offset, tree, &status);
2505 offset = dissect_path(tvb, offset, tree, hf_nfs_readlink_data, &name);
2506 if (check_col(pinfo->cinfo, COL_INFO)) {
2507 col_append_fstr(pinfo->cinfo, COL_INFO," Path:%s", name);
2509 proto_item_append_text(tree, ", READLINK Reply Path:%s", name);
2513 err=val_to_str(status, names_nfs_stat, "Unknown error:%u");
2514 if (check_col(pinfo->cinfo, COL_INFO)) {
2515 col_append_fstr(pinfo->cinfo, COL_INFO," Error:%s", err);
2517 proto_item_append_text(tree, ", READLINK Reply Error:%s", err);
2525 /* RFC 1094, Page 7 */
2527 dissect_nfs2_read_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
2530 guint32 offset_value;
2535 offset = dissect_fhandle(tvb, offset, pinfo, tree, "file", &hash);
2536 offset_value = tvb_get_ntohl(tvb, offset+0);
2537 count = tvb_get_ntohl(tvb, offset+4);
2538 totalcount = tvb_get_ntohl(tvb, offset+8);
2540 proto_tree_add_uint(tree, hf_nfs_read_offset, tvb,
2541 offset+0, 4, offset_value);
2542 proto_tree_add_uint(tree, hf_nfs_read_count, tvb,
2543 offset+4, 4, count);
2544 proto_tree_add_uint(tree, hf_nfs_read_totalcount, tvb,
2545 offset+8, 4, totalcount);
2549 if (check_col(pinfo->cinfo, COL_INFO)) {
2550 col_append_fstr(pinfo->cinfo, COL_INFO,", FH:0x%08x Offset:%d Count:%d TotalCount:%d", hash, offset_value, count, totalcount);
2552 proto_item_append_text(tree, ", READ Call FH:0x%08x Offset:%d Count:%d TotalCount:%d", hash, offset_value, count, totalcount);
2558 /* RFC 1094, Page 7 */
2560 dissect_nfs2_read_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
2566 offset = dissect_stat(tvb, offset, tree, &status);
2569 offset = dissect_fattr(tvb, offset, tree, "attributes");
2570 proto_item_append_text(tree, ", READ Reply");
2571 offset = dissect_nfsdata(tvb, offset, tree, hf_nfs_data);
2574 err=val_to_str(status, names_nfs_stat, "Unknown error:%u");
2575 if (check_col(pinfo->cinfo, COL_INFO)) {
2576 col_append_fstr(pinfo->cinfo, COL_INFO," Error:%s", err);
2578 proto_item_append_text(tree, ", READ Reply Error:%s", err);
2586 /* RFC 1094, Page 8 */
2588 dissect_nfs2_write_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
2591 guint32 beginoffset;
2592 guint32 offset_value;
2596 offset = dissect_fhandle(tvb, offset, pinfo, tree, "file", &hash);
2597 beginoffset = tvb_get_ntohl(tvb, offset+0);
2598 offset_value = tvb_get_ntohl(tvb, offset+4);
2599 totalcount = tvb_get_ntohl(tvb, offset+8);
2601 proto_tree_add_uint(tree, hf_nfs_write_beginoffset, tvb,
2602 offset+0, 4, beginoffset);
2603 proto_tree_add_uint(tree, hf_nfs_write_offset, tvb,
2604 offset+4, 4, offset_value);
2605 proto_tree_add_uint(tree, hf_nfs_write_totalcount, tvb,
2606 offset+8, 4, totalcount);
2610 if (check_col(pinfo->cinfo, COL_INFO)) {
2611 col_append_fstr(pinfo->cinfo, COL_INFO,", FH:0x%08x BeginOffset:%d Offset:%d TotalCount:%d", hash, beginoffset, offset_value, totalcount);
2613 proto_item_append_text(tree, ", WRITE Call FH:0x%08x BeginOffset:%d Offset:%d TotalCount:%d", hash, beginoffset, offset_value, totalcount);
2615 offset = dissect_nfsdata(tvb, offset, tree, hf_nfs_data);
2621 /* RFC 1094, Page 8 */
2623 dissect_nfs2_mkdir_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
2629 offset = dissect_diropargs(tvb, offset, pinfo, tree, "where", &hash, &name);
2630 offset = dissect_sattr (tvb, offset, tree, "attributes");
2632 if (check_col(pinfo->cinfo, COL_INFO)) {
2633 col_append_fstr(pinfo->cinfo, COL_INFO,", DH:0x%08x/%s", hash, name);
2635 proto_item_append_text(tree, ", MKDIR Call DH:0x%08x/%s", hash, name);
2642 dissect_nfs2_create_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
2648 offset = dissect_diropargs(tvb, offset, pinfo, tree, "where", &hash, &name);
2649 offset = dissect_sattr (tvb, offset, tree, "attributes");
2651 if (check_col(pinfo->cinfo, COL_INFO)) {
2652 col_append_fstr(pinfo->cinfo, COL_INFO,", DH:0x%08x/%s", hash, name);
2654 proto_item_append_text(tree, ", CREATE Call DH:0x%08x/%s", hash, name);
2661 /* RFC 1094, Page 9 */
2663 dissect_nfs2_rename_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
2667 char *from_name=NULL;
2671 offset = dissect_diropargs(tvb, offset, pinfo, tree, "from", &from_hash, &from_name);
2672 offset = dissect_diropargs(tvb, offset, pinfo, tree, "to", &to_hash, &to_name);
2674 if (check_col(pinfo->cinfo, COL_INFO)) {
2675 col_append_fstr(pinfo->cinfo, COL_INFO,", From DH:0x%08x/%s To DH:0x%08x/%s", from_hash, from_name, to_hash, to_name);
2677 proto_item_append_text(tree, ", RENAME Call From DH:0x%08x/%s To DH:0x%08x/%s", from_hash, from_name, to_hash, to_name);
2685 /* RFC 1094, Page 9 */
2687 dissect_nfs2_link_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
2694 offset = dissect_fhandle(tvb, offset, pinfo, tree, "from", &from_hash);
2695 offset = dissect_diropargs(tvb, offset, pinfo, tree, "to", &to_hash, &to_name);
2697 if (check_col(pinfo->cinfo, COL_INFO)) {
2698 col_append_fstr(pinfo->cinfo, COL_INFO,", From DH:0x%08x To DH:0x%08x/%s", from_hash, to_hash, to_name);
2700 proto_item_append_text(tree, ", LINK Call From DH:0x%08x To DH:0x%08x/%s", from_hash, to_hash, to_name);
2707 /* RFC 1094, Page 10 */
2709 dissect_nfs2_symlink_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
2713 char *from_name=NULL;
2716 offset = dissect_diropargs(tvb, offset, pinfo, tree, "from", &from_hash, &from_name);
2717 offset = dissect_path(tvb, offset, tree, hf_nfs_symlink_to, &to_name);
2718 offset = dissect_sattr(tvb, offset, tree, "attributes");
2720 if (check_col(pinfo->cinfo, COL_INFO)) {
2721 col_append_fstr(pinfo->cinfo, COL_INFO,", From DH:0x%08x/%s To %s", from_hash, from_name, to_name);
2723 proto_item_append_text(tree, ", SYMLINK Call From DH:0x%08x/%s To %s", from_hash, from_name, to_name);
2731 /* RFC 1094, Page 11 */
2733 dissect_nfs2_readdir_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
2740 offset = dissect_fhandle(tvb, offset, pinfo, tree, "dir", &hash);
2741 cookie = tvb_get_ntohl(tvb, offset+ 0);
2742 count = tvb_get_ntohl(tvb, offset+ 4);
2744 proto_tree_add_uint(tree, hf_nfs_readdir_cookie, tvb,
2745 offset+ 0, 4, cookie);
2746 proto_tree_add_uint(tree, hf_nfs_readdir_count, tvb,
2747 offset+ 4, 4, count);
2751 if (check_col(pinfo->cinfo, COL_INFO)) {
2752 col_append_fstr(pinfo->cinfo, COL_INFO,", FH:0x%08x", hash);
2754 proto_item_append_text(tree, ", READDIR Call FH:0x%08x", hash);
2760 /* RFC 1094, Page 11 */
2762 dissect_readdir_entry(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
2765 proto_item* entry_item = NULL;
2766 proto_tree* entry_tree = NULL;
2767 int old_offset = offset;
2773 entry_item = proto_tree_add_item(tree, hf_nfs_readdir_entry, tvb,
2774 offset+0, -1, FALSE);
2775 entry_tree = proto_item_add_subtree(entry_item, ett_nfs_readdir_entry);
2778 fileid = tvb_get_ntohl(tvb, offset + 0);
2780 proto_tree_add_uint(entry_tree, hf_nfs_readdir_entry_fileid, tvb,
2781 offset+0, 4, fileid);
2784 offset = dissect_filename(tvb, offset, entry_tree,
2785 hf_nfs_readdir_entry_name, &name);
2787 proto_item_set_text(entry_item, "Entry: file ID %u, name %s",
2791 cookie = tvb_get_ntohl(tvb, offset + 0);
2793 proto_tree_add_uint(entry_tree, hf_nfs_readdir_entry_cookie, tvb,
2794 offset+0, 4, cookie);
2797 /* now we know, that a readdir entry is shorter */
2799 proto_item_set_len(entry_item, offset - old_offset);
2805 /* RFC 1094, Page 11 */
2807 dissect_nfs2_readdir_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
2814 offset = dissect_stat(tvb, offset, tree, &status);
2817 proto_item_append_text(tree, ", READDIR Reply");
2819 offset = dissect_rpc_list(tvb, pinfo, tree, offset,
2820 dissect_readdir_entry);
2821 eof_value = tvb_get_ntohl(tvb, offset+0);
2823 proto_tree_add_uint(tree, hf_nfs_readdir_eof, tvb,
2824 offset+ 0, 4, eof_value);
2828 err=val_to_str(status, names_nfs_stat, "Unknown error:%u");
2829 if (check_col(pinfo->cinfo, COL_INFO)) {
2830 col_append_fstr(pinfo->cinfo, COL_INFO," Error:%s", err);
2832 proto_item_append_text(tree, ", READDIR Reply Error:%s", err);
2840 /* RFC 1094, Page 12 */
2842 dissect_nfs2_statfs_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
2853 offset = dissect_stat(tvb, offset, tree, &status);
2856 tsize = tvb_get_ntohl(tvb, offset+ 0);
2857 bsize = tvb_get_ntohl(tvb, offset+ 4);
2858 blocks = tvb_get_ntohl(tvb, offset+ 8);
2859 bfree = tvb_get_ntohl(tvb, offset+12);
2860 bavail = tvb_get_ntohl(tvb, offset+16);
2862 proto_tree_add_uint(tree, hf_nfs_statfs_tsize, tvb,
2863 offset+ 0, 4, tsize);
2864 proto_tree_add_uint(tree, hf_nfs_statfs_bsize, tvb,
2865 offset+ 4, 4, bsize);
2866 proto_tree_add_uint(tree, hf_nfs_statfs_blocks, tvb,
2867 offset+ 8, 4, blocks);
2868 proto_tree_add_uint(tree, hf_nfs_statfs_bfree, tvb,
2869 offset+12, 4, bfree);
2870 proto_tree_add_uint(tree, hf_nfs_statfs_bavail, tvb,
2871 offset+16, 4, bavail);
2874 proto_item_append_text(tree, ", STATFS Reply");
2877 err=val_to_str(status, names_nfs_stat, "Unknown error:%u");
2878 if (check_col(pinfo->cinfo, COL_INFO)) {
2879 col_append_fstr(pinfo->cinfo, COL_INFO," Error:%s", err);
2881 proto_item_append_text(tree, ", STATFS Reply Error:%s", err);
2889 /* proc number, "proc name", dissect_request, dissect_reply */
2890 /* NULL as function pointer means: type of arguments is "void". */
2891 static const vsff nfs2_proc[] = {
2892 { 0, "NULL", /* OK */
2894 { 1, "GETATTR", /* OK */
2895 dissect_nfs2_getattr_call, dissect_nfs2_getattr_reply },
2896 { 2, "SETATTR", /* OK */
2897 dissect_nfs2_setattr_call, dissect_nfs2_setattr_reply },
2898 { 3, "ROOT", /* OK */
2900 { 4, "LOOKUP", /* OK */
2901 dissect_nfs2_lookup_call, dissect_nfs2_lookup_reply },
2902 { 5, "READLINK", /* OK */
2903 dissect_nfs2_readlink_call, dissect_nfs2_readlink_reply },
2904 { 6, "READ", /* OK */
2905 dissect_nfs2_read_call, dissect_nfs2_read_reply },
2906 { 7, "WRITECACHE", /* OK */
2908 { 8, "WRITE", /* OK */
2909 dissect_nfs2_write_call, dissect_nfs2_write_reply },
2910 { 9, "CREATE", /* OK */
2911 dissect_nfs2_create_call, dissect_nfs2_create_reply },
2912 { 10, "REMOVE", /* OK */
2913 dissect_nfs2_remove_call, dissect_nfs2_remove_reply },
2914 { 11, "RENAME", /* OK */
2915 dissect_nfs2_rename_call, dissect_nfs2_rename_reply },
2916 { 12, "LINK", /* OK */
2917 dissect_nfs2_link_call, dissect_nfs2_link_reply },
2918 { 13, "SYMLINK", /* OK */
2919 dissect_nfs2_symlink_call, dissect_nfs2_symlink_reply },
2920 { 14, "MKDIR", /* OK */
2921 dissect_nfs2_mkdir_call, dissect_nfs2_mkdir_reply },
2922 { 15, "RMDIR", /* OK */
2923 dissect_nfs2_rmdir_call, dissect_nfs2_rmdir_reply },
2924 { 16, "READDIR", /* OK */
2925 dissect_nfs2_readdir_call, dissect_nfs2_readdir_reply },
2926 { 17, "STATFS", /* OK */
2927 dissect_nfs2_statfs_call, dissect_nfs2_statfs_reply },
2928 { 0,NULL,NULL,NULL }
2931 static const value_string nfsv2_proc_vals[] = {
2939 { 7, "WRITECACHE" },
2953 /* end of NFS Version 2 */
2956 /***************************/
2957 /* NFS Version 3, RFC 1813 */
2958 /***************************/
2961 /* RFC 1813, Page 15 */
2963 dissect_filename3(tvbuff_t *tvb, int offset,
2964 proto_tree *tree, int hf, char **string_ret)
2966 offset = dissect_rpc_string(tvb, tree, hf, offset, string_ret);
2971 /* RFC 1813, Page 15 */
2973 dissect_nfspath3(tvbuff_t *tvb, int offset, proto_tree *tree, int hf, char **name)
2975 offset = dissect_rpc_string(tvb, tree, hf, offset, name);
2979 /* RFC 1813, Page 15 */
2981 dissect_cookieverf3(tvbuff_t *tvb, int offset, proto_tree *tree)
2983 proto_tree_add_text(tree, tvb, offset, NFS3_COOKIEVERFSIZE,
2984 "Verifier: Opaque Data");
2985 offset += NFS3_COOKIEVERFSIZE;
2990 /* RFC 1813, Page 16 */
2992 dissect_createverf3(tvbuff_t *tvb, int offset, proto_tree *tree)
2994 proto_tree_add_text(tree, tvb, offset, NFS3_CREATEVERFSIZE,
2995 "Verifier: Opaque Data");
2996 offset += NFS3_CREATEVERFSIZE;
3001 /* RFC 1813, Page 16 */
3003 dissect_writeverf3(tvbuff_t *tvb, int offset, proto_tree *tree)
3005 proto_tree_add_text(tree, tvb, offset, NFS3_WRITEVERFSIZE,
3006 "Verifier: Opaque Data");
3007 offset += NFS3_WRITEVERFSIZE;
3011 /* RFC 1813, Page 16 */
3013 dissect_mode3(tvbuff_t *tvb, int offset, proto_tree *tree, char* name)
3016 proto_item* mode3_item = NULL;
3017 proto_tree* mode3_tree = NULL;
3019 mode3 = tvb_get_ntohl(tvb, offset+0);
3022 mode3_item = proto_tree_add_text(tree, tvb, offset, 4,
3023 "%s: 0%o", name, mode3);
3025 mode3_tree = proto_item_add_subtree(mode3_item, ett_nfs_mode3);
3028 /* RFC 1813, Page 23 */
3030 proto_tree_add_text(mode3_tree, tvb, offset, 4, "%s",
3031 decode_boolean_bitfield(mode3, 0x800, 12, "Set user id on exec", "not SUID"));
3032 proto_tree_add_text(mode3_tree, tvb, offset, 4, "%s",
3033 decode_boolean_bitfield(mode3, 0x400, 12, "Set group id on exec", "not SGID"));
3034 proto_tree_add_text(mode3_tree, tvb, offset, 4, "%s",
3035 decode_boolean_bitfield(mode3, 0x200, 12, "Save swapped text even after use", "not save swapped text"));
3036 proto_tree_add_text(mode3_tree, tvb, offset, 4, "%s",
3037 decode_boolean_bitfield(mode3, 0x100, 12, "Read permission for owner", "no Read permission for owner"));
3038 proto_tree_add_text(mode3_tree, tvb, offset, 4, "%s",
3039 decode_boolean_bitfield(mode3, 0x80, 12, "Write permission for owner", "no Write permission for owner"));
3040 proto_tree_add_text(mode3_tree, tvb, offset, 4, "%s",
3041 decode_boolean_bitfield(mode3, 0x40, 12, "Execute permission for owner", "no Execute permission for owner"));
3042 proto_tree_add_text(mode3_tree, tvb, offset, 4, "%s",
3043 decode_boolean_bitfield(mode3, 0x20, 12, "Read permission for group", "no Read permission for group"));
3044 proto_tree_add_text(mode3_tree, tvb, offset, 4, "%s",
3045 decode_boolean_bitfield(mode3, 0x10, 12, "Write permission for group", "no Write permission for group"));
3046 proto_tree_add_text(mode3_tree, tvb, offset, 4, "%s",
3047 decode_boolean_bitfield(mode3, 0x8, 12, "Execute permission for group", "no Execute permission for group"));
3048 proto_tree_add_text(mode3_tree, tvb, offset, 4, "%s",
3049 decode_boolean_bitfield(mode3, 0x4, 12, "Read permission for others", "no Read permission for others"));
3050 proto_tree_add_text(mode3_tree, tvb, offset, 4, "%s",
3051 decode_boolean_bitfield(mode3, 0x2, 12, "Write permission for others", "no Write permission for others"));
3052 proto_tree_add_text(mode3_tree, tvb, offset, 4, "%s",
3053 decode_boolean_bitfield(mode3, 0x1, 12, "Execute permission for others", "no Execute permission for others"));
3060 /* RFC 1813, Page 16,17 */
3061 static const value_string names_nfs_nfsstat3[] =
3068 { 13, "ERR_ACCES" },
3069 { 17, "ERR_EXIST" },
3071 { 19, "ERR_NODEV" },
3072 { 20, "ERR_NOTDIR" },
3073 { 21, "ERR_ISDIR" },
3074 { 22, "ERR_INVAL" },
3076 { 28, "ERR_NOSPC" },
3078 { 31, "ERR_MLINK" },
3079 { 63, "ERR_NAMETOOLONG" },
3080 { 66, "ERR_NOTEMPTY" },
3081 { 69, "ERR_DQUOT" },
3082 { 70, "ERR_STALE" },
3083 { 71, "ERR_REMOTE" },
3084 { 10001, "ERR_BADHANDLE" },
3085 { 10002, "ERR_NOT_SYNC" },
3086 { 10003, "ERR_BAD_COOKIE" },
3087 { 10004, "ERR_NOTSUPP" },
3088 { 10005, "ERR_TOOSMALL" },
3089 { 10006, "ERR_SERVERFAULT" },
3090 { 10007, "ERR_BADTYPE" },
3091 { 10008, "ERR_JUKEBOX" },
3096 /* RFC 1813, Page 16 */
3098 dissect_nfsstat3(tvbuff_t *tvb, int offset,
3099 proto_tree *tree,guint32 *status)
3103 nfsstat3 = tvb_get_ntohl(tvb, offset+0);
3106 proto_tree_add_uint(tree, hf_nfs_nfsstat3, tvb,
3107 offset, 4, nfsstat3);
3116 static const value_string names_nfs_ftype3[] =
3118 { NF3REG, "Regular File" },
3119 { NF3DIR, "Directory" },
3120 { NF3BLK, "Block Special Device" },
3121 { NF3CHR, "Character Special Device" },
3122 { NF3LNK, "Symbolic Link" },
3123 { NF3SOCK,"Socket" },
3124 { NF3FIFO,"Named Pipe" },
3129 /* RFC 1813, Page 20 */
3131 dissect_ftype3(tvbuff_t *tvb, int offset, proto_tree *tree,
3132 int hf, guint32* ftype3)
3136 type = tvb_get_ntohl(tvb, offset+0);
3139 proto_tree_add_uint(tree, hf, tvb, offset, 4, type);
3148 /* RFC 1813, Page 20 */
3150 dissect_specdata3(tvbuff_t *tvb, int offset, proto_tree *tree, char* name)
3155 proto_item* specdata3_item;
3156 proto_tree* specdata3_tree = NULL;
3158 specdata1 = tvb_get_ntohl(tvb, offset+0);
3159 specdata2 = tvb_get_ntohl(tvb, offset+4);
3162 specdata3_item = proto_tree_add_text(tree, tvb, offset, 8,
3163 "%s: %u,%u", name, specdata1, specdata2);
3165 specdata3_tree = proto_item_add_subtree(specdata3_item,
3169 if (specdata3_tree) {
3170 proto_tree_add_text(specdata3_tree, tvb,offset+0,4,
3171 "specdata1: %u", specdata1);
3172 proto_tree_add_text(specdata3_tree, tvb,offset+4,4,
3173 "specdata2: %u", specdata2);
3181 /* RFC 1813, Page 21 */
3183 dissect_nfs_fh3(tvbuff_t *tvb, int offset, packet_info *pinfo,
3184 proto_tree *tree, char *name, guint32 *hash)
3189 proto_item* fitem = NULL;
3190 proto_tree* ftree = NULL;
3191 int fh_offset,fh_length;
3193 fh3_len = tvb_get_ntohl(tvb, offset+0);
3194 fh3_len_full = rpc_roundup(fh3_len);
3195 fh3_fill = fh3_len_full - fh3_len;
3198 fitem = proto_tree_add_text(tree, tvb, offset, 4+fh3_len_full,
3201 ftree = proto_item_add_subtree(fitem, ett_nfs_fh3);
3204 /* are we snooping fh to filenames ?*/
3205 if((!pinfo->fd->flags.visited) && nfs_file_name_snooping){
3206 rpc_call_info_value *civ=pinfo->private_data;
3208 /* NFS v3 LOOKUP, CREATE, MKDIR calls might give us a mapping*/
3209 if( (civ->prog==100003)
3212 &&((civ->proc==3)||(civ->proc==8)||(civ->proc==9))
3214 fh_length=tvb_get_ntohl(tvb, offset);
3216 nfs_name_snoop_add_fh(civ->xid, tvb,
3217 fh_offset, fh_length);
3220 /* MOUNT v3 MNT replies might give us a filehandle */
3221 if( (civ->prog==100005)
3226 fh_length=tvb_get_ntohl(tvb, offset);
3228 nfs_name_snoop_add_fh(civ->xid, tvb,
3229 fh_offset, fh_length);
3233 proto_tree_add_uint(ftree, hf_nfs_fh_length, tvb, offset+0, 4,
3236 /* Handle WebNFS requests where filehandle may be 0 length */
3239 dissect_fhandle_data(tvb, offset+4, pinfo, ftree, fh3_len, FALSE, hash);
3241 offset += fh3_len_full;
3250 /* RFC 1813, Page 21 */
3252 dissect_nfstime3(tvbuff_t *tvb, int offset,
3253 proto_tree *tree, int hf_time, int hf_time_sec, int hf_time_nsec)
3259 proto_item* time_item;
3260 proto_tree* time_tree = NULL;
3262 seconds = tvb_get_ntohl(tvb, offset+0);
3263 nseconds = tvb_get_ntohl(tvb, offset+4);
3265 ts.nsecs = nseconds;
3268 time_item = proto_tree_add_time(tree, hf_time, tvb, offset, 8,
3271 time_tree = proto_item_add_subtree(time_item, ett_nfs_nfstime3);
3275 proto_tree_add_uint(time_tree, hf_time_sec, tvb, offset, 4,
3277 proto_tree_add_uint(time_tree, hf_time_nsec, tvb, offset+4, 4,
3285 /* RFC 1813, Page 22 */
3287 dissect_nfs_fattr3(tvbuff_t *tvb, int offset, proto_tree *tree, char* name)
3289 proto_item* fattr3_item = NULL;
3290 proto_tree* fattr3_tree = NULL;
3291 int old_offset = offset;
3295 fattr3_item = proto_tree_add_text(tree, tvb, offset, -1,
3297 fattr3_tree = proto_item_add_subtree(fattr3_item, ett_nfs_fattr3);
3300 offset = dissect_ftype3(tvb,offset,fattr3_tree,hf_nfs_fattr3_type,&type);
3301 offset = dissect_mode3(tvb,offset,fattr3_tree,"mode");
3302 offset = dissect_rpc_uint32(tvb, fattr3_tree, hf_nfs_fattr3_nlink,
3304 offset = dissect_rpc_uint32(tvb, fattr3_tree, hf_nfs_fattr3_uid,
3306 offset = dissect_rpc_uint32(tvb, fattr3_tree, hf_nfs_fattr3_gid,
3308 offset = dissect_rpc_uint64(tvb, fattr3_tree, hf_nfs_fattr3_size,
3310 offset = dissect_rpc_uint64(tvb, fattr3_tree, hf_nfs_fattr3_used,
3312 offset = dissect_specdata3(tvb,offset,fattr3_tree,"rdev");
3313 offset = dissect_rpc_uint64(tvb, fattr3_tree, hf_nfs_fattr3_fsid,
3315 offset = dissect_rpc_uint64(tvb, fattr3_tree, hf_nfs_fattr3_fileid,
3317 offset = dissect_nfstime3 (tvb,offset,fattr3_tree,hf_nfs_atime,hf_nfs_atime_sec,hf_nfs_atime_nsec);
3318 offset = dissect_nfstime3 (tvb,offset,fattr3_tree,hf_nfs_mtime,hf_nfs_mtime_sec,hf_nfs_mtime_nsec);
3319 offset = dissect_nfstime3 (tvb,offset,fattr3_tree,hf_nfs_ctime,hf_nfs_ctime_sec,hf_nfs_ctime_nsec);
3321 /* now we know, that fattr3 is shorter */
3323 proto_item_set_len(fattr3_item, offset - old_offset);
3330 static const value_string value_follows[] =
3333 { 1, "value follows"},
3338 /* RFC 1813, Page 23 */
3340 dissect_nfs_post_op_attr(tvbuff_t *tvb, int offset, proto_tree *tree,
3343 proto_item* post_op_attr_item = NULL;
3344 proto_tree* post_op_attr_tree = NULL;
3345 int old_offset = offset;
3346 guint32 attributes_follow;
3349 post_op_attr_item = proto_tree_add_text(tree, tvb, offset, -1,
3351 post_op_attr_tree = proto_item_add_subtree(post_op_attr_item,
3352 ett_nfs_post_op_attr);
3355 attributes_follow = tvb_get_ntohl(tvb, offset+0);
3356 proto_tree_add_text(post_op_attr_tree, tvb, offset, 4,
3357 "attributes_follow: %s (%u)",
3358 val_to_str(attributes_follow,value_follows,"Unknown"), attributes_follow);
3360 switch (attributes_follow) {
3362 offset = dissect_nfs_fattr3(tvb, offset, post_op_attr_tree,
3370 /* now we know, that post_op_attr_tree is shorter */
3371 if (post_op_attr_item) {
3372 proto_item_set_len(post_op_attr_item, offset - old_offset);
3379 /* RFC 1813, Page 24 */
3381 dissect_wcc_attr(tvbuff_t *tvb, int offset, proto_tree *tree, char* name)
3383 proto_item* wcc_attr_item = NULL;
3384 proto_tree* wcc_attr_tree = NULL;
3385 int old_offset = offset;
3388 wcc_attr_item = proto_tree_add_text(tree, tvb, offset, -1,
3390 wcc_attr_tree = proto_item_add_subtree(wcc_attr_item,
3394 offset = dissect_rpc_uint64(tvb, wcc_attr_tree, hf_nfs_wcc_attr_size,
3396 offset = dissect_nfstime3(tvb, offset, wcc_attr_tree, hf_nfs_mtime, hf_nfs_mtime_sec, hf_nfs_mtime_nsec);
3397 offset = dissect_nfstime3(tvb, offset, wcc_attr_tree, hf_nfs_ctime, hf_nfs_ctime_sec, hf_nfs_ctime_nsec);
3398 /* now we know, that wcc_attr_tree is shorter */
3399 if (wcc_attr_item) {
3400 proto_item_set_len(wcc_attr_item, offset - old_offset);
3407 /* RFC 1813, Page 24 */
3409 dissect_pre_op_attr(tvbuff_t *tvb, int offset, proto_tree *tree, char* name)
3411 proto_item* pre_op_attr_item = NULL;
3412 proto_tree* pre_op_attr_tree = NULL;
3413 int old_offset = offset;
3414 guint32 attributes_follow;
3417 pre_op_attr_item = proto_tree_add_text(tree, tvb, offset, -1,
3419 pre_op_attr_tree = proto_item_add_subtree(pre_op_attr_item,
3420 ett_nfs_pre_op_attr);
3423 attributes_follow = tvb_get_ntohl(tvb, offset+0);
3424 proto_tree_add_text(pre_op_attr_tree, tvb, offset, 4,
3425 "attributes_follow: %s (%u)",
3426 val_to_str(attributes_follow,value_follows,"Unknown"), attributes_follow);
3428 switch (attributes_follow) {
3430 offset = dissect_wcc_attr(tvb, offset, pre_op_attr_tree,
3438 /* now we know, that pre_op_attr_tree is shorter */
3439 if (pre_op_attr_item) {
3440 proto_item_set_len(pre_op_attr_item, offset - old_offset);
3447 /* RFC 1813, Page 24 */
3449 dissect_wcc_data(tvbuff_t *tvb, int offset, proto_tree *tree, char* name)
3451 proto_item* wcc_data_item = NULL;
3452 proto_tree* wcc_data_tree = NULL;
3453 int old_offset = offset;
3456 wcc_data_item = proto_tree_add_text(tree, tvb, offset, -1,
3458 wcc_data_tree = proto_item_add_subtree(wcc_data_item,
3462 offset = dissect_pre_op_attr (tvb, offset, wcc_data_tree, "before");
3463 offset = dissect_nfs_post_op_attr(tvb, offset, wcc_data_tree, "after" );
3465 /* now we know, that wcc_data is shorter */
3466 if (wcc_data_item) {
3467 proto_item_set_len(wcc_data_item, offset - old_offset);
3474 /* RFC 1813, Page 25 */
3476 dissect_post_op_fh3(tvbuff_t *tvb, int offset, packet_info *pinfo,
3477 proto_tree *tree, char* name)
3479 proto_item* post_op_fh3_item = NULL;
3480 proto_tree* post_op_fh3_tree = NULL;
3481 int old_offset = offset;
3482 guint32 handle_follows;
3485 post_op_fh3_item = proto_tree_add_text(tree, tvb, offset, -1,
3487 post_op_fh3_tree = proto_item_add_subtree(post_op_fh3_item,
3488 ett_nfs_post_op_fh3);
3491 handle_follows = tvb_get_ntohl(tvb, offset+0);
3492 proto_tree_add_text(post_op_fh3_tree, tvb, offset, 4,
3493 "handle_follows: %s (%u)",
3494 val_to_str(handle_follows,value_follows,"Unknown"), handle_follows);
3496 switch (handle_follows) {
3498 offset = dissect_nfs_fh3(tvb, offset, pinfo, post_op_fh3_tree,
3506 /* now we know, that post_op_fh3_tree is shorter */
3507 if (post_op_fh3_item) {
3508 proto_item_set_len(post_op_fh3_item, offset - old_offset);
3515 /* RFC 1813, Page 25 */
3517 dissect_set_mode3(tvbuff_t *tvb, int offset, proto_tree *tree, char* name)
3519 proto_item* set_mode3_item = NULL;
3520 proto_tree* set_mode3_tree = NULL;
3521 int old_offset = offset;
3525 set_it = tvb_get_ntohl(tvb, offset+0);
3526 set_it_name = val_to_str(set_it,value_follows,"Unknown");
3529 set_mode3_item = proto_tree_add_text(tree, tvb, offset, -1,
3530 "%s: %s", name, set_it_name);
3531 set_mode3_tree = proto_item_add_subtree(set_mode3_item,
3536 proto_tree_add_text(set_mode3_tree, tvb, offset, 4,
3537 "set_it: %s (%u)", set_it_name, set_it);
3543 offset = dissect_mode3(tvb, offset, set_mode3_tree,
3551 /* now we know, that set_mode3 is shorter */
3552 if (set_mode3_item) {
3553 proto_item_set_len(set_mode3_item, offset - old_offset);
3560 /* RFC 1813, Page 26 */
3562 dissect_set_uid3(tvbuff_t *tvb, int offset, proto_tree *tree, char* name)
3564 proto_item* set_uid3_item = NULL;
3565 proto_tree* set_uid3_tree = NULL;
3566 int old_offset = offset;
3570 set_it = tvb_get_ntohl(tvb, offset+0);
3571 set_it_name = val_to_str(set_it,value_follows,"Unknown");
3574 set_uid3_item = proto_tree_add_text(tree, tvb, offset, -1,
3575 "%s: %s", name, set_it_name);
3576 set_uid3_tree = proto_item_add_subtree(set_uid3_item,
3581 proto_tree_add_text(set_uid3_tree, tvb, offset, 4,
3582 "set_it: %s (%u)", set_it_name, set_it);
3588 offset = dissect_rpc_uint32(tvb, set_uid3_tree,
3589 hf_nfs_uid3, offset);
3596 /* now we know, that set_uid3 is shorter */
3597 if (set_uid3_item) {
3598 proto_item_set_len(set_uid3_item, offset - old_offset);
3605 /* RFC 1813, Page 26 */
3607 dissect_set_gid3(tvbuff_t *tvb, int offset, proto_tree *tree, char* name)
3609 proto_item* set_gid3_item = NULL;
3610 proto_tree* set_gid3_tree = NULL;
3611 int old_offset = offset;
3615 set_it = tvb_get_ntohl(tvb, offset+0);
3616 set_it_name = val_to_str(set_it,value_follows,"Unknown");
3619 set_gid3_item = proto_tree_add_text(tree, tvb, offset, -1,
3620 "%s: %s", name, set_it_name);
3621 set_gid3_tree = proto_item_add_subtree(set_gid3_item,
3626 proto_tree_add_text(set_gid3_tree, tvb, offset, 4,
3627 "set_it: %s (%u)", set_it_name, set_it);
3633 offset = dissect_rpc_uint32(tvb, set_gid3_tree,
3634 hf_nfs_gid3, offset);
3641 /* now we know, that set_gid3 is shorter */
3642 if (set_gid3_item) {
3643 proto_item_set_len(set_gid3_item, offset - old_offset);
3650 /* RFC 1813, Page 26 */
3652 dissect_set_size3(tvbuff_t *tvb, int offset, proto_tree *tree, char* name)
3654 proto_item* set_size3_item = NULL;
3655 proto_tree* set_size3_tree = NULL;
3656 int old_offset = offset;
3660 set_it = tvb_get_ntohl(tvb, offset+0);
3661 set_it_name = val_to_str(set_it,value_follows,"Unknown");
3664 set_size3_item = proto_tree_add_text(tree, tvb, offset, -1,
3665 "%s: %s", name, set_it_name);
3666 set_size3_tree = proto_item_add_subtree(set_size3_item,
3671 proto_tree_add_text(set_size3_tree, tvb, offset, 4,
3672 "set_it: %s (%u)", set_it_name, set_it);
3678 offset = dissect_rpc_uint64(tvb, set_size3_tree,
3679 hf_nfs_set_size3_size, offset);
3686 /* now we know, that set_size3 is shorter */
3687 if (set_size3_item) {
3688 proto_item_set_len(set_size3_item, offset - old_offset);
3695 /* RFC 1813, Page 25 */
3696 #define DONT_CHANGE 0
3697 #define SET_TO_SERVER_TIME 1
3698 #define SET_TO_CLIENT_TIME 2
3700 static const value_string time_how[] =
3702 { DONT_CHANGE, "don't change" },
3703 { SET_TO_SERVER_TIME, "set to server time" },
3704 { SET_TO_CLIENT_TIME, "set to client time" },
3709 /* RFC 1813, Page 26 */
3711 dissect_set_atime(tvbuff_t *tvb, int offset, proto_tree *tree, char* name)
3713 proto_item* set_atime_item = NULL;
3714 proto_tree* set_atime_tree = NULL;
3715 int old_offset = offset;
3719 set_it = tvb_get_ntohl(tvb, offset+0);
3720 set_it_name = val_to_str(set_it,time_how,"Unknown");
3723 set_atime_item = proto_tree_add_text(tree, tvb, offset, -1,
3724 "%s: %s", name, set_it_name);
3725 set_atime_tree = proto_item_add_subtree(set_atime_item,
3730 proto_tree_add_text(set_atime_tree, tvb, offset, 4,
3731 "set_it: %s (%u)", set_it_name, set_it);
3736 case SET_TO_CLIENT_TIME:
3737 if (set_atime_item) {
3738 offset = dissect_nfstime3(tvb, offset, set_atime_tree,
3739 hf_nfs_atime, hf_nfs_atime_sec, hf_nfs_atime_nsec);
3747 /* now we know, that set_atime is shorter */
3748 if (set_atime_item) {
3749 proto_item_set_len(set_atime_item, offset - old_offset);
3756 /* RFC 1813, Page 26 */
3758 dissect_set_mtime(tvbuff_t *tvb, int offset, proto_tree *tree, char* name)
3760 proto_item* set_mtime_item = NULL;
3761 proto_tree* set_mtime_tree = NULL;
3762 int old_offset = offset;
3766 set_it = tvb_get_ntohl(tvb, offset+0);
3767 set_it_name = val_to_str(set_it,time_how,"Unknown");
3770 set_mtime_item = proto_tree_add_text(tree, tvb, offset, -1,
3771 "%s: %s", name, set_it_name);
3772 set_mtime_tree = proto_item_add_subtree(set_mtime_item,
3777 proto_tree_add_text(set_mtime_tree, tvb, offset, 4,
3778 "set_it: %s (%u)", set_it_name, set_it);
3783 case SET_TO_CLIENT_TIME:
3784 if (set_mtime_item) {
3785 offset = dissect_nfstime3(tvb, offset, set_mtime_tree,
3786 hf_nfs_atime, hf_nfs_atime_sec, hf_nfs_atime_nsec);
3794 /* now we know, that set_mtime is shorter */
3795 if (set_mtime_item) {
3796 proto_item_set_len(set_mtime_item, offset - old_offset);
3803 /* RFC 1813, Page 25..27 */
3805 dissect_sattr3(tvbuff_t *tvb, int offset, proto_tree *tree, char* name)
3807 proto_item* sattr3_item = NULL;
3808 proto_tree* sattr3_tree = NULL;
3809 int old_offset = offset;
3812 sattr3_item = proto_tree_add_text(tree, tvb, offset, -1,
3814 sattr3_tree = proto_item_add_subtree(sattr3_item, ett_nfs_sattr3);
3817 offset = dissect_set_mode3(tvb, offset, sattr3_tree, "mode");
3818 offset = dissect_set_uid3 (tvb, offset, sattr3_tree, "uid");
3819 offset = dissect_set_gid3 (tvb, offset, sattr3_tree, "gid");
3820 offset = dissect_set_size3(tvb, offset, sattr3_tree, "size");
3821 offset = dissect_set_atime(tvb, offset, sattr3_tree, "atime");
3822 offset = dissect_set_mtime(tvb, offset, sattr3_tree, "mtime");
3824 /* now we know, that sattr3 is shorter */
3826 proto_item_set_len(sattr3_item, offset - old_offset);
3833 /* RFC 1813, Page 27 */
3835 dissect_diropargs3(tvbuff_t *tvb, int offset, packet_info *pinfo,
3836 proto_tree *tree, char* label, guint32 *hash, char **name)
3838 proto_item* diropargs3_item = NULL;
3839 proto_tree* diropargs3_tree = NULL;
3840 int old_offset = offset;
3841 int parent_offset, parent_len;
3842 int name_offset, name_len;
3845 diropargs3_item = proto_tree_add_text(tree, tvb, offset, -1,
3847 diropargs3_tree = proto_item_add_subtree(diropargs3_item,
3848 ett_nfs_diropargs3);
3851 parent_offset=offset+4;
3852 parent_len=tvb_get_ntohl(tvb, offset);
3853 offset = dissect_nfs_fh3(tvb, offset, pinfo, diropargs3_tree, "dir", hash);
3854 name_offset=offset+4;
3855 name_len=tvb_get_ntohl(tvb, offset);
3856 offset = dissect_filename3(tvb, offset, diropargs3_tree,
3859 /* are we snooping fh to filenames ?*/
3860 if((!pinfo->fd->flags.visited) && nfs_file_name_snooping){
3861 /* v3 LOOKUP, CREATE, MKDIR calls might give us a mapping*/
3862 rpc_call_info_value *civ=pinfo->private_data;
3864 if( (civ->prog==100003)
3867 &&((civ->proc==3)||(civ->proc==8)||(civ->proc==9))
3869 nfs_name_snoop_add_name(civ->xid, tvb,
3870 name_offset, name_len,
3871 parent_offset, parent_len, NULL);
3876 /* now we know, that diropargs3 is shorter */
3877 if (diropargs3_item) {
3878 proto_item_set_len(diropargs3_item, offset - old_offset);
3885 dissect_nfs3_remove_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
3891 offset = dissect_diropargs3(tvb, offset, pinfo, tree, "object", &hash, &name);
3893 if (check_col(pinfo->cinfo, COL_INFO)) {
3894 col_append_fstr(pinfo->cinfo, COL_INFO,", DH:0x%08x/%s", hash, name);
3896 proto_item_append_text(tree, ", REMOVE Call DH:0x%08x/%s", hash, name);
3903 dissect_nfs3_null_call(tvbuff_t *tvb _U_, int offset, packet_info *pinfo _U_,
3906 proto_item_append_text(tree, ", NULL Call");
3912 dissect_nfs3_null_reply(tvbuff_t *tvb _U_, int offset, packet_info *pinfo _U_,
3915 proto_item_append_text(tree, ", NULL Reply");
3921 dissect_nfs3_rmdir_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
3927 offset = dissect_diropargs3(tvb, offset, pinfo, tree, "object", &hash, &name);
3929 if (check_col(pinfo->cinfo, COL_INFO)) {
3930 col_append_fstr(pinfo->cinfo, COL_INFO,", DH:0x%08x/%s", hash, name);
3932 proto_item_append_text(tree, ", RMDIR Call DH:0x%08x/%s", hash, name);
3939 /* RFC 1813, Page 40 */
3941 dissect_access(tvbuff_t *tvb, int offset, proto_tree *tree,
3945 proto_item* access_item = NULL;
3946 proto_tree* access_tree = NULL;
3948 access = tvb_get_ntohl(tvb, offset+0);
3951 access_item = proto_tree_add_text(tree, tvb, offset, 4,
3952 "%s: 0x%02x", name, access);
3954 access_tree = proto_item_add_subtree(access_item, ett_nfs_access);
3958 proto_tree_add_text(access_tree, tvb, offset, 4, "%s READ",
3959 decode_boolean_bitfield(access, 0x001, 6, "allow", "not allow"));
3960 proto_tree_add_text(access_tree, tvb, offset, 4, "%s LOOKUP",
3961 decode_boolean_bitfield(access, 0x002, 6, "allow", "not allow"));
3962 proto_tree_add_text(access_tree, tvb, offset, 4, "%s MODIFY",
3963 decode_boolean_bitfield(access, 0x004, 6, "allow", "not allow"));
3964 proto_tree_add_text(access_tree, tvb, offset, 4, "%s EXTEND",
3965 decode_boolean_bitfield(access, 0x008, 6, "allow", "not allow"));
3966 proto_tree_add_text(access_tree, tvb, offset, 4, "%s DELETE",
3967 decode_boolean_bitfield(access, 0x010, 6, "allow", "not allow"));
3968 proto_tree_add_text(access_tree, tvb, offset, 4, "%s EXECUTE",
3969 decode_boolean_bitfield(access, 0x020, 6, "allow", "not allow"));
3977 /* RFC 1813, Page 32,33 */
3979 dissect_nfs3_getattr_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
3984 offset = dissect_nfs_fh3(tvb, offset, pinfo, tree, "object", &hash);
3986 if (check_col(pinfo->cinfo, COL_INFO)) {
3987 col_append_fstr(pinfo->cinfo, COL_INFO,", FH:0x%08x", hash);
3989 proto_item_append_text(tree, ", GETATTR Call FH:0x%08x", hash);
3995 /* RFC 1813, Page 32,33 */
3997 dissect_nfs3_getattr_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
4003 offset = dissect_nfsstat3(tvb, offset, tree, &status);
4006 offset = dissect_nfs_fattr3(tvb, offset, tree, "obj_attributes");
4007 proto_item_append_text(tree, ", GETATTR Reply");
4012 err=val_to_str(status, names_nfs_stat, "Unknown error:%u");
4013 if (check_col(pinfo->cinfo, COL_INFO)) {
4014 col_append_fstr(pinfo->cinfo, COL_INFO," Error:%s", err);
4016 proto_item_append_text(tree, ", GETATTR Reply Error:%s", err);
4024 /* RFC 1813, Page 33 */
4026 dissect_sattrguard3(tvbuff_t *tvb, int offset, proto_tree* tree, char *name)
4028 proto_item* sattrguard3_item = NULL;
4029 proto_tree* sattrguard3_tree = NULL;
4030 int old_offset = offset;
4034 check = tvb_get_ntohl(tvb, offset+0);
4035 check_name = val_to_str(check,value_follows,"Unknown");
4038 sattrguard3_item = proto_tree_add_text(tree, tvb, offset, -1,
4039 "%s: %s", name, check_name);
4040 sattrguard3_tree = proto_item_add_subtree(sattrguard3_item,
4041 ett_nfs_sattrguard3);
4044 if (sattrguard3_tree)
4045 proto_tree_add_text(sattrguard3_tree, tvb, offset, 4,
4046 "check: %s (%u)", check_name, check);
4052 offset = dissect_nfstime3(tvb, offset, sattrguard3_tree,
4053 hf_nfs_ctime, hf_nfs_ctime_sec, hf_nfs_ctime_nsec);
4060 /* now we know, that sattrguard3 is shorter */
4061 if (sattrguard3_item) {
4062 proto_item_set_len(sattrguard3_item, offset - old_offset);
4069 /* RFC 1813, Page 33..36 */
4071 dissect_nfs3_setattr_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
4076 offset = dissect_nfs_fh3 (tvb, offset, pinfo, tree, "object", &hash);
4077 offset = dissect_sattr3 (tvb, offset, tree, "new_attributes");
4078 offset = dissect_sattrguard3(tvb, offset, tree, "guard");
4080 if (check_col(pinfo->cinfo, COL_INFO)) {
4081 col_append_fstr(pinfo->cinfo, COL_INFO,", FH:0x%08x", hash);
4083 proto_item_append_text(tree, ", SETATTR Call FH:0x%08x", hash);
4089 /* RFC 1813, Page 33..36 */
4091 dissect_nfs3_setattr_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
4097 offset = dissect_nfsstat3(tvb, offset, tree, &status);
4100 offset = dissect_wcc_data(tvb, offset, tree, "obj_wcc");
4101 proto_item_append_text(tree, ", SETATTR Reply");
4104 offset = dissect_wcc_data(tvb, offset, tree, "obj_wcc");
4106 err=val_to_str(status, names_nfs_stat, "Unknown error:%u");
4107 if (check_col(pinfo->cinfo, COL_INFO)) {
4108 col_append_fstr(pinfo->cinfo, COL_INFO," Error:%s", err);
4110 proto_item_append_text(tree, ", SETATTR Reply Error:%s", err);
4118 /* RFC 1813, Page 37..39 */
4120 dissect_nfs3_lookup_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
4126 offset = dissect_diropargs3 (tvb, offset, pinfo, tree, "what", &hash, &name);
4128 if (check_col(pinfo->cinfo, COL_INFO)) {
4129 col_append_fstr(pinfo->cinfo, COL_INFO,", DH:0x%08x/%s", hash, name);
4131 proto_item_append_text(tree, ", LOOKUP Call DH:0x%08x/%s", hash, name);
4138 /* RFC 1813, Page 37..39 */
4140 dissect_nfs3_lookup_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
4147 offset = dissect_nfsstat3(tvb, offset, tree, &status);
4150 offset = dissect_nfs_fh3(tvb, offset, pinfo, tree, "object", &hash);
4151 offset = dissect_nfs_post_op_attr(tvb, offset, tree,
4153 offset = dissect_nfs_post_op_attr(tvb, offset, tree,
4156 if (check_col(pinfo->cinfo, COL_INFO)) {
4157 col_append_fstr(pinfo->cinfo, COL_INFO,", FH:0x%08x", hash);
4159 proto_item_append_text(tree, ", LOOKUP Reply FH:0x%08x", hash);
4162 offset = dissect_nfs_post_op_attr(tvb, offset, tree,
4165 err=val_to_str(status, names_nfs_stat, "Unknown error:%u");
4166 if (check_col(pinfo->cinfo, COL_INFO)) {
4167 col_append_fstr(pinfo->cinfo, COL_INFO," Error:%s", err);
4169 proto_item_append_text(tree, ", LOOKUP Reply Error:%s", err);
4177 /* RFC 1813, Page 40..43 */
4179 dissect_nfs3_access_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
4184 offset = dissect_nfs_fh3(tvb, offset, pinfo, tree, "object", &hash);
4185 offset = dissect_access (tvb, offset, tree, "access");
4187 if (check_col(pinfo->cinfo, COL_INFO)) {
4188 col_append_fstr(pinfo->cinfo, COL_INFO,", FH:0x%08x", hash);
4190 proto_item_append_text(tree, ", ACCESS Call FH:0x%08x", hash);
4196 /* RFC 1813, Page 40..43 */
4198 dissect_nfs3_access_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
4204 offset = dissect_nfsstat3(tvb, offset, tree, &status);
4207 offset = dissect_nfs_post_op_attr(tvb, offset, tree,
4209 offset = dissect_access(tvb, offset, tree, "access");
4211 proto_item_append_text(tree, ", ACCESS Reply");
4214 offset = dissect_nfs_post_op_attr(tvb, offset, tree,
4217 err=val_to_str(status, names_nfs_stat, "Unknown error:%u");
4218 if (check_col(pinfo->cinfo, COL_INFO)) {
4219 col_append_fstr(pinfo->cinfo, COL_INFO," Error:%s", err);
4221 proto_item_append_text(tree, ", ACCESS Reply Error:%s", err);
4229 /* RFC 1813, Page 44,45 */
4231 dissect_nfs3_readlink_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
4236 offset = dissect_nfs_fh3(tvb, offset, pinfo, tree, "object", &hash);
4238 if (check_col(pinfo->cinfo, COL_INFO)) {
4239 col_append_fstr(pinfo->cinfo, COL_INFO,", FH:0x%08x", hash);
4241 proto_item_append_text(tree, ", READLINK Call FH:0x%08x", hash);
4246 dissect_nfs3_readlink_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
4253 offset = dissect_nfsstat3(tvb, offset, tree, &status);
4256 offset = dissect_nfs_post_op_attr(tvb, offset, tree,
4257 "symlink_attributes");
4258 offset = dissect_nfspath3(tvb, offset, tree,
4259 hf_nfs_readlink_data, &name);
4261 if (check_col(pinfo->cinfo, COL_INFO)) {
4262 col_append_fstr(pinfo->cinfo, COL_INFO," Path:%s", name);
4264 proto_item_append_text(tree, ", READLINK Reply Path:%s", name);
4268 offset = dissect_nfs_post_op_attr(tvb, offset, tree,
4269 "symlink_attributes");
4271 err=val_to_str(status, names_nfs_stat, "Unknown error:%u");
4272 if (check_col(pinfo->cinfo, COL_INFO)) {
4273 col_append_fstr(pinfo->cinfo, COL_INFO," Error:%s", err);
4275 proto_item_append_text(tree, ", READLINK Reply Error:%s", err);
4283 /* RFC 1813, Page 46..48 */
4285 dissect_nfs3_read_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
4292 offset = dissect_nfs_fh3(tvb, offset, pinfo, tree, "file", &hash);
4294 off=u64toa(tvb_get_ptr(tvb, offset, 8));
4295 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_offset3, offset);
4297 len=tvb_get_ntohl(tvb, offset);
4298 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_count3, offset);
4301 if (check_col(pinfo->cinfo, COL_INFO)) {
4302 col_append_fstr(pinfo->cinfo, COL_INFO,", FH:0x%08x Offset:%s Len:%d", hash, off, len);
4304 proto_item_append_text(tree, ", READ Call FH:0x%08x Offset:%s Len:%d", hash, off, len);
4310 /* RFC 1813, Page 46..48 */
4312 dissect_nfs3_read_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
4319 offset = dissect_nfsstat3(tvb, offset, tree, &status);
4322 offset = dissect_nfs_post_op_attr(tvb, offset, tree,
4324 len=tvb_get_ntohl(tvb, offset);
4325 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_count3,
4327 offset = dissect_rpc_bool(tvb, tree, hf_nfs_read_eof,
4329 if (check_col(pinfo->cinfo, COL_INFO)) {
4330 col_append_fstr(pinfo->cinfo, COL_INFO," Len:%d", len);
4332 proto_item_append_text(tree, ", READ Reply Len:%d", len);
4333 offset = dissect_nfsdata(tvb, offset, tree, hf_nfs_data);
4336 offset = dissect_nfs_post_op_attr(tvb, offset, tree,
4339 err=val_to_str(status, names_nfs_stat, "Unknown error:%u");
4340 if (check_col(pinfo->cinfo, COL_INFO)) {
4341 col_append_fstr(pinfo->cinfo, COL_INFO," Error:%s", err);
4343 proto_item_append_text(tree, ", READ Reply Error:%s", err);
4351 /* RFC 1813, Page 49 */
4352 static const value_string names_stable_how[] = {
4353 { UNSTABLE, "UNSTABLE" },
4354 { DATA_SYNC, "DATA_SYNC" },
4355 { FILE_SYNC, "FILE_SYNC" },
4360 /* RFC 1813, Page 49 */
4362 dissect_stable_how(tvbuff_t *tvb, int offset, proto_tree* tree, int hfindex)
4366 stable_how = tvb_get_ntohl(tvb,offset+0);
4368 proto_tree_add_uint(tree, hfindex, tvb,
4369 offset, 4, stable_how);
4377 /* RFC 1813, Page 49..54 */
4379 dissect_nfs3_write_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
4387 offset = dissect_nfs_fh3 (tvb, offset, pinfo, tree, "file", &hash);
4389 off=u64toa(tvb_get_ptr(tvb, offset, 8));
4390 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_offset3, offset);
4392 len=tvb_get_ntohl(tvb, offset);
4393 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_count3, offset);
4395 stable=tvb_get_ntohl(tvb, offset);
4396 offset = dissect_stable_how(tvb, offset, tree, hf_nfs_write_stable);
4398 if (check_col(pinfo->cinfo, COL_INFO)) {
4399 col_append_fstr(pinfo->cinfo, COL_INFO,", FH:0x%08x Offset:%s Len:%d %s", hash, off, len, val_to_str(stable, names_stable_how, "Stable:%u"));
4401 proto_item_append_text(tree, ", WRITE Call FH:0x%08x Offset:%s Len:%d %s", hash, off, len, val_to_str(stable, names_stable_how, "Stable:%u"));
4403 offset = dissect_nfsdata (tvb, offset, tree, hf_nfs_data);
4409 /* RFC 1813, Page 49..54 */
4411 dissect_nfs3_write_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
4419 offset = dissect_nfsstat3(tvb, offset, tree, &status);
4422 offset = dissect_wcc_data (tvb, offset, tree, "file_wcc");
4423 len=tvb_get_ntohl(tvb, offset);
4424 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_count3,
4426 stable=tvb_get_ntohl(tvb, offset);
4427 offset = dissect_stable_how(tvb, offset, tree,
4428 hf_nfs_write_committed);
4429 offset = dissect_writeverf3(tvb, offset, tree);
4431 if (check_col(pinfo->cinfo, COL_INFO)) {
4432 col_append_fstr(pinfo->cinfo, COL_INFO," Len:%d %s", len, val_to_str(stable, names_stable_how, "Stable:%u"));
4434 proto_item_append_text(tree, ", WRITE Reply Len:%d %s", len, val_to_str(stable, names_stable_how, "Stable:%u"));
4437 offset = dissect_wcc_data(tvb, offset, tree, "file_wcc");
4439 err=val_to_str(status, names_nfs_stat, "Unknown error:%u");
4440 if (check_col(pinfo->cinfo, COL_INFO)) {
4441 col_append_fstr(pinfo->cinfo, COL_INFO," Error:%s", err);
4443 proto_item_append_text(tree, ", WRITE Reply Error:%s", err);
4451 /* RFC 1813, Page 54 */
4452 static const value_string names_createmode3[] = {
4453 { UNCHECKED, "UNCHECKED" },
4454 { GUARDED, "GUARDED" },
4455 { EXCLUSIVE, "EXCLUSIVE" },
4460 /* RFC 1813, Page 54 */
4462 dissect_createmode3(tvbuff_t *tvb, int offset, proto_tree* tree, guint32* mode)
4466 mode_value = tvb_get_ntohl(tvb, offset + 0);
4468 proto_tree_add_uint(tree, hf_nfs_createmode3, tvb,
4469 offset+0, 4, mode_value);
4478 /* RFC 1813, Page 54..58 */
4480 dissect_nfs3_create_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
4487 offset = dissect_diropargs3 (tvb, offset, pinfo, tree, "where", &hash, &name);
4488 offset = dissect_createmode3(tvb, offset, tree, &mode);
4492 offset = dissect_sattr3(tvb, offset, tree, "obj_attributes");
4495 offset = dissect_createverf3(tvb, offset, tree);
4499 if (check_col(pinfo->cinfo, COL_INFO)) {
4500 col_append_fstr(pinfo->cinfo, COL_INFO,", DH:0x%08x/%s Mode:%s", hash, name, val_to_str(mode, names_createmode3, "Unknown Mode:%u"));
4502 proto_item_append_text(tree, ", CREATE Call DH:0x%08x/%s Mode:%s", hash, name, val_to_str(mode, names_createmode3, "Unknown Mode:%u"));
4509 /* RFC 1813, Page 54..58 */
4511 dissect_nfs3_create_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
4517 offset = dissect_nfsstat3(tvb, offset, tree, &status);
4520 offset = dissect_post_op_fh3 (tvb, offset, pinfo, tree, "obj");
4521 offset = dissect_nfs_post_op_attr(tvb, offset, tree,
4523 offset = dissect_wcc_data(tvb, offset, tree, "dir_wcc");
4524 proto_item_append_text(tree, ", CREATE Reply");
4527 offset = dissect_wcc_data(tvb, offset, tree, "dir_wcc");
4529 err=val_to_str(status, names_nfs_stat, "Unknown error:%u");
4530 if (check_col(pinfo->cinfo, COL_INFO)) {
4531 col_append_fstr(pinfo->cinfo, COL_INFO," Error:%s", err);
4533 proto_item_append_text(tree, ", CREATE Reply Error:%s", err);
4541 /* RFC 1813, Page 58..60 */
4543 dissect_nfs3_mkdir_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
4549 offset = dissect_diropargs3(tvb, offset, pinfo, tree, "where", &hash, &name);
4550 offset = dissect_sattr3 (tvb, offset, tree, "attributes");
4552 if (check_col(pinfo->cinfo, COL_INFO)) {
4553 col_append_fstr(pinfo->cinfo, COL_INFO,", DH:0x%08x/%s", hash, name);
4555 proto_item_append_text(tree, ", MKDIR Call DH:0x%08x/%s", hash, name);
4562 dissect_nfs3_mkdir_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
4568 offset = dissect_nfsstat3(tvb, offset, tree, &status);
4571 offset = dissect_post_op_fh3 (tvb, offset, pinfo, tree, "obj");
4572 offset = dissect_nfs_post_op_attr(tvb, offset, tree,
4574 offset = dissect_wcc_data(tvb, offset, tree, "dir_wcc");
4575 proto_item_append_text(tree, ", MKDIR Reply");
4578 offset = dissect_wcc_data(tvb, offset, tree, "dir_wcc");
4580 err=val_to_str(status, names_nfs_stat, "Unknown error:%u");
4581 if (check_col(pinfo->cinfo, COL_INFO)) {
4582 col_append_fstr(pinfo->cinfo, COL_INFO," Error:%s", err);
4584 proto_item_append_text(tree, ", MKDIR Reply Error:%s", err);
4592 /* RFC 1813, Page 61..63 */
4594 dissect_nfs3_symlink_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
4598 char *from_name=NULL;
4601 offset = dissect_diropargs3(tvb, offset, pinfo, tree, "where", &from_hash, &from_name);
4602 offset = dissect_sattr3 (tvb, offset, tree, "symlink_attributes");
4603 offset = dissect_nfspath3 (tvb, offset, tree, hf_nfs_symlink_to, &to_name);
4605 if (check_col(pinfo->cinfo, COL_INFO)) {
4606 col_append_fstr(pinfo->cinfo, COL_INFO,", From DH:0x%08x/%s To %s", from_hash, from_name, to_name);
4608 proto_item_append_text(tree, ", SYMLINK Call From DH:0x%08x/%s To %s", from_hash, from_name, to_name);
4615 dissect_nfs3_symlink_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
4621 offset = dissect_nfsstat3(tvb, offset, tree, &status);
4624 offset = dissect_post_op_fh3 (tvb, offset, pinfo, tree, "obj");
4625 offset = dissect_nfs_post_op_attr(tvb, offset, tree,
4627 offset = dissect_wcc_data(tvb, offset, tree, "dir_wcc");
4628 proto_item_append_text(tree, ", SYMLINK Reply");
4631 offset = dissect_wcc_data(tvb, offset, tree, "dir_wcc");
4633 err=val_to_str(status, names_nfs_stat, "Unknown error:%u");
4634 if (check_col(pinfo->cinfo, COL_INFO)) {
4635 col_append_fstr(pinfo->cinfo, COL_INFO," Error:%s", err);
4637 proto_item_append_text(tree, ", SYMLINK Reply Error:%s", err);
4645 /* RFC 1813, Page 63..66 */
4647 dissect_nfs3_mknod_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
4655 offset = dissect_diropargs3(tvb, offset, pinfo, tree, "where", &hash, &name);
4656 offset = dissect_ftype3(tvb, offset, tree, hf_nfs_ftype3, &type);
4660 offset = dissect_sattr3(tvb, offset, tree, "dev_attributes");
4661 offset = dissect_specdata3(tvb, offset, tree, "spec");
4665 offset = dissect_sattr3(tvb, offset, tree, "pipe_attributes");
4672 type_str=val_to_str(type, names_nfs_ftype3, "Unknown type:%u");
4673 if (check_col(pinfo->cinfo, COL_INFO)) {
4674 col_append_fstr(pinfo->cinfo, COL_INFO,", FH:0x%08x/%s %s", hash, name, type_str);
4676 proto_item_append_text(tree, ", MKNOD Call FH:0x%08x/%s %s", hash, name, type_str);
4682 dissect_nfs3_mknod_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
4688 offset = dissect_nfsstat3(tvb, offset, tree, &status);
4691 offset = dissect_post_op_fh3 (tvb, offset, pinfo, tree, "obj");
4692 offset = dissect_nfs_post_op_attr(tvb, offset, tree,
4694 offset = dissect_wcc_data(tvb, offset, tree, "dir_wcc");
4695 proto_item_append_text(tree, ", MKNOD Reply");
4698 offset = dissect_wcc_data(tvb, offset, tree, "dir_wcc");
4700 err=val_to_str(status, names_nfs_stat, "Unknown error:%u");
4701 if (check_col(pinfo->cinfo, COL_INFO)) {
4702 col_append_fstr(pinfo->cinfo, COL_INFO," Error:%s", err);
4704 proto_item_append_text(tree, ", MKNOD Reply Error:%s", err);
4712 /* RFC 1813, Page 67..69 */
4714 dissect_nfs3_remove_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
4720 offset = dissect_nfsstat3(tvb, offset, tree, &status);
4723 offset = dissect_wcc_data(tvb, offset, tree, "dir_wcc");
4724 proto_item_append_text(tree, ", REMOVE Reply");
4727 offset = dissect_wcc_data(tvb, offset, tree, "dir_wcc");
4728 err=val_to_str(status, names_nfs_stat, "Unknown error:%u");
4729 if (check_col(pinfo->cinfo, COL_INFO)) {
4730 col_append_fstr(pinfo->cinfo, COL_INFO," Error:%s", err);
4732 proto_item_append_text(tree, ", REMOVE Reply Error:%s", err);
4739 dissect_nfs3_rmdir_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
4745 offset = dissect_nfsstat3(tvb, offset, tree, &status);
4748 offset = dissect_wcc_data(tvb, offset, tree, "dir_wcc");
4749 proto_item_append_text(tree, ", RMDIR Reply");
4752 offset = dissect_wcc_data(tvb, offset, tree, "dir_wcc");
4753 err=val_to_str(status, names_nfs_stat, "Unknown error:%u");
4754 if (check_col(pinfo->cinfo, COL_INFO)) {
4755 col_append_fstr(pinfo->cinfo, COL_INFO," Error:%s", err);
4757 proto_item_append_text(tree, ", RMDIR Reply Error:%s", err);
4765 /* RFC 1813, Page 71..74 */
4767 dissect_nfs3_rename_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
4771 char *from_name=NULL;
4775 offset = dissect_diropargs3(tvb, offset, pinfo, tree, "from", &from_hash, &from_name);
4776 offset = dissect_diropargs3(tvb, offset, pinfo, tree, "to", &to_hash, &to_name);
4778 if (check_col(pinfo->cinfo, COL_INFO)) {
4779 col_append_fstr(pinfo->cinfo, COL_INFO,", From DH:0x%08x/%s To DH:0x%08x/%s", from_hash, from_name, to_hash, to_name);
4781 proto_item_append_text(tree, ", RENAME Call From DH:0x%08x/%s To DH:0x%08x/%s", from_hash, from_name, to_hash, to_name);
4789 /* RFC 1813, Page 71..74 */
4791 dissect_nfs3_rename_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
4797 offset = dissect_nfsstat3(tvb, offset, tree, &status);
4800 offset = dissect_wcc_data(tvb, offset, tree, "fromdir_wcc");
4801 offset = dissect_wcc_data(tvb, offset, tree, "todir_wcc");
4802 proto_item_append_text(tree, ", RENAME Reply");
4805 offset = dissect_wcc_data(tvb, offset, tree, "fromdir_wcc");
4806 offset = dissect_wcc_data(tvb, offset, tree, "todir_wcc");
4808 err=val_to_str(status, names_nfs_stat, "Unknown error:%u");
4809 if (check_col(pinfo->cinfo, COL_INFO)) {
4810 col_append_fstr(pinfo->cinfo, COL_INFO," Error:%s", err);
4812 proto_item_append_text(tree, ", RENAME Reply Error:%s", err);
4820 /* RFC 1813, Page 74..76 */
4822 dissect_nfs3_link_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
4829 offset = dissect_nfs_fh3 (tvb, offset, pinfo, tree, "file", &from_hash);
4830 offset = dissect_diropargs3(tvb, offset, pinfo, tree, "link", &to_hash, &to_name);
4832 if (check_col(pinfo->cinfo, COL_INFO)) {
4833 col_append_fstr(pinfo->cinfo, COL_INFO,", From DH:0x%08x To DH:0x%08x/%s", from_hash, to_hash, to_name);
4835 proto_item_append_text(tree, ", LINK Call From DH:0x%08x To DH:0x%08x/%s", from_hash, to_hash, to_name);
4842 /* RFC 1813, Page 74..76 */
4844 dissect_nfs3_link_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
4850 offset = dissect_nfsstat3(tvb, offset, tree, &status);
4853 offset = dissect_nfs_post_op_attr(tvb, offset, tree,
4855 offset = dissect_wcc_data(tvb, offset, tree, "linkdir_wcc");
4856 proto_item_append_text(tree, ", LINK Reply");
4859 offset = dissect_nfs_post_op_attr(tvb, offset, tree,
4861 offset = dissect_wcc_data(tvb, offset, tree, "linkdir_wcc");
4863 err=val_to_str(status, names_nfs_stat, "Unknown error:%u");
4864 if (check_col(pinfo->cinfo, COL_INFO)) {
4865 col_append_fstr(pinfo->cinfo, COL_INFO," Error:%s", err);
4867 proto_item_append_text(tree, ", LINK Reply Error:%s", err);
4875 /* RFC 1813, Page 76..80 */
4877 dissect_nfs3_readdir_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
4882 offset = dissect_nfs_fh3 (tvb, offset, pinfo, tree, "dir", &hash);
4883 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_cookie3, offset);
4884 offset = dissect_cookieverf3(tvb, offset, tree);
4885 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_count3, offset);
4887 if (check_col(pinfo->cinfo, COL_INFO)) {
4888 col_append_fstr(pinfo->cinfo, COL_INFO,", FH:0x%08x", hash);
4890 proto_item_append_text(tree, ", READDIR Call FH:0x%08x", hash);
4896 /* RFC 1813, Page 76..80 */
4898 dissect_entry3(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
4901 proto_item* entry_item = NULL;
4902 proto_tree* entry_tree = NULL;
4903 int old_offset = offset;
4907 entry_item = proto_tree_add_item(tree, hf_nfs_readdir_entry, tvb,
4908 offset+0, -1, FALSE);
4909 entry_tree = proto_item_add_subtree(entry_item, ett_nfs_readdir_entry);
4912 offset = dissect_rpc_uint64(tvb, entry_tree, hf_nfs_readdir_entry3_fileid,
4915 offset = dissect_filename3(tvb, offset, entry_tree,
4916 hf_nfs_readdir_entry3_name, &name);
4918 proto_item_set_text(entry_item, "Entry: name %s", name);
4920 if (check_col(pinfo->cinfo, COL_INFO)) {
4921 col_append_fstr(pinfo->cinfo, COL_INFO," %s", name);
4925 offset = dissect_rpc_uint64(tvb, entry_tree, hf_nfs_readdir_entry3_cookie,
4928 /* now we know, that a readdir entry is shorter */
4930 proto_item_set_len(entry_item, offset - old_offset);
4937 /* RFC 1813, Page 76..80 */
4939 dissect_nfs3_readdir_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
4946 offset = dissect_stat(tvb, offset, tree, &status);
4949 proto_item_append_text(tree, ", READDIR Reply");
4951 offset = dissect_nfs_post_op_attr(tvb, offset, tree,
4953 offset = dissect_cookieverf3(tvb, offset, tree);
4954 offset = dissect_rpc_list(tvb, pinfo, tree, offset,
4956 eof_value = tvb_get_ntohl(tvb, offset+0);
4958 proto_tree_add_uint(tree, hf_nfs_readdir_eof, tvb,
4959 offset+ 0, 4, eof_value);
4963 offset = dissect_nfs_post_op_attr(tvb, offset, tree,
4966 err=val_to_str(status, names_nfs_stat, "Unknown error:%u");
4967 if (check_col(pinfo->cinfo, COL_INFO)) {
4968 col_append_fstr(pinfo->cinfo, COL_INFO," Error:%s", err);
4970 proto_item_append_text(tree, ", READDIR Reply Error:%s", err);
4978 /* RFC 1813, Page 80..83 */
4980 dissect_nfs3_readdirplus_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
4985 offset = dissect_nfs_fh3 (tvb, offset, pinfo, tree, "dir", &hash);
4986 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_cookie3, offset);
4987 offset = dissect_cookieverf3(tvb, offset, tree);
4988 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_count3_dircount,
4990 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_count3_maxcount,
4993 if (check_col(pinfo->cinfo, COL_INFO)) {
4994 col_append_fstr(pinfo->cinfo, COL_INFO,", FH:0x%08x", hash);
4996 proto_item_append_text(tree, ", READDIRPLUS Call FH:0x%08x", hash);
5002 /* RFC 1813, Page 80..83 */
5004 dissect_entryplus3(tvbuff_t *tvb, int offset, packet_info *pinfo,
5007 proto_item* entry_item = NULL;
5008 proto_tree* entry_tree = NULL;
5009 int old_offset = offset;
5013 entry_item = proto_tree_add_item(tree, hf_nfs_readdir_entry, tvb,
5014 offset+0, -1, FALSE);
5015 entry_tree = proto_item_add_subtree(entry_item, ett_nfs_readdir_entry);
5018 offset = dissect_rpc_uint64(tvb, entry_tree,
5019 hf_nfs_readdirplus_entry_fileid, offset);
5021 offset = dissect_filename3(tvb, offset, entry_tree,
5022 hf_nfs_readdirplus_entry_name, &name);
5024 proto_item_set_text(entry_item, "Entry: name %s", name);
5026 if (check_col(pinfo->cinfo, COL_INFO)) {
5027 col_append_fstr(pinfo->cinfo, COL_INFO," %s", name);
5031 offset = dissect_rpc_uint64(tvb, entry_tree, hf_nfs_readdirplus_entry_cookie,
5034 offset = dissect_nfs_post_op_attr(tvb, offset, entry_tree,
5036 offset = dissect_post_op_fh3(tvb, offset, pinfo, entry_tree, "name_handle");
5038 /* now we know, that a readdirplus entry is shorter */
5040 proto_item_set_len(entry_item, offset - old_offset);
5047 /* RFC 1813, Page 80..83 */
5049 dissect_nfs3_readdirplus_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
5056 offset = dissect_stat(tvb, offset, tree, &status);
5059 proto_item_append_text(tree, ", READDIRPLUS Reply");
5061 offset = dissect_nfs_post_op_attr(tvb, offset, tree,
5063 offset = dissect_cookieverf3(tvb, offset, tree);
5064 offset = dissect_rpc_list(tvb, pinfo, tree, offset,
5065 dissect_entryplus3);
5066 eof_value = tvb_get_ntohl(tvb, offset+0);
5068 proto_tree_add_uint(tree, hf_nfs_readdir_eof, tvb,
5069 offset+ 0, 4, eof_value);
5073 offset = dissect_nfs_post_op_attr(tvb, offset, tree,
5076 err=val_to_str(status, names_nfs_stat, "Unknown error:%u");
5077 if (check_col(pinfo->cinfo, COL_INFO)) {
5078 col_append_fstr(pinfo->cinfo, COL_INFO," Error:%s", err);
5080 proto_item_append_text(tree, ", READDIRPLUS Reply Error:%s", err);
5088 /* RFC 1813, Page 84..86 */
5090 dissect_nfs3_fsstat_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
5095 offset = dissect_nfs_fh3(tvb, offset, pinfo, tree, "object", &hash);
5097 if (check_col(pinfo->cinfo, COL_INFO)) {
5098 col_append_fstr(pinfo->cinfo, COL_INFO,", FH:0x%08x", hash);
5100 proto_item_append_text(tree, ", FSSTAT Call DH:0x%08x", hash);
5106 dissect_nfs3_fsstat_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
5113 offset = dissect_nfsstat3(tvb, offset, tree, &status);
5116 offset = dissect_nfs_post_op_attr(tvb, offset, tree,
5118 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_fsstat3_resok_tbytes,
5120 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_fsstat3_resok_fbytes,
5122 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_fsstat3_resok_abytes,
5124 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_fsstat3_resok_tfiles,
5126 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_fsstat3_resok_ffiles,
5128 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_fsstat3_resok_afiles,
5130 invarsec = tvb_get_ntohl(tvb, offset + 0);
5132 proto_tree_add_uint(tree, hf_nfs_fsstat_invarsec, tvb,
5133 offset+0, 4, invarsec);
5136 proto_item_append_text(tree, ", FSSTAT Reply");
5139 offset = dissect_nfs_post_op_attr(tvb, offset, tree,
5142 err=val_to_str(status, names_nfs_stat, "Unknown error:%u");
5143 if (check_col(pinfo->cinfo, COL_INFO)) {
5144 col_append_fstr(pinfo->cinfo, COL_INFO," Error:%s", err);
5146 proto_item_append_text(tree, ", FSSTAT Reply Error:%s", err);
5154 #define FSF3_LINK 0x0001
5155 #define FSF3_SYMLINK 0x0002
5156 #define FSF3_HOMOGENEOUS 0x0008
5157 #define FSF3_CANSETTIME 0x0010
5160 /* RFC 1813, Page 86..90 */
5162 dissect_nfs3_fsinfo_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
5167 offset = dissect_nfs_fh3(tvb, offset, pinfo, tree, "object", &hash);
5169 if (check_col(pinfo->cinfo, COL_INFO)) {
5170 col_append_fstr(pinfo->cinfo, COL_INFO,", FH:0x%08x", hash);
5172 proto_item_append_text(tree, ", FSINFO Call DH:0x%08x", hash);
5176 dissect_nfs3_fsinfo_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
5188 proto_item* properties_item = NULL;
5189 proto_tree* properties_tree = NULL;
5192 offset = dissect_nfsstat3(tvb, offset, tree, &status);
5195 offset = dissect_nfs_post_op_attr(tvb, offset, tree,
5197 rtmax = tvb_get_ntohl(tvb, offset+0);
5199 proto_tree_add_uint(tree, hf_nfs_fsinfo_rtmax, tvb,
5200 offset+0, 4, rtmax);
5202 rtpref = tvb_get_ntohl(tvb, offset+0);
5204 proto_tree_add_uint(tree, hf_nfs_fsinfo_rtpref, tvb,
5205 offset+0, 4, rtpref);
5207 rtmult = tvb_get_ntohl(tvb, offset+0);
5209 proto_tree_add_uint(tree, hf_nfs_fsinfo_rtmult, tvb,
5210 offset+0, 4, rtmult);
5212 wtmax = tvb_get_ntohl(tvb, offset+0);
5214 proto_tree_add_uint(tree, hf_nfs_fsinfo_wtmax, tvb,
5215 offset+0, 4, wtmax);
5217 wtpref = tvb_get_ntohl(tvb, offset+0);
5219 proto_tree_add_uint(tree, hf_nfs_fsinfo_wtpref, tvb,
5220 offset+0, 4, wtpref);
5222 wtmult = tvb_get_ntohl(tvb, offset+0);
5224 proto_tree_add_uint(tree, hf_nfs_fsinfo_wtmult, tvb,
5225 offset+0, 4, wtmult);
5227 dtpref = tvb_get_ntohl(tvb, offset+0);
5229 proto_tree_add_uint(tree, hf_nfs_fsinfo_dtpref, tvb,
5230 offset+0, 4, dtpref);
5233 offset = dissect_rpc_uint64(tvb, tree,
5234 hf_nfs_fsinfo_maxfilesize, offset);
5235 offset = dissect_nfstime3(tvb, offset, tree, hf_nfs_dtime, hf_nfs_dtime_sec, hf_nfs_dtime_nsec);
5236 properties = tvb_get_ntohl(tvb, offset+0);
5238 properties_item = proto_tree_add_uint(tree,
5239 hf_nfs_fsinfo_properties,
5240 tvb, offset+0, 4, properties);
5241 if (properties_item)
5242 properties_tree = proto_item_add_subtree(properties_item,
5243 ett_nfs_fsinfo_properties);
5244 if (properties_tree) {
5245 proto_tree_add_text(properties_tree, tvb,
5247 decode_boolean_bitfield(properties,
5249 "SETATTR can set time on server",
5250 "SETATTR can't set time on server"));
5252 proto_tree_add_text(properties_tree, tvb,
5254 decode_boolean_bitfield(properties,
5256 "PATHCONF is valid for all files",
5257 "PATHCONF should be get for every single file"));
5259 proto_tree_add_text(properties_tree, tvb,
5261 decode_boolean_bitfield(properties,
5263 "File System supports symbolic links",
5264 "File System does not symbolic hard links"));
5266 proto_tree_add_text(properties_tree, tvb,
5268 decode_boolean_bitfield(properties,
5270 "File System supports hard links",
5271 "File System does not support hard links"));
5276 proto_item_append_text(tree, ", FSINFO Reply");
5279 offset = dissect_nfs_post_op_attr(tvb, offset, tree,
5282 err=val_to_str(status, names_nfs_stat, "Unknown error:%u");
5283 if (check_col(pinfo->cinfo, COL_INFO)) {
5284 col_append_fstr(pinfo->cinfo, COL_INFO," Error:%s", err);
5286 proto_item_append_text(tree, ", FSINFO Reply Error:%s", err);
5294 /* RFC 1813, Page 90..92 */
5296 dissect_nfs3_pathconf_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
5301 offset = dissect_nfs_fh3(tvb, offset, pinfo, tree, "object", &hash);
5303 if (check_col(pinfo->cinfo, COL_INFO)) {
5304 col_append_fstr(pinfo->cinfo, COL_INFO,", FH:0x%08x", hash);
5306 proto_item_append_text(tree, ", PATHCONF Call DH:0x%08x", hash);
5310 dissect_nfs3_pathconf_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
5318 offset = dissect_nfsstat3(tvb, offset, tree, &status);
5321 offset = dissect_nfs_post_op_attr(tvb, offset, tree,
5323 linkmax = tvb_get_ntohl(tvb, offset + 0);
5325 proto_tree_add_uint(tree, hf_nfs_pathconf_linkmax, tvb,
5326 offset+0, 4, linkmax);
5328 name_max = tvb_get_ntohl(tvb, offset + 0);
5330 proto_tree_add_uint(tree, hf_nfs_pathconf_name_max, tvb,
5331 offset+0, 4, name_max);
5333 offset = dissect_rpc_bool(tvb, tree,
5334 hf_nfs_pathconf_no_trunc, offset);
5335 offset = dissect_rpc_bool(tvb, tree,
5336 hf_nfs_pathconf_chown_restricted, offset);
5337 offset = dissect_rpc_bool(tvb, tree,
5338 hf_nfs_pathconf_case_insensitive, offset);
5339 offset = dissect_rpc_bool(tvb, tree,
5340 hf_nfs_pathconf_case_preserving, offset);
5342 proto_item_append_text(tree, ", PATHCONF Reply");
5345 offset = dissect_nfs_post_op_attr(tvb, offset, tree,
5348 err=val_to_str(status, names_nfs_stat, "Unknown error:%u");
5349 if (check_col(pinfo->cinfo, COL_INFO)) {
5350 col_append_fstr(pinfo->cinfo, COL_INFO," Error:%s", err);
5352 proto_item_append_text(tree, ", PATHCONF Reply Error:%s", err);
5360 /* RFC 1813, Page 92..95 */
5362 dissect_nfs3_commit_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
5367 offset = dissect_nfs_fh3(tvb, offset, pinfo, tree, "file", &hash);
5368 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_offset3, offset);
5369 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_count3, offset);
5371 if (check_col(pinfo->cinfo, COL_INFO)) {
5372 col_append_fstr(pinfo->cinfo, COL_INFO,", FH:0x%08x", hash);
5374 proto_item_append_text(tree, ", COMMIT Call FH:0x%08x", hash);
5380 /* RFC 1813, Page 92..95 */
5382 dissect_nfs3_commit_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
5388 offset = dissect_nfsstat3(tvb, offset, tree, &status);
5391 offset = dissect_wcc_data (tvb, offset, tree, "file_wcc");
5392 offset = dissect_writeverf3(tvb, offset, tree);
5394 proto_item_append_text(tree, ", COMMIT Reply");
5397 offset = dissect_wcc_data(tvb, offset, tree, "file_wcc");
5399 err=val_to_str(status, names_nfs_stat, "Unknown error:%u");
5400 if (check_col(pinfo->cinfo, COL_INFO)) {
5401 col_append_fstr(pinfo->cinfo, COL_INFO," Error:%s", err);
5403 proto_item_append_text(tree, ", COMMIT Reply Error:%s", err);
5410 /**********************************************************/
5411 /* NFS Version 4, RFC 3010 with nfs4_prot.x 1.103 changes */
5412 /**********************************************************/
5415 dissect_nfs_utf8string(tvbuff_t *tvb, int offset,
5416 proto_tree *tree, int hf, char **string_ret)
5418 /* TODO: this dissector is subject to change; do not remove */
5419 return dissect_rpc_string(tvb, tree, hf, offset, string_ret);
5423 dissect_nfs_specdata4(tvbuff_t *tvb, int offset, proto_tree *tree)
5425 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_specdata1, offset);
5426 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_specdata2, offset);
5431 static const value_string names_ftype4[] = {
5432 { NF4REG, "NF4REG" },
5433 { NF4DIR, "NF4DIR" },
5434 { NF4BLK, "NF4BLK" },
5435 { NF4CHR, "NF4CHR" },
5436 { NF4LNK, "NF4LNK" },
5437 { NF4SOCK, "NF4SOCK" },
5438 { NF4FIFO, "NF4FIFO" },
5439 { NF4ATTRDIR, "NF4ATTRDIR" },
5440 { NF4NAMEDATTR, "NF4NAMEDATTR" },
5445 dissect_nfs_lock_owner4(tvbuff_t *tvb, int offset, proto_tree *tree)
5447 proto_tree *newftree = NULL;
5448 proto_item *fitem = NULL;
5450 fitem = proto_tree_add_text(tree, tvb, offset, 4, "Owner");
5454 newftree = proto_item_add_subtree(fitem, ett_nfs_lock_owner4);
5458 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_clientid4, offset);
5459 offset = dissect_nfsdata(tvb, offset, newftree, hf_nfs_data);
5467 dissect_nfs_pathname4(tvbuff_t *tvb, int offset, proto_tree *tree)
5469 guint32 comp_count, i;
5470 proto_item *fitem = NULL;
5471 proto_tree *newftree = NULL;
5473 comp_count=tvb_get_ntohl(tvb, offset);
5474 fitem = proto_tree_add_text(tree, tvb, offset, 4,
5475 "pathname components (%u)", comp_count);
5480 newftree = proto_item_add_subtree(fitem, ett_nfs_pathname4);
5484 for (i = 0; i < comp_count; i++)
5485 offset = dissect_nfs_utf8string(tvb, offset, newftree,
5486 hf_nfs_component4, NULL);
5494 dissect_nfs_nfstime4(tvbuff_t *tvb, int offset, proto_tree *tree)
5496 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_nfstime4_seconds, offset);
5497 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_nfstime4_nseconds, offset);
5502 static const value_string names_time_how4[] = {
5503 #define SET_TO_SERVER_TIME4 0
5504 { SET_TO_SERVER_TIME4, "SET_TO_SERVER_TIME4" },
5505 #define SET_TO_CLIENT_TIME4 1
5506 { SET_TO_CLIENT_TIME4, "SET_TO_CLIENT_TIME4" },
5511 dissect_nfs_settime4(tvbuff_t *tvb, int offset,
5512 proto_tree *tree, char *name _U_)
5516 set_it = tvb_get_ntohl(tvb, offset);
5517 proto_tree_add_uint(tree, hf_nfs_time_how4, tvb, offset+0,
5521 if (set_it == SET_TO_CLIENT_TIME4)
5522 offset = dissect_nfs_nfstime4(tvb, offset, tree);
5528 dissect_nfs_fsid4(tvbuff_t *tvb, int offset, proto_tree *tree, char *name)
5530 proto_tree *newftree = NULL;
5531 proto_item *fitem = NULL;
5533 fitem = proto_tree_add_text(tree, tvb, offset, 0, "%s", name);
5535 if (fitem == NULL) return offset;
5537 newftree = proto_item_add_subtree(fitem, ett_nfs_fsid4);
5539 if (newftree == NULL) return offset;
5541 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_fsid4_major,
5543 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_fsid4_minor,
5549 static const value_string names_acetype4[] = {
5550 #define ACE4_ACCESS_ALLOWED_ACE_TYPE 0x00000000
5551 { ACE4_ACCESS_ALLOWED_ACE_TYPE, "ACE4_ACCESS_ALLOWED_ACE_TYPE" },
5552 #define ACE4_ACCESS_DENIED_ACE_TYPE 0x00000001
5553 { ACE4_ACCESS_DENIED_ACE_TYPE, "ACE4_ACCESS_DENIED_ACE_TYPE" },
5554 #define ACE4_SYSTEM_AUDIT_ACE_TYPE 0x00000002
5555 { ACE4_SYSTEM_AUDIT_ACE_TYPE, "ACE4_SYSTEM_AUDIT_ACE_TYPE" },
5556 #define ACE4_SYSTEM_ALARM_ACE_TYPE 0x00000003
5557 { ACE4_SYSTEM_ALARM_ACE_TYPE, "ACE4_SYSTEM_ALARM_ACE_TYPE" },
5561 /* ACE mask values */
5562 #define ACE4_READ_DATA 0x00000001
5563 #define ACE4_LIST_DIRECTORY 0x00000001
5564 #define ACE4_WRITE_DATA 0x00000002
5565 #define ACE4_ADD_FILE 0x00000002
5566 #define ACE4_APPEND_DATA 0x00000004
5567 #define ACE4_ADD_SUBDIRECTORY 0x00000004
5568 #define ACE4_READ_NAMED_ATTRS 0x00000008
5569 #define ACE4_WRITE_NAMED_ATTRS 0x00000010
5570 #define ACE4_EXECUTE 0x00000020
5571 #define ACE4_DELETE_CHILD 0x00000040
5572 #define ACE4_READ_ATTRIBUTES 0x00000080
5573 #define ACE4_WRITE_ATTRIBUTES 0x00000100
5574 #define ACE4_DELETE 0x00010000
5575 #define ACE4_READ_ACL 0x00020000
5576 #define ACE4_WRITE_ACL 0x00040000
5577 #define ACE4_WRITE_OWNER 0x00080000
5578 #define ACE4_SYNCHRONIZE 0x00100000
5581 dissect_nfs_acemask4(tvbuff_t *tvb, int offset, proto_tree *tree)
5584 proto_item *acemask_item = NULL;
5585 proto_tree *acemask_tree = NULL;
5587 acemask = tvb_get_ntohl(tvb, offset);
5589 acemask_item = proto_tree_add_text(tree, tvb, offset, 4,
5590 "acemask: 0x%08x", acemask);
5593 acemask_tree = proto_item_add_subtree(acemask_item, ett_nfs_acemask4);
5597 if (acemask & ACE4_READ_DATA)
5598 proto_tree_add_text(acemask_tree, tvb, offset, 4,
5599 "ACE4_READ_DATA/ACE4_LIST_DIRECTORY (0x%08x)",
5602 if (acemask & ACE4_WRITE_DATA)
5603 proto_tree_add_text(acemask_tree, tvb, offset, 4,
5604 "ACE4_WRITE_DATA/ACE4_ADD_FILE (0x%08x)",
5607 if (acemask & ACE4_APPEND_DATA)
5608 proto_tree_add_text(acemask_tree, tvb, offset, 4,
5609 "ACE4_ADD_FILE/ACE4_ADD_SUBDIRECTORY (0x%08x)",
5612 if (acemask & ACE4_READ_NAMED_ATTRS)
5613 proto_tree_add_text(acemask_tree, tvb, offset, 4,
5614 "ACE4_READ_NAMED_ATTRS (0x%08x)",
5615 ACE4_READ_NAMED_ATTRS);
5617 if (acemask & ACE4_WRITE_NAMED_ATTRS)
5618 proto_tree_add_text(acemask_tree, tvb, offset, 4,
5619 "ACE4_WRITE_NAMED_ATTRS (0x%08x)",
5620 ACE4_WRITE_NAMED_ATTRS);
5622 if (acemask & ACE4_EXECUTE)
5623 proto_tree_add_text(acemask_tree, tvb, offset, 4,
5624 "ACE4_EXECUTE (0x%08x)",
5627 if (acemask & ACE4_DELETE_CHILD)
5628 proto_tree_add_text(acemask_tree, tvb, offset, 4,
5629 "ACE4_DELETE_CHILD (0x%08x)",
5632 if (acemask & ACE4_READ_ATTRIBUTES)
5633 proto_tree_add_text(acemask_tree, tvb, offset, 4,
5634 "ACE4_READ_ATTRIBUTES (0x%08x)",
5635 ACE4_READ_ATTRIBUTES);
5637 if (acemask & ACE4_WRITE_ATTRIBUTES)
5638 proto_tree_add_text(acemask_tree, tvb, offset, 4,
5639 "ACE4_WRITE_ATTRIBUTES (0x%08x)",
5640 ACE4_WRITE_ATTRIBUTES);
5642 if (acemask & ACE4_DELETE)
5643 proto_tree_add_text(acemask_tree, tvb, offset, 4,
5644 "ACE4_DELETE (0x%08x)",
5647 if (acemask & ACE4_READ_ACL)
5648 proto_tree_add_text(acemask_tree, tvb, offset, 4,
5649 "ACE4_READ_ACL (0x%08x)",
5652 if (acemask & ACE4_WRITE_ACL)
5653 proto_tree_add_text(acemask_tree, tvb, offset, 4,
5654 "ACE4_WRITE_ACL (0x%08x)",
5657 if (acemask & ACE4_WRITE_OWNER)
5658 proto_tree_add_text(acemask_tree, tvb, offset, 4,
5659 "ACE4_WRITE_OWNER (0x%08x)",
5662 if (acemask & ACE4_SYNCHRONIZE)
5663 proto_tree_add_text(acemask_tree, tvb, offset, 4,
5664 "ACE4_SYNCHRONIZE (0x%08x)",
5673 /* ACE flag values */
5674 #define ACE4_FILE_INHERIT_ACE 0x00000001
5675 #define ACE4_DIRECTORY_INHERIT_ACE 0x00000002
5676 #define ACE4_NO_PROPAGATE_INHERIT_ACE 0x00000004
5677 #define ACE4_INHERIT_ONLY_ACE 0x00000008
5678 #define ACE4_SUCCESSFUL_ACCESS_ACE_FLAG 0x00000010
5679 #define ACE4_FAILED_ACCESS_ACE_FLAG 0x00000020
5680 #define ACE4_IDENTIFIER_GROUP 0x00000040
5684 dissect_nfs_ace4(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
5687 proto_item* ace_item = NULL;
5688 proto_tree* ace_tree = NULL;
5689 proto_item *aceflag_item = NULL;
5690 proto_tree *aceflag_tree = NULL;
5694 ace_item = proto_tree_add_text(tree, tvb, offset, 4,
5698 ace_tree = proto_item_add_subtree(ace_item, ett_nfs_ace4);
5702 offset = dissect_rpc_uint32(tvb, ace_tree, hf_nfs_acetype4, offset);
5704 aceflag4 = tvb_get_ntohl(tvb, offset);
5706 aceflag_item = proto_tree_add_text(ace_tree, tvb, offset, 4,
5707 "aceflag: 0x%08x", aceflag4);
5711 aceflag_tree = proto_item_add_subtree(aceflag_item, ett_nfs_aceflag4);
5715 if (aceflag4 & ACE4_FILE_INHERIT_ACE)
5716 proto_tree_add_text(aceflag_tree, tvb, offset, 4,
5717 "ACE4_FILE_INHERIT_ACE (0x%08x)", ACE4_FILE_INHERIT_ACE);
5719 if (aceflag4 & ACE4_DIRECTORY_INHERIT_ACE)
5720 proto_tree_add_text(aceflag_tree, tvb, offset, 4,
5721 "ACE4_DIRECTORY_INHERIT_ACE (0x%08x)",
5722 ACE4_DIRECTORY_INHERIT_ACE);
5724 if (aceflag4 & ACE4_INHERIT_ONLY_ACE)
5725 proto_tree_add_text(aceflag_tree, tvb, offset, 4,
5726 "ACE4_INHERIT_ONLY_ACE (0x%08x)",
5727 ACE4_INHERIT_ONLY_ACE);
5729 if (aceflag4 & ACE4_SUCCESSFUL_ACCESS_ACE_FLAG)
5730 proto_tree_add_text(aceflag_tree, tvb, offset, 4,
5731 "ACE4_SUCCESSFUL_ACCESS_ACE_FLAG (0x%08x)",
5732 ACE4_SUCCESSFUL_ACCESS_ACE_FLAG);
5734 if (aceflag4 & ACE4_FAILED_ACCESS_ACE_FLAG)
5735 proto_tree_add_text(aceflag_tree, tvb, offset, 4,
5736 "ACE4_FAILED_ACCESS_ACE_FLAG (0x%08x)",
5737 ACE4_FAILED_ACCESS_ACE_FLAG);
5739 if (aceflag4 & ACE4_IDENTIFIER_GROUP)
5740 proto_tree_add_text(aceflag_tree, tvb, offset, 4,
5741 "ACE4_IDENTIFIER_GROUP (0x%08x)",
5742 ACE4_IDENTIFIER_GROUP);
5748 offset = dissect_nfs_acemask4(tvb, offset, ace_tree);
5750 offset = dissect_nfs_utf8string(tvb, offset, ace_tree, hf_nfs_who, NULL);
5757 dissect_nfs_fattr4_acl(tvbuff_t *tvb, int offset, packet_info *pinfo,
5760 return dissect_rpc_array(tvb, pinfo, tree, offset, dissect_nfs_ace4,
5765 dissect_nfs_fh4(tvbuff_t *tvb, int offset, packet_info *pinfo,
5766 proto_tree *tree, char *name)
5768 return dissect_nfs_fh3(tvb, offset, pinfo, tree, name, NULL);
5772 dissect_nfs_fs_location4(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
5775 proto_tree *newftree = NULL;
5776 proto_item *fitem = NULL;
5778 fitem = proto_tree_add_text(tree, tvb, offset, 0, "rootpath");
5780 if (fitem == NULL) return offset;
5782 newftree = proto_item_add_subtree(fitem, ett_nfs_fs_location4);
5784 if (newftree == NULL) return offset;
5786 offset = dissect_nfs_utf8string(tvb, offset, tree, hf_nfs_server, NULL);
5792 dissect_nfs_fs_locations4(tvbuff_t *tvb, packet_info *pinfo, int offset,
5793 proto_tree *tree, char *name)
5795 proto_tree *newftree = NULL;
5796 proto_item *fitem = NULL;
5798 fitem = proto_tree_add_text(tree, tvb, offset, 0, "%s", name);
5800 if (fitem == NULL) return offset;
5802 newftree = proto_item_add_subtree(fitem, ett_nfs_fs_locations4);
5804 if (newftree == NULL) return offset;
5806 offset = dissect_nfs_pathname4(tvb, offset, newftree);
5808 offset = dissect_rpc_list(tvb, pinfo, tree, offset,
5809 dissect_nfs_fs_location4);
5815 dissect_nfs_mode4(tvbuff_t *tvb, int offset,
5816 proto_tree *tree, char *name)
5818 return dissect_mode(tvb, offset, tree, name);
5821 static const value_string nfs4_fattr4_fh_expire_type_names[] = {
5822 #define FH4_PERSISTENT 0x00000000
5823 { FH4_PERSISTENT, "FH4_PERSISTENT" },
5824 #define FH4_NOEXPIRE_WITH_OPEN 0x00000001
5825 { FH4_NOEXPIRE_WITH_OPEN, "FH4_NOEXPIRE_WITH_OPEN" },
5826 #define FH4_VOLATILE_ANY 0x00000002
5827 { FH4_VOLATILE_ANY, "FH4_VOLATILE_ANY" },
5828 #define FH4_VOL_MIGRATION 0x00000004
5829 { FH4_VOL_MIGRATION, "FH4_VOL_MIGRATION" },
5830 #define FH4_VOL_RENAME 0x00000008
5831 { FH4_VOL_RENAME, "FH4_VOL_RENAME" },
5837 dissect_nfs_fattr4_fh_expire_type(tvbuff_t *tvb, int offset, proto_tree *tree)
5839 guint32 expire_type;
5840 proto_item *expire_type_item = NULL;
5841 proto_tree *expire_type_tree = NULL;
5843 expire_type = tvb_get_ntohl(tvb, offset + 0);
5847 expire_type_item = proto_tree_add_text(tree, tvb, offset, 4,
5848 "fattr4_fh_expire_type: 0x%08x", expire_type);
5849 if (expire_type_item)
5850 expire_type_tree = proto_item_add_subtree(expire_type_item,
5851 ett_nfs_fattr4_fh_expire_type);
5854 if (expire_type_tree)
5856 if (expire_type == FH4_PERSISTENT)
5858 proto_tree_add_text(expire_type_tree, tvb, offset, 4, "%s",
5859 decode_enumerated_bitfield(expire_type, FH4_PERSISTENT, 8,
5860 nfs4_fattr4_fh_expire_type_names, "%s"));
5864 if (expire_type & FH4_NOEXPIRE_WITH_OPEN)
5865 proto_tree_add_text(expire_type_tree, tvb, offset, 4,
5866 "FH4_NOEXPIRE_WITH_OPEN (0x%08x)", FH4_NOEXPIRE_WITH_OPEN);
5868 if (expire_type & FH4_VOLATILE_ANY)
5869 proto_tree_add_text(expire_type_tree, tvb, offset, 4,
5870 "FH4_VOLATILE_ANY (0x%08x)", FH4_VOLATILE_ANY);
5872 if (expire_type & FH4_VOL_MIGRATION)
5873 proto_tree_add_text(expire_type_tree, tvb, offset, 4,
5874 "FH4_VOL_MIGRATION (0x%08x)", FH4_VOL_MIGRATION);
5876 if (expire_type & FH4_VOL_RENAME)
5877 proto_tree_add_text(expire_type_tree, tvb, offset, 4,
5878 "FH4_VOL_RENAME (0x%08x)", FH4_VOL_RENAME);
5887 static const value_string names_fattr4[] = {
5888 #define FATTR4_SUPPORTED_ATTRS 0
5889 { FATTR4_SUPPORTED_ATTRS, "FATTR4_SUPPORTED_ATTRS" },
5890 #define FATTR4_TYPE 1
5891 { FATTR4_TYPE, "FATTR4_TYPE" },
5892 #define FATTR4_FH_EXPIRE_TYPE 2
5893 { FATTR4_FH_EXPIRE_TYPE, "FATTR4_FH_EXPIRE_TYPE" },
5894 #define FATTR4_CHANGE 3
5895 { FATTR4_CHANGE, "FATTR4_CHANGE" },
5896 #define FATTR4_SIZE 4
5897 { FATTR4_SIZE, "FATTR4_SIZE" },
5898 #define FATTR4_LINK_SUPPORT 5
5899 { FATTR4_LINK_SUPPORT, "FATTR4_LINK_SUPPORT" },
5900 #define FATTR4_SYMLINK_SUPPORT 6
5901 { FATTR4_SYMLINK_SUPPORT, "FATTR4_SYMLINK_SUPPORT" },
5902 #define FATTR4_NAMED_ATTR 7
5903 { FATTR4_NAMED_ATTR, "FATTR4_NAMED_ATTR" },
5904 #define FATTR4_FSID 8
5905 { FATTR4_FSID, "FATTR4_FSID" },
5906 #define FATTR4_UNIQUE_HANDLES 9
5907 { FATTR4_UNIQUE_HANDLES, "FATTR4_UNIQUE_HANDLES" },
5908 #define FATTR4_LEASE_TIME 10
5909 { FATTR4_LEASE_TIME, "FATTR4_LEASE_TIME" },
5910 #define FATTR4_RDATTR_ERROR 11
5911 { FATTR4_RDATTR_ERROR, "FATTR4_RDATTR_ERROR" },
5912 #define FATTR4_ACL 12
5913 { FATTR4_ACL, "FATTR4_ACL" },
5914 #define FATTR4_ACLSUPPORT 13
5915 { FATTR4_ACLSUPPORT, "FATTR4_ACLSUPPORT" },
5916 #define FATTR4_ARCHIVE 14
5917 { FATTR4_ARCHIVE, "FATTR4_ARCHIVE" },
5918 #define FATTR4_CANSETTIME 15
5919 { FATTR4_CANSETTIME, "FATTR4_CANSETTIME" },
5920 #define FATTR4_CASE_INSENSITIVE 16
5921 { FATTR4_CASE_INSENSITIVE, "FATTR4_CASE_INSENSITIVE" },
5922 #define FATTR4_CASE_PRESERVING 17
5923 { FATTR4_CASE_PRESERVING, "FATTR4_CASE_PRESERVING" },
5924 #define FATTR4_CHOWN_RESTRICTED 18
5925 { FATTR4_CHOWN_RESTRICTED, "FATTR4_CHOWN_RESTRICTED" },
5926 #define FATTR4_FILEHANDLE 19
5927 { FATTR4_FILEHANDLE, "FATTR4_FILEHANDLE" },
5928 #define FATTR4_FILEID 20
5929 { FATTR4_FILEID, "FATTR4_FILEID" },
5930 #define FATTR4_FILES_AVAIL 21
5931 { FATTR4_FILES_AVAIL, "FATTR4_FILES_AVAIL" },
5932 #define FATTR4_FILES_FREE 22
5933 { FATTR4_FILES_FREE, "FATTR4_FILES_FREE" },
5934 #define FATTR4_FILES_TOTAL 23
5935 { FATTR4_FILES_TOTAL, "FATTR4_FILES_TOTAL" },
5936 #define FATTR4_FS_LOCATIONS 24
5937 { FATTR4_FS_LOCATIONS, "FATTR4_FS_LOCATIONS" },
5938 #define FATTR4_HIDDEN 25
5939 { FATTR4_HIDDEN, "FATTR4_HIDDEN" },
5940 #define FATTR4_HOMOGENEOUS 26
5941 { FATTR4_HOMOGENEOUS, "FATTR4_HOMOGENEOUS" },
5942 #define FATTR4_MAXFILESIZE 27
5943 { FATTR4_MAXFILESIZE, "FATTR4_MAXFILESIZE" },
5944 #define FATTR4_MAXLINK 28
5945 { FATTR4_MAXLINK, "FATTR4_MAXLINK" },
5946 #define FATTR4_MAXNAME 29
5947 { FATTR4_MAXNAME, "FATTR4_MAXNAME" },
5948 #define FATTR4_MAXREAD 30
5949 { FATTR4_MAXREAD, "FATTR4_MAXREAD" },
5950 #define FATTR4_MAXWRITE 31
5951 { FATTR4_MAXWRITE, "FATTR4_MAXWRITE" },
5952 #define FATTR4_MIMETYPE 32
5953 { FATTR4_MIMETYPE, "FATTR4_MIMETYPE" },
5954 #define FATTR4_MODE 33
5955 { FATTR4_MODE, "FATTR4_MODE" },
5956 #define FATTR4_NO_TRUNC 34
5957 { FATTR4_NO_TRUNC, "FATTR4_NO_TRUNC" },
5958 #define FATTR4_NUMLINKS 35
5959 { FATTR4_NUMLINKS, "FATTR4_NUMLINKS" },
5960 #define FATTR4_OWNER 36
5961 { FATTR4_OWNER, "FATTR4_OWNER" },
5962 #define FATTR4_OWNER_GROUP 37
5963 { FATTR4_OWNER_GROUP, "FATTR4_OWNER_GROUP" },
5964 #define FATTR4_QUOTA_AVAIL_HARD 38
5965 { FATTR4_QUOTA_AVAIL_HARD, "FATTR4_QUOTA_AVAIL_HARD" },
5966 #define FATTR4_QUOTA_AVAIL_SOFT 39
5967 { FATTR4_QUOTA_AVAIL_SOFT, "FATTR4_QUOTA_AVAIL_SOFT" },
5968 #define FATTR4_QUOTA_USED 40
5969 { FATTR4_QUOTA_USED, "FATTR4_QUOTA_USED" },
5970 #define FATTR4_RAWDEV 41
5971 { FATTR4_RAWDEV, "FATTR4_RAWDEV" },
5972 #define FATTR4_SPACE_AVAIL 42
5973 { FATTR4_SPACE_AVAIL, "FATTR4_SPACE_AVAIL" },
5974 #define FATTR4_SPACE_FREE 43
5975 { FATTR4_SPACE_FREE, "FATTR4_SPACE_FREE" },
5976 #define FATTR4_SPACE_TOTAL 44
5977 { FATTR4_SPACE_TOTAL, "FATTR4_SPACE_TOTAL" },
5978 #define FATTR4_SPACE_USED 45
5979 { FATTR4_SPACE_USED, "FATTR4_SPACE_USED" },
5980 #define FATTR4_SYSTEM 46
5981 { FATTR4_SYSTEM, "FATTR4_SYSTEM" },
5982 #define FATTR4_TIME_ACCESS 47
5983 { FATTR4_TIME_ACCESS, "FATTR4_TIME_ACCESS" },
5984 #define FATTR4_TIME_ACCESS_SET 48
5985 { FATTR4_TIME_ACCESS_SET, "FATTR4_TIME_ACCESS_SET" },
5986 #define FATTR4_TIME_BACKUP 49
5987 { FATTR4_TIME_BACKUP, "FATTR4_TIME_BACKUP" },
5988 #define FATTR4_TIME_CREATE 50
5989 { FATTR4_TIME_CREATE, "FATTR4_TIME_CREATE" },
5990 #define FATTR4_TIME_DELTA 51
5991 { FATTR4_TIME_DELTA, "FATTR4_TIME_DELTA" },
5992 #define FATTR4_TIME_METADATA 52
5993 { FATTR4_TIME_METADATA, "FATTR4_TIME_METADATA" },
5994 #define FATTR4_TIME_MODIFY 53
5995 { FATTR4_TIME_MODIFY, "FATTR4_TIME_MODIFY" },
5996 #define FATTR4_TIME_MODIFY_SET 54
5997 { FATTR4_TIME_MODIFY_SET, "FATTR4_TIME_MODIFY_SET" },
5998 #define FATTR4_MOUNTED_ON_FILEID 55
5999 { FATTR4_MOUNTED_ON_FILEID, "FATTR4_MOUNTED_ON_FILEID" },
6003 #define FATTR4_BITMAP_ONLY 0
6004 #define FATTR4_FULL_DISSECT 1
6007 dissect_nfs_attributes(tvbuff_t *tvb, int offset, packet_info *pinfo,
6008 proto_tree *tree, int type)
6011 proto_item *fitem = NULL;
6012 proto_tree *newftree = NULL;
6013 proto_item *attr_fitem = NULL;
6014 proto_tree *attr_newftree = NULL;
6020 int attr_vals_offset;
6022 bitmap_len = tvb_get_ntohl(tvb, offset);
6023 tvb_ensure_bytes_exist(tvb, offset, 4 + bitmap_len * 4);
6024 fitem = proto_tree_add_text(tree, tvb, offset, 4 + bitmap_len * 4,
6028 if (fitem == NULL) return offset;
6030 newftree = proto_item_add_subtree(fitem, ett_nfs_bitmap4);
6032 if (newftree == NULL) return offset;
6034 attr_vals_offset = offset + 4 + bitmap_len * 4;
6036 bitmap = g_malloc(bitmap_len * sizeof(guint32));
6037 if (bitmap == NULL) return offset;
6039 for (i = 0; i < bitmap_len; i++)
6041 bitmap[i] = tvb_get_ntohl(tvb, offset);
6045 for (j = 0; j < 32; j++)
6051 /* switch label if attribute is recommended vs. mandatory */
6052 attr_fitem = proto_tree_add_uint(newftree,
6053 (fattr < FATTR4_ACL)? hf_nfs_mand_attr: hf_nfs_recc_attr,
6054 tvb, offset, 4, fattr);
6056 if (attr_fitem == NULL) break;
6058 attr_newftree = proto_item_add_subtree(attr_fitem, ett_nfs_bitmap4);
6060 if (attr_newftree == NULL) break;
6062 if (type == FATTR4_FULL_DISSECT)
6064 /* do a full decode of the arguments for the set flag */
6067 case FATTR4_SUPPORTED_ATTRS:
6068 attr_vals_offset = dissect_nfs_attributes(tvb,
6069 attr_vals_offset, pinfo, attr_newftree,
6070 FATTR4_BITMAP_ONLY);
6074 attr_vals_offset = dissect_rpc_uint32(tvb,
6075 attr_newftree, hf_nfs_ftype4, attr_vals_offset);
6078 case FATTR4_FH_EXPIRE_TYPE:
6079 attr_vals_offset = dissect_nfs_fattr4_fh_expire_type(tvb,
6080 attr_vals_offset, attr_newftree);
6084 attr_vals_offset = dissect_rpc_uint64(tvb, attr_newftree,
6085 hf_nfs_changeid4, attr_vals_offset);
6089 attr_vals_offset = dissect_rpc_uint64(tvb,
6090 attr_newftree, hf_nfs_fattr4_size, attr_vals_offset);
6093 case FATTR4_LINK_SUPPORT:
6094 attr_vals_offset = dissect_rpc_bool(tvb,
6095 attr_newftree, hf_nfs_fattr4_link_support,
6099 case FATTR4_SYMLINK_SUPPORT:
6100 attr_vals_offset = dissect_rpc_bool(tvb,
6101 attr_newftree, hf_nfs_fattr4_symlink_support,
6105 case FATTR4_NAMED_ATTR:
6106 attr_vals_offset = dissect_rpc_bool(tvb,
6107 attr_newftree, hf_nfs_fattr4_named_attr, attr_vals_offset);
6111 attr_vals_offset = dissect_nfs_fsid4(tvb, attr_vals_offset,
6112 attr_newftree, "fattr4_fsid");
6115 case FATTR4_UNIQUE_HANDLES:
6116 attr_vals_offset = dissect_rpc_bool(tvb,
6117 attr_newftree, hf_nfs_fattr4_unique_handles,
6121 case FATTR4_LEASE_TIME:
6122 attr_vals_offset = dissect_rpc_uint32(tvb,
6123 attr_newftree, hf_nfs_fattr4_lease_time,
6127 case FATTR4_RDATTR_ERROR:
6128 attr_vals_offset = dissect_nfs_nfsstat4(tvb,
6129 attr_vals_offset, attr_newftree, NULL);
6133 attr_vals_offset = dissect_nfs_fattr4_acl(tvb,
6134 attr_vals_offset, pinfo, attr_newftree);
6137 case FATTR4_ACLSUPPORT:
6138 attr_vals_offset = dissect_rpc_uint32(tvb,
6139 attr_newftree, hf_nfs_fattr4_aclsupport,
6143 case FATTR4_ARCHIVE:
6144 attr_vals_offset = dissect_rpc_bool(tvb,
6145 attr_newftree, hf_nfs_fattr4_archive,
6149 case FATTR4_CANSETTIME:
6150 attr_vals_offset = dissect_rpc_bool(tvb,
6151 attr_newftree, hf_nfs_fattr4_cansettime, attr_vals_offset);
6154 case FATTR4_CASE_INSENSITIVE:
6155 attr_vals_offset = dissect_rpc_bool(tvb,
6156 attr_newftree, hf_nfs_fattr4_case_insensitive,
6160 case FATTR4_CASE_PRESERVING:
6161 attr_vals_offset = dissect_rpc_bool(tvb,
6162 attr_newftree, hf_nfs_fattr4_case_preserving,
6166 case FATTR4_CHOWN_RESTRICTED:
6167 attr_vals_offset = dissect_rpc_bool(tvb,
6168 attr_newftree, hf_nfs_fattr4_chown_restricted,
6173 attr_vals_offset = dissect_rpc_uint64(tvb,
6174 attr_newftree, hf_nfs_fattr4_fileid, attr_vals_offset);
6177 case FATTR4_FILES_AVAIL:
6178 attr_vals_offset = dissect_rpc_uint64(tvb,
6179 attr_newftree, hf_nfs_fattr4_files_avail,
6183 case FATTR4_FILEHANDLE:
6184 attr_vals_offset = dissect_nfs_fh4(tvb, attr_vals_offset,
6185 pinfo, attr_newftree, "fattr4_filehandle");
6188 case FATTR4_FILES_FREE:
6189 attr_vals_offset = dissect_rpc_uint64(tvb,
6190 attr_newftree, hf_nfs_fattr4_files_free, attr_vals_offset);
6193 case FATTR4_FILES_TOTAL:
6194 attr_vals_offset = dissect_rpc_uint64(tvb,
6195 attr_newftree, hf_nfs_fattr4_files_total,
6199 case FATTR4_FS_LOCATIONS:
6200 attr_vals_offset = dissect_nfs_fs_locations4(tvb, pinfo,
6201 attr_vals_offset, attr_newftree,
6202 "fattr4_fs_locations");
6206 attr_vals_offset = dissect_rpc_bool(tvb,
6207 attr_newftree, hf_nfs_fattr4_hidden, attr_vals_offset);
6210 case FATTR4_HOMOGENEOUS:
6211 attr_vals_offset = dissect_rpc_bool(tvb,
6212 attr_newftree, hf_nfs_fattr4_homogeneous,
6216 case FATTR4_MAXFILESIZE:
6217 attr_vals_offset = dissect_rpc_uint64(tvb,
6218 attr_newftree, hf_nfs_fattr4_maxfilesize,
6222 case FATTR4_MAXLINK:
6223 attr_vals_offset = dissect_rpc_uint32(tvb,
6224 attr_newftree, hf_nfs_fattr4_maxlink, attr_vals_offset);
6227 case FATTR4_MAXNAME:
6228 attr_vals_offset = dissect_rpc_uint32(tvb,
6229 attr_newftree, hf_nfs_fattr4_maxname, attr_vals_offset);
6232 case FATTR4_MAXREAD:
6233 attr_vals_offset = dissect_rpc_uint64(tvb,
6234 attr_newftree, hf_nfs_fattr4_maxread, attr_vals_offset);
6237 case FATTR4_MAXWRITE:
6238 attr_vals_offset = dissect_rpc_uint64(tvb,
6239 attr_newftree, hf_nfs_fattr4_maxwrite, attr_vals_offset);
6242 case FATTR4_MIMETYPE:
6243 attr_vals_offset = dissect_nfs_utf8string(tvb,
6244 attr_vals_offset, attr_newftree,
6245 hf_nfs_fattr4_mimetype, NULL);
6249 attr_vals_offset = dissect_nfs_mode4(tvb,
6250 attr_vals_offset, attr_newftree, "fattr4_mode");
6253 case FATTR4_NO_TRUNC:
6254 attr_vals_offset = dissect_rpc_bool(tvb,
6255 attr_newftree, hf_nfs_fattr4_no_trunc, attr_vals_offset);
6258 case FATTR4_NUMLINKS:
6259 attr_vals_offset = dissect_rpc_uint32(tvb,
6260 attr_newftree, hf_nfs_fattr4_numlinks, attr_vals_offset);
6264 attr_vals_offset = dissect_nfs_utf8string(tvb,
6265 attr_vals_offset, attr_newftree,
6266 hf_nfs_fattr4_owner,
6270 case FATTR4_OWNER_GROUP:
6271 attr_vals_offset = dissect_nfs_utf8string(tvb,
6272 attr_vals_offset, attr_newftree,
6273 hf_nfs_fattr4_owner_group, NULL);
6276 case FATTR4_QUOTA_AVAIL_HARD:
6277 attr_vals_offset = dissect_rpc_uint64(tvb,
6278 attr_newftree, hf_nfs_fattr4_quota_hard, attr_vals_offset);
6281 case FATTR4_QUOTA_AVAIL_SOFT:
6282 attr_vals_offset = dissect_rpc_uint64(tvb,
6283 attr_newftree, hf_nfs_fattr4_quota_soft, attr_vals_offset);
6286 case FATTR4_QUOTA_USED:
6287 attr_vals_offset = dissect_rpc_uint64(tvb,
6288 attr_newftree, hf_nfs_fattr4_quota_used, attr_vals_offset);
6292 attr_vals_offset = dissect_nfs_specdata4(tvb,
6293 attr_vals_offset, attr_newftree);
6296 case FATTR4_SPACE_AVAIL:
6297 attr_vals_offset = dissect_rpc_uint64(tvb,
6298 attr_newftree, hf_nfs_fattr4_space_avail,
6302 case FATTR4_SPACE_FREE:
6303 attr_vals_offset = dissect_rpc_uint64(tvb,
6304 attr_newftree, hf_nfs_fattr4_space_free, attr_vals_offset);
6307 case FATTR4_SPACE_TOTAL:
6308 attr_vals_offset = dissect_rpc_uint64(tvb,
6309 attr_newftree, hf_nfs_fattr4_space_total,
6313 case FATTR4_SPACE_USED:
6314 attr_vals_offset = dissect_rpc_uint64(tvb,
6315 attr_newftree, hf_nfs_fattr4_space_used, attr_vals_offset);
6319 attr_vals_offset = dissect_rpc_bool(tvb,
6320 attr_newftree, hf_nfs_fattr4_system, attr_vals_offset);
6323 case FATTR4_TIME_ACCESS:
6324 case FATTR4_TIME_BACKUP:
6325 case FATTR4_TIME_CREATE:
6326 case FATTR4_TIME_DELTA:
6327 case FATTR4_TIME_METADATA:
6328 case FATTR4_TIME_MODIFY:
6329 attr_vals_offset = dissect_nfs_nfstime4(tvb, attr_vals_offset,
6333 case FATTR4_TIME_ACCESS_SET:
6334 case FATTR4_TIME_MODIFY_SET:
6335 attr_vals_offset = dissect_nfs_settime4(tvb,
6336 attr_vals_offset, attr_newftree, "settime4");
6357 dissect_nfs_fattr4(tvbuff_t *tvb, int offset, packet_info *pinfo,
6360 proto_tree *newftree = NULL;
6361 proto_item *fitem = NULL;
6363 fitem = proto_tree_add_text(tree, tvb, offset, 4, "obj_attributes");
6365 if (fitem == NULL) return offset;
6367 newftree = proto_item_add_subtree(fitem, ett_nfs_fattr4);
6369 if (newftree == NULL) return offset;
6371 offset = dissect_nfs_attributes(tvb, offset, pinfo, newftree,
6372 FATTR4_FULL_DISSECT);
6374 offset = dissect_nfsdata(tvb, offset, tree, hf_nfs_attrlist4);
6379 static const value_string names_open4_share_access[] = {
6380 #define OPEN4_SHARE_ACCESS_READ 0x00000001
6381 { OPEN4_SHARE_ACCESS_READ, "OPEN4_SHARE_ACCESS_READ" },
6382 #define OPEN4_SHARE_ACCESS_WRITE 0x00000002
6383 { OPEN4_SHARE_ACCESS_WRITE, "OPEN4_SHARE_ACCESS_WRITE" },
6384 #define OPEN4_SHARE_ACCESS_BOTH 0x00000003
6385 { OPEN4_SHARE_ACCESS_BOTH, "OPEN4_SHARE_ACCESS_BOTH" },
6390 dissect_nfs_open4_share_access(tvbuff_t *tvb, int offset,
6395 share_access = tvb_get_ntohl(tvb, offset);
6396 proto_tree_add_uint(tree, hf_nfs_open4_share_access, tvb, offset, 4,
6403 static const value_string names_open4_share_deny[] = {
6404 #define OPEN4_SHARE_DENY_NONE 0x00000000
6405 { OPEN4_SHARE_DENY_NONE, "OPEN4_SHARE_DENY_NONE" },
6406 #define OPEN4_SHARE_DENY_READ 0x00000001
6407 { OPEN4_SHARE_DENY_READ, "OPEN4_SHARE_DENY_READ" },
6408 #define OPEN4_SHARE_DENY_WRITE 0x00000002
6409 { OPEN4_SHARE_DENY_WRITE, "OPEN4_SHARE_DENY_WRITE" },
6410 #define OPEN4_SHARE_DENY_BOTH 0x00000003
6411 { OPEN4_SHARE_DENY_BOTH, "OPEN4_SHARE_DENY_BOTH" },
6416 dissect_nfs_open4_share_deny(tvbuff_t *tvb, int offset,
6421 deny_access = tvb_get_ntohl(tvb, offset);
6422 proto_tree_add_uint(tree, hf_nfs_open4_share_deny, tvb, offset, 4,
6430 dissect_nfs_open_owner4(tvbuff_t *tvb, int offset, proto_tree *tree)
6432 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_clientid4, offset);
6433 offset = dissect_nfsdata(tvb, offset, tree, hf_nfs_open_owner4);
6439 dissect_nfs_open_claim_delegate_cur4(tvbuff_t *tvb, int offset,
6442 offset = dissect_rpc_uint64(tvb, tree,
6443 hf_nfs_stateid4_delegate_stateid, offset);
6444 offset = dissect_nfs_utf8string(tvb, offset, tree, hf_nfs_component4, NULL);
6449 #define CLAIM_NULL 0
6450 #define CLAIM_PREVIOUS 1
6451 #define CLAIM_DELEGATE_CUR 2
6452 #define CLAIM_DELEGATE_PREV 3
6454 static const value_string names_claim_type4[] = {
6455 { CLAIM_NULL, "CLAIM_NULL" },
6456 { CLAIM_PREVIOUS, "CLAIM_PREVIOUS" },
6457 { CLAIM_DELEGATE_CUR, "CLAIM_DELEGATE_CUR" },
6458 { CLAIM_DELEGATE_PREV, "CLAIM_DELEGATE_PREV" },
6463 dissect_nfs_open_claim4(tvbuff_t *tvb, int offset,
6466 guint open_claim_type4;
6467 proto_item *fitem = NULL;
6468 proto_tree *newftree = NULL;
6470 open_claim_type4 = tvb_get_ntohl(tvb, offset);
6471 fitem = proto_tree_add_uint(tree, hf_nfs_open_claim_type4, tvb,
6472 offset+0, 4, open_claim_type4);
6476 newftree = proto_item_add_subtree(fitem, ett_nfs_open_claim4);
6480 switch(open_claim_type4)
6483 offset = dissect_nfs_utf8string(tvb, offset, newftree, hf_nfs_component4, NULL);
6486 case CLAIM_PREVIOUS:
6487 offset = dissect_rpc_uint32(tvb, newftree,
6488 hf_nfs_delegate_type, offset);
6491 case CLAIM_DELEGATE_CUR:
6492 offset = dissect_nfs_open_claim_delegate_cur4(tvb, offset,
6496 case CLAIM_DELEGATE_PREV:
6497 offset = dissect_nfs_utf8string(tvb, offset, newftree, hf_nfs_component4, NULL);
6510 dissect_nfs_createhow4(tvbuff_t *tvb, int offset, packet_info *pinfo,
6515 /* This is intentional; we're using the same flags as NFSv3 */
6516 mode = tvb_get_ntohl(tvb, offset);
6517 proto_tree_add_uint(tree, hf_nfs_createmode3, tvb, offset, 4, mode);
6522 case UNCHECKED: /* UNCHECKED4 */
6523 case GUARDED: /* GUARDED4 */
6524 offset = dissect_nfs_fattr4(tvb, offset, pinfo, tree);
6527 case EXCLUSIVE: /* EXCLUSIVE4 */
6528 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_verifier4, offset);
6538 #define OPEN4_NOCREATE 0
6539 #define OPEN4_CREATE 1
6540 static const value_string names_opentype4[] = {
6541 { OPEN4_NOCREATE, "OPEN4_NOCREATE" },
6542 { OPEN4_CREATE, "OPEN4_CREATE" },
6547 dissect_nfs_openflag4(tvbuff_t *tvb, int offset, packet_info *pinfo,
6551 proto_item *fitem = NULL;
6552 proto_tree *newftree = NULL;
6554 opentype4 = tvb_get_ntohl(tvb, offset);
6555 fitem = proto_tree_add_uint(tree, hf_nfs_opentype4, tvb,
6556 offset+0, 4, opentype4);
6560 newftree = proto_item_add_subtree(fitem, ett_nfs_opentype4);
6567 offset = dissect_nfs_createhow4(tvb, offset, pinfo, newftree);
6580 dissect_nfs_clientaddr4(tvbuff_t *tvb, int offset, proto_tree *tree)
6582 offset = dissect_nfsdata(tvb, offset, tree, hf_nfs_r_netid);
6583 offset = dissect_nfsdata(tvb, offset, tree, hf_nfs_r_addr);
6590 dissect_nfs_cb_client4(tvbuff_t *tvb, int offset, proto_tree *tree)
6592 proto_tree *cb_location = NULL;
6593 proto_item *fitem = NULL;
6595 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_cb_program, offset);
6597 fitem = proto_tree_add_text(tree, tvb, offset, 0, "cb_location");
6601 cb_location = proto_item_add_subtree(fitem, ett_nfs_clientaddr4);
6603 offset = dissect_nfs_clientaddr4(tvb, offset, cb_location);
6609 static const value_string names_stable_how4[] = {
6611 { UNSTABLE4, "UNSTABLE4" },
6612 #define DATA_SYNC4 1
6613 { DATA_SYNC4, "DATA_SYNC4" },
6614 #define FILE_SYNC4 2
6615 { FILE_SYNC4, "FILE_SYNC4" },
6620 dissect_nfs_stable_how4(tvbuff_t *tvb, int offset,
6621 proto_tree *tree, char *name)
6625 stable_how4 = tvb_get_ntohl(tvb, offset);
6626 proto_tree_add_uint_format(tree, hf_nfs_stable_how4, tvb,
6627 offset+0, 4, stable_how4, "%s: %s (%u)", name,
6628 val_to_str(stable_how4, names_stable_how4, "%u"), stable_how4);
6634 static const value_string names_nfsv4_operation[] = {
6635 { NFS4_OP_ACCESS, "ACCESS" },
6636 { NFS4_OP_CLOSE, "CLOSE" },
6637 { NFS4_OP_COMMIT, "COMMIT" },
6638 { NFS4_OP_CREATE, "CREATE" },
6639 { NFS4_OP_DELEGPURGE, "DELEGPURGE" },
6640 { NFS4_OP_DELEGRETURN, "DELEGRETURN" },
6641 { NFS4_OP_GETATTR, "GETATTR" },
6642 { NFS4_OP_GETFH, "GETFH" },
6643 { NFS4_OP_LINK, "LINK" },
6644 { NFS4_OP_LOCK, "LOCK" },
6645 { NFS4_OP_LOCKT, "LOCKT" },
6646 { NFS4_OP_LOCKU, "LOCKU" },
6647 { NFS4_OP_LOOKUP, "LOOKUP" },
6648 { NFS4_OP_LOOKUPP, "LOOKUPP" },
6649 { NFS4_OP_NVERIFY, "NVERIFY" },
6650 { NFS4_OP_OPEN, "OPEN" },
6651 { NFS4_OP_OPENATTR, "OPENATTR" },
6652 { NFS4_OP_OPEN_CONFIRM, "OPEN_CONFIRM" },
6653 { NFS4_OP_OPEN_DOWNGRADE, "OPEN_DOWNGRADE" },
6654 { NFS4_OP_PUTFH, "PUTFH" },
6655 { NFS4_OP_PUTPUBFH, "PUTPUBFH" },
6656 { NFS4_OP_PUTROOTFH, "PUTROOTFH" },
6657 { NFS4_OP_READ, "READ" },
6658 { NFS4_OP_READDIR, "READDIR" },
6659 { NFS4_OP_READLINK, "READLINK" },
6660 { NFS4_OP_REMOVE, "REMOVE" },
6661 { NFS4_OP_RENAME, "RENAME" },
6662 { NFS4_OP_RENEW, "RENEW" },
6663 { NFS4_OP_RESTOREFH, "RESTOREFH" },
6664 { NFS4_OP_SAVEFH, "SAVEFH" },
6665 { NFS4_OP_SECINFO, "SECINFO" },
6666 { NFS4_OP_SETATTR, "SETATTR" },
6667 { NFS4_OP_SETCLIENTID, "SETCLIENTID" },
6668 { NFS4_OP_SETCLIENTID_CONFIRM, "SETCLIENTID_CONFIRM" },
6669 { NFS4_OP_VERIFY, "VERIFY" },
6670 { NFS4_OP_WRITE, "WRITE" },
6674 gint *nfsv4_operation_ett[] =
6680 &ett_nfs_delegpurge4 ,
6681 &ett_nfs_delegreturn4 ,
6692 &ett_nfs_openattr4 ,
6693 &ett_nfs_open_confirm4 ,
6694 &ett_nfs_open_downgrade4 ,
6696 &ett_nfs_putpubfh4 ,
6697 &ett_nfs_putrootfh4 ,
6700 &ett_nfs_readlink4 ,
6704 &ett_nfs_restorefh4 ,
6708 &ett_nfs_setclientid4 ,
6709 &ett_nfs_setclientid_confirm4 ,
6715 dissect_nfs_entry4(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
6718 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_cookie4, offset);
6719 offset = dissect_nfs_utf8string(tvb, offset, tree, hf_nfs_component4, NULL);
6720 offset = dissect_nfs_fattr4(tvb, offset, pinfo, tree);
6726 dissect_nfs_dirlist4(tvbuff_t *tvb, int offset, packet_info *pinfo,
6729 proto_tree *newftree = NULL;
6731 newftree = proto_item_add_subtree(tree, ett_nfs_dirlist4);
6732 if (newftree==NULL) return offset;
6734 offset = dissect_rpc_list(tvb, pinfo, tree, offset, dissect_nfs_entry4);
6735 offset = dissect_rpc_bool(tvb, newftree, hf_nfs_dirlist4_eof, offset);
6741 dissect_nfs_change_info4(tvbuff_t *tvb, int offset,
6742 proto_tree *tree, char *name)
6744 proto_tree *newftree = NULL;
6745 proto_tree *fitem = NULL;
6747 fitem = proto_tree_add_text(tree, tvb, offset, 0, "%s", name);
6750 newftree = proto_item_add_subtree(fitem, ett_nfs_change_info4);
6753 offset = dissect_rpc_bool(tvb, newftree,
6754 hf_nfs_change_info4_atomic, offset);
6755 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_changeid4_before,
6757 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_changeid4_after,
6765 static const value_string names_nfs_lock_type4[] =
6768 { READ_LT, "READ_LT" },
6770 { WRITE_LT, "WRITE_LT" },
6772 { READW_LT, "READW_LT" },
6774 { WRITEW_LT, "WRITEW_LT" },
6775 #define RELEASE_STATE 5
6776 { RELEASE_STATE, "RELEASE_STATE" },
6781 dissect_nfs_lock4denied(tvbuff_t *tvb, int offset, proto_tree *tree)
6783 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_offset4, offset);
6784 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_length4, offset);
6785 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_lock_type4, offset);
6786 offset = dissect_nfs_lock_owner4(tvb, offset, tree);
6792 static const value_string names_open4_result_flags[] = {
6793 #define OPEN4_RESULT_MLOCK 0x00000001
6794 { OPEN4_RESULT_MLOCK, "OPEN4_RESULT_MLOCK" },
6795 #define OPEN4_RESULT_CONFIRM 0x00000002
6796 { OPEN4_RESULT_CONFIRM, "OPEN4_RESULT_CONFIRM" },
6801 dissect_nfs_open4_rflags(tvbuff_t *tvb, int offset,
6802 proto_tree *tree, char *name)
6805 proto_item *rflags_item = NULL;
6806 proto_item *rflags_tree = NULL;
6808 rflags = tvb_get_ntohl(tvb, offset);
6812 rflags_item = proto_tree_add_text(tree, tvb, offset, 4,
6813 "%s: 0x%08x", name, rflags);
6817 rflags_tree = proto_item_add_subtree(rflags_item,
6818 ett_nfs_open4_result_flags);
6822 proto_tree_add_text(rflags_tree, tvb, offset, 4, "%s",
6823 decode_enumerated_bitfield(rflags, OPEN4_RESULT_MLOCK, 2,
6824 names_open4_result_flags, "%s"));
6826 proto_tree_add_text(rflags_tree, tvb, offset, 4, "%s",
6827 decode_enumerated_bitfield(rflags, OPEN4_RESULT_CONFIRM, 2,
6828 names_open4_result_flags, "%s"));
6839 dissect_nfs_stateid4(tvbuff_t *tvb, int offset,
6842 proto_item *fitem = NULL;
6843 proto_tree *newftree = NULL;
6846 gboolean first_line;
6848 fitem = proto_tree_add_text(tree, tvb, offset, 4, "stateid");
6851 newftree = proto_item_add_subtree(fitem, ett_nfs_stateid4);
6853 offset = dissect_rpc_uint32(tvb, newftree, hf_nfs_seqid4,
6859 while (bytes_left != 0)
6862 if (sublen > bytes_left)
6863 sublen = bytes_left;
6865 proto_tree_add_text(newftree, tvb, offset, sublen, "%s%s",
6866 first_line ? "other: " : " ",
6867 tvb_bytes_to_str(tvb, offset, sublen));
6869 bytes_left -= sublen;
6880 dissect_nfs_open_read_delegation4(tvbuff_t *tvb, int offset,
6881 packet_info *pinfo, proto_tree *tree)
6883 offset = dissect_nfs_stateid4(tvb, offset, tree);
6884 offset = dissect_rpc_bool(tvb, tree, hf_nfs_recall4, offset);
6885 offset = dissect_nfs_ace4(tvb, offset, pinfo, tree);
6891 dissect_nfs_modified_limit4(tvbuff_t *tvb, int offset, proto_tree *tree)
6893 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_num_blocks, offset);
6894 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_bytes_per_block, offset);
6899 #define NFS_LIMIT_SIZE 1
6900 #define NFS_LIMIT_BLOCKS 2
6901 static const value_string names_limit_by4[] = {
6902 { NFS_LIMIT_SIZE, "NFS_LIMIT_SIZE" },
6903 { NFS_LIMIT_BLOCKS, "NFS_LIMIT_BLOCKS" },
6908 dissect_nfs_space_limit4(tvbuff_t *tvb, int offset,
6913 limitby = tvb_get_ntohl(tvb, offset);
6914 proto_tree_add_uint(tree, hf_nfs_limit_by4, tvb, offset+0, 4, limitby);
6919 case NFS_LIMIT_SIZE:
6920 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_filesize,
6924 case NFS_LIMIT_BLOCKS:
6925 offset = dissect_nfs_modified_limit4(tvb, offset, tree);
6936 dissect_nfs_open_write_delegation4(tvbuff_t *tvb, int offset,
6937 packet_info *pinfo, proto_tree *tree)
6939 offset = dissect_nfs_stateid4(tvb, offset, tree);
6940 offset = dissect_rpc_bool(tvb, tree, hf_nfs_recall, offset);
6941 offset = dissect_nfs_space_limit4(tvb, offset, tree);
6942 offset = dissect_nfs_ace4(tvb, offset, pinfo, tree);
6947 #define OPEN_DELEGATE_NONE 0
6948 #define OPEN_DELEGATE_READ 1
6949 #define OPEN_DELEGATE_WRITE 2
6950 static const value_string names_open_delegation_type4[] = {
6951 { OPEN_DELEGATE_NONE, "OPEN_DELEGATE_NONE" },
6952 { OPEN_DELEGATE_READ, "OPEN_DELEGATE_READ" },
6953 { OPEN_DELEGATE_WRITE, "OPEN_DELEGATE_WRITE" },
6958 dissect_nfs_open_delegation4(tvbuff_t *tvb, int offset, packet_info *pinfo,
6961 guint delegation_type;
6962 proto_tree *newftree = NULL;
6963 proto_item *fitem = NULL;
6965 delegation_type = tvb_get_ntohl(tvb, offset);
6966 proto_tree_add_uint(tree, hf_nfs_open_delegation_type4, tvb, offset+0,
6967 4, delegation_type);
6971 newftree = proto_item_add_subtree(fitem, ett_nfs_open_delegation4);
6973 switch(delegation_type)
6975 case OPEN_DELEGATE_NONE:
6978 case OPEN_DELEGATE_READ:
6979 offset = dissect_nfs_open_read_delegation4(tvb, offset, pinfo,
6983 case OPEN_DELEGATE_WRITE:
6984 offset = dissect_nfs_open_write_delegation4(tvb, offset, pinfo,
6997 dissect_nfs_rpcsec_gss_info(tvbuff_t *tvb, int offset, proto_tree *tree)
6999 offset = dissect_rpc_opaque_data(tvb, offset, tree, NULL,
7000 hf_nfs_sec_oid4, FALSE, 0, FALSE, NULL, NULL);
7001 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_qop4, offset);
7002 offset = dissect_rpc_uint32(tvb, tree,
7003 hf_nfs_secinfo_rpcsec_gss_info_service, offset);
7009 dissect_nfs_open_to_lock_owner4(tvbuff_t *tvb, int offset, proto_tree *tree)
7011 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_seqid4, offset);
7012 offset = dissect_nfs_stateid4(tvb, offset, tree);
7013 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_lock_seqid4, offset);
7014 offset = dissect_nfs_lock_owner4(tvb, offset, tree);
7020 dissect_nfs_exist_lock_owner4(tvbuff_t *tvb, int offset, proto_tree *tree)
7022 offset = dissect_nfs_stateid4(tvb, offset, tree);
7023 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_lock_seqid4, offset);
7029 dissect_nfs_locker4(tvbuff_t *tvb, int offset, proto_tree *tree)
7031 guint new_lock_owner;
7033 new_lock_owner = tvb_get_ntohl(tvb, offset);
7034 offset = dissect_rpc_bool(tvb, tree, hf_nfs_new_lock_owner, offset);
7037 offset = dissect_nfs_open_to_lock_owner4(tvb, offset, tree);
7039 offset = dissect_nfs_exist_lock_owner4(tvb, offset, tree);
7045 dissect_nfs_client_id4(tvbuff_t *tvb, int offset, proto_tree *tree)
7047 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_verifier4, offset);
7048 offset = dissect_rpc_data(tvb, tree, hf_nfs_client_id4_id, offset);
7054 dissect_nfs_argop4(tvbuff_t *tvb, int offset, packet_info *pinfo,
7057 guint32 ops, ops_counter;
7060 proto_tree *ftree = NULL;
7061 proto_tree *newftree = NULL;
7063 ops = tvb_get_ntohl(tvb, offset+0);
7065 fitem = proto_tree_add_text(tree, tvb, offset, 4,
7066 "Operations (count: %u)", ops);
7069 if (fitem == NULL) return offset;
7071 ftree = proto_item_add_subtree(fitem, ett_nfs_argop4);
7073 if (ftree == NULL) return offset;
7075 for (ops_counter=0; ops_counter<ops; ops_counter++)
7077 opcode = tvb_get_ntohl(tvb, offset);
7079 fitem = proto_tree_add_uint(ftree, hf_nfs_argop4, tvb, offset, 4,
7083 if (opcode < NFS4_OP_ACCESS || opcode > NFS4_OP_WRITE)
7086 if (fitem == NULL) break;
7088 newftree = proto_item_add_subtree(fitem, *nfsv4_operation_ett[opcode-3]);
7089 if (newftree == NULL) break;
7093 case NFS4_OP_ACCESS:
7094 offset = dissect_access(tvb, offset, newftree, "access");
7098 offset = dissect_rpc_uint32(tvb, newftree, hf_nfs_seqid4,
7100 offset = dissect_nfs_stateid4(tvb, offset, newftree);
7103 case NFS4_OP_COMMIT:
7104 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_offset4,
7106 offset = dissect_rpc_uint32(tvb, newftree, hf_nfs_count4,
7110 case NFS4_OP_CREATE:
7114 create_type = tvb_get_ntohl(tvb, offset);
7115 offset = dissect_rpc_uint32(tvb, newftree, hf_nfs_ftype4,
7121 offset = dissect_nfs_utf8string(tvb, offset, newftree,
7122 hf_nfs_linktext4, NULL);
7127 offset = dissect_nfs_specdata4(tvb, offset, newftree);
7139 offset = dissect_nfs_utf8string(tvb, offset, newftree, hf_nfs_component4, NULL);
7141 offset = dissect_nfs_fattr4(tvb, offset, pinfo, newftree);
7145 case NFS4_OP_DELEGPURGE:
7146 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_clientid4, offset);
7149 case NFS4_OP_DELEGRETURN:
7150 offset = dissect_nfs_stateid4(tvb, offset, newftree);
7153 case NFS4_OP_GETATTR:
7154 offset = dissect_nfs_attributes(tvb, offset, pinfo, newftree,
7155 FATTR4_BITMAP_ONLY);
7162 offset = dissect_nfs_utf8string(tvb, offset, newftree,
7163 hf_nfs_component4, NULL);
7167 offset = dissect_rpc_uint32(tvb, newftree, hf_nfs_lock_type4, offset);
7168 offset = dissect_rpc_bool(tvb, newftree, hf_nfs_lock4_reclaim, offset);
7169 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_offset4, offset);
7170 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_length4, offset);
7171 offset = dissect_nfs_locker4(tvb, offset, newftree);
7175 offset = dissect_rpc_uint32(tvb, newftree, hf_nfs_lock_type4, offset);
7176 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_offset4, offset);
7177 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_length4, offset);
7178 offset = dissect_nfs_lock_owner4(tvb, offset, newftree);
7182 offset = dissect_rpc_uint32(tvb, newftree, hf_nfs_lock_type4, offset);
7183 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_seqid4, offset);
7184 offset = dissect_nfs_stateid4(tvb, offset, newftree);
7185 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_offset4, offset);
7186 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_length4, offset);
7189 case NFS4_OP_LOOKUP:
7190 offset = dissect_nfs_utf8string(tvb, offset, newftree,
7191 hf_nfs_component4, NULL);
7194 case NFS4_OP_LOOKUPP:
7197 case NFS4_OP_NVERIFY:
7198 offset = dissect_nfs_fattr4(tvb, offset, pinfo, newftree);
7202 offset = dissect_rpc_uint32(tvb, newftree, hf_nfs_seqid4,
7204 offset = dissect_nfs_open4_share_access(tvb, offset, newftree);
7205 offset = dissect_nfs_open4_share_deny(tvb, offset, newftree);
7206 offset = dissect_nfs_open_owner4(tvb, offset, newftree);
7207 offset = dissect_nfs_openflag4(tvb, offset, pinfo, newftree);
7208 offset = dissect_nfs_open_claim4(tvb, offset, newftree);
7211 case NFS4_OP_OPENATTR:
7212 offset = dissect_rpc_bool(tvb, newftree, hf_nfs_attrdircreate,
7216 case NFS4_OP_OPEN_CONFIRM:
7217 offset = dissect_nfs_stateid4(tvb, offset, newftree);
7218 offset = dissect_rpc_uint32(tvb, newftree, hf_nfs_seqid4,
7222 case NFS4_OP_OPEN_DOWNGRADE:
7223 offset = dissect_nfs_stateid4(tvb, offset, newftree);
7224 offset = dissect_rpc_uint32(tvb, newftree, hf_nfs_seqid4,
7226 offset = dissect_nfs_open4_share_access(tvb, offset, newftree);
7227 offset = dissect_nfs_open4_share_deny(tvb, offset, newftree);
7231 offset = dissect_nfs_fh4(tvb, offset, pinfo, newftree, "filehandle");
7234 case NFS4_OP_PUTPUBFH:
7235 case NFS4_OP_PUTROOTFH:
7239 offset = dissect_nfs_stateid4(tvb, offset, newftree);
7240 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_offset4,
7242 offset = dissect_rpc_uint32(tvb, newftree, hf_nfs_count4,
7246 case NFS4_OP_READDIR:
7247 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_cookie4,
7249 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_cookieverf4,
7251 offset = dissect_rpc_uint32(tvb, newftree,
7252 hf_nfs_count4_dircount, offset);
7253 offset = dissect_rpc_uint32(tvb, newftree,
7254 hf_nfs_count4_maxcount, offset);
7255 offset = dissect_nfs_attributes(tvb, offset, pinfo, newftree,
7256 FATTR4_BITMAP_ONLY);
7259 case NFS4_OP_READLINK:
7262 case NFS4_OP_REMOVE:
7263 offset = dissect_nfs_utf8string(tvb, offset, newftree,
7264 hf_nfs_component4, NULL);
7267 case NFS4_OP_RENAME:
7268 offset = dissect_nfs_utf8string(tvb, offset, newftree,
7269 hf_nfs_component4, NULL);
7270 offset = dissect_nfs_utf8string(tvb, offset, newftree,
7271 hf_nfs_component4, NULL);
7275 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_clientid4, offset);
7278 case NFS4_OP_RESTOREFH:
7279 case NFS4_OP_SAVEFH:
7282 case NFS4_OP_SECINFO:
7283 offset = dissect_nfs_utf8string(tvb, offset, newftree,
7284 hf_nfs_component4, NULL);
7287 case NFS4_OP_SETATTR:
7288 offset = dissect_nfs_stateid4(tvb, offset, newftree);
7289 offset = dissect_nfs_fattr4(tvb, offset, pinfo, newftree);
7292 case NFS4_OP_SETCLIENTID:
7294 proto_tree *client_tree = NULL;
7295 proto_tree *callback_tree = NULL;
7297 fitem = proto_tree_add_text(newftree, tvb, offset, 0, "client");
7300 client_tree = proto_item_add_subtree(fitem, ett_nfs_client_id4);
7303 offset = dissect_nfs_client_id4(tvb, offset, client_tree);
7306 fitem = proto_tree_add_text(newftree, tvb, offset, 0, "callback");
7309 callback_tree = proto_item_add_subtree(fitem,
7310 ett_nfs_cb_client4);
7313 offset = dissect_nfs_cb_client4(tvb, offset, callback_tree);
7316 offset = dissect_rpc_uint32(tvb, newftree, hf_nfs_callback_ident,
7321 case NFS4_OP_SETCLIENTID_CONFIRM:
7322 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_clientid4, offset);
7323 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_verifier4, offset);
7326 case NFS4_OP_VERIFY:
7327 offset = dissect_nfs_fattr4(tvb, offset, pinfo, newftree);
7331 offset = dissect_nfs_stateid4(tvb, offset, newftree);
7332 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_offset4, offset);
7333 offset = dissect_nfs_stable_how4(tvb, offset, newftree, "stable");
7334 offset = dissect_nfsdata(tvb, offset, newftree, hf_nfs_data);
7346 dissect_nfs4_compound_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
7349 offset = dissect_nfs_utf8string(tvb, offset, tree, hf_nfs_tag4, NULL);
7350 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_minorversion, offset);
7351 offset = dissect_nfs_argop4(tvb, offset, pinfo, tree);
7357 dissect_nfs_secinfo4_res(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
7362 proto_tree *secftree;
7364 flavor = tvb_get_ntohl(tvb, offset);
7365 fitem = proto_tree_add_uint(tree, hf_nfs_secinfo_flavor, tvb, offset, 4,
7374 secftree = proto_item_add_subtree(fitem, ett_nfs_secinfo4_flavor_info);
7376 offset = dissect_nfs_rpcsec_gss_info(tvb, offset, secftree);
7388 dissect_nfs_resop4(tvbuff_t *tvb, int offset, packet_info *pinfo,
7391 guint32 ops, ops_counter;
7394 proto_tree *ftree = NULL;
7395 proto_tree *newftree = NULL;
7398 ops = tvb_get_ntohl(tvb, offset+0);
7400 fitem = proto_tree_add_text(tree, tvb, offset, 4,
7401 "Operations (count: %u)", ops);
7404 if (fitem == NULL) return offset;
7406 ftree = proto_item_add_subtree(fitem, ett_nfs_resop4);
7408 if (ftree == NULL) return offset; /* error adding new subtree */
7410 for (ops_counter = 0; ops_counter < ops; ops_counter++)
7412 opcode = tvb_get_ntohl(tvb, offset);
7414 /* sanity check for bogus packets */
7415 if (opcode < NFS4_OP_ACCESS || opcode > NFS4_OP_WRITE) break;
7417 fitem = proto_tree_add_uint(ftree, hf_nfs_resop4, tvb, offset, 4,
7421 if (fitem == NULL) break; /* error adding new item to tree */
7423 newftree = proto_item_add_subtree(fitem, *nfsv4_operation_ett[opcode-3]);
7425 if (newftree == NULL)
7426 break; /* error adding new subtree to operation item */
7428 offset = dissect_nfs_nfsstat4(tvb, offset, newftree, &status);
7431 * With the exception of NFS4_OP_LOCK, NFS4_OP_LOCKT, and
7432 * NFS4_OP_SETATTR, all other ops do *not* return data with the
7433 * failed status code.
7435 if ((status != NFS4_OK) &&
7436 ((opcode != NFS4_OP_LOCK) && (opcode != NFS4_OP_LOCKT) &&
7437 (opcode != NFS4_OP_SETATTR)))
7440 /* These parsing routines are only executed if the status is NFS4_OK */
7443 case NFS4_OP_ACCESS:
7444 offset = dissect_access(tvb, offset, newftree, "Supported");
7445 offset = dissect_access(tvb, offset, newftree, "Access");
7449 offset = dissect_nfs_stateid4(tvb, offset, newftree);
7452 case NFS4_OP_COMMIT:
7453 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_verifier4,
7457 case NFS4_OP_CREATE:
7458 offset = dissect_nfs_change_info4(tvb, offset, newftree,
7460 offset = dissect_nfs_attributes(tvb, offset, pinfo, newftree,
7461 FATTR4_BITMAP_ONLY);
7464 case NFS4_OP_GETATTR:
7465 offset = dissect_nfs_fattr4(tvb, offset, pinfo, newftree);
7469 offset = dissect_nfs_fh4(tvb, offset, pinfo, newftree, "Filehandle");
7473 offset = dissect_nfs_change_info4(tvb, offset, newftree,
7479 if (status == NFS4_OK)
7481 if (opcode == NFS4_OP_LOCK)
7482 offset = dissect_nfs_stateid4(tvb, offset, newftree);
7485 if (status == NFS4ERR_DENIED)
7486 offset = dissect_nfs_lock4denied(tvb, offset, newftree);
7490 offset = dissect_nfs_stateid4(tvb, offset, newftree);
7494 offset = dissect_nfs_stateid4(tvb, offset, newftree);
7495 offset = dissect_nfs_change_info4(tvb, offset, newftree,
7497 offset = dissect_nfs_open4_rflags(tvb, offset, newftree,
7499 offset = dissect_nfs_attributes(tvb, offset, pinfo, newftree,
7500 FATTR4_BITMAP_ONLY);
7501 offset = dissect_nfs_open_delegation4(tvb, offset, pinfo, newftree);
7504 case NFS4_OP_OPEN_CONFIRM:
7505 case NFS4_OP_OPEN_DOWNGRADE:
7506 offset = dissect_nfs_stateid4(tvb, offset, newftree);
7510 offset = dissect_rpc_uint32(tvb, newftree, hf_nfs_eof, offset);
7511 offset = dissect_nfsdata(tvb, offset, newftree, hf_nfs_data);
7514 case NFS4_OP_READDIR:
7515 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_verifier4, offset);
7516 offset = dissect_nfs_dirlist4(tvb, offset, pinfo, newftree);
7519 case NFS4_OP_READLINK:
7520 offset = dissect_nfs_utf8string(tvb, offset, newftree,
7521 hf_nfs_linktext4, NULL);
7524 case NFS4_OP_REMOVE:
7525 offset = dissect_nfs_change_info4(tvb, offset, newftree,
7529 case NFS4_OP_RENAME:
7530 offset = dissect_nfs_change_info4(tvb, offset, newftree,
7532 offset = dissect_nfs_change_info4(tvb, offset, newftree,
7536 case NFS4_OP_SECINFO:
7537 offset = dissect_rpc_array(tvb, pinfo, newftree, offset,
7538 dissect_nfs_secinfo4_res, hf_nfs_secinfo_arr4);
7541 case NFS4_OP_SETATTR:
7542 offset = dissect_nfs_attributes(tvb, offset, pinfo, newftree,
7543 FATTR4_BITMAP_ONLY);
7546 case NFS4_OP_SETCLIENTID:
7547 if (status == NFS4_OK)
7549 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_clientid4,
7551 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_verifier4,
7555 if (status == NFS4ERR_CLID_INUSE)
7556 offset = dissect_nfs_clientaddr4(tvb, offset, newftree);
7560 offset = dissect_rpc_uint32(tvb, newftree, hf_nfs_count4,
7562 offset = dissect_nfs_stable_how4(tvb, offset, newftree,
7564 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_verifier4,
7577 dissect_nfs4_compound_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
7582 offset = dissect_nfs_nfsstat4(tvb, offset, tree, &status);
7583 offset = dissect_nfs_utf8string(tvb, offset, tree, hf_nfs_tag4, NULL);
7584 offset = dissect_nfs_resop4(tvb, offset, pinfo, tree);
7590 /* proc number, "proc name", dissect_request, dissect_reply */
7591 /* NULL as function pointer means: type of arguments is "void". */
7592 static const vsff nfs3_proc[] = {
7593 { 0, "NULL", /* OK */
7594 dissect_nfs3_null_call, dissect_nfs3_null_reply },
7595 { 1, "GETATTR", /* OK */
7596 dissect_nfs3_getattr_call, dissect_nfs3_getattr_reply },
7597 { 2, "SETATTR", /* OK */
7598 dissect_nfs3_setattr_call, dissect_nfs3_setattr_reply },
7599 { 3, "LOOKUP", /* OK */
7600 dissect_nfs3_lookup_call, dissect_nfs3_lookup_reply },
7601 { 4, "ACCESS", /* OK */
7602 dissect_nfs3_access_call, dissect_nfs3_access_reply },
7603 { 5, "READLINK", /* OK */
7604 dissect_nfs3_readlink_call, dissect_nfs3_readlink_reply },
7605 { 6, "READ", /* OK */
7606 dissect_nfs3_read_call, dissect_nfs3_read_reply },
7607 { 7, "WRITE", /* OK */
7608 dissect_nfs3_write_call, dissect_nfs3_write_reply },
7609 { 8, "CREATE", /* OK */
7610 dissect_nfs3_create_call, dissect_nfs3_create_reply },
7611 { 9, "MKDIR", /* OK */
7612 dissect_nfs3_mkdir_call, dissect_nfs3_mkdir_reply },
7613 { 10, "SYMLINK", /* OK */
7614 dissect_nfs3_symlink_call, dissect_nfs3_symlink_reply },
7615 { 11, "MKNOD", /* OK */
7616 dissect_nfs3_mknod_call, dissect_nfs3_mknod_reply },
7617 { 12, "REMOVE", /* OK */
7618 dissect_nfs3_remove_call, dissect_nfs3_remove_reply },
7619 { 13, "RMDIR", /* OK */
7620 dissect_nfs3_rmdir_call, dissect_nfs3_rmdir_reply },
7621 { 14, "RENAME", /* OK */
7622 dissect_nfs3_rename_call, dissect_nfs3_rename_reply },
7623 { 15, "LINK", /* OK */
7624 dissect_nfs3_link_call, dissect_nfs3_link_reply },
7625 { 16, "READDIR", /* OK */
7626 dissect_nfs3_readdir_call, dissect_nfs3_readdir_reply },
7627 { 17, "READDIRPLUS", /* OK */
7628 dissect_nfs3_readdirplus_call, dissect_nfs3_readdirplus_reply },
7629 { 18, "FSSTAT", /* OK */
7630 dissect_nfs3_fsstat_call, dissect_nfs3_fsstat_reply },
7631 { 19, "FSINFO", /* OK */
7632 dissect_nfs3_fsinfo_call, dissect_nfs3_fsinfo_reply },
7633 { 20, "PATHCONF", /* OK */
7634 dissect_nfs3_pathconf_call, dissect_nfs3_pathconf_reply },
7635 { 21, "COMMIT", /* OK */
7636 dissect_nfs3_commit_call, dissect_nfs3_commit_reply },
7637 { 0,NULL,NULL,NULL }
7640 static const value_string nfsv3_proc_vals[] = {
7658 { 17, "READDIRPLUS" },
7666 /* end of NFS Version 3 */
7668 static const vsff nfs4_proc[] = {
7672 dissect_nfs4_compound_call, dissect_nfs4_compound_reply },
7673 { 0, NULL, NULL, NULL }
7676 static const value_string nfsv4_proc_vals[] = {
7682 static struct true_false_string yesno = { "Yes", "No" };
7686 proto_register_nfs(void)
7688 static hf_register_info hf[] = {
7689 { &hf_nfs_procedure_v2, {
7690 "V2 Procedure", "nfs.procedure_v2", FT_UINT32, BASE_DEC,
7691 VALS(nfsv2_proc_vals), 0, "V2 Procedure", HFILL }},
7692 { &hf_nfs_procedure_v3, {
7693 "V3 Procedure", "nfs.procedure_v3", FT_UINT32, BASE_DEC,
7694 VALS(nfsv3_proc_vals), 0, "V3 Procedure", HFILL }},
7695 { &hf_nfs_procedure_v4, {
7696 "V4 Procedure", "nfs.procedure_v4", FT_UINT32, BASE_DEC,
7697 VALS(nfsv4_proc_vals), 0, "V4 Procedure", HFILL }},
7698 { &hf_nfs_fh_length, {
7699 "length", "nfs.fh.length", FT_UINT32, BASE_DEC,
7700 NULL, 0, "file handle length", HFILL }},
7701 { &hf_nfs_fh_hash, {
7702 "hash", "nfs.fh.hash", FT_UINT32, BASE_HEX,
7703 NULL, 0, "file handle hash", HFILL }},
7704 { &hf_nfs_fh_mount_fileid, {
7705 "fileid", "nfs.fh.mount.fileid", FT_UINT32, BASE_DEC,
7706 NULL, 0, "mount point fileid", HFILL }},
7707 { &hf_nfs_fh_mount_generation, {
7708 "generation", "nfs.fh.mount.generation", FT_UINT32, BASE_HEX,
7709 NULL, 0, "mount point generation", HFILL }},
7710 { &hf_nfs_fh_flags, {
7711 "flags", "nfs.fh.flags", FT_UINT16, BASE_HEX,
7712 NULL, 0, "file handle flags", HFILL }},
7713 { &hf_nfs_fh_snapid, {
7714 "snapid", "nfs.fh.snapid", FT_UINT8, BASE_DEC,
7715 NULL, 0, "snapshot ID", HFILL }},
7716 { &hf_nfs_fh_unused, {
7717 "unused", "nfs.fh.unused", FT_UINT8, BASE_DEC,
7718 NULL, 0, "unused", HFILL }},
7719 { &hf_nfs_fh_fileid, {
7720 "fileid", "nfs.fh.fileid", FT_UINT32, BASE_DEC,
7721 NULL, 0, "file ID", HFILL }},
7722 { &hf_nfs_fh_generation, {
7723 "generation", "nfs.fh.generation", FT_UINT32, BASE_HEX,
7724 NULL, 0, "inode generation", HFILL }},
7725 { &hf_nfs_fh_fsid, {
7726 "fsid", "nfs.fh.fsid", FT_UINT32, BASE_HEX,
7727 NULL, 0, "file system ID", HFILL }},
7728 { &hf_nfs_fh_export_fileid, {
7729 "fileid", "nfs.fh.export.fileid", FT_UINT32, BASE_DEC,
7730 NULL, 0, "export point fileid", HFILL }},
7731 { &hf_nfs_fh_export_generation, {
7732 "generation", "nfs.fh.export.generation", FT_UINT32, BASE_HEX,
7733 NULL, 0, "export point generation", HFILL }},
7734 { &hf_nfs_fh_export_snapid, {
7735 "snapid", "nfs.fh.export.snapid", FT_UINT8, BASE_DEC,
7736 NULL, 0, "export point snapid", HFILL }},
7737 { &hf_nfs_fh_fsid_major, {
7738 "major", "nfs.fh.fsid.major", FT_UINT32, BASE_DEC,
7739 NULL, 0, "major file system ID", HFILL }},
7740 { &hf_nfs_fh_fsid_minor, {
7741 "minor", "nfs.fh.fsid.minor", FT_UINT32, BASE_DEC,
7742 NULL, 0, "minor file system ID", HFILL }},
7743 { &hf_nfs_fh_fsid_inode, {
7744 "inode", "nfs.fh.fsid.inode", FT_UINT32, BASE_DEC,
7745 NULL, 0, "file system inode", HFILL }},
7746 { &hf_nfs_fh_xfsid_major, {
7747 "exported major", "nfs.fh.xfsid.major", FT_UINT32, BASE_DEC,
7748 NULL, 0, "exported major file system ID", HFILL }},
7749 { &hf_nfs_fh_xfsid_minor, {
7750 "exported minor", "nfs.fh.xfsid.minor", FT_UINT32, BASE_DEC,
7751 NULL, 0, "exported minor file system ID", HFILL }},
7752 { &hf_nfs_fh_fstype, {
7753 "file system type", "nfs.fh.fstype", FT_UINT32, BASE_DEC,
7754 NULL, 0, "file system type", HFILL }},
7756 "file number", "nfs.fh.fn", FT_UINT32, BASE_DEC,
7757 NULL, 0, "file number", HFILL }},
7758 { &hf_nfs_fh_fn_len, {
7759 "length", "nfs.fh.fn.len", FT_UINT32, BASE_DEC,
7760 NULL, 0, "file number length", HFILL }},
7761 { &hf_nfs_fh_fn_inode, {
7762 "inode", "nfs.fh.fn.inode", FT_UINT32, BASE_DEC,
7763 NULL, 0, "file number inode", HFILL }},
7764 { &hf_nfs_fh_fn_generation, {
7765 "generation", "nfs.fh.fn.generation", FT_UINT32, BASE_DEC,
7766 NULL, 0, "file number generation", HFILL }},
7768 "exported file number", "nfs.fh.xfn", FT_UINT32, BASE_DEC,
7769 NULL, 0, "exported file number", HFILL }},
7770 { &hf_nfs_fh_xfn_len, {
7771 "length", "nfs.fh.xfn.len", FT_UINT32, BASE_DEC,
7772 NULL, 0, "exported file number length", HFILL }},
7773 { &hf_nfs_fh_xfn_inode, {
7774 "exported inode", "nfs.fh.xfn.inode", FT_UINT32, BASE_DEC,
7775 NULL, 0, "exported file number inode", HFILL }},
7776 { &hf_nfs_fh_xfn_generation, {
7777 "generation", "nfs.fh.xfn.generation", FT_UINT32, BASE_DEC,
7778 NULL, 0, "exported file number generation", HFILL }},
7779 { &hf_nfs_fh_dentry, {
7780 "dentry", "nfs.fh.dentry", FT_UINT32, BASE_HEX,
7781 NULL, 0, "dentry (cookie)", HFILL }},
7783 "device", "nfs.fh.dev", FT_UINT32, BASE_DEC,
7784 NULL, 0, "device", HFILL }},
7785 { &hf_nfs_fh_xdev, {
7786 "exported device", "nfs.fh.xdev", FT_UINT32, BASE_DEC,
7787 NULL, 0, "exported device", HFILL }},
7788 { &hf_nfs_fh_dirinode, {
7789 "directory inode", "nfs.fh.dirinode", FT_UINT32, BASE_DEC,
7790 NULL, 0, "directory inode", HFILL }},
7791 { &hf_nfs_fh_pinode, {
7792 "pseudo inode", "nfs.fh.pinode", FT_UINT32, BASE_HEX,
7793 NULL, 0, "pseudo inode", HFILL }},
7794 { &hf_nfs_fh_hp_len, {
7795 "length", "nfs.fh.hp.len", FT_UINT32, BASE_DEC,
7796 NULL, 0, "hash path length", HFILL }},
7797 { &hf_nfs_fh_version, {
7798 "version", "nfs.fh.version", FT_UINT8, BASE_DEC,
7799 NULL, 0, "file handle layout version", HFILL }},
7800 { &hf_nfs_fh_auth_type, {
7801 "auth_type", "nfs.fh.auth_type", FT_UINT8, BASE_DEC,
7802 VALS(auth_type_names), 0, "authentication type", HFILL }},
7803 { &hf_nfs_fh_fsid_type, {
7804 "fsid_type", "nfs.fh.fsid_type", FT_UINT8, BASE_DEC,
7805 VALS(fsid_type_names), 0, "file system ID type", HFILL }},
7806 { &hf_nfs_fh_fileid_type, {
7807 "fileid_type", "nfs.fh.fileid_type", FT_UINT8, BASE_DEC,
7808 VALS(fileid_type_names), 0, "file ID type", HFILL }},
7810 "Status", "nfs.status2", FT_UINT32, BASE_DEC,
7811 VALS(names_nfs_stat), 0, "Reply status", HFILL }},
7812 { &hf_nfs_full_name, {
7813 "Full Name", "nfs.full_name", FT_STRING, BASE_DEC,
7814 NULL, 0, "Full Name", HFILL }},
7816 "Name", "nfs.name", FT_STRING, BASE_DEC,
7817 NULL, 0, "Name", HFILL }},
7818 { &hf_nfs_readlink_data, {
7819 "Data", "nfs.readlink.data", FT_STRING, BASE_DEC,
7820 NULL, 0, "Symbolic Link Data", HFILL }},
7821 { &hf_nfs_read_offset, {
7822 "Offset", "nfs.read.offset", FT_UINT32, BASE_DEC,
7823 NULL, 0, "Read Offset", HFILL }},
7824 { &hf_nfs_read_count, {
7825 "Count", "nfs.read.count", FT_UINT32, BASE_DEC,
7826 NULL, 0, "Read Count", HFILL }},
7827 { &hf_nfs_read_totalcount, {
7828 "Total Count", "nfs.read.totalcount", FT_UINT32, BASE_DEC,
7829 NULL, 0, "Total Count (obsolete)", HFILL }},
7831 "Data", "nfs.data", FT_BYTES, BASE_DEC,
7832 NULL, 0, "Data", HFILL }},
7833 { &hf_nfs_write_beginoffset, {
7834 "Begin Offset", "nfs.write.beginoffset", FT_UINT32, BASE_DEC,
7835 NULL, 0, "Begin offset (obsolete)", HFILL }},
7836 { &hf_nfs_write_offset, {
7837 "Offset", "nfs.write.offset", FT_UINT32, BASE_DEC,
7838 NULL, 0, "Offset", HFILL }},
7839 { &hf_nfs_write_totalcount, {
7840 "Total Count", "nfs.write.totalcount", FT_UINT32, BASE_DEC,
7841 NULL, 0, "Total Count (obsolete)", HFILL }},
7842 { &hf_nfs_symlink_to, {
7843 "To", "nfs.symlink.to", FT_STRING, BASE_DEC,
7844 NULL, 0, "Symbolic link destination name", HFILL }},
7845 { &hf_nfs_readdir_cookie, {
7846 "Cookie", "nfs.readdir.cookie", FT_UINT32, BASE_DEC,
7847 NULL, 0, "Directory Cookie", HFILL }},
7848 { &hf_nfs_readdir_count, {
7849 "Count", "nfs.readdir.count", FT_UINT32, BASE_DEC,
7850 NULL, 0, "Directory Count", HFILL }},
7852 { &hf_nfs_readdir_entry, {
7853 "Entry", "nfs.readdir.entry", FT_NONE, 0,
7854 NULL, 0, "Directory Entry", HFILL }},
7856 { &hf_nfs_readdir_entry_fileid, {
7857 "File ID", "nfs.readdir.entry.fileid", FT_UINT32, BASE_DEC,
7858 NULL, 0, "File ID", HFILL }},
7860 { &hf_nfs_readdir_entry_name, {
7861 "Name", "nfs.readdir.entry.name", FT_STRING, BASE_DEC,
7862 NULL, 0, "Name", HFILL }},
7864 { &hf_nfs_readdir_entry_cookie, {
7865 "Cookie", "nfs.readdir.entry.cookie", FT_UINT32, BASE_DEC,
7866 NULL, 0, "Directory Cookie", HFILL }},
7868 { &hf_nfs_readdir_entry3_fileid, {
7869 "File ID", "nfs.readdir.entry3.fileid", FT_UINT64, BASE_DEC,
7870 NULL, 0, "File ID", HFILL }},
7872 { &hf_nfs_readdir_entry3_name, {
7873 "Name", "nfs.readdir.entry3.name", FT_STRING, BASE_DEC,
7874 NULL, 0, "Name", HFILL }},
7876 { &hf_nfs_readdir_entry3_cookie, {
7877 "Cookie", "nfs.readdir.entry3.cookie", FT_UINT64, BASE_DEC,
7878 NULL, 0, "Directory Cookie", HFILL }},
7880 { &hf_nfs_readdirplus_entry_fileid, {
7881 "File ID", "nfs.readdirplus.entry.fileid", FT_UINT64, BASE_DEC,
7882 NULL, 0, "Name", HFILL }},
7884 { &hf_nfs_readdirplus_entry_name, {
7885 "Name", "nfs.readdirplus.entry.name", FT_STRING, BASE_DEC,
7886 NULL, 0, "Name", HFILL }},
7888 { &hf_nfs_readdirplus_entry_cookie, {
7889 "Cookie", "nfs.readdirplus.entry.cookie", FT_UINT64, BASE_DEC,
7890 NULL, 0, "Directory Cookie", HFILL }},
7892 { &hf_nfs_readdir_eof, {
7893 "EOF", "nfs.readdir.eof", FT_UINT32, BASE_DEC,
7894 NULL, 0, "EOF", HFILL }},
7896 { &hf_nfs_statfs_tsize, {
7897 "Transfer Size", "nfs.statfs.tsize", FT_UINT32, BASE_DEC,
7898 NULL, 0, "Transfer Size", HFILL }},
7899 { &hf_nfs_statfs_bsize, {
7900 "Block Size", "nfs.statfs.bsize", FT_UINT32, BASE_DEC,
7901 NULL, 0, "Block Size", HFILL }},
7902 { &hf_nfs_statfs_blocks, {
7903 "Total Blocks", "nfs.statfs.blocks", FT_UINT32, BASE_DEC,
7904 NULL, 0, "Total Blocks", HFILL }},
7905 { &hf_nfs_statfs_bfree, {
7906 "Free Blocks", "nfs.statfs.bfree", FT_UINT32, BASE_DEC,
7907 NULL, 0, "Free Blocks", HFILL }},
7908 { &hf_nfs_statfs_bavail, {
7909 "Available Blocks", "nfs.statfs.bavail", FT_UINT32, BASE_DEC,
7910 NULL, 0, "Available Blocks", HFILL }},
7912 "Type", "nfs.type", FT_UINT32, BASE_DEC,
7913 VALS(names_nfs_ftype3), 0, "File Type", HFILL }},
7914 { &hf_nfs_nfsstat3, {
7915 "Status", "nfs.status", FT_UINT32, BASE_DEC,
7916 VALS(names_nfs_nfsstat3), 0, "Reply status", HFILL }},
7917 { &hf_nfs_read_eof, {
7918 "EOF", "nfs.read.eof", FT_BOOLEAN, BASE_NONE,
7919 &yesno, 0, "EOF", HFILL }},
7920 { &hf_nfs_write_stable, {
7921 "Stable", "nfs.write.stable", FT_UINT32, BASE_DEC,
7922 VALS(names_stable_how), 0, "Stable", HFILL }},
7923 { &hf_nfs_write_committed, {
7924 "Committed", "nfs.write.committed", FT_UINT32, BASE_DEC,
7925 VALS(names_stable_how), 0, "Committed", HFILL }},
7926 { &hf_nfs_createmode3, {
7927 "Create Mode", "nfs.createmode", FT_UINT32, BASE_DEC,
7928 VALS(names_createmode3), 0, "Create Mode", HFILL }},
7929 { &hf_nfs_fsstat_invarsec, {
7930 "invarsec", "nfs.fsstat.invarsec", FT_UINT32, BASE_DEC,
7931 NULL, 0, "probable number of seconds of file system invariance", HFILL }},
7932 { &hf_nfs_fsinfo_rtmax, {
7933 "rtmax", "nfs.fsinfo.rtmax", FT_UINT32, BASE_DEC,
7934 NULL, 0, "maximum READ request", HFILL }},
7935 { &hf_nfs_fsinfo_rtpref, {
7936 "rtpref", "nfs.fsinfo.rtpref", FT_UINT32, BASE_DEC,
7937 NULL, 0, "Preferred READ request size", HFILL }},
7938 { &hf_nfs_fsinfo_rtmult, {
7939 "rtmult", "nfs.fsinfo.rtmult", FT_UINT32, BASE_DEC,
7940 NULL, 0, "Suggested READ multiple", HFILL }},
7941 { &hf_nfs_fsinfo_wtmax, {
7942 "wtmax", "nfs.fsinfo.wtmax", FT_UINT32, BASE_DEC,
7943 NULL, 0, "Maximum WRITE request size", HFILL }},
7944 { &hf_nfs_fsinfo_wtpref, {
7945 "wtpref", "nfs.fsinfo.wtpref", FT_UINT32, BASE_DEC,
7946 NULL, 0, "Preferred WRITE request size", HFILL }},
7947 { &hf_nfs_fsinfo_wtmult, {
7948 "wtmult", "nfs.fsinfo.wtmult", FT_UINT32, BASE_DEC,
7949 NULL, 0, "Suggested WRITE multiple", HFILL }},
7950 { &hf_nfs_fsinfo_dtpref, {
7951 "dtpref", "nfs.fsinfo.dtpref", FT_UINT32, BASE_DEC,
7952 NULL, 0, "Preferred READDIR request", HFILL }},
7953 { &hf_nfs_fsinfo_maxfilesize, {
7954 "maxfilesize", "nfs.fsinfo.maxfilesize", FT_UINT64, BASE_DEC,
7955 NULL, 0, "Maximum file size", HFILL }},
7956 { &hf_nfs_fsinfo_properties, {
7957 "Properties", "nfs.fsinfo.propeties", FT_UINT32, BASE_HEX,
7958 NULL, 0, "File System Properties", HFILL }},
7959 { &hf_nfs_pathconf_linkmax, {
7960 "linkmax", "nfs.pathconf.linkmax", FT_UINT32, BASE_DEC,
7961 NULL, 0, "Maximum number of hard links", HFILL }},
7962 { &hf_nfs_pathconf_name_max, {
7963 "name_max", "nfs.pathconf.name_max", FT_UINT32, BASE_DEC,
7964 NULL, 0, "Maximum file name length", HFILL }},
7965 { &hf_nfs_pathconf_no_trunc, {
7966 "no_trunc", "nfs.pathconf.no_trunc", FT_BOOLEAN, BASE_NONE,
7967 &yesno, 0, "No long file name truncation", HFILL }},
7968 { &hf_nfs_pathconf_chown_restricted, {
7969 "chown_restricted", "nfs.pathconf.chown_restricted", FT_BOOLEAN,
7970 BASE_NONE, &yesno, 0, "chown is restricted to root", HFILL }},
7971 { &hf_nfs_pathconf_case_insensitive, {
7972 "case_insensitive", "nfs.pathconf.case_insensitive", FT_BOOLEAN,
7973 BASE_NONE, &yesno, 0, "file names are treated case insensitive", HFILL }},
7974 { &hf_nfs_pathconf_case_preserving, {
7975 "case_preserving", "nfs.pathconf.case_preserving", FT_BOOLEAN,
7976 BASE_NONE, &yesno, 0, "file name cases are preserved", HFILL }},
7978 { &hf_nfs_fattr_type, {
7979 "type", "nfs.fattr.type", FT_UINT32, BASE_DEC,
7980 NULL, 0, "nfs.fattr.type", HFILL }},
7982 { &hf_nfs_fattr_nlink, {
7983 "nlink", "nfs.fattr.nlink", FT_UINT32, BASE_DEC,
7984 NULL, 0, "nfs.fattr.nlink", HFILL }},
7986 { &hf_nfs_fattr_uid, {
7987 "uid", "nfs.fattr.uid", FT_UINT32, BASE_DEC,
7988 NULL, 0, "nfs.fattr.uid", HFILL }},
7990 { &hf_nfs_fattr_gid, {
7991 "gid", "nfs.fattr.gid", FT_UINT32, BASE_DEC,
7992 NULL, 0, "nfs.fattr.gid", HFILL }},
7994 { &hf_nfs_fattr_size, {
7995 "size", "nfs.fattr.size", FT_UINT32, BASE_DEC,
7996 NULL, 0, "nfs.fattr.size", HFILL }},
7998 { &hf_nfs_fattr_blocksize, {
7999 "blocksize", "nfs.fattr.blocksize", FT_UINT32, BASE_DEC,
8000 NULL, 0, "nfs.fattr.blocksize", HFILL }},
8002 { &hf_nfs_fattr_rdev, {
8003 "rdev", "nfs.fattr.rdev", FT_UINT32, BASE_DEC,
8004 NULL, 0, "nfs.fattr.rdev", HFILL }},
8006 { &hf_nfs_fattr_blocks, {
8007 "blocks", "nfs.fattr.blocks", FT_UINT32, BASE_DEC,
8008 NULL, 0, "nfs.fattr.blocks", HFILL }},
8010 { &hf_nfs_fattr_fsid, {
8011 "fsid", "nfs.fattr.fsid", FT_UINT32, BASE_HEX,
8012 NULL, 0, "nfs.fattr.fsid", HFILL }},
8014 { &hf_nfs_fattr_fileid, {
8015 "fileid", "nfs.fattr.fileid", FT_UINT32, BASE_DEC,
8016 NULL, 0, "nfs.fattr.fileid", HFILL }},
8018 { &hf_nfs_fattr3_type, {
8019 "Type", "nfs.fattr3.type", FT_UINT32, BASE_DEC,
8020 VALS(names_nfs_ftype3), 0, "nfs.fattr3.type", HFILL }},
8022 { &hf_nfs_fattr3_nlink, {
8023 "nlink", "nfs.fattr3.nlink", FT_UINT32, BASE_DEC,
8024 NULL, 0, "nfs.fattr3.nlink", HFILL }},
8026 { &hf_nfs_fattr3_uid, {
8027 "uid", "nfs.fattr3.uid", FT_UINT32, BASE_DEC,
8028 NULL, 0, "nfs.fattr3.uid", HFILL }},
8030 { &hf_nfs_fattr3_gid, {
8031 "gid", "nfs.fattr3.gid", FT_UINT32, BASE_DEC,
8032 NULL, 0, "nfs.fattr3.gid", HFILL }},
8034 { &hf_nfs_fattr3_size, {
8035 "size", "nfs.fattr3.size", FT_UINT64, BASE_DEC,
8036 NULL, 0, "nfs.fattr3.size", HFILL }},
8038 { &hf_nfs_fattr3_used, {
8039 "used", "nfs.fattr3.used", FT_UINT64, BASE_DEC,
8040 NULL, 0, "nfs.fattr3.used", HFILL }},
8042 { &hf_nfs_fattr3_rdev, {
8043 "rdev", "nfs.fattr3.rdev", FT_UINT32, BASE_DEC,
8044 NULL, 0, "nfs.fattr3.rdev", HFILL }},
8046 { &hf_nfs_fattr3_fsid, {
8047 "fsid", "nfs.fattr3.fsid", FT_UINT64, BASE_HEX,
8048 NULL, 0, "nfs.fattr3.fsid", HFILL }},
8050 { &hf_nfs_fattr3_fileid, {
8051 "fileid", "nfs.fattr3.fileid", FT_UINT64, BASE_DEC,
8052 NULL, 0, "nfs.fattr3.fileid", HFILL }},
8054 { &hf_nfs_wcc_attr_size, {
8055 "size", "nfs.wcc_attr.size", FT_UINT64, BASE_DEC,
8056 NULL, 0, "nfs.wcc_attr.size", HFILL }},
8058 { &hf_nfs_set_size3_size, {
8059 "size", "nfs.set_size3.size", FT_UINT64, BASE_DEC,
8060 NULL, 0, "nfs.set_size3.size", HFILL }},
8063 "uid", "nfs.uid3", FT_UINT32, BASE_DEC,
8064 NULL, 0, "nfs.uid3", HFILL }},
8067 "gid", "nfs.gid3", FT_UINT32, BASE_DEC,
8068 NULL, 0, "nfs.gid3", HFILL }},
8070 { &hf_nfs_cookie3, {
8071 "cookie", "nfs.cookie3", FT_UINT64, BASE_DEC,
8072 NULL, 0, "nfs.cookie3", HFILL }},
8074 { &hf_nfs_offset3, {
8075 "offset", "nfs.offset3", FT_UINT64, BASE_DEC,
8076 NULL, 0, "nfs.offset3", HFILL }},
8079 "count", "nfs.count3", FT_UINT32, BASE_DEC,
8080 NULL, 0, "nfs.count3", HFILL }},
8082 { &hf_nfs_count3_maxcount, {
8083 "maxcount", "nfs.count3_maxcount", FT_UINT32, BASE_DEC,
8084 NULL, 0, "nfs.count3_maxcount", HFILL }},
8086 { &hf_nfs_count3_dircount, {
8087 "dircount", "nfs.count3_dircount", FT_UINT32, BASE_DEC,
8088 NULL, 0, "nfs.count3_dircount", HFILL }},
8090 { &hf_nfs_fsstat3_resok_tbytes, {
8091 "Total bytes", "nfs.fsstat3_resok.tbytes", FT_UINT64, BASE_DEC,
8092 NULL, 0, "Total bytes", HFILL }},
8094 { &hf_nfs_fsstat3_resok_fbytes, {
8095 "Free bytes", "nfs.fsstat3_resok.fbytes", FT_UINT64, BASE_DEC,
8096 NULL, 0, "Free bytes", HFILL }},
8098 { &hf_nfs_fsstat3_resok_abytes, {
8099 "Available free bytes", "nfs.fsstat3_resok.abytes", FT_UINT64, BASE_DEC,
8100 NULL, 0, "Available free bytes", HFILL }},
8102 { &hf_nfs_fsstat3_resok_tfiles, {
8103 "Total file slots", "nfs.fsstat3_resok.tfiles", FT_UINT64, BASE_DEC,
8104 NULL, 0, "Total file slots", HFILL }},
8106 { &hf_nfs_fsstat3_resok_ffiles, {
8107 "Free file slots", "nfs.fsstat3_resok.ffiles", FT_UINT64, BASE_DEC,
8108 NULL, 0, "Free file slots", HFILL }},
8110 { &hf_nfs_fsstat3_resok_afiles, {
8111 "Available free file slots", "nfs.fsstat3_resok.afiles", FT_UINT64, BASE_DEC,
8112 NULL, 0, "Available free file slots", HFILL }},
8117 "Opcode", "nfs.call.operation", FT_UINT32, BASE_DEC,
8118 VALS(names_nfsv4_operation), 0, "Opcode", HFILL }},
8121 "Opcode", "nfs.reply.operation", FT_UINT32, BASE_DEC,
8122 VALS(names_nfsv4_operation), 0, "Opcode", HFILL }},
8124 { &hf_nfs_linktext4, {
8125 "Name", "nfs.symlink.linktext", FT_STRING, BASE_DEC,
8126 NULL, 0, "Symbolic link contents", HFILL }},
8128 { &hf_nfs_component4, {
8129 "Filename", "nfs.pathname.component", FT_STRING, BASE_DEC,
8130 NULL, 0, "Pathname component", HFILL }},
8133 "Tag", "nfs.tag", FT_STRING, BASE_DEC,
8134 NULL, 0, "Tag", HFILL }},
8136 { &hf_nfs_clientid4, {
8137 "clientid", "nfs.clientid", FT_UINT64, BASE_HEX,
8138 NULL, 0, "Client ID", HFILL }},
8141 "ace", "nfs.ace", FT_STRING, BASE_DEC,
8142 NULL, 0, "Access Control Entry", HFILL }},
8145 "EOF", "nfs.recall", FT_BOOLEAN, BASE_NONE,
8146 &yesno, 0, "Recall", HFILL }},
8148 { &hf_nfs_open_claim_type4, {
8149 "Claim Type", "nfs.open.claim_type", FT_UINT32, BASE_DEC,
8150 VALS(names_claim_type4), 0, "Claim Type", HFILL }},
8152 { &hf_nfs_opentype4, {
8153 "Open Type", "nfs.open.opentype", FT_UINT32, BASE_DEC,
8154 VALS(names_opentype4), 0, "Open Type", HFILL }},
8156 { &hf_nfs_limit_by4, {
8157 "Space Limit", "nfs.open.limit_by", FT_UINT32, BASE_DEC,
8158 VALS(names_limit_by4), 0, "Limit By", HFILL }},
8160 { &hf_nfs_open_delegation_type4, {
8161 "Delegation Type", "nfs.open.delegation_type", FT_UINT32, BASE_DEC,
8162 VALS(names_open_delegation_type4), 0, "Delegation Type", HFILL }},
8165 "nfs_ftype4", "nfs.nfs_ftype4", FT_UINT32, BASE_DEC,
8166 VALS(names_ftype4), 0, "nfs.nfs_ftype4", HFILL }},
8168 { &hf_nfs_change_info4_atomic, {
8169 "Atomic", "nfs.change_info.atomic", FT_BOOLEAN, BASE_NONE,
8170 &yesno, 0, "Atomic", HFILL }},
8172 { &hf_nfs_open4_share_access, {
8173 "share_access", "nfs.open4.share_access", FT_UINT32, BASE_DEC,
8174 VALS(names_open4_share_access), 0, "Share Access", HFILL }},
8176 { &hf_nfs_open4_share_deny, {
8177 "share_deny", "nfs.open4.share_deny", FT_UINT32, BASE_DEC,
8178 VALS(names_open4_share_deny), 0, "Share Deny", HFILL }},
8181 "seqid", "nfs.seqid", FT_UINT32, BASE_HEX,
8182 NULL, 0, "Sequence ID", HFILL }},
8184 { &hf_nfs_lock_seqid4, {
8185 "lock_seqid", "nfs.lock_seqid", FT_UINT32, BASE_HEX,
8186 NULL, 0, "Lock Sequence ID", HFILL }},
8188 { &hf_nfs_mand_attr, {
8189 "mand_attr", "nfs.attr", FT_UINT32, BASE_DEC,
8190 VALS(names_fattr4), 0, "Mandatory Attribute", HFILL }},
8192 { &hf_nfs_recc_attr, {
8193 "recc_attr", "nfs.attr", FT_UINT32, BASE_DEC,
8194 VALS(names_fattr4), 0, "Recommended Attribute", HFILL }},
8196 { &hf_nfs_time_how4, {
8197 "set_it", "nfs.set_it", FT_UINT32, BASE_DEC,
8198 VALS(names_time_how4), 0, "How To Set Time", HFILL }},
8200 { &hf_nfs_attrlist4, {
8201 "attr_vals", "nfs.fattr4.attr_vals", FT_BYTES, BASE_DEC,
8202 NULL, 0, "attr_vals", HFILL }},
8204 { &hf_nfs_fattr4_link_support, {
8205 "fattr4_link_support", "nfs.fattr4_link_support", FT_BOOLEAN,
8206 BASE_NONE, &yesno, 0, "nfs.fattr4_link_support", HFILL }},
8208 { &hf_nfs_fattr4_symlink_support, {
8209 "fattr4_symlink_support", "nfs.fattr4_symlink_support", FT_BOOLEAN,
8210 BASE_NONE, &yesno, 0, "nfs.fattr4_symlink_support", HFILL }},
8212 { &hf_nfs_fattr4_named_attr, {
8213 "fattr4_named_attr", "nfs.fattr4_named_attr", FT_BOOLEAN, BASE_NONE,
8214 &yesno, 0, "nfs.fattr4_named_attr", HFILL }},
8216 { &hf_nfs_fattr4_unique_handles, {
8217 "fattr4_unique_handles", "nfs.fattr4_unique_handles", FT_BOOLEAN,
8218 BASE_NONE, &yesno, 0, "nfs.fattr4_unique_handles", HFILL }},
8220 { &hf_nfs_fattr4_archive, {
8221 "fattr4_archive", "nfs.fattr4_archive", FT_BOOLEAN,
8222 BASE_NONE, &yesno, 0, "nfs.fattr4_archive", HFILL }},
8224 { &hf_nfs_fattr4_cansettime, {
8225 "fattr4_cansettime", "nfs.fattr4_cansettime", FT_BOOLEAN,
8226 BASE_NONE, &yesno, 0, "nfs.fattr4_cansettime", HFILL }},
8228 { &hf_nfs_fattr4_case_insensitive, {
8229 "fattr4_case_insensitive", "nfs.fattr4_case_insensitive", FT_BOOLEAN,
8230 BASE_NONE, &yesno, 0, "nfs.fattr4_case_insensitive", HFILL }},
8232 { &hf_nfs_fattr4_case_preserving, {
8233 "fattr4_case_preserving", "nfs.fattr4_case_preserving", FT_BOOLEAN,
8234 BASE_NONE, &yesno, 0, "nfs.fattr4_case_preserving", HFILL }},
8236 { &hf_nfs_fattr4_chown_restricted, {
8237 "fattr4_chown_restricted", "nfs.fattr4_chown_restricted", FT_BOOLEAN,
8238 BASE_NONE, &yesno, 0, "nfs.fattr4_chown_restricted", HFILL }},
8240 { &hf_nfs_fattr4_hidden, {
8241 "fattr4_hidden", "nfs.fattr4_hidden", FT_BOOLEAN,
8242 BASE_NONE, &yesno, 0, "nfs.fattr4_hidden", HFILL }},
8244 { &hf_nfs_fattr4_homogeneous, {
8245 "fattr4_homogeneous", "nfs.fattr4_homogeneous", FT_BOOLEAN,
8246 BASE_NONE, &yesno, 0, "nfs.fattr4_homogeneous", HFILL }},
8248 { &hf_nfs_fattr4_mimetype, {
8249 "fattr4_mimetype", "nfs.fattr4_mimetype", FT_STRING, BASE_DEC,
8250 NULL, 0, "nfs.fattr4_mimetype", HFILL }},
8252 { &hf_nfs_fattr4_no_trunc, {
8253 "fattr4_no_trunc", "nfs.fattr4_no_trunc", FT_BOOLEAN,
8254 BASE_NONE, &yesno, 0, "nfs.fattr4_no_trunc", HFILL }},
8256 { &hf_nfs_fattr4_system, {
8257 "fattr4_system", "nfs.fattr4_system", FT_BOOLEAN,
8258 BASE_NONE, &yesno, 0, "nfs.fattr4_system", HFILL }},
8261 "who", "nfs.who", FT_STRING, BASE_DEC,
8262 NULL, 0, "nfs.who", HFILL }},
8265 "server", "nfs.server", FT_STRING, BASE_DEC,
8266 NULL, 0, "nfs.server", HFILL }},
8268 { &hf_nfs_fattr4_owner, {
8269 "fattr4_owner", "nfs.fattr4_owner", FT_STRING, BASE_DEC,
8270 NULL, 0, "nfs.fattr4_owner", HFILL }},
8272 { &hf_nfs_fattr4_owner_group, {
8273 "fattr4_owner_group", "nfs.fattr4_owner_group", FT_STRING, BASE_DEC,
8274 NULL, 0, "nfs.fattr4_owner_group", HFILL }},
8276 { &hf_nfs_stable_how4, {
8277 "stable_how4", "nfs.stable_how4", FT_UINT32, BASE_DEC,
8278 VALS(names_stable_how4), 0, "nfs.stable_how4", HFILL }},
8280 { &hf_nfs_dirlist4_eof, {
8281 "eof", "nfs.dirlist4.eof", FT_BOOLEAN,
8282 BASE_NONE, &yesno, 0, "nfs.dirlist4.eof", HFILL }},
8284 { &hf_nfs_stateid4, {
8285 "stateid", "nfs.stateid4", FT_UINT64, BASE_DEC,
8286 NULL, 0, "nfs.stateid4", HFILL }},
8288 { &hf_nfs_offset4, {
8289 "offset", "nfs.offset4", FT_UINT64, BASE_DEC,
8290 NULL, 0, "nfs.offset4", HFILL }},
8292 { &hf_nfs_specdata1, {
8293 "specdata1", "nfs.specdata1", FT_UINT32, BASE_DEC,
8294 NULL, 0, "nfs.specdata1", HFILL }},
8296 { &hf_nfs_specdata2, {
8297 "specdata2", "nfs.specdata2", FT_UINT32, BASE_DEC,
8298 NULL, 0, "nfs.specdata2", HFILL }},
8300 { &hf_nfs_lock_type4, {
8301 "locktype", "nfs.locktype4", FT_UINT32, BASE_DEC,
8302 VALS(names_nfs_lock_type4), 0, "nfs.locktype4", HFILL }},
8304 { &hf_nfs_reclaim4, {
8305 "reclaim", "nfs.reclaim4", FT_BOOLEAN,
8306 BASE_NONE, &yesno, 0, "Reclaim", HFILL }},
8308 { &hf_nfs_length4, {
8309 "length", "nfs.length4", FT_UINT64, BASE_DEC,
8310 NULL, 0, "nfs.length4", HFILL }},
8312 { &hf_nfs_changeid4, {
8313 "changeid", "nfs.changeid4", FT_UINT64, BASE_DEC,
8314 NULL, 0, "nfs.changeid4", HFILL }},
8316 { &hf_nfs_changeid4_before, {
8317 "changeid", "nfs.changeid4.before", FT_UINT64, BASE_DEC,
8318 NULL, 0, "nfs.changeid4.before", HFILL }},
8320 { &hf_nfs_changeid4_after, {
8321 "changeid", "nfs.changeid4.after", FT_UINT64, BASE_DEC,
8322 NULL, 0, "nfs.changeid4.after", HFILL }},
8324 { &hf_nfs_nfstime4_seconds, {
8325 "seconds", "nfs.nfstime4.seconds", FT_UINT64, BASE_DEC,
8326 NULL, 0, "nfs.nfstime4.seconds", HFILL }},
8328 { &hf_nfs_nfstime4_nseconds, {
8329 "nseconds", "nfs.nfstime4.nseconds", FT_UINT32, BASE_DEC,
8330 NULL, 0, "nfs.nfstime4.nseconds", HFILL }},
8332 { &hf_nfs_fsid4_major, {
8333 "fsid4.major", "nfs.fsid4.major", FT_UINT64, BASE_DEC,
8334 NULL, 0, "nfs.nfstime4.fsid4.major", HFILL }},
8336 { &hf_nfs_fsid4_minor, {
8337 "fsid4.minor", "nfs.fsid4.minor", FT_UINT64, BASE_DEC,
8338 NULL, 0, "nfs.fsid4.minor", HFILL }},
8340 { &hf_nfs_acetype4, {
8341 "acetype", "nfs.acetype4", FT_UINT32, BASE_DEC,
8342 VALS(names_acetype4), 0, "nfs.acetype4", HFILL }},
8344 { &hf_nfs_aceflag4, {
8345 "aceflag", "nfs.aceflag4", FT_UINT32, BASE_DEC,
8346 NULL, 0, "nfs.aceflag4", HFILL }},
8348 { &hf_nfs_acemask4, {
8349 "acemask", "nfs.acemask4", FT_UINT32, BASE_DEC,
8350 NULL, 0, "nfs.acemask4", HFILL }},
8352 { &hf_nfs_fattr4_size, {
8353 "size", "nfs.fattr4.size", FT_UINT64, BASE_DEC,
8354 NULL, 0, "nfs.fattr4.size", HFILL }},
8356 { &hf_nfs_fattr4_lease_time, {
8357 "lease_time", "nfs.fattr4.lease_time", FT_UINT32, BASE_DEC,
8358 NULL, 0, "nfs.fattr4.lease_time", HFILL }},
8360 { &hf_nfs_fattr4_aclsupport, {
8361 "aclsupport", "nfs.fattr4.aclsupport", FT_UINT32, BASE_DEC,
8362 NULL, 0, "nfs.fattr4.aclsupport", HFILL }},
8364 { &hf_nfs_fattr4_fileid, {
8365 "fileid", "nfs.fattr4.fileid", FT_UINT64, BASE_DEC,
8366 NULL, 0, "nfs.fattr4.fileid", HFILL }},
8368 { &hf_nfs_fattr4_files_avail, {
8369 "files_avail", "nfs.fattr4.files_avail", FT_UINT64, BASE_DEC,
8370 NULL, 0, "nfs.fattr4.files_avail", HFILL }},
8372 { &hf_nfs_fattr4_files_free, {
8373 "files_free", "nfs.fattr4.files_free", FT_UINT64, BASE_DEC,
8374 NULL, 0, "nfs.fattr4.files_free", HFILL }},
8376 { &hf_nfs_fattr4_files_total, {
8377 "files_total", "nfs.fattr4.files_total", FT_UINT64, BASE_DEC,
8378 NULL, 0, "nfs.fattr4.files_total", HFILL }},
8380 { &hf_nfs_fattr4_maxfilesize, {
8381 "maxfilesize", "nfs.fattr4.maxfilesize", FT_UINT64, BASE_DEC,
8382 NULL, 0, "nfs.fattr4.maxfilesize", HFILL }},
8384 { &hf_nfs_fattr4_maxlink, {
8385 "maxlink", "nfs.fattr4.maxlink", FT_UINT32, BASE_DEC,
8386 NULL, 0, "nfs.fattr4.maxlink", HFILL }},
8388 { &hf_nfs_fattr4_maxname, {
8389 "maxname", "nfs.fattr4.maxname", FT_UINT32, BASE_DEC,
8390 NULL, 0, "nfs.fattr4.maxname", HFILL }},
8392 { &hf_nfs_fattr4_numlinks, {
8393 "numlinks", "nfs.fattr4.numlinks", FT_UINT32, BASE_DEC,
8394 NULL, 0, "nfs.fattr4.numlinks", HFILL }},
8396 { &hf_nfs_delegate_type, {
8397 "delegate_type", "nfs.delegate_type", FT_UINT32, BASE_DEC,
8398 NULL, 0, "nfs.delegate_type", HFILL }},
8400 { &hf_nfs_secinfo_flavor, {
8401 "flavor", "nfs.secinfo.flavor", FT_UINT32, BASE_DEC,
8402 VALS(rpc_auth_flavor), 0, "nfs.secinfo.flavor", HFILL }},
8404 { &hf_nfs_num_blocks, {
8405 "num_blocks", "nfs.num_blocks", FT_UINT32, BASE_DEC,
8406 NULL, 0, "nfs.num_blocks", HFILL }},
8408 { &hf_nfs_bytes_per_block, {
8409 "bytes_per_block", "nfs.bytes_per_block", FT_UINT32, BASE_DEC,
8410 NULL, 0, "nfs.bytes_per_block", HFILL }},
8413 "eof", "nfs.eof", FT_UINT32, BASE_DEC,
8414 NULL, 0, "nfs.eof", HFILL }},
8416 { &hf_nfs_fattr4_maxread, {
8417 "maxread", "nfs.fattr4.maxread", FT_UINT64, BASE_DEC,
8418 NULL, 0, "nfs.fattr4.maxread", HFILL }},
8420 { &hf_nfs_fattr4_maxwrite, {
8421 "maxwrite", "nfs.fattr4.maxwrite", FT_UINT64, BASE_DEC,
8422 NULL, 0, "nfs.fattr4.maxwrite", HFILL }},
8424 { &hf_nfs_fattr4_quota_hard, {
8425 "quota_hard", "nfs.fattr4.quota_hard", FT_UINT64, BASE_DEC,
8426 NULL, 0, "nfs.fattr4.quota_hard", HFILL }},
8428 { &hf_nfs_fattr4_quota_soft, {
8429 "quota_soft", "nfs.fattr4.quota_soft", FT_UINT64, BASE_DEC,
8430 NULL, 0, "nfs.fattr4.quota_soft", HFILL }},
8432 { &hf_nfs_fattr4_quota_used, {
8433 "quota_used", "nfs.fattr4.quota_used", FT_UINT64, BASE_DEC,
8434 NULL, 0, "nfs.fattr4.quota_used", HFILL }},
8436 { &hf_nfs_fattr4_space_avail, {
8437 "space_avail", "nfs.fattr4.space_avail", FT_UINT64, BASE_DEC,
8438 NULL, 0, "nfs.fattr4.space_avail", HFILL }},
8440 { &hf_nfs_fattr4_space_free, {
8441 "space_free", "nfs.fattr4.space_free", FT_UINT64, BASE_DEC,
8442 NULL, 0, "nfs.fattr4.space_free", HFILL }},
8444 { &hf_nfs_fattr4_space_total, {
8445 "space_total", "nfs.fattr4.space_total", FT_UINT64, BASE_DEC,
8446 NULL, 0, "nfs.fattr4.space_total", HFILL }},
8448 { &hf_nfs_fattr4_space_used, {
8449 "space_used", "nfs.fattr4.space_used", FT_UINT64, BASE_DEC,
8450 NULL, 0, "nfs.fattr4.space_used", HFILL }},
8452 { &hf_nfs_stateid4_delegate_stateid, {
8453 "delegate_stateid", "nfs.delegate_stateid", FT_UINT64, BASE_DEC,
8454 NULL, 0, "nfs.delegate_stateid", HFILL }},
8456 { &hf_nfs_verifier4, {
8457 "verifier", "nfs.verifier4", FT_UINT64, BASE_HEX,
8458 NULL, 0, "nfs.verifier4", HFILL }},
8460 { &hf_nfs_cookie4, {
8461 "cookie", "nfs.cookie4", FT_UINT64, BASE_DEC,
8462 NULL, 0, "nfs.cookie4", HFILL }},
8464 { &hf_nfs_cookieverf4, {
8465 "cookieverf", "nfs.cookieverf4", FT_UINT64, BASE_DEC,
8466 NULL, 0, "nfs.cookieverf4", HFILL }},
8468 { &hf_nfs_cb_location, {
8469 "cb_location", "nfs.cb_location", FT_UINT32, BASE_DEC,
8470 NULL, 0, "nfs.cb_location", HFILL }},
8472 { &hf_nfs_cb_program, {
8473 "cb_program", "nfs.cb_program", FT_UINT32, BASE_HEX,
8474 NULL, 0, "nfs.cb_program", HFILL }},
8476 { &hf_nfs_recall4, {
8477 "recall", "nfs.recall4", FT_BOOLEAN,
8478 BASE_NONE, &yesno, 0, "nfs.recall4", HFILL }},
8480 { &hf_nfs_filesize, {
8481 "filesize", "nfs.filesize", FT_UINT64, BASE_DEC,
8482 NULL, 0, "nfs.filesize", HFILL }},
8485 "count", "nfs.count4", FT_UINT32, BASE_DEC,
8486 NULL, 0, "nfs.count4", HFILL }},
8488 { &hf_nfs_count4_dircount, {
8489 "dircount", "nfs.dircount", FT_UINT32, BASE_DEC,
8490 NULL, 0, "nfs.dircount", HFILL }},
8492 { &hf_nfs_count4_maxcount, {
8493 "maxcount", "nfs.maxcount", FT_UINT32, BASE_DEC,
8494 NULL, 0, "nfs.maxcount", HFILL }},
8496 { &hf_nfs_minorversion, {
8497 "minorversion", "nfs.minorversion", FT_UINT32, BASE_DEC,
8498 NULL, 0, "nfs.minorversion", HFILL }},
8501 "atime", "nfs.atime", FT_ABSOLUTE_TIME, BASE_NONE,
8502 NULL, 0, "Access Time", HFILL }},
8504 { &hf_nfs_atime_sec, {
8505 "seconds", "nfs.atime.sec", FT_UINT32, BASE_DEC,
8506 NULL, 0, "Access Time, Seconds", HFILL }},
8508 { &hf_nfs_atime_nsec, {
8509 "nano seconds", "nfs.atime.nsec", FT_UINT32, BASE_DEC,
8510 NULL, 0, "Access Time, Nano-seconds", HFILL }},
8512 { &hf_nfs_atime_usec, {
8513 "micro seconds", "nfs.atime.usec", FT_UINT32, BASE_DEC,
8514 NULL, 0, "Access Time, Micro-seconds", HFILL }},
8517 "mtime", "nfs.mtime", FT_ABSOLUTE_TIME, BASE_NONE,
8518 NULL, 0, "Modify Time", HFILL }},
8520 { &hf_nfs_mtime_sec, {
8521 "seconds", "nfs.mtime.sec", FT_UINT32, BASE_DEC,
8522 NULL, 0, "Modify Seconds", HFILL }},
8524 { &hf_nfs_mtime_nsec, {
8525 "nano seconds", "nfs.mtime.nsec", FT_UINT32, BASE_DEC,
8526 NULL, 0, "Modify Time, Nano-seconds", HFILL }},
8528 { &hf_nfs_mtime_usec, {
8529 "micro seconds", "nfs.mtime.usec", FT_UINT32, BASE_DEC,
8530 NULL, 0, "Modify Time, Micro-seconds", HFILL }},
8533 "ctime", "nfs.ctime", FT_ABSOLUTE_TIME, BASE_NONE,
8534 NULL, 0, "Creation Time", HFILL }},
8536 { &hf_nfs_ctime_sec, {
8537 "seconds", "nfs.ctime.sec", FT_UINT32, BASE_DEC,
8538 NULL, 0, "Creation Time, Seconds", HFILL }},
8540 { &hf_nfs_ctime_nsec, {
8541 "nano seconds", "nfs.ctime.nsec", FT_UINT32, BASE_DEC,
8542 NULL, 0, "Creation Time, Nano-seconds", HFILL }},
8544 { &hf_nfs_ctime_usec, {
8545 "micro seconds", "nfs.ctime.usec", FT_UINT32, BASE_DEC,
8546 NULL, 0, "Creation Time, Micro-seconds", HFILL }},
8549 "time delta", "nfs.dtime", FT_RELATIVE_TIME, BASE_NONE,
8550 NULL, 0, "Time Delta", HFILL }},
8552 { &hf_nfs_dtime_sec, {
8553 "seconds", "nfs.dtime.sec", FT_UINT32, BASE_DEC,
8554 NULL, 0, "Time Delta, Seconds", HFILL }},
8556 { &hf_nfs_dtime_nsec, {
8557 "nano seconds", "nfs.dtime.nsec", FT_UINT32, BASE_DEC,
8558 NULL, 0, "Time Delta, Nano-seconds", HFILL }},
8560 { &hf_nfs_open_owner4, {
8561 "owner", "nfs.open_owner4", FT_BYTES, BASE_DEC,
8562 NULL, 0, "owner", HFILL }},
8564 { &hf_nfs_lock_owner4, {
8565 "owner", "nfs.lock_owner4", FT_BYTES, BASE_DEC,
8566 NULL, 0, "owner", HFILL }},
8568 { &hf_nfs_secinfo_rpcsec_gss_info_service, {
8569 "service", "nfs.secinfo.rpcsec_gss_info.service", FT_UINT32,
8570 BASE_DEC, VALS(rpc_authgss_svc), 0, "service", HFILL }},
8572 { &hf_nfs_attrdircreate, {
8573 "attribute dir create", "nfs.openattr4.createdir", FT_BOOLEAN,
8574 BASE_NONE, &yesno, 0, "nfs.openattr4.createdir", HFILL }},
8576 { &hf_nfs_new_lock_owner, {
8577 "new lock owner?", "nfs.lock.locker.new_lock_owner", FT_BOOLEAN,
8578 BASE_NONE, &yesno, 0, "nfs.lock.locker.new_lock_owner", HFILL }},
8580 { &hf_nfs_lock4_reclaim, {
8581 "reclaim?", "nfs.lock.reclaim", FT_BOOLEAN,
8582 BASE_NONE, &yesno, 0, "nfs.lock.reclaim", HFILL }},
8584 { &hf_nfs_sec_oid4, {
8585 "oid", "nfs.secinfo.flavor_info.rpcsec_gss_info.oid", FT_BYTES,
8586 BASE_DEC, NULL, 0, "oid", HFILL }},
8589 "qop", "nfs.secinfo.flavor_info.rpcsec_gss_info.qop", FT_UINT32,
8590 BASE_DEC, NULL, 0, "qop", HFILL }},
8592 { &hf_nfs_client_id4_id, {
8593 "id", "nfs.nfs_client_id4.id", FT_BYTES, BASE_DEC,
8594 NULL, 0, "nfs.nfs_client_id4.id", HFILL }},
8596 { &hf_nfs_stateid4_other, {
8597 "Data", "nfs.stateid4.other", FT_BYTES, BASE_DEC,
8598 NULL, 0, "Data", HFILL }},
8601 "ACL", "nfs.acl", FT_NONE, BASE_NONE,
8602 NULL, 0, "Access Control List", HFILL }},
8604 { &hf_nfs_callback_ident, {
8605 "callback_ident", "nfs.callback.ident", FT_UINT32, BASE_HEX,
8606 NULL, 0, "Callback Identifier", HFILL }},
8608 { &hf_nfs_r_netid, {
8609 "r_netid", "nfs.r_netid", FT_BYTES, BASE_DEC, NULL, 0,
8610 "r_netid", HFILL }},
8613 "r_addr", "nfs.r_addr", FT_BYTES, BASE_DEC, NULL, 0,
8616 { &hf_nfs_secinfo_arr4, {
8617 "Flavors Info", "nfs.flavors.info", FT_NONE, BASE_NONE,
8618 NULL, 0, "Flavors Info", HFILL }},
8621 static gint *ett[] = {
8623 &ett_nfs_fh_encoding,
8639 &ett_nfs_readdir_entry,
8645 &ett_nfs_post_op_fh3,
8647 &ett_nfs_diropargs3,
8648 &ett_nfs_sattrguard3,
8655 &ett_nfs_pre_op_attr,
8656 &ett_nfs_post_op_attr,
8660 &ett_nfs_fsinfo_properties,
8661 &ett_nfs_compound_call4,
8662 &ett_nfs_utf8string,
8669 &ett_nfs_delegpurge4,
8670 &ett_nfs_delegreturn4,
8682 &ett_nfs_open_confirm4,
8683 &ett_nfs_open_downgrade4,
8686 &ett_nfs_putrootfh4,
8693 &ett_nfs_restorefh4,
8696 &ett_nfs_setclientid4,
8697 &ett_nfs_setclientid_confirm4,
8704 &ett_nfs_change_info4,
8705 &ett_nfs_open_delegation4,
8706 &ett_nfs_open_claim4,
8708 &ett_nfs_lock_owner4,
8709 &ett_nfs_cb_client4,
8710 &ett_nfs_client_id4,
8714 &ett_nfs_fs_locations4,
8715 &ett_nfs_fs_location4,
8716 &ett_nfs_open4_result_flags,
8718 &ett_nfs_secinfo4_flavor_info,
8720 &ett_nfs_fattr4_fh_expire_type,
8722 &ett_nfs_clientaddr4,
8726 module_t *nfs_module;
8728 proto_nfs = proto_register_protocol("Network File System", "NFS", "nfs");
8729 proto_register_field_array(proto_nfs, hf, array_length(hf));
8730 proto_register_subtree_array(ett, array_length(ett));
8732 nfs_module=prefs_register_protocol(proto_nfs, NULL);
8733 prefs_register_bool_preference(nfs_module, "file_name_snooping",
8734 "Snoop FH to filename mappings",
8735 "Whether the dissector should snoop the FH to filename mappings by looking inside certain packets",
8736 &nfs_file_name_snooping);
8737 prefs_register_bool_preference(nfs_module, "file_full_name_snooping",
8738 "Snoop full path to filenames",
8739 "Whether the dissector should snoop the full pathname for files for matching FH's",
8740 &nfs_file_name_full_snooping);
8741 prefs_register_bool_preference(nfs_module, "fhandle_find_both_reqrep",
8742 "Fhandle filters finds both request/response",
8743 "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",
8744 &nfs_fhandle_reqrep_matching);
8745 register_init_routine(nfs_name_snoop_init);
8746 register_init_routine(nfs_fhandle_reqrep_matching_init);
8750 proto_reg_handoff_nfs(void)
8752 /* Register the protocol as RPC */
8753 rpc_init_prog(proto_nfs, NFS_PROGRAM, ett_nfs);
8754 /* Register the procedure tables */
8755 rpc_init_proc_table(NFS_PROGRAM, 2, nfs2_proc, hf_nfs_procedure_v2);
8756 rpc_init_proc_table(NFS_PROGRAM, 3, nfs3_proc, hf_nfs_procedure_v3);
8757 rpc_init_proc_table(NFS_PROGRAM, 4, nfs4_proc, hf_nfs_procedure_v4);