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.81 2002/10/14 17:08:53 guy Exp $
7 * Ethereal - Network traffic analyzer
8 * By Gerald Combs <gerald@ethereal.com>
9 * Copyright 1998 Gerald Combs
11 * Copied from packet-smb.c
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version 2
16 * of the License, or (at your option) any later version.
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
36 #include "packet-rpc.h"
37 #include "packet-nfs.h"
41 static int proto_nfs = -1;
43 static int hf_nfs_fh_length = -1;
44 static int hf_nfs_fh_hash = -1;
45 static int hf_nfs_fh_fsid_major = -1;
46 static int hf_nfs_fh_fsid_minor = -1;
47 static int hf_nfs_fh_fsid_inode = -1;
48 static int hf_nfs_fh_xfsid_major = -1;
49 static int hf_nfs_fh_xfsid_minor = -1;
50 static int hf_nfs_fh_fstype = -1;
51 static int hf_nfs_fh_fn = -1;
52 static int hf_nfs_fh_fn_len = -1;
53 static int hf_nfs_fh_fn_inode = -1;
54 static int hf_nfs_fh_fn_generation = -1;
55 static int hf_nfs_fh_xfn = -1;
56 static int hf_nfs_fh_xfn_len = -1;
57 static int hf_nfs_fh_xfn_inode = -1;
58 static int hf_nfs_fh_xfn_generation = -1;
59 static int hf_nfs_fh_dentry = -1;
60 static int hf_nfs_fh_dev = -1;
61 static int hf_nfs_fh_xdev = -1;
62 static int hf_nfs_fh_dirinode = -1;
63 static int hf_nfs_fh_pinode = -1;
64 static int hf_nfs_fh_hp_len = -1;
65 static int hf_nfs_fh_version = -1;
66 static int hf_nfs_fh_auth_type = -1;
67 static int hf_nfs_fh_fsid_type = -1;
68 static int hf_nfs_fh_fileid_type = -1;
69 static int hf_nfs_stat = -1;
70 static int hf_nfs_name = -1;
71 static int hf_nfs_full_name = -1;
72 static int hf_nfs_readlink_data = -1;
73 static int hf_nfs_read_offset = -1;
74 static int hf_nfs_read_count = -1;
75 static int hf_nfs_read_totalcount = -1;
76 static int hf_nfs_data = -1;
77 static int hf_nfs_write_beginoffset = -1;
78 static int hf_nfs_write_offset = -1;
79 static int hf_nfs_write_totalcount = -1;
80 static int hf_nfs_symlink_to = -1;
81 static int hf_nfs_readdir_cookie = -1;
82 static int hf_nfs_readdir_count = -1;
83 static int hf_nfs_readdir_entry = -1;
84 static int hf_nfs_readdir_entry_fileid = -1;
85 static int hf_nfs_readdir_entry_name = -1;
86 static int hf_nfs_readdir_entry_cookie = -1;
87 static int hf_nfs_readdir_entry3_fileid = -1;
88 static int hf_nfs_readdir_entry3_name = -1;
89 static int hf_nfs_readdir_entry3_cookie = -1;
90 static int hf_nfs_readdirplus_entry_fileid = -1;
91 static int hf_nfs_readdirplus_entry_name = -1;
92 static int hf_nfs_readdirplus_entry_cookie = -1;
93 static int hf_nfs_readdir_eof = -1;
94 static int hf_nfs_statfs_tsize = -1;
95 static int hf_nfs_statfs_bsize = -1;
96 static int hf_nfs_statfs_blocks = -1;
97 static int hf_nfs_statfs_bfree = -1;
98 static int hf_nfs_statfs_bavail = -1;
99 static int hf_nfs_ftype3 = -1;
100 static int hf_nfs_nfsstat3 = -1;
101 static int hf_nfs_read_eof = -1;
102 static int hf_nfs_write_stable = -1;
103 static int hf_nfs_write_committed = -1;
104 static int hf_nfs_createmode3 = -1;
105 static int hf_nfs_fsstat_invarsec = -1;
106 static int hf_nfs_fsinfo_rtmax = -1;
107 static int hf_nfs_fsinfo_rtpref = -1;
108 static int hf_nfs_fsinfo_rtmult = -1;
109 static int hf_nfs_fsinfo_wtmax = -1;
110 static int hf_nfs_fsinfo_wtpref = -1;
111 static int hf_nfs_fsinfo_wtmult = -1;
112 static int hf_nfs_fsinfo_dtpref = -1;
113 static int hf_nfs_fsinfo_maxfilesize = -1;
114 static int hf_nfs_fsinfo_properties = -1;
115 static int hf_nfs_pathconf_linkmax = -1;
116 static int hf_nfs_pathconf_name_max = -1;
117 static int hf_nfs_pathconf_no_trunc = -1;
118 static int hf_nfs_pathconf_chown_restricted = -1;
119 static int hf_nfs_pathconf_case_insensitive = -1;
120 static int hf_nfs_pathconf_case_preserving = -1;
122 static int hf_nfs_atime = -1;
123 static int hf_nfs_atime_sec = -1;
124 static int hf_nfs_atime_nsec = -1;
125 static int hf_nfs_atime_usec = -1;
126 static int hf_nfs_mtime = -1;
127 static int hf_nfs_mtime_sec = -1;
128 static int hf_nfs_mtime_nsec = -1;
129 static int hf_nfs_mtime_usec = -1;
130 static int hf_nfs_ctime = -1;
131 static int hf_nfs_ctime_sec = -1;
132 static int hf_nfs_ctime_nsec = -1;
133 static int hf_nfs_ctime_usec = -1;
134 static int hf_nfs_dtime = -1;
135 static int hf_nfs_dtime_sec = -1;
136 static int hf_nfs_dtime_nsec = -1;
138 static int hf_nfs_fattr_type = -1;
139 static int hf_nfs_fattr_nlink = -1;
140 static int hf_nfs_fattr_uid = -1;
141 static int hf_nfs_fattr_gid = -1;
142 static int hf_nfs_fattr_size = -1;
143 static int hf_nfs_fattr_blocksize = -1;
144 static int hf_nfs_fattr_rdev = -1;
145 static int hf_nfs_fattr_blocks = -1;
146 static int hf_nfs_fattr_fsid = -1;
147 static int hf_nfs_fattr_fileid = -1;
148 static int hf_nfs_fattr3_type = -1;
149 static int hf_nfs_fattr3_nlink = -1;
150 static int hf_nfs_fattr3_uid = -1;
151 static int hf_nfs_fattr3_gid = -1;
152 static int hf_nfs_fattr3_size = -1;
153 static int hf_nfs_fattr3_used = -1;
154 static int hf_nfs_fattr3_rdev = -1;
155 static int hf_nfs_fattr3_fsid = -1;
156 static int hf_nfs_fattr3_fileid = -1;
157 static int hf_nfs_wcc_attr_size = -1;
158 static int hf_nfs_set_size3_size = -1;
159 static int hf_nfs_cookie3 = -1;
160 static int hf_nfs_fsstat3_resok_tbytes = -1;
161 static int hf_nfs_fsstat3_resok_fbytes = -1;
162 static int hf_nfs_fsstat3_resok_abytes = -1;
163 static int hf_nfs_fsstat3_resok_tfiles = -1;
164 static int hf_nfs_fsstat3_resok_ffiles = -1;
165 static int hf_nfs_fsstat3_resok_afiles = -1;
166 static int hf_nfs_uid3 = -1;
167 static int hf_nfs_gid3 = -1;
168 static int hf_nfs_offset3 = -1;
169 static int hf_nfs_count3 = -1;
170 static int hf_nfs_count3_maxcount = -1;
171 static int hf_nfs_count3_dircount= -1;
174 static int hf_nfs_argop4 = -1;
175 static int hf_nfs_resop4 = -1;
176 static int hf_nfs_linktext4 = -1;
177 static int hf_nfs_tag4 = -1;
178 static int hf_nfs_component4 = -1;
179 static int hf_nfs_clientid4 = -1;
180 static int hf_nfs_ace4 = -1;
181 static int hf_nfs_recall = -1;
182 static int hf_nfs_open_claim_type4 = -1;
183 static int hf_nfs_opentype4 = -1;
184 static int hf_nfs_limit_by4 = -1;
185 static int hf_nfs_open_delegation_type4 = -1;
186 static int hf_nfs_ftype4 = -1;
187 static int hf_nfs_change_info4_atomic = -1;
188 static int hf_nfs_open4_share_access = -1;
189 static int hf_nfs_open4_share_deny = -1;
190 static int hf_nfs_seqid4 = -1;
191 static int hf_nfs_lock_seqid4 = -1;
192 static int hf_nfs_mand_attr = -1;
193 static int hf_nfs_recc_attr = -1;
194 static int hf_nfs_time_how4 = -1;
195 static int hf_nfs_attrlist4 = -1;
196 static int hf_nfs_fattr4_link_support = -1;
197 static int hf_nfs_fattr4_symlink_support = -1;
198 static int hf_nfs_fattr4_named_attr = -1;
199 static int hf_nfs_fattr4_unique_handles = -1;
200 static int hf_nfs_fattr4_archive = -1;
201 static int hf_nfs_fattr4_cansettime = -1;
202 static int hf_nfs_fattr4_case_insensitive = -1;
203 static int hf_nfs_fattr4_case_preserving = -1;
204 static int hf_nfs_fattr4_chown_restricted = -1;
205 static int hf_nfs_fattr4_hidden = -1;
206 static int hf_nfs_fattr4_homogeneous = -1;
207 static int hf_nfs_fattr4_mimetype = -1;
208 static int hf_nfs_fattr4_no_trunc = -1;
209 static int hf_nfs_fattr4_system = -1;
210 static int hf_nfs_fattr4_owner = -1;
211 static int hf_nfs_fattr4_owner_group = -1;
212 static int hf_nfs_fattr4_size = -1;
213 static int hf_nfs_fattr4_aclsupport = -1;
214 static int hf_nfs_fattr4_lease_time = -1;
215 static int hf_nfs_fattr4_fileid = -1;
216 static int hf_nfs_fattr4_files_avail = -1;
217 static int hf_nfs_fattr4_files_free = -1;
218 static int hf_nfs_fattr4_files_total = -1;
219 static int hf_nfs_fattr4_maxfilesize = -1;
220 static int hf_nfs_fattr4_maxlink = -1;
221 static int hf_nfs_fattr4_maxname = -1;
222 static int hf_nfs_fattr4_numlinks = -1;
223 static int hf_nfs_fattr4_maxread = -1;
224 static int hf_nfs_fattr4_maxwrite = -1;
225 static int hf_nfs_fattr4_quota_hard = -1;
226 static int hf_nfs_fattr4_quota_soft = -1;
227 static int hf_nfs_fattr4_quota_used = -1;
228 static int hf_nfs_fattr4_space_avail = -1;
229 static int hf_nfs_fattr4_space_free = -1;
230 static int hf_nfs_fattr4_space_total = -1;
231 static int hf_nfs_fattr4_space_used = -1;
232 static int hf_nfs_who = -1;
233 static int hf_nfs_server = -1;
234 static int hf_nfs_stable_how4 = -1;
235 static int hf_nfs_dirlist4_eof = -1;
236 static int hf_nfs_stateid4 = -1;
237 static int hf_nfs_offset4 = -1;
238 static int hf_nfs_specdata1 = -1;
239 static int hf_nfs_specdata2 = -1;
240 static int hf_nfs_lock_type4 = -1;
241 static int hf_nfs_reclaim4 = -1;
242 static int hf_nfs_length4 = -1;
243 static int hf_nfs_changeid4 = -1;
244 static int hf_nfs_changeid4_before = -1;
245 static int hf_nfs_changeid4_after = -1;
246 static int hf_nfs_nfstime4_seconds = -1;
247 static int hf_nfs_nfstime4_nseconds = -1;
248 static int hf_nfs_fsid4_major = -1;
249 static int hf_nfs_fsid4_minor = -1;
250 static int hf_nfs_acetype4 = -1;
251 static int hf_nfs_aceflag4 = -1;
252 static int hf_nfs_acemask4 = -1;
253 static int hf_nfs_delegate_type = -1;
254 static int hf_nfs_secinfo_flavor = -1;
255 static int hf_nfs_num_blocks = -1;
256 static int hf_nfs_bytes_per_block = -1;
257 static int hf_nfs_eof = -1;
258 static int hf_nfs_stateid4_delegate_stateid = -1;
259 static int hf_nfs_verifier4 = -1;
260 static int hf_nfs_cookie4 = -1;
261 static int hf_nfs_cookieverf4 = -1;
262 static int hf_nfs_cb_program = -1;
263 static int hf_nfs_cb_location = -1;
264 static int hf_nfs_recall4 = -1;
265 static int hf_nfs_filesize = -1;
266 static int hf_nfs_count4 = -1;
267 static int hf_nfs_count4_dircount = -1;
268 static int hf_nfs_count4_maxcount = -1;
269 static int hf_nfs_minorversion = -1;
270 static int hf_nfs_open_owner4 = -1;
271 static int hf_nfs_lock_owner4 = -1;
272 static int hf_nfs_new_lock_owner = -1;
273 static int hf_nfs_sec_oid4 = -1;
274 static int hf_nfs_qop4 = -1;
275 static int hf_nfs_secinfo_rpcsec_gss_info_service = -1;
276 static int hf_nfs_attrdircreate = -1;
277 static int hf_nfs_client_id4_id = -1;
278 static int hf_nfs_stateid4_other = -1;
279 static int hf_nfs_lock4_reclaim = -1;
280 static int hf_nfs_acl4 = -1;
281 static int hf_nfs_callback_ident = -1;
282 static int hf_nfs_r_netid = -1;
283 static int hf_nfs_r_addr = -1;
285 static gint ett_nfs = -1;
286 static gint ett_nfs_fh_encoding = -1;
287 static gint ett_nfs_fh_fsid = -1;
288 static gint ett_nfs_fh_xfsid = -1;
289 static gint ett_nfs_fh_fn = -1;
290 static gint ett_nfs_fh_xfn = -1;
291 static gint ett_nfs_fh_hp = -1;
292 static gint ett_nfs_fh_auth = -1;
293 static gint ett_nfs_fhandle = -1;
294 static gint ett_nfs_timeval = -1;
295 static gint ett_nfs_mode = -1;
296 static gint ett_nfs_fattr = -1;
297 static gint ett_nfs_sattr = -1;
298 static gint ett_nfs_diropargs = -1;
299 static gint ett_nfs_readdir_entry = -1;
300 static gint ett_nfs_mode3 = -1;
301 static gint ett_nfs_specdata3 = -1;
302 static gint ett_nfs_fh3 = -1;
303 static gint ett_nfs_nfstime3 = -1;
304 static gint ett_nfs_fattr3 = -1;
305 static gint ett_nfs_post_op_fh3 = -1;
306 static gint ett_nfs_sattr3 = -1;
307 static gint ett_nfs_diropargs3 = -1;
308 static gint ett_nfs_sattrguard3 = -1;
309 static gint ett_nfs_set_mode3 = -1;
310 static gint ett_nfs_set_uid3 = -1;
311 static gint ett_nfs_set_gid3 = -1;
312 static gint ett_nfs_set_size3 = -1;
313 static gint ett_nfs_set_atime = -1;
314 static gint ett_nfs_set_mtime = -1;
315 static gint ett_nfs_pre_op_attr = -1;
316 static gint ett_nfs_post_op_attr = -1;
317 static gint ett_nfs_wcc_attr = -1;
318 static gint ett_nfs_wcc_data = -1;
319 static gint ett_nfs_access = -1;
320 static gint ett_nfs_fsinfo_properties = -1;
323 static gint ett_nfs_compound_call4 = -1;
324 static gint ett_nfs_utf8string = -1;
325 static gint ett_nfs_argop4 = -1;
326 static gint ett_nfs_resop4 = -1;
327 static gint ett_nfs_access4 = -1;
328 static gint ett_nfs_close4 = -1;
329 static gint ett_nfs_commit4 = -1;
330 static gint ett_nfs_create4 = -1;
331 static gint ett_nfs_delegpurge4 = -1;
332 static gint ett_nfs_delegreturn4 = -1;
333 static gint ett_nfs_getattr4 = -1;
334 static gint ett_nfs_getfh4 = -1;
335 static gint ett_nfs_link4 = -1;
336 static gint ett_nfs_lock4 = -1;
337 static gint ett_nfs_lockt4 = -1;
338 static gint ett_nfs_locku4 = -1;
339 static gint ett_nfs_lookup4 = -1;
340 static gint ett_nfs_lookupp4 = -1;
341 static gint ett_nfs_nverify4 = -1;
342 static gint ett_nfs_open4 = -1;
343 static gint ett_nfs_openattr4 = -1;
344 static gint ett_nfs_open_confirm4 = -1;
345 static gint ett_nfs_open_downgrade4 = -1;
346 static gint ett_nfs_putfh4 = -1;
347 static gint ett_nfs_putpubfh4 = -1;
348 static gint ett_nfs_putrootfh4 = -1;
349 static gint ett_nfs_read4 = -1;
350 static gint ett_nfs_readdir4 = -1;
351 static gint ett_nfs_readlink4 = -1;
352 static gint ett_nfs_remove4 = -1;
353 static gint ett_nfs_rename4 = -1;
354 static gint ett_nfs_renew4 = -1;
355 static gint ett_nfs_restorefh4 = -1;
356 static gint ett_nfs_savefh4 = -1;
357 static gint ett_nfs_secinfo4 = -1;
358 static gint ett_nfs_setattr4 = -1;
359 static gint ett_nfs_setclientid4 = -1;
360 static gint ett_nfs_setclientid_confirm4 = -1;
361 static gint ett_nfs_verify4 = -1;
362 static gint ett_nfs_write4 = -1;
363 static gint ett_nfs_verifier4 = -1;
364 static gint ett_nfs_opaque = -1;
365 static gint ett_nfs_dirlist4 = -1;
366 static gint ett_nfs_pathname4 = -1;
367 static gint ett_nfs_change_info4 = -1;
368 static gint ett_nfs_open_delegation4 = -1;
369 static gint ett_nfs_open_claim4 = -1;
370 static gint ett_nfs_opentype4 = -1;
371 static gint ett_nfs_lock_owner4 = -1;
372 static gint ett_nfs_cb_client4 = -1;
373 static gint ett_nfs_client_id4 = -1;
374 static gint ett_nfs_bitmap4 = -1;
375 static gint ett_nfs_fattr4 = -1;
376 static gint ett_nfs_fsid4 = -1;
377 static gint ett_nfs_fs_locations4 = -1;
378 static gint ett_nfs_fs_location4 = -1;
379 static gint ett_nfs_open4_result_flags = -1;
380 static gint ett_nfs_secinfo4_flavor_info = -1;
381 static gint ett_nfs_stateid4 = -1;
382 static gint ett_nfs_fattr4_fh_expire_type = -1;
383 static gint ett_nfs_ace4 = -1;
384 static gint ett_nfs_clientaddr4 = -1;
385 static gint ett_nfs_aceflag4 = -1;
386 static gint ett_nfs_acemask4 = -1;
389 /* fhandle displayfilters to match also corresponding request/response
390 packet in addition to the one containing the actual filehandle */
391 gboolean nfs_fhandle_reqrep_matching = FALSE;
392 static GMemChunk *nfs_fhandle_data_chunk = NULL;
393 static int nfs_fhandle_data_init_count = 100;
394 static GHashTable *nfs_fhandle_data_table = NULL;
395 GHashTable *nfs_fhandle_frame_table = NULL;
398 nfs_fhandle_data_equal(gconstpointer k1, gconstpointer k2)
400 nfs_fhandle_data_t *key1 = (nfs_fhandle_data_t *)k1;
401 nfs_fhandle_data_t *key2 = (nfs_fhandle_data_t *)k2;
403 return (key1->len==key2->len)
404 &&(!memcmp(key1->fh, key2->fh, key1->len));
407 nfs_fhandle_data_hash(gconstpointer k)
409 nfs_fhandle_data_t *key = (nfs_fhandle_data_t *)k;
414 for(i=0;i<key->len;i++)
420 nfs_fhandle_data_free_all(gpointer key_arg _U_, gpointer value, gpointer user_data _U_)
422 nfs_fhandle_data_t *nns = (nfs_fhandle_data_t *)value;
427 g_free((gpointer)nns->fh);
435 nfs_fhandle_frame_equal(gconstpointer k1, gconstpointer k2)
437 guint32 key1 = (guint32)k1;
438 guint32 key2 = (guint32)k2;
443 nfs_fhandle_frame_hash(gconstpointer k)
445 guint32 key = (guint32)k;
450 nfs_fhandle_frame_free_all(gpointer key_arg _U_, gpointer value _U_, gpointer user_data _U_)
455 nfs_fhandle_reqrep_matching_init(void)
457 if (nfs_fhandle_frame_table != NULL) {
458 g_hash_table_foreach_remove(nfs_fhandle_frame_table,
459 nfs_fhandle_frame_free_all, NULL);
461 nfs_fhandle_frame_table=g_hash_table_new(nfs_fhandle_frame_hash,
462 nfs_fhandle_frame_equal);
466 if (nfs_fhandle_data_table != NULL) {
467 g_hash_table_foreach_remove(nfs_fhandle_data_table,
468 nfs_fhandle_data_free_all, NULL);
470 nfs_fhandle_data_table=g_hash_table_new(nfs_fhandle_data_hash,
471 nfs_fhandle_data_equal);
474 if(nfs_fhandle_data_chunk){
475 g_mem_chunk_destroy(nfs_fhandle_data_chunk);
476 nfs_fhandle_data_chunk = NULL;
479 if(nfs_fhandle_reqrep_matching){
480 nfs_fhandle_data_chunk = g_mem_chunk_new("nfs_fhandle_data_chunk",
481 sizeof(nfs_fhandle_data_t),
482 nfs_fhandle_data_init_count * sizeof(nfs_fhandle_data_t),
489 /* file name snooping */
490 gboolean nfs_file_name_snooping = FALSE;
491 gboolean nfs_file_name_full_snooping = FALSE;
492 typedef struct nfs_name_snoop {
498 unsigned char *parent;
500 unsigned char *full_name;
503 typedef struct nfs_name_snoop_key {
507 } nfs_name_snoop_key_t;
509 static GMemChunk *nfs_name_snoop_chunk = NULL;
510 static int nfs_name_snoop_init_count = 100;
511 static GHashTable *nfs_name_snoop_unmatched = NULL;
513 static GMemChunk *nfs_name_snoop_key_chunk = NULL;
514 static int nfs_name_snoop_key_init_count = 100;
515 static GHashTable *nfs_name_snoop_matched = NULL;
517 static GHashTable *nfs_name_snoop_known = NULL;
520 nfs_name_snoop_matched_equal(gconstpointer k1, gconstpointer k2)
522 nfs_name_snoop_key_t *key1 = (nfs_name_snoop_key_t *)k1;
523 nfs_name_snoop_key_t *key2 = (nfs_name_snoop_key_t *)k2;
525 return (key1->key==key2->key)
526 &&(key1->fh_length==key2->fh_length)
527 &&(!memcmp(key1->fh, key2->fh, key1->fh_length));
530 nfs_name_snoop_matched_hash(gconstpointer k)
532 nfs_name_snoop_key_t *key = (nfs_name_snoop_key_t *)k;
537 for(i=0;i<key->fh_length;i++)
543 nfs_name_snoop_unmatched_equal(gconstpointer k1, gconstpointer k2)
545 guint32 key1 = (guint32)k1;
546 guint32 key2 = (guint32)k2;
551 nfs_name_snoop_unmatched_hash(gconstpointer k)
553 guint32 key = (guint32)k;
558 nfs_name_snoop_unmatched_free_all(gpointer key_arg _U_, gpointer value, gpointer user_data _U_)
560 nfs_name_snoop_t *nns = (nfs_name_snoop_t *)value;
563 g_free((gpointer)nns->name);
568 g_free((gpointer)nns->full_name);
570 nns->full_name_len=0;
573 g_free((gpointer)nns->parent);
578 g_free((gpointer)nns->fh);
586 nfs_name_snoop_init(void)
588 if (nfs_name_snoop_unmatched != NULL) {
589 g_hash_table_foreach_remove(nfs_name_snoop_unmatched,
590 nfs_name_snoop_unmatched_free_all, NULL);
592 /* The fragment table does not exist. Create it */
593 nfs_name_snoop_unmatched=g_hash_table_new(nfs_name_snoop_unmatched_hash,
594 nfs_name_snoop_unmatched_equal);
596 if (nfs_name_snoop_matched != NULL) {
597 g_hash_table_foreach_remove(nfs_name_snoop_matched,
598 nfs_name_snoop_unmatched_free_all, NULL);
600 /* The fragment table does not exist. Create it */
601 nfs_name_snoop_matched=g_hash_table_new(nfs_name_snoop_matched_hash,
602 nfs_name_snoop_matched_equal);
604 if (nfs_name_snoop_known != NULL) {
605 g_hash_table_foreach_remove(nfs_name_snoop_known,
606 nfs_name_snoop_unmatched_free_all, NULL);
608 /* The fragment table does not exist. Create it */
609 nfs_name_snoop_known=g_hash_table_new(nfs_name_snoop_matched_hash,
610 nfs_name_snoop_matched_equal);
613 if(nfs_name_snoop_chunk){
614 g_mem_chunk_destroy(nfs_name_snoop_chunk);
615 nfs_name_snoop_chunk = NULL;
617 if(nfs_name_snoop_key_chunk){
618 g_mem_chunk_destroy(nfs_name_snoop_key_chunk);
619 nfs_name_snoop_key_chunk = NULL;
622 if(nfs_file_name_snooping){
623 nfs_name_snoop_chunk = g_mem_chunk_new("nfs_name_snoop_chunk",
624 sizeof(nfs_name_snoop_t),
625 nfs_name_snoop_init_count * sizeof(nfs_name_snoop_t),
627 nfs_name_snoop_key_chunk = g_mem_chunk_new("nfs_name_snoop_key_chunk",
628 sizeof(nfs_name_snoop_key_t),
629 nfs_name_snoop_key_init_count * sizeof(nfs_name_snoop_key_t),
636 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)
638 nfs_name_snoop_t *nns, *old_nns;
639 unsigned char *ptr=NULL;
641 /* filter out all '.' and '..' names */
643 ptr=(unsigned char *)tvb_get_ptr(tvb, name_offset, name_len);
656 nns=g_mem_chunk_alloc(nfs_name_snoop_chunk);
662 nns->parent_len=parent_len;
663 nns->parent=g_malloc(parent_len);
664 memcpy(nns->parent, tvb_get_ptr(tvb, parent_offset, parent_len), parent_len);
670 nns->name_len=name_len;
674 nns->name=g_malloc(name_len+1);
675 memcpy(nns->name, ptr, name_len);
677 nns->name[name_len]=0;
679 nns->full_name_len=0;
682 /* remove any old entry for this */
683 old_nns=g_hash_table_lookup(nfs_name_snoop_unmatched, (gconstpointer)xid);
685 /* if we haven't seen the reply yet, then there are no
686 matched entries for it, thus we can dealloc the arrays*/
688 g_free(old_nns->name);
692 g_free(old_nns->parent);
693 old_nns->parent=NULL;
694 old_nns->parent_len=0;
696 g_mem_chunk_free(nfs_name_snoop_chunk, old_nns);
698 g_hash_table_remove(nfs_name_snoop_unmatched, (gconstpointer)xid);
701 g_hash_table_insert(nfs_name_snoop_unmatched, (gpointer)xid, nns);
705 nfs_name_snoop_add_fh(int xid, tvbuff_t *tvb, int fh_offset, int fh_length)
707 nfs_name_snoop_t *nns, *old_nns;
708 nfs_name_snoop_key_t *key;
710 /* find which request we correspond to */
711 nns=g_hash_table_lookup(nfs_name_snoop_unmatched, (gconstpointer)xid);
713 /* oops couldnt find matching request, bail out */
717 /* if we have already seen this response earlier */
722 /* oki, we have a new entry */
723 nns->fh=g_malloc(fh_length);
724 memcpy(nns->fh, tvb_get_ptr(tvb, fh_offset, fh_length), fh_length);
725 nns->fh_length=fh_length;
727 key=g_mem_chunk_alloc(nfs_name_snoop_key_chunk);
729 key->fh_length=nns->fh_length;
732 /* already have something matched for this fh, remove it from
734 old_nns=g_hash_table_lookup(nfs_name_snoop_matched, key);
736 g_hash_table_remove(nfs_name_snoop_matched, key);
739 g_hash_table_remove(nfs_name_snoop_unmatched, (gconstpointer)xid);
740 g_hash_table_insert(nfs_name_snoop_matched, key, nns);
744 nfs_full_name_snoop(nfs_name_snoop_t *nns, int *len, unsigned char **name, unsigned char **pos)
746 nfs_name_snoop_t *parent_nns = NULL;
747 nfs_name_snoop_key_t key;
749 /* check if the nns component ends with a '/' else we just allocate
750 an extra byte to len to accommodate for it later */
751 if(nns->name[nns->name_len-1]!='/'){
755 (*len) += nns->name_len;
757 if(nns->parent==NULL){
758 *name = g_malloc((*len)+1);
761 strcpy(*pos, nns->name);
762 *pos += nns->name_len;
767 key.fh_length=nns->parent_len;
770 parent_nns=g_hash_table_lookup(nfs_name_snoop_matched, &key);
773 nfs_full_name_snoop(parent_nns, len, name, pos);
775 /* make sure components are '/' separated */
776 if( (*pos)[-1] != '/'){
781 strcpy(*pos, nns->name);
782 *pos += nns->name_len;
791 nfs_name_snoop_fh(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int fh_offset, int fh_length, gboolean hidden)
793 nfs_name_snoop_key_t key;
794 nfs_name_snoop_t *nns = NULL;
796 /* if this is a new packet, see if we can register the mapping */
797 if(!pinfo->fd->flags.visited){
799 key.fh_length=fh_length;
800 key.fh=(unsigned char *)tvb_get_ptr(tvb, fh_offset, fh_length);
802 nns=g_hash_table_lookup(nfs_name_snoop_matched, &key);
804 nfs_name_snoop_key_t *k;
805 k=g_mem_chunk_alloc(nfs_name_snoop_key_chunk);
806 k->key=pinfo->fd->num;
807 k->fh_length=nns->fh_length;
809 g_hash_table_insert(nfs_name_snoop_known, k, nns);
811 if(nfs_file_name_full_snooping){
812 unsigned char *name=NULL, *pos=NULL;
815 nfs_full_name_snoop(nns, &len, &name, &pos);
818 nns->full_name_len=len;
824 /* see if we know this mapping */
826 key.key=pinfo->fd->num;
827 key.fh_length=fh_length;
828 key.fh=(unsigned char *)tvb_get_ptr(tvb, fh_offset, fh_length);
830 nns=g_hash_table_lookup(nfs_name_snoop_known, &key);
833 /* if we know the mapping, print the filename */
836 proto_tree_add_string_hidden(tree, hf_nfs_name, tvb,
837 fh_offset, 0, nns->name);
839 proto_tree_add_string_format(tree, hf_nfs_name, tvb,
840 fh_offset, 0, nns->name, "Name: %s", nns->name);
844 proto_tree_add_string_hidden(tree, hf_nfs_full_name, tvb,
845 fh_offset, 0, nns->name);
847 proto_tree_add_string_format(tree, hf_nfs_full_name, tvb,
848 fh_offset, 0, nns->name, "Full Name: %s", nns->full_name);
854 /* file handle dissection */
856 #define FHT_UNKNOWN 0
858 #define FHT_LINUX_KNFSD_LE 2
859 #define FHT_LINUX_NFSD_LE 3
860 #define FHT_LINUX_KNFSD_NEW 4
862 static const value_string names_fhtype[] =
864 { FHT_UNKNOWN, "unknown" },
865 { FHT_SVR4, "System V R4" },
866 { FHT_LINUX_KNFSD_LE, "Linux knfsd (little-endian)" },
867 { FHT_LINUX_NFSD_LE, "Linux user-land nfsd (little-endian)" },
868 { FHT_LINUX_KNFSD_NEW, "Linux knfsd (new)" },
873 /* SVR4: checked with ReliantUNIX (5.43, 5.44, 5.45) */
876 dissect_fhandle_data_SVR4(tvbuff_t* tvb, int offset, proto_tree *tree,
879 guint32 nof = offset;
891 temp = tvb_get_ntohl(tvb, fsid_O);
892 fsid_major = ( temp>>18 ) & 0x3fff; /* 14 bits */
893 fsid_minor = ( temp ) & 0x3ffff; /* 18 bits */
895 proto_item* fsid_item = NULL;
896 proto_tree* fsid_tree = NULL;
898 fsid_item = proto_tree_add_text(tree, tvb,
900 "file system ID: %d,%d", fsid_major, fsid_minor);
902 fsid_tree = proto_item_add_subtree(fsid_item,
904 proto_tree_add_uint(fsid_tree, hf_nfs_fh_fsid_major,
905 tvb, fsid_O, 2, fsid_major);
906 proto_tree_add_uint(fsid_tree, hf_nfs_fh_fsid_minor,
907 tvb, fsid_O+1, 3, fsid_minor);
910 nof = fsid_O + fsid_L;
913 /* file system type */
921 fstype = tvb_get_ntohl(tvb, fstype_O);
923 proto_tree_add_uint(tree, hf_nfs_fh_fstype, tvb,
924 fstype_O, fstype_L, fstype);
926 nof = fstype_O + fstype_L;
936 guint32 fn_data_inode_O;
937 guint32 fn_data_inode_L;
939 guint32 fn_data_gen_O;
940 guint32 fn_data_gen_L;
947 fn_len = tvb_get_ntohs(tvb, fn_len_O);
948 fn_data_O = fn_O + fn_len_L;
949 fn_data_inode_O = fn_data_O + 2;
951 inode = tvb_get_ntohl(tvb, fn_data_inode_O);
952 fn_data_gen_O = fn_data_inode_O + fn_data_inode_L;
954 gen = tvb_get_ntohl(tvb, fn_data_gen_O);
955 fn_L = fn_len_L + fn_len;
957 proto_item* fn_item = NULL;
958 proto_tree* fn_tree = NULL;
960 fn_item = proto_tree_add_uint(tree, hf_nfs_fh_fn, tvb,
963 fn_tree = proto_item_add_subtree(fn_item,
965 proto_tree_add_uint(fn_tree, hf_nfs_fh_fn_len,
966 tvb, fn_len_O, fn_len_L, fn_len);
967 proto_tree_add_uint(fn_tree, hf_nfs_fh_fn_inode,
968 tvb, fn_data_inode_O, fn_data_inode_L, inode);
969 proto_tree_add_uint(fn_tree, hf_nfs_fh_fn_generation,
970 tvb, fn_data_gen_O, fn_data_gen_L, gen);
973 nof = fn_O + fn_len_L + fn_len;
976 /* exported file number */
983 guint32 xfn_data_inode_O;
984 guint32 xfn_data_inode_L;
986 guint32 xfn_data_gen_O;
987 guint32 xfn_data_gen_L;
994 xfn_len = tvb_get_ntohs(tvb, xfn_len_O);
995 xfn_data_O = xfn_O + xfn_len_L;
996 xfn_data_inode_O = xfn_data_O + 2;
997 xfn_data_inode_L = 4;
998 xinode = tvb_get_ntohl(tvb, xfn_data_inode_O);
999 xfn_data_gen_O = xfn_data_inode_O + xfn_data_inode_L;
1001 xgen = tvb_get_ntohl(tvb, xfn_data_gen_O);
1002 xfn_L = xfn_len_L + xfn_len;
1004 proto_item* xfn_item = NULL;
1005 proto_tree* xfn_tree = NULL;
1007 xfn_item = proto_tree_add_uint(tree, hf_nfs_fh_xfn, tvb,
1008 xfn_O, xfn_L, xinode);
1010 xfn_tree = proto_item_add_subtree(xfn_item,
1012 proto_tree_add_uint(xfn_tree, hf_nfs_fh_xfn_len,
1013 tvb, xfn_len_O, xfn_len_L, xfn_len);
1014 proto_tree_add_uint(xfn_tree, hf_nfs_fh_xfn_inode,
1015 tvb, xfn_data_inode_O, xfn_data_inode_L, xinode);
1016 proto_tree_add_uint(xfn_tree, hf_nfs_fh_xfn_generation,
1017 tvb, xfn_data_gen_O, xfn_data_gen_L, xgen);
1024 /* Checked with RedHat Linux 6.2 (kernel 2.2.14 knfsd) */
1027 dissect_fhandle_data_LINUX_KNFSD_LE(tvbuff_t* tvb, int offset, proto_tree *tree,
1036 guint32 xfsid_major;
1037 guint32 xfsid_minor;
1041 dentry = tvb_get_letohl(tvb, offset+0);
1042 inode = tvb_get_letohl(tvb, offset+4);
1043 dirinode = tvb_get_letohl(tvb, offset+8);
1044 temp = tvb_get_letohs (tvb,offset+12);
1045 fsid_major = (temp >> 8) & 0xff;
1046 fsid_minor = (temp ) & 0xff;
1047 temp = tvb_get_letohs(tvb,offset+16);
1048 xfsid_major = (temp >> 8) & 0xff;
1049 xfsid_minor = (temp ) & 0xff;
1050 xinode = tvb_get_letohl(tvb,offset+20);
1051 gen = tvb_get_letohl(tvb,offset+24);
1054 proto_tree_add_uint(tree, hf_nfs_fh_dentry,
1055 tvb, offset+0, 4, dentry);
1056 proto_tree_add_uint(tree, hf_nfs_fh_fn_inode,
1057 tvb, offset+4, 4, inode);
1058 proto_tree_add_uint(tree, hf_nfs_fh_dirinode,
1059 tvb, offset+8, 4, dirinode);
1061 /* file system id (device) */
1063 proto_item* fsid_item = NULL;
1064 proto_tree* fsid_tree = NULL;
1066 fsid_item = proto_tree_add_text(tree, tvb,
1068 "file system ID: %d,%d", fsid_major, fsid_minor);
1070 fsid_tree = proto_item_add_subtree(fsid_item,
1072 proto_tree_add_uint(fsid_tree, hf_nfs_fh_fsid_major,
1073 tvb, offset+13, 1, fsid_major);
1074 proto_tree_add_uint(fsid_tree, hf_nfs_fh_fsid_minor,
1075 tvb, offset+12, 1, fsid_minor);
1079 /* exported file system id (device) */
1081 proto_item* xfsid_item = NULL;
1082 proto_tree* xfsid_tree = NULL;
1084 xfsid_item = proto_tree_add_text(tree, tvb,
1086 "exported file system ID: %d,%d", xfsid_major, xfsid_minor);
1088 xfsid_tree = proto_item_add_subtree(xfsid_item,
1090 proto_tree_add_uint(xfsid_tree, hf_nfs_fh_xfsid_major,
1091 tvb, offset+17, 1, xfsid_major);
1092 proto_tree_add_uint(xfsid_tree, hf_nfs_fh_xfsid_minor,
1093 tvb, offset+16, 1, xfsid_minor);
1097 proto_tree_add_uint(tree, hf_nfs_fh_xfn_inode,
1098 tvb, offset+20, 4, xinode);
1099 proto_tree_add_uint(tree, hf_nfs_fh_fn_generation,
1100 tvb, offset+24, 4, gen);
1105 /* Checked with RedHat Linux 5.2 (nfs-server 2.2beta47 user-land nfsd) */
1108 dissect_fhandle_data_LINUX_NFSD_LE(tvbuff_t* tvb, int offset, proto_tree *tree,
1114 pinode = tvb_get_letohl(tvb, offset+0);
1116 proto_tree_add_uint(tree, hf_nfs_fh_pinode,
1117 tvb, offset+0, 4, pinode);
1125 hashlen = tvb_get_guint8(tvb, offset+4);
1127 proto_item* hash_item = NULL;
1128 proto_tree* hash_tree = NULL;
1130 hash_item = proto_tree_add_text(tree, tvb, offset+4,
1133 tvb_bytes_to_str(tvb,offset+5,hashlen));
1135 hash_tree = proto_item_add_subtree(hash_item,
1138 proto_tree_add_uint(hash_tree,
1139 hf_nfs_fh_hp_len, tvb, offset+4, 1,
1141 proto_tree_add_text(hash_tree, tvb, offset+5,
1144 tvb_bytes_to_str(tvb,offset+5,hashlen));
1152 /* Checked with SuSE 7.1 (kernel 2.4.0 knfsd) */
1153 /* read linux-2.4.5/include/linux/nfsd/nfsfh.h for more details */
1155 #define AUTH_TYPE_NONE 0
1156 static const value_string auth_type_names[] = {
1157 { AUTH_TYPE_NONE, "no authentication" },
1161 #define FSID_TYPE_MAJOR_MINOR_INODE 0
1162 static const value_string fsid_type_names[] = {
1163 { FSID_TYPE_MAJOR_MINOR_INODE, "major/minor/inode" },
1167 #define FILEID_TYPE_ROOT 0
1168 #define FILEID_TYPE_INODE_GENERATION 1
1169 #define FILEID_TYPE_INODE_GENERATION_PARENT 2
1170 static const value_string fileid_type_names[] = {
1171 { FILEID_TYPE_ROOT, "root" },
1172 { FILEID_TYPE_INODE_GENERATION, "inode/generation" },
1173 { FILEID_TYPE_INODE_GENERATION_PARENT, "inode/generation/parent" },
1178 dissect_fhandle_data_LINUX_KNFSD_NEW(tvbuff_t* tvb, int offset, proto_tree *tree,
1186 version = tvb_get_guint8(tvb, offset + 0);
1188 proto_tree_add_uint(tree, hf_nfs_fh_version,
1189 tvb, offset+0, 1, version);
1194 auth_type = tvb_get_guint8(tvb, offset + 1);
1195 fsid_type = tvb_get_guint8(tvb, offset + 2);
1196 fileid_type = tvb_get_guint8(tvb, offset + 3);
1198 proto_item* encoding_item = proto_tree_add_text(tree, tvb,
1200 "encoding: %u %u %u",
1201 auth_type, fsid_type, fileid_type);
1202 if (encoding_item) {
1203 proto_tree* encoding_tree = proto_item_add_subtree(encoding_item,
1204 ett_nfs_fh_encoding);
1205 if (encoding_tree) {
1206 proto_tree_add_uint(encoding_tree, hf_nfs_fh_auth_type,
1207 tvb, offset+1, 1, auth_type);
1208 proto_tree_add_uint(encoding_tree, hf_nfs_fh_fsid_type,
1209 tvb, offset+2, 1, fsid_type);
1210 proto_tree_add_uint(encoding_tree, hf_nfs_fh_fileid_type,
1211 tvb, offset+3, 1, fileid_type);
1218 /* unknown version */
1223 switch (auth_type) {
1225 /* no authentication */
1227 proto_tree_add_text(tree, tvb,
1229 "authentication: none");
1233 /* unknown authentication type */
1238 switch (fsid_type) {
1244 fsid_major = tvb_get_ntohs(tvb, offset + 0);
1245 fsid_minor = tvb_get_ntohs(tvb, offset + 2);
1246 fsid_inode = tvb_get_letohl(tvb, offset + 4);
1248 proto_item* fsid_item = proto_tree_add_text(tree, tvb,
1250 "file system ID: %u,%u (inode %u)",
1251 fsid_major, fsid_minor, fsid_inode);
1253 proto_tree* fsid_tree = proto_item_add_subtree(fsid_item,
1256 proto_tree_add_uint(fsid_tree, hf_nfs_fh_fsid_major,
1257 tvb, offset+0, 2, fsid_major);
1258 proto_tree_add_uint(fsid_tree, hf_nfs_fh_fsid_minor,
1259 tvb, offset+2, 2, fsid_minor);
1260 proto_tree_add_uint(fsid_tree, hf_nfs_fh_fsid_inode,
1261 tvb, offset+4, 4, fsid_inode);
1268 /* unknown fsid type */
1273 switch (fileid_type) {
1276 proto_tree_add_text(tree, tvb,
1278 "file ID: root inode");
1285 inode = tvb_get_letohl(tvb, offset + 0);
1286 generation = tvb_get_letohl(tvb, offset + 4);
1289 proto_item* fileid_item = proto_tree_add_text(tree, tvb,
1294 proto_tree* fileid_tree = proto_item_add_subtree(
1295 fileid_item, ett_nfs_fh_fn);
1297 proto_tree_add_uint(fileid_tree, hf_nfs_fh_fn_inode,
1298 tvb, offset+0, 4, inode);
1299 proto_tree_add_uint(fileid_tree, hf_nfs_fh_fn_generation,
1300 tvb, offset+4, 4, generation);
1310 guint32 parent_inode;
1312 inode = tvb_get_letohl(tvb, offset + 0);
1313 generation = tvb_get_letohl(tvb, offset + 4);
1314 parent_inode = tvb_get_letohl(tvb, offset + 8);
1317 proto_item* fileid_item = proto_tree_add_text(tree, tvb,
1322 proto_tree* fileid_tree = proto_item_add_subtree(
1323 fileid_item, ett_nfs_fh_fn);
1325 proto_tree_add_uint(fileid_tree, hf_nfs_fh_fn_inode,
1326 tvb, offset+0, 4, inode);
1327 proto_tree_add_uint(fileid_tree, hf_nfs_fh_fn_generation,
1328 tvb, offset+4, 4, generation);
1329 proto_tree_add_uint(fileid_tree, hf_nfs_fh_dirinode,
1330 tvb, offset+8, 4, parent_inode);
1338 /* unknown fileid type */
1349 dissect_fhandle_data_unknown(tvbuff_t *tvb, int offset, proto_tree *tree,
1354 gboolean first_line;
1358 while (bytes_left != 0) {
1360 if (sublen > bytes_left)
1361 sublen = bytes_left;
1362 proto_tree_add_text(tree, tvb, offset, sublen,
1364 first_line ? "data: " :
1366 tvb_bytes_to_str(tvb,offset,sublen));
1367 bytes_left -= sublen;
1375 dissect_fhandle_data(tvbuff_t *tvb, int offset, packet_info *pinfo,
1376 proto_tree *tree, unsigned int fhlen, gboolean hidden)
1378 unsigned int fhtype = FHT_UNKNOWN;
1380 /* filehandle too long */
1381 if (fhlen>64) goto type_ready;
1382 /* Not all bytes there. Any attempt to deduce the type would be
1384 if (!tvb_bytes_exist(tvb,offset,fhlen)) goto type_ready;
1386 /* this is to set up fhandle display filters to find both packets
1388 if(nfs_fhandle_reqrep_matching && (!hidden) ){
1389 nfs_fhandle_data_t *old_fhd=NULL;
1391 if( !pinfo->fd->flags.visited ){
1392 nfs_fhandle_data_t fhd;
1394 /* first check if we have seen this fhandle before */
1396 fhd.fh=(unsigned char *)tvb_get_ptr(tvb, offset, fhlen);
1397 old_fhd=g_hash_table_lookup(nfs_fhandle_data_table,
1398 (gconstpointer)&fhd);
1400 /* oh, a new fhandle, alloc struct and store it in the table*/
1401 old_fhd=g_mem_chunk_alloc(nfs_fhandle_data_chunk);
1403 old_fhd->fh=g_malloc(fhlen);
1404 memcpy(old_fhd->fh, fhd.fh, fhlen);
1405 old_fhd->tvb=tvb_new_real_data(old_fhd->fh, old_fhd->len, old_fhd->len);
1406 g_hash_table_insert(nfs_fhandle_data_table,
1407 (gpointer)old_fhd, (gpointer)old_fhd);
1410 /* XXX here we should really check that we havent stored
1411 this fhandle for this frame number already.
1412 We should also make sure we can handle when we have multiple
1413 fhandles seen for the same frame, which WILL happen for certain
1414 nfs calls. For now, we dont handle this and those calls will
1415 not work properly with this feature
1417 g_hash_table_insert(nfs_fhandle_frame_table,
1418 (gpointer)pinfo->fd->num,
1423 /* create a semiunique hash value for the filehandle */
1428 for(fhhash=0,i=0;i<(fhlen-3);i+=4){
1430 val = tvb_get_ntohl(tvb, offset+i);
1435 proto_tree_add_uint_hidden(tree, hf_nfs_fh_hash, tvb, offset,
1438 proto_tree_add_uint(tree, hf_nfs_fh_hash, tvb, offset,
1442 if(nfs_file_name_snooping){
1443 nfs_name_snoop_fh(pinfo, tree, tvb, offset, fhlen, hidden);
1447 /* calculate (heuristically) fhtype */
1450 if (tvb_get_ntohl(tvb,offset) == 0x01000000) {
1451 fhtype=FHT_LINUX_KNFSD_NEW;
1455 if (tvb_get_ntohl(tvb,offset) == 0x01000001) {
1456 fhtype=FHT_LINUX_KNFSD_NEW;
1460 if (tvb_get_ntohl(tvb,offset) == 0x01000002) {
1461 fhtype=FHT_LINUX_KNFSD_NEW;
1467 if (tvb_get_ntohs(tvb,offset+4) == 0) {
1468 len1=tvb_get_ntohs(tvb,offset+8);
1469 if (tvb_bytes_exist(tvb,offset+10+len1,2)) {
1470 len2=tvb_get_ntohs(tvb,
1472 if (fhlen==12+len1+len2) {
1478 len1 = tvb_get_guint8(tvb,offset+4);
1479 if (len1<28 && tvb_bytes_exist(tvb,offset+5,len1)) {
1481 for (len2=5+len1;len2<32;len2++) {
1482 if (tvb_get_guint8(tvb,offset+len2)) {
1488 fhtype=FHT_LINUX_NFSD_LE;
1492 if (tvb_get_ntohl(tvb,offset+28) == 0) {
1493 if (tvb_get_ntohs(tvb,offset+14) == 0) {
1494 if (tvb_get_ntohs(tvb,offset+18) == 0) {
1495 fhtype=FHT_LINUX_KNFSD_LE;
1507 proto_tree_add_text(tree, tvb, offset, 0,
1508 "type: %s", val_to_str(fhtype, names_fhtype, "Unknown"));
1513 dissect_fhandle_data_SVR4 (tvb, offset, tree,
1516 case FHT_LINUX_KNFSD_LE:
1517 dissect_fhandle_data_LINUX_KNFSD_LE(tvb, offset, tree,
1520 case FHT_LINUX_NFSD_LE:
1521 dissect_fhandle_data_LINUX_NFSD_LE (tvb, offset, tree,
1524 case FHT_LINUX_KNFSD_NEW:
1525 dissect_fhandle_data_LINUX_KNFSD_NEW (tvb, offset, tree,
1530 dissect_fhandle_data_unknown(tvb, offset, tree, fhlen);
1537 dissect_fhandle_hidden(packet_info *pinfo, proto_tree *tree, nfs_fhandle_data_t *nfd)
1539 if(nfd && nfd->len){
1540 dissect_fhandle_data(nfd->tvb, 0, pinfo, tree, nfd->len, TRUE);
1545 /***************************/
1546 /* NFS Version 2, RFC 1094 */
1547 /***************************/
1550 /* RFC 1094, Page 12..14 */
1551 static const value_string names_nfs_stat[] =
1558 { 13, "ERR_ACCES" },
1559 { 17, "ERR_EXIST" },
1560 { 18, "ERR_XDEV" }, /* not in spec, but can happen */
1561 { 19, "ERR_NODEV" },
1562 { 20, "ERR_NOTDIR" },
1563 { 21, "ERR_ISDIR" },
1564 { 22, "ERR_INVAL" }, /* not in spec, but I think it can happen */
1565 { 26, "ERR_TXTBSY" }, /* not in spec, but I think it can happen */
1567 { 28, "ERR_NOSPC" },
1569 { 31, "ERR_MLINK" }, /* not in spec, but can happen */
1570 { 45, "ERR_OPNOTSUPP" }, /* not in spec, but I think it can happen */
1571 { 63, "ERR_NAMETOOLONG" },
1572 { 66, "ERR_NOTEMPTY" },
1573 { 69, "ERR_DQUOT" },
1574 { 70, "ERR_STALE" },
1575 { 99, "ERR_WFLUSH" },
1579 /* NFSv4 Draft Specification, Page 198-199 */
1580 static const value_string names_nfs_stat4[] = {
1582 { 1, "NFS4ERR_PERM" },
1583 { 2, "NFS4ERR_NOENT" },
1584 { 5, "NFS4ERR_IO" },
1585 { 6, "NFS4ERR_NXIO" },
1586 { 13, "NFS4ERR_ACCES" },
1587 { 17, "NFS4ERR_EXIST" },
1588 { 18, "NFS4ERR_XDEV" },
1589 { 19, "NFS4ERR_NODEV" },
1590 { 20, "NFS4ERR_NOTDIR" },
1591 { 21, "NFS4ERR_ISDIR" },
1592 { 22, "NFS4ERR_INVAL" },
1593 { 27, "NFS4ERR_FBIG" },
1594 { 28, "NFS4ERR_NOSPC" },
1595 { 30, "NFS4ERR_ROFS" },
1596 { 31, "NFS4ERR_MLINK" },
1597 { 63, "NFS4ERR_NAMETOOLONG" },
1598 { 66, "NFS4ERR_NOTEMPTY" },
1599 { 69, "NFS4ERR_DQUOT" },
1600 { 70, "NFS4ERR_STALE" },
1601 { 10001, "NFS4ERR_BADHANDLE" },
1602 { 10003, "NFS4ERR_BAD_COOKIE" },
1603 { 10004, "NFS4ERR_NOTSUPP" },
1604 { 10005, "NFS4ERR_TOOSMALL" },
1605 { 10006, "NFS4ERR_SERVERFAULT" },
1606 { 10007, "NFS4ERR_BADTYPE" },
1607 { 10008, "NFS4ERR_DELAY" },
1608 { 10009, "NFS4ERR_SAME" },
1609 { 10010, "NFS4ERR_DENIED" },
1610 { 10011, "NFS4ERR_EXPIRED" },
1611 { 10012, "NFS4ERR_LOCKED" },
1612 { 10013, "NFS4ERR_GRACE" },
1613 { 10014, "NFS4ERR_FHEXPIRED" },
1614 { 10015, "NFS4ERR_SHARE_DENIED" },
1615 { 10016, "NFS4ERR_WRONGSEC" },
1616 { 10017, "NFS4ERR_CLID_INUSE" },
1617 { 10018, "NFS4ERR_RESOURCE" },
1618 { 10019, "NFS4ERR_MOVED" },
1619 { 10020, "NFS4ERR_NOFILEHANDLE" },
1620 { 10021, "NFS4ERR_MINOR_VERS_MISMATCH" },
1621 { 10022, "NFS4ERR_STALE_CLIENTID" },
1622 { 10023, "NFS4ERR_STALE_STATEID" },
1623 { 10024, "NFS4ERR_OLD_STATEID" },
1624 { 10025, "NFS4ERR_BAD_STATEID" },
1625 { 10026, "NFS4ERR_BAD_SEQID" },
1626 { 10027, "NFS4ERR_NOT_SAME" },
1627 { 10028, "NFS4ERR_LOCK_RANGE" },
1628 { 10029, "NFS4ERR_SYMLINK" },
1629 { 10030, "NFS4ERR_READDIR_NOSPC" },
1630 { 10031, "NFS4ERR_LEASE_MOVED" },
1631 { 10032, "NFS4ERR_ATTRNOTSUPP" },
1632 { 10033, "NFS4ERR_NO_GRACE" },
1633 { 10034, "NFS4ERR_RECLAIM_BAD" },
1634 { 10035, "NFS4ERR_RECLAIM_CONFLICT" },
1635 { 10036, "NFS4ERR_BADXDR" },
1636 { 10037, "NFS4ERR_LOCKS_HELD" },
1637 { 10038, "NFS4ERR_OPENMODE" },
1638 { 10039, "NFS4ERR_BADOWNER" },
1643 /* This function has been modified to support NFSv4 style error codes as
1644 * well as being backwards compatible with NFSv2 and NFSv3.
1647 dissect_stat_internal(tvbuff_t *tvb, int offset,
1648 proto_tree *tree, guint32* status, int nfsvers)
1652 stat = tvb_get_ntohl(tvb, offset+0);
1655 /* this gives the right NFSv2 number<->message relation */
1656 /* and makes it searchable via "nfs.status" */
1657 proto_tree_add_uint_format(tree, hf_nfs_nfsstat3, tvb,
1658 offset+0, 4, stat, "Status: %s (%u)",
1660 (nfsvers != 4)? names_nfs_stat: names_nfs_stat4,"%u"), stat);
1665 if (status) *status = stat;
1671 /* RFC 1094, Page 12..14 */
1673 dissect_stat(tvbuff_t *tvb, int offset, proto_tree *tree,
1676 return dissect_stat_internal(tvb, offset, tree, status, !4);
1680 /* RFC 1094, Page 12..14 */
1682 dissect_nfs2_stat_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree* tree)
1686 offset = dissect_stat(tvb, offset, tree, &status);
1693 dissect_nfs_nfsstat4(tvbuff_t *tvb, int offset,
1694 proto_tree *tree, guint32 *status)
1696 return dissect_stat_internal(tvb, offset, tree, status, 4);
1700 /* RFC 1094, Page 15 */
1702 dissect_ftype(tvbuff_t *tvb, int offset, proto_tree *tree, char* name)
1705 char* ftype_name = NULL;
1707 const value_string nfs2_ftype[] =
1710 { 1, "Regular File" },
1712 { 3, "Block Special Device" },
1713 { 4, "Character Special Device" },
1714 { 5, "Symbolic Link" },
1718 ftype = tvb_get_ntohl(tvb, offset+0);
1719 ftype_name = val_to_str(ftype, nfs2_ftype, "%u");
1722 proto_tree_add_text(tree, tvb, offset, 4,
1723 "%s: %s (%u)", name, ftype_name, ftype);
1731 /* RFC 1094, Page 15 */
1733 dissect_fhandle(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree,
1737 proto_tree* ftree = NULL;
1740 fitem = proto_tree_add_text(tree, tvb, offset, FHSIZE,
1743 ftree = proto_item_add_subtree(fitem, ett_nfs_fhandle);
1746 /* are we snooping fh to filenames ?*/
1747 if((!pinfo->fd->flags.visited) && nfs_file_name_snooping){
1748 rpc_call_info_value *civ=pinfo->private_data;
1750 /* NFS v2 LOOKUP, CREATE, MKDIR calls might give us a mapping*/
1751 if( (civ->prog==100003)
1754 &&((civ->proc==4)||(civ->proc==9)||(civ->proc==14))
1756 nfs_name_snoop_add_fh(civ->xid, tvb,
1760 /* MOUNT v1,v2 MNT replies might give us a filehandle*/
1761 if( (civ->prog==100005)
1763 &&((civ->vers==1)||(civ->vers==2))
1766 nfs_name_snoop_add_fh(civ->xid, tvb,
1771 dissect_fhandle_data(tvb, offset, pinfo, ftree, FHSIZE, FALSE);
1777 /* RFC 1094, Page 15 */
1779 dissect_nfs2_fhandle_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
1781 offset = dissect_fhandle(tvb, offset, pinfo, tree, "object");
1787 /* RFC 1094, Page 15 */
1789 dissect_timeval(tvbuff_t *tvb, int offset, proto_tree *tree, int hf_time, int hf_time_sec, int hf_time_usec)
1795 proto_item* time_item;
1796 proto_tree* time_tree = NULL;
1798 seconds = tvb_get_ntohl(tvb, offset+0);
1799 useconds = tvb_get_ntohl(tvb, offset+4);
1801 ts.nsecs = useconds*1000;
1804 time_item = proto_tree_add_time(tree, hf_time, tvb, offset, 8,
1807 time_tree = proto_item_add_subtree(time_item, ett_nfs_timeval);
1811 proto_tree_add_uint(time_tree, hf_time_sec, tvb, offset, 4,
1813 proto_tree_add_uint(time_tree, hf_time_usec, tvb, offset+4, 4,
1821 /* RFC 1094, Page 16 */
1822 static const value_string nfs2_mode_names[] = {
1823 { 0040000, "Directory" },
1824 { 0020000, "Character Special Device" },
1825 { 0060000, "Block Special Device" },
1826 { 0100000, "Regular File" },
1827 { 0120000, "Symbolic Link" },
1828 { 0140000, "Named Socket" },
1833 dissect_mode(tvbuff_t *tvb, int offset, proto_tree *tree, char* name)
1836 proto_item* mode_item = NULL;
1837 proto_tree* mode_tree = NULL;
1839 mode = tvb_get_ntohl(tvb, offset+0);
1842 mode_item = proto_tree_add_text(tree, tvb, offset, 4,
1843 "%s: 0%o", name, mode);
1845 mode_tree = proto_item_add_subtree(mode_item, ett_nfs_mode);
1849 proto_tree_add_text(mode_tree, tvb, offset, 4, "%s",
1850 decode_enumerated_bitfield(mode, 0160000, 16,
1851 nfs2_mode_names, "%s"));
1852 proto_tree_add_text(mode_tree, tvb, offset, 4, "%s",
1853 decode_boolean_bitfield(mode, 04000, 16, "Set user id on exec", "not SUID"));
1854 proto_tree_add_text(mode_tree, tvb, offset, 4, "%s",
1855 decode_boolean_bitfield(mode, 02000, 16, "Set group id on exec", "not SGID"));
1856 proto_tree_add_text(mode_tree, tvb, offset, 4, "%s",
1857 decode_boolean_bitfield(mode, 01000, 16, "Save swapped text even after use", "not save swapped text"));
1858 proto_tree_add_text(mode_tree, tvb, offset, 4, "%s",
1859 decode_boolean_bitfield(mode, 0400, 16, "Read permission for owner", "no Read permission for owner"));
1860 proto_tree_add_text(mode_tree, tvb, offset, 4, "%s",
1861 decode_boolean_bitfield(mode, 0200, 16, "Write permission for owner", "no Write permission for owner"));
1862 proto_tree_add_text(mode_tree, tvb, offset, 4, "%s",
1863 decode_boolean_bitfield(mode, 0100, 16, "Execute permission for owner", "no Execute permission for owner"));
1864 proto_tree_add_text(mode_tree, tvb, offset, 4, "%s",
1865 decode_boolean_bitfield(mode, 040, 16, "Read permission for group", "no Read permission for group"));
1866 proto_tree_add_text(mode_tree, tvb, offset, 4, "%s",
1867 decode_boolean_bitfield(mode, 020, 16, "Write permission for group", "no Write permission for group"));
1868 proto_tree_add_text(mode_tree, tvb, offset, 4, "%s",
1869 decode_boolean_bitfield(mode, 010, 16, "Execute permission for group", "no Execute permission for group"));
1870 proto_tree_add_text(mode_tree, tvb, offset, 4, "%s",
1871 decode_boolean_bitfield(mode, 04, 16, "Read permission for others", "no Read permission for others"));
1872 proto_tree_add_text(mode_tree, tvb, offset, 4, "%s",
1873 decode_boolean_bitfield(mode, 02, 16, "Write permission for others", "no Write permission for others"));
1874 proto_tree_add_text(mode_tree, tvb, offset, 4, "%s",
1875 decode_boolean_bitfield(mode, 01, 16, "Execute permission for others", "no Execute permission for others"));
1883 /* RFC 1094, Page 15 */
1885 dissect_fattr(tvbuff_t *tvb, int offset, proto_tree *tree, char* name)
1887 proto_item* fattr_item = NULL;
1888 proto_tree* fattr_tree = NULL;
1889 int old_offset = offset;
1892 fattr_item = proto_tree_add_text(tree, tvb, offset, -1,
1894 fattr_tree = proto_item_add_subtree(fattr_item, ett_nfs_fattr);
1897 offset = dissect_ftype(tvb, offset, fattr_tree, "type");
1898 offset = dissect_mode(tvb, offset, fattr_tree, "mode");
1899 offset = dissect_rpc_uint32(tvb, fattr_tree, hf_nfs_fattr_nlink, offset);
1900 offset = dissect_rpc_uint32(tvb, fattr_tree, hf_nfs_fattr_uid, offset);
1901 offset = dissect_rpc_uint32(tvb, fattr_tree, hf_nfs_fattr_gid, offset);
1902 offset = dissect_rpc_uint32(tvb, fattr_tree, hf_nfs_fattr_size, offset);
1903 offset = dissect_rpc_uint32(tvb, fattr_tree, hf_nfs_fattr_blocksize, offset);
1904 offset = dissect_rpc_uint32(tvb, fattr_tree, hf_nfs_fattr_rdev, offset);
1905 offset = dissect_rpc_uint32(tvb, fattr_tree, hf_nfs_fattr_blocks, offset);
1906 offset = dissect_rpc_uint32(tvb, fattr_tree, hf_nfs_fattr_fsid, offset);
1907 offset = dissect_rpc_uint32(tvb, fattr_tree, hf_nfs_fattr_fileid, offset);
1909 offset = dissect_timeval(tvb, offset, fattr_tree, hf_nfs_atime, hf_nfs_atime_sec, hf_nfs_atime_usec);
1910 offset = dissect_timeval(tvb, offset, fattr_tree, hf_nfs_mtime, hf_nfs_mtime_sec, hf_nfs_mtime_usec);
1911 offset = dissect_timeval(tvb, offset, fattr_tree, hf_nfs_ctime, hf_nfs_ctime_sec, hf_nfs_ctime_usec);
1913 /* now we know, that fattr is shorter */
1915 proto_item_set_len(fattr_item, offset - old_offset);
1922 /* RFC 1094, Page 17 */
1924 dissect_sattr(tvbuff_t *tvb, int offset, proto_tree *tree, char* name)
1926 proto_item* sattr_item = NULL;
1927 proto_tree* sattr_tree = NULL;
1928 int old_offset = offset;
1931 sattr_item = proto_tree_add_text(tree, tvb, offset, -1,
1933 sattr_tree = proto_item_add_subtree(sattr_item, ett_nfs_sattr);
1936 if (tvb_get_ntohl(tvb, offset+0) != 0xffffffff)
1937 offset = dissect_mode(tvb, offset, sattr_tree, "mode");
1939 proto_tree_add_text(sattr_tree, tvb, offset, 4, "mode: no value");
1943 if (tvb_get_ntohl(tvb, offset+0) != 0xffffffff)
1944 offset = dissect_rpc_uint32(tvb, sattr_tree, hf_nfs_fattr_uid,
1947 proto_tree_add_text(sattr_tree, tvb, offset, 4, "uid: no value");
1951 if (tvb_get_ntohl(tvb, offset+0) != 0xffffffff)
1952 offset = dissect_rpc_uint32(tvb, sattr_tree, hf_nfs_fattr_gid,
1955 proto_tree_add_text(sattr_tree, tvb, offset, 4, "gid: no value");
1959 if (tvb_get_ntohl(tvb, offset+0) != 0xffffffff)
1960 offset = dissect_rpc_uint32(tvb, sattr_tree, hf_nfs_fattr_size,
1963 proto_tree_add_text(sattr_tree, tvb, offset, 4, "size: no value");
1967 if (tvb_get_ntohl(tvb, offset+0) != 0xffffffff) {
1968 offset = dissect_timeval(tvb, offset, sattr_tree, hf_nfs_atime, hf_nfs_atime_sec, hf_nfs_atime_usec);
1970 proto_tree_add_text(sattr_tree, tvb, offset, 8, "atime: no value");
1974 if (tvb_get_ntohl(tvb, offset+0) != 0xffffffff) {
1975 offset = dissect_timeval(tvb, offset, sattr_tree, hf_nfs_mtime, hf_nfs_mtime_sec, hf_nfs_mtime_usec);
1977 proto_tree_add_text(sattr_tree, tvb, offset, 8, "mtime: no value");
1981 /* now we know, that sattr is shorter */
1983 proto_item_set_len(sattr_item, offset - old_offset);
1990 /* RFC 1094, Page 17 */
1992 dissect_filename(tvbuff_t *tvb, int offset,
1993 proto_tree *tree, int hf, char **string_ret)
1995 offset = dissect_rpc_string(tvb, tree, hf, offset, string_ret);
2000 /* RFC 1094, Page 17 */
2002 dissect_path(tvbuff_t *tvb, int offset, proto_tree *tree, int hf)
2004 offset = dissect_rpc_string(tvb, tree, hf, offset, NULL);
2009 /* RFC 1094, Page 17,18 */
2011 dissect_attrstat(tvbuff_t *tvb, int offset, proto_tree *tree)
2015 offset = dissect_stat(tvb, offset, tree, &status);
2018 offset = dissect_fattr(tvb, offset, tree, "attributes");
2029 /* RFC 1094, Page 17,18 */
2031 dissect_nfs2_attrstat_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree* tree)
2033 offset = dissect_attrstat(tvb, offset, tree);
2039 /* RFC 1094, Page 18 */
2041 dissect_diropargs(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, char* name)
2043 proto_item* diropargs_item = NULL;
2044 proto_tree* diropargs_tree = NULL;
2045 int old_offset = offset;
2048 diropargs_item = proto_tree_add_text(tree, tvb, offset, -1,
2050 diropargs_tree = proto_item_add_subtree(diropargs_item, ett_nfs_diropargs);
2053 /* are we snooping fh to filenames ?*/
2054 if((!pinfo->fd->flags.visited) && nfs_file_name_snooping){
2055 /* v2 LOOKUP, CREATE, MKDIR calls might give us a mapping*/
2056 rpc_call_info_value *civ=pinfo->private_data;
2058 if( (civ->prog==100003)
2061 &&((civ->proc==4)||(civ->proc==9)||(civ->proc==14))
2063 nfs_name_snoop_add_name(civ->xid, tvb,
2064 offset+36, tvb_get_ntohl(tvb, offset+32),
2069 offset = dissect_fhandle (tvb,offset,pinfo,diropargs_tree,"dir");
2070 offset = dissect_filename(tvb,offset, diropargs_tree,hf_nfs_name,NULL);
2072 /* now we know, that diropargs is shorter */
2073 if (diropargs_item) {
2074 proto_item_set_len(diropargs_item, offset - old_offset);
2081 /* RFC 1094, Page 18 */
2083 dissect_nfs2_diropargs_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
2085 offset = dissect_diropargs(tvb, offset, pinfo, tree, "where");
2091 /* RFC 1094, Page 18 */
2093 dissect_diropres(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
2097 offset = dissect_stat(tvb, offset, tree, &status);
2100 offset = dissect_fhandle(tvb, offset, pinfo, tree, "file");
2101 offset = dissect_fattr (tvb, offset, tree, "attributes");
2112 /* nfsdata is simply a chunk of RPC opaque data (length, data, fill bytes) */
2114 dissect_nfsdata(tvbuff_t *tvb, int offset, proto_tree *tree, int hf)
2116 offset = dissect_rpc_data(tvb, tree, hf, offset);
2121 /* RFC 1094, Page 18 */
2123 dissect_nfs2_diropres_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
2126 offset = dissect_diropres(tvb, offset, pinfo, tree);
2131 /* RFC 1094, Page 6 */
2133 dissect_nfs2_setattr_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
2136 offset = dissect_fhandle(tvb, offset, pinfo, tree, "file" );
2137 offset = dissect_sattr (tvb, offset, tree, "attributes");
2143 /* RFC 1094, Page 6 */
2145 dissect_nfs2_readlink_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
2150 offset = dissect_stat(tvb, offset, tree, &status);
2153 offset = dissect_path(tvb, offset, tree, hf_nfs_readlink_data);
2164 /* RFC 1094, Page 7 */
2166 dissect_nfs2_read_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
2169 guint32 offset_value;
2173 offset = dissect_fhandle(tvb, offset, pinfo, tree, "file" );
2174 offset_value = tvb_get_ntohl(tvb, offset+0);
2175 count = tvb_get_ntohl(tvb, offset+4);
2176 totalcount = tvb_get_ntohl(tvb, offset+8);
2178 proto_tree_add_uint(tree, hf_nfs_read_offset, tvb,
2179 offset+0, 4, offset_value);
2180 proto_tree_add_uint(tree, hf_nfs_read_count, tvb,
2181 offset+4, 4, count);
2182 proto_tree_add_uint(tree, hf_nfs_read_totalcount, tvb,
2183 offset+8, 4, totalcount);
2191 /* RFC 1094, Page 7 */
2193 dissect_nfs2_read_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
2198 offset = dissect_stat(tvb, offset, tree, &status);
2201 offset = dissect_fattr(tvb, offset, tree, "attributes");
2202 offset = dissect_nfsdata(tvb, offset, tree, hf_nfs_data);
2213 /* RFC 1094, Page 8 */
2215 dissect_nfs2_write_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
2218 guint32 beginoffset;
2219 guint32 offset_value;
2222 offset = dissect_fhandle(tvb, offset, pinfo, tree, "file" );
2223 beginoffset = tvb_get_ntohl(tvb, offset+0);
2224 offset_value = tvb_get_ntohl(tvb, offset+4);
2225 totalcount = tvb_get_ntohl(tvb, offset+8);
2227 proto_tree_add_uint(tree, hf_nfs_write_beginoffset, tvb,
2228 offset+0, 4, beginoffset);
2229 proto_tree_add_uint(tree, hf_nfs_write_offset, tvb,
2230 offset+4, 4, offset_value);
2231 proto_tree_add_uint(tree, hf_nfs_write_totalcount, tvb,
2232 offset+8, 4, totalcount);
2236 offset = dissect_nfsdata(tvb, offset, tree, hf_nfs_data);
2242 /* RFC 1094, Page 8 */
2244 dissect_nfs2_createargs_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
2247 offset = dissect_diropargs(tvb, offset, pinfo, tree, "where" );
2248 offset = dissect_sattr (tvb, offset, tree, "attributes");
2254 /* RFC 1094, Page 9 */
2256 dissect_nfs2_rename_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
2259 offset = dissect_diropargs(tvb, offset, pinfo, tree, "from");
2260 offset = dissect_diropargs(tvb, offset, pinfo, tree, "to" );
2266 /* RFC 1094, Page 9 */
2268 dissect_nfs2_link_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
2271 offset = dissect_fhandle (tvb, offset, pinfo, tree, "from");
2272 offset = dissect_diropargs(tvb, offset, pinfo, tree, "to" );
2278 /* RFC 1094, Page 10 */
2280 dissect_nfs2_symlink_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
2283 offset = dissect_diropargs(tvb, offset, pinfo, tree, "from" );
2284 offset = dissect_path (tvb, offset, tree, hf_nfs_symlink_to);
2285 offset = dissect_sattr (tvb, offset, tree, "attributes" );
2291 /* RFC 1094, Page 11 */
2293 dissect_nfs2_readdir_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
2299 offset = dissect_fhandle (tvb, offset, pinfo, tree, "dir");
2300 cookie = tvb_get_ntohl(tvb, offset+ 0);
2301 count = tvb_get_ntohl(tvb, offset+ 4);
2303 proto_tree_add_uint(tree, hf_nfs_readdir_cookie, tvb,
2304 offset+ 0, 4, cookie);
2305 proto_tree_add_uint(tree, hf_nfs_readdir_count, tvb,
2306 offset+ 4, 4, count);
2314 /* RFC 1094, Page 11 */
2316 dissect_readdir_entry(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
2319 proto_item* entry_item = NULL;
2320 proto_tree* entry_tree = NULL;
2321 int old_offset = offset;
2327 entry_item = proto_tree_add_item(tree, hf_nfs_readdir_entry, tvb,
2328 offset+0, -1, FALSE);
2329 entry_tree = proto_item_add_subtree(entry_item, ett_nfs_readdir_entry);
2332 fileid = tvb_get_ntohl(tvb, offset + 0);
2334 proto_tree_add_uint(entry_tree, hf_nfs_readdir_entry_fileid, tvb,
2335 offset+0, 4, fileid);
2338 offset = dissect_filename(tvb, offset, entry_tree,
2339 hf_nfs_readdir_entry_name, &name);
2341 proto_item_set_text(entry_item, "Entry: file ID %u, name %s",
2345 cookie = tvb_get_ntohl(tvb, offset + 0);
2347 proto_tree_add_uint(entry_tree, hf_nfs_readdir_entry_cookie, tvb,
2348 offset+0, 4, cookie);
2351 /* now we know, that a readdir entry is shorter */
2353 proto_item_set_len(entry_item, offset - old_offset);
2359 /* RFC 1094, Page 11 */
2361 dissect_nfs2_readdir_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
2367 offset = dissect_stat(tvb, offset, tree, &status);
2370 offset = dissect_rpc_list(tvb, pinfo, tree, offset,
2371 dissect_readdir_entry);
2372 eof_value = tvb_get_ntohl(tvb, offset+0);
2374 proto_tree_add_uint(tree, hf_nfs_readdir_eof, tvb,
2375 offset+ 0, 4, eof_value);
2387 /* RFC 1094, Page 12 */
2389 dissect_nfs2_statfs_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
2399 offset = dissect_stat(tvb, offset, tree, &status);
2402 tsize = tvb_get_ntohl(tvb, offset+ 0);
2403 bsize = tvb_get_ntohl(tvb, offset+ 4);
2404 blocks = tvb_get_ntohl(tvb, offset+ 8);
2405 bfree = tvb_get_ntohl(tvb, offset+12);
2406 bavail = tvb_get_ntohl(tvb, offset+16);
2408 proto_tree_add_uint(tree, hf_nfs_statfs_tsize, tvb,
2409 offset+ 0, 4, tsize);
2410 proto_tree_add_uint(tree, hf_nfs_statfs_bsize, tvb,
2411 offset+ 4, 4, bsize);
2412 proto_tree_add_uint(tree, hf_nfs_statfs_blocks, tvb,
2413 offset+ 8, 4, blocks);
2414 proto_tree_add_uint(tree, hf_nfs_statfs_bfree, tvb,
2415 offset+12, 4, bfree);
2416 proto_tree_add_uint(tree, hf_nfs_statfs_bavail, tvb,
2417 offset+16, 4, bavail);
2430 /* proc number, "proc name", dissect_request, dissect_reply */
2431 /* NULL as function pointer means: type of arguments is "void". */
2432 static const vsff nfs2_proc[] = {
2433 { 0, "NULL", /* OK */
2435 { 1, "GETATTR", /* OK */
2436 dissect_nfs2_fhandle_call, dissect_nfs2_attrstat_reply },
2437 { 2, "SETATTR", /* OK */
2438 dissect_nfs2_setattr_call, dissect_nfs2_attrstat_reply },
2439 { 3, "ROOT", /* OK */
2441 { 4, "LOOKUP", /* OK */
2442 dissect_nfs2_diropargs_call, dissect_nfs2_diropres_reply },
2443 { 5, "READLINK", /* OK */
2444 dissect_nfs2_fhandle_call, dissect_nfs2_readlink_reply },
2445 { 6, "READ", /* OK */
2446 dissect_nfs2_read_call, dissect_nfs2_read_reply },
2447 { 7, "WRITECACHE", /* OK */
2449 { 8, "WRITE", /* OK */
2450 dissect_nfs2_write_call, dissect_nfs2_attrstat_reply },
2451 { 9, "CREATE", /* OK */
2452 dissect_nfs2_createargs_call, dissect_nfs2_diropres_reply },
2453 { 10, "REMOVE", /* OK */
2454 dissect_nfs2_diropargs_call, dissect_nfs2_stat_reply },
2455 { 11, "RENAME", /* OK */
2456 dissect_nfs2_rename_call, dissect_nfs2_stat_reply },
2457 { 12, "LINK", /* OK */
2458 dissect_nfs2_link_call, dissect_nfs2_stat_reply },
2459 { 13, "SYMLINK", /* OK */
2460 dissect_nfs2_symlink_call, dissect_nfs2_stat_reply },
2461 { 14, "MKDIR", /* OK */
2462 dissect_nfs2_createargs_call, dissect_nfs2_diropres_reply },
2463 { 15, "RMDIR", /* OK */
2464 dissect_nfs2_diropargs_call, dissect_nfs2_stat_reply },
2465 { 16, "READDIR", /* OK */
2466 dissect_nfs2_readdir_call, dissect_nfs2_readdir_reply },
2467 { 17, "STATFS", /* OK */
2468 dissect_nfs2_fhandle_call, dissect_nfs2_statfs_reply },
2469 { 0,NULL,NULL,NULL }
2471 /* end of NFS Version 2 */
2474 /***************************/
2475 /* NFS Version 3, RFC 1813 */
2476 /***************************/
2479 /* RFC 1813, Page 15 */
2481 dissect_filename3(tvbuff_t *tvb, int offset,
2482 proto_tree *tree, int hf, char **string_ret)
2484 offset = dissect_rpc_string(tvb, tree, hf, offset, string_ret);
2489 /* RFC 1813, Page 15 */
2491 dissect_nfspath3(tvbuff_t *tvb, int offset, proto_tree *tree, int hf)
2493 offset = dissect_rpc_string(tvb, tree, hf, offset, NULL);
2497 /* RFC 1813, Page 15 */
2499 dissect_cookieverf3(tvbuff_t *tvb, int offset, proto_tree *tree)
2501 proto_tree_add_text(tree, tvb, offset, NFS3_COOKIEVERFSIZE,
2502 "Verifier: Opaque Data");
2503 offset += NFS3_COOKIEVERFSIZE;
2508 /* RFC 1813, Page 16 */
2510 dissect_createverf3(tvbuff_t *tvb, int offset, proto_tree *tree)
2512 proto_tree_add_text(tree, tvb, offset, NFS3_CREATEVERFSIZE,
2513 "Verifier: Opaque Data");
2514 offset += NFS3_CREATEVERFSIZE;
2519 /* RFC 1813, Page 16 */
2521 dissect_writeverf3(tvbuff_t *tvb, int offset, proto_tree *tree)
2523 proto_tree_add_text(tree, tvb, offset, NFS3_WRITEVERFSIZE,
2524 "Verifier: Opaque Data");
2525 offset += NFS3_WRITEVERFSIZE;
2529 /* RFC 1813, Page 16 */
2531 dissect_mode3(tvbuff_t *tvb, int offset, proto_tree *tree, char* name)
2534 proto_item* mode3_item = NULL;
2535 proto_tree* mode3_tree = NULL;
2537 mode3 = tvb_get_ntohl(tvb, offset+0);
2540 mode3_item = proto_tree_add_text(tree, tvb, offset, 4,
2541 "%s: 0%o", name, mode3);
2543 mode3_tree = proto_item_add_subtree(mode3_item, ett_nfs_mode3);
2546 /* RFC 1813, Page 23 */
2548 proto_tree_add_text(mode3_tree, tvb, offset, 4, "%s",
2549 decode_boolean_bitfield(mode3, 0x800, 12, "Set user id on exec", "not SUID"));
2550 proto_tree_add_text(mode3_tree, tvb, offset, 4, "%s",
2551 decode_boolean_bitfield(mode3, 0x400, 12, "Set group id on exec", "not SGID"));
2552 proto_tree_add_text(mode3_tree, tvb, offset, 4, "%s",
2553 decode_boolean_bitfield(mode3, 0x200, 12, "Save swapped text even after use", "not save swapped text"));
2554 proto_tree_add_text(mode3_tree, tvb, offset, 4, "%s",
2555 decode_boolean_bitfield(mode3, 0x100, 12, "Read permission for owner", "no Read permission for owner"));
2556 proto_tree_add_text(mode3_tree, tvb, offset, 4, "%s",
2557 decode_boolean_bitfield(mode3, 0x80, 12, "Write permission for owner", "no Write permission for owner"));
2558 proto_tree_add_text(mode3_tree, tvb, offset, 4, "%s",
2559 decode_boolean_bitfield(mode3, 0x40, 12, "Execute permission for owner", "no Execute permission for owner"));
2560 proto_tree_add_text(mode3_tree, tvb, offset, 4, "%s",
2561 decode_boolean_bitfield(mode3, 0x20, 12, "Read permission for group", "no Read permission for group"));
2562 proto_tree_add_text(mode3_tree, tvb, offset, 4, "%s",
2563 decode_boolean_bitfield(mode3, 0x10, 12, "Write permission for group", "no Write permission for group"));
2564 proto_tree_add_text(mode3_tree, tvb, offset, 4, "%s",
2565 decode_boolean_bitfield(mode3, 0x8, 12, "Execute permission for group", "no Execute permission for group"));
2566 proto_tree_add_text(mode3_tree, tvb, offset, 4, "%s",
2567 decode_boolean_bitfield(mode3, 0x4, 12, "Read permission for others", "no Read permission for others"));
2568 proto_tree_add_text(mode3_tree, tvb, offset, 4, "%s",
2569 decode_boolean_bitfield(mode3, 0x2, 12, "Write permission for others", "no Write permission for others"));
2570 proto_tree_add_text(mode3_tree, tvb, offset, 4, "%s",
2571 decode_boolean_bitfield(mode3, 0x1, 12, "Execute permission for others", "no Execute permission for others"));
2578 /* RFC 1813, Page 16,17 */
2579 static const value_string names_nfs_nfsstat3[] =
2586 { 13, "ERR_ACCES" },
2587 { 17, "ERR_EXIST" },
2589 { 19, "ERR_NODEV" },
2590 { 20, "ERR_NOTDIR" },
2591 { 21, "ERR_ISDIR" },
2592 { 22, "ERR_INVAL" },
2594 { 28, "ERR_NOSPC" },
2596 { 31, "ERR_MLINK" },
2597 { 63, "ERR_NAMETOOLONG" },
2598 { 66, "ERR_NOTEMPTY" },
2599 { 69, "ERR_DQUOT" },
2600 { 70, "ERR_STALE" },
2601 { 71, "ERR_REMOTE" },
2602 { 10001, "ERR_BADHANDLE" },
2603 { 10002, "ERR_NOT_SYNC" },
2604 { 10003, "ERR_BAD_COOKIE" },
2605 { 10004, "ERR_NOTSUPP" },
2606 { 10005, "ERR_TOOSMALL" },
2607 { 10006, "ERR_SERVERFAULT" },
2608 { 10007, "ERR_BADTYPE" },
2609 { 10008, "ERR_JUKEBOX" },
2614 /* RFC 1813, Page 16 */
2616 dissect_nfsstat3(tvbuff_t *tvb, int offset,
2617 proto_tree *tree,guint32 *status)
2621 nfsstat3 = tvb_get_ntohl(tvb, offset+0);
2624 proto_tree_add_uint(tree, hf_nfs_nfsstat3, tvb,
2625 offset, 4, nfsstat3);
2634 static const value_string names_nfs_ftype3[] =
2636 { NF3REG, "Regular File" },
2637 { NF3DIR, "Directory" },
2638 { NF3BLK, "Block Special Device" },
2639 { NF3CHR, "Character Special Device" },
2640 { NF3LNK, "Symbolic Link" },
2641 { NF3SOCK,"Socket" },
2642 { NF3FIFO,"Named Pipe" },
2647 /* RFC 1813, Page 20 */
2649 dissect_ftype3(tvbuff_t *tvb, int offset, proto_tree *tree,
2650 int hf, guint32* ftype3)
2654 type = tvb_get_ntohl(tvb, offset+0);
2657 proto_tree_add_uint(tree, hf, tvb, offset, 4, type);
2666 /* RFC 1813, Page 20 */
2668 dissect_specdata3(tvbuff_t *tvb, int offset, proto_tree *tree, char* name)
2673 proto_item* specdata3_item;
2674 proto_tree* specdata3_tree = NULL;
2676 specdata1 = tvb_get_ntohl(tvb, offset+0);
2677 specdata2 = tvb_get_ntohl(tvb, offset+4);
2680 specdata3_item = proto_tree_add_text(tree, tvb, offset, 8,
2681 "%s: %u,%u", name, specdata1, specdata2);
2683 specdata3_tree = proto_item_add_subtree(specdata3_item,
2687 if (specdata3_tree) {
2688 proto_tree_add_text(specdata3_tree, tvb,offset+0,4,
2689 "specdata1: %u", specdata1);
2690 proto_tree_add_text(specdata3_tree, tvb,offset+4,4,
2691 "specdata2: %u", specdata2);
2699 /* RFC 1813, Page 21 */
2701 dissect_nfs_fh3(tvbuff_t *tvb, int offset, packet_info *pinfo,
2702 proto_tree *tree, char *name)
2707 proto_item* fitem = NULL;
2708 proto_tree* ftree = NULL;
2709 int fh_offset,fh_length;
2711 fh3_len = tvb_get_ntohl(tvb, offset+0);
2712 fh3_len_full = rpc_roundup(fh3_len);
2713 fh3_fill = fh3_len_full - fh3_len;
2716 fitem = proto_tree_add_text(tree, tvb, offset, 4+fh3_len_full,
2719 ftree = proto_item_add_subtree(fitem, ett_nfs_fh3);
2722 /* are we snooping fh to filenames ?*/
2723 if((!pinfo->fd->flags.visited) && nfs_file_name_snooping){
2724 rpc_call_info_value *civ=pinfo->private_data;
2726 /* NFS v3 LOOKUP, CREATE, MKDIR calls might give us a mapping*/
2727 if( (civ->prog==100003)
2730 &&((civ->proc==3)||(civ->proc==8)||(civ->proc==9))
2732 fh_length=tvb_get_ntohl(tvb, offset);
2734 nfs_name_snoop_add_fh(civ->xid, tvb,
2735 fh_offset, fh_length);
2738 /* MOUNT v3 MNT replies might give us a filehandle */
2739 if( (civ->prog==100005)
2744 fh_length=tvb_get_ntohl(tvb, offset);
2746 nfs_name_snoop_add_fh(civ->xid, tvb,
2747 fh_offset, fh_length);
2751 proto_tree_add_uint(ftree, hf_nfs_fh_length, tvb, offset+0, 4,
2753 dissect_fhandle_data(tvb, offset+4, pinfo, ftree, fh3_len, FALSE);
2755 offset += 4 + fh3_len_full;
2760 /* RFC 1813, Page 21 */
2762 dissect_nfstime3(tvbuff_t *tvb, int offset,
2763 proto_tree *tree, int hf_time, int hf_time_sec, int hf_time_nsec)
2769 proto_item* time_item;
2770 proto_tree* time_tree = NULL;
2772 seconds = tvb_get_ntohl(tvb, offset+0);
2773 nseconds = tvb_get_ntohl(tvb, offset+4);
2775 ts.nsecs = nseconds;
2778 time_item = proto_tree_add_time(tree, hf_time, tvb, offset, 8,
2781 time_tree = proto_item_add_subtree(time_item, ett_nfs_nfstime3);
2785 proto_tree_add_uint(time_tree, hf_time_sec, tvb, offset, 4,
2787 proto_tree_add_uint(time_tree, hf_time_nsec, tvb, offset+4, 4,
2795 /* RFC 1813, Page 22 */
2797 dissect_fattr3(tvbuff_t *tvb, int offset, proto_tree *tree, char* name)
2799 proto_item* fattr3_item = NULL;
2800 proto_tree* fattr3_tree = NULL;
2801 int old_offset = offset;
2805 fattr3_item = proto_tree_add_text(tree, tvb, offset, -1,
2807 fattr3_tree = proto_item_add_subtree(fattr3_item, ett_nfs_fattr3);
2810 offset = dissect_ftype3(tvb,offset,fattr3_tree,hf_nfs_fattr3_type,&type);
2811 offset = dissect_mode3(tvb,offset,fattr3_tree,"mode");
2812 offset = dissect_rpc_uint32(tvb, fattr3_tree, hf_nfs_fattr3_nlink,
2814 offset = dissect_rpc_uint32(tvb, fattr3_tree, hf_nfs_fattr3_uid,
2816 offset = dissect_rpc_uint32(tvb, fattr3_tree, hf_nfs_fattr3_gid,
2818 offset = dissect_rpc_uint64(tvb, fattr3_tree, hf_nfs_fattr3_size,
2820 offset = dissect_rpc_uint64(tvb, fattr3_tree, hf_nfs_fattr3_used,
2822 offset = dissect_specdata3(tvb,offset,fattr3_tree,"rdev");
2823 offset = dissect_rpc_uint64(tvb, fattr3_tree, hf_nfs_fattr3_fsid,
2825 offset = dissect_rpc_uint64(tvb, fattr3_tree, hf_nfs_fattr3_fileid,
2827 offset = dissect_nfstime3 (tvb,offset,fattr3_tree,hf_nfs_atime,hf_nfs_atime_sec,hf_nfs_atime_nsec);
2828 offset = dissect_nfstime3 (tvb,offset,fattr3_tree,hf_nfs_mtime,hf_nfs_mtime_sec,hf_nfs_mtime_nsec);
2829 offset = dissect_nfstime3 (tvb,offset,fattr3_tree,hf_nfs_ctime,hf_nfs_ctime_sec,hf_nfs_ctime_nsec);
2831 /* now we know, that fattr3 is shorter */
2833 proto_item_set_len(fattr3_item, offset - old_offset);
2840 static const value_string value_follows[] =
2843 { 1, "value follows"},
2848 /* RFC 1813, Page 23 */
2850 dissect_post_op_attr(tvbuff_t *tvb, int offset, proto_tree *tree, char* name)
2852 proto_item* post_op_attr_item = NULL;
2853 proto_tree* post_op_attr_tree = NULL;
2854 int old_offset = offset;
2855 guint32 attributes_follow;
2858 post_op_attr_item = proto_tree_add_text(tree, tvb, offset, -1,
2860 post_op_attr_tree = proto_item_add_subtree(post_op_attr_item,
2861 ett_nfs_post_op_attr);
2864 attributes_follow = tvb_get_ntohl(tvb, offset+0);
2865 proto_tree_add_text(post_op_attr_tree, tvb, offset, 4,
2866 "attributes_follow: %s (%u)",
2867 val_to_str(attributes_follow,value_follows,"Unknown"), attributes_follow);
2869 switch (attributes_follow) {
2871 offset = dissect_fattr3(tvb, offset, post_op_attr_tree,
2879 /* now we know, that post_op_attr_tree is shorter */
2880 if (post_op_attr_item) {
2881 proto_item_set_len(post_op_attr_item, offset - old_offset);
2888 /* RFC 1813, Page 24 */
2890 dissect_wcc_attr(tvbuff_t *tvb, int offset, proto_tree *tree, char* name)
2892 proto_item* wcc_attr_item = NULL;
2893 proto_tree* wcc_attr_tree = NULL;
2894 int old_offset = offset;
2897 wcc_attr_item = proto_tree_add_text(tree, tvb, offset, -1,
2899 wcc_attr_tree = proto_item_add_subtree(wcc_attr_item,
2903 offset = dissect_rpc_uint64(tvb, wcc_attr_tree, hf_nfs_wcc_attr_size,
2905 offset = dissect_nfstime3(tvb, offset, wcc_attr_tree, hf_nfs_mtime, hf_nfs_mtime_sec, hf_nfs_mtime_nsec);
2906 offset = dissect_nfstime3(tvb, offset, wcc_attr_tree, hf_nfs_ctime, hf_nfs_ctime_sec, hf_nfs_ctime_nsec);
2907 /* now we know, that wcc_attr_tree is shorter */
2908 if (wcc_attr_item) {
2909 proto_item_set_len(wcc_attr_item, offset - old_offset);
2916 /* RFC 1813, Page 24 */
2918 dissect_pre_op_attr(tvbuff_t *tvb, int offset, proto_tree *tree, char* name)
2920 proto_item* pre_op_attr_item = NULL;
2921 proto_tree* pre_op_attr_tree = NULL;
2922 int old_offset = offset;
2923 guint32 attributes_follow;
2926 pre_op_attr_item = proto_tree_add_text(tree, tvb, offset, -1,
2928 pre_op_attr_tree = proto_item_add_subtree(pre_op_attr_item,
2929 ett_nfs_pre_op_attr);
2932 attributes_follow = tvb_get_ntohl(tvb, offset+0);
2933 proto_tree_add_text(pre_op_attr_tree, tvb, offset, 4,
2934 "attributes_follow: %s (%u)",
2935 val_to_str(attributes_follow,value_follows,"Unknown"), attributes_follow);
2937 switch (attributes_follow) {
2939 offset = dissect_wcc_attr(tvb, offset, pre_op_attr_tree,
2947 /* now we know, that pre_op_attr_tree is shorter */
2948 if (pre_op_attr_item) {
2949 proto_item_set_len(pre_op_attr_item, offset - old_offset);
2956 /* RFC 1813, Page 24 */
2958 dissect_wcc_data(tvbuff_t *tvb, int offset, proto_tree *tree, char* name)
2960 proto_item* wcc_data_item = NULL;
2961 proto_tree* wcc_data_tree = NULL;
2962 int old_offset = offset;
2965 wcc_data_item = proto_tree_add_text(tree, tvb, offset, -1,
2967 wcc_data_tree = proto_item_add_subtree(wcc_data_item,
2971 offset = dissect_pre_op_attr (tvb, offset, wcc_data_tree, "before");
2972 offset = dissect_post_op_attr(tvb, offset, wcc_data_tree, "after" );
2974 /* now we know, that wcc_data is shorter */
2975 if (wcc_data_item) {
2976 proto_item_set_len(wcc_data_item, offset - old_offset);
2983 /* RFC 1813, Page 25 */
2985 dissect_post_op_fh3(tvbuff_t *tvb, int offset, packet_info *pinfo,
2986 proto_tree *tree, char* name)
2988 proto_item* post_op_fh3_item = NULL;
2989 proto_tree* post_op_fh3_tree = NULL;
2990 int old_offset = offset;
2991 guint32 handle_follows;
2994 post_op_fh3_item = proto_tree_add_text(tree, tvb, offset, -1,
2996 post_op_fh3_tree = proto_item_add_subtree(post_op_fh3_item,
2997 ett_nfs_post_op_fh3);
3000 handle_follows = tvb_get_ntohl(tvb, offset+0);
3001 proto_tree_add_text(post_op_fh3_tree, tvb, offset, 4,
3002 "handle_follows: %s (%u)",
3003 val_to_str(handle_follows,value_follows,"Unknown"), handle_follows);
3005 switch (handle_follows) {
3007 offset = dissect_nfs_fh3(tvb, offset, pinfo, post_op_fh3_tree,
3015 /* now we know, that post_op_fh3_tree is shorter */
3016 if (post_op_fh3_item) {
3017 proto_item_set_len(post_op_fh3_item, offset - old_offset);
3024 /* RFC 1813, Page 25 */
3026 dissect_set_mode3(tvbuff_t *tvb, int offset, proto_tree *tree, char* name)
3028 proto_item* set_mode3_item = NULL;
3029 proto_tree* set_mode3_tree = NULL;
3030 int old_offset = offset;
3034 set_it = tvb_get_ntohl(tvb, offset+0);
3035 set_it_name = val_to_str(set_it,value_follows,"Unknown");
3038 set_mode3_item = proto_tree_add_text(tree, tvb, offset, -1,
3039 "%s: %s", name, set_it_name);
3040 set_mode3_tree = proto_item_add_subtree(set_mode3_item,
3045 proto_tree_add_text(set_mode3_tree, tvb, offset, 4,
3046 "set_it: %s (%u)", set_it_name, set_it);
3052 offset = dissect_mode3(tvb, offset, set_mode3_tree,
3060 /* now we know, that set_mode3 is shorter */
3061 if (set_mode3_item) {
3062 proto_item_set_len(set_mode3_item, offset - old_offset);
3069 /* RFC 1813, Page 26 */
3071 dissect_set_uid3(tvbuff_t *tvb, int offset, proto_tree *tree, char* name)
3073 proto_item* set_uid3_item = NULL;
3074 proto_tree* set_uid3_tree = NULL;
3075 int old_offset = offset;
3079 set_it = tvb_get_ntohl(tvb, offset+0);
3080 set_it_name = val_to_str(set_it,value_follows,"Unknown");
3083 set_uid3_item = proto_tree_add_text(tree, tvb, offset, -1,
3084 "%s: %s", name, set_it_name);
3085 set_uid3_tree = proto_item_add_subtree(set_uid3_item,
3090 proto_tree_add_text(set_uid3_tree, tvb, offset, 4,
3091 "set_it: %s (%u)", set_it_name, set_it);
3097 offset = dissect_rpc_uint32(tvb, set_uid3_tree,
3098 hf_nfs_uid3, offset);
3105 /* now we know, that set_uid3 is shorter */
3106 if (set_uid3_item) {
3107 proto_item_set_len(set_uid3_item, offset - old_offset);
3114 /* RFC 1813, Page 26 */
3116 dissect_set_gid3(tvbuff_t *tvb, int offset, proto_tree *tree, char* name)
3118 proto_item* set_gid3_item = NULL;
3119 proto_tree* set_gid3_tree = NULL;
3120 int old_offset = offset;
3124 set_it = tvb_get_ntohl(tvb, offset+0);
3125 set_it_name = val_to_str(set_it,value_follows,"Unknown");
3128 set_gid3_item = proto_tree_add_text(tree, tvb, offset, -1,
3129 "%s: %s", name, set_it_name);
3130 set_gid3_tree = proto_item_add_subtree(set_gid3_item,
3135 proto_tree_add_text(set_gid3_tree, tvb, offset, 4,
3136 "set_it: %s (%u)", set_it_name, set_it);
3142 offset = dissect_rpc_uint32(tvb, set_gid3_tree,
3143 hf_nfs_gid3, offset);
3150 /* now we know, that set_gid3 is shorter */
3151 if (set_gid3_item) {
3152 proto_item_set_len(set_gid3_item, offset - old_offset);
3159 /* RFC 1813, Page 26 */
3161 dissect_set_size3(tvbuff_t *tvb, int offset, proto_tree *tree, char* name)
3163 proto_item* set_size3_item = NULL;
3164 proto_tree* set_size3_tree = NULL;
3165 int old_offset = offset;
3169 set_it = tvb_get_ntohl(tvb, offset+0);
3170 set_it_name = val_to_str(set_it,value_follows,"Unknown");
3173 set_size3_item = proto_tree_add_text(tree, tvb, offset, -1,
3174 "%s: %s", name, set_it_name);
3175 set_size3_tree = proto_item_add_subtree(set_size3_item,
3180 proto_tree_add_text(set_size3_tree, tvb, offset, 4,
3181 "set_it: %s (%u)", set_it_name, set_it);
3187 offset = dissect_rpc_uint64(tvb, set_size3_tree,
3188 hf_nfs_set_size3_size, offset);
3195 /* now we know, that set_size3 is shorter */
3196 if (set_size3_item) {
3197 proto_item_set_len(set_size3_item, offset - old_offset);
3204 /* RFC 1813, Page 25 */
3205 #define DONT_CHANGE 0
3206 #define SET_TO_SERVER_TIME 1
3207 #define SET_TO_CLIENT_TIME 2
3209 static const value_string time_how[] =
3211 { DONT_CHANGE, "don't change" },
3212 { SET_TO_SERVER_TIME, "set to server time" },
3213 { SET_TO_CLIENT_TIME, "set to client time" },
3218 /* RFC 1813, Page 26 */
3220 dissect_set_atime(tvbuff_t *tvb, int offset, proto_tree *tree, char* name)
3222 proto_item* set_atime_item = NULL;
3223 proto_tree* set_atime_tree = NULL;
3224 int old_offset = offset;
3228 set_it = tvb_get_ntohl(tvb, offset+0);
3229 set_it_name = val_to_str(set_it,time_how,"Unknown");
3232 set_atime_item = proto_tree_add_text(tree, tvb, offset, -1,
3233 "%s: %s", name, set_it_name);
3234 set_atime_tree = proto_item_add_subtree(set_atime_item,
3239 proto_tree_add_text(set_atime_tree, tvb, offset, 4,
3240 "set_it: %s (%u)", set_it_name, set_it);
3245 case SET_TO_CLIENT_TIME:
3246 if (set_atime_item) {
3247 offset = dissect_nfstime3(tvb, offset, set_atime_tree,
3248 hf_nfs_atime, hf_nfs_atime_sec, hf_nfs_atime_nsec);
3256 /* now we know, that set_atime is shorter */
3257 if (set_atime_item) {
3258 proto_item_set_len(set_atime_item, offset - old_offset);
3265 /* RFC 1813, Page 26 */
3267 dissect_set_mtime(tvbuff_t *tvb, int offset, proto_tree *tree, char* name)
3269 proto_item* set_mtime_item = NULL;
3270 proto_tree* set_mtime_tree = NULL;
3271 int old_offset = offset;
3275 set_it = tvb_get_ntohl(tvb, offset+0);
3276 set_it_name = val_to_str(set_it,time_how,"Unknown");
3279 set_mtime_item = proto_tree_add_text(tree, tvb, offset, -1,
3280 "%s: %s", name, set_it_name);
3281 set_mtime_tree = proto_item_add_subtree(set_mtime_item,
3286 proto_tree_add_text(set_mtime_tree, tvb, offset, 4,
3287 "set_it: %s (%u)", set_it_name, set_it);
3292 case SET_TO_CLIENT_TIME:
3293 if (set_mtime_item) {
3294 offset = dissect_nfstime3(tvb, offset, set_mtime_tree,
3295 hf_nfs_atime, hf_nfs_atime_sec, hf_nfs_atime_nsec);
3303 /* now we know, that set_mtime is shorter */
3304 if (set_mtime_item) {
3305 proto_item_set_len(set_mtime_item, offset - old_offset);
3312 /* RFC 1813, Page 25..27 */
3314 dissect_sattr3(tvbuff_t *tvb, int offset, proto_tree *tree, char* name)
3316 proto_item* sattr3_item = NULL;
3317 proto_tree* sattr3_tree = NULL;
3318 int old_offset = offset;
3321 sattr3_item = proto_tree_add_text(tree, tvb, offset, -1,
3323 sattr3_tree = proto_item_add_subtree(sattr3_item, ett_nfs_sattr3);
3326 offset = dissect_set_mode3(tvb, offset, sattr3_tree, "mode");
3327 offset = dissect_set_uid3 (tvb, offset, sattr3_tree, "uid");
3328 offset = dissect_set_gid3 (tvb, offset, sattr3_tree, "gid");
3329 offset = dissect_set_size3(tvb, offset, sattr3_tree, "size");
3330 offset = dissect_set_atime(tvb, offset, sattr3_tree, "atime");
3331 offset = dissect_set_mtime(tvb, offset, sattr3_tree, "mtime");
3333 /* now we know, that sattr3 is shorter */
3335 proto_item_set_len(sattr3_item, offset - old_offset);
3342 /* RFC 1813, Page 27 */
3344 dissect_diropargs3(tvbuff_t *tvb, int offset, packet_info *pinfo,
3345 proto_tree *tree, char* name)
3347 proto_item* diropargs3_item = NULL;
3348 proto_tree* diropargs3_tree = NULL;
3349 int old_offset = offset;
3350 int parent_offset, parent_len;
3351 int name_offset, name_len;
3354 diropargs3_item = proto_tree_add_text(tree, tvb, offset, -1,
3356 diropargs3_tree = proto_item_add_subtree(diropargs3_item,
3357 ett_nfs_diropargs3);
3360 parent_offset=offset+4;
3361 parent_len=tvb_get_ntohl(tvb, offset);
3362 offset = dissect_nfs_fh3(tvb, offset, pinfo, diropargs3_tree, "dir");
3363 name_offset=offset+4;
3364 name_len=tvb_get_ntohl(tvb, offset);
3365 offset = dissect_filename3(tvb, offset, diropargs3_tree,
3368 /* are we snooping fh to filenames ?*/
3369 if((!pinfo->fd->flags.visited) && nfs_file_name_snooping){
3370 /* v3 LOOKUP, CREATE, MKDIR calls might give us a mapping*/
3371 rpc_call_info_value *civ=pinfo->private_data;
3373 if( (civ->prog==100003)
3376 &&((civ->proc==3)||(civ->proc==8)||(civ->proc==9))
3378 nfs_name_snoop_add_name(civ->xid, tvb,
3379 name_offset, name_len,
3380 parent_offset, parent_len, NULL);
3385 /* now we know, that diropargs3 is shorter */
3386 if (diropargs3_item) {
3387 proto_item_set_len(diropargs3_item, offset - old_offset);
3394 /* RFC 1813, Page 27 */
3396 dissect_nfs3_diropargs3_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
3399 offset = dissect_diropargs3(tvb, offset, pinfo, tree, "object");
3405 /* RFC 1813, Page 40 */
3407 dissect_access(tvbuff_t *tvb, int offset, proto_tree *tree,
3411 proto_item* access_item = NULL;
3412 proto_tree* access_tree = NULL;
3414 access = tvb_get_ntohl(tvb, offset+0);
3417 access_item = proto_tree_add_text(tree, tvb, offset, 4,
3418 "%s: 0x%02x", name, access);
3420 access_tree = proto_item_add_subtree(access_item, ett_nfs_access);
3424 proto_tree_add_text(access_tree, tvb, offset, 4, "%s READ",
3425 decode_boolean_bitfield(access, 0x001, 6, "allow", "not allow"));
3426 proto_tree_add_text(access_tree, tvb, offset, 4, "%s LOOKUP",
3427 decode_boolean_bitfield(access, 0x002, 6, "allow", "not allow"));
3428 proto_tree_add_text(access_tree, tvb, offset, 4, "%s MODIFY",
3429 decode_boolean_bitfield(access, 0x004, 6, "allow", "not allow"));
3430 proto_tree_add_text(access_tree, tvb, offset, 4, "%s EXTEND",
3431 decode_boolean_bitfield(access, 0x008, 6, "allow", "not allow"));
3432 proto_tree_add_text(access_tree, tvb, offset, 4, "%s DELETE",
3433 decode_boolean_bitfield(access, 0x010, 6, "allow", "not allow"));
3434 proto_tree_add_text(access_tree, tvb, offset, 4, "%s EXECUTE",
3435 decode_boolean_bitfield(access, 0x020, 6, "allow", "not allow"));
3443 /* NFS3 file handle dissector */
3445 dissect_nfs3_nfs_fh3_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
3448 offset = dissect_nfs_fh3(tvb, offset, pinfo, tree, "object");
3453 /* RFC 1813, Page 32,33 */
3455 dissect_nfs3_getattr_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
3458 offset = dissect_nfs_fh3(tvb, offset, pinfo, tree, "object");
3463 /* RFC 1813, Page 32,33 */
3465 dissect_nfs3_getattr_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
3470 offset = dissect_nfsstat3(tvb, offset, tree, &status);
3473 offset = dissect_fattr3(tvb, offset, tree, "obj_attributes");
3484 /* RFC 1813, Page 33 */
3486 dissect_sattrguard3(tvbuff_t *tvb, int offset, proto_tree* tree, char *name)
3488 proto_item* sattrguard3_item = NULL;
3489 proto_tree* sattrguard3_tree = NULL;
3490 int old_offset = offset;
3494 check = tvb_get_ntohl(tvb, offset+0);
3495 check_name = val_to_str(check,value_follows,"Unknown");
3498 sattrguard3_item = proto_tree_add_text(tree, tvb, offset, -1,
3499 "%s: %s", name, check_name);
3500 sattrguard3_tree = proto_item_add_subtree(sattrguard3_item,
3501 ett_nfs_sattrguard3);
3504 if (sattrguard3_tree)
3505 proto_tree_add_text(sattrguard3_tree, tvb, offset, 4,
3506 "check: %s (%u)", check_name, check);
3512 offset = dissect_nfstime3(tvb, offset, sattrguard3_tree,
3513 hf_nfs_ctime, hf_nfs_ctime_sec, hf_nfs_ctime_nsec);
3520 /* now we know, that sattrguard3 is shorter */
3521 if (sattrguard3_item) {
3522 proto_item_set_len(sattrguard3_item, offset - old_offset);
3529 /* RFC 1813, Page 33..36 */
3531 dissect_nfs3_setattr_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
3534 offset = dissect_nfs_fh3 (tvb, offset, pinfo, tree, "object");
3535 offset = dissect_sattr3 (tvb, offset, tree, "new_attributes");
3536 offset = dissect_sattrguard3(tvb, offset, tree, "guard");
3541 /* RFC 1813, Page 33..36 */
3543 dissect_nfs3_setattr_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
3548 offset = dissect_nfsstat3(tvb, offset, tree, &status);
3551 offset = dissect_wcc_data(tvb, offset, tree, "obj_wcc");
3554 offset = dissect_wcc_data(tvb, offset, tree, "obj_wcc");
3562 /* RFC 1813, Page 37..39 */
3564 dissect_nfs3_lookup_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
3567 offset = dissect_diropargs3 (tvb, offset, pinfo, tree, "what");
3572 /* RFC 1813, Page 37..39 */
3574 dissect_nfs3_lookup_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
3579 offset = dissect_nfsstat3(tvb, offset, tree, &status);
3582 offset = dissect_nfs_fh3(tvb, offset, pinfo, tree, "object");
3583 offset = dissect_post_op_attr(tvb, offset, tree,
3585 offset = dissect_post_op_attr(tvb, offset, tree,
3589 offset = dissect_post_op_attr(tvb, offset, tree,
3598 /* RFC 1813, Page 40..43 */
3600 dissect_nfs3_access_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
3603 offset = dissect_nfs_fh3(tvb, offset, pinfo, tree, "object");
3604 offset = dissect_access (tvb, offset, tree, "access");
3610 /* RFC 1813, Page 40..43 */
3612 dissect_nfs3_access_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
3617 offset = dissect_nfsstat3(tvb, offset, tree, &status);
3620 offset = dissect_post_op_attr(tvb, offset, tree,
3622 offset = dissect_access(tvb, offset, tree, "access");
3625 offset = dissect_post_op_attr(tvb, offset, tree,
3634 /* RFC 1813, Page 44,45 */
3636 dissect_nfs3_readlink_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
3641 offset = dissect_nfsstat3(tvb, offset, tree, &status);
3644 offset = dissect_post_op_attr(tvb, offset, tree,
3645 "symlink_attributes");
3646 offset = dissect_nfspath3(tvb, offset, tree,
3647 hf_nfs_readlink_data);
3650 offset = dissect_post_op_attr(tvb, offset, tree,
3651 "symlink_attributes");
3659 /* RFC 1813, Page 46..48 */
3661 dissect_nfs3_read_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
3664 offset = dissect_nfs_fh3(tvb, offset, pinfo, tree, "file");
3665 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_offset3, offset);
3666 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_count3, offset);
3672 /* RFC 1813, Page 46..48 */
3674 dissect_nfs3_read_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
3679 offset = dissect_nfsstat3(tvb, offset, tree, &status);
3682 offset = dissect_post_op_attr(tvb, offset, tree,
3684 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_count3,
3686 offset = dissect_rpc_bool(tvb, tree, hf_nfs_read_eof,
3688 offset = dissect_nfsdata(tvb, offset, tree, hf_nfs_data);
3691 offset = dissect_post_op_attr(tvb, offset, tree,
3700 /* RFC 1813, Page 49 */
3701 static const value_string names_stable_how[] = {
3702 { UNSTABLE, "UNSTABLE" },
3703 { DATA_SYNC, "DATA_SYNC" },
3704 { FILE_SYNC, "FILE_SYNC" },
3709 /* RFC 1813, Page 49 */
3711 dissect_stable_how(tvbuff_t *tvb, int offset, proto_tree* tree, int hfindex)
3715 stable_how = tvb_get_ntohl(tvb,offset+0);
3717 proto_tree_add_uint(tree, hfindex, tvb,
3718 offset, 4, stable_how);
3726 /* RFC 1813, Page 49..54 */
3728 dissect_nfs3_write_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
3731 offset = dissect_nfs_fh3 (tvb, offset, pinfo, tree, "file");
3732 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_offset3, offset);
3733 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_count3, offset);
3734 offset = dissect_stable_how(tvb, offset, tree, hf_nfs_write_stable);
3735 offset = dissect_nfsdata (tvb, offset, tree, hf_nfs_data);
3741 /* RFC 1813, Page 49..54 */
3743 dissect_nfs3_write_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
3748 offset = dissect_nfsstat3(tvb, offset, tree, &status);
3751 offset = dissect_wcc_data (tvb, offset, tree, "file_wcc");
3752 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_count3,
3754 offset = dissect_stable_how(tvb, offset, tree,
3755 hf_nfs_write_committed);
3756 offset = dissect_writeverf3(tvb, offset, tree);
3759 offset = dissect_wcc_data(tvb, offset, tree, "file_wcc");
3767 /* RFC 1813, Page 54 */
3768 static const value_string names_createmode3[] = {
3769 { UNCHECKED, "UNCHECKED" },
3770 { GUARDED, "GUARDED" },
3771 { EXCLUSIVE, "EXCLUSIVE" },
3776 /* RFC 1813, Page 54 */
3778 dissect_createmode3(tvbuff_t *tvb, int offset, proto_tree* tree, guint32* mode)
3782 mode_value = tvb_get_ntohl(tvb, offset + 0);
3784 proto_tree_add_uint(tree, hf_nfs_createmode3, tvb,
3785 offset+0, 4, mode_value);
3794 /* RFC 1813, Page 54..58 */
3796 dissect_nfs3_create_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
3801 offset = dissect_diropargs3 (tvb, offset, pinfo, tree, "where");
3802 offset = dissect_createmode3(tvb, offset, tree, &mode);
3806 offset = dissect_sattr3(tvb, offset, tree, "obj_attributes");
3809 offset = dissect_createverf3(tvb, offset, tree);
3817 /* RFC 1813, Page 54..58 */
3819 dissect_nfs3_create_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
3824 offset = dissect_nfsstat3(tvb, offset, tree, &status);
3827 offset = dissect_post_op_fh3 (tvb, offset, pinfo, tree, "obj");
3828 offset = dissect_post_op_attr(tvb, offset, tree,
3830 offset = dissect_wcc_data(tvb, offset, tree, "dir_wcc");
3833 offset = dissect_wcc_data(tvb, offset, tree, "dir_wcc");
3841 /* RFC 1813, Page 58..60 */
3843 dissect_nfs3_mkdir_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
3846 offset = dissect_diropargs3(tvb, offset, pinfo, tree, "where");
3847 offset = dissect_sattr3 (tvb, offset, tree, "attributes");
3853 /* RFC 1813, Page 61..63 */
3855 dissect_nfs3_symlink_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
3858 offset = dissect_diropargs3(tvb, offset, pinfo, tree, "where");
3859 offset = dissect_sattr3 (tvb, offset, tree, "symlink_attributes");
3860 offset = dissect_nfspath3 (tvb, offset, tree, hf_nfs_symlink_to);
3866 /* RFC 1813, Page 63..66 */
3868 dissect_nfs3_mknod_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
3873 offset = dissect_diropargs3(tvb, offset, pinfo, tree, "where");
3874 offset = dissect_ftype3(tvb, offset, tree, hf_nfs_ftype3, &type);
3878 offset = dissect_sattr3(tvb, offset, tree, "dev_attributes");
3879 offset = dissect_specdata3(tvb, offset, tree, "spec");
3883 offset = dissect_sattr3(tvb, offset, tree, "pipe_attributes");
3894 /* RFC 1813, Page 67..69 */
3896 dissect_nfs3_remove_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
3901 offset = dissect_nfsstat3(tvb, offset, tree, &status);
3904 offset = dissect_wcc_data(tvb, offset, tree, "dir_wcc");
3907 offset = dissect_wcc_data(tvb, offset, tree, "dir_wcc");
3915 /* RFC 1813, Page 71..74 */
3917 dissect_nfs3_rename_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
3920 offset = dissect_diropargs3(tvb, offset, pinfo, tree, "from");
3921 offset = dissect_diropargs3(tvb, offset, pinfo, tree, "to");
3927 /* RFC 1813, Page 71..74 */
3929 dissect_nfs3_rename_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
3934 offset = dissect_nfsstat3(tvb, offset, tree, &status);
3937 offset = dissect_wcc_data(tvb, offset, tree, "fromdir_wcc");
3938 offset = dissect_wcc_data(tvb, offset, tree, "todir_wcc");
3941 offset = dissect_wcc_data(tvb, offset, tree, "fromdir_wcc");
3942 offset = dissect_wcc_data(tvb, offset, tree, "todir_wcc");
3950 /* RFC 1813, Page 74..76 */
3952 dissect_nfs3_link_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
3955 offset = dissect_nfs_fh3 (tvb, offset, pinfo, tree, "file");
3956 offset = dissect_diropargs3(tvb, offset, pinfo, tree, "link");
3962 /* RFC 1813, Page 74..76 */
3964 dissect_nfs3_link_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
3969 offset = dissect_nfsstat3(tvb, offset, tree, &status);
3972 offset = dissect_post_op_attr(tvb, offset, tree,
3974 offset = dissect_wcc_data(tvb, offset, tree, "linkdir_wcc");
3977 offset = dissect_post_op_attr(tvb, offset, tree,
3979 offset = dissect_wcc_data(tvb, offset, tree, "linkdir_wcc");
3987 /* RFC 1813, Page 76..80 */
3989 dissect_nfs3_readdir_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
3992 offset = dissect_nfs_fh3 (tvb, offset, pinfo, tree, "dir");
3993 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_cookie3, offset);
3994 offset = dissect_cookieverf3(tvb, offset, tree);
3995 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_count3, offset);
4001 /* RFC 1813, Page 76..80 */
4003 dissect_entry3(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
4006 proto_item* entry_item = NULL;
4007 proto_tree* entry_tree = NULL;
4008 int old_offset = offset;
4012 entry_item = proto_tree_add_item(tree, hf_nfs_readdir_entry, tvb,
4013 offset+0, -1, FALSE);
4014 entry_tree = proto_item_add_subtree(entry_item, ett_nfs_readdir_entry);
4017 offset = dissect_rpc_uint64(tvb, entry_tree, hf_nfs_readdir_entry3_fileid,
4020 offset = dissect_filename3(tvb, offset, entry_tree,
4021 hf_nfs_readdir_entry3_name, &name);
4023 proto_item_set_text(entry_item, "Entry: name %s", name);
4026 offset = dissect_rpc_uint64(tvb, entry_tree, hf_nfs_readdir_entry3_cookie,
4029 /* now we know, that a readdir entry is shorter */
4031 proto_item_set_len(entry_item, offset - old_offset);
4038 /* RFC 1813, Page 76..80 */
4040 dissect_nfs3_readdir_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
4046 offset = dissect_stat(tvb, offset, tree, &status);
4049 offset = dissect_post_op_attr(tvb, offset, tree,
4051 offset = dissect_cookieverf3(tvb, offset, tree);
4052 offset = dissect_rpc_list(tvb, pinfo, tree, offset,
4054 eof_value = tvb_get_ntohl(tvb, offset+0);
4056 proto_tree_add_uint(tree, hf_nfs_readdir_eof, tvb,
4057 offset+ 0, 4, eof_value);
4061 offset = dissect_post_op_attr(tvb, offset, tree,
4070 /* RFC 1813, Page 80..83 */
4072 dissect_nfs3_readdirplus_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
4075 offset = dissect_nfs_fh3 (tvb, offset, pinfo, tree, "dir");
4076 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_cookie3, offset);
4077 offset = dissect_cookieverf3(tvb, offset, tree);
4078 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_count3_dircount,
4080 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_count3_maxcount,
4087 /* RFC 1813, Page 80..83 */
4089 dissect_entryplus3(tvbuff_t *tvb, int offset, packet_info *pinfo,
4092 proto_item* entry_item = NULL;
4093 proto_tree* entry_tree = NULL;
4094 int old_offset = offset;
4098 entry_item = proto_tree_add_item(tree, hf_nfs_readdir_entry, tvb,
4099 offset+0, -1, FALSE);
4100 entry_tree = proto_item_add_subtree(entry_item, ett_nfs_readdir_entry);
4103 offset = dissect_rpc_uint64(tvb, entry_tree,
4104 hf_nfs_readdirplus_entry_fileid, offset);
4106 offset = dissect_filename3(tvb, offset, entry_tree,
4107 hf_nfs_readdirplus_entry_name, &name);
4109 proto_item_set_text(entry_item, "Entry: name %s", name);
4112 offset = dissect_rpc_uint64(tvb, entry_tree, hf_nfs_readdirplus_entry_cookie,
4115 offset = dissect_post_op_attr(tvb, offset, entry_tree,
4117 offset = dissect_post_op_fh3(tvb, offset, pinfo, entry_tree, "name_handle");
4119 /* now we know, that a readdirplus entry is shorter */
4121 proto_item_set_len(entry_item, offset - old_offset);
4128 /* RFC 1813, Page 80..83 */
4130 dissect_nfs3_readdirplus_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
4136 offset = dissect_stat(tvb, offset, tree, &status);
4139 offset = dissect_post_op_attr(tvb, offset, tree,
4141 offset = dissect_cookieverf3(tvb, offset, tree);
4142 offset = dissect_rpc_list(tvb, pinfo, tree, offset,
4143 dissect_entryplus3);
4144 eof_value = tvb_get_ntohl(tvb, offset+0);
4146 proto_tree_add_uint(tree, hf_nfs_readdir_eof, tvb,
4147 offset+ 0, 4, eof_value);
4151 offset = dissect_post_op_attr(tvb, offset, tree,
4160 /* RFC 1813, Page 84..86 */
4162 dissect_nfs3_fsstat_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
4168 offset = dissect_nfsstat3(tvb, offset, tree, &status);
4171 offset = dissect_post_op_attr(tvb, offset, tree,
4173 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_fsstat3_resok_tbytes,
4175 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_fsstat3_resok_fbytes,
4177 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_fsstat3_resok_abytes,
4179 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_fsstat3_resok_tfiles,
4181 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_fsstat3_resok_ffiles,
4183 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_fsstat3_resok_afiles,
4185 invarsec = tvb_get_ntohl(tvb, offset + 0);
4187 proto_tree_add_uint(tree, hf_nfs_fsstat_invarsec, tvb,
4188 offset+0, 4, invarsec);
4192 offset = dissect_post_op_attr(tvb, offset, tree,
4201 #define FSF3_LINK 0x0001
4202 #define FSF3_SYMLINK 0x0002
4203 #define FSF3_HOMOGENEOUS 0x0008
4204 #define FSF3_CANSETTIME 0x0010
4207 /* RFC 1813, Page 86..90 */
4209 dissect_nfs3_fsinfo_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
4221 proto_item* properties_item = NULL;
4222 proto_tree* properties_tree = NULL;
4224 offset = dissect_nfsstat3(tvb, offset, tree, &status);
4227 offset = dissect_post_op_attr(tvb, offset, tree,
4229 rtmax = tvb_get_ntohl(tvb, offset+0);
4231 proto_tree_add_uint(tree, hf_nfs_fsinfo_rtmax, tvb,
4232 offset+0, 4, rtmax);
4234 rtpref = tvb_get_ntohl(tvb, offset+0);
4236 proto_tree_add_uint(tree, hf_nfs_fsinfo_rtpref, tvb,
4237 offset+0, 4, rtpref);
4239 rtmult = tvb_get_ntohl(tvb, offset+0);
4241 proto_tree_add_uint(tree, hf_nfs_fsinfo_rtmult, tvb,
4242 offset+0, 4, rtmult);
4244 wtmax = tvb_get_ntohl(tvb, offset+0);
4246 proto_tree_add_uint(tree, hf_nfs_fsinfo_wtmax, tvb,
4247 offset+0, 4, wtmax);
4249 wtpref = tvb_get_ntohl(tvb, offset+0);
4251 proto_tree_add_uint(tree, hf_nfs_fsinfo_wtpref, tvb,
4252 offset+0, 4, wtpref);
4254 wtmult = tvb_get_ntohl(tvb, offset+0);
4256 proto_tree_add_uint(tree, hf_nfs_fsinfo_wtmult, tvb,
4257 offset+0, 4, wtmult);
4259 dtpref = tvb_get_ntohl(tvb, offset+0);
4261 proto_tree_add_uint(tree, hf_nfs_fsinfo_dtpref, tvb,
4262 offset+0, 4, dtpref);
4265 offset = dissect_rpc_uint64(tvb, tree,
4266 hf_nfs_fsinfo_maxfilesize, offset);
4267 offset = dissect_nfstime3(tvb, offset, tree, hf_nfs_dtime, hf_nfs_dtime_sec, hf_nfs_dtime_nsec);
4268 properties = tvb_get_ntohl(tvb, offset+0);
4270 properties_item = proto_tree_add_uint(tree,
4271 hf_nfs_fsinfo_properties,
4272 tvb, offset+0, 4, properties);
4273 if (properties_item)
4274 properties_tree = proto_item_add_subtree(properties_item,
4275 ett_nfs_fsinfo_properties);
4276 if (properties_tree) {
4277 proto_tree_add_text(properties_tree, tvb,
4279 decode_boolean_bitfield(properties,
4281 "SETATTR can set time on server",
4282 "SETATTR can't set time on server"));
4284 proto_tree_add_text(properties_tree, tvb,
4286 decode_boolean_bitfield(properties,
4288 "PATHCONF is valid for all files",
4289 "PATHCONF should be get for every single file"));
4291 proto_tree_add_text(properties_tree, tvb,
4293 decode_boolean_bitfield(properties,
4295 "File System supports symbolic links",
4296 "File System does not symbolic hard links"));
4298 proto_tree_add_text(properties_tree, tvb,
4300 decode_boolean_bitfield(properties,
4302 "File System supports hard links",
4303 "File System does not support hard links"));
4309 offset = dissect_post_op_attr(tvb, offset, tree,
4318 /* RFC 1813, Page 90..92 */
4320 dissect_nfs3_pathconf_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
4327 offset = dissect_nfsstat3(tvb, offset, tree, &status);
4330 offset = dissect_post_op_attr(tvb, offset, tree,
4332 linkmax = tvb_get_ntohl(tvb, offset + 0);
4334 proto_tree_add_uint(tree, hf_nfs_pathconf_linkmax, tvb,
4335 offset+0, 4, linkmax);
4337 name_max = tvb_get_ntohl(tvb, offset + 0);
4339 proto_tree_add_uint(tree, hf_nfs_pathconf_name_max, tvb,
4340 offset+0, 4, name_max);
4342 offset = dissect_rpc_bool(tvb, tree,
4343 hf_nfs_pathconf_no_trunc, offset);
4344 offset = dissect_rpc_bool(tvb, tree,
4345 hf_nfs_pathconf_chown_restricted, offset);
4346 offset = dissect_rpc_bool(tvb, tree,
4347 hf_nfs_pathconf_case_insensitive, offset);
4348 offset = dissect_rpc_bool(tvb, tree,
4349 hf_nfs_pathconf_case_preserving, offset);
4352 offset = dissect_post_op_attr(tvb, offset, tree,
4361 /* RFC 1813, Page 92..95 */
4363 dissect_nfs3_commit_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
4366 offset = dissect_nfs_fh3(tvb, offset, pinfo, tree, "file");
4367 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_offset3, offset);
4368 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_count3, offset);
4373 /* RFC 1813, Page 92..95 */
4375 dissect_nfs3_commit_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
4380 offset = dissect_nfsstat3(tvb, offset, tree, &status);
4383 offset = dissect_wcc_data (tvb, offset, tree, "file_wcc");
4384 offset = dissect_writeverf3(tvb, offset, tree);
4387 offset = dissect_wcc_data(tvb, offset, tree, "file_wcc");
4394 /**********************************************************/
4395 /* NFS Version 4, RFC 3010 with nfs4_prot.x 1.103 changes */
4396 /**********************************************************/
4399 dissect_nfs_utf8string(tvbuff_t *tvb, int offset,
4400 proto_tree *tree, int hf, char **string_ret)
4402 /* TODO: this dissector is subject to change; do not remove */
4403 return dissect_rpc_string(tvb, tree, hf, offset, string_ret);
4407 dissect_nfs_specdata4(tvbuff_t *tvb, int offset, proto_tree *tree)
4409 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_specdata1, offset);
4410 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_specdata2, offset);
4415 static const value_string names_ftype4[] = {
4416 { NF4REG, "NF4REG" },
4417 { NF4DIR, "NF4DIR" },
4418 { NF4BLK, "NF4BLK" },
4419 { NF4CHR, "NF4CHR" },
4420 { NF4LNK, "NF4LNK" },
4421 { NF4SOCK, "NF4SOCK" },
4422 { NF4FIFO, "NF4FIFO" },
4423 { NF4ATTRDIR, "NF4ATTRDIR" },
4424 { NF4NAMEDATTR, "NF4NAMEDATTR" },
4429 dissect_nfs_lock_owner4(tvbuff_t *tvb, int offset, proto_tree *tree)
4431 proto_tree *newftree = NULL;
4432 proto_item *fitem = NULL;
4434 fitem = proto_tree_add_text(tree, tvb, offset, 4, "Owner");
4438 newftree = proto_item_add_subtree(fitem, ett_nfs_lock_owner4);
4442 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_clientid4, offset);
4443 offset = dissect_nfsdata(tvb, offset, newftree, hf_nfs_data);
4451 dissect_nfs_pathname4(tvbuff_t *tvb, int offset, proto_tree *tree)
4453 guint32 comp_count, i;
4454 proto_item *fitem = NULL;
4455 proto_tree *newftree = NULL;
4457 comp_count=tvb_get_ntohl(tvb, offset);
4458 fitem = proto_tree_add_text(tree, tvb, offset, 4,
4459 "pathname components (%u)", comp_count);
4464 newftree = proto_item_add_subtree(fitem, ett_nfs_pathname4);
4468 for (i = 0; i < comp_count; i++)
4469 offset = dissect_nfs_utf8string(tvb, offset, newftree,
4470 hf_nfs_component4, NULL);
4478 dissect_nfs_nfstime4(tvbuff_t *tvb, int offset, proto_tree *tree)
4480 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_nfstime4_seconds, offset);
4481 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_nfstime4_nseconds, offset);
4486 static const value_string names_time_how4[] = {
4487 #define SET_TO_SERVER_TIME4 0
4488 { SET_TO_SERVER_TIME4, "SET_TO_SERVER_TIME4" },
4489 #define SET_TO_CLIENT_TIME4 1
4490 { SET_TO_CLIENT_TIME4, "SET_TO_CLIENT_TIME4" },
4495 dissect_nfs_settime4(tvbuff_t *tvb, int offset,
4496 proto_tree *tree, char *name _U_)
4500 set_it = tvb_get_ntohl(tvb, offset);
4501 proto_tree_add_uint(tree, hf_nfs_time_how4, tvb, offset+0,
4505 if (set_it == SET_TO_CLIENT_TIME4)
4506 offset = dissect_nfs_nfstime4(tvb, offset, tree);
4512 dissect_nfs_fsid4(tvbuff_t *tvb, int offset, proto_tree *tree, char *name)
4514 proto_tree *newftree = NULL;
4515 proto_item *fitem = NULL;
4517 fitem = proto_tree_add_text(tree, tvb, offset, 0, "%s", name);
4519 if (fitem == NULL) return offset;
4521 newftree = proto_item_add_subtree(fitem, ett_nfs_fsid4);
4523 if (newftree == NULL) return offset;
4525 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_fsid4_major,
4527 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_fsid4_minor,
4533 static const value_string names_acetype4[] = {
4534 #define ACE4_ACCESS_ALLOWED_ACE_TYPE 0x00000000
4535 { ACE4_ACCESS_ALLOWED_ACE_TYPE, "ACE4_ACCESS_ALLOWED_ACE_TYPE" },
4536 #define ACE4_ACCESS_DENIED_ACE_TYPE 0x00000001
4537 { ACE4_ACCESS_DENIED_ACE_TYPE, "ACE4_ACCESS_DENIED_ACE_TYPE" },
4538 #define ACE4_SYSTEM_AUDIT_ACE_TYPE 0x00000002
4539 { ACE4_SYSTEM_AUDIT_ACE_TYPE, "ACE4_SYSTEM_AUDIT_ACE_TYPE" },
4540 #define ACE4_SYSTEM_ALARM_ACE_TYPE 0x00000003
4541 { ACE4_SYSTEM_ALARM_ACE_TYPE, "ACE4_SYSTEM_ALARM_ACE_TYPE" },
4545 /* ACE mask values */
4546 #define ACE4_READ_DATA 0x00000001
4547 #define ACE4_LIST_DIRECTORY 0x00000001
4548 #define ACE4_WRITE_DATA 0x00000002
4549 #define ACE4_ADD_FILE 0x00000002
4550 #define ACE4_APPEND_DATA 0x00000004
4551 #define ACE4_ADD_SUBDIRECTORY 0x00000004
4552 #define ACE4_READ_NAMED_ATTRS 0x00000008
4553 #define ACE4_WRITE_NAMED_ATTRS 0x00000010
4554 #define ACE4_EXECUTE 0x00000020
4555 #define ACE4_DELETE_CHILD 0x00000040
4556 #define ACE4_READ_ATTRIBUTES 0x00000080
4557 #define ACE4_WRITE_ATTRIBUTES 0x00000100
4558 #define ACE4_DELETE 0x00010000
4559 #define ACE4_READ_ACL 0x00020000
4560 #define ACE4_WRITE_ACL 0x00040000
4561 #define ACE4_WRITE_OWNER 0x00080000
4562 #define ACE4_SYNCHRONIZE 0x00100000
4565 dissect_nfs_acemask4(tvbuff_t *tvb, int offset, proto_tree *tree)
4568 proto_item *acemask_item = NULL;
4569 proto_tree *acemask_tree = NULL;
4571 acemask = tvb_get_ntohl(tvb, offset);
4573 acemask_item = proto_tree_add_text(tree, tvb, offset, 4,
4574 "acemask: 0x%08x", acemask);
4577 acemask_tree = proto_item_add_subtree(acemask_item, ett_nfs_acemask4);
4581 if (acemask & ACE4_READ_DATA)
4582 proto_tree_add_text(acemask_tree, tvb, offset, 4,
4583 "ACE4_READ_DATA/ACE4_LIST_DIRECTORY (0x%08x)",
4586 if (acemask & ACE4_WRITE_DATA)
4587 proto_tree_add_text(acemask_tree, tvb, offset, 4,
4588 "ACE4_WRITE_DATA/ACE4_ADD_FILE (0x%08x)",
4591 if (acemask & ACE4_APPEND_DATA)
4592 proto_tree_add_text(acemask_tree, tvb, offset, 4,
4593 "ACE4_ADD_FILE/ACE4_ADD_SUBDIRECTORY (0x%08x)",
4596 if (acemask & ACE4_READ_NAMED_ATTRS)
4597 proto_tree_add_text(acemask_tree, tvb, offset, 4,
4598 "ACE4_READ_NAMED_ATTRS (0x%08x)",
4599 ACE4_READ_NAMED_ATTRS);
4601 if (acemask & ACE4_WRITE_NAMED_ATTRS)
4602 proto_tree_add_text(acemask_tree, tvb, offset, 4,
4603 "ACE4_WRITE_NAMED_ATTRS (0x%08x)",
4604 ACE4_WRITE_NAMED_ATTRS);
4606 if (acemask & ACE4_EXECUTE)
4607 proto_tree_add_text(acemask_tree, tvb, offset, 4,
4608 "ACE4_EXECUTE (0x%08x)",
4611 if (acemask & ACE4_DELETE_CHILD)
4612 proto_tree_add_text(acemask_tree, tvb, offset, 4,
4613 "ACE4_DELETE_CHILD (0x%08x)",
4616 if (acemask & ACE4_READ_ATTRIBUTES)
4617 proto_tree_add_text(acemask_tree, tvb, offset, 4,
4618 "ACE4_READ_ATTRIBUTES (0x%08x)",
4619 ACE4_READ_ATTRIBUTES);
4621 if (acemask & ACE4_WRITE_ATTRIBUTES)
4622 proto_tree_add_text(acemask_tree, tvb, offset, 4,
4623 "ACE4_WRITE_ATTRIBUTES (0x%08x)",
4624 ACE4_WRITE_ATTRIBUTES);
4626 if (acemask & ACE4_DELETE)
4627 proto_tree_add_text(acemask_tree, tvb, offset, 4,
4628 "ACE4_DELETE (0x%08x)",
4631 if (acemask & ACE4_READ_ACL)
4632 proto_tree_add_text(acemask_tree, tvb, offset, 4,
4633 "ACE4_READ_ACL (0x%08x)",
4636 if (acemask & ACE4_WRITE_ACL)
4637 proto_tree_add_text(acemask_tree, tvb, offset, 4,
4638 "ACE4_WRITE_ACL (0x%08x)",
4641 if (acemask & ACE4_WRITE_OWNER)
4642 proto_tree_add_text(acemask_tree, tvb, offset, 4,
4643 "ACE4_WRITE_OWNER (0x%08x)",
4646 if (acemask & ACE4_SYNCHRONIZE)
4647 proto_tree_add_text(acemask_tree, tvb, offset, 4,
4648 "ACE4_SYNCHRONIZE (0x%08x)",
4657 /* ACE flag values */
4658 #define ACE4_FILE_INHERIT_ACE 0x00000001
4659 #define ACE4_DIRECTORY_INHERIT_ACE 0x00000002
4660 #define ACE4_NO_PROPAGATE_INHERIT_ACE 0x00000004
4661 #define ACE4_INHERIT_ONLY_ACE 0x00000008
4662 #define ACE4_SUCCESSFUL_ACCESS_ACE_FLAG 0x00000010
4663 #define ACE4_FAILED_ACCESS_ACE_FLAG 0x00000020
4664 #define ACE4_IDENTIFIER_GROUP 0x00000040
4668 dissect_nfs_ace4(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
4671 proto_item* ace_item = NULL;
4672 proto_tree* ace_tree = NULL;
4673 proto_item *aceflag_item = NULL;
4674 proto_tree *aceflag_tree = NULL;
4678 ace_item = proto_tree_add_text(tree, tvb, offset, 4,
4682 ace_tree = proto_item_add_subtree(ace_item, ett_nfs_ace4);
4686 offset = dissect_rpc_uint32(tvb, ace_tree, hf_nfs_acetype4, offset);
4688 aceflag4 = tvb_get_ntohl(tvb, offset);
4690 aceflag_item = proto_tree_add_text(ace_tree, tvb, offset, 4,
4691 "aceflag: 0x%08x", aceflag4);
4695 aceflag_tree = proto_item_add_subtree(aceflag_item, ett_nfs_aceflag4);
4699 if (aceflag4 & ACE4_FILE_INHERIT_ACE)
4700 proto_tree_add_text(aceflag_tree, tvb, offset, 4,
4701 "ACE4_FILE_INHERIT_ACE (0x%08x)", ACE4_FILE_INHERIT_ACE);
4703 if (aceflag4 & ACE4_DIRECTORY_INHERIT_ACE)
4704 proto_tree_add_text(aceflag_tree, tvb, offset, 4,
4705 "ACE4_DIRECTORY_INHERIT_ACE (0x%08x)",
4706 ACE4_DIRECTORY_INHERIT_ACE);
4708 if (aceflag4 & ACE4_INHERIT_ONLY_ACE)
4709 proto_tree_add_text(aceflag_tree, tvb, offset, 4,
4710 "ACE4_INHERIT_ONLY_ACE (0x%08x)",
4711 ACE4_INHERIT_ONLY_ACE);
4713 if (aceflag4 & ACE4_SUCCESSFUL_ACCESS_ACE_FLAG)
4714 proto_tree_add_text(aceflag_tree, tvb, offset, 4,
4715 "ACE4_SUCCESSFUL_ACCESS_ACE_FLAG (0x%08x)",
4716 ACE4_SUCCESSFUL_ACCESS_ACE_FLAG);
4718 if (aceflag4 & ACE4_FAILED_ACCESS_ACE_FLAG)
4719 proto_tree_add_text(aceflag_tree, tvb, offset, 4,
4720 "ACE4_FAILED_ACCESS_ACE_FLAG (0x%08x)",
4721 ACE4_FAILED_ACCESS_ACE_FLAG);
4723 if (aceflag4 & ACE4_IDENTIFIER_GROUP)
4724 proto_tree_add_text(aceflag_tree, tvb, offset, 4,
4725 "ACE4_IDENTIFIER_GROUP (0x%08x)",
4726 ACE4_IDENTIFIER_GROUP);
4732 offset = dissect_nfs_acemask4(tvb, offset, ace_tree);
4734 offset = dissect_nfs_utf8string(tvb, offset, ace_tree, hf_nfs_who, NULL);
4741 dissect_nfs_fattr4_acl(tvbuff_t *tvb, int offset, packet_info *pinfo,
4744 return dissect_rpc_array(tvb, pinfo, tree, offset, dissect_nfs_ace4,
4749 dissect_nfs_fh4(tvbuff_t *tvb, int offset, packet_info *pinfo,
4750 proto_tree *tree, char *name)
4752 return dissect_nfs_fh3(tvb, offset, pinfo, tree, name);
4756 dissect_nfs_fs_location4(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
4759 proto_tree *newftree = NULL;
4760 proto_item *fitem = NULL;
4762 fitem = proto_tree_add_text(tree, tvb, offset, 0, "rootpath");
4764 if (fitem == NULL) return offset;
4766 newftree = proto_item_add_subtree(fitem, ett_nfs_fs_location4);
4768 if (newftree == NULL) return offset;
4770 offset = dissect_nfs_utf8string(tvb, offset, tree, hf_nfs_server, NULL);
4776 dissect_nfs_fs_locations4(tvbuff_t *tvb, packet_info *pinfo, int offset,
4777 proto_tree *tree, char *name)
4779 proto_tree *newftree = NULL;
4780 proto_item *fitem = NULL;
4782 fitem = proto_tree_add_text(tree, tvb, offset, 0, "%s", name);
4784 if (fitem == NULL) return offset;
4786 newftree = proto_item_add_subtree(fitem, ett_nfs_fs_locations4);
4788 if (newftree == NULL) return offset;
4790 offset = dissect_nfs_pathname4(tvb, offset, newftree);
4792 offset = dissect_rpc_list(tvb, pinfo, tree, offset,
4793 dissect_nfs_fs_location4);
4799 dissect_nfs_mode4(tvbuff_t *tvb, int offset,
4800 proto_tree *tree, char *name)
4802 return dissect_mode(tvb, offset, tree, name);
4805 static const value_string nfs4_fattr4_fh_expire_type_names[] = {
4806 #define FH4_PERSISTENT 0x00000000
4807 { FH4_PERSISTENT, "FH4_PERSISTENT" },
4808 #define FH4_NOEXPIRE_WITH_OPEN 0x00000001
4809 { FH4_NOEXPIRE_WITH_OPEN, "FH4_NOEXPIRE_WITH_OPEN" },
4810 #define FH4_VOLATILE_ANY 0x00000002
4811 { FH4_VOLATILE_ANY, "FH4_VOLATILE_ANY" },
4812 #define FH4_VOL_MIGRATION 0x00000004
4813 { FH4_VOL_MIGRATION, "FH4_VOL_MIGRATION" },
4814 #define FH4_VOL_RENAME 0x00000008
4815 { FH4_VOL_RENAME, "FH4_VOL_RENAME" },
4821 dissect_nfs_fattr4_fh_expire_type(tvbuff_t *tvb, int offset, proto_tree *tree)
4823 guint32 expire_type;
4824 proto_item *expire_type_item = NULL;
4825 proto_tree *expire_type_tree = NULL;
4827 expire_type = tvb_get_ntohl(tvb, offset + 0);
4831 expire_type_item = proto_tree_add_text(tree, tvb, offset, 4,
4832 "fattr4_fh_expire_type: 0x%08x", expire_type);
4833 if (expire_type_item)
4834 expire_type_tree = proto_item_add_subtree(expire_type_item,
4835 ett_nfs_fattr4_fh_expire_type);
4838 if (expire_type_tree)
4840 if (expire_type == FH4_PERSISTENT)
4842 proto_tree_add_text(expire_type_tree, tvb, offset, 4, "%s",
4843 decode_enumerated_bitfield(expire_type, FH4_PERSISTENT, 8,
4844 nfs4_fattr4_fh_expire_type_names, "%s"));
4848 if (expire_type & FH4_NOEXPIRE_WITH_OPEN)
4849 proto_tree_add_text(expire_type_tree, tvb, offset, 4,
4850 "FH4_NOEXPIRE_WITH_OPEN (0x%08x)", FH4_NOEXPIRE_WITH_OPEN);
4852 if (expire_type & FH4_VOLATILE_ANY)
4853 proto_tree_add_text(expire_type_tree, tvb, offset, 4,
4854 "FH4_VOLATILE_ANY (0x%08x)", FH4_VOLATILE_ANY);
4856 if (expire_type & FH4_VOL_MIGRATION)
4857 proto_tree_add_text(expire_type_tree, tvb, offset, 4,
4858 "FH4_VOL_MIGRATION (0x%08x)", FH4_VOL_MIGRATION);
4860 if (expire_type & FH4_VOL_RENAME)
4861 proto_tree_add_text(expire_type_tree, tvb, offset, 4,
4862 "FH4_VOL_RENAME (0x%08x)", FH4_VOL_RENAME);
4871 static const value_string names_fattr4[] = {
4872 #define FATTR4_SUPPORTED_ATTRS 0
4873 { FATTR4_SUPPORTED_ATTRS, "FATTR4_SUPPORTED_ATTRS" },
4874 #define FATTR4_TYPE 1
4875 { FATTR4_TYPE, "FATTR4_TYPE" },
4876 #define FATTR4_FH_EXPIRE_TYPE 2
4877 { FATTR4_FH_EXPIRE_TYPE, "FATTR4_FH_EXPIRE_TYPE" },
4878 #define FATTR4_CHANGE 3
4879 { FATTR4_CHANGE, "FATTR4_CHANGE" },
4880 #define FATTR4_SIZE 4
4881 { FATTR4_SIZE, "FATTR4_SIZE" },
4882 #define FATTR4_LINK_SUPPORT 5
4883 { FATTR4_LINK_SUPPORT, "FATTR4_LINK_SUPPORT" },
4884 #define FATTR4_SYMLINK_SUPPORT 6
4885 { FATTR4_SYMLINK_SUPPORT, "FATTR4_SYMLINK_SUPPORT" },
4886 #define FATTR4_NAMED_ATTR 7
4887 { FATTR4_NAMED_ATTR, "FATTR4_NAMED_ATTR" },
4888 #define FATTR4_FSID 8
4889 { FATTR4_FSID, "FATTR4_FSID" },
4890 #define FATTR4_UNIQUE_HANDLES 9
4891 { FATTR4_UNIQUE_HANDLES, "FATTR4_UNIQUE_HANDLES" },
4892 #define FATTR4_LEASE_TIME 10
4893 { FATTR4_LEASE_TIME, "FATTR4_LEASE_TIME" },
4894 #define FATTR4_RDATTR_ERROR 11
4895 { FATTR4_RDATTR_ERROR, "FATTR4_RDATTR_ERROR" },
4896 #define FATTR4_ACL 12
4897 { FATTR4_ACL, "FATTR4_ACL" },
4898 #define FATTR4_ACLSUPPORT 13
4899 { FATTR4_ACLSUPPORT, "FATTR4_ACLSUPPORT" },
4900 #define FATTR4_ARCHIVE 14
4901 { FATTR4_ARCHIVE, "FATTR4_ARCHIVE" },
4902 #define FATTR4_CANSETTIME 15
4903 { FATTR4_CANSETTIME, "FATTR4_CANSETTIME" },
4904 #define FATTR4_CASE_INSENSITIVE 16
4905 { FATTR4_CASE_INSENSITIVE, "FATTR4_CASE_INSENSITIVE" },
4906 #define FATTR4_CASE_PRESERVING 17
4907 { FATTR4_CASE_PRESERVING, "FATTR4_CASE_PRESERVING" },
4908 #define FATTR4_CHOWN_RESTRICTED 18
4909 { FATTR4_CHOWN_RESTRICTED, "FATTR4_CHOWN_RESTRICTED" },
4910 #define FATTR4_FILEHANDLE 19
4911 { FATTR4_FILEHANDLE, "FATTR4_FILEHANDLE" },
4912 #define FATTR4_FILEID 20
4913 { FATTR4_FILEID, "FATTR4_FILEID" },
4914 #define FATTR4_FILES_AVAIL 21
4915 { FATTR4_FILES_AVAIL, "FATTR4_FILES_AVAIL" },
4916 #define FATTR4_FILES_FREE 22
4917 { FATTR4_FILES_FREE, "FATTR4_FILES_FREE" },
4918 #define FATTR4_FILES_TOTAL 23
4919 { FATTR4_FILES_TOTAL, "FATTR4_FILES_TOTAL" },
4920 #define FATTR4_FS_LOCATIONS 24
4921 { FATTR4_FS_LOCATIONS, "FATTR4_FS_LOCATIONS" },
4922 #define FATTR4_HIDDEN 25
4923 { FATTR4_HIDDEN, "FATTR4_HIDDEN" },
4924 #define FATTR4_HOMOGENEOUS 26
4925 { FATTR4_HOMOGENEOUS, "FATTR4_HOMOGENEOUS" },
4926 #define FATTR4_MAXFILESIZE 27
4927 { FATTR4_MAXFILESIZE, "FATTR4_MAXFILESIZE" },
4928 #define FATTR4_MAXLINK 28
4929 { FATTR4_MAXLINK, "FATTR4_MAXLINK" },
4930 #define FATTR4_MAXNAME 29
4931 { FATTR4_MAXNAME, "FATTR4_MAXNAME" },
4932 #define FATTR4_MAXREAD 30
4933 { FATTR4_MAXREAD, "FATTR4_MAXREAD" },
4934 #define FATTR4_MAXWRITE 31
4935 { FATTR4_MAXWRITE, "FATTR4_MAXWRITE" },
4936 #define FATTR4_MIMETYPE 32
4937 { FATTR4_MIMETYPE, "FATTR4_MIMETYPE" },
4938 #define FATTR4_MODE 33
4939 { FATTR4_MODE, "FATTR4_MODE" },
4940 #define FATTR4_NO_TRUNC 34
4941 { FATTR4_NO_TRUNC, "FATTR4_NO_TRUNC" },
4942 #define FATTR4_NUMLINKS 35
4943 { FATTR4_NUMLINKS, "FATTR4_NUMLINKS" },
4944 #define FATTR4_OWNER 36
4945 { FATTR4_OWNER, "FATTR4_OWNER" },
4946 #define FATTR4_OWNER_GROUP 37
4947 { FATTR4_OWNER_GROUP, "FATTR4_OWNER_GROUP" },
4948 #define FATTR4_QUOTA_AVAIL_HARD 38
4949 { FATTR4_QUOTA_AVAIL_HARD, "FATTR4_QUOTA_AVAIL_HARD" },
4950 #define FATTR4_QUOTA_AVAIL_SOFT 39
4951 { FATTR4_QUOTA_AVAIL_SOFT, "FATTR4_QUOTA_AVAIL_SOFT" },
4952 #define FATTR4_QUOTA_USED 40
4953 { FATTR4_QUOTA_USED, "FATTR4_QUOTA_USED" },
4954 #define FATTR4_RAWDEV 41
4955 { FATTR4_RAWDEV, "FATTR4_RAWDEV" },
4956 #define FATTR4_SPACE_AVAIL 42
4957 { FATTR4_SPACE_AVAIL, "FATTR4_SPACE_AVAIL" },
4958 #define FATTR4_SPACE_FREE 43
4959 { FATTR4_SPACE_FREE, "FATTR4_SPACE_FREE" },
4960 #define FATTR4_SPACE_TOTAL 44
4961 { FATTR4_SPACE_TOTAL, "FATTR4_SPACE_TOTAL" },
4962 #define FATTR4_SPACE_USED 45
4963 { FATTR4_SPACE_USED, "FATTR4_SPACE_USED" },
4964 #define FATTR4_SYSTEM 46
4965 { FATTR4_SYSTEM, "FATTR4_SYSTEM" },
4966 #define FATTR4_TIME_ACCESS 47
4967 { FATTR4_TIME_ACCESS, "FATTR4_TIME_ACCESS" },
4968 #define FATTR4_TIME_ACCESS_SET 48
4969 { FATTR4_TIME_ACCESS_SET, "FATTR4_TIME_ACCESS_SET" },
4970 #define FATTR4_TIME_BACKUP 49
4971 { FATTR4_TIME_BACKUP, "FATTR4_TIME_BACKUP" },
4972 #define FATTR4_TIME_CREATE 50
4973 { FATTR4_TIME_CREATE, "FATTR4_TIME_CREATE" },
4974 #define FATTR4_TIME_DELTA 51
4975 { FATTR4_TIME_DELTA, "FATTR4_TIME_DELTA" },
4976 #define FATTR4_TIME_METADATA 52
4977 { FATTR4_TIME_METADATA, "FATTR4_TIME_METADATA" },
4978 #define FATTR4_TIME_MODIFY 53
4979 { FATTR4_TIME_MODIFY, "FATTR4_TIME_MODIFY" },
4980 #define FATTR4_TIME_MODIFY_SET 54
4981 { FATTR4_TIME_MODIFY_SET, "FATTR4_TIME_MODIFY_SET" },
4982 #define FATTR4_MOUNTED_ON_FILEID 55
4983 { FATTR4_MOUNTED_ON_FILEID, "FATTR4_MOUNTED_ON_FILEID" },
4987 #define FATTR4_BITMAP_ONLY 0
4988 #define FATTR4_FULL_DISSECT 1
4991 dissect_nfs_attributes(tvbuff_t *tvb, int offset, packet_info *pinfo,
4992 proto_tree *tree, int type)
4995 proto_item *fitem = NULL;
4996 proto_tree *newftree = NULL;
4997 proto_item *attr_fitem = NULL;
4998 proto_tree *attr_newftree = NULL;
5004 int attr_vals_offset;
5006 bitmap_len = tvb_get_ntohl(tvb, offset);
5007 fitem = proto_tree_add_text(tree, tvb, offset, 4 + bitmap_len * 4,
5011 if (fitem == NULL) return offset;
5013 newftree = proto_item_add_subtree(fitem, ett_nfs_bitmap4);
5015 if (newftree == NULL) return offset;
5017 attr_vals_offset = offset + 4 + bitmap_len * 4;
5019 bitmap = g_malloc(bitmap_len * sizeof(guint32));
5020 if (bitmap == NULL) return offset;
5022 for (i = 0; i < bitmap_len; i++)
5024 if (!tvb_bytes_exist(tvb, offset, 4))
5030 bitmap[i] = tvb_get_ntohl(tvb, offset);
5034 for (j = 0; j < 32; j++)
5040 /* switch label if attribute is recommended vs. mandatory */
5041 attr_fitem = proto_tree_add_uint(newftree,
5042 (fattr < FATTR4_ACL)? hf_nfs_mand_attr: hf_nfs_recc_attr,
5043 tvb, offset, 4, fattr);
5045 if (attr_fitem == NULL) break;
5047 attr_newftree = proto_item_add_subtree(attr_fitem, ett_nfs_bitmap4);
5049 if (attr_newftree == NULL) break;
5051 if (type == FATTR4_FULL_DISSECT)
5053 /* do a full decode of the arguments for the set flag */
5056 case FATTR4_SUPPORTED_ATTRS:
5057 attr_vals_offset = dissect_nfs_attributes(tvb,
5058 attr_vals_offset, pinfo, attr_newftree,
5059 FATTR4_BITMAP_ONLY);
5063 attr_vals_offset = dissect_rpc_uint32(tvb,
5064 attr_newftree, hf_nfs_ftype4, attr_vals_offset);
5067 case FATTR4_FH_EXPIRE_TYPE:
5068 attr_vals_offset = dissect_nfs_fattr4_fh_expire_type(tvb,
5069 attr_vals_offset, attr_newftree);
5073 attr_vals_offset = dissect_rpc_uint64(tvb, attr_newftree,
5074 hf_nfs_changeid4, attr_vals_offset);
5078 attr_vals_offset = dissect_rpc_uint64(tvb,
5079 attr_newftree, hf_nfs_fattr4_size, attr_vals_offset);
5082 case FATTR4_LINK_SUPPORT:
5083 attr_vals_offset = dissect_rpc_bool(tvb,
5084 attr_newftree, hf_nfs_fattr4_link_support,
5088 case FATTR4_SYMLINK_SUPPORT:
5089 attr_vals_offset = dissect_rpc_bool(tvb,
5090 attr_newftree, hf_nfs_fattr4_symlink_support,
5094 case FATTR4_NAMED_ATTR:
5095 attr_vals_offset = dissect_rpc_bool(tvb,
5096 attr_newftree, hf_nfs_fattr4_named_attr, attr_vals_offset);
5100 attr_vals_offset = dissect_nfs_fsid4(tvb, attr_vals_offset,
5101 attr_newftree, "fattr4_fsid");
5104 case FATTR4_UNIQUE_HANDLES:
5105 attr_vals_offset = dissect_rpc_bool(tvb,
5106 attr_newftree, hf_nfs_fattr4_unique_handles,
5110 case FATTR4_LEASE_TIME:
5111 attr_vals_offset = dissect_rpc_uint32(tvb,
5112 attr_newftree, hf_nfs_fattr4_lease_time,
5116 case FATTR4_RDATTR_ERROR:
5117 attr_vals_offset = dissect_nfs_nfsstat4(tvb,
5118 attr_vals_offset, attr_newftree, NULL);
5122 attr_vals_offset = dissect_nfs_fattr4_acl(tvb,
5123 attr_vals_offset, pinfo, attr_newftree);
5126 case FATTR4_ACLSUPPORT:
5127 attr_vals_offset = dissect_rpc_uint32(tvb,
5128 attr_newftree, hf_nfs_fattr4_aclsupport,
5132 case FATTR4_ARCHIVE:
5133 attr_vals_offset = dissect_rpc_bool(tvb,
5134 attr_newftree, hf_nfs_fattr4_archive,
5138 case FATTR4_CANSETTIME:
5139 attr_vals_offset = dissect_rpc_bool(tvb,
5140 attr_newftree, hf_nfs_fattr4_cansettime, attr_vals_offset);
5143 case FATTR4_CASE_INSENSITIVE:
5144 attr_vals_offset = dissect_rpc_bool(tvb,
5145 attr_newftree, hf_nfs_fattr4_case_insensitive,
5149 case FATTR4_CASE_PRESERVING:
5150 attr_vals_offset = dissect_rpc_bool(tvb,
5151 attr_newftree, hf_nfs_fattr4_case_preserving,
5155 case FATTR4_CHOWN_RESTRICTED:
5156 attr_vals_offset = dissect_rpc_bool(tvb,
5157 attr_newftree, hf_nfs_fattr4_chown_restricted,
5162 attr_vals_offset = dissect_rpc_uint64(tvb,
5163 attr_newftree, hf_nfs_fattr4_fileid, attr_vals_offset);
5166 case FATTR4_FILES_AVAIL:
5167 attr_vals_offset = dissect_rpc_uint64(tvb,
5168 attr_newftree, hf_nfs_fattr4_files_avail,
5172 case FATTR4_FILEHANDLE:
5173 attr_vals_offset = dissect_nfs_fh4(tvb, attr_vals_offset,
5174 pinfo, attr_newftree, "fattr4_filehandle");
5177 case FATTR4_FILES_FREE:
5178 attr_vals_offset = dissect_rpc_uint64(tvb,
5179 attr_newftree, hf_nfs_fattr4_files_free, attr_vals_offset);
5182 case FATTR4_FILES_TOTAL:
5183 attr_vals_offset = dissect_rpc_uint64(tvb,
5184 attr_newftree, hf_nfs_fattr4_files_total,
5188 case FATTR4_FS_LOCATIONS:
5189 attr_vals_offset = dissect_nfs_fs_locations4(tvb, pinfo,
5190 attr_vals_offset, attr_newftree,
5191 "fattr4_fs_locations");
5195 attr_vals_offset = dissect_rpc_bool(tvb,
5196 attr_newftree, hf_nfs_fattr4_hidden, attr_vals_offset);
5199 case FATTR4_HOMOGENEOUS:
5200 attr_vals_offset = dissect_rpc_bool(tvb,
5201 attr_newftree, hf_nfs_fattr4_homogeneous,
5205 case FATTR4_MAXFILESIZE:
5206 attr_vals_offset = dissect_rpc_uint64(tvb,
5207 attr_newftree, hf_nfs_fattr4_maxfilesize,
5211 case FATTR4_MAXLINK:
5212 attr_vals_offset = dissect_rpc_uint32(tvb,
5213 attr_newftree, hf_nfs_fattr4_maxlink, attr_vals_offset);
5216 case FATTR4_MAXNAME:
5217 attr_vals_offset = dissect_rpc_uint32(tvb,
5218 attr_newftree, hf_nfs_fattr4_maxname, attr_vals_offset);
5221 case FATTR4_MAXREAD:
5222 attr_vals_offset = dissect_rpc_uint64(tvb,
5223 attr_newftree, hf_nfs_fattr4_maxread, attr_vals_offset);
5226 case FATTR4_MAXWRITE:
5227 attr_vals_offset = dissect_rpc_uint64(tvb,
5228 attr_newftree, hf_nfs_fattr4_maxwrite, attr_vals_offset);
5231 case FATTR4_MIMETYPE:
5232 attr_vals_offset = dissect_nfs_utf8string(tvb,
5233 attr_vals_offset, attr_newftree,
5234 hf_nfs_fattr4_mimetype, NULL);
5238 attr_vals_offset = dissect_nfs_mode4(tvb,
5239 attr_vals_offset, attr_newftree, "fattr4_mode");
5242 case FATTR4_NO_TRUNC:
5243 attr_vals_offset = dissect_rpc_bool(tvb,
5244 attr_newftree, hf_nfs_fattr4_no_trunc, attr_vals_offset);
5247 case FATTR4_NUMLINKS:
5248 attr_vals_offset = dissect_rpc_uint32(tvb,
5249 attr_newftree, hf_nfs_fattr4_numlinks, attr_vals_offset);
5253 attr_vals_offset = dissect_nfs_utf8string(tvb,
5254 attr_vals_offset, attr_newftree,
5255 hf_nfs_fattr4_owner,
5259 case FATTR4_OWNER_GROUP:
5260 attr_vals_offset = dissect_nfs_utf8string(tvb,
5261 attr_vals_offset, attr_newftree,
5262 hf_nfs_fattr4_owner_group, NULL);
5265 case FATTR4_QUOTA_AVAIL_HARD:
5266 attr_vals_offset = dissect_rpc_uint64(tvb,
5267 attr_newftree, hf_nfs_fattr4_quota_hard, attr_vals_offset);
5270 case FATTR4_QUOTA_AVAIL_SOFT:
5271 attr_vals_offset = dissect_rpc_uint64(tvb,
5272 attr_newftree, hf_nfs_fattr4_quota_soft, attr_vals_offset);
5275 case FATTR4_QUOTA_USED:
5276 attr_vals_offset = dissect_rpc_uint64(tvb,
5277 attr_newftree, hf_nfs_fattr4_quota_used, attr_vals_offset);
5281 attr_vals_offset = dissect_nfs_specdata4(tvb,
5282 attr_vals_offset, attr_newftree);
5285 case FATTR4_SPACE_AVAIL:
5286 attr_vals_offset = dissect_rpc_uint64(tvb,
5287 attr_newftree, hf_nfs_fattr4_space_avail,
5291 case FATTR4_SPACE_FREE:
5292 attr_vals_offset = dissect_rpc_uint64(tvb,
5293 attr_newftree, hf_nfs_fattr4_space_free, attr_vals_offset);
5296 case FATTR4_SPACE_TOTAL:
5297 attr_vals_offset = dissect_rpc_uint64(tvb,
5298 attr_newftree, hf_nfs_fattr4_space_total,
5302 case FATTR4_SPACE_USED:
5303 attr_vals_offset = dissect_rpc_uint64(tvb,
5304 attr_newftree, hf_nfs_fattr4_space_used, attr_vals_offset);
5308 attr_vals_offset = dissect_rpc_bool(tvb,
5309 attr_newftree, hf_nfs_fattr4_system, attr_vals_offset);
5312 case FATTR4_TIME_ACCESS:
5313 case FATTR4_TIME_BACKUP:
5314 case FATTR4_TIME_CREATE:
5315 case FATTR4_TIME_DELTA:
5316 case FATTR4_TIME_METADATA:
5317 case FATTR4_TIME_MODIFY:
5318 attr_vals_offset = dissect_nfs_nfstime4(tvb, attr_vals_offset,
5322 case FATTR4_TIME_ACCESS_SET:
5323 case FATTR4_TIME_MODIFY_SET:
5324 attr_vals_offset = dissect_nfs_settime4(tvb,
5325 attr_vals_offset, attr_newftree, "settime4");
5346 dissect_nfs_fattr4(tvbuff_t *tvb, int offset, packet_info *pinfo,
5349 proto_tree *newftree = NULL;
5350 proto_item *fitem = NULL;
5352 fitem = proto_tree_add_text(tree, tvb, offset, 4, "obj_attributes");
5354 if (fitem == NULL) return offset;
5356 newftree = proto_item_add_subtree(fitem, ett_nfs_fattr4);
5358 if (newftree == NULL) return offset;
5360 offset = dissect_nfs_attributes(tvb, offset, pinfo, newftree,
5361 FATTR4_FULL_DISSECT);
5363 offset = dissect_nfsdata(tvb, offset, tree, hf_nfs_attrlist4);
5368 static const value_string names_open4_share_access[] = {
5369 #define OPEN4_SHARE_ACCESS_READ 0x00000001
5370 { OPEN4_SHARE_ACCESS_READ, "OPEN4_SHARE_ACCESS_READ" },
5371 #define OPEN4_SHARE_ACCESS_WRITE 0x00000002
5372 { OPEN4_SHARE_ACCESS_WRITE, "OPEN4_SHARE_ACCESS_WRITE" },
5373 #define OPEN4_SHARE_ACCESS_BOTH 0x00000003
5374 { OPEN4_SHARE_ACCESS_BOTH, "OPEN4_SHARE_ACCESS_BOTH" },
5379 dissect_nfs_open4_share_access(tvbuff_t *tvb, int offset,
5384 share_access = tvb_get_ntohl(tvb, offset);
5385 proto_tree_add_uint(tree, hf_nfs_open4_share_access, tvb, offset, 4,
5392 static const value_string names_open4_share_deny[] = {
5393 #define OPEN4_SHARE_DENY_NONE 0x00000000
5394 { OPEN4_SHARE_DENY_NONE, "OPEN4_SHARE_DENY_NONE" },
5395 #define OPEN4_SHARE_DENY_READ 0x00000001
5396 { OPEN4_SHARE_DENY_READ, "OPEN4_SHARE_DENY_READ" },
5397 #define OPEN4_SHARE_DENY_WRITE 0x00000002
5398 { OPEN4_SHARE_DENY_WRITE, "OPEN4_SHARE_DENY_WRITE" },
5399 #define OPEN4_SHARE_DENY_BOTH 0x00000003
5400 { OPEN4_SHARE_DENY_BOTH, "OPEN4_SHARE_DENY_BOTH" },
5405 dissect_nfs_open4_share_deny(tvbuff_t *tvb, int offset,
5410 deny_access = tvb_get_ntohl(tvb, offset);
5411 proto_tree_add_uint(tree, hf_nfs_open4_share_deny, tvb, offset, 4,
5419 dissect_nfs_open_owner4(tvbuff_t *tvb, int offset, proto_tree *tree)
5421 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_clientid4, offset);
5422 offset = dissect_nfsdata(tvb, offset, tree, hf_nfs_open_owner4);
5428 dissect_nfs_open_claim_delegate_cur4(tvbuff_t *tvb, int offset,
5431 offset = dissect_rpc_uint64(tvb, tree,
5432 hf_nfs_stateid4_delegate_stateid, offset);
5433 offset = dissect_nfs_utf8string(tvb, offset, tree, hf_nfs_component4, NULL);
5438 #define CLAIM_NULL 0
5439 #define CLAIM_PREVIOUS 1
5440 #define CLAIM_DELEGATE_CUR 2
5441 #define CLAIM_DELEGATE_PREV 3
5443 static const value_string names_claim_type4[] = {
5444 { CLAIM_NULL, "CLAIM_NULL" },
5445 { CLAIM_PREVIOUS, "CLAIM_PREVIOUS" },
5446 { CLAIM_DELEGATE_CUR, "CLAIM_DELEGATE_CUR" },
5447 { CLAIM_DELEGATE_PREV, "CLAIM_DELEGATE_PREV" },
5452 dissect_nfs_open_claim4(tvbuff_t *tvb, int offset,
5455 guint open_claim_type4;
5456 proto_item *fitem = NULL;
5457 proto_tree *newftree = NULL;
5459 open_claim_type4 = tvb_get_ntohl(tvb, offset);
5460 fitem = proto_tree_add_uint(tree, hf_nfs_open_claim_type4, tvb,
5461 offset+0, 4, open_claim_type4);
5465 newftree = proto_item_add_subtree(fitem, ett_nfs_open_claim4);
5469 switch(open_claim_type4)
5472 offset = dissect_nfs_utf8string(tvb, offset, newftree, hf_nfs_component4, NULL);
5475 case CLAIM_PREVIOUS:
5476 offset = dissect_rpc_uint32(tvb, newftree,
5477 hf_nfs_delegate_type, offset);
5480 case CLAIM_DELEGATE_CUR:
5481 offset = dissect_nfs_open_claim_delegate_cur4(tvb, offset,
5485 case CLAIM_DELEGATE_PREV:
5486 offset = dissect_nfs_utf8string(tvb, offset, newftree, hf_nfs_component4, NULL);
5499 dissect_nfs_createhow4(tvbuff_t *tvb, int offset, packet_info *pinfo,
5504 /* This is intentional; we're using the same flags as NFSv3 */
5505 mode = tvb_get_ntohl(tvb, offset);
5506 proto_tree_add_uint(tree, hf_nfs_createmode3, tvb, offset, 4, mode);
5511 case UNCHECKED: /* UNCHECKED4 */
5512 case GUARDED: /* GUARDED4 */
5513 offset = dissect_nfs_fattr4(tvb, offset, pinfo, tree);
5516 case EXCLUSIVE: /* EXCLUSIVE4 */
5517 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_verifier4, offset);
5527 #define OPEN4_NOCREATE 0
5528 #define OPEN4_CREATE 1
5529 static const value_string names_opentype4[] = {
5530 { OPEN4_NOCREATE, "OPEN4_NOCREATE" },
5531 { OPEN4_CREATE, "OPEN4_CREATE" },
5536 dissect_nfs_openflag4(tvbuff_t *tvb, int offset, packet_info *pinfo,
5540 proto_item *fitem = NULL;
5541 proto_tree *newftree = NULL;
5543 opentype4 = tvb_get_ntohl(tvb, offset);
5544 fitem = proto_tree_add_uint(tree, hf_nfs_opentype4, tvb,
5545 offset+0, 4, opentype4);
5549 newftree = proto_item_add_subtree(fitem, ett_nfs_opentype4);
5556 offset = dissect_nfs_createhow4(tvb, offset, pinfo, newftree);
5569 dissect_nfs_clientaddr4(tvbuff_t *tvb, int offset, proto_tree *tree)
5571 offset = dissect_nfsdata(tvb, offset, tree, hf_nfs_r_netid);
5572 offset = dissect_nfsdata(tvb, offset, tree, hf_nfs_r_addr);
5579 dissect_nfs_cb_client4(tvbuff_t *tvb, int offset, proto_tree *tree)
5581 proto_tree *cb_location = NULL;
5582 proto_item *fitem = NULL;
5584 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_cb_program, offset);
5586 fitem = proto_tree_add_text(tree, tvb, offset, 0, "cb_location");
5590 cb_location = proto_item_add_subtree(fitem, ett_nfs_clientaddr4);
5592 offset = dissect_nfs_clientaddr4(tvb, offset, cb_location);
5598 static const value_string names_stable_how4[] = {
5600 { UNSTABLE4, "UNSTABLE4" },
5601 #define DATA_SYNC4 1
5602 { DATA_SYNC4, "DATA_SYNC4" },
5603 #define FILE_SYNC4 2
5604 { FILE_SYNC4, "FILE_SYNC4" },
5609 dissect_nfs_stable_how4(tvbuff_t *tvb, int offset,
5610 proto_tree *tree, char *name)
5614 stable_how4 = tvb_get_ntohl(tvb, offset);
5615 proto_tree_add_uint_format(tree, hf_nfs_stable_how4, tvb,
5616 offset+0, 4, stable_how4, "%s: %s (%u)", name,
5617 val_to_str(stable_how4, names_stable_how4, "%u"), stable_how4);
5623 static const value_string names_nfsv4_operation[] = {
5624 { NFS4_OP_ACCESS, "ACCESS" },
5625 { NFS4_OP_CLOSE, "CLOSE" },
5626 { NFS4_OP_COMMIT, "COMMIT" },
5627 { NFS4_OP_CREATE, "CREATE" },
5628 { NFS4_OP_DELEGPURGE, "DELEGPURGE" },
5629 { NFS4_OP_DELEGRETURN, "DELEGRETURN" },
5630 { NFS4_OP_GETATTR, "GETATTR" },
5631 { NFS4_OP_GETFH, "GETFH" },
5632 { NFS4_OP_LINK, "LINK" },
5633 { NFS4_OP_LOCK, "LOCK" },
5634 { NFS4_OP_LOCKT, "LOCKT" },
5635 { NFS4_OP_LOCKU, "LOCKU" },
5636 { NFS4_OP_LOOKUP, "LOOKUP" },
5637 { NFS4_OP_LOOKUPP, "LOOKUPP" },
5638 { NFS4_OP_NVERIFY, "NVERIFY" },
5639 { NFS4_OP_OPEN, "OPEN" },
5640 { NFS4_OP_OPENATTR, "OPENATTR" },
5641 { NFS4_OP_OPEN_CONFIRM, "OPEN_CONFIRM" },
5642 { NFS4_OP_OPEN_DOWNGRADE, "OPEN_DOWNGRADE" },
5643 { NFS4_OP_PUTFH, "PUTFH" },
5644 { NFS4_OP_PUTPUBFH, "PUTPUBFH" },
5645 { NFS4_OP_PUTROOTFH, "PUTROOTFH" },
5646 { NFS4_OP_READ, "READ" },
5647 { NFS4_OP_READDIR, "READDIR" },
5648 { NFS4_OP_READLINK, "READLINK" },
5649 { NFS4_OP_REMOVE, "REMOVE" },
5650 { NFS4_OP_RENAME, "RENAME" },
5651 { NFS4_OP_RENEW, "RENEW" },
5652 { NFS4_OP_RESTOREFH, "RESTOREFH" },
5653 { NFS4_OP_SAVEFH, "SAVEFH" },
5654 { NFS4_OP_SECINFO, "SECINFO" },
5655 { NFS4_OP_SETATTR, "SETATTR" },
5656 { NFS4_OP_SETCLIENTID, "SETCLIENTID" },
5657 { NFS4_OP_SETCLIENTID_CONFIRM, "SETCLIENTID_CONFIRM" },
5658 { NFS4_OP_VERIFY, "VERIFY" },
5659 { NFS4_OP_WRITE, "WRITE" },
5663 gint *nfsv4_operation_ett[] =
5669 &ett_nfs_delegpurge4 ,
5670 &ett_nfs_delegreturn4 ,
5681 &ett_nfs_openattr4 ,
5682 &ett_nfs_open_confirm4 ,
5683 &ett_nfs_open_downgrade4 ,
5685 &ett_nfs_putpubfh4 ,
5686 &ett_nfs_putrootfh4 ,
5689 &ett_nfs_readlink4 ,
5693 &ett_nfs_restorefh4 ,
5697 &ett_nfs_setclientid4 ,
5698 &ett_nfs_setclientid_confirm4 ,
5704 dissect_nfs_entry4(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
5707 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_cookie4, offset);
5708 offset = dissect_nfs_utf8string(tvb, offset, tree, hf_nfs_component4, NULL);
5709 offset = dissect_nfs_fattr4(tvb, offset, pinfo, tree);
5715 dissect_nfs_dirlist4(tvbuff_t *tvb, int offset, packet_info *pinfo,
5718 proto_tree *newftree = NULL;
5720 newftree = proto_item_add_subtree(tree, ett_nfs_dirlist4);
5721 if (newftree==NULL) return offset;
5723 offset = dissect_rpc_list(tvb, pinfo, tree, offset, dissect_nfs_entry4);
5724 offset = dissect_rpc_bool(tvb, newftree, hf_nfs_dirlist4_eof, offset);
5730 dissect_nfs_change_info4(tvbuff_t *tvb, int offset,
5731 proto_tree *tree, char *name)
5733 proto_tree *newftree = NULL;
5734 proto_tree *fitem = NULL;
5736 fitem = proto_tree_add_text(tree, tvb, offset, 0, "%s", name);
5739 newftree = proto_item_add_subtree(fitem, ett_nfs_change_info4);
5742 offset = dissect_rpc_bool(tvb, newftree,
5743 hf_nfs_change_info4_atomic, offset);
5744 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_changeid4_before,
5746 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_changeid4_after,
5754 static const value_string names_nfs_lock_type4[] =
5757 { READ_LT, "READ_LT" },
5759 { WRITE_LT, "WRITE_LT" },
5761 { READW_LT, "READW_LT" },
5763 { WRITEW_LT, "WRITEW_LT" },
5764 #define RELEASE_STATE 5
5765 { RELEASE_STATE, "RELEASE_STATE" },
5770 dissect_nfs_lock4denied(tvbuff_t *tvb, int offset, proto_tree *tree)
5772 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_offset4, offset);
5773 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_length4, offset);
5774 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_lock_type4, offset);
5775 offset = dissect_nfs_lock_owner4(tvb, offset, tree);
5781 static const value_string names_open4_result_flags[] = {
5782 #define OPEN4_RESULT_MLOCK 0x00000001
5783 { OPEN4_RESULT_MLOCK, "OPEN4_RESULT_MLOCK" },
5784 #define OPEN4_RESULT_CONFIRM 0x00000002
5785 { OPEN4_RESULT_CONFIRM, "OPEN4_RESULT_CONFIRM" },
5790 dissect_nfs_open4_rflags(tvbuff_t *tvb, int offset,
5791 proto_tree *tree, char *name)
5794 proto_item *rflags_item = NULL;
5795 proto_item *rflags_tree = NULL;
5797 rflags = tvb_get_ntohl(tvb, offset);
5801 rflags_item = proto_tree_add_text(tree, tvb, offset, 4,
5802 "%s: 0x%08x", name, rflags);
5806 rflags_tree = proto_item_add_subtree(rflags_item,
5807 ett_nfs_open4_result_flags);
5811 proto_tree_add_text(rflags_tree, tvb, offset, 4, "%s",
5812 decode_enumerated_bitfield(rflags, OPEN4_RESULT_MLOCK, 2,
5813 names_open4_result_flags, "%s"));
5815 proto_tree_add_text(rflags_tree, tvb, offset, 4, "%s",
5816 decode_enumerated_bitfield(rflags, OPEN4_RESULT_CONFIRM, 2,
5817 names_open4_result_flags, "%s"));
5828 dissect_nfs_stateid4(tvbuff_t *tvb, int offset,
5831 proto_item *fitem = NULL;
5832 proto_tree *newftree = NULL;
5835 gboolean first_line;
5837 fitem = proto_tree_add_text(tree, tvb, offset, 4, "stateid");
5840 newftree = proto_item_add_subtree(fitem, ett_nfs_stateid4);
5842 offset = dissect_rpc_uint32(tvb, newftree, hf_nfs_seqid4,
5848 while (bytes_left != 0)
5851 if (sublen > bytes_left)
5852 sublen = bytes_left;
5854 proto_tree_add_text(newftree, tvb, offset, sublen, "%s%s",
5855 first_line ? "other: " : " ",
5856 tvb_bytes_to_str(tvb, offset, sublen));
5858 bytes_left -= sublen;
5869 dissect_nfs_open_read_delegation4(tvbuff_t *tvb, int offset,
5870 packet_info *pinfo, proto_tree *tree)
5872 offset = dissect_nfs_stateid4(tvb, offset, tree);
5873 offset = dissect_rpc_bool(tvb, tree, hf_nfs_recall4, offset);
5874 offset = dissect_nfs_ace4(tvb, offset, pinfo, tree);
5880 dissect_nfs_modified_limit4(tvbuff_t *tvb, int offset, proto_tree *tree)
5882 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_num_blocks, offset);
5883 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_bytes_per_block, offset);
5888 #define NFS_LIMIT_SIZE 1
5889 #define NFS_LIMIT_BLOCKS 2
5890 static const value_string names_limit_by4[] = {
5891 { NFS_LIMIT_SIZE, "NFS_LIMIT_SIZE" },
5892 { NFS_LIMIT_BLOCKS, "NFS_LIMIT_BLOCKS" },
5897 dissect_nfs_space_limit4(tvbuff_t *tvb, int offset,
5902 limitby = tvb_get_ntohl(tvb, offset);
5903 proto_tree_add_uint(tree, hf_nfs_limit_by4, tvb, offset+0, 4, limitby);
5908 case NFS_LIMIT_SIZE:
5909 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_filesize,
5913 case NFS_LIMIT_BLOCKS:
5914 offset = dissect_nfs_modified_limit4(tvb, offset, tree);
5925 dissect_nfs_open_write_delegation4(tvbuff_t *tvb, int offset,
5926 packet_info *pinfo, proto_tree *tree)
5928 offset = dissect_nfs_stateid4(tvb, offset, tree);
5929 offset = dissect_rpc_bool(tvb, tree, hf_nfs_recall, offset);
5930 offset = dissect_nfs_space_limit4(tvb, offset, tree);
5931 offset = dissect_nfs_ace4(tvb, offset, pinfo, tree);
5936 #define OPEN_DELEGATE_NONE 0
5937 #define OPEN_DELEGATE_READ 1
5938 #define OPEN_DELEGATE_WRITE 2
5939 static const value_string names_open_delegation_type4[] = {
5940 { OPEN_DELEGATE_NONE, "OPEN_DELEGATE_NONE" },
5941 { OPEN_DELEGATE_READ, "OPEN_DELEGATE_READ" },
5942 { OPEN_DELEGATE_WRITE, "OPEN_DELEGATE_WRITE" },
5947 dissect_nfs_open_delegation4(tvbuff_t *tvb, int offset, packet_info *pinfo,
5950 guint delegation_type;
5951 proto_tree *newftree = NULL;
5952 proto_item *fitem = NULL;
5954 delegation_type = tvb_get_ntohl(tvb, offset);
5955 proto_tree_add_uint(tree, hf_nfs_open_delegation_type4, tvb, offset+0,
5956 4, delegation_type);
5960 newftree = proto_item_add_subtree(fitem, ett_nfs_open_delegation4);
5962 switch(delegation_type)
5964 case OPEN_DELEGATE_NONE:
5967 case OPEN_DELEGATE_READ:
5968 offset = dissect_nfs_open_read_delegation4(tvb, offset, pinfo,
5972 case OPEN_DELEGATE_WRITE:
5973 offset = dissect_nfs_open_write_delegation4(tvb, offset, pinfo,
5986 dissect_nfs_rpcsec_gss_info(tvbuff_t *tvb, int offset, proto_tree *tree)
5988 offset = dissect_nfsdata(tvb, offset, tree, hf_nfs_sec_oid4);
5989 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_qop4, offset);
5990 offset = dissect_rpc_uint32(tvb, tree,
5991 hf_nfs_secinfo_rpcsec_gss_info_service, offset);
5997 dissect_nfs_open_to_lock_owner4(tvbuff_t *tvb, int offset, proto_tree *tree)
5999 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_seqid4, offset);
6000 offset = dissect_nfs_stateid4(tvb, offset, tree);
6001 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_lock_seqid4, offset);
6002 offset = dissect_nfs_lock_owner4(tvb, offset, tree);
6008 dissect_nfs_exist_lock_owner4(tvbuff_t *tvb, int offset, proto_tree *tree)
6010 offset = dissect_nfs_stateid4(tvb, offset, tree);
6011 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_lock_seqid4, offset);
6017 dissect_nfs_locker4(tvbuff_t *tvb, int offset, proto_tree *tree)
6019 guint new_lock_owner;
6021 new_lock_owner = tvb_get_ntohl(tvb, offset);
6022 offset = dissect_rpc_bool(tvb, tree, hf_nfs_new_lock_owner, offset);
6025 offset = dissect_nfs_open_to_lock_owner4(tvb, offset, tree);
6027 offset = dissect_nfs_exist_lock_owner4(tvb, offset, tree);
6033 dissect_nfs_client_id4(tvbuff_t *tvb, int offset, proto_tree *tree)
6035 offset = dissect_rpc_uint64(tvb, tree, hf_nfs_verifier4, offset);
6036 offset = dissect_rpc_data(tvb, tree, hf_nfs_client_id4_id, offset);
6042 dissect_nfs_argop4(tvbuff_t *tvb, int offset, packet_info *pinfo,
6045 guint32 ops, ops_counter;
6048 proto_tree *ftree = NULL;
6049 proto_tree *newftree = NULL;
6051 ops = tvb_get_ntohl(tvb, offset+0);
6053 fitem = proto_tree_add_text(tree, tvb, offset, 4,
6054 "Operations (count: %u)", ops);
6057 if (fitem == NULL) return offset;
6059 ftree = proto_item_add_subtree(fitem, ett_nfs_argop4);
6061 if (ftree == NULL) return offset;
6063 for (ops_counter=0; ops_counter<ops; ops_counter++)
6065 opcode = tvb_get_ntohl(tvb, offset);
6067 fitem = proto_tree_add_uint(ftree, hf_nfs_argop4, tvb, offset, 4,
6071 if (opcode < NFS4_OP_ACCESS || opcode > NFS4_OP_WRITE)
6074 if (fitem == NULL) break;
6076 newftree = proto_item_add_subtree(fitem, *nfsv4_operation_ett[opcode-3]);
6077 if (newftree == NULL) break;
6081 case NFS4_OP_ACCESS:
6082 offset = dissect_access(tvb, offset, newftree, "access");
6086 offset = dissect_rpc_uint32(tvb, newftree, hf_nfs_seqid4,
6088 offset = dissect_nfs_stateid4(tvb, offset, newftree);
6091 case NFS4_OP_COMMIT:
6092 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_offset4,
6094 offset = dissect_rpc_uint32(tvb, newftree, hf_nfs_count4,
6098 case NFS4_OP_CREATE:
6102 create_type = tvb_get_ntohl(tvb, offset);
6103 offset = dissect_rpc_uint32(tvb, newftree, hf_nfs_ftype4,
6109 offset = dissect_nfs_utf8string(tvb, offset, newftree,
6110 hf_nfs_linktext4, NULL);
6115 offset = dissect_nfs_specdata4(tvb, offset, newftree);
6127 offset = dissect_nfs_utf8string(tvb, offset, newftree, hf_nfs_component4, NULL);
6129 offset = dissect_nfs_fattr4(tvb, offset, pinfo, newftree);
6133 case NFS4_OP_DELEGPURGE:
6134 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_clientid4, offset);
6137 case NFS4_OP_DELEGRETURN:
6138 offset = dissect_nfs_stateid4(tvb, offset, newftree);
6141 case NFS4_OP_GETATTR:
6142 offset = dissect_nfs_attributes(tvb, offset, pinfo, newftree,
6143 FATTR4_BITMAP_ONLY);
6150 offset = dissect_nfs_utf8string(tvb, offset, newftree,
6151 hf_nfs_component4, NULL);
6155 offset = dissect_rpc_uint32(tvb, newftree, hf_nfs_lock_type4, offset);
6156 offset = dissect_rpc_bool(tvb, newftree, hf_nfs_lock4_reclaim, offset);
6157 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_offset4, offset);
6158 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_length4, offset);
6159 offset = dissect_nfs_locker4(tvb, offset, newftree);
6163 offset = dissect_rpc_uint32(tvb, newftree, hf_nfs_lock_type4, offset);
6164 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_offset4, offset);
6165 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_length4, offset);
6166 offset = dissect_nfs_lock_owner4(tvb, offset, newftree);
6170 offset = dissect_rpc_uint32(tvb, newftree, hf_nfs_lock_type4, offset);
6171 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_seqid4, offset);
6172 offset = dissect_nfs_stateid4(tvb, offset, newftree);
6173 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_offset4, offset);
6174 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_length4, offset);
6177 case NFS4_OP_LOOKUP:
6178 offset = dissect_nfs_utf8string(tvb, offset, newftree,
6179 hf_nfs_component4, NULL);
6182 case NFS4_OP_LOOKUPP:
6185 case NFS4_OP_NVERIFY:
6186 offset = dissect_nfs_fattr4(tvb, offset, pinfo, newftree);
6190 offset = dissect_rpc_uint32(tvb, newftree, hf_nfs_seqid4,
6192 offset = dissect_nfs_open4_share_access(tvb, offset, newftree);
6193 offset = dissect_nfs_open4_share_deny(tvb, offset, newftree);
6194 offset = dissect_nfs_open_owner4(tvb, offset, newftree);
6195 offset = dissect_nfs_openflag4(tvb, offset, pinfo, newftree);
6196 offset = dissect_nfs_open_claim4(tvb, offset, newftree);
6199 case NFS4_OP_OPENATTR:
6200 offset = dissect_rpc_bool(tvb, newftree, hf_nfs_attrdircreate,
6204 case NFS4_OP_OPEN_CONFIRM:
6205 offset = dissect_nfs_stateid4(tvb, offset, newftree);
6206 offset = dissect_rpc_uint32(tvb, newftree, hf_nfs_seqid4,
6210 case NFS4_OP_OPEN_DOWNGRADE:
6211 offset = dissect_nfs_stateid4(tvb, offset, newftree);
6212 offset = dissect_rpc_uint32(tvb, newftree, hf_nfs_seqid4,
6214 offset = dissect_nfs_open4_share_access(tvb, offset, newftree);
6215 offset = dissect_nfs_open4_share_deny(tvb, offset, newftree);
6219 offset = dissect_nfs_fh4(tvb, offset, pinfo, newftree, "filehandle");
6222 case NFS4_OP_PUTPUBFH:
6223 case NFS4_OP_PUTROOTFH:
6227 offset = dissect_nfs_stateid4(tvb, offset, newftree);
6228 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_offset4,
6230 offset = dissect_rpc_uint32(tvb, newftree, hf_nfs_count4,
6234 case NFS4_OP_READDIR:
6235 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_cookie4,
6237 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_cookieverf4,
6239 offset = dissect_rpc_uint32(tvb, newftree,
6240 hf_nfs_count4_dircount, offset);
6241 offset = dissect_rpc_uint32(tvb, newftree,
6242 hf_nfs_count4_maxcount, offset);
6243 offset = dissect_nfs_attributes(tvb, offset, pinfo, newftree,
6244 FATTR4_BITMAP_ONLY);
6247 case NFS4_OP_READLINK:
6250 case NFS4_OP_REMOVE:
6251 offset = dissect_nfs_utf8string(tvb, offset, newftree,
6252 hf_nfs_component4, NULL);
6255 case NFS4_OP_RENAME:
6256 offset = dissect_nfs_utf8string(tvb, offset, newftree,
6257 hf_nfs_component4, NULL);
6258 offset = dissect_nfs_utf8string(tvb, offset, newftree,
6259 hf_nfs_component4, NULL);
6263 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_clientid4, offset);
6266 case NFS4_OP_RESTOREFH:
6267 case NFS4_OP_SAVEFH:
6270 case NFS4_OP_SECINFO:
6271 offset = dissect_nfs_utf8string(tvb, offset, newftree,
6272 hf_nfs_component4, NULL);
6275 case NFS4_OP_SETATTR:
6276 offset = dissect_nfs_stateid4(tvb, offset, newftree);
6277 offset = dissect_nfs_fattr4(tvb, offset, pinfo, newftree);
6280 case NFS4_OP_SETCLIENTID:
6282 proto_tree *client_tree = NULL;
6283 proto_tree *callback_tree = NULL;
6285 fitem = proto_tree_add_text(newftree, tvb, offset, 0, "client");
6288 client_tree = proto_item_add_subtree(fitem, ett_nfs_client_id4);
6291 offset = dissect_nfs_client_id4(tvb, offset, client_tree);
6294 fitem = proto_tree_add_text(newftree, tvb, offset, 0, "callback");
6297 callback_tree = proto_item_add_subtree(fitem,
6298 ett_nfs_cb_client4);
6301 offset = dissect_nfs_cb_client4(tvb, offset, callback_tree);
6304 offset = dissect_rpc_uint32(tvb, newftree, hf_nfs_callback_ident,
6309 case NFS4_OP_SETCLIENTID_CONFIRM:
6310 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_clientid4, offset);
6311 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_verifier4, offset);
6314 case NFS4_OP_VERIFY:
6315 offset = dissect_nfs_fattr4(tvb, offset, pinfo, newftree);
6319 offset = dissect_nfs_stateid4(tvb, offset, newftree);
6320 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_offset4, offset);
6321 offset = dissect_nfs_stable_how4(tvb, offset, newftree, "stable");
6322 offset = dissect_nfsdata(tvb, offset, newftree, hf_nfs_data);
6334 dissect_nfs4_compound_call(tvbuff_t *tvb, int offset, packet_info *pinfo,
6337 offset = dissect_nfs_utf8string(tvb, offset, tree, hf_nfs_tag4, NULL);
6338 offset = dissect_rpc_uint32(tvb, tree, hf_nfs_minorversion, offset);
6339 offset = dissect_nfs_argop4(tvb, offset, pinfo, tree);
6345 dissect_nfs_secinfo4_res(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
6350 proto_tree *secftree;
6352 flavor = tvb_get_ntohl(tvb, offset);
6353 fitem = proto_tree_add_uint(tree, hf_nfs_secinfo_flavor, tvb, offset, 4,
6362 secftree = proto_item_add_subtree(fitem, ett_nfs_secinfo4_flavor_info);
6364 offset = dissect_nfs_rpcsec_gss_info(tvb, offset, secftree);
6376 dissect_nfs_resop4(tvbuff_t *tvb, int offset, packet_info *pinfo,
6379 guint32 ops, ops_counter;
6382 proto_tree *ftree = NULL;
6383 proto_tree *newftree = NULL;
6386 ops = tvb_get_ntohl(tvb, offset+0);
6388 fitem = proto_tree_add_text(tree, tvb, offset, 4,
6389 "Operations (count: %u)", ops);
6392 if (fitem == NULL) return offset;
6394 ftree = proto_item_add_subtree(fitem, ett_nfs_resop4);
6396 if (ftree == NULL) return offset; /* error adding new subtree */
6398 for (ops_counter = 0; ops_counter < ops; ops_counter++)
6400 opcode = tvb_get_ntohl(tvb, offset);
6402 /* sanity check for bogus packets */
6403 if (opcode < NFS4_OP_ACCESS || opcode > NFS4_OP_WRITE) break;
6405 fitem = proto_tree_add_uint(ftree, hf_nfs_resop4, tvb, offset, 4,
6409 if (fitem == NULL) break; /* error adding new item to tree */
6411 newftree = proto_item_add_subtree(fitem, *nfsv4_operation_ett[opcode-3]);
6413 if (newftree == NULL)
6414 break; /* error adding new subtree to operation item */
6416 offset = dissect_nfs_nfsstat4(tvb, offset, newftree, &status);
6419 * With the exception of NFS4_OP_LOCK, NFS4_OP_LOCKT, and
6420 * NFS4_OP_SETATTR, all other ops do *not* return data with the
6421 * failed status code.
6423 if ((status != NFS4_OK) &&
6424 ((opcode != NFS4_OP_LOCK) && (opcode != NFS4_OP_LOCKT) &&
6425 (opcode != NFS4_OP_SETATTR)))
6428 /* These parsing routines are only executed if the status is NFS4_OK */
6431 case NFS4_OP_ACCESS:
6432 offset = dissect_access(tvb, offset, newftree, "Supported");
6433 offset = dissect_access(tvb, offset, newftree, "Access");
6437 offset = dissect_nfs_stateid4(tvb, offset, newftree);
6440 case NFS4_OP_COMMIT:
6441 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_verifier4,
6445 case NFS4_OP_CREATE:
6446 offset = dissect_nfs_change_info4(tvb, offset, newftree,
6448 offset = dissect_nfs_attributes(tvb, offset, pinfo, newftree,
6449 FATTR4_BITMAP_ONLY);
6452 case NFS4_OP_GETATTR:
6453 offset = dissect_nfs_fattr4(tvb, offset, pinfo, newftree);
6457 offset = dissect_nfs_fh4(tvb, offset, pinfo, newftree, "Filehandle");
6461 offset = dissect_nfs_change_info4(tvb, offset, newftree,
6467 if (status == NFS4_OK)
6469 if (opcode == NFS4_OP_LOCK)
6470 offset = dissect_nfs_stateid4(tvb, offset, newftree);
6473 if (status == NFS4ERR_DENIED)
6474 offset = dissect_nfs_lock4denied(tvb, offset, newftree);
6478 offset = dissect_nfs_stateid4(tvb, offset, newftree);
6482 offset = dissect_nfs_stateid4(tvb, offset, newftree);
6483 offset = dissect_nfs_change_info4(tvb, offset, newftree,
6485 offset = dissect_nfs_open4_rflags(tvb, offset, newftree,
6487 offset = dissect_nfs_attributes(tvb, offset, pinfo, newftree,
6488 FATTR4_BITMAP_ONLY);
6489 offset = dissect_nfs_open_delegation4(tvb, offset, pinfo, newftree);
6492 case NFS4_OP_OPEN_CONFIRM:
6493 case NFS4_OP_OPEN_DOWNGRADE:
6494 offset = dissect_nfs_stateid4(tvb, offset, newftree);
6498 offset = dissect_rpc_uint32(tvb, newftree, hf_nfs_eof, offset);
6499 offset = dissect_nfsdata(tvb, offset, newftree, hf_nfs_data);
6502 case NFS4_OP_READDIR:
6503 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_verifier4, offset);
6504 offset = dissect_nfs_dirlist4(tvb, offset, pinfo, newftree);
6507 case NFS4_OP_READLINK:
6508 offset = dissect_nfs_utf8string(tvb, offset, newftree,
6509 hf_nfs_linktext4, NULL);
6512 case NFS4_OP_REMOVE:
6513 offset = dissect_nfs_change_info4(tvb, offset, newftree,
6517 case NFS4_OP_RENAME:
6518 offset = dissect_nfs_change_info4(tvb, offset, newftree,
6520 offset = dissect_nfs_change_info4(tvb, offset, newftree,
6524 case NFS4_OP_SECINFO:
6525 offset = dissect_rpc_list(tvb, pinfo, tree, offset,
6526 dissect_nfs_secinfo4_res);
6529 case NFS4_OP_SETATTR:
6530 offset = dissect_nfs_attributes(tvb, offset, pinfo, newftree,
6531 FATTR4_BITMAP_ONLY);
6534 case NFS4_OP_SETCLIENTID:
6535 if (status == NFS4_OK)
6537 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_clientid4,
6539 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_verifier4,
6543 if (status == NFS4ERR_CLID_INUSE)
6544 offset = dissect_nfs_clientaddr4(tvb, offset, newftree);
6548 offset = dissect_rpc_uint32(tvb, newftree, hf_nfs_count4,
6550 offset = dissect_nfs_stable_how4(tvb, offset, newftree,
6552 offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_verifier4,
6565 dissect_nfs4_compound_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
6570 offset = dissect_nfs_nfsstat4(tvb, offset, tree, &status);
6571 offset = dissect_nfs_utf8string(tvb, offset, tree, hf_nfs_tag4, NULL);
6572 offset = dissect_nfs_resop4(tvb, offset, pinfo, tree);
6578 /* proc number, "proc name", dissect_request, dissect_reply */
6579 /* NULL as function pointer means: type of arguments is "void". */
6580 static const vsff nfs3_proc[] = {
6581 { 0, "NULL", /* OK */
6583 { 1, "GETATTR", /* OK */
6584 dissect_nfs3_getattr_call, dissect_nfs3_getattr_reply },
6585 { 2, "SETATTR", /* OK */
6586 dissect_nfs3_setattr_call, dissect_nfs3_setattr_reply },
6587 { 3, "LOOKUP", /* OK */
6588 dissect_nfs3_lookup_call, dissect_nfs3_lookup_reply },
6589 { 4, "ACCESS", /* OK */
6590 dissect_nfs3_access_call, dissect_nfs3_access_reply },
6591 { 5, "READLINK", /* OK */
6592 dissect_nfs3_nfs_fh3_call, dissect_nfs3_readlink_reply },
6593 { 6, "READ", /* OK */
6594 dissect_nfs3_read_call, dissect_nfs3_read_reply },
6595 { 7, "WRITE", /* OK */
6596 dissect_nfs3_write_call, dissect_nfs3_write_reply },
6597 { 8, "CREATE", /* OK */
6598 dissect_nfs3_create_call, dissect_nfs3_create_reply },
6599 { 9, "MKDIR", /* OK */
6600 dissect_nfs3_mkdir_call, dissect_nfs3_create_reply },
6601 { 10, "SYMLINK", /* OK */
6602 dissect_nfs3_symlink_call, dissect_nfs3_create_reply },
6603 { 11, "MKNOD", /* OK */
6604 dissect_nfs3_mknod_call, dissect_nfs3_create_reply },
6605 { 12, "REMOVE", /* OK */
6606 dissect_nfs3_diropargs3_call, dissect_nfs3_remove_reply },
6607 { 13, "RMDIR", /* OK */
6608 dissect_nfs3_diropargs3_call, dissect_nfs3_remove_reply },
6609 { 14, "RENAME", /* OK */
6610 dissect_nfs3_rename_call, dissect_nfs3_rename_reply },
6611 { 15, "LINK", /* OK */
6612 dissect_nfs3_link_call, dissect_nfs3_link_reply },
6613 { 16, "READDIR", /* OK */
6614 dissect_nfs3_readdir_call, dissect_nfs3_readdir_reply },
6615 { 17, "READDIRPLUS", /* OK */
6616 dissect_nfs3_readdirplus_call, dissect_nfs3_readdirplus_reply },
6617 { 18, "FSSTAT", /* OK */
6618 dissect_nfs3_nfs_fh3_call, dissect_nfs3_fsstat_reply },
6619 { 19, "FSINFO", /* OK */
6620 dissect_nfs3_nfs_fh3_call, dissect_nfs3_fsinfo_reply },
6621 { 20, "PATHCONF", /* OK */
6622 dissect_nfs3_nfs_fh3_call, dissect_nfs3_pathconf_reply },
6623 { 21, "COMMIT", /* OK */
6624 dissect_nfs3_commit_call, dissect_nfs3_commit_reply },
6625 { 0,NULL,NULL,NULL }
6627 /* end of NFS Version 3 */
6629 static const vsff nfs4_proc[] = {
6633 dissect_nfs4_compound_call, dissect_nfs4_compound_reply },
6634 { 0, NULL, NULL, NULL }
6638 static struct true_false_string yesno = { "Yes", "No" };
6642 proto_register_nfs(void)
6644 static hf_register_info hf[] = {
6645 { &hf_nfs_fh_length, {
6646 "length", "nfs.fh.length", FT_UINT32, BASE_DEC,
6647 NULL, 0, "file handle length", HFILL }},
6648 { &hf_nfs_fh_hash, {
6649 "hash", "nfs.fh.hash", FT_UINT32, BASE_HEX,
6650 NULL, 0, "file handle hash", HFILL }},
6651 { &hf_nfs_fh_fsid_major, {
6652 "major", "nfs.fh.fsid.major", FT_UINT32, BASE_DEC,
6653 NULL, 0, "major file system ID", HFILL }},
6654 { &hf_nfs_fh_fsid_minor, {
6655 "minor", "nfs.fh.fsid.minor", FT_UINT32, BASE_DEC,
6656 NULL, 0, "minor file system ID", HFILL }},
6657 { &hf_nfs_fh_fsid_inode, {
6658 "inode", "nfs.fh.fsid.inode", FT_UINT32, BASE_DEC,
6659 NULL, 0, "file system inode", HFILL }},
6660 { &hf_nfs_fh_xfsid_major, {
6661 "exported major", "nfs.fh.xfsid.major", FT_UINT32, BASE_DEC,
6662 NULL, 0, "exported major file system ID", HFILL }},
6663 { &hf_nfs_fh_xfsid_minor, {
6664 "exported minor", "nfs.fh.xfsid.minor", FT_UINT32, BASE_DEC,
6665 NULL, 0, "exported minor file system ID", HFILL }},
6666 { &hf_nfs_fh_fstype, {
6667 "file system type", "nfs.fh.fstype", FT_UINT32, BASE_DEC,
6668 NULL, 0, "file system type", HFILL }},
6670 "file number", "nfs.fh.fn", FT_UINT32, BASE_DEC,
6671 NULL, 0, "file number", HFILL }},
6672 { &hf_nfs_fh_fn_len, {
6673 "length", "nfs.fh.fn.len", FT_UINT32, BASE_DEC,
6674 NULL, 0, "file number length", HFILL }},
6675 { &hf_nfs_fh_fn_inode, {
6676 "inode", "nfs.fh.fn.inode", FT_UINT32, BASE_DEC,
6677 NULL, 0, "file number inode", HFILL }},
6678 { &hf_nfs_fh_fn_generation, {
6679 "generation", "nfs.fh.fn.generation", FT_UINT32, BASE_DEC,
6680 NULL, 0, "file number generation", HFILL }},
6682 "exported file number", "nfs.fh.xfn", FT_UINT32, BASE_DEC,
6683 NULL, 0, "exported file number", HFILL }},
6684 { &hf_nfs_fh_xfn_len, {
6685 "length", "nfs.fh.xfn.len", FT_UINT32, BASE_DEC,
6686 NULL, 0, "exported file number length", HFILL }},
6687 { &hf_nfs_fh_xfn_inode, {
6688 "exported inode", "nfs.fh.xfn.inode", FT_UINT32, BASE_DEC,
6689 NULL, 0, "exported file number inode", HFILL }},
6690 { &hf_nfs_fh_xfn_generation, {
6691 "generation", "nfs.fh.xfn.generation", FT_UINT32, BASE_DEC,
6692 NULL, 0, "exported file number generation", HFILL }},
6693 { &hf_nfs_fh_dentry, {
6694 "dentry", "nfs.fh.dentry", FT_UINT32, BASE_HEX,
6695 NULL, 0, "dentry (cookie)", HFILL }},
6697 "device", "nfs.fh.dev", FT_UINT32, BASE_DEC,
6698 NULL, 0, "device", HFILL }},
6699 { &hf_nfs_fh_xdev, {
6700 "exported device", "nfs.fh.xdev", FT_UINT32, BASE_DEC,
6701 NULL, 0, "exported device", HFILL }},
6702 { &hf_nfs_fh_dirinode, {
6703 "directory inode", "nfs.fh.dirinode", FT_UINT32, BASE_DEC,
6704 NULL, 0, "directory inode", HFILL }},
6705 { &hf_nfs_fh_pinode, {
6706 "pseudo inode", "nfs.fh.pinode", FT_UINT32, BASE_HEX,
6707 NULL, 0, "pseudo inode", HFILL }},
6708 { &hf_nfs_fh_hp_len, {
6709 "length", "nfs.fh.hp.len", FT_UINT32, BASE_DEC,
6710 NULL, 0, "hash path length", HFILL }},
6711 { &hf_nfs_fh_version, {
6712 "version", "nfs.fh.version", FT_UINT8, BASE_DEC,
6713 NULL, 0, "file handle layout version", HFILL }},
6714 { &hf_nfs_fh_auth_type, {
6715 "auth_type", "nfs.fh.auth_type", FT_UINT8, BASE_DEC,
6716 VALS(auth_type_names), 0, "authentication type", HFILL }},
6717 { &hf_nfs_fh_fsid_type, {
6718 "fsid_type", "nfs.fh.fsid_type", FT_UINT8, BASE_DEC,
6719 VALS(fsid_type_names), 0, "file system ID type", HFILL }},
6720 { &hf_nfs_fh_fileid_type, {
6721 "fileid_type", "nfs.fh.fileid_type", FT_UINT8, BASE_DEC,
6722 VALS(fileid_type_names), 0, "file ID type", HFILL }},
6724 "Status", "nfs.status2", FT_UINT32, BASE_DEC,
6725 VALS(names_nfs_stat), 0, "Reply status", HFILL }},
6726 { &hf_nfs_full_name, {
6727 "Full Name", "nfs.full_name", FT_STRING, BASE_DEC,
6728 NULL, 0, "Full Name", HFILL }},
6730 "Name", "nfs.name", FT_STRING, BASE_DEC,
6731 NULL, 0, "Name", HFILL }},
6732 { &hf_nfs_readlink_data, {
6733 "Data", "nfs.readlink.data", FT_STRING, BASE_DEC,
6734 NULL, 0, "Symbolic Link Data", HFILL }},
6735 { &hf_nfs_read_offset, {
6736 "Offset", "nfs.read.offset", FT_UINT32, BASE_DEC,
6737 NULL, 0, "Read Offset", HFILL }},
6738 { &hf_nfs_read_count, {
6739 "Count", "nfs.read.count", FT_UINT32, BASE_DEC,
6740 NULL, 0, "Read Count", HFILL }},
6741 { &hf_nfs_read_totalcount, {
6742 "Total Count", "nfs.read.totalcount", FT_UINT32, BASE_DEC,
6743 NULL, 0, "Total Count (obsolete)", HFILL }},
6745 "Data", "nfs.data", FT_BYTES, BASE_DEC,
6746 NULL, 0, "Data", HFILL }},
6747 { &hf_nfs_write_beginoffset, {
6748 "Begin Offset", "nfs.write.beginoffset", FT_UINT32, BASE_DEC,
6749 NULL, 0, "Begin offset (obsolete)", HFILL }},
6750 { &hf_nfs_write_offset, {
6751 "Offset", "nfs.write.offset", FT_UINT32, BASE_DEC,
6752 NULL, 0, "Offset", HFILL }},
6753 { &hf_nfs_write_totalcount, {
6754 "Total Count", "nfs.write.totalcount", FT_UINT32, BASE_DEC,
6755 NULL, 0, "Total Count (obsolete)", HFILL }},
6756 { &hf_nfs_symlink_to, {
6757 "To", "nfs.symlink.to", FT_STRING, BASE_DEC,
6758 NULL, 0, "Symbolic link destination name", HFILL }},
6759 { &hf_nfs_readdir_cookie, {
6760 "Cookie", "nfs.readdir.cookie", FT_UINT32, BASE_DEC,
6761 NULL, 0, "Directory Cookie", HFILL }},
6762 { &hf_nfs_readdir_count, {
6763 "Count", "nfs.readdir.count", FT_UINT32, BASE_DEC,
6764 NULL, 0, "Directory Count", HFILL }},
6766 { &hf_nfs_readdir_entry, {
6767 "Entry", "nfs.readdir.entry", FT_NONE, 0,
6768 NULL, 0, "Directory Entry", HFILL }},
6770 { &hf_nfs_readdir_entry_fileid, {
6771 "File ID", "nfs.readdir.entry.fileid", FT_UINT32, BASE_DEC,
6772 NULL, 0, "File ID", HFILL }},
6774 { &hf_nfs_readdir_entry_name, {
6775 "Name", "nfs.readdir.entry.name", FT_STRING, BASE_DEC,
6776 NULL, 0, "Name", HFILL }},
6778 { &hf_nfs_readdir_entry_cookie, {
6779 "Cookie", "nfs.readdir.entry.cookie", FT_UINT32, BASE_DEC,
6780 NULL, 0, "Directory Cookie", HFILL }},
6782 { &hf_nfs_readdir_entry3_fileid, {
6783 "File ID", "nfs.readdir.entry3.fileid", FT_UINT64, BASE_DEC,
6784 NULL, 0, "File ID", HFILL }},
6786 { &hf_nfs_readdir_entry3_name, {
6787 "Name", "nfs.readdir.entry3.name", FT_STRING, BASE_DEC,
6788 NULL, 0, "Name", HFILL }},
6790 { &hf_nfs_readdir_entry3_cookie, {
6791 "Cookie", "nfs.readdir.entry3.cookie", FT_UINT64, BASE_DEC,
6792 NULL, 0, "Directory Cookie", HFILL }},
6794 { &hf_nfs_readdirplus_entry_fileid, {
6795 "File ID", "nfs.readdirplus.entry.fileid", FT_UINT64, BASE_DEC,
6796 NULL, 0, "Name", HFILL }},
6798 { &hf_nfs_readdirplus_entry_name, {
6799 "Name", "nfs.readdirplus.entry.name", FT_STRING, BASE_DEC,
6800 NULL, 0, "Name", HFILL }},
6802 { &hf_nfs_readdirplus_entry_cookie, {
6803 "Cookie", "nfs.readdirplus.entry.cookie", FT_UINT64, BASE_DEC,
6804 NULL, 0, "Directory Cookie", HFILL }},
6806 { &hf_nfs_readdir_eof, {
6807 "EOF", "nfs.readdir.eof", FT_UINT32, BASE_DEC,
6808 NULL, 0, "EOF", HFILL }},
6810 { &hf_nfs_statfs_tsize, {
6811 "Transfer Size", "nfs.statfs.tsize", FT_UINT32, BASE_DEC,
6812 NULL, 0, "Transfer Size", HFILL }},
6813 { &hf_nfs_statfs_bsize, {
6814 "Block Size", "nfs.statfs.bsize", FT_UINT32, BASE_DEC,
6815 NULL, 0, "Block Size", HFILL }},
6816 { &hf_nfs_statfs_blocks, {
6817 "Total Blocks", "nfs.statfs.blocks", FT_UINT32, BASE_DEC,
6818 NULL, 0, "Total Blocks", HFILL }},
6819 { &hf_nfs_statfs_bfree, {
6820 "Free Blocks", "nfs.statfs.bfree", FT_UINT32, BASE_DEC,
6821 NULL, 0, "Free Blocks", HFILL }},
6822 { &hf_nfs_statfs_bavail, {
6823 "Available Blocks", "nfs.statfs.bavail", FT_UINT32, BASE_DEC,
6824 NULL, 0, "Available Blocks", HFILL }},
6826 "Type", "nfs.type", FT_UINT32, BASE_DEC,
6827 VALS(names_nfs_ftype3), 0, "File Type", HFILL }},
6828 { &hf_nfs_nfsstat3, {
6829 "Status", "nfs.status", FT_UINT32, BASE_DEC,
6830 VALS(names_nfs_nfsstat3), 0, "Reply status", HFILL }},
6831 { &hf_nfs_read_eof, {
6832 "EOF", "nfs.read.eof", FT_BOOLEAN, BASE_NONE,
6833 &yesno, 0, "EOF", HFILL }},
6834 { &hf_nfs_write_stable, {
6835 "Stable", "nfs.write.stable", FT_UINT32, BASE_DEC,
6836 VALS(names_stable_how), 0, "Stable", HFILL }},
6837 { &hf_nfs_write_committed, {
6838 "Committed", "nfs.write.committed", FT_UINT32, BASE_DEC,
6839 VALS(names_stable_how), 0, "Committed", HFILL }},
6840 { &hf_nfs_createmode3, {
6841 "Create Mode", "nfs.createmode", FT_UINT32, BASE_DEC,
6842 VALS(names_createmode3), 0, "Create Mode", HFILL }},
6843 { &hf_nfs_fsstat_invarsec, {
6844 "invarsec", "nfs.fsstat.invarsec", FT_UINT32, BASE_DEC,
6845 NULL, 0, "probable number of seconds of file system invariance", HFILL }},
6846 { &hf_nfs_fsinfo_rtmax, {
6847 "rtmax", "nfs.fsinfo.rtmax", FT_UINT32, BASE_DEC,
6848 NULL, 0, "maximum READ request", HFILL }},
6849 { &hf_nfs_fsinfo_rtpref, {
6850 "rtpref", "nfs.fsinfo.rtpref", FT_UINT32, BASE_DEC,
6851 NULL, 0, "Preferred READ request size", HFILL }},
6852 { &hf_nfs_fsinfo_rtmult, {
6853 "rtmult", "nfs.fsinfo.rtmult", FT_UINT32, BASE_DEC,
6854 NULL, 0, "Suggested READ multiple", HFILL }},
6855 { &hf_nfs_fsinfo_wtmax, {
6856 "wtmax", "nfs.fsinfo.wtmax", FT_UINT32, BASE_DEC,
6857 NULL, 0, "Maximum WRITE request size", HFILL }},
6858 { &hf_nfs_fsinfo_wtpref, {
6859 "wtpref", "nfs.fsinfo.wtpref", FT_UINT32, BASE_DEC,
6860 NULL, 0, "Preferred WRITE request size", HFILL }},
6861 { &hf_nfs_fsinfo_wtmult, {
6862 "wtmult", "nfs.fsinfo.wtmult", FT_UINT32, BASE_DEC,
6863 NULL, 0, "Suggested WRITE multiple", HFILL }},
6864 { &hf_nfs_fsinfo_dtpref, {
6865 "dtpref", "nfs.fsinfo.dtpref", FT_UINT32, BASE_DEC,
6866 NULL, 0, "Preferred READDIR request", HFILL }},
6867 { &hf_nfs_fsinfo_maxfilesize, {
6868 "maxfilesize", "nfs.fsinfo.maxfilesize", FT_UINT64, BASE_DEC,
6869 NULL, 0, "Maximum file size", HFILL }},
6870 { &hf_nfs_fsinfo_properties, {
6871 "Properties", "nfs.fsinfo.propeties", FT_UINT32, BASE_HEX,
6872 NULL, 0, "File System Properties", HFILL }},
6873 { &hf_nfs_pathconf_linkmax, {
6874 "linkmax", "nfs.pathconf.linkmax", FT_UINT32, BASE_DEC,
6875 NULL, 0, "Maximum number of hard links", HFILL }},
6876 { &hf_nfs_pathconf_name_max, {
6877 "name_max", "nfs.pathconf.name_max", FT_UINT32, BASE_DEC,
6878 NULL, 0, "Maximum file name length", HFILL }},
6879 { &hf_nfs_pathconf_no_trunc, {
6880 "no_trunc", "nfs.pathconf.no_trunc", FT_BOOLEAN, BASE_NONE,
6881 &yesno, 0, "No long file name truncation", HFILL }},
6882 { &hf_nfs_pathconf_chown_restricted, {
6883 "chown_restricted", "nfs.pathconf.chown_restricted", FT_BOOLEAN,
6884 BASE_NONE, &yesno, 0, "chown is restricted to root", HFILL }},
6885 { &hf_nfs_pathconf_case_insensitive, {
6886 "case_insensitive", "nfs.pathconf.case_insensitive", FT_BOOLEAN,
6887 BASE_NONE, &yesno, 0, "file names are treated case insensitive", HFILL }},
6888 { &hf_nfs_pathconf_case_preserving, {
6889 "case_preserving", "nfs.pathconf.case_preserving", FT_BOOLEAN,
6890 BASE_NONE, &yesno, 0, "file name cases are preserved", HFILL }},
6892 { &hf_nfs_fattr_type, {
6893 "type", "nfs.fattr.type", FT_UINT32, BASE_DEC,
6894 NULL, 0, "nfs.fattr.type", HFILL }},
6896 { &hf_nfs_fattr_nlink, {
6897 "nlink", "nfs.fattr.nlink", FT_UINT32, BASE_DEC,
6898 NULL, 0, "nfs.fattr.nlink", HFILL }},
6900 { &hf_nfs_fattr_uid, {
6901 "uid", "nfs.fattr.uid", FT_UINT32, BASE_DEC,
6902 NULL, 0, "nfs.fattr.uid", HFILL }},
6904 { &hf_nfs_fattr_gid, {
6905 "gid", "nfs.fattr.gid", FT_UINT32, BASE_DEC,
6906 NULL, 0, "nfs.fattr.gid", HFILL }},
6908 { &hf_nfs_fattr_size, {
6909 "size", "nfs.fattr.size", FT_UINT32, BASE_DEC,
6910 NULL, 0, "nfs.fattr.size", HFILL }},
6912 { &hf_nfs_fattr_blocksize, {
6913 "blocksize", "nfs.fattr.blocksize", FT_UINT32, BASE_DEC,
6914 NULL, 0, "nfs.fattr.blocksize", HFILL }},
6916 { &hf_nfs_fattr_rdev, {
6917 "rdev", "nfs.fattr.rdev", FT_UINT32, BASE_DEC,
6918 NULL, 0, "nfs.fattr.rdev", HFILL }},
6920 { &hf_nfs_fattr_blocks, {
6921 "blocks", "nfs.fattr.blocks", FT_UINT32, BASE_DEC,
6922 NULL, 0, "nfs.fattr.blocks", HFILL }},
6924 { &hf_nfs_fattr_fsid, {
6925 "fsid", "nfs.fattr.fsid", FT_UINT32, BASE_DEC,
6926 NULL, 0, "nfs.fattr.fsid", HFILL }},
6928 { &hf_nfs_fattr_fileid, {
6929 "fileid", "nfs.fattr.fileid", FT_UINT32, BASE_DEC,
6930 NULL, 0, "nfs.fattr.fileid", HFILL }},
6932 { &hf_nfs_fattr3_type, {
6933 "Type", "nfs.fattr3.type", FT_UINT32, BASE_DEC,
6934 VALS(names_nfs_ftype3), 0, "nfs.fattr3.type", HFILL }},
6936 { &hf_nfs_fattr3_nlink, {
6937 "nlink", "nfs.fattr3.nlink", FT_UINT32, BASE_DEC,
6938 NULL, 0, "nfs.fattr3.nlink", HFILL }},
6940 { &hf_nfs_fattr3_uid, {
6941 "uid", "nfs.fattr3.uid", FT_UINT32, BASE_DEC,
6942 NULL, 0, "nfs.fattr3.uid", HFILL }},
6944 { &hf_nfs_fattr3_gid, {
6945 "gid", "nfs.fattr3.gid", FT_UINT32, BASE_DEC,
6946 NULL, 0, "nfs.fattr3.gid", HFILL }},
6948 { &hf_nfs_fattr3_size, {
6949 "size", "nfs.fattr3.size", FT_UINT64, BASE_DEC,
6950 NULL, 0, "nfs.fattr3.size", HFILL }},
6952 { &hf_nfs_fattr3_used, {
6953 "used", "nfs.fattr3.used", FT_UINT64, BASE_DEC,
6954 NULL, 0, "nfs.fattr3.used", HFILL }},
6956 { &hf_nfs_fattr3_rdev, {
6957 "rdev", "nfs.fattr3.rdev", FT_UINT32, BASE_DEC,
6958 NULL, 0, "nfs.fattr3.rdev", HFILL }},
6960 { &hf_nfs_fattr3_fsid, {
6961 "fsid", "nfs.fattr3.fsid", FT_UINT64, BASE_DEC,
6962 NULL, 0, "nfs.fattr3.fsid", HFILL }},
6964 { &hf_nfs_fattr3_fileid, {
6965 "fileid", "nfs.fattr3.fileid", FT_UINT64, BASE_DEC,
6966 NULL, 0, "nfs.fattr3.fileid", HFILL }},
6968 { &hf_nfs_wcc_attr_size, {
6969 "size", "nfs.wcc_attr.size", FT_UINT64, BASE_DEC,
6970 NULL, 0, "nfs.wcc_attr.size", HFILL }},
6972 { &hf_nfs_set_size3_size, {
6973 "size", "nfs.set_size3.size", FT_UINT64, BASE_DEC,
6974 NULL, 0, "nfs.set_size3.size", HFILL }},
6977 "uid", "nfs.uid3", FT_UINT32, BASE_DEC,
6978 NULL, 0, "nfs.uid3", HFILL }},
6981 "gid", "nfs.gid3", FT_UINT32, BASE_DEC,
6982 NULL, 0, "nfs.gid3", HFILL }},
6984 { &hf_nfs_cookie3, {
6985 "cookie", "nfs.cookie3", FT_UINT64, BASE_DEC,
6986 NULL, 0, "nfs.cookie3", HFILL }},
6988 { &hf_nfs_offset3, {
6989 "offset", "nfs.offset3", FT_UINT64, BASE_DEC,
6990 NULL, 0, "nfs.offset3", HFILL }},
6993 "count", "nfs.count3", FT_UINT32, BASE_DEC,
6994 NULL, 0, "nfs.count3", HFILL }},
6996 { &hf_nfs_count3_maxcount, {
6997 "maxcount", "nfs.count3_maxcount", FT_UINT32, BASE_DEC,
6998 NULL, 0, "nfs.count3_maxcount", HFILL }},
7000 { &hf_nfs_count3_dircount, {
7001 "dircount", "nfs.count3_dircount", FT_UINT32, BASE_DEC,
7002 NULL, 0, "nfs.count3_dircount", HFILL }},
7004 { &hf_nfs_fsstat3_resok_tbytes, {
7005 "Total bytes", "nfs.fsstat3_resok.tbytes", FT_UINT64, BASE_DEC,
7006 NULL, 0, "Total bytes", HFILL }},
7008 { &hf_nfs_fsstat3_resok_fbytes, {
7009 "Free bytes", "nfs.fsstat3_resok.fbytes", FT_UINT64, BASE_DEC,
7010 NULL, 0, "Free bytes", HFILL }},
7012 { &hf_nfs_fsstat3_resok_abytes, {
7013 "Available free bytes", "nfs.fsstat3_resok.abytes", FT_UINT64, BASE_DEC,
7014 NULL, 0, "Available free bytes", HFILL }},
7016 { &hf_nfs_fsstat3_resok_tfiles, {
7017 "Total file slots", "nfs.fsstat3_resok.tfiles", FT_UINT64, BASE_DEC,
7018 NULL, 0, "Total file slots", HFILL }},
7020 { &hf_nfs_fsstat3_resok_ffiles, {
7021 "Free file slots", "nfs.fsstat3_resok.ffiles", FT_UINT64, BASE_DEC,
7022 NULL, 0, "Free file slots", HFILL }},
7024 { &hf_nfs_fsstat3_resok_afiles, {
7025 "Available free file slots", "nfs.fsstat3_resok.afiles", FT_UINT64, BASE_DEC,
7026 NULL, 0, "Available free file slots", HFILL }},
7031 "Opcode", "nfs.call.operation", FT_UINT32, BASE_DEC,
7032 VALS(names_nfsv4_operation), 0, "Opcode", HFILL }},
7035 "Opcode", "nfs.reply.operation", FT_UINT32, BASE_DEC,
7036 VALS(names_nfsv4_operation), 0, "Opcode", HFILL }},
7038 { &hf_nfs_linktext4, {
7039 "Name", "nfs.symlink.linktext", FT_STRING, BASE_DEC,
7040 NULL, 0, "Symbolic link contents", HFILL }},
7042 { &hf_nfs_component4, {
7043 "Filename", "nfs.pathname.component", FT_STRING, BASE_DEC,
7044 NULL, 0, "Pathname component", HFILL }},
7047 "Tag", "nfs.tag", FT_STRING, BASE_DEC,
7048 NULL, 0, "Tag", HFILL }},
7050 { &hf_nfs_clientid4, {
7051 "clientid", "nfs.clientid", FT_UINT64, BASE_HEX,
7052 NULL, 0, "Client ID", HFILL }},
7055 "ace", "nfs.ace", FT_STRING, BASE_DEC,
7056 NULL, 0, "Access Control Entry", HFILL }},
7059 "EOF", "nfs.recall", FT_BOOLEAN, BASE_NONE,
7060 &yesno, 0, "Recall", HFILL }},
7062 { &hf_nfs_open_claim_type4, {
7063 "Claim Type", "nfs.open.claim_type", FT_UINT32, BASE_DEC,
7064 VALS(names_claim_type4), 0, "Claim Type", HFILL }},
7066 { &hf_nfs_opentype4, {
7067 "Open Type", "nfs.open.opentype", FT_UINT32, BASE_DEC,
7068 VALS(names_opentype4), 0, "Open Type", HFILL }},
7070 { &hf_nfs_limit_by4, {
7071 "Space Limit", "nfs.open.limit_by", FT_UINT32, BASE_DEC,
7072 VALS(names_limit_by4), 0, "Limit By", HFILL }},
7074 { &hf_nfs_open_delegation_type4, {
7075 "Delegation Type", "nfs.open.delegation_type", FT_UINT32, BASE_DEC,
7076 VALS(names_open_delegation_type4), 0, "Delegation Type", HFILL }},
7079 "nfs_ftype4", "nfs.nfs_ftype4", FT_UINT32, BASE_DEC,
7080 VALS(names_ftype4), 0, "nfs.nfs_ftype4", HFILL }},
7082 { &hf_nfs_change_info4_atomic, {
7083 "Atomic", "nfs.change_info.atomic", FT_BOOLEAN, BASE_NONE,
7084 &yesno, 0, "Atomic", HFILL }},
7086 { &hf_nfs_open4_share_access, {
7087 "share_access", "nfs.open4.share_access", FT_UINT32, BASE_DEC,
7088 VALS(names_open4_share_access), 0, "Share Access", HFILL }},
7090 { &hf_nfs_open4_share_deny, {
7091 "share_deny", "nfs.open4.share_deny", FT_UINT32, BASE_DEC,
7092 VALS(names_open4_share_deny), 0, "Share Deny", HFILL }},
7095 "seqid", "nfs.seqid", FT_UINT32, BASE_HEX,
7096 NULL, 0, "Sequence ID", HFILL }},
7098 { &hf_nfs_lock_seqid4, {
7099 "lock_seqid", "nfs.lock_seqid", FT_UINT32, BASE_HEX,
7100 NULL, 0, "Lock Sequence ID", HFILL }},
7102 { &hf_nfs_mand_attr, {
7103 "mand_attr", "nfs.attr", FT_UINT32, BASE_DEC,
7104 VALS(names_fattr4), 0, "Mandatory Attribute", HFILL }},
7106 { &hf_nfs_recc_attr, {
7107 "recc_attr", "nfs.attr", FT_UINT32, BASE_DEC,
7108 VALS(names_fattr4), 0, "Recommended Attribute", HFILL }},
7110 { &hf_nfs_time_how4, {
7111 "set_it", "nfs.set_it", FT_UINT32, BASE_DEC,
7112 VALS(names_time_how4), 0, "How To Set Time", HFILL }},
7114 { &hf_nfs_attrlist4, {
7115 "attr_vals", "nfs.fattr4.attr_vals", FT_BYTES, BASE_DEC,
7116 NULL, 0, "attr_vals", HFILL }},
7118 { &hf_nfs_fattr4_link_support, {
7119 "fattr4_link_support", "nfs.fattr4_link_support", FT_BOOLEAN,
7120 BASE_NONE, &yesno, 0, "nfs.fattr4_link_support", HFILL }},
7122 { &hf_nfs_fattr4_symlink_support, {
7123 "fattr4_symlink_support", "nfs.fattr4_symlink_support", FT_BOOLEAN,
7124 BASE_NONE, &yesno, 0, "nfs.fattr4_symlink_support", HFILL }},
7126 { &hf_nfs_fattr4_named_attr, {
7127 "fattr4_named_attr", "nfs.fattr4_named_attr", FT_BOOLEAN, BASE_NONE,
7128 &yesno, 0, "nfs.fattr4_named_attr", HFILL }},
7130 { &hf_nfs_fattr4_unique_handles, {
7131 "fattr4_unique_handles", "nfs.fattr4_unique_handles", FT_BOOLEAN,
7132 BASE_NONE, &yesno, 0, "nfs.fattr4_unique_handles", HFILL }},
7134 { &hf_nfs_fattr4_archive, {
7135 "fattr4_archive", "nfs.fattr4_archive", FT_BOOLEAN,
7136 BASE_NONE, &yesno, 0, "nfs.fattr4_archive", HFILL }},
7138 { &hf_nfs_fattr4_cansettime, {
7139 "fattr4_cansettime", "nfs.fattr4_cansettime", FT_BOOLEAN,
7140 BASE_NONE, &yesno, 0, "nfs.fattr4_cansettime", HFILL }},
7142 { &hf_nfs_fattr4_case_insensitive, {
7143 "fattr4_case_insensitive", "nfs.fattr4_case_insensitive", FT_BOOLEAN,
7144 BASE_NONE, &yesno, 0, "nfs.fattr4_case_insensitive", HFILL }},
7146 { &hf_nfs_fattr4_case_preserving, {
7147 "fattr4_case_preserving", "nfs.fattr4_case_preserving", FT_BOOLEAN,
7148 BASE_NONE, &yesno, 0, "nfs.fattr4_case_preserving", HFILL }},
7150 { &hf_nfs_fattr4_chown_restricted, {
7151 "fattr4_chown_restricted", "nfs.fattr4_chown_restricted", FT_BOOLEAN,
7152 BASE_NONE, &yesno, 0, "nfs.fattr4_chown_restricted", HFILL }},
7154 { &hf_nfs_fattr4_hidden, {
7155 "fattr4_hidden", "nfs.fattr4_hidden", FT_BOOLEAN,
7156 BASE_NONE, &yesno, 0, "nfs.fattr4_hidden", HFILL }},
7158 { &hf_nfs_fattr4_homogeneous, {
7159 "fattr4_homogeneous", "nfs.fattr4_homogeneous", FT_BOOLEAN,
7160 BASE_NONE, &yesno, 0, "nfs.fattr4_homogeneous", HFILL }},
7162 { &hf_nfs_fattr4_mimetype, {
7163 "fattr4_mimetype", "nfs.fattr4_mimetype", FT_STRING, BASE_DEC,
7164 NULL, 0, "nfs.fattr4_mimetype", HFILL }},
7166 { &hf_nfs_fattr4_no_trunc, {
7167 "fattr4_no_trunc", "nfs.fattr4_no_trunc", FT_BOOLEAN,
7168 BASE_NONE, &yesno, 0, "nfs.fattr4_no_trunc", HFILL }},
7170 { &hf_nfs_fattr4_system, {
7171 "fattr4_system", "nfs.fattr4_system", FT_BOOLEAN,
7172 BASE_NONE, &yesno, 0, "nfs.fattr4_system", HFILL }},
7175 "who", "nfs.who", FT_STRING, BASE_DEC,
7176 NULL, 0, "nfs.who", HFILL }},
7179 "server", "nfs.server", FT_STRING, BASE_DEC,
7180 NULL, 0, "nfs.server", HFILL }},
7182 { &hf_nfs_fattr4_owner, {
7183 "fattr4_owner", "nfs.fattr4_owner", FT_STRING, BASE_DEC,
7184 NULL, 0, "nfs.fattr4_owner", HFILL }},
7186 { &hf_nfs_fattr4_owner_group, {
7187 "fattr4_owner_group", "nfs.fattr4_owner_group", FT_STRING, BASE_DEC,
7188 NULL, 0, "nfs.fattr4_owner_group", HFILL }},
7190 { &hf_nfs_stable_how4, {
7191 "stable_how4", "nfs.stable_how4", FT_UINT32, BASE_DEC,
7192 VALS(names_stable_how4), 0, "nfs.stable_how4", HFILL }},
7194 { &hf_nfs_dirlist4_eof, {
7195 "eof", "nfs.dirlist4.eof", FT_BOOLEAN,
7196 BASE_NONE, &yesno, 0, "nfs.dirlist4.eof", HFILL }},
7198 { &hf_nfs_stateid4, {
7199 "stateid", "nfs.stateid4", FT_UINT64, BASE_DEC,
7200 NULL, 0, "nfs.stateid4", HFILL }},
7202 { &hf_nfs_offset4, {
7203 "offset", "nfs.offset4", FT_UINT64, BASE_DEC,
7204 NULL, 0, "nfs.offset4", HFILL }},
7206 { &hf_nfs_specdata1, {
7207 "specdata1", "nfs.specdata1", FT_UINT32, BASE_DEC,
7208 NULL, 0, "nfs.specdata1", HFILL }},
7210 { &hf_nfs_specdata2, {
7211 "specdata2", "nfs.specdata2", FT_UINT32, BASE_DEC,
7212 NULL, 0, "nfs.specdata2", HFILL }},
7214 { &hf_nfs_lock_type4, {
7215 "locktype", "nfs.locktype4", FT_UINT32, BASE_DEC,
7216 VALS(names_nfs_lock_type4), 0, "nfs.locktype4", HFILL }},
7218 { &hf_nfs_reclaim4, {
7219 "reclaim", "nfs.reclaim4", FT_BOOLEAN,
7220 BASE_NONE, &yesno, 0, "Reclaim", HFILL }},
7222 { &hf_nfs_length4, {
7223 "length", "nfs.length4", FT_UINT64, BASE_DEC,
7224 NULL, 0, "nfs.length4", HFILL }},
7226 { &hf_nfs_changeid4, {
7227 "changeid", "nfs.changeid4", FT_UINT64, BASE_DEC,
7228 NULL, 0, "nfs.changeid4", HFILL }},
7230 { &hf_nfs_changeid4_before, {
7231 "changeid", "nfs.changeid4.before", FT_UINT64, BASE_DEC,
7232 NULL, 0, "nfs.changeid4.before", HFILL }},
7234 { &hf_nfs_changeid4_after, {
7235 "changeid", "nfs.changeid4.after", FT_UINT64, BASE_DEC,
7236 NULL, 0, "nfs.changeid4.after", HFILL }},
7238 { &hf_nfs_nfstime4_seconds, {
7239 "seconds", "nfs.nfstime4.seconds", FT_UINT64, BASE_DEC,
7240 NULL, 0, "nfs.nfstime4.seconds", HFILL }},
7242 { &hf_nfs_nfstime4_nseconds, {
7243 "nseconds", "nfs.nfstime4.nseconds", FT_UINT32, BASE_DEC,
7244 NULL, 0, "nfs.nfstime4.nseconds", HFILL }},
7246 { &hf_nfs_fsid4_major, {
7247 "fsid4.major", "nfs.fsid4.major", FT_UINT64, BASE_DEC,
7248 NULL, 0, "nfs.nfstime4.fsid4.major", HFILL }},
7250 { &hf_nfs_fsid4_minor, {
7251 "fsid4.minor", "nfs.fsid4.minor", FT_UINT64, BASE_DEC,
7252 NULL, 0, "nfs.fsid4.minor", HFILL }},
7254 { &hf_nfs_acetype4, {
7255 "acetype", "nfs.acetype4", FT_UINT32, BASE_DEC,
7256 VALS(names_acetype4), 0, "nfs.acetype4", HFILL }},
7258 { &hf_nfs_aceflag4, {
7259 "aceflag", "nfs.aceflag4", FT_UINT32, BASE_DEC,
7260 NULL, 0, "nfs.aceflag4", HFILL }},
7262 { &hf_nfs_acemask4, {
7263 "acemask", "nfs.acemask4", FT_UINT32, BASE_DEC,
7264 NULL, 0, "nfs.acemask4", HFILL }},
7266 { &hf_nfs_fattr4_size, {
7267 "size", "nfs.fattr4.size", FT_UINT64, BASE_DEC,
7268 NULL, 0, "nfs.fattr4.size", HFILL }},
7270 { &hf_nfs_fattr4_lease_time, {
7271 "lease_time", "nfs.fattr4.lease_time", FT_UINT32, BASE_DEC,
7272 NULL, 0, "nfs.fattr4.lease_time", HFILL }},
7274 { &hf_nfs_fattr4_aclsupport, {
7275 "aclsupport", "nfs.fattr4.aclsupport", FT_UINT32, BASE_DEC,
7276 NULL, 0, "nfs.fattr4.aclsupport", HFILL }},
7278 { &hf_nfs_fattr4_fileid, {
7279 "fileid", "nfs.fattr4.fileid", FT_UINT64, BASE_DEC,
7280 NULL, 0, "nfs.fattr4.fileid", HFILL }},
7282 { &hf_nfs_fattr4_files_avail, {
7283 "files_avail", "nfs.fattr4.files_avail", FT_UINT64, BASE_DEC,
7284 NULL, 0, "nfs.fattr4.files_avail", HFILL }},
7286 { &hf_nfs_fattr4_files_free, {
7287 "files_free", "nfs.fattr4.files_free", FT_UINT64, BASE_DEC,
7288 NULL, 0, "nfs.fattr4.files_free", HFILL }},
7290 { &hf_nfs_fattr4_files_total, {
7291 "files_total", "nfs.fattr4.files_total", FT_UINT64, BASE_DEC,
7292 NULL, 0, "nfs.fattr4.files_total", HFILL }},
7294 { &hf_nfs_fattr4_maxfilesize, {
7295 "maxfilesize", "nfs.fattr4.maxfilesize", FT_UINT64, BASE_DEC,
7296 NULL, 0, "nfs.fattr4.maxfilesize", HFILL }},
7298 { &hf_nfs_fattr4_maxlink, {
7299 "maxlink", "nfs.fattr4.maxlink", FT_UINT32, BASE_DEC,
7300 NULL, 0, "nfs.fattr4.maxlink", HFILL }},
7302 { &hf_nfs_fattr4_maxname, {
7303 "maxname", "nfs.fattr4.maxname", FT_UINT32, BASE_DEC,
7304 NULL, 0, "nfs.fattr4.maxname", HFILL }},
7306 { &hf_nfs_fattr4_numlinks, {
7307 "numlinks", "nfs.fattr4.numlinks", FT_UINT32, BASE_DEC,
7308 NULL, 0, "nfs.fattr4.numlinks", HFILL }},
7310 { &hf_nfs_delegate_type, {
7311 "delegate_type", "nfs.delegate_type", FT_UINT32, BASE_DEC,
7312 NULL, 0, "nfs.delegate_type", HFILL }},
7314 { &hf_nfs_secinfo_flavor, {
7315 "flavor", "nfs.secinfo.flavor", FT_UINT32, BASE_DEC,
7316 VALS(rpc_auth_flavor), 0, "nfs.secinfo.flavor", HFILL }},
7318 { &hf_nfs_num_blocks, {
7319 "num_blocks", "nfs.num_blocks", FT_UINT32, BASE_DEC,
7320 NULL, 0, "nfs.num_blocks", HFILL }},
7322 { &hf_nfs_bytes_per_block, {
7323 "bytes_per_block", "nfs.bytes_per_block", FT_UINT32, BASE_DEC,
7324 NULL, 0, "nfs.bytes_per_block", HFILL }},
7327 "eof", "nfs.eof", FT_UINT32, BASE_DEC,
7328 NULL, 0, "nfs.eof", HFILL }},
7330 { &hf_nfs_fattr4_maxread, {
7331 "maxread", "nfs.fattr4.maxread", FT_UINT64, BASE_DEC,
7332 NULL, 0, "nfs.fattr4.maxread", HFILL }},
7334 { &hf_nfs_fattr4_maxwrite, {
7335 "maxwrite", "nfs.fattr4.maxwrite", FT_UINT64, BASE_DEC,
7336 NULL, 0, "nfs.fattr4.maxwrite", HFILL }},
7338 { &hf_nfs_fattr4_quota_hard, {
7339 "quota_hard", "nfs.fattr4.quota_hard", FT_UINT64, BASE_DEC,
7340 NULL, 0, "nfs.fattr4.quota_hard", HFILL }},
7342 { &hf_nfs_fattr4_quota_soft, {
7343 "quota_soft", "nfs.fattr4.quota_soft", FT_UINT64, BASE_DEC,
7344 NULL, 0, "nfs.fattr4.quota_soft", HFILL }},
7346 { &hf_nfs_fattr4_quota_used, {
7347 "quota_used", "nfs.fattr4.quota_used", FT_UINT64, BASE_DEC,
7348 NULL, 0, "nfs.fattr4.quota_used", HFILL }},
7350 { &hf_nfs_fattr4_space_avail, {
7351 "space_avail", "nfs.fattr4.space_avail", FT_UINT64, BASE_DEC,
7352 NULL, 0, "nfs.fattr4.space_avail", HFILL }},
7354 { &hf_nfs_fattr4_space_free, {
7355 "space_free", "nfs.fattr4.space_free", FT_UINT64, BASE_DEC,
7356 NULL, 0, "nfs.fattr4.space_free", HFILL }},
7358 { &hf_nfs_fattr4_space_total, {
7359 "space_total", "nfs.fattr4.space_total", FT_UINT64, BASE_DEC,
7360 NULL, 0, "nfs.fattr4.space_total", HFILL }},
7362 { &hf_nfs_fattr4_space_used, {
7363 "space_used", "nfs.fattr4.space_used", FT_UINT64, BASE_DEC,
7364 NULL, 0, "nfs.fattr4.space_used", HFILL }},
7366 { &hf_nfs_stateid4_delegate_stateid, {
7367 "delegate_stateid", "nfs.delegate_stateid", FT_UINT64, BASE_DEC,
7368 NULL, 0, "nfs.delegate_stateid", HFILL }},
7370 { &hf_nfs_verifier4, {
7371 "verifier", "nfs.verifier4", FT_UINT64, BASE_HEX,
7372 NULL, 0, "nfs.verifier4", HFILL }},
7374 { &hf_nfs_cookie4, {
7375 "cookie", "nfs.cookie4", FT_UINT64, BASE_DEC,
7376 NULL, 0, "nfs.cookie4", HFILL }},
7378 { &hf_nfs_cookieverf4, {
7379 "cookieverf", "nfs.cookieverf4", FT_UINT64, BASE_DEC,
7380 NULL, 0, "nfs.cookieverf4", HFILL }},
7382 { &hf_nfs_cb_location, {
7383 "cb_location", "nfs.cb_location", FT_UINT32, BASE_DEC,
7384 NULL, 0, "nfs.cb_location", HFILL }},
7386 { &hf_nfs_cb_program, {
7387 "cb_program", "nfs.cb_program", FT_UINT32, BASE_HEX,
7388 NULL, 0, "nfs.cb_program", HFILL }},
7390 { &hf_nfs_recall4, {
7391 "recall", "nfs.recall4", FT_BOOLEAN,
7392 BASE_NONE, &yesno, 0, "nfs.recall4", HFILL }},
7394 { &hf_nfs_filesize, {
7395 "filesize", "nfs.filesize", FT_UINT64, BASE_DEC,
7396 NULL, 0, "nfs.filesize", HFILL }},
7399 "count", "nfs.count4", FT_UINT32, BASE_DEC,
7400 NULL, 0, "nfs.count4", HFILL }},
7402 { &hf_nfs_count4_dircount, {
7403 "dircount", "nfs.dircount", FT_UINT32, BASE_DEC,
7404 NULL, 0, "nfs.dircount", HFILL }},
7406 { &hf_nfs_count4_maxcount, {
7407 "maxcount", "nfs.maxcount", FT_UINT32, BASE_DEC,
7408 NULL, 0, "nfs.maxcount", HFILL }},
7410 { &hf_nfs_minorversion, {
7411 "minorversion", "nfs.minorversion", FT_UINT32, BASE_DEC,
7412 NULL, 0, "nfs.minorversion", HFILL }},
7415 "atime", "nfs.atime", FT_ABSOLUTE_TIME, BASE_NONE,
7416 NULL, 0, "Access Time", HFILL }},
7418 { &hf_nfs_atime_sec, {
7419 "seconds", "nfs.atime.sec", FT_UINT32, BASE_DEC,
7420 NULL, 0, "Access Time, Seconds", HFILL }},
7422 { &hf_nfs_atime_nsec, {
7423 "nano seconds", "nfs.atime.nsec", FT_UINT32, BASE_DEC,
7424 NULL, 0, "Access Time, Nano-seconds", HFILL }},
7426 { &hf_nfs_atime_usec, {
7427 "micro seconds", "nfs.atime.usec", FT_UINT32, BASE_DEC,
7428 NULL, 0, "Access Time, Micro-seconds", HFILL }},
7431 "mtime", "nfs.mtime", FT_ABSOLUTE_TIME, BASE_NONE,
7432 NULL, 0, "Modify Time", HFILL }},
7434 { &hf_nfs_mtime_sec, {
7435 "seconds", "nfs.mtime.sec", FT_UINT32, BASE_DEC,
7436 NULL, 0, "Modify Seconds", HFILL }},
7438 { &hf_nfs_mtime_nsec, {
7439 "nano seconds", "nfs.mtime.nsec", FT_UINT32, BASE_DEC,
7440 NULL, 0, "Modify Time, Nano-seconds", HFILL }},
7442 { &hf_nfs_mtime_usec, {
7443 "micro seconds", "nfs.mtime.usec", FT_UINT32, BASE_DEC,
7444 NULL, 0, "Modify Time, Micro-seconds", HFILL }},
7447 "ctime", "nfs.ctime", FT_ABSOLUTE_TIME, BASE_NONE,
7448 NULL, 0, "Creation Time", HFILL }},
7450 { &hf_nfs_ctime_sec, {
7451 "seconds", "nfs.ctime.sec", FT_UINT32, BASE_DEC,
7452 NULL, 0, "Creation Time, Seconds", HFILL }},
7454 { &hf_nfs_ctime_nsec, {
7455 "nano seconds", "nfs.ctime.nsec", FT_UINT32, BASE_DEC,
7456 NULL, 0, "Creation Time, Nano-seconds", HFILL }},
7458 { &hf_nfs_ctime_usec, {
7459 "micro seconds", "nfs.ctime.usec", FT_UINT32, BASE_DEC,
7460 NULL, 0, "Creation Time, Micro-seconds", HFILL }},
7463 "time delta", "nfs.dtime", FT_RELATIVE_TIME, BASE_NONE,
7464 NULL, 0, "Time Delta", HFILL }},
7466 { &hf_nfs_dtime_sec, {
7467 "seconds", "nfs.dtime.sec", FT_UINT32, BASE_DEC,
7468 NULL, 0, "Time Delta, Seconds", HFILL }},
7470 { &hf_nfs_dtime_nsec, {
7471 "nano seconds", "nfs.dtime.nsec", FT_UINT32, BASE_DEC,
7472 NULL, 0, "Time Delta, Nano-seconds", HFILL }},
7474 { &hf_nfs_open_owner4, {
7475 "owner", "nfs.open_owner4", FT_BYTES, BASE_DEC,
7476 NULL, 0, "owner", HFILL }},
7478 { &hf_nfs_lock_owner4, {
7479 "owner", "nfs.lock_owner4", FT_BYTES, BASE_DEC,
7480 NULL, 0, "owner", HFILL }},
7482 { &hf_nfs_secinfo_rpcsec_gss_info_service, {
7483 "service", "nfs.secinfo.rpcsec_gss_info.service", FT_UINT32,
7484 BASE_DEC, VALS(rpc_authgss_svc), 0, "service", HFILL }},
7486 { &hf_nfs_attrdircreate, {
7487 "attribute dir create", "nfs.openattr4.createdir", FT_BOOLEAN,
7488 BASE_NONE, &yesno, 0, "nfs.openattr4.createdir", HFILL }},
7490 { &hf_nfs_new_lock_owner, {
7491 "new lock owner?", "nfs.lock.locker.new_lock_owner", FT_BOOLEAN,
7492 BASE_NONE, &yesno, 0, "nfs.lock.locker.new_lock_owner", HFILL }},
7494 { &hf_nfs_lock4_reclaim, {
7495 "reclaim?", "nfs.lock.reclaim", FT_BOOLEAN,
7496 BASE_NONE, &yesno, 0, "nfs.lock.reclaim", HFILL }},
7498 { &hf_nfs_sec_oid4, {
7499 "oid", "nfs.secinfo.flavor_info.rpcsec_gss_info.oid", FT_BYTES,
7500 BASE_DEC, NULL, 0, "oid", HFILL }},
7503 "qop", "nfs.secinfo.flavor_info.rpcsec_gss_info.qop", FT_UINT32,
7504 BASE_DEC, NULL, 0, "qop", HFILL }},
7506 { &hf_nfs_client_id4_id, {
7507 "id", "nfs.nfs_client_id4.id", FT_BYTES, BASE_DEC,
7508 NULL, 0, "nfs.nfs_client_id4.id", HFILL }},
7510 { &hf_nfs_stateid4_other, {
7511 "Data", "nfs.stateid4.other", FT_BYTES, BASE_DEC,
7512 NULL, 0, "Data", HFILL }},
7515 "ACL", "nfs.acl", FT_NONE, BASE_NONE,
7516 NULL, 0, "Access Control List", HFILL }},
7518 { &hf_nfs_callback_ident, {
7519 "callback_ident", "nfs.callback.ident", FT_UINT32, BASE_HEX,
7520 NULL, 0, "Callback Identifier", HFILL }},
7522 { &hf_nfs_r_netid, {
7523 "r_netid", "nfs.r_netid", FT_BYTES, BASE_DEC, NULL, 0,
7524 "r_netid", HFILL }},
7527 "r_addr", "nfs.r_addr", FT_BYTES, BASE_DEC, NULL, 0,
7531 static gint *ett[] = {
7533 &ett_nfs_fh_encoding,
7546 &ett_nfs_readdir_entry,
7552 &ett_nfs_post_op_fh3,
7554 &ett_nfs_diropargs3,
7555 &ett_nfs_sattrguard3,
7562 &ett_nfs_pre_op_attr,
7563 &ett_nfs_post_op_attr,
7567 &ett_nfs_fsinfo_properties,
7568 &ett_nfs_compound_call4,
7569 &ett_nfs_utf8string,
7576 &ett_nfs_delegpurge4,
7577 &ett_nfs_delegreturn4,
7589 &ett_nfs_open_confirm4,
7590 &ett_nfs_open_downgrade4,
7593 &ett_nfs_putrootfh4,
7600 &ett_nfs_restorefh4,
7603 &ett_nfs_setclientid4,
7604 &ett_nfs_setclientid_confirm4,
7611 &ett_nfs_change_info4,
7612 &ett_nfs_open_delegation4,
7613 &ett_nfs_open_claim4,
7615 &ett_nfs_lock_owner4,
7616 &ett_nfs_cb_client4,
7617 &ett_nfs_client_id4,
7621 &ett_nfs_fs_locations4,
7622 &ett_nfs_fs_location4,
7623 &ett_nfs_open4_result_flags,
7625 &ett_nfs_secinfo4_flavor_info,
7627 &ett_nfs_fattr4_fh_expire_type,
7629 &ett_nfs_clientaddr4,
7633 module_t *nfs_module;
7635 proto_nfs = proto_register_protocol("Network File System", "NFS", "nfs");
7636 proto_register_field_array(proto_nfs, hf, array_length(hf));
7637 proto_register_subtree_array(ett, array_length(ett));
7639 nfs_module=prefs_register_protocol(proto_nfs, NULL);
7640 prefs_register_bool_preference(nfs_module, "file_name_snooping",
7641 "Snoop FH to filename mappings",
7642 "Whether the dissector should snoop the FH to filename mappings by looking inside certain packets",
7643 &nfs_file_name_snooping);
7644 prefs_register_bool_preference(nfs_module, "file_full_name_snooping",
7645 "Snoop full path to filenames",
7646 "Whether the dissector should snoop the full pathname for files for matching FH's",
7647 &nfs_file_name_full_snooping);
7648 prefs_register_bool_preference(nfs_module, "fhandle_find_both_reqrep",
7649 "Fhandle filters finds both request/response",
7650 "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",
7651 &nfs_fhandle_reqrep_matching);
7652 register_init_routine(nfs_name_snoop_init);
7653 register_init_routine(nfs_fhandle_reqrep_matching_init);
7657 proto_reg_handoff_nfs(void)
7659 /* Register the protocol as RPC */
7660 rpc_init_prog(proto_nfs, NFS_PROGRAM, ett_nfs);
7661 /* Register the procedure tables */
7662 rpc_init_proc_table(NFS_PROGRAM, 2, nfs2_proc);
7663 rpc_init_proc_table(NFS_PROGRAM, 3, nfs3_proc);
7664 rpc_init_proc_table(NFS_PROGRAM, 4, nfs4_proc);