Coverage Report

Created: 2026-08-14 06:45

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/wireshark/epan/dissectors/packet-nfs.c
Line
Count
Source
1
/* packet-nfs.c
2
 * Routines for nfs dissection
3
 * Copyright 1999, Uwe Girlich <Uwe.Girlich@philosys.de>
4
 * Copyright 2000-2004, Mike Frisch <frisch@hummingbird.com> (NFSv4 decoding)
5
 *
6
 * Wireshark - Network traffic analyzer
7
 * By Gerald Combs <gerald@wireshark.org>
8
 * Copyright 1998 Gerald Combs
9
 *
10
 * Copied from packet-smb.c
11
 *
12
 * SPDX-License-Identifier: GPL-2.0-or-later
13
 */
14
15
#include "config.h"
16
17
#include <stdio.h>  /* for sscanf() */
18
19
#include <epan/packet.h>
20
#include <epan/prefs.h>
21
#include <epan/expert.h>
22
#include <epan/exceptions.h>
23
#include <epan/proto_data.h>
24
#include <epan/to_str.h>
25
#include <epan/decode_as.h>
26
#include <epan/crc16-tvb.h>
27
#include <epan/crc32-tvb.h>
28
#include <epan/srt_table.h>
29
#include <epan/tap.h>
30
#include <epan/tfs.h>
31
32
#include <wsutil/array.h>
33
#include <wsutil/str_util.h>
34
#include <wsutil/ws_padding_to.h>
35
36
#include "packet-nfs.h"
37
#include "packet-rpcrdma.h"
38
39
void proto_register_nfs(void);
40
void proto_reg_handoff_nfs(void);
41
42
/* NON-NFS-version-specific hf variables */
43
static int proto_nfs;
44
static int proto_nfs_unknown;
45
static int proto_nfs_svr4;
46
static int proto_nfs_knfsd_le;
47
static int proto_nfs_nfsd_le;
48
static int proto_nfs_knfsd_new;
49
static int proto_nfs_ontap_v3;
50
static int proto_nfs_ontap_v4;
51
static int proto_nfs_ontap_gx_v3;
52
static int proto_nfs_celerra_vnx;
53
static int proto_nfs_gluster;
54
static int proto_nfs_dcache;
55
static int proto_nfs_primary_data;
56
static int proto_nfs_cb;
57
static int proto_nfsv4;
58
static int hf_nfs_access_check;
59
static int hf_nfs_access_supported;
60
static int hf_nfs_access_rights;
61
static int hf_nfs_access_supp_read;
62
static int hf_nfs_access_supp_lookup;
63
static int hf_nfs_access_supp_modify;
64
static int hf_nfs_access_supp_extend;
65
static int hf_nfs_access_supp_delete;
66
static int hf_nfs_access_supp_execute;
67
static int hf_nfs_access_supp_xattr_read;
68
static int hf_nfs_access_supp_xattr_write;
69
static int hf_nfs_access_supp_xattr_list;
70
static int hf_nfs_access_read;
71
static int hf_nfs_access_lookup;
72
static int hf_nfs_access_modify;
73
static int hf_nfs_access_extend;
74
static int hf_nfs_access_delete;
75
static int hf_nfs_access_execute;
76
static int hf_nfs_access_xattr_read;
77
static int hf_nfs_access_xattr_write;
78
static int hf_nfs_access_xattr_list;
79
static int hf_nfs_access_denied;
80
static int hf_nfs_fh_length;
81
static int hf_nfs_fh_hash;
82
static int hf_nfs_fh_fhandle_data;
83
static int hf_nfs_fh_mount_fileid;
84
static int hf_nfs_fh_mount_generation;
85
static int hf_nfs_fh_snapid;
86
static int hf_nfs_fh_unused;
87
static int hf_nfs_fh_flags;
88
static int hf_nfs_fh_fileid;
89
static int hf_nfs_fh_generation;
90
static int hf_nfs_fh_fsid;
91
static int hf_nfs_fh_export_fileid;
92
static int hf_nfs_fh_export_generation;
93
static int hf_nfs_fh_export_snapid;
94
static int hf_nfs_fh_exportid;
95
static int hf_nfs_fh_file_flag_mntpoint;
96
static int hf_nfs_fh_file_flag_snapdir;
97
static int hf_nfs_fh_file_flag_snapdir_ent;
98
static int hf_nfs_fh_file_flag_empty;
99
static int hf_nfs_fh_file_flag_vbn_access;
100
static int hf_nfs_fh_file_flag_multivolume;
101
static int hf_nfs_fh_file_flag_metadata;
102
static int hf_nfs_fh_file_flag_orphan;
103
static int hf_nfs_fh_file_flag_foster;
104
static int hf_nfs_fh_file_flag_named_attr;
105
static int hf_nfs_fh_file_flag_exp_snapdir;
106
static int hf_nfs_fh_file_flag_vfiler;
107
static int hf_nfs_fh_file_flag_aggr;
108
static int hf_nfs_fh_file_flag_striped;
109
static int hf_nfs_fh_file_flag_private;
110
static int hf_nfs_fh_file_flag_next_gen;
111
static int hf_nfs_fh_gfid;
112
static int hf_nfs_fh_handle_type;
113
static int hf_nfs_fh_fsid_major16_mask;
114
static int hf_nfs_fh_fsid_minor16_mask;
115
static int hf_nfs_fh_fsid_major16;
116
static int hf_nfs_fh_fsid_minor16;
117
static int hf_nfs_fh_fsid_major32;
118
static int hf_nfs_fh_fsid_minor32;
119
static int hf_nfs_fh_fsid_inode;
120
static int hf_nfs_fh_xfsid_major;
121
static int hf_nfs_fh_xfsid_minor;
122
static int hf_nfs_fh_fstype;
123
static int hf_nfs_fh_fn;
124
static int hf_nfs_fh_fn_len;
125
static int hf_nfs_fh_fn_inode;
126
static int hf_nfs_fh_fn_generation;
127
static int hf_nfs_fh_xfn;
128
static int hf_nfs_fh_xfn_len;
129
static int hf_nfs_fh_xfn_inode;
130
static int hf_nfs_fh_xfn_generation;
131
static int hf_nfs_fh_dentry;
132
/* static int hf_nfs_fh_dev; */
133
/* static int hf_nfs_fh_xdev; */
134
static int hf_nfs_fh_dirinode;
135
static int hf_nfs_fh_pinode;
136
static int hf_nfs_fh_hp_len;
137
static int hf_nfs_fh_hp_key;
138
static int hf_nfs_fh_version;
139
static int hf_nfs_fh_auth_type;
140
static int hf_nfs_fh_fsid_type;
141
static int hf_nfs_fh_fileid_type;
142
static int hf_nfs_fh_obj_id;
143
static int hf_nfs_fh_ro_node;
144
static int hf_nfs_fh_obj;
145
static int hf_nfs_fh_obj_fsid;
146
static int hf_nfs_fh_obj_treeid;
147
static int hf_nfs_fh_obj_kindid;
148
static int hf_nfs_fh_obj_inode;
149
static int hf_nfs_fh_obj_gen;
150
static int hf_nfs_fh_ex;
151
static int hf_nfs_fh_ex_fsid;
152
static int hf_nfs_fh_ex_treeid;
153
static int hf_nfs_fh_ex_kindid;
154
static int hf_nfs_fh_ex_inode;
155
static int hf_nfs_fh_ex_gen;
156
static int hf_nfs_fh_flag;
157
static int hf_nfs_fh_endianness;
158
static int hf_nfs_fh_dc_opaque;
159
static int hf_nfs_fh_dc_exportid;
160
static int hf_nfs_fh_dc_handle_type;
161
static int hf_nfs4_fh_pd_share;
162
static int hf_nfs4_fh_pd_flags;
163
static int hf_nfs4_fh_pd_flags_reserved;
164
static int hf_nfs4_fh_pd_flags_version;
165
static int hf_nfs4_fh_pd_container;
166
static int hf_nfs4_fh_pd_inum;
167
static int hf_nfs4_fh_pd_sites;
168
static int hf_nfs4_fh_pd_sites_inum;
169
static int hf_nfs4_fh_pd_sites_siteid;
170
static int hf_nfs4_fh_pd_spaces;
171
static int hf_nfs4_fh_pd_spaces_snapid;
172
static int hf_nfs4_fh_pd_spaces_container;
173
static int hf_nfs_full_name;
174
static int hf_nfs_name;
175
static int hf_nfs_data;
176
static int hf_nfs_symlink_to;
177
static int hf_nfs_readdir_eof;
178
static int hf_nfs_readdir_entry;
179
static int hf_nfs_atime;
180
static int hf_nfs_atime_sec;
181
static int hf_nfs_atime_nsec;
182
static int hf_nfs_atime_usec;
183
static int hf_nfs_mtime;
184
static int hf_nfs_mtime_sec;
185
static int hf_nfs_mtime_nsec;
186
static int hf_nfs_mtime_usec;
187
static int hf_nfs_ctime;
188
static int hf_nfs_ctime_sec;
189
static int hf_nfs_ctime_nsec;
190
static int hf_nfs_ctime_usec;
191
static int hf_nfs_dtime;
192
static int hf_nfs_dtime_sec;
193
static int hf_nfs_dtime_nsec;
194
195
/* Hidden field for v2, v3, and v4 status; also used in dissect-nfsacl.c */
196
int hf_nfs_status;
197
198
/* NFSv2 RFC 1094 hf variables */
199
static int hf_nfs2_procedure;
200
static int hf_nfs2_status;
201
static int hf_nfs2_readlink_data;
202
/* static int hf_nfs2_fattr_type; */
203
static int hf_nfs2_fattr_nlink;
204
static int hf_nfs2_fattr_uid;
205
static int hf_nfs2_fattr_gid;
206
static int hf_nfs2_fattr_size;
207
static int hf_nfs2_fattr_blocksize;
208
static int hf_nfs2_fattr_rdev;
209
static int hf_nfs2_fattr_blocks;
210
static int hf_nfs2_fattr_fsid;
211
static int hf_nfs2_fattr_fileid;
212
static int hf_nfs2_ftype;
213
static int hf_nfs2_mode;
214
static int hf_nfs2_mode_name;
215
static int hf_nfs2_mode_set_user_id;
216
static int hf_nfs2_mode_set_group_id;
217
static int hf_nfs2_mode_save_swap_text;
218
static int hf_nfs2_mode_read_owner;
219
static int hf_nfs2_mode_write_owner;
220
static int hf_nfs2_mode_exec_owner;
221
static int hf_nfs2_mode_read_group;
222
static int hf_nfs2_mode_write_group;
223
static int hf_nfs2_mode_exec_group;
224
static int hf_nfs2_mode_read_other;
225
static int hf_nfs2_mode_write_other;
226
static int hf_nfs2_mode_exec_other;
227
static int hf_nfs2_read_offset;
228
static int hf_nfs2_read_count;
229
static int hf_nfs2_read_totalcount;
230
static int hf_nfs2_write_beginoffset;
231
static int hf_nfs2_write_offset;
232
static int hf_nfs2_write_totalcount;
233
static int hf_nfs2_readdir_cookie;
234
static int hf_nfs2_readdir_count;
235
static int hf_nfs2_readdir_entry_fileid;
236
static int hf_nfs2_readdir_entry_name;
237
static int hf_nfs2_readdir_entry_cookie;
238
static int hf_nfs2_statfs_tsize;
239
static int hf_nfs2_statfs_bsize;
240
static int hf_nfs2_statfs_blocks;
241
static int hf_nfs2_statfs_bfree;
242
static int hf_nfs2_statfs_bavail;
243
244
/* NFSv3 RFC 1813 header format variables */
245
static int hf_nfs3_procedure;
246
static int hf_nfs3_fattr_type;
247
static int hf_nfs3_fattr_nlink;
248
static int hf_nfs3_fattr_uid;
249
static int hf_nfs3_fattr_gid;
250
static int hf_nfs3_fattr_size;
251
static int hf_nfs3_fattr_used;
252
/* static int hf_nfs3_fattr_rdev; */
253
static int hf_nfs3_fattr_fsid;
254
static int hf_nfs3_fattr_fileid;
255
static int hf_nfs3_wcc_attr_size;
256
static int hf_nfs3_set_size;
257
static int hf_nfs3_cookie;
258
static int hf_nfs3_fsstat_resok_tbytes;
259
static int hf_nfs3_fsstat_resok_fbytes;
260
static int hf_nfs3_fsstat_resok_abytes;
261
static int hf_nfs3_fsstat_resok_tfiles;
262
static int hf_nfs3_fsstat_resok_ffiles;
263
static int hf_nfs3_fsstat_resok_afiles;
264
static int hf_nfs3_uid;
265
static int hf_nfs3_gid;
266
static int hf_nfs3_offset;
267
static int hf_nfs3_count;
268
static int hf_nfs3_count_maxcount;
269
static int hf_nfs3_count_dircount;
270
static int hf_nfs3_mode;
271
static int hf_nfs3_mode_suid;
272
static int hf_nfs3_mode_sgid;
273
static int hf_nfs3_mode_sticky;
274
static int hf_nfs3_mode_rusr;
275
static int hf_nfs3_mode_wusr;
276
static int hf_nfs3_mode_xusr;
277
static int hf_nfs3_mode_rgrp;
278
static int hf_nfs3_mode_wgrp;
279
static int hf_nfs3_mode_xgrp;
280
static int hf_nfs3_mode_roth;
281
static int hf_nfs3_mode_woth;
282
static int hf_nfs3_mode_xoth;
283
static int hf_nfs3_readdir_entry_fileid;
284
static int hf_nfs3_readdir_entry_name;
285
static int hf_nfs3_readdir_entry_cookie;
286
static int hf_nfs3_readdirplus_entry_fileid;
287
static int hf_nfs3_readdirplus_entry_name;
288
static int hf_nfs3_readdirplus_entry_cookie;
289
static int hf_nfs3_ftype;
290
static int hf_nfs3_status;
291
static int hf_nfs3_read_eof;
292
static int hf_nfs3_write_stable;
293
static int hf_nfs3_write_committed;
294
static int hf_nfs3_createmode;
295
static int hf_nfs3_fsstat_invarsec;
296
static int hf_nfs3_fsinfo_rtmax;
297
static int hf_nfs3_fsinfo_rtpref;
298
static int hf_nfs3_fsinfo_rtmult;
299
static int hf_nfs3_fsinfo_wtmax;
300
static int hf_nfs3_fsinfo_wtpref;
301
static int hf_nfs3_fsinfo_wtmult;
302
static int hf_nfs3_fsinfo_dtpref;
303
static int hf_nfs3_fsinfo_maxfilesize;
304
static int hf_nfs3_fsinfo_properties;
305
static int hf_nfs3_fsinfo_properties_setattr;
306
static int hf_nfs3_fsinfo_properties_pathconf;
307
static int hf_nfs3_fsinfo_properties_symlinks;
308
static int hf_nfs3_fsinfo_properties_hardlinks;
309
static int hf_nfs3_pathconf_linkmax;
310
static int hf_nfs3_pathconf_name_max;
311
static int hf_nfs3_pathconf_no_trunc;
312
static int hf_nfs3_pathconf_chown_restricted;
313
static int hf_nfs3_pathconf_case_insensitive;
314
static int hf_nfs3_pathconf_case_preserving;
315
static int hf_nfs3_gxfh_utlfield;
316
static int hf_nfs3_gxfh_utlfield_tree;
317
static int hf_nfs3_gxfh_utlfield_jun;
318
static int hf_nfs3_gxfh_utlfield_ver;
319
static int hf_nfs3_gxfh_volcnt;
320
static int hf_nfs3_gxfh_epoch;
321
static int hf_nfs3_gxfh_ldsid;
322
static int hf_nfs3_gxfh_cid;
323
static int hf_nfs3_gxfh_resv;
324
static int hf_nfs3_gxfh_sfhflags;
325
static int hf_nfs3_gxfh_sfhflags_resv1;
326
static int hf_nfs3_gxfh_sfhflags_resv2;
327
static int hf_nfs3_gxfh_sfhflags_ontap7G;
328
static int hf_nfs3_gxfh_sfhflags_ontapGX;
329
static int hf_nfs3_gxfh_sfhflags_striped;
330
static int hf_nfs3_gxfh_sfhflags_empty;
331
static int hf_nfs3_gxfh_sfhflags_snapdirent;
332
static int hf_nfs3_gxfh_sfhflags_snapdir;
333
static int hf_nfs3_gxfh_sfhflags_streamdir;
334
static int hf_nfs3_gxfh_spinfid;
335
static int hf_nfs3_gxfh_spinfuid;
336
static int hf_nfs3_gxfh_exportptid;
337
static int hf_nfs3_gxfh_exportptuid;
338
static int hf_nfs3_verifier;
339
static int hf_nfs3_specdata1;
340
static int hf_nfs3_specdata2;
341
static int hf_nfs3_attributes_follow;
342
static int hf_nfs3_handle_follow;
343
static int hf_nfs3_sattrguard3;
344
345
346
/* NFSv4 RFC 5661 header format variables */
347
static int hf_nfs4_procedure;
348
static int hf_nfs4_status;
349
static int hf_nfs4_op;
350
static int hf_nfs4_main_opcode;
351
static int hf_nfs4_linktext;
352
static int hf_nfs4_tag;
353
static int hf_nfs4_ops_count;
354
static int hf_nfs4_pathname_components;
355
static int hf_nfs4_component;
356
static int hf_nfs4_clientid;
357
/* static int hf_nfs4_ace; */
358
static int hf_nfs4_recall;
359
static int hf_nfs4_open_claim_type;
360
static int hf_nfs4_opentype;
361
static int hf_nfs4_state_protect_how;
362
static int hf_nfs4_limit_by;
363
static int hf_nfs4_open_delegation_type;
364
static int hf_nfs4_why_no_delegation;
365
static int hf_nfs4_ftype;
366
static int hf_nfs4_change_info_atomic;
367
static int hf_nfs4_open_share_access;
368
static int hf_nfs4_open_share_deny;
369
static int hf_nfs4_want_flags;
370
static int hf_nfs4_want_notify_flags;
371
static int hf_nfs4_want_signal_deleg_when_resrc_avail;
372
static int hf_nfs4_want_push_deleg_when_uncontended;
373
static int hf_nfs4_want_deleg_timestamps;
374
static int hf_nfs4_seqid;
375
static int hf_nfs4_lock_seqid;
376
static int hf_nfs4_reqd_attr;
377
static int hf_nfs4_reco_attr;
378
static int hf_nfs4_attr_mask;
379
static int hf_nfs4_attr_count;
380
static int hf_nfs4_set_it_value_follows;
381
static int hf_nfs4_time_how;
382
static int hf_nfs4_time_how4;
383
static int hf_nfs4_fattr_link_support;
384
static int hf_nfs4_fattr_symlink_support;
385
static int hf_nfs4_fattr_named_attr;
386
static int hf_nfs4_fattr_unique_handles;
387
static int hf_nfs4_fattr_archive;
388
static int hf_nfs4_fattr_cansettime;
389
static int hf_nfs4_fattr_case_insensitive;
390
static int hf_nfs4_fattr_case_preserving;
391
static int hf_nfs4_fattr_chown_restricted;
392
static int hf_nfs4_fattr_fh_expire_type;
393
static int hf_nfs4_fattr_fh_expiry_noexpire_with_open;
394
static int hf_nfs4_fattr_fh_expiry_volatile_any;
395
static int hf_nfs4_fattr_fh_expiry_vol_migration;
396
static int hf_nfs4_fattr_fh_expiry_vol_rename;
397
static int hf_nfs4_fattr_hidden;
398
static int hf_nfs4_fattr_homogeneous;
399
static int hf_nfs4_fattr_mimetype;
400
static int hf_nfs4_fattr_no_trunc;
401
static int hf_nfs4_fattr_system;
402
static int hf_nfs4_fattr_owner;
403
static int hf_nfs4_fattr_owner_group;
404
static int hf_nfs4_fattr_size;
405
static int hf_nfs4_fattr_aclsupport;
406
static int hf_nfs4_aclsupport_allow_acl;
407
static int hf_nfs4_aclsupport_deny_acl;
408
static int hf_nfs4_aclsupport_audit_acl;
409
static int hf_nfs4_aclsupport_alarm_acl;
410
static int hf_nfs4_fattr_lease_time;
411
static int hf_nfs4_fattr_fs_charset_cap;
412
static int hf_nfs4_fs_charset_cap_nonutf8;
413
static int hf_nfs4_fs_charset_cap_utf8;
414
static int hf_nfs4_fattr_fileid;
415
static int hf_nfs4_fattr_files_avail;
416
static int hf_nfs4_fattr_files_free;
417
static int hf_nfs4_fattr_files_total;
418
static int hf_nfs4_fattr_maxfilesize;
419
static int hf_nfs4_fattr_maxlink;
420
static int hf_nfs4_fattr_maxname;
421
static int hf_nfs4_fattr_numlinks;
422
static int hf_nfs4_fattr_maxread;
423
static int hf_nfs4_fattr_maxwrite;
424
static int hf_nfs4_fattr_quota_hard;
425
static int hf_nfs4_fattr_quota_soft;
426
static int hf_nfs4_fattr_quota_used;
427
static int hf_nfs4_fattr_space_avail;
428
static int hf_nfs4_fattr_space_free;
429
static int hf_nfs4_fattr_space_total;
430
static int hf_nfs4_fattr_space_used;
431
static int hf_nfs4_fattr_mounted_on_fileid;
432
static int hf_nfs4_fattr_layout_blksize;
433
static int hf_nfs4_mdsthreshold_item;
434
static int hf_nfs4_mdsthreshold_hint_mask;
435
static int hf_nfs4_mdsthreshold_hint_count;
436
static int hf_nfs4_mdsthreshold_mask_count;
437
static int hf_nfs4_mdsthreshold_hint_file;
438
static int hf_nfs4_fattr_security_label_lfs;
439
static int hf_nfs4_fattr_security_label_pi;
440
static int hf_nfs4_fattr_security_label_context;
441
static int hf_nfs4_fattr_umask_mask;
442
static int hf_nfs4_fattr_xattr_support;
443
static int hf_nfs4_fattr_offline;
444
static int hf_nfs4_who;
445
static int hf_nfs4_server;
446
static int hf_nfs4_servers;
447
static int hf_nfs4_fslocation;
448
static int hf_nfs4_stable_how;
449
static int hf_nfs4_dirlist_eof;
450
static int hf_nfs4_offset;
451
static int hf_nfs4_specdata1;
452
static int hf_nfs4_specdata2;
453
static int hf_nfs4_lock_type;
454
static int hf_nfs4_open_rflags;
455
static int hf_nfs4_open_rflags_confirm;
456
static int hf_nfs4_open_rflags_locktype_posix;
457
static int hf_nfs4_open_rflags_preserve_unlinked;
458
static int hf_nfs4_open_rflags_may_notify_lock;
459
static int hf_nfs4_reclaim;
460
static int hf_nfs4_length;
461
static int hf_nfs4_changeid;
462
static int hf_nfs4_changeid_before;
463
static int hf_nfs4_changeid_after;
464
static int hf_nfs4_time;
465
static int hf_nfs4_time_seconds;
466
static int hf_nfs4_time_nseconds;
467
static int hf_nfs4_fsid_major;
468
static int hf_nfs4_fsid_minor;
469
static int hf_nfs4_acetype;
470
static int hf_nfs4_aceflags;
471
static int hf_nfs4_aceflag_file_inherit;
472
static int hf_nfs4_aceflag_dir_inherit;
473
static int hf_nfs4_aceflag_no_prop_inherit;
474
static int hf_nfs4_aceflag_inherit_only;
475
static int hf_nfs4_aceflag_successful_access;
476
static int hf_nfs4_aceflag_failed_access;
477
static int hf_nfs4_aceflag_id_group;
478
static int hf_nfs4_aceflag_inherited_ace;
479
static int hf_nfs4_acemask;
480
static int hf_nfs4_ace_permission;
481
static int hf_nfs4_delegate_type;
482
static int hf_nfs4_secinfo_flavor;
483
static int hf_nfs4_secinfo_arr;
484
static int hf_nfs4_num_blocks;
485
static int hf_nfs4_bytes_per_block;
486
static int hf_nfs4_eof;
487
static int hf_nfs4_verifier;
488
static int hf_nfs4_value_follows;
489
static int hf_nfs4_cookie;
490
static int hf_nfs4_dir_entry_name;
491
static int hf_nfs4_cookie_verf;
492
static int hf_nfs4_cb_program;
493
/* static int hf_nfs4_cb_location; */
494
static int hf_nfs4_recall4;
495
static int hf_nfs4_filesize;
496
static int hf_nfs4_count;
497
static int hf_nfs4_count_dircount;
498
static int hf_nfs4_count_maxcount;
499
static int hf_nfs4_minorversion;
500
static int hf_nfs4_open_owner;
501
static int hf_nfs4_lock_owner;
502
static int hf_nfs4_new_lock_owner;
503
static int hf_nfs4_ond_server_will_push_deleg;
504
static int hf_nfs4_ond_server_will_signal_avail;
505
static int hf_nfs4_sec_oid;
506
static int hf_nfs4_qop;
507
static int hf_nfs4_secinfo_rpcsec_gss_info_service;
508
static int hf_nfs4_attr_dir_create;
509
static int hf_nfs4_client_id;
510
static int hf_nfs4_stateid;
511
static int hf_nfs4_seqid_stateid;
512
static int hf_nfs4_stateid_other;
513
static int hf_nfs4_stateid_hash;
514
static int hf_nfs4_stateid_other_hash;
515
static int hf_nfs4_lock_reclaim;
516
static int hf_nfs4_aclflags;
517
static int hf_nfs4_aclflag_auto_inherit;
518
static int hf_nfs4_aclflag_protected;
519
static int hf_nfs4_aclflag_defaulted;
520
static int hf_nfs4_num_aces;
521
static int hf_nfs4_callback_ident;
522
static int hf_nfs4_r_netid;
523
static int hf_nfs4_gsshandle;
524
static int hf_nfs4_r_addr;
525
static int hf_nfs4_createmode;
526
static int hf_nfs4_op_mask;
527
static int hf_nfs4_read_data_length;
528
static int hf_nfs4_write_data_length;
529
static int hf_nfs4_length_minlength;
530
static int hf_nfs4_layout_type;
531
static int hf_nfs4_layout_return_type;
532
static int hf_nfs4_iomode;
533
/* static int hf_nfs4_stripetype; */
534
/* static int hf_nfs4_mdscommit; */
535
static int hf_nfs4_stripeunit;
536
static int hf_nfs4_newtime;
537
static int hf_nfs4_newoffset;
538
static int hf_nfs4_layout_avail;
539
static int hf_nfs4_newsize;
540
static int hf_nfs4_layoutupdate;
541
static int hf_nfs4_deviceid;
542
static int hf_nfs4_devicenum;
543
static int hf_nfs4_deviceidx;
544
static int hf_nfs4_layout;
545
/* static int hf_nfs4_stripedevs; */
546
/* static int hf_nfs4_devaddr; */
547
static int hf_nfs4_devaddr_ssv_start;
548
static int hf_nfs4_devaddr_ssv_length;
549
static int hf_nfs4_devaddr_scsi_vol_type;
550
static int hf_nfs4_devaddr_scsi_vol_index;
551
static int hf_nfs4_devaddr_scsi_vol_ref_index;
552
static int hf_nfs4_devaddr_ssv_stripe_unit;
553
static int hf_nfs4_devaddr_scsi_vpd_code_set;
554
static int hf_nfs4_devaddr_scsi_vpd_designator_type;
555
static int hf_nfs4_devaddr_scsi_vpd_designator;
556
static int hf_nfs4_devaddr_scsi_private_key;
557
static int hf_nfs4_scsil_ext_file_offset;
558
static int hf_nfs4_scsil_ext_length;
559
static int hf_nfs4_scsil_ext_vol_offset;
560
static int hf_nfs4_scsil_ext_state;
561
static int hf_nfs4_return_on_close;
562
static int hf_nfs4_slotid;
563
static int hf_nfs4_high_slotid;
564
static int hf_nfs4_target_high_slotid;
565
static int hf_nfs4_serverscope4;
566
static int hf_nfs4_minorid;
567
static int hf_nfs4_majorid;
568
static int hf_nfs4_padsize;
569
/* static int hf_nfs4_cbrenforce; */
570
/* static int hf_nfs4_hashalg; */
571
/* static int hf_nfs4_ssvlen; */
572
static int hf_nfs4_maxreqsize;
573
static int hf_nfs4_maxrespsize;
574
static int hf_nfs4_maxrespsizecached;
575
static int hf_nfs4_maxops;
576
static int hf_nfs4_maxreqs;
577
static int hf_nfs4_rdmachanattrs;
578
static int hf_nfs4_machinename;
579
static int hf_nfs4_flavor;
580
static int hf_nfs4_stamp;
581
static int hf_nfs4_uid;
582
static int hf_nfs4_gid;
583
static int hf_nfs4_service;
584
static int hf_nfs4_sessionid;
585
static int hf_nfs4_exchid_call_flags;
586
static int hf_nfs4_exchid_reply_flags;
587
static int hf_nfs4_exchid_flags_moved_refer;
588
static int hf_nfs4_exchid_flags_moved_migr;
589
static int hf_nfs4_exchid_flags_bind_princ;
590
static int hf_nfs4_exchid_flags_non_pnfs;
591
static int hf_nfs4_exchid_flags_pnfs_mds;
592
static int hf_nfs4_exchid_flags_pnfs_ds;
593
static int hf_nfs4_exchid_flags_upd_conf_rec_a;
594
static int hf_nfs4_exchid_flags_confirmed_r;
595
static int hf_nfs4_state_protect_window;
596
static int hf_nfs4_state_protect_num_gss_handles;
597
static int hf_nfs4_sp_parms_hash_algs;
598
static int hf_nfs4_sp_parms_encr_algs;
599
static int hf_nfs4_prot_info_spi_window;
600
static int hf_nfs4_prot_info_svv_length;
601
static int hf_nfs4_prot_info_encr_alg;
602
static int hf_nfs4_prot_info_hash_alg;
603
static int hf_nfs4_nii_domain;
604
static int hf_nfs4_nii_name;
605
static int hf_nfs4_create_session_flags_csa;
606
static int hf_nfs4_create_session_flags_csr;
607
static int hf_nfs4_create_session_flags_persist;
608
static int hf_nfs4_create_session_flags_conn_back_chan;
609
static int hf_nfs4_create_session_flags_conn_rdma;
610
static int hf_nfs4_cachethis;
611
/* static int hf_nfs4_util; */
612
/* static int hf_nfs4_first_stripe_idx; */
613
/* static int hf_nfs4_layout_count; */
614
/* static int hf_nfs4_pattern_offset; */
615
static int hf_nfs4_notify_mask;
616
static int hf_nfs4_notify_type;
617
static int hf_nfs4_notify_deviceid_mask;
618
static int hf_nfs4_notify_deviceid_type;
619
static int hf_nfs4_lrs_present;
620
static int hf_nfs4_nfl_mirrors;
621
static int hf_nfs4_nfl_util;
622
static int hf_nfs4_nfl_util_stripe_size;
623
static int hf_nfs4_nfl_util_commit_thru_mds;
624
static int hf_nfs4_nfl_util_dense;
625
static int hf_nfs4_nfl_fhs;
626
static int hf_nfs4_mirror_eff;
627
static int hf_nfs4_nfl_first_stripe_index;
628
static int hf_nfs4_lrf_body_content;
629
static int hf_nfs4_reclaim_one_fs;
630
static int hf_nfs4_bctsa_dir;
631
static int hf_nfs4_bctsa_use_conn_in_rdma_mode;
632
static int hf_nfs4_bctsr_dir;
633
static int hf_nfs4_bctsr_use_conn_in_rdma_mode;
634
static int hf_nfs4_sequence_status_flags;
635
static int hf_nfs4_sequence_status_flags_cb_path_down;
636
static int hf_nfs4_sequence_status_flags_cb_gss_contexts_expiring;
637
static int hf_nfs4_sequence_status_flags_cb_gss_contexts_expired;
638
static int hf_nfs4_sequence_status_flags_expired_all_state_revoked;
639
static int hf_nfs4_sequence_status_flags_expired_some_state_revoked;
640
static int hf_nfs4_sequence_status_flags_admin_state_revoked;
641
static int hf_nfs4_sequence_status_flags_recallable_state_revoked;
642
static int hf_nfs4_sequence_status_flags_lease_moved;
643
static int hf_nfs4_sequence_status_flags_restart_reclaim_needed;
644
static int hf_nfs4_sequence_status_flags_cb_path_down_session;
645
static int hf_nfs4_sequence_status_flags_backchannel_fault;
646
static int hf_nfs4_sequence_status_flags_devid_changed;
647
static int hf_nfs4_sequence_status_flags_devid_deleted;
648
static int hf_nfs4_secinfo_style;
649
static int hf_nfs4_test_stateid_arg;
650
static int hf_nfs4_test_stateid_res;
651
static int hf_nfs4_seek_data_content;
652
/* static int hf_nfs4_impl_id_len; */
653
static int hf_nfs4_bitmap_data;
654
static int hf_nfs4_huge_bitmap_length;
655
static int hf_nfs4_universal_address_ipv4;
656
static int hf_nfs4_universal_address_ipv6;
657
static int hf_nfs4_getdevinfo;
658
static int hf_nfs4_ff_version;
659
static int hf_nfs4_ff_minorversion;
660
static int hf_nfs4_ff_tightly_coupled;
661
static int hf_nfs4_ff_rsize;
662
static int hf_nfs4_ff_wsize;
663
static int hf_nfs4_fattr_clone_blocksize;
664
static int hf_nfs4_fattr_space_freed;
665
static int hf_nfs4_fattr_change_attr_type;
666
static int hf_nfs4_ff_layout_flags;
667
static int hf_nfs4_ff_layout_flags_no_layoutcommit;
668
static int hf_nfs4_ff_layout_flags_no_io_thru_mds;
669
static int hf_nfs4_ff_layout_flags_no_read_io;
670
static int hf_nfs4_ff_stats_collect_hint;
671
static int hf_nfs4_ff_synthetic_owner;
672
static int hf_nfs4_ff_synthetic_owner_group;
673
static int hf_nfs4_ff_bytes_completed;
674
static int hf_nfs4_ff_bytes_not_delivered;
675
static int hf_nfs4_ff_bytes_requested;
676
static int hf_nfs4_ff_local;
677
static int hf_nfs4_ff_ops_completed;
678
static int hf_nfs4_ff_ops_requested;
679
static int hf_nfs4_io_bytes;
680
static int hf_nfs4_io_count;
681
static int hf_nfs4_layoutstats;
682
static int hf_nfs4_callback_stateids;
683
static int hf_nfs4_callback_stateids_index;
684
static int hf_nfs4_num_offload_status;
685
static int hf_nfs4_offload_status_index;
686
static int hf_nfs4_consecutive;
687
static int hf_nfs4_netloc;
688
static int hf_nfs4_netloc_type;
689
static int hf_nfs4_nl_name;
690
static int hf_nfs4_nl_url;
691
static int hf_nfs4_source_server_index;
692
static int hf_nfs4_source_servers;
693
static int hf_nfs4_synchronous;
694
static int hf_nfs4_device_error_count;
695
static int hf_nfs4_device_errors_index;
696
static int hf_nfs4_ff_ioerrs_count;
697
static int hf_nfs4_ff_ioerrs_index;
698
static int hf_nfs4_ff_ioerrs_length;
699
static int hf_nfs4_ff_ioerrs_offset;
700
static int hf_nfs4_ff_iostats_count;
701
static int hf_nfs4_ff_iostats_index;
702
static int hf_nfs4_io_error_op;
703
static int hf_nfs4_io_hints_mask;
704
static int hf_nfs4_io_hint_count;
705
static int hf_nfs4_io_advise_hint;
706
static int hf_nfs4_cb_recall_any_objs;
707
static int hf_nfs4_cb_recall_any_count;
708
static int hf_nfs4_cb_recall_any_mask;
709
static int hf_nfs4_cb_recall_any_item;
710
static int hf_nfs4_bytes_copied;
711
static int hf_nfs4_read_plus_contents;
712
static int hf_nfs4_read_plus_content_type;
713
static int hf_nfs4_block_size;
714
static int hf_nfs4_block_count;
715
static int hf_nfs4_reloff_blocknum;
716
static int hf_nfs4_blocknum;
717
static int hf_nfs4_reloff_pattern;
718
static int hf_nfs4_pattern_hash;
719
static int hf_nfs4_setxattr_options;
720
static int hf_nfs4_listxattr_maxcount;
721
static int hf_nfs4_listxattr_cookie;
722
static int hf_nfs4_listxattr_names_len;
723
static int hf_nfs4_xattrkey;
724
static int hf_nfs4_listxattr_eof;
725
static int hf_nfs4_gdd_signal_deleg_avail;
726
static int hf_nfs4_gdd_non_fatal_status;
727
static int hf_nfs4_gdd_child_attr_delay;
728
static int hf_nfs4_gdd_dir_attr_delay;
729
static int hf_nfs4_gdd_child_attrs;
730
static int hf_nfs4_gdd_dir_attrs;
731
static int hf_nfs4_nad_last_entry;
732
733
static int ett_nfs;
734
static int ett_nfs_fh_encoding;
735
static int ett_nfs_fh_mount;
736
static int ett_nfs_fh_file;
737
static int ett_nfs_fh_export;
738
static int ett_nfs_fh_fsid;
739
static int ett_nfs_fh_xfsid;
740
static int ett_nfs_fh_fn;
741
static int ett_nfs_fh_xfn;
742
static int ett_nfs_fh_hp;
743
static int ett_nfs_fh_auth;
744
static int ett_nfs_fhandle;
745
static int ett_nfs_timeval;
746
static int ett_nfs_fattr;
747
static int ett_nfs_readdir_entry;
748
static int ett_nfs_fh_obj;
749
static int ett_nfs_fh_ex;
750
static int ett_nfs_utf8string;
751
752
static int ett_nfs2_mode;
753
static int ett_nfs2_sattr;
754
static int ett_nfs2_diropargs;
755
756
static int ett_nfs3_mode;
757
static int ett_nfs3_specdata;
758
static int ett_nfs3_fh;
759
static int ett_nfs3_nfstime;
760
static int ett_nfs3_fattr;
761
static int ett_nfs3_post_op_fh;
762
static int ett_nfs3_sattr;
763
static int ett_nfs3_diropargs;
764
static int ett_nfs3_sattrguard;
765
static int ett_nfs3_set_mode;
766
static int ett_nfs3_set_uid;
767
static int ett_nfs3_set_gid;
768
static int ett_nfs3_set_size;
769
static int ett_nfs3_set_atime;
770
static int ett_nfs3_set_mtime;
771
static int ett_nfs3_pre_op_attr;
772
static int ett_nfs3_post_op_attr;
773
static int ett_nfs3_wcc_attr;
774
static int ett_nfs3_wcc_data;
775
static int ett_nfs3_access;
776
static int ett_nfs3_fsinfo_properties;
777
static int ett_nfs3_gxfh_utlfield;
778
static int ett_nfs3_gxfh_sfhfield;
779
static int ett_nfs3_gxfh_sfhflags;
780
static int ett_nfs4_fh_pd_flags;
781
static int ett_nfs4_fh_pd_sites;
782
static int ett_nfs4_fh_pd_spaces;
783
784
static int ett_nfs4_compound_call;
785
static int ett_nfs4_request_op;
786
static int ett_nfs4_response_op;
787
static int ett_nfs4_access;
788
static int ett_nfs4_access_supp;
789
static int ett_nfs4_close;
790
static int ett_nfs4_commit;
791
static int ett_nfs4_create;
792
static int ett_nfs4_delegpurge;
793
static int ett_nfs4_delegreturn;
794
static int ett_nfs4_getattr;
795
static int ett_nfs4_getattr_args;
796
static int ett_nfs4_getattr_resp;
797
static int ett_nfs4_resok4;
798
static int ett_nfs4_obj_attrs;
799
static int ett_nfs4_fattr_new_attr_vals;
800
static int ett_nfs4_fattr4_attrmask;
801
static int ett_nfs4_attribute;
802
static int ett_nfs4_getfh;
803
static int ett_nfs4_link;
804
static int ett_nfs4_lock;
805
static int ett_nfs4_lockt;
806
static int ett_nfs4_locku;
807
static int ett_nfs4_lookup;
808
static int ett_nfs4_lookupp;
809
static int ett_nfs4_nverify;
810
static int ett_nfs4_open;
811
static int ett_nfs4_openattr;
812
static int ett_nfs4_open_confirm;
813
static int ett_nfs4_open_downgrade;
814
static int ett_nfs4_putfh;
815
static int ett_nfs4_putpubfh;
816
static int ett_nfs4_putrootfh;
817
static int ett_nfs4_read;
818
static int ett_nfs4_readdir;
819
static int ett_nfs4_readlink;
820
static int ett_nfs4_remove;
821
static int ett_nfs4_rename;
822
static int ett_nfs4_renew;
823
static int ett_nfs4_restorefh;
824
static int ett_nfs4_savefh;
825
static int ett_nfs4_secinfo;
826
static int ett_nfs4_setattr;
827
static int ett_nfs4_setclientid;
828
static int ett_nfs4_setclientid_confirm;
829
static int ett_nfs4_verify;
830
static int ett_nfs4_write;
831
static int ett_nfs4_release_lockowner;
832
static int ett_nfs4_backchannel_ctl;
833
static int ett_nfs4_illegal;
834
static int ett_nfs4_verifier;
835
static int ett_nfs4_dirlist;
836
static int ett_nfs4_dir_entry;
837
static int ett_nfs4_pathname;
838
static int ett_nfs4_change_info;
839
static int ett_nfs4_open_delegation;
840
static int ett_nfs4_open_why_no_deleg;
841
static int ett_nfs4_open_claim;
842
static int ett_nfs4_opentype;
843
static int ett_nfs4_lock_owner;
844
static int ett_nfs4_cb_client;
845
static int ett_nfs4_client_id;
846
static int ett_nfs4_clientowner;
847
static int ett_nfs4_exchangeid_call_flags;
848
static int ett_nfs4_exchangeid_reply_flags;
849
static int ett_nfs4_server_owner;
850
static int ett_nfs4_bitmap;
851
static int ett_nfs4_attr_request;
852
static int ett_nfs4_fattr;
853
static int ett_nfs4_fsid;
854
static int ett_nfs4_fs_locations;
855
static int ett_nfs4_fs_location;
856
static int ett_nfs4_open_result_flags;
857
static int ett_nfs4_secinfo_flavor_info;
858
static int ett_nfs4_stateid;
859
static int ett_nfs4_fattr_fh_expire_type;
860
static int ett_nfs4_fattr_fs_charset_cap;
861
static int ett_nfs4_fattr_aclsupport;
862
static int ett_nfs4_aclflag;
863
static int ett_nfs4_ace;
864
static int ett_nfs4_clientaddr;
865
static int ett_nfs4_aceflag;
866
static int ett_nfs4_acemask;
867
static int ett_nfs4_create_session_flags;
868
static int ett_nfs4_sequence_status_flags;
869
static int ett_nfs4_fh_file;
870
static int ett_nfs4_fh_file_flags;
871
static int ett_nfs4_fh_export;
872
static int ett_nfs4_layoutget;
873
static int ett_nfs4_layoutcommit;
874
static int ett_nfs4_layoutreturn;
875
static int ett_nfs4_getdevinfo;
876
static int ett_nfs4_getdevlist;
877
static int ett_nfs4_bind_conn_to_session;
878
static int ett_nfs4_exchange_id;
879
static int ett_nfs4_create_session;
880
static int ett_nfs4_destroy_session;
881
static int ett_nfs4_free_stateid;
882
static int ett_nfs4_get_dir_delegation;
883
static int ett_nfs4_secinfo_no_name;
884
static int ett_nfs4_sequence;
885
static int ett_nfs4_slotid;
886
static int ett_nfs4_sr_status;
887
static int ett_nfs4_serverscope;
888
static int ett_nfs4_minorid;
889
static int ett_nfs4_majorid;
890
static int ett_nfs4_persist;
891
static int ett_nfs4_backchan;
892
static int ett_nfs4_rdmamode;
893
static int ett_nfs4_padsize;
894
static int ett_nfs4_cbrenforce;
895
static int ett_nfs4_hashalg;
896
static int ett_nfs4_ssvlen;
897
static int ett_nfs4_maxreqsize;
898
static int ett_nfs4_maxrespsize;
899
static int ett_nfs4_maxrespsizecached;
900
static int ett_nfs4_maxops;
901
static int ett_nfs4_maxreqs;
902
static int ett_nfs4_streamchanattrs;
903
static int ett_nfs4_rdmachanattrs;
904
static int ett_nfs4_sec_parms_array;
905
static int ett_nfs4_sec_parms_item;
906
static int ett_nfs4_gids;
907
static int ett_nfs4_machinename;
908
static int ett_nfs4_flavor;
909
static int ett_nfs4_stamp;
910
static int ett_nfs4_uid;
911
static int ett_nfs4_gid;
912
static int ett_nfs4_service;
913
static int ett_nfs4_sessionid;
914
static int ett_nfs4_layoutseg;
915
static int ett_nfs4_layoutseg_sub;
916
static int ett_nfs4_nfl_util;
917
static int ett_nfs4_test_stateid;
918
static int ett_nfs4_destroy_clientid;
919
static int ett_nfs4_reclaim_complete;
920
static int ett_nfs4_allocate;
921
static int ett_nfs4_deallocate;
922
static int ett_nfs4_seek;
923
static int ett_nfs4_chan_attrs;
924
static int ett_nfs4_want_notify_flags;
925
static int ett_nfs4_ff_layout_flags;
926
static int ett_nfs4_scsi_layout_vol;
927
static int ett_nfs4_scsi_layout_vol_indices;
928
static int ett_nfs4_layoutstats;
929
static int ett_nfs4_io_info;
930
static int ett_nfs4_io_latency;
931
static int ett_nfs4_io_time;
932
static int ett_nfs4_callback_stateids_sub;
933
static int ett_nfs4_source_servers_sub;
934
static int ett_nfs4_copy;
935
static int ett_nfs4_copy_notify;
936
static int ett_nfs4_device_errors_sub;
937
static int ett_nfs4_layouterror;
938
static int ett_nfs4_ff_ioerrs_sub;
939
static int ett_nfs4_ff_iostats_sub;
940
static int ett_nfs4_clone;
941
static int ett_nfs4_getxattr;
942
static int ett_nfs4_setxattr;
943
static int ett_nfs4_listxattr;
944
static int ett_nfs4_removexattr;
945
static int ett_nfs4_offload_cancel;
946
static int ett_nfs4_offload_status;
947
static int ett_nfs4_osr_complete_sub;
948
static int ett_nfs4_io_advise;
949
static int ett_nfs4_read_plus;
950
static int ett_nfs4_read_plus_content_sub;
951
static int ett_nfs4_write_same;
952
static int ett_nfs4_listxattr_names;
953
static int ett_nfs4_notify_delay;
954
static int ett_nfs4_notify_attrs;
955
static int ett_nfs4_cb_notify_changes;
956
static int ett_nfs4_cb_notify_list_entries;
957
static int ett_nfs4_cb_notify_attr4_dir;
958
static int ett_nfs4_cb_notify_attr4_child;
959
static int ett_nfs4_cb_notify_remove4;
960
static int ett_nfs4_cb_notify_add4;
961
static int ett_nfs4_cb_notify_rename4;
962
static int ett_nfs4_nfstime;
963
964
static expert_field ei_nfs_too_many_ops;
965
static expert_field ei_nfs_not_vnx_file;
966
static expert_field ei_nfs_too_many_bitmaps;
967
static expert_field ei_nfs_bitmap_no_dissector;
968
static expert_field ei_nfs_bitmap_skip_value;
969
static expert_field ei_nfs_bitmap_undissected_data;
970
static expert_field ei_nfs4_stateid_deprecated;
971
static expert_field ei_nfs_file_system_cycle;
972
973
static int nfsv4_tap;
974
975
static const true_false_string tfs_read_write = { "Read", "Write" };
976
977
/*
978
 * Bitmaps are currently used for attributes and state_protect bits.
979
 * Currently we don't expect more than 4 words, but future protocol
980
 * revisions might add more bits, and in theory an implementation
981
 * might legally zero-pad a bitmask out to something longer.  We keep
982
 * a generous maximum here just as a sanity check:
983
 */
984
0
#define MAX_BITMAPS 100
985
986
/* Prototype for function to dissect attribute value */
987
typedef unsigned (dissect_bitmap_item_t)(tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
988
    rpc_call_info_value *civ, uint32_t opcode, uint32_t fh_idx,
989
    proto_tree *attr_tree, proto_item *attr_item,
990
    uint32_t bit_num, void *battr_data);
991
992
/* Prototype for function to return the header field for the item label */
993
typedef unsigned (get_bitmap_hinfo_t)(uint32_t bit_num);
994
995
/* Bitmap type */
996
typedef enum {
997
  NFS4_BITMAP_MASK,   /* Dissect the bitmap mask only */
998
  NFS4_BITMAP_VALUES  /* Dissect the bitmap mask and their values */
999
} nfs4_bitmap_type_t;
1000
1001
/*
1002
 * Bitmap info structure to customize dissect_nfs4_bitmap() behavior
1003
 * Do not display the item when its corresponding hf_* label is set to NULL
1004
 */
1005
typedef struct _nfs4_bitmap_info_t {
1006
  value_string_ext       *vse_names_ext; /* Extended value strings which maps bit number to attribute name,
1007
            * append list of attribute names to the attr mask header line */
1008
  dissect_bitmap_item_t  *dissect_battr; /* Function to dissect attribute value given by the bit number */
1009
1010
  void *battr_data;      /* Data pass to function dissect_battr */
1011
1012
  int  *hf_mask_label;   /* Label for bitmap mask. If this is set to NULL the mask bytes are just consumed */
1013
  int  *hf_item_label;   /* Label for bitmap item (see get_item_label below) */
1014
  int  *hf_item_count;   /* Label for hidden attribute to display the number of bits set */
1015
  int  *hf_mask_count;   /* Label to display the number of masks in the bitmap */
1016
  int  *hf_btmap_data;   /* Label to display bitmap value data as an opaque */
1017
1018
  get_bitmap_hinfo_t  *get_item_label;   /* Pointer to function to return a dynamically generated hf variable
1019
            * for the item label, this takes precedence over hf_item_label */
1020
} nfs4_bitmap_info_t;
1021
1022
/* Types of fhandles we can dissect */
1023
static dissector_table_t nfs_fhandle_table;
1024
1025
typedef struct nfs_fhandle_data {
1026
  int len;
1027
  const unsigned char *fh;
1028
} nfs_fhandle_data_t;
1029
1030
/* For dissector helpers which take a "levels" argument to indicate how
1031
 * many expansions up they should populate the expansion items with
1032
 * text to enhance useability, this flag to "levels" specify that the
1033
 * text should also be appended to COL_INFO
1034
 */
1035
0
#define COL_INFO_LEVEL 0x80000000
1036
1037
1038
/* fhandle displayfilters to match also corresponding request/response
1039
   packet in addition to the one containing the actual filehandle */
1040
bool nfs_fhandle_reqrep_matching;
1041
static wmem_tree_t *nfs_fhandle_frame_table;
1042
1043
1044
/* file name snooping */
1045
bool nfs_file_name_snooping;
1046
static bool nfs_file_name_full_snooping;
1047
typedef struct nfs_name_snoop {
1048
  int        fh_length;
1049
  unsigned char *fh;
1050
  int        name_len;
1051
  char        *name;
1052
  int        parent_len;
1053
  unsigned char *parent;
1054
  int        full_name_len;
1055
  char        *full_name;
1056
  bool         fs_cycle;
1057
} nfs_name_snoop_t;
1058
1059
typedef struct nfs_name_snoop_key {
1060
  int key;
1061
  int fh_length;
1062
  const unsigned char *fh;
1063
} nfs_name_snoop_key_t;
1064
1065
static GHashTable *nfs_name_snoop_readdir;
1066
static GHashTable *nfs_name_snoop_unmatched;
1067
1068
static GHashTable *nfs_name_snoop_matched;
1069
1070
static wmem_tree_t *nfs_name_snoop_known;
1071
static wmem_tree_t *nfs_file_handles;
1072
1073
static bool nfs_display_v4_tag = true;
1074
static bool display_major_nfs4_ops = true;
1075
1076
/* Types of RDMA reduced opaque data */
1077
typedef enum {
1078
  R_UTF8STRING,
1079
  R_NFS2_PATH,
1080
  R_NFS3_PATH,
1081
  R_NFSDATA,
1082
} rdma_reduce_type_t;
1083
1084
static unsigned dissect_nfsdata_reduced(rdma_reduce_type_t rtype, tvbuff_t *tvb, packet_info* pinfo,
1085
      unsigned offset, proto_tree *tree, int hf, const char **name);
1086
1087
static unsigned dissect_nfs4_stateid(tvbuff_t *tvb, unsigned offset, proto_tree *tree, uint16_t *hash);
1088
1089
static void nfs4_cb_register_prog(tvbuff_t *tvb, int offset);
1090
1091
static void nfs_prompt(packet_info *pinfo _U_, char* result)
1092
0
{
1093
0
  snprintf(result, MAX_DECODE_AS_PROMPT_LEN, "Decode NFS file handles as");
1094
0
}
1095
1096
/* This function will store one nfs filehandle in our global tree of
1097
 * filehandles.
1098
 * We store all filehandles we see in this tree so that every unique
1099
 * filehandle is only stored once with a unique pointer.
1100
 * We need to store pointers to filehandles in several of our other
1101
 * structures and this is a way to make sure we don't keep any redundant
1102
 * copies around for a specific filehandle.
1103
 *
1104
 * If this is the first time this filehandle has been seen an se block
1105
 * is allocated to store the filehandle in.
1106
 * If this filehandle has already been stored in the tree this function returns
1107
 * a pointer to the original copy.
1108
 */
1109
static nfs_fhandle_data_t *
1110
store_nfs_file_handle(nfs_fhandle_data_t *nfs_fh)
1111
0
{
1112
0
  uint32_t        fhlen;
1113
0
  uint32_t       *fhdata;
1114
0
  wmem_tree_key_t     fhkey[3];
1115
0
  nfs_fhandle_data_t *new_nfs_fh;
1116
1117
0
  fhlen = nfs_fh->len/4;
1118
  /* align the file handle data */
1119
0
  fhdata = (uint32_t *)g_memdup2(nfs_fh->fh, fhlen*4);
1120
0
  fhkey[0].length = 1;
1121
0
  fhkey[0].key  = &fhlen;
1122
0
  fhkey[1].length = fhlen;
1123
0
  fhkey[1].key  = fhdata;
1124
0
  fhkey[2].length = 0;
1125
1126
0
  new_nfs_fh = (nfs_fhandle_data_t *)wmem_tree_lookup32_array(nfs_file_handles, &fhkey[0]);
1127
0
  if (new_nfs_fh) {
1128
0
    g_free(fhdata);
1129
0
    return new_nfs_fh;
1130
0
  }
1131
1132
0
  new_nfs_fh = wmem_new(wmem_file_scope(), nfs_fhandle_data_t);
1133
0
  new_nfs_fh->len = nfs_fh->len;
1134
0
  new_nfs_fh->fh = (const unsigned char *)wmem_memdup(wmem_file_scope(), nfs_fh->fh, nfs_fh->len);
1135
0
  fhlen = nfs_fh->len/4;
1136
0
  fhkey[0].length = 1;
1137
0
  fhkey[0].key  = &fhlen;
1138
0
  fhkey[1].length = fhlen;
1139
0
  fhkey[1].key  = fhdata;
1140
0
  fhkey[2].length = 0;
1141
0
  wmem_tree_insert32_array(nfs_file_handles, &fhkey[0], new_nfs_fh);
1142
1143
0
  g_free(fhdata);
1144
0
  return new_nfs_fh;
1145
0
}
1146
1147
1148
static int
1149
nfs_name_snoop_matched_equal(const void *k1, const void *k2)
1150
0
{
1151
0
  const nfs_name_snoop_key_t *key1 = (const nfs_name_snoop_key_t *)k1;
1152
0
  const nfs_name_snoop_key_t *key2 = (const nfs_name_snoop_key_t *)k2;
1153
1154
0
  return (key1->key == key2->key)
1155
0
       &&(key1->fh_length == key2->fh_length)
1156
0
       &&(!memcmp(key1->fh, key2->fh, key1->fh_length));
1157
0
}
1158
1159
1160
static unsigned
1161
nfs_name_snoop_matched_hash(const void *k)
1162
0
{
1163
0
  const nfs_name_snoop_key_t *key = (const nfs_name_snoop_key_t *)k;
1164
0
  int i;
1165
0
  unsigned hash;
1166
1167
0
  hash = key->key;
1168
0
  for (i=0; i<key->fh_length; i++)
1169
0
    hash ^= key->fh[i];
1170
1171
0
  return hash;
1172
0
}
1173
1174
1175
static void
1176
nfs_name_snoop_value_destroy(void *value)
1177
0
{
1178
0
  nfs_name_snoop_t *nns = (nfs_name_snoop_t *)value;
1179
1180
0
  g_free((void *)nns->name);
1181
0
  g_free((void *)nns->full_name);
1182
0
  wmem_free(NULL, nns->parent);
1183
0
  wmem_free(NULL, nns->fh);
1184
0
  g_free(nns);
1185
0
}
1186
1187
1188
static void
1189
nfs_name_snoop_init(void)
1190
16
{
1191
16
  nfs_name_snoop_readdir =
1192
16
    g_hash_table_new_full(g_int64_hash,
1193
16
    g_int64_equal,
1194
16
    NULL, nfs_name_snoop_value_destroy);
1195
16
  nfs_name_snoop_unmatched =
1196
16
    g_hash_table_new_full(g_int64_hash,
1197
16
    g_int64_equal,
1198
16
    NULL, nfs_name_snoop_value_destroy);
1199
16
  nfs_name_snoop_matched =
1200
16
    g_hash_table_new_full(nfs_name_snoop_matched_hash,
1201
16
    nfs_name_snoop_matched_equal,
1202
16
    NULL, nfs_name_snoop_value_destroy);
1203
16
}
1204
1205
static void
1206
nfs_name_snoop_cleanup(void)
1207
0
{
1208
0
  g_hash_table_destroy(nfs_name_snoop_readdir);
1209
0
  g_hash_table_destroy(nfs_name_snoop_unmatched);
1210
0
  g_hash_table_destroy(nfs_name_snoop_matched);
1211
0
}
1212
1213
1214
void
1215
nfs_name_snoop_add_name(uint64_t id, tvbuff_t *tvb, unsigned name_offset, unsigned name_len, unsigned parent_offset,
1216
  unsigned parent_len, const char *name)
1217
0
{
1218
0
  nfs_name_snoop_t *nns;
1219
0
  const char   *ptr;
1220
0
  uint64_t   *key;
1221
1222
0
  if (name_len <= 0) {
1223
    /* Do we need some way to signal an error here? This could be
1224
     * programmatic or just a corrupt packet, depending on the
1225
     * caller... */
1226
0
    return;
1227
0
  }
1228
1229
  /* filter out all '.' and '..' names */
1230
0
  if (!name) {
1231
0
    ptr = (const char *)tvb_get_ptr(tvb, name_offset, name_len);
1232
0
  } else {
1233
0
    ptr = name;
1234
0
  }
1235
0
  if (ptr[0] == '.') {
1236
0
    if (name_len <= 1 || ptr[1] == 0) {
1237
0
      return;
1238
0
    }
1239
0
    if (ptr[1] == '.') {
1240
0
      if (name_len <= 2 || ptr[2] == 0) {
1241
0
        return;
1242
0
      }
1243
0
    }
1244
0
  }
1245
1246
0
  nns = g_new(nfs_name_snoop_t, 1);
1247
1248
0
  nns->fh_length = 0;
1249
0
  nns->fh = NULL;
1250
1251
0
  if (parent_len) {
1252
0
    nns->parent_len = parent_len;
1253
0
    nns->parent = (unsigned char *)tvb_memdup(NULL, tvb, parent_offset, parent_len);
1254
0
  } else {
1255
0
    nns->parent_len = 0;
1256
0
    nns->parent = NULL;
1257
0
  }
1258
1259
0
  if (name) {
1260
0
    nns->name_len = (int)strlen(name);
1261
0
    nns->name = g_strdup(name);
1262
0
  } else {
1263
0
    nns->name_len = name_len;
1264
0
    nns->name = (char *)g_malloc(name_len+1);
1265
0
    memcpy(nns->name, ptr, name_len);
1266
0
  }
1267
0
  nns->name[nns->name_len] = 0;
1268
1269
0
  nns->full_name_len = 0;
1270
0
  nns->full_name = NULL;
1271
0
  nns->fs_cycle = false;
1272
1273
  /* any old entry will be deallocated and removed */
1274
0
  key = g_new0(uint64_t, 1);
1275
0
  *key = id;
1276
0
  g_hash_table_insert(nfs_name_snoop_unmatched, key, nns);
1277
0
}
1278
1279
1280
static void
1281
nfs_name_snoop_add_fh(uint64_t id, tvbuff_t *tvb, int fh_offset, int fh_length)
1282
0
{
1283
0
  unsigned char      *fh;
1284
0
  nfs_name_snoop_t     *nns;
1285
0
  nfs_name_snoop_key_t *key;
1286
0
  gpointer             stolen_key;
1287
1288
  /* find which request we correspond to */
1289
0
  nns = (nfs_name_snoop_t *)g_hash_table_lookup(nfs_name_snoop_unmatched, &id);
1290
0
  if (!nns) {
1291
    /* oops couldn't find matching request, bail out */
1292
0
    return;
1293
0
  }
1294
1295
  /* if we have already seen this response earlier */
1296
0
  if (nns->fh) {
1297
0
    return;
1298
0
  }
1299
1300
  /* oki, we have a new entry */
1301
0
  fh = (unsigned char *)tvb_memdup(NULL, tvb, fh_offset, fh_length);
1302
0
  nns->fh = fh;
1303
0
  nns->fh_length = fh_length;
1304
1305
0
  key = wmem_new(wmem_file_scope(), nfs_name_snoop_key_t);
1306
0
  key->key = 0;
1307
0
  key->fh_length = nns->fh_length;
1308
0
  key->fh = nns->fh;
1309
1310
0
  g_hash_table_steal_extended(nfs_name_snoop_unmatched, &id, &stolen_key, NULL);
1311
0
  g_free(stolen_key);
1312
0
  g_hash_table_replace(nfs_name_snoop_matched, key, nns);
1313
0
}
1314
1315
static void
1316
nfs_name_snoop_readdir_add_parent_fh(uint64_t id, tvbuff_t *tvb, int fh_offset, int fh_length)
1317
0
{
1318
0
  nfs_name_snoop_t     *nns;
1319
0
  unsigned char        *fh;
1320
0
  uint64_t             *key;
1321
1322
0
  fh = (unsigned char *)tvb_memdup(NULL, tvb, fh_offset, fh_length);
1323
1324
0
  nns = g_new0(nfs_name_snoop_t, 1);
1325
0
  nns->parent_len = fh_length;
1326
0
  nns->parent = fh;
1327
1328
0
  key = g_new0(uint64_t, 1);
1329
0
  *key = id;
1330
0
  g_hash_table_insert(nfs_name_snoop_readdir, key, nns);
1331
0
}
1332
1333
static void
1334
nfs_name_snoop_readdir_add_child_fh_name(uint64_t id, tvbuff_t *tvb, int fh_offset, int fh_length, const char *name)
1335
0
{
1336
0
  nfs_name_snoop_t     *readdir_nns;
1337
0
  unsigned char        *fh;
1338
0
  nfs_name_snoop_t     *nns;
1339
0
  nfs_name_snoop_key_t *key;
1340
1341
0
  if (strcmp(name, ".") == 0 || strcmp(name, "..") == 0)
1342
0
    return;
1343
1344
0
  readdir_nns = (nfs_name_snoop_t *)g_hash_table_lookup(nfs_name_snoop_readdir, &id);
1345
0
  if (!readdir_nns)
1346
0
    return;
1347
1348
0
  fh = (unsigned char *)tvb_memdup(NULL, tvb, fh_offset, fh_length);
1349
1350
0
  nns = g_new(nfs_name_snoop_t, 1);
1351
0
  nns->fh_length = fh_length;
1352
0
  nns->fh = fh;
1353
0
  nns->parent_len = readdir_nns->parent_len;
1354
0
  nns->parent = g_malloc(readdir_nns->parent_len);
1355
0
  memcpy(nns->parent, readdir_nns->parent, readdir_nns->parent_len);
1356
0
  nns->name_len = (int)strlen(name);
1357
0
  nns->name = g_strdup(name);
1358
0
  nns->full_name_len = 0;
1359
0
  nns->full_name = NULL;
1360
0
  nns->fs_cycle = false;
1361
1362
0
  key = wmem_new(wmem_file_scope(), nfs_name_snoop_key_t);
1363
0
  key->key = 0;
1364
0
  key->fh_length = nns->fh_length;
1365
0
  key->fh = nns->fh;
1366
1367
0
  g_hash_table_replace(nfs_name_snoop_matched, key, nns);
1368
1369
  /* do not remove entry from the nfs_name_snoop_readdir as it is used for more child names, not just this one */
1370
0
}
1371
1372
0
#define NFS_MAX_FS_DEPTH 100
1373
1374
static void
1375
// NOLINTNEXTLINE(misc-no-recursion)
1376
nfs_full_name_snoop(packet_info *pinfo, nfs_name_snoop_t *nns, int *len, char **name, char **pos)
1377
0
{
1378
0
  nfs_name_snoop_t     *parent_nns = NULL;
1379
0
  nfs_name_snoop_key_t  key;
1380
1381
  /* check if the nns component ends with a '/' else we just allocate
1382
     an extra byte to len to accommodate for it later */
1383
0
  if (nns->name[nns->name_len-1] != '/') {
1384
0
    (*len)++;
1385
0
  }
1386
1387
0
  (*len) += nns->name_len;
1388
1389
0
  if (nns->parent == NULL) {
1390
0
    *name = (char *)g_malloc((*len)+1);
1391
0
    *pos = *name;
1392
1393
0
    *pos += snprintf(*pos, (*len)+1, "%s", nns->name);
1394
0
    DISSECTOR_ASSERT((*pos-*name) <= *len);
1395
0
    return;
1396
0
  }
1397
1398
0
  key.key = 0;
1399
0
  key.fh_length = nns->parent_len;
1400
0
  key.fh = nns->parent;
1401
1402
0
  parent_nns = (nfs_name_snoop_t *)g_hash_table_lookup(nfs_name_snoop_matched, &key);
1403
1404
0
  if (parent_nns) {
1405
0
    unsigned fs_depth = p_get_proto_depth(pinfo, proto_nfs);
1406
0
    if (++fs_depth >= NFS_MAX_FS_DEPTH) {
1407
0
      nns->fs_cycle = true;
1408
0
      return;
1409
0
    }
1410
0
    p_set_proto_depth(pinfo, proto_nfs, fs_depth);
1411
1412
0
    nfs_full_name_snoop(pinfo, parent_nns, len, name, pos);
1413
0
    if (*name) {
1414
      /* make sure components are '/' separated */
1415
0
      *pos += snprintf(*pos, (*len+1) - (*pos-*name), "%s%s",
1416
0
             ((*pos)[-1] != '/')?"/":"", nns->name);
1417
0
      DISSECTOR_ASSERT((*pos-*name) <= *len);
1418
0
    }
1419
0
    p_set_proto_depth(pinfo, proto_nfs, fs_depth - 1);
1420
0
    return;
1421
0
  }
1422
1423
0
  return;
1424
0
}
1425
1426
1427
static void
1428
nfs_name_snoop_fh(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int fh_offset,
1429
          int fh_length, bool hidden)
1430
0
{
1431
0
  nfs_name_snoop_key_t  key;
1432
0
  nfs_name_snoop_t     *nns = NULL;
1433
1434
  /* if this is a new packet, see if we can register the mapping */
1435
0
  if (!pinfo->fd->visited) {
1436
0
    key.key = 0;
1437
0
    key.fh_length = fh_length;
1438
0
    key.fh = (const unsigned char *)tvb_get_ptr(tvb, fh_offset, fh_length);
1439
1440
0
    nns = (nfs_name_snoop_t *)g_hash_table_lookup(nfs_name_snoop_matched, &key);
1441
0
    if (nns) {
1442
0
      uint32_t fhlen;
1443
0
      uint32_t *fhdata;
1444
0
      wmem_tree_key_t fhkey[3];
1445
1446
0
      fhlen = nns->fh_length;
1447
      /* align it */
1448
0
      fhdata = (uint32_t *)g_memdup2(nns->fh, fhlen);
1449
0
      fhkey[0].length = 1;
1450
0
      fhkey[0].key  = &fhlen;
1451
0
      fhkey[1].length = fhlen/4;
1452
0
      fhkey[1].key  = fhdata;
1453
0
      fhkey[2].length = 0;
1454
0
      wmem_tree_insert32_array(nfs_name_snoop_known, &fhkey[0], nns);
1455
0
      g_free(fhdata);
1456
1457
0
      if (nfs_file_name_full_snooping) {
1458
0
        char *name = NULL, *pos = NULL;
1459
0
        int len = 0;
1460
1461
0
        nfs_full_name_snoop(pinfo, nns, &len, &name, &pos);
1462
0
        if (name) {
1463
0
          nns->full_name = name;
1464
0
          nns->full_name_len = len;
1465
0
        }
1466
0
      }
1467
0
    }
1468
0
  }
1469
1470
  /* see if we know this mapping */
1471
0
  if (!nns) {
1472
0
    uint32_t fhlen;
1473
0
    uint32_t *fhdata;
1474
0
    wmem_tree_key_t fhkey[3];
1475
1476
0
    fhlen = fh_length;
1477
    /* align it */
1478
0
    fhdata = (uint32_t *)tvb_memdup(pinfo->pool, tvb, fh_offset, fh_length);
1479
0
    fhkey[0].length = 1;
1480
0
    fhkey[0].key  = &fhlen;
1481
0
    fhkey[1].length = fhlen/4;
1482
0
    fhkey[1].key  = fhdata;
1483
0
    fhkey[2].length = 0;
1484
1485
0
    nns = (nfs_name_snoop_t *)wmem_tree_lookup32_array(nfs_name_snoop_known, &fhkey[0]);
1486
0
  }
1487
1488
  /* if we know the mapping, print the filename */
1489
0
  if (nns) {
1490
0
    proto_item *fh_item = NULL;
1491
1492
0
    if (hidden) {
1493
0
      fh_item = proto_tree_add_string(tree, hf_nfs_name, NULL,
1494
0
        0, 0, nns->name);
1495
0
      proto_item_set_hidden(fh_item);
1496
0
    } else {
1497
0
      fh_item = proto_tree_add_string(tree, hf_nfs_name, tvb,
1498
0
        fh_offset, 0, nns->name);
1499
0
    }
1500
0
    proto_item_set_generated(fh_item);
1501
1502
0
    if (nns->full_name) {
1503
0
      if (hidden) {
1504
0
        fh_item = proto_tree_add_string(tree, hf_nfs_full_name, NULL,
1505
0
          0, 0, nns->full_name);
1506
0
        proto_item_set_hidden(fh_item);
1507
0
      } else {
1508
0
        fh_item = proto_tree_add_string_format_value(tree, hf_nfs_full_name, tvb,
1509
0
          fh_offset, 0, nns->full_name, "%s", nns->full_name);
1510
0
      }
1511
0
      proto_item_set_generated(fh_item);
1512
0
    }
1513
1514
0
    if (nns->fs_cycle) {
1515
0
      proto_tree_add_expert(tree, pinfo, &ei_nfs_file_system_cycle, tvb, 0, 0);
1516
0
    }
1517
0
  }
1518
0
}
1519
1520
1521
/* file handle dissection */
1522
1523
static const true_false_string tfs_endianness = { "Little Endian", "Big Endian" };
1524
1525
static void
1526
nfs_fmt_fsid( char *result, uint32_t revision )
1527
0
{
1528
0
  uint32_t fsid_major;
1529
0
  uint32_t fsid_minor;
1530
1531
0
  fsid_major = ( revision>>18 ) &  0x3fff; /* 14 bits */
1532
0
  fsid_minor = ( revision     ) & 0x3ffff; /* 18 bits */
1533
1534
0
   snprintf( result, ITEM_LABEL_LENGTH, "%u,%u", fsid_major, fsid_minor);
1535
0
}
1536
1537
/* SVR4: checked with ReliantUNIX (5.43, 5.44, 5.45), OpenSolaris (build 101a) */
1538
static int
1539
dissect_fhandle_data_SVR4(tvbuff_t* tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
1540
0
{
1541
0
  unsigned encoding = ENC_BIG_ENDIAN; /* We support little endian and big endian. Default is big endian*/
1542
0
  bool have_flag = false;  /* The flag field at the end is optional. Assume no flag is there */
1543
0
  bool found = false;    /* Did we really detect the file handle format? */
1544
0
  uint32_t   nof = 0;
1545
0
  uint32_t   len1;
1546
0
  uint32_t   len2;
1547
0
  uint32_t   fhlen;   /* File handle length. */
1548
1549
0
  static int * const fsid_fields[] = {
1550
0
    &hf_nfs_fh_fsid_major32,
1551
0
    &hf_nfs_fh_fsid_minor32,
1552
0
    NULL
1553
0
  };
1554
1555
  /* Somehow this is no calling argument, so we have to re-calculate it. */
1556
0
  fhlen = tvb_reported_length(tvb);
1557
1558
  /* Check for little endianness. */
1559
0
  len1 = tvb_get_letohs(tvb, 8);
1560
0
  if (tvb_bytes_exist(tvb, 10+len1, 2)) {
1561
0
    len2 = tvb_get_letohs(tvb, 10+len1);
1562
1563
0
    if (12+len1+len2 == fhlen) {
1564
0
      encoding = ENC_LITTLE_ENDIAN;
1565
0
      have_flag = false;
1566
0
      found = true;
1567
0
    }
1568
0
    if (16+len1+len2 == fhlen) {
1569
0
      encoding = ENC_LITTLE_ENDIAN;
1570
0
      have_flag = true;
1571
0
      found = true;
1572
0
    }
1573
0
  }
1574
1575
0
  if (!found) {
1576
    /* Check for big endianness. */
1577
0
    len1 = tvb_get_ntohs(tvb, 8);
1578
0
    if (tvb_bytes_exist(tvb, 10+len1, 2)) {
1579
0
      len2 = tvb_get_ntohs(tvb, 10+len1);
1580
1581
0
      if (12+len1+len2 == fhlen) {
1582
0
        have_flag = false;
1583
0
      }
1584
0
      if (16+len1+len2 == fhlen) {
1585
0
        have_flag = true;
1586
0
      }
1587
0
    }
1588
0
  }
1589
1590
0
  proto_tree_add_boolean(tree, hf_nfs_fh_endianness, tvb, 0, fhlen, (encoding == ENC_LITTLE_ENDIAN));
1591
1592
  /* We are fairly sure, that when found == false, the following code will
1593
  throw an exception. */
1594
1595
  /* file system id */
1596
0
  proto_tree_add_bitmask(tree, tvb, nof, hf_nfs_fh_fsid,
1597
0
          ett_nfs_fh_fsid, fsid_fields, encoding);
1598
0
  nof += 4;
1599
1600
  /* file system type */
1601
0
  proto_tree_add_item(tree, hf_nfs_fh_fstype, tvb, nof, 4, encoding);
1602
0
  nof += 4;
1603
1604
  /* file number */
1605
0
  {
1606
0
    uint32_t fn_O;
1607
0
    uint32_t fn_len_O;
1608
0
    uint32_t fn_len_L;
1609
0
    uint32_t fn_len;
1610
0
    uint32_t fn_data_O;
1611
0
    uint32_t fn_data_inode_O;
1612
0
    uint32_t fn_data_inode_L;
1613
0
    uint32_t inode;
1614
0
    uint32_t fn_data_gen_O;
1615
0
    uint32_t fn_data_gen_L;
1616
0
    uint32_t gen;
1617
0
    uint32_t fn_L;
1618
1619
0
    fn_O = nof;
1620
0
    fn_len_O = fn_O;
1621
0
    fn_len_L = 2;
1622
0
    fn_len = tvb_get_uint16(tvb, fn_len_O, encoding);
1623
0
    fn_data_O = fn_O + fn_len_L;
1624
0
    fn_data_inode_O = fn_data_O + 2;
1625
0
    fn_data_inode_L = 4;
1626
0
    inode = tvb_get_uint32(tvb, fn_data_inode_O, encoding);
1627
0
    fn_data_gen_O = fn_data_inode_O + fn_data_inode_L;
1628
0
    fn_data_gen_L = 4;
1629
0
    gen = tvb_get_uint32(tvb, fn_data_gen_O, encoding);
1630
0
    fn_L = fn_len_L + fn_len;
1631
0
    if (tree) {
1632
0
      proto_item *fn_item = NULL;
1633
0
      proto_tree *fn_tree = NULL;
1634
1635
0
      fn_item = proto_tree_add_uint(tree, hf_nfs_fh_fn, tvb,
1636
0
                  fn_O, fn_L, inode);
1637
0
      fn_tree = proto_item_add_subtree(fn_item,
1638
0
               ett_nfs_fh_fn);
1639
0
      proto_tree_add_uint(fn_tree, hf_nfs_fh_fn_len,
1640
0
              tvb, fn_len_O, fn_len_L, fn_len);
1641
0
      proto_tree_add_uint(fn_tree, hf_nfs_fh_fn_inode,
1642
0
              tvb, fn_data_inode_O, fn_data_inode_L, inode);
1643
0
      proto_tree_add_uint(fn_tree, hf_nfs_fh_fn_generation,
1644
0
              tvb, fn_data_gen_O, fn_data_gen_L, gen);
1645
0
    }
1646
0
    nof = fn_O + fn_len_L + fn_len;
1647
0
  }
1648
1649
  /* exported file number */
1650
0
  {
1651
0
    uint32_t xfn_O;
1652
0
    uint32_t xfn_len_O;
1653
0
    uint32_t xfn_len_L;
1654
0
    uint32_t xfn_len;
1655
0
    uint32_t xfn_data_O;
1656
0
    uint32_t xfn_data_inode_O;
1657
0
    uint32_t xfn_data_inode_L;
1658
0
    uint32_t xinode;
1659
0
    uint32_t xfn_data_gen_O;
1660
0
    uint32_t xfn_data_gen_L;
1661
0
    uint32_t xgen;
1662
0
    uint32_t xfn_L;
1663
1664
0
    xfn_O = nof;
1665
0
    xfn_len_O = xfn_O;
1666
0
    xfn_len_L = 2;
1667
0
    xfn_len = tvb_get_uint16(tvb, xfn_len_O, encoding);
1668
0
    xfn_data_O = xfn_O + xfn_len_L;
1669
0
    xfn_data_inode_O = xfn_data_O + 2;
1670
0
    xfn_data_inode_L = 4;
1671
0
    xinode = tvb_get_uint32(tvb, xfn_data_inode_O, encoding);
1672
0
    xfn_data_gen_O = xfn_data_inode_O + xfn_data_inode_L;
1673
0
    xfn_data_gen_L = 4;
1674
0
    xgen = tvb_get_uint32(tvb, xfn_data_gen_O, encoding);
1675
0
    xfn_L = xfn_len_L + xfn_len;
1676
1677
0
    if (tree) {
1678
0
      proto_item *xfn_item = NULL;
1679
0
      proto_tree *xfn_tree = NULL;
1680
1681
0
      xfn_item = proto_tree_add_uint(tree, hf_nfs_fh_xfn, tvb,
1682
0
                   xfn_O, xfn_L, xinode);
1683
0
      xfn_tree = proto_item_add_subtree(xfn_item,
1684
0
                ett_nfs_fh_xfn);
1685
0
      proto_tree_add_uint(xfn_tree, hf_nfs_fh_xfn_len,
1686
0
              tvb, xfn_len_O, xfn_len_L, xfn_len);
1687
0
      proto_tree_add_uint(xfn_tree, hf_nfs_fh_xfn_inode,
1688
0
              tvb, xfn_data_inode_O, xfn_data_inode_L, xinode);
1689
0
      proto_tree_add_uint(xfn_tree, hf_nfs_fh_xfn_generation,
1690
0
              tvb, xfn_data_gen_O, xfn_data_gen_L, xgen);
1691
0
    }
1692
0
    nof = xfn_O + xfn_len_L + xfn_len;
1693
0
  }
1694
1695
  /* flag */
1696
0
  if (have_flag)
1697
0
    proto_tree_add_item(tree, hf_nfs_fh_flag, tvb, nof, 4, encoding);
1698
1699
0
  return tvb_captured_length(tvb);
1700
0
}
1701
1702
1703
/* Checked with RedHat Linux 6.2 (kernel 2.2.14 knfsd) */
1704
1705
static int
1706
dissect_fhandle_data_LINUX_KNFSD_LE(tvbuff_t* tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
1707
0
{
1708
0
  if (tree) {
1709
0
    int offset = 0;
1710
0
    uint32_t temp;
1711
0
    uint32_t fsid_major;
1712
0
    uint32_t fsid_minor;
1713
0
    uint32_t xfsid_major;
1714
0
    uint32_t xfsid_minor;
1715
1716
0
    temp      = tvb_get_letohs (tvb, offset+12);
1717
0
    fsid_major  = (temp >> 8) & 0xff;
1718
0
    fsid_minor  = (temp     ) & 0xff;
1719
0
    temp      = tvb_get_letohs(tvb, offset+16);
1720
0
    xfsid_major = (temp >> 8) & 0xff;
1721
0
    xfsid_minor = (temp     ) & 0xff;
1722
1723
0
    proto_tree_add_item(tree, hf_nfs_fh_dentry, tvb, offset+0, 4, ENC_LITTLE_ENDIAN);
1724
0
    proto_tree_add_item(tree, hf_nfs_fh_fn_inode, tvb, offset+4, 4, ENC_LITTLE_ENDIAN);
1725
0
    proto_tree_add_item(tree, hf_nfs_fh_dirinode, tvb, offset+8, 4, ENC_LITTLE_ENDIAN);
1726
1727
    /* file system id (device) */
1728
0
    {
1729
0
      proto_tree *fsid_tree;
1730
1731
0
      fsid_tree = proto_tree_add_subtree_format(tree, tvb,
1732
0
              offset+12, 4, ett_nfs_fh_fsid, NULL,
1733
0
              "file system ID: %u,%u",
1734
0
              fsid_major, fsid_minor);
1735
0
      proto_tree_add_item(fsid_tree, hf_nfs_fh_fsid_major16_mask, tvb, offset+12, 2, ENC_LITTLE_ENDIAN);
1736
0
      proto_tree_add_item(fsid_tree, hf_nfs_fh_fsid_minor16_mask, tvb, offset+12, 2, ENC_LITTLE_ENDIAN);
1737
0
    }
1738
1739
    /* exported file system id (device) */
1740
0
    {
1741
0
      proto_tree *xfsid_tree;
1742
1743
0
      xfsid_tree = proto_tree_add_subtree_format(tree, tvb,
1744
0
               offset+16, 4, ett_nfs_fh_xfsid, NULL,
1745
0
               "exported file system ID: %u,%u", xfsid_major, xfsid_minor);
1746
0
      proto_tree_add_item(xfsid_tree, hf_nfs_fh_xfsid_major, tvb, offset+16, 2, ENC_LITTLE_ENDIAN);
1747
0
      proto_tree_add_item(xfsid_tree, hf_nfs_fh_xfsid_minor, tvb, offset+16, 2, ENC_LITTLE_ENDIAN);
1748
0
    }
1749
1750
0
    proto_tree_add_item(tree, hf_nfs_fh_xfn_inode, tvb, offset+20, 4, ENC_LITTLE_ENDIAN);
1751
0
    proto_tree_add_item(tree, hf_nfs_fh_fn_generation, tvb, offset+24, 4, ENC_LITTLE_ENDIAN);
1752
0
  }
1753
0
  return tvb_captured_length(tvb);
1754
0
}
1755
1756
1757
/* Checked with RedHat Linux 5.2 (nfs-server 2.2beta47 user-land nfsd) */
1758
1759
static int
1760
dissect_fhandle_data_LINUX_NFSD_LE(tvbuff_t* tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
1761
0
{
1762
0
  unsigned offset = 0;
1763
1764
  /* pseudo inode */
1765
0
  proto_tree_add_item(tree, hf_nfs_fh_pinode, tvb, offset+0, 4, ENC_LITTLE_ENDIAN);
1766
1767
  /* hash path */
1768
0
  {
1769
0
    uint32_t hashlen;
1770
1771
0
    hashlen  = tvb_get_uint8(tvb, offset+4);
1772
0
    if (tree) {
1773
0
      proto_tree *hash_tree;
1774
1775
0
      hash_tree = proto_tree_add_subtree_format(tree, tvb, offset+4, hashlen + 1, ett_nfs_fh_hp, NULL,
1776
0
                  "hash path: %s", tvb_bytes_to_str(pinfo->pool, tvb, offset+5, hashlen));
1777
0
      proto_tree_add_uint(hash_tree,
1778
0
              hf_nfs_fh_hp_len, tvb, offset+4, 1,
1779
0
              hashlen);
1780
0
      proto_tree_add_item(hash_tree, hf_nfs_fh_hp_key, tvb, offset+5, hashlen, ENC_NA);
1781
0
    }
1782
0
  }
1783
0
  return tvb_captured_length(tvb);
1784
0
}
1785
1786
1787
static int
1788
dissect_fhandle_data_NETAPP(tvbuff_t* tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
1789
0
{
1790
0
  unsigned offset = 0;
1791
0
  static int * const flags[] = {
1792
0
    &hf_nfs_fh_file_flag_mntpoint,
1793
0
    &hf_nfs_fh_file_flag_snapdir,
1794
0
    &hf_nfs_fh_file_flag_snapdir_ent,
1795
0
    &hf_nfs_fh_file_flag_empty,
1796
0
    &hf_nfs_fh_file_flag_vbn_access,
1797
0
    &hf_nfs_fh_file_flag_multivolume,
1798
0
    &hf_nfs_fh_file_flag_metadata,
1799
0
    NULL
1800
0
  };
1801
1802
0
  if (tree) {
1803
0
    uint32_t mount         = tvb_get_letohl(tvb, offset +  0);
1804
1805
0
    uint32_t inum        = tvb_get_ntohl( tvb, offset + 12);
1806
0
    uint32_t nfsexport      = tvb_get_letohl(tvb, offset + 24);
1807
0
    uint32_t export_snapgen = tvb_get_letohl(tvb, offset + 28);
1808
1809
0
    proto_tree *subtree = NULL;
1810
1811
0
    subtree = proto_tree_add_subtree_format(tree, tvb, offset + 0, 8,
1812
0
             ett_nfs_fh_mount, NULL, "mount (inode %u)", mount);
1813
0
    proto_tree_add_uint(subtree, hf_nfs_fh_mount_fileid,
1814
0
             tvb, offset + 0, 4, mount);
1815
0
    proto_tree_add_item(subtree, hf_nfs_fh_mount_generation, tvb, offset + 4, 4, ENC_LITTLE_ENDIAN);
1816
0
    subtree = proto_tree_add_subtree_format(tree, tvb, offset + 8, 16,
1817
0
             ett_nfs_fh_file, NULL, "file (inode %u)", inum);
1818
1819
0
    proto_tree_add_bitmask_with_flags(subtree, tvb, offset + 8, hf_nfs_fh_flags, ett_nfs4_fh_file_flags, flags, ENC_LITTLE_ENDIAN, BMT_NO_FALSE);
1820
1821
0
    proto_tree_add_item(subtree, hf_nfs_fh_snapid, tvb, offset + 10, 1, ENC_NA);
1822
0
    proto_tree_add_item(subtree, hf_nfs_fh_unused, tvb, offset + 11, 1, ENC_NA);
1823
0
    proto_tree_add_item(subtree, hf_nfs_fh_fileid, tvb, offset + 12, 4, ENC_BIG_ENDIAN);
1824
0
    proto_tree_add_item(subtree, hf_nfs_fh_generation, tvb, offset + 16, 4, ENC_LITTLE_ENDIAN);
1825
0
    proto_tree_add_item(subtree, hf_nfs_fh_fsid, tvb, offset + 20, 4, ENC_LITTLE_ENDIAN);
1826
0
    subtree = proto_tree_add_subtree_format(tree, tvb, offset + 24, 8,
1827
0
             ett_nfs_fh_export, NULL, "export (inode %u)", nfsexport);
1828
0
    proto_tree_add_uint(subtree, hf_nfs_fh_export_fileid,
1829
0
             tvb, offset + 24, 4, nfsexport);
1830
0
    proto_tree_add_uint(subtree,
1831
0
             hf_nfs_fh_export_generation,
1832
0
             tvb, offset + 28, 3,
1833
0
             export_snapgen & 0xffffff);
1834
0
    proto_tree_add_uint(subtree, hf_nfs_fh_export_snapid,
1835
0
             tvb, offset + 31, 1,
1836
0
             export_snapgen >> 24);
1837
0
  }
1838
0
  return tvb_captured_length(tvb);
1839
0
}
1840
1841
static const value_string handle_type_strings[] = {
1842
  { 0, "NORMAL" },
1843
  { 1, "UNEXP" },
1844
  { 2, "VOLDIR" },
1845
  { 3, "ROOT" },
1846
  { 4, "ABSENT" },
1847
  { 0, NULL }
1848
};
1849
1850
static int
1851
dissect_fhandle_data_NETAPP_V4(tvbuff_t* tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
1852
0
{
1853
0
  static int * const flags[] = {
1854
0
    &hf_nfs_fh_file_flag_mntpoint,
1855
0
    &hf_nfs_fh_file_flag_snapdir,
1856
0
    &hf_nfs_fh_file_flag_snapdir_ent,
1857
0
    &hf_nfs_fh_file_flag_empty,
1858
0
    &hf_nfs_fh_file_flag_vbn_access,
1859
0
    &hf_nfs_fh_file_flag_multivolume,
1860
0
    &hf_nfs_fh_file_flag_metadata,
1861
0
    &hf_nfs_fh_file_flag_orphan,
1862
0
    &hf_nfs_fh_file_flag_foster,
1863
0
    &hf_nfs_fh_file_flag_named_attr,
1864
0
    &hf_nfs_fh_file_flag_exp_snapdir,
1865
0
    &hf_nfs_fh_file_flag_vfiler,
1866
0
    &hf_nfs_fh_file_flag_aggr,
1867
0
    &hf_nfs_fh_file_flag_striped,
1868
0
    &hf_nfs_fh_file_flag_private,
1869
0
    &hf_nfs_fh_file_flag_next_gen,
1870
0
    NULL
1871
0
  };
1872
1873
0
  if (tree == NULL)
1874
0
    return tvb_captured_length(tvb);
1875
1876
0
  {
1877
0
    int     offset = 0;
1878
0
    proto_tree *subtree;
1879
0
    uint32_t      fileid;
1880
0
    uint32_t      handle_type;
1881
0
    uint32_t      inum;
1882
0
    unsigned encoding;
1883
1884
0
    handle_type = tvb_get_ntohl(tvb, offset + 24);
1885
0
    inum      = tvb_get_ntohl(tvb, offset + 12);
1886
1887
0
    if ( handle_type != 0 && handle_type <= 255) {
1888
0
      encoding = ENC_BIG_ENDIAN;
1889
0
    } else {
1890
0
      encoding = ENC_LITTLE_ENDIAN;
1891
0
    }
1892
0
        fileid = tvb_get_uint32(tvb, offset, encoding);
1893
0
    subtree = proto_tree_add_subtree_format(tree, tvb, offset + 0, 8, ett_nfs4_fh_export, NULL, "export (inode %u)", fileid);
1894
1895
0
    proto_tree_add_item(subtree, hf_nfs_fh_export_fileid, tvb, offset + 0, 4, encoding);
1896
0
    proto_tree_add_item(subtree, hf_nfs_fh_export_generation, tvb, offset + 4, 4, encoding);
1897
0
    subtree = proto_tree_add_subtree_format(tree, tvb, offset + 8, 16, ett_nfs4_fh_file, NULL, "file (inode %u)", inum);
1898
1899
0
    proto_tree_add_bitmask_with_flags(subtree, tvb, offset + 8, hf_nfs_fh_flags, ett_nfs4_fh_file_flags, flags, encoding, BMT_NO_FALSE);
1900
1901
0
    proto_tree_add_item(subtree, hf_nfs_fh_snapid, tvb, offset + 10, 1, ENC_NA);
1902
0
    proto_tree_add_item(subtree, hf_nfs_fh_unused, tvb, offset + 11, 1, ENC_NA);
1903
0
    proto_tree_add_item(subtree, hf_nfs_fh_fileid, tvb, offset + 12, 4, encoding);
1904
0
    proto_tree_add_item(subtree, hf_nfs_fh_generation, tvb, offset + 16, 4, encoding);
1905
0
    proto_tree_add_item(subtree, hf_nfs_fh_fsid, tvb, offset + 20, 4, encoding);
1906
0
    proto_tree_add_item(tree, hf_nfs_fh_handle_type, tvb, offset+24, 4, encoding);
1907
0
  }
1908
0
  return tvb_captured_length(tvb);
1909
0
}
1910
1911
#define NETAPP_GX_FH3_LENGTH    44
1912
16
#define NFS3GX_FH_TREE_MASK   0x80
1913
16
#define NFS3GX_FH_JUN_MASK    0x40
1914
16
#define NFS3GX_FH_VER_MASK    0x3F
1915
16
#define SPINNP_FH_FLAG_RESV1            0x80
1916
16
#define SPINNP_FH_FLAG_RESV2            0x40
1917
32
#define SPINNP_FH_FLAG_ONTAP_MASK 0x20
1918
16
#define SPINNP_FH_FLAG_STRIPED_MASK 0x10
1919
16
#define SPINNP_FH_FLAG_EMPTY_MASK 0x08
1920
16
#define SPINNP_FH_FLAG_SNAPDIR_ENT_MASK 0x04
1921
16
#define SPINNP_FH_FLAG_SNAPDIR_MASK 0x02
1922
16
#define SPINNP_FH_FLAG_STREAMDIR_MASK 0x01
1923
1924
static int
1925
dissect_fhandle_data_NETAPP_GX_v3(tvbuff_t* tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
1926
0
{
1927
0
  if (tree) {
1928
0
    proto_tree *field_tree;
1929
0
    uint8_t     flags;
1930
0
    uint32_t    offset = 0;
1931
0
    static int * const fh_flags[] = {
1932
0
      &hf_nfs3_gxfh_sfhflags_resv1,
1933
0
      &hf_nfs3_gxfh_sfhflags_resv2,
1934
0
      &hf_nfs3_gxfh_sfhflags_ontapGX,
1935
0
      &hf_nfs3_gxfh_sfhflags_striped,
1936
0
      &hf_nfs3_gxfh_sfhflags_empty,
1937
0
      &hf_nfs3_gxfh_sfhflags_snapdirent,
1938
0
      &hf_nfs3_gxfh_sfhflags_snapdir,
1939
0
      &hf_nfs3_gxfh_sfhflags_streamdir,
1940
0
      NULL
1941
0
    };
1942
1943
0
    static int * const fh_flags_ontap[] = {
1944
0
      &hf_nfs3_gxfh_sfhflags_resv1,
1945
0
      &hf_nfs3_gxfh_sfhflags_resv2,
1946
0
      &hf_nfs3_gxfh_sfhflags_ontap7G,
1947
0
      &hf_nfs3_gxfh_sfhflags_striped,
1948
0
      &hf_nfs3_gxfh_sfhflags_empty,
1949
0
      &hf_nfs3_gxfh_sfhflags_snapdirent,
1950
0
      &hf_nfs3_gxfh_sfhflags_snapdir,
1951
0
      &hf_nfs3_gxfh_sfhflags_streamdir,
1952
0
      NULL
1953
0
    };
1954
1955
0
    static int * const utility_flags[] = {
1956
0
      &hf_nfs3_gxfh_utlfield_tree,
1957
0
      &hf_nfs3_gxfh_utlfield_jun,
1958
0
      &hf_nfs3_gxfh_utlfield_ver,
1959
0
      NULL
1960
0
    };
1961
1962
    /* = utility = */
1963
0
    proto_tree_add_bitmask(tree, tvb, offset, hf_nfs3_gxfh_utlfield, ett_nfs3_gxfh_utlfield, utility_flags, ENC_NA);
1964
1965
    /* = volume count== */
1966
0
    proto_tree_add_item(tree, hf_nfs3_gxfh_volcnt, tvb, offset+1, 1, ENC_NA);
1967
    /* = epoch = */
1968
0
    proto_tree_add_item(tree, hf_nfs3_gxfh_epoch, tvb, offset+2, 2, ENC_LITTLE_ENDIAN);
1969
    /* = spin file handle = */
1970
0
    flags        = tvb_get_uint8(tvb, offset+11);
1971
1972
0
    field_tree = proto_tree_add_subtree(tree, tvb, offset+4, 16,
1973
0
           ett_nfs3_gxfh_sfhfield, NULL, "  spin file handle");
1974
1975
0
    proto_tree_add_item(field_tree, hf_nfs3_gxfh_ldsid, tvb, offset+4, 4, ENC_BIG_ENDIAN);
1976
0
    proto_tree_add_item(field_tree, hf_nfs3_gxfh_cid, tvb, offset+8, 2, ENC_BIG_ENDIAN);
1977
0
    proto_tree_add_item(field_tree, hf_nfs3_gxfh_resv, tvb, offset+10, 1, ENC_BIG_ENDIAN);
1978
1979
0
    if (flags & SPINNP_FH_FLAG_ONTAP_MASK) {
1980
0
      proto_tree_add_bitmask(field_tree, tvb, offset+11, hf_nfs3_gxfh_sfhflags, ett_nfs3_gxfh_sfhflags, fh_flags_ontap, ENC_NA);
1981
0
    }
1982
0
    else {
1983
0
      proto_tree_add_bitmask(field_tree, tvb, offset+11, hf_nfs3_gxfh_sfhflags, ett_nfs3_gxfh_sfhflags, fh_flags, ENC_NA);
1984
0
    }
1985
1986
0
    proto_tree_add_item(field_tree, hf_nfs3_gxfh_spinfid, tvb, offset+12, 4, ENC_LITTLE_ENDIAN);
1987
0
    proto_tree_add_item(field_tree, hf_nfs3_gxfh_spinfuid, tvb, offset+16, 4, ENC_LITTLE_ENDIAN);
1988
1989
    /* = spin file handle (mount point) = */
1990
0
    flags        = tvb_get_uint8(tvb, offset+27);
1991
1992
0
    field_tree = proto_tree_add_subtree(tree, tvb, offset+20, 16,
1993
0
           ett_nfs3_gxfh_sfhfield, NULL, "  spin (mount point) file handle");
1994
1995
0
    proto_tree_add_item(field_tree, hf_nfs3_gxfh_ldsid, tvb, offset+20, 4, ENC_BIG_ENDIAN);
1996
0
    proto_tree_add_item(field_tree, hf_nfs3_gxfh_cid, tvb, offset+24, 2, ENC_BIG_ENDIAN);
1997
0
    proto_tree_add_item(field_tree, hf_nfs3_gxfh_resv, tvb, offset+26, 1, ENC_BIG_ENDIAN);
1998
1999
0
    if (flags & SPINNP_FH_FLAG_ONTAP_MASK) {
2000
0
      proto_tree_add_bitmask(field_tree, tvb, offset+27, hf_nfs3_gxfh_sfhflags, ett_nfs3_gxfh_sfhflags, fh_flags_ontap, ENC_NA);
2001
0
    }
2002
0
    else {
2003
0
      proto_tree_add_bitmask(field_tree, tvb, offset+27, hf_nfs3_gxfh_sfhflags, ett_nfs3_gxfh_sfhflags, fh_flags, ENC_NA);
2004
0
    }
2005
2006
0
    proto_tree_add_item(field_tree, hf_nfs3_gxfh_spinfid, tvb, offset+28, 4, ENC_LITTLE_ENDIAN);
2007
0
    proto_tree_add_item(field_tree, hf_nfs3_gxfh_spinfuid, tvb, offset+32, 4, ENC_LITTLE_ENDIAN);
2008
    /* = export point id  = */
2009
0
    proto_tree_add_item(tree, hf_nfs3_gxfh_exportptid, tvb, offset+36, 4, ENC_LITTLE_ENDIAN);
2010
    /* = export point unique id  = */
2011
0
    proto_tree_add_item(tree, hf_nfs3_gxfh_exportptuid, tvb, offset+40, 4, ENC_LITTLE_ENDIAN);
2012
2013
0
  }  /* end of (tree) */
2014
0
  return tvb_captured_length(tvb);
2015
0
}
2016
2017
/* Checked with SuSE 7.1 (kernel 2.4.0 knfsd) */
2018
/* read linux-2.4.5/include/linux/nfsd/nfsfh.h for more details */
2019
2020
#define AUTH_TYPE_NONE 0
2021
static const value_string auth_type_names[] = {
2022
  { AUTH_TYPE_NONE,       "no authentication"   },
2023
  { 0,  NULL}
2024
};
2025
2026
#define FSID_TYPE_MAJOR_MINOR_INODE 0
2027
static const value_string fsid_type_names[] = {
2028
  { FSID_TYPE_MAJOR_MINOR_INODE,    "major/minor/inode"   },
2029
  { 0,  NULL}
2030
};
2031
2032
#define FILEID_TYPE_ROOT      0
2033
#define FILEID_TYPE_INODE_GENERATION    1
2034
#define FILEID_TYPE_INODE_GENERATION_PARENT 2
2035
static const value_string fileid_type_names[] = {
2036
  { FILEID_TYPE_ROOT,     "root"        },
2037
  { FILEID_TYPE_INODE_GENERATION,   "inode/generation"    },
2038
  { FILEID_TYPE_INODE_GENERATION_PARENT,  "inode/generation/parent" },
2039
  { 0,  NULL}
2040
};
2041
2042
static int
2043
dissect_fhandle_data_LINUX_KNFSD_NEW(tvbuff_t* tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
2044
0
{
2045
0
  int    offset = 0;
2046
0
  uint32_t version;
2047
0
  uint8_t auth_type = 0;
2048
0
  uint8_t fsid_type;
2049
0
  uint8_t fileid_type;
2050
0
  proto_tree *fileid_tree;
2051
0
  proto_item *fileid_item;
2052
2053
0
  proto_tree_add_item_ret_uint(tree, hf_nfs_fh_version, tvb, offset+0, 1, ENC_NA, &version);
2054
2055
0
  switch (version) {
2056
0
    case 1:
2057
0
      auth_type   = tvb_get_uint8(tvb, offset + 1);
2058
0
      fsid_type   = tvb_get_uint8(tvb, offset + 2);
2059
0
      fileid_type = tvb_get_uint8(tvb, offset + 3);
2060
0
      if (tree) {
2061
0
        proto_tree *encoding_tree = proto_tree_add_subtree_format(tree, tvb,
2062
0
          offset + 1, 3,
2063
0
          ett_nfs_fh_encoding, NULL, "encoding: %u %u %u",
2064
0
          auth_type, fsid_type, fileid_type);
2065
2066
0
        proto_tree_add_uint(encoding_tree, hf_nfs_fh_auth_type,
2067
0
              tvb, offset+1, 1, auth_type);
2068
0
        proto_tree_add_uint(encoding_tree, hf_nfs_fh_fsid_type,
2069
0
              tvb, offset+2, 1, fsid_type);
2070
0
        proto_tree_add_uint(encoding_tree, hf_nfs_fh_fileid_type,
2071
0
              tvb, offset+3, 1, fileid_type);
2072
0
      }
2073
0
      offset += 4;
2074
0
      break;
2075
0
    default: {
2076
      /* unknown version */
2077
0
      return 1;
2078
0
    }
2079
0
  }
2080
2081
0
  if (auth_type != 0)
2082
0
  {
2083
    /* unknown authentication type */
2084
0
    return 2;
2085
0
  }
2086
2087
0
  if (fsid_type != 0)
2088
0
  {
2089
    /* unknown authentication type */
2090
0
    return 3;
2091
0
  }
2092
2093
0
  {
2094
0
  uint16_t fsid_major;
2095
0
  uint16_t fsid_minor;
2096
0
  uint32_t fsid_inode;
2097
2098
0
  fsid_major = tvb_get_ntohs(tvb, offset + 0);
2099
0
  fsid_minor = tvb_get_ntohs(tvb, offset + 2);
2100
0
  fsid_inode = tvb_get_letohl(tvb, offset + 4);
2101
0
  if (tree) {
2102
0
    proto_tree *fsid_tree = proto_tree_add_subtree_format(tree, tvb,
2103
0
      offset+0, 8, ett_nfs_fh_fsid, NULL,
2104
0
      "file system ID: %u,%u (inode %u)",
2105
0
      fsid_major, fsid_minor, fsid_inode);
2106
2107
0
    proto_tree_add_uint(fsid_tree, hf_nfs_fh_fsid_major16,
2108
0
          tvb, offset+0, 2, fsid_major);
2109
0
    proto_tree_add_uint(fsid_tree, hf_nfs_fh_fsid_minor16,
2110
0
          tvb, offset+2, 2, fsid_minor);
2111
0
    proto_tree_add_uint(fsid_tree, hf_nfs_fh_fsid_inode,
2112
0
          tvb, offset+4, 4, fsid_inode);
2113
0
  }
2114
2115
0
  offset += 8;
2116
0
  }
2117
2118
0
  fileid_tree = proto_tree_add_subtree_format(tree, tvb,
2119
0
          offset, 0, ett_nfs_fh_fn, &fileid_item, "file ID");
2120
2121
0
  switch (fileid_type) {
2122
0
    case 0: {
2123
0
      proto_item_append_text(fileid_item, ": root inode");
2124
0
    } break;
2125
0
    case 1: {
2126
0
      uint32_t inode;
2127
0
      uint32_t generation;
2128
2129
0
      inode = tvb_get_letohl(tvb, offset + 0);
2130
0
      generation = tvb_get_letohl(tvb, offset + 4);
2131
2132
0
      if (tree) {
2133
0
        proto_item_append_text(fileid_item, ": %u (%u)", inode, generation);
2134
0
        proto_item_set_len(fileid_item, 8);
2135
2136
0
        proto_tree_add_uint(fileid_tree, hf_nfs_fh_fn_inode,
2137
0
            tvb, offset+0, 4, inode);
2138
0
        proto_tree_add_uint(fileid_tree, hf_nfs_fh_fn_generation,
2139
0
            tvb, offset+4, 4, generation);
2140
0
      }
2141
2142
      /*offset += 8;*/
2143
0
    } break;
2144
0
    case 2: {
2145
0
      uint32_t inode;
2146
0
      uint32_t generation;
2147
2148
0
      inode = tvb_get_letohl(tvb, offset + 0);
2149
0
      generation = tvb_get_letohl(tvb, offset + 4);
2150
2151
0
      if (tree) {
2152
0
        proto_item_append_text(fileid_item, ": %u (%u)", inode, generation);
2153
0
        proto_item_set_len(fileid_item, 12);
2154
2155
0
        proto_tree_add_uint(fileid_tree, hf_nfs_fh_fn_inode,
2156
0
            tvb, offset+0, 4, inode);
2157
0
        proto_tree_add_uint(fileid_tree, hf_nfs_fh_fn_generation,
2158
0
            tvb, offset+4, 4, generation);
2159
0
        proto_tree_add_item(fileid_tree, hf_nfs_fh_dirinode,
2160
0
            tvb, offset+8, 4, ENC_LITTLE_ENDIAN);
2161
0
      }
2162
2163
      /*offset += 12;*/
2164
0
    } break;
2165
0
    default: {
2166
0
      proto_item_append_text(fileid_item, ": unknown");
2167
      /* unknown fileid type */
2168
0
      return offset;
2169
0
    }
2170
0
  }
2171
0
  return tvb_captured_length(tvb);
2172
0
}
2173
2174
2175
/*
2176
 * Dissect GlusterFS/NFS NFSv3 File Handle - glusterfs-3.3+
2177
 * The filehandle is always 32 bytes and first 4 bytes of ident ":OGL"
2178
 */
2179
static int
2180
dissect_fhandle_data_GLUSTER(tvbuff_t* tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
2181
0
{
2182
0
  uint16_t offset=0;
2183
0
  uint16_t  fhlen;
2184
0
  char *ident;
2185
2186
0
  if (!tree)
2187
0
    return tvb_captured_length(tvb);
2188
2189
0
  fhlen = tvb_reported_length(tvb);
2190
0
  if (fhlen != 36)
2191
0
    return tvb_captured_length(tvb);
2192
2193
0
  ident = (char*)tvb_get_string_enc(pinfo->pool, tvb, offset, 4, ENC_ASCII);
2194
0
  if (strncmp(":OGL", ident, 4))
2195
0
    return 4;
2196
0
  offset += 4;
2197
2198
0
  proto_tree_add_item(tree, hf_nfs_fh_exportid, tvb, offset, 16, ENC_BIG_ENDIAN);
2199
0
  offset += 16;
2200
0
  proto_tree_add_item(tree, hf_nfs_fh_gfid, tvb, offset, 16, ENC_BIG_ENDIAN);
2201
0
  offset += 16;
2202
0
  return offset;
2203
0
}
2204
2205
/*
2206
 * Dissect dCache NFS File Handle - dcache > 2.6
2207
 */
2208
2209
0
#define DCACHE_MAGIC_MASK   0x00FFFFFF
2210
0
#define DCACHE_VERSION_MASK 0xFF000000
2211
0
#define DCACHE_MAGIC        0xCAFFEE
2212
2213
static const value_string dcache_handle_types[] = {
2214
  { 0, "INODE" },
2215
  { 1, "TAG" },
2216
  { 2, "TAGS" },
2217
  { 3, "ID" },
2218
  { 4, "PATHOF" },
2219
  { 5, "PARENT" },
2220
  { 6, "NAMEOF" },
2221
  { 7, "PGET" },
2222
  { 8, "PSET" },
2223
  { 9, "CONST" },
2224
  { 0, NULL }
2225
};
2226
2227
static int
2228
dissect_fhandle_data_DCACHE(tvbuff_t* tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
2229
0
{
2230
0
  unsigned offset = 0;
2231
0
  uint32_t version;
2232
0
  uint32_t magic;
2233
0
  uint8_t obj_len;
2234
2235
0
  if (!tree)
2236
0
    return tvb_captured_length(tvb);
2237
2238
0
  version = (tvb_get_ntohl(tvb, offset) & DCACHE_VERSION_MASK) >> 24;
2239
0
  magic   = (tvb_get_ntohl(tvb, offset) & DCACHE_MAGIC_MASK);
2240
2241
0
  if ((version != 1) || (magic != DCACHE_MAGIC)) {
2242
    /* unknown file handle */
2243
0
    return 0;
2244
0
  }
2245
2246
0
  proto_tree_add_item(tree, hf_nfs_fh_version, tvb, offset, 1, ENC_BIG_ENDIAN);
2247
0
  proto_tree_add_item(tree, hf_nfs_fh_generation, tvb, offset+4, 4, ENC_BIG_ENDIAN);
2248
0
  proto_tree_add_item(tree, hf_nfs_fh_dc_exportid, tvb, offset+8, 4, ENC_BIG_ENDIAN);
2249
0
  proto_tree_add_item(tree, hf_nfs_fh_dc_handle_type, tvb, offset+15, 1, ENC_BIG_ENDIAN);
2250
0
  obj_len = tvb_get_uint8(tvb, offset + 16);
2251
0
  proto_tree_add_item(tree, hf_nfs_fh_dc_opaque, tvb, offset + 17, obj_len, ENC_NA);
2252
0
  return tvb_captured_length(tvb);
2253
0
}
2254
2255
16
#define PD_VERSION_MASK   0xf0000000
2256
16
#define PD_RESERVED_MASK  0x0ffffffF
2257
16
#define PD_INUM_MASK      UINT64_C(0x0007ffffffffffff)
2258
16
#define PD_SITEID_MASK    UINT64_C(0xfff8000000000000)
2259
16
#define PD_SNAPID_MASK    UINT64_C(0x0000000000001fff)
2260
16
#define PD_CONTAINER_MASK UINT64_C(0xffffffffffffe000)
2261
2262
static int
2263
dissect_fhandle_data_PRIMARY_DATA(tvbuff_t* tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
2264
0
{
2265
0
  unsigned offset = 0;
2266
0
  uint32_t version;
2267
2268
0
  static int * const fh_flags[] = {
2269
0
    &hf_nfs4_fh_pd_flags_version,
2270
0
    &hf_nfs4_fh_pd_flags_reserved,
2271
0
    NULL
2272
0
  };
2273
2274
0
  static int * const fh_sites[] = {
2275
0
    &hf_nfs4_fh_pd_sites_inum,
2276
0
    &hf_nfs4_fh_pd_sites_siteid,
2277
0
    NULL
2278
0
  };
2279
2280
0
  static int * const fh_spaces[] = {
2281
0
    &hf_nfs4_fh_pd_spaces_snapid,
2282
0
    &hf_nfs4_fh_pd_spaces_container,
2283
0
    NULL
2284
0
  };
2285
2286
2287
0
  if (!tree)
2288
0
    return tvb_captured_length(tvb);
2289
2290
2291
0
  version = (tvb_get_letohl(tvb, offset + 4) & PD_VERSION_MASK) >> 28;
2292
0
  if (version > 2) {
2293
0
    return 0;
2294
0
  }
2295
2296
0
  proto_tree_add_item(tree, hf_nfs4_fh_pd_share, tvb, offset, 4, ENC_LITTLE_ENDIAN);
2297
0
  proto_tree_add_bitmask(tree, tvb, offset + 4, hf_nfs4_fh_pd_flags, ett_nfs4_fh_pd_flags, fh_flags, ENC_LITTLE_ENDIAN);
2298
2299
0
  if (version == 0) {
2300
0
    proto_tree_add_item(tree, hf_nfs4_fh_pd_inum, tvb, offset + 8, 8, ENC_LITTLE_ENDIAN);
2301
0
  } else if (version == 1) {
2302
0
    proto_tree_add_item(tree, hf_nfs4_fh_pd_container, tvb, offset + 8, 8, ENC_LITTLE_ENDIAN);
2303
0
    proto_tree_add_item(tree, hf_nfs4_fh_pd_inum, tvb, offset + 16, 8, ENC_LITTLE_ENDIAN);
2304
0
  } else if (version == 2) {
2305
0
    proto_tree_add_bitmask(tree, tvb, offset + 8, hf_nfs4_fh_pd_spaces, ett_nfs4_fh_pd_spaces, fh_spaces, ENC_LITTLE_ENDIAN);
2306
0
    proto_tree_add_bitmask(tree, tvb, offset + 16, hf_nfs4_fh_pd_sites, ett_nfs4_fh_pd_sites, fh_sites, ENC_LITTLE_ENDIAN);
2307
0
  }
2308
2309
0
  return tvb_captured_length(tvb);
2310
0
}
2311
2312
/* Dissect EMC Celerra or VNX NFSv3/v4 File Handle */
2313
static int
2314
dissect_fhandle_data_CELERRA_VNX(tvbuff_t* tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
2315
0
{
2316
0
  uint16_t offset = 0;
2317
0
  uint16_t  fhlen;
2318
0
  uint32_t  obj_id;
2319
2320
0
  fhlen = tvb_reported_length(tvb);
2321
2322
  /* Display the entire file handle */
2323
0
  proto_tree_add_item(tree, hf_nfs_fh_fhandle_data, tvb, 0, fhlen, ENC_NA);
2324
2325
  /*  If fhlen = 32, it's an NFSv3 file handle */
2326
0
  if (fhlen == 32) {
2327
    /* Create a "File/Dir" subtree: bytes 0 thru 15 of the 32-byte file handle   */
2328
0
    {
2329
0
    proto_item *obj_item;
2330
0
    proto_tree *obj_tree;
2331
2332
0
    if (!tree)
2333
0
      return tvb_captured_length(tvb);
2334
2335
0
    obj_item = proto_tree_add_item(tree, hf_nfs_fh_obj, tvb, offset+0, 16, ENC_NA );
2336
0
    obj_tree = proto_item_add_subtree(obj_item, ett_nfs_fh_obj);
2337
2338
0
    proto_tree_add_item(obj_tree, hf_nfs_fh_obj_fsid,   tvb,  offset+0, 4, ENC_LITTLE_ENDIAN);
2339
0
    proto_tree_add_item(obj_tree, hf_nfs_fh_obj_kindid, tvb,  offset+4, 2, ENC_LITTLE_ENDIAN);
2340
0
    proto_tree_add_item(obj_tree, hf_nfs_fh_obj_treeid, tvb,  offset+6, 2, ENC_LITTLE_ENDIAN);
2341
0
    proto_tree_add_item(obj_tree, hf_nfs_fh_obj_inode,  tvb,  offset+8, 4, ENC_LITTLE_ENDIAN);
2342
0
    proto_tree_add_item(obj_tree, hf_nfs_fh_obj_gen,    tvb, offset+12, 4, ENC_LITTLE_ENDIAN);
2343
0
    }
2344
0
    {
2345
    /* Create "Export" subtree (NFSv3: Bytes 16 thru 31 of the 32-byte file handle  */
2346
0
    proto_item *ex_item;
2347
0
    proto_tree *ex_tree;
2348
0
    ex_item = proto_tree_add_item(tree, hf_nfs_fh_ex, tvb,  offset+16, 16, ENC_NA );
2349
0
    ex_tree = proto_item_add_subtree(ex_item, ett_nfs_fh_ex);
2350
2351
0
    proto_tree_add_item(ex_tree, hf_nfs_fh_ex_fsid,     tvb, offset+16, 4, ENC_LITTLE_ENDIAN);
2352
0
    proto_tree_add_item(ex_tree, hf_nfs_fh_ex_kindid,   tvb, offset+20, 2, ENC_LITTLE_ENDIAN);
2353
0
    proto_tree_add_item(ex_tree, hf_nfs_fh_ex_treeid,   tvb, offset+22, 2, ENC_LITTLE_ENDIAN);
2354
0
    proto_tree_add_item(ex_tree, hf_nfs_fh_ex_inode,    tvb, offset+24, 4, ENC_LITTLE_ENDIAN);
2355
0
    proto_tree_add_item(ex_tree, hf_nfs_fh_ex_gen,      tvb, offset+28, 4, ENC_LITTLE_ENDIAN);
2356
0
    }
2357
0
  } else if (fhlen == 40) {
2358
    /*
2359
    If fhlen = 40, it's an NFSv4 file handle).  In Celerra|VNX NFSv4 file handles,
2360
    the first 4 bytes hold the Named Attribute ID, and the next 4 bytes hold the
2361
    RO_Node boolean which if true, the file/dir is Read Only. Unlike NFSv3 file
2362
    handles where the file/dir info precedes the export info, the next 16 bytes contain
2363
    the *export* info followed by 16 bytes containing the *file/dir* info.
2364
    */
2365
2366
0
    if (!tree)
2367
0
      return tvb_captured_length(tvb);
2368
2369
    /* "Named Attribute ID" or "Object ID" (bytes 0 thru 3) */
2370
0
    obj_id = tvb_get_letohl(tvb, offset+0);
2371
0
    if (obj_id <= 0 || obj_id > 9) obj_id = 1;
2372
0
    proto_tree_add_uint(tree, hf_nfs_fh_obj_id,         tvb,  offset+0, 4, obj_id);
2373
2374
    /* "RO_Node" boolean (bytes 4 thru 7) */
2375
0
    proto_tree_add_item(tree, hf_nfs_fh_ro_node,     tvb,  offset+4, 4, ENC_LITTLE_ENDIAN);
2376
2377
    /* Create "Export" subtree (bytes 8 thru 23 of the 40-byte file handle  */
2378
0
    {
2379
0
    proto_item *ex_item;
2380
0
    proto_tree *ex_tree;
2381
0
    ex_item = proto_tree_add_item(tree, hf_nfs_fh_ex,  tvb,  offset+8, 16, ENC_NA );
2382
0
    ex_tree = proto_item_add_subtree(ex_item, ett_nfs_fh_ex);
2383
2384
0
    proto_tree_add_item(ex_tree, hf_nfs_fh_ex_fsid,    tvb,  offset+8,  4, ENC_LITTLE_ENDIAN);
2385
0
    proto_tree_add_item(ex_tree, hf_nfs_fh_ex_kindid,  tvb, offset+12,  2, ENC_LITTLE_ENDIAN);
2386
0
    proto_tree_add_item(ex_tree, hf_nfs_fh_ex_treeid,  tvb, offset+14,  2, ENC_LITTLE_ENDIAN);
2387
0
    proto_tree_add_item(ex_tree, hf_nfs_fh_ex_inode,   tvb, offset+16,  4, ENC_LITTLE_ENDIAN);
2388
0
    proto_tree_add_item(ex_tree, hf_nfs_fh_ex_gen,     tvb, offset+20,  4, ENC_LITTLE_ENDIAN);
2389
0
    }
2390
    /* Create a "File/Dir/Object" subtree (bytes 24 thru 39 of the 40-byte file handle) */
2391
0
    {
2392
0
    proto_item *obj_item;
2393
0
    proto_tree *obj_tree;
2394
0
    obj_item = proto_tree_add_item(tree, hf_nfs_fh_obj, tvb, offset+24, 16, ENC_NA);
2395
0
    obj_tree = proto_item_add_subtree(obj_item, ett_nfs_fh_obj);
2396
2397
0
    proto_tree_add_item(obj_tree, hf_nfs_fh_obj_fsid,   tvb, offset+24,  4, ENC_LITTLE_ENDIAN);
2398
0
    proto_tree_add_item(obj_tree, hf_nfs_fh_obj_kindid, tvb, offset+28,  2, ENC_LITTLE_ENDIAN);
2399
0
    proto_tree_add_item(obj_tree, hf_nfs_fh_obj_treeid, tvb, offset+30,  2, ENC_LITTLE_ENDIAN);
2400
0
    proto_tree_add_item(obj_tree, hf_nfs_fh_obj_inode,  tvb, offset+32,  4, ENC_LITTLE_ENDIAN);
2401
0
    proto_tree_add_item(obj_tree, hf_nfs_fh_obj_gen,    tvb, offset+36,  4, ENC_LITTLE_ENDIAN);
2402
0
    }
2403
0
  } else {
2404
    /* This is not a Celerra|VNX file handle.  Display a warning. */
2405
0
    expert_add_info_format(pinfo, tree, &ei_nfs_not_vnx_file,
2406
0
      "Celerra|VNX file handles are 32 (NFSv3) or 40 (NFSv4) but the length is %u.\n"
2407
0
      "Change the 'Decode NFS file handles as' pref to the correct type or 'Unknown'.",
2408
0
      fhlen);
2409
0
  }
2410
0
  return tvb_captured_length(tvb);
2411
0
}
2412
2413
2414
static int
2415
dissect_fhandle_data_unknown(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
2416
0
{
2417
0
  unsigned fhlen = tvb_reported_length(tvb);
2418
2419
0
  proto_tree_add_item(tree, hf_nfs_fh_fhandle_data, tvb, 0, fhlen, ENC_NA);
2420
0
  return tvb_captured_length(tvb);
2421
0
}
2422
2423
2424
static void
2425
dissect_fhandle_data(tvbuff_t *tvb, unsigned offset, packet_info *pinfo, proto_tree *tree,
2426
         unsigned int fhlen, bool hidden, uint32_t *hash)
2427
0
{
2428
  /* this is to set up fhandle display filters to find both packets
2429
     of an RPC call */
2430
0
  if (nfs_fhandle_reqrep_matching && (!hidden) ) {
2431
0
    nfs_fhandle_data_t *old_fhd = NULL;
2432
2433
0
    if ( !pinfo->fd->visited ) {
2434
0
      nfs_fhandle_data_t fhd;
2435
2436
      /* first check if we have seen this fhandle before */
2437
0
      fhd.len = fhlen;
2438
0
      fhd.fh = (const unsigned char *)tvb_get_ptr(tvb, offset, fhlen);
2439
0
      old_fhd = store_nfs_file_handle(&fhd);
2440
2441
      /* XXX here we should really check that we haven't stored
2442
         this fhandle for this frame number already.
2443
         We should also make sure we can handle when we have multiple
2444
         fhandles seen for the same frame, which WILL happen for certain
2445
         nfs calls. For now, we don't handle this and those calls will
2446
         not work properly with this feature
2447
      */
2448
0
      wmem_tree_insert32(nfs_fhandle_frame_table, pinfo->num, old_fhd);
2449
0
    }
2450
0
  }
2451
2452
  /* Create a unique hash value for the filehandle using CRC32 */
2453
0
  {
2454
0
    uint32_t fhhash;
2455
0
    proto_item *fh_item = NULL;
2456
2457
0
    fhhash = crc32_ccitt_tvb_offset(tvb, offset, fhlen);
2458
2459
0
    if (hidden) {
2460
0
      fh_item = proto_tree_add_uint(tree, hf_nfs_fh_hash, NULL, 0,
2461
0
        0, fhhash);
2462
0
      proto_item_set_hidden(fh_item);
2463
0
    } else {
2464
0
      fh_item = proto_tree_add_uint(tree, hf_nfs_fh_hash, tvb, offset,
2465
0
        fhlen, fhhash);
2466
0
    }
2467
0
    proto_item_set_generated(fh_item);
2468
0
    if (hash) {
2469
0
      *hash = fhhash;
2470
0
    }
2471
0
  }
2472
0
  if (nfs_file_name_snooping) {
2473
0
    nfs_name_snoop_fh(pinfo, tree, tvb, offset, fhlen, hidden);
2474
0
  }
2475
2476
0
  if (!hidden) {
2477
0
    tvbuff_t *fh_tvb;
2478
2479
0
    fh_tvb = tvb_new_subset_length(tvb, offset, fhlen);
2480
0
    if (!dissector_try_payload_with_data(nfs_fhandle_table, fh_tvb, pinfo, tree, true, NULL))
2481
0
      dissect_fhandle_data_unknown(fh_tvb, pinfo, tree, NULL);
2482
0
  }
2483
0
}
2484
2485
2486
void
2487
dissect_fhandle_hidden(packet_info *pinfo, proto_tree *tree, int frame)
2488
0
{
2489
0
  nfs_fhandle_data_t *nfd;
2490
2491
0
  nfd = (nfs_fhandle_data_t *)wmem_tree_lookup32(nfs_fhandle_frame_table, frame);
2492
0
  if (nfd && nfd->len) {
2493
0
    tvbuff_t *tvb;
2494
0
    tvb = tvb_new_real_data(nfd->fh, nfd->len, nfd->len);
2495
    /* There's no need to call add_new_data_source() since
2496
       dissect_fhandle(), in the 'hidden' case, never refers
2497
       to the tvb when displaying a field based on the tvb */
2498
0
    dissect_fhandle_data(tvb, 0, pinfo, tree, nfd->len, true, NULL);
2499
0
    tvb_free(tvb);
2500
0
  }
2501
0
}
2502
2503
2504
/***************************/
2505
/* NFS Version 2, RFC 1094 */
2506
/***************************/
2507
2508
/* NFSv2 RFC 1094, Page 12..14 */
2509
static const value_string names_nfs2_stat[] =
2510
{
2511
  { 0,  "NFS_OK" },
2512
  { 1,  "NFS2ERR_PERM" },
2513
  { 2,  "NFS2ERR_NOENT" },
2514
  { 5,  "NFS2ERR_IO" },
2515
  { 6,  "NFS2ERR_NXIO" },
2516
  { 11, "NFS2ERR_EAGAIN" },
2517
  { 13, "NFS2ERR_ACCES" },
2518
  { 17, "NFS2ERR_EXIST" },
2519
  { 18, "NFS2ERR_XDEV" }, /* not in spec, but can happen */
2520
  { 19, "NFS2ERR_NODEV" },
2521
  { 20, "NFS2ERR_NOTDIR" },
2522
  { 21, "NFS2ERR_ISDIR" },
2523
  { 22, "NFS2ERR_INVAL" },  /* not in spec, but I think it can happen */
2524
  { 26, "NFS2ERR_TXTBSY" }, /* not in spec, but I think it can happen */
2525
  { 27, "NFS2ERR_FBIG" },
2526
  { 28, "NFS2ERR_NOSPC" },
2527
  { 30, "NFS2ERR_ROFS" },
2528
  { 31, "NFS2ERR_MLINK" },  /* not in spec, but can happen */
2529
  { 45, "NFS2ERR_OPNOTSUPP" },  /* not in spec, but I think it can happen */
2530
  { 63, "NFS2ERR_NAMETOOLONG" },
2531
  { 66, "NFS2ERR_NOTEMPTY" },
2532
  { 69, "NFS2ERR_DQUOT" },
2533
  { 70, "NFS2ERR_STALE" },
2534
  { 71, "NFS2ERR_REMOTE" },
2535
  { 99, "NFS2ERR_WFLUSH" },
2536
  { 10001,  "NFS2ERR_BADHANDLE" },
2537
  { 10002,  "NFS2ERR_NOT_SYNC" },
2538
  { 10003,  "NFS2ERR_BAD_COOKIE" },
2539
  { 10004,  "NFS2ERR_NOTSUPP" },
2540
  { 10005,  "NFS2ERR_TOOSMALL" },
2541
  { 10006,  "NFS2ERR_SERVERFAULT" },
2542
  { 10007,  "NFS2ERR_BADTYPE" },
2543
  { 10008,  "NFS2ERR_JUKEBOX" },
2544
  { 10009,  "NFS2ERR_SAME" },
2545
  { 10010,  "NFS2ERR_DENIED" },
2546
  { 10011,  "NFS2ERR_EXPIRED" },
2547
  { 10012,  "NFS2ERR_LOCKED" },
2548
  { 10013,  "NFS2ERR_GRACE" },
2549
  { 10014,  "NFS2ERR_FHEXPIRED" },
2550
  { 10015,  "NFS2ERR_SHARE_DENIED" },
2551
  { 10016,  "NFS2ERR_WRONGSEC" },
2552
  { 10017,  "NFS2ERR_CLID_INUSE" },
2553
  { 10018,  "NFS2ERR_RESOURCE" },
2554
  { 10019,  "NFS2ERR_MOVED" },
2555
  { 10020,  "NFS2ERR_NOFILEHANDLE" },
2556
  { 10021,  "NFS2ERR_MINOR_VERS_MISMATCH" },
2557
  { 10022,  "NFS2ERR_STALE_CLIENTID" },
2558
  { 10023,  "NFS2ERR_STALE_STATEID" },
2559
  { 10024,  "NFS2ERR_OLD_STATEID" },
2560
  { 10025,  "NFS2ERR_BAD_STATEID" },
2561
  { 10026,  "NFS2ERR_BAD_SEQID" },
2562
  { 10027,  "NFS2ERR_NOT_SAME" },
2563
  { 10028,  "NFS2ERR_LOCK_RANGE" },
2564
  { 10029,  "NFS2ERR_SYMLINK" },
2565
  { 10030,  "NFS2ERR_RESTOREFH" },
2566
  { 10031,  "NFS2ERR_LEASE_MOVED" },
2567
  { 10032,  "NFS2ERR_ATTRNOTSUPP" },
2568
  { 10033,  "NFS2ERR_NO_GRACE" },
2569
  { 10034,  "NFS2ERR_RECLAIM_BAD" },
2570
  { 10035,  "NFS2ERR_RECLAIM_CONFLICT" },
2571
  { 10036,  "NFS2ERR_BAD_XDR" },
2572
  { 10037,  "NFS2ERR_LOCKS_HELD" },
2573
  { 10038,  "NFS2ERR_OPENMODE" },
2574
  { 10039,  "NFS2ERR_BADOWNER" },
2575
  { 10040,  "NFS2ERR_BADCHAR" },
2576
  { 10041,  "NFS2ERR_BADNAME" },
2577
  { 10042,  "NFS2ERR_BAD_RANGE" },
2578
  { 10043,  "NFS2ERR_LOCK_NOTSUPP" },
2579
  { 10044,  "NFS2ERR_OP_ILLEGAL" },
2580
  { 10045,  "NFS2ERR_DEADLOCK" },
2581
  { 10046,  "NFS2ERR_FILE_OPEN" },
2582
  { 10047,  "NFS2ERR_ADMIN_REVOKED" },
2583
  { 10048,  "NFS2ERR_CB_PATH_DOWN" },
2584
  { 10049,  "NFS2ERR_REPLAY_ME" },
2585
  { 0,  NULL }
2586
};
2587
static value_string_ext names_nfs2_stat_ext = VALUE_STRING_EXT_INIT(names_nfs2_stat);
2588
2589
/* NFSv2 RFC 1094, Page 12..14 */
2590
static int
2591
dissect_nfs2_status(tvbuff_t *tvb, unsigned offset, proto_tree *tree, uint32_t *status)
2592
0
{
2593
0
  uint32_t      stat;
2594
0
  proto_item *stat_item;
2595
2596
0
  proto_tree_add_item_ret_uint(tree, hf_nfs2_status, tvb, offset+0, 4, ENC_BIG_ENDIAN, &stat);
2597
0
  stat_item = proto_tree_add_uint(tree, hf_nfs_status, tvb, offset+0, 4, stat);
2598
0
  proto_item_set_hidden(stat_item);
2599
2600
0
  offset += 4;
2601
2602
0
  if (status)
2603
0
    *status = stat;
2604
2605
0
  return offset;
2606
0
}
2607
2608
2609
/* NFSv2 RFC 1094, Page 12..14 */
2610
static int
2611
dissect_nfs2_rmdir_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
2612
0
{
2613
0
  uint32_t      status;
2614
0
  const char *err;
2615
0
  unsigned offset = 0;
2616
2617
0
  offset = dissect_nfs2_status(tvb, offset, tree, &status);
2618
0
  switch (status) {
2619
0
    case 0:
2620
0
      proto_item_append_text(tree, ", RMDIR Reply");
2621
0
      break;
2622
0
    default:
2623
0
      err = val_to_str_ext(pinfo->pool, status, &names_nfs2_stat_ext, "Unknown error: %u");
2624
0
      col_append_fstr(pinfo->cinfo, COL_INFO, " Error: %s", err);
2625
0
      proto_item_append_text(tree, ", RMDIR Reply  Error: %s", err);
2626
0
  }
2627
2628
0
  return offset;
2629
0
}
2630
2631
2632
static int
2633
dissect_nfs2_symlink_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
2634
0
{
2635
0
  uint32_t      status;
2636
0
  const char *err;
2637
0
  unsigned offset = 0;
2638
2639
0
  offset = dissect_nfs2_status(tvb, offset, tree, &status);
2640
0
  switch (status) {
2641
0
    case 0:
2642
0
      proto_item_append_text(tree, ", SYMLINK Reply");
2643
0
      break;
2644
0
    default:
2645
0
      err = val_to_str_ext(pinfo->pool, status, &names_nfs2_stat_ext, "Unknown error: %u");
2646
0
      col_append_fstr(pinfo->cinfo, COL_INFO, " Error: %s", err);
2647
0
      proto_item_append_text(tree, ", SYMLINK Reply  Error: %s", err);
2648
0
  }
2649
2650
0
  return offset;
2651
0
}
2652
2653
2654
static int
2655
dissect_nfs2_link_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
2656
0
{
2657
0
  uint32_t      status;
2658
0
  const char *err;
2659
0
  unsigned offset = 0;
2660
2661
0
  offset = dissect_nfs2_status(tvb, offset, tree, &status);
2662
0
  switch (status) {
2663
0
    case 0:
2664
0
      proto_item_append_text(tree, ", LINK Reply");
2665
0
      break;
2666
0
    default:
2667
0
      err = val_to_str_ext(pinfo->pool, status, &names_nfs2_stat_ext, "Unknown error: %u");
2668
0
      col_append_fstr(pinfo->cinfo, COL_INFO, " Error: %s", err);
2669
0
      proto_item_append_text(tree, ", LINK Reply  Error: %s", err);
2670
0
  }
2671
2672
0
  return offset;
2673
0
}
2674
2675
2676
static int
2677
dissect_nfs2_rename_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
2678
0
{
2679
0
  uint32_t      status;
2680
0
  const char *err;
2681
0
  unsigned offset = 0;
2682
2683
0
  offset = dissect_nfs2_status(tvb, offset, tree, &status);
2684
0
  switch (status) {
2685
0
    case 0:
2686
0
      proto_item_append_text(tree, ", RENAME Reply");
2687
0
      break;
2688
0
    default:
2689
0
      err = val_to_str_ext(pinfo->pool, status, &names_nfs2_stat_ext, "Unknown error: %u");
2690
0
      col_append_fstr(pinfo->cinfo, COL_INFO, " Error: %s", err);
2691
0
      proto_item_append_text(tree, ", RENAME Reply  Error: %s", err);
2692
0
  }
2693
2694
0
  return offset;
2695
0
}
2696
2697
2698
static int
2699
dissect_nfs2_remove_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
2700
0
{
2701
0
  uint32_t      status;
2702
0
  const char *err;
2703
0
  unsigned offset = 0;
2704
2705
0
  offset = dissect_nfs2_status(tvb, offset, tree, &status);
2706
0
  switch (status) {
2707
0
    case 0:
2708
0
      proto_item_append_text(tree, ", REMOVE Reply");
2709
0
      break;
2710
0
    default:
2711
0
      err = val_to_str_ext(pinfo->pool, status, &names_nfs2_stat_ext, "Unknown error: %u");
2712
0
      col_append_fstr(pinfo->cinfo, COL_INFO, " Error: %s", err);
2713
0
      proto_item_append_text(tree, ", REMOVE Reply  Error: %s", err);
2714
0
  }
2715
2716
0
  return offset;
2717
0
}
2718
2719
2720
/* NFSv2 RFC 1094, Page 15 */
2721
static const value_string nfs2_ftype[] =
2722
{
2723
  { 0,  "Non-File" },
2724
  { 1,  "Regular File" },
2725
  { 2,  "Directory" },
2726
  { 3,  "Block Special Device" },
2727
  { 4,  "Character Special Device" },
2728
  { 5,  "Symbolic Link" },
2729
  { 0,  NULL }
2730
};
2731
static value_string_ext nfs2_ftype_ext = VALUE_STRING_EXT_INIT(nfs2_ftype);
2732
2733
static unsigned
2734
dissect_nfs2_ftype(tvbuff_t *tvb, unsigned offset, proto_tree *tree)
2735
0
{
2736
0
  proto_tree_add_item(tree, hf_nfs2_ftype, tvb, offset, 4, ENC_BIG_ENDIAN);
2737
0
  offset += 4;
2738
0
  return offset;
2739
0
}
2740
2741
2742
/* NFSv2 RFC 1094, Page 15 */
2743
unsigned
2744
dissect_fhandle(tvbuff_t *tvb, unsigned offset, packet_info *pinfo, proto_tree *tree,
2745
          const char *name, uint32_t *hash, rpc_call_info_value *civ)
2746
0
{
2747
0
  proto_tree *ftree;
2748
2749
0
  ftree = proto_tree_add_subtree(tree, tvb, offset, FHSIZE,
2750
0
        ett_nfs_fhandle, NULL, name);
2751
2752
2753
  /* are we snooping fh to filenames ?*/
2754
0
  if ((!pinfo->fd->visited) && nfs_file_name_snooping) {
2755
2756
    /* NFS v2 LOOKUP, CREATE, MKDIR, SYMLINK calls might give us a mapping*/
2757
0
    if ( (civ->prog == 100003)
2758
0
      &&(civ->vers == 2)
2759
0
      &&(!civ->request)
2760
0
      &&((civ->proc == 4)||(civ->proc == 9)||(civ->proc == 13)||(civ->proc == 14))
2761
0
    ) {
2762
0
      nfs_name_snoop_add_fh(civ->xid, tvb,
2763
0
        offset, 32);
2764
0
    }
2765
2766
    /* MOUNT v1,v2 MNT replies might give us a filehandle*/
2767
0
    if ( (civ->prog == 100005)
2768
0
      &&(civ->proc == 1)
2769
0
      &&((civ->vers == 1)||(civ->vers == 2))
2770
0
      &&(!civ->request)
2771
0
    ) {
2772
0
      nfs_name_snoop_add_fh(civ->xid, tvb,
2773
0
        offset, 32);
2774
0
    }
2775
0
  }
2776
2777
0
  dissect_fhandle_data(tvb, offset, pinfo, ftree, FHSIZE, false, hash);
2778
2779
0
  offset += FHSIZE;
2780
0
  return offset;
2781
0
}
2782
2783
2784
/* NFSv2 RFC 1094, Page 15 */
2785
static int
2786
dissect_nfs2_statfs_call(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
2787
0
{
2788
0
  uint32_t hash;
2789
0
  unsigned offset = 0;
2790
2791
0
  offset = dissect_fhandle(tvb, offset, pinfo, tree, "object", &hash, (rpc_call_info_value*)data);
2792
2793
0
  col_append_fstr(pinfo->cinfo, COL_INFO, ", FH: 0x%08x", hash);
2794
0
  proto_item_append_text(tree, ", STATFS Call FH: 0x%08x", hash);
2795
2796
0
  return offset;
2797
0
}
2798
2799
2800
static int
2801
dissect_nfs2_readlink_call(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
2802
0
{
2803
0
  uint32_t hash;
2804
0
  unsigned offset = 0;
2805
2806
0
  offset = dissect_fhandle(tvb, offset, pinfo, tree, "object", &hash, (rpc_call_info_value*)data);
2807
2808
0
  col_append_fstr(pinfo->cinfo, COL_INFO, ", FH: 0x%08x", hash);
2809
0
  proto_item_append_text(tree, ", READLINK Call FH: 0x%08x", hash);
2810
2811
0
  return offset;
2812
0
}
2813
2814
2815
static int
2816
dissect_nfs2_getattr_call(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
2817
0
{
2818
0
  uint32_t hash;
2819
0
  unsigned offset = 0;
2820
2821
0
  offset = dissect_fhandle(tvb, offset, pinfo, tree, "object", &hash, (rpc_call_info_value*)data);
2822
2823
0
  col_append_fstr(pinfo->cinfo, COL_INFO, ", FH: 0x%08x", hash);
2824
0
  proto_item_append_text(tree, ", GETATTR Call FH: 0x%08x", hash);
2825
2826
0
  return offset;
2827
0
}
2828
2829
2830
/* NFSv2 RFC 1094, Page 15 */
2831
static int
2832
dissect_timeval(tvbuff_t *tvb, unsigned offset, proto_tree *tree, int hf_time, int hf_time_sec,
2833
          int hf_time_usec)
2834
0
{
2835
2836
0
  if (tree) {
2837
0
    proto_item *time_item;
2838
0
    proto_tree *time_tree;
2839
0
    uint32_t      seconds;
2840
0
    uint32_t      useconds;
2841
0
    nstime_t    ts;
2842
2843
0
    seconds  = tvb_get_ntohl(tvb, offset+0);
2844
0
    useconds = tvb_get_ntohl(tvb, offset+4);
2845
0
    ts.secs  = seconds;
2846
0
    ts.nsecs = useconds * 1000;
2847
2848
0
    time_item = proto_tree_add_time(tree, hf_time, tvb, offset, 8,
2849
0
        &ts);
2850
2851
0
    time_tree = proto_item_add_subtree(time_item, ett_nfs_timeval);
2852
2853
0
    proto_tree_add_uint(time_tree, hf_time_sec, tvb, offset, 4,
2854
0
            seconds);
2855
0
    proto_tree_add_uint(time_tree, hf_time_usec, tvb, offset+4, 4,
2856
0
            useconds);
2857
0
  }
2858
0
  offset += 8;
2859
0
  return offset;
2860
0
}
2861
2862
/* NFSv2 RFC 1094, Page 16 */
2863
static const value_string nfs2_mode_names[] = {
2864
  { 1,  "Character Special Device"  },
2865
  { 2,  "Directory" },
2866
  { 3,  "Block Special Device"  },
2867
  { 4,  "Regular File"  },
2868
  { 5,  "Symbolic Link" },
2869
  { 6,  "Named Socket"  },
2870
  { 0000000,  NULL    }
2871
};
2872
2873
static int
2874
dissect_nfs2_mode(tvbuff_t *tvb, unsigned offset, proto_tree *tree)
2875
0
{
2876
0
  static int * const modes[] = {
2877
0
    &hf_nfs2_mode_name,
2878
0
    &hf_nfs2_mode_set_user_id,
2879
0
    &hf_nfs2_mode_set_group_id,
2880
0
    &hf_nfs2_mode_save_swap_text,
2881
0
    &hf_nfs2_mode_read_owner,
2882
0
    &hf_nfs2_mode_write_owner,
2883
0
    &hf_nfs2_mode_exec_owner,
2884
0
    &hf_nfs2_mode_read_group,
2885
0
    &hf_nfs2_mode_write_group,
2886
0
    &hf_nfs2_mode_exec_group,
2887
0
    &hf_nfs2_mode_read_other,
2888
0
    &hf_nfs2_mode_write_other,
2889
0
    &hf_nfs2_mode_exec_other,
2890
0
    NULL
2891
0
  };
2892
2893
0
  proto_tree_add_bitmask(tree, tvb, offset, hf_nfs2_mode, ett_nfs2_mode, modes, ENC_BIG_ENDIAN);
2894
2895
0
  offset += 4;
2896
0
  return offset;
2897
0
}
2898
2899
2900
/* NFSv2 RFC 1094, Page 15 */
2901
unsigned
2902
dissect_nfs2_fattr(tvbuff_t *tvb, unsigned offset, proto_tree *tree, const char *name)
2903
0
{
2904
0
  proto_item *fattr_item;
2905
0
  proto_tree *fattr_tree;
2906
0
  unsigned    old_offset = offset;
2907
2908
0
  fattr_tree = proto_tree_add_subtree(tree, tvb, offset, -1,
2909
0
      ett_nfs_fattr, &fattr_item, name);
2910
2911
0
  offset = dissect_nfs2_ftype(tvb, offset, fattr_tree);
2912
0
  offset = dissect_nfs2_mode(tvb, offset, fattr_tree);
2913
  /* XXX - "Notice that the file type is specified both in the mode bits
2914
   * and in the file type." - Expert Info if inconsistent?
2915
   */
2916
0
  offset = dissect_rpc_uint32(tvb, fattr_tree, hf_nfs2_fattr_nlink, offset);
2917
0
  offset = dissect_rpc_uint32(tvb, fattr_tree, hf_nfs2_fattr_uid, offset);
2918
0
  offset = dissect_rpc_uint32(tvb, fattr_tree, hf_nfs2_fattr_gid, offset);
2919
0
  offset = dissect_rpc_uint32(tvb, fattr_tree, hf_nfs2_fattr_size, offset);
2920
0
  offset = dissect_rpc_uint32(tvb, fattr_tree, hf_nfs2_fattr_blocksize, offset);
2921
0
  offset = dissect_rpc_uint32(tvb, fattr_tree, hf_nfs2_fattr_rdev, offset);
2922
0
  offset = dissect_rpc_uint32(tvb, fattr_tree, hf_nfs2_fattr_blocks, offset);
2923
0
  offset = dissect_rpc_uint32(tvb, fattr_tree, hf_nfs2_fattr_fsid, offset);
2924
0
  offset = dissect_rpc_uint32(tvb, fattr_tree, hf_nfs2_fattr_fileid, offset);
2925
2926
0
  offset = dissect_timeval(tvb, offset, fattr_tree,
2927
0
    hf_nfs_atime, hf_nfs_atime_sec, hf_nfs_atime_usec);
2928
0
  offset = dissect_timeval(tvb, offset, fattr_tree,
2929
0
    hf_nfs_mtime, hf_nfs_mtime_sec, hf_nfs_mtime_usec);
2930
0
  offset = dissect_timeval(tvb, offset, fattr_tree,
2931
0
    hf_nfs_ctime, hf_nfs_ctime_sec, hf_nfs_ctime_usec);
2932
2933
  /* now we know, that fattr is shorter */
2934
0
  proto_item_set_len(fattr_item, offset - old_offset);
2935
2936
0
  return offset;
2937
0
}
2938
2939
2940
/* NFSv2 RFC 1094, Page 17 */
2941
static int
2942
dissect_nfs2_sattr(tvbuff_t *tvb, unsigned offset, proto_tree *tree, const char *name)
2943
0
{
2944
0
  proto_item *sattr_item;
2945
0
  proto_tree *sattr_tree;
2946
0
  unsigned    old_offset = offset;
2947
2948
0
  sattr_tree = proto_tree_add_subtree(tree, tvb, offset, -1,
2949
0
          ett_nfs2_sattr, &sattr_item, name);
2950
2951
0
  if (tvb_get_ntohl(tvb, offset+0) != 0xffffffff)
2952
0
    offset = dissect_nfs2_mode(tvb, offset, sattr_tree);
2953
0
  else {
2954
0
    proto_tree_add_uint_format_value(sattr_tree, hf_nfs2_mode, tvb, offset, 4, 0xffffffff, "no value");
2955
0
    offset += 4;
2956
0
  }
2957
2958
0
  if (tvb_get_ntohl(tvb, offset+0) != 0xffffffff)
2959
0
    offset = dissect_rpc_uint32(tvb, sattr_tree, hf_nfs2_fattr_uid,
2960
0
      offset);
2961
0
  else {
2962
0
    proto_tree_add_uint_format_value(sattr_tree, hf_nfs2_fattr_uid, tvb, offset, 4, 0xffffffff, "no value");
2963
0
    offset += 4;
2964
0
  }
2965
2966
0
  if (tvb_get_ntohl(tvb, offset+0) != 0xffffffff)
2967
0
    offset = dissect_rpc_uint32(tvb, sattr_tree, hf_nfs2_fattr_gid,
2968
0
      offset);
2969
0
  else {
2970
0
    proto_tree_add_uint_format_value(sattr_tree, hf_nfs2_fattr_gid, tvb, offset, 4, 0xffffffff, "no value");
2971
0
    offset += 4;
2972
0
  }
2973
2974
0
  if (tvb_get_ntohl(tvb, offset+0) != 0xffffffff)
2975
0
    offset = dissect_rpc_uint32(tvb, sattr_tree, hf_nfs2_fattr_size,
2976
0
      offset);
2977
0
  else {
2978
0
    proto_tree_add_uint_format_value(sattr_tree, hf_nfs2_fattr_size, tvb, offset, 4, 0xffffffff, "no value");
2979
0
    offset += 4;
2980
0
  }
2981
2982
0
  if (tvb_get_ntohl(tvb, offset+0) != 0xffffffff) {
2983
0
    offset = dissect_timeval(tvb, offset, sattr_tree,
2984
0
      hf_nfs_atime, hf_nfs_atime_sec, hf_nfs_atime_usec);
2985
0
  } else {
2986
0
    nstime_t    ts;
2987
2988
0
    ts.secs  = 0xffffffff;
2989
0
    ts.nsecs = 0;
2990
2991
0
    proto_tree_add_time_format_value(sattr_tree, hf_nfs_atime, tvb, offset, 8, &ts, "no value");
2992
0
    offset += 8;
2993
0
  }
2994
2995
0
  if (tvb_get_ntohl(tvb, offset+0) != 0xffffffff) {
2996
0
    offset = dissect_timeval(tvb, offset, sattr_tree,
2997
0
      hf_nfs_mtime, hf_nfs_mtime_sec, hf_nfs_mtime_usec);
2998
0
  } else {
2999
0
    nstime_t    ts;
3000
3001
0
    ts.secs  = 0xffffffff;
3002
0
    ts.nsecs = 0;
3003
3004
0
    proto_tree_add_time_format_value(sattr_tree, hf_nfs_mtime, tvb, offset, 8, &ts, "no value");
3005
0
    offset += 8;
3006
0
  }
3007
3008
  /* now we know, that sattr is shorter */
3009
0
  proto_item_set_len(sattr_item, offset - old_offset);
3010
3011
0
  return offset;
3012
0
}
3013
3014
3015
/* NFSv2 RFC 1094, Page 17 */
3016
static int
3017
dissect_filename(tvbuff_t *tvb, packet_info* pinfo, unsigned offset, proto_tree *tree, int hf, const char **string_ret)
3018
0
{
3019
0
  offset = dissect_rpc_string(tvb, pinfo, tree, hf, offset, string_ret);
3020
0
  return offset;
3021
0
}
3022
3023
3024
/* NFSv2 RFC 1094, Page 17 */
3025
static int
3026
dissect_path(tvbuff_t *tvb, packet_info* pinfo, unsigned offset, proto_tree *tree, int hf, const char **name)
3027
0
{
3028
0
  offset = dissect_rpc_string(tvb, pinfo, tree, hf, offset, name);
3029
0
  return offset;
3030
0
}
3031
3032
3033
/* NFSv2 RFC 1094, Page 17,18 */
3034
static int
3035
dissect_attrstat(tvbuff_t *tvb, unsigned offset, proto_tree *tree, packet_info *pinfo, const char *funcname)
3036
0
{
3037
0
  uint32_t      status;
3038
0
  const char *err;
3039
3040
0
  offset = dissect_nfs2_status(tvb, offset, tree, &status);
3041
0
  switch (status) {
3042
0
    case 0:
3043
0
      offset = dissect_nfs2_fattr(tvb, offset, tree, "attributes");
3044
0
      proto_item_append_text(tree, ", %s Reply", funcname);
3045
0
    break;
3046
0
    default:
3047
0
      err = val_to_str_ext(pinfo->pool, status, &names_nfs2_stat_ext, "Unknown error: %u");
3048
0
      col_append_fstr(pinfo->cinfo, COL_INFO, " Error: %s", err);
3049
0
      proto_item_append_text(tree, ", %s Reply  Error: %s", funcname, err);
3050
0
    break;
3051
0
  }
3052
3053
0
  return offset;
3054
0
}
3055
3056
3057
/* NFSv2 RFC 1094, Page 17,18 */
3058
static int
3059
dissect_nfs2_write_reply(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data _U_)
3060
0
{
3061
0
  return dissect_attrstat(tvb, 0, tree, pinfo, "WRITE");
3062
0
}
3063
3064
3065
/* NFSv2 RFC 1094, Page 18 */
3066
static int
3067
dissect_nfs2_setattr_reply(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data _U_)
3068
0
{
3069
0
  return dissect_attrstat(tvb, 0, tree, pinfo, "SETATTR");
3070
0
}
3071
3072
3073
/* NFSv2 RFC 1094, Page 18 */
3074
static int
3075
dissect_nfs2_getattr_reply(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data _U_)
3076
0
{
3077
0
  return dissect_attrstat(tvb, 0, tree, pinfo, "GETATTR");
3078
0
}
3079
3080
3081
/* NFSv2 RFC 1094, Page 18 */
3082
static int
3083
dissect_diropargs(tvbuff_t *tvb, unsigned offset, packet_info *pinfo, proto_tree *tree,
3084
          const char *label, uint32_t *hash, const char **name, rpc_call_info_value *civ)
3085
0
{
3086
0
  proto_item *diropargs_item;
3087
0
  proto_tree *diropargs_tree;
3088
0
  unsigned    old_offset     = offset;
3089
3090
0
  diropargs_tree = proto_tree_add_subtree(tree, tvb, offset, -1,
3091
0
      ett_nfs2_diropargs, &diropargs_item, label);
3092
3093
  /* are we snooping fh to filenames ?*/
3094
0
  if ((!pinfo->fd->visited) && nfs_file_name_snooping) {
3095
    /* v2 LOOKUP, CREATE, MKDIR, SYMLINK calls might give us a mapping*/
3096
3097
0
    if ( (civ->prog == 100003)
3098
0
      &&(civ->vers == 2)
3099
0
      &&(civ->request)
3100
0
      &&((civ->proc == 4)||(civ->proc == 9)||(civ->proc == 13)||(civ->proc == 14))
3101
0
    ) {
3102
0
      nfs_name_snoop_add_name(civ->xid, tvb,
3103
0
        offset+36, tvb_get_ntohl(tvb, offset+32),
3104
0
        offset, 32, NULL);
3105
0
    }
3106
0
  }
3107
3108
0
  offset = dissect_fhandle(tvb, offset, pinfo, diropargs_tree, "dir", hash, civ);
3109
0
  offset = dissect_filename(tvb, pinfo, offset, diropargs_tree, hf_nfs_name, name);
3110
3111
  /* now we know, that diropargs is shorter */
3112
0
  proto_item_set_len(diropargs_item, offset - old_offset);
3113
3114
0
  return offset;
3115
0
}
3116
3117
3118
/* NFSv2 RFC 1094, Page 18 */
3119
static int
3120
dissect_nfs2_rmdir_call(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
3121
0
{
3122
0
  uint32_t      hash;
3123
0
  const char *name = NULL;
3124
0
  unsigned offset = 0;
3125
3126
0
  offset = dissect_diropargs(tvb, offset, pinfo, tree, "where", &hash, &name, (rpc_call_info_value*)data);
3127
3128
0
  col_append_fstr(pinfo->cinfo, COL_INFO, ", DH: 0x%08x/%s", hash, name);
3129
0
  proto_item_append_text(tree, ", RMDIR Call DH: 0x%08x/%s", hash, name);
3130
3131
0
  return offset;
3132
0
}
3133
3134
3135
/* NFSv2 RFC 1094, Page 18 */
3136
static int
3137
dissect_nfs2_remove_call(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
3138
0
{
3139
0
  uint32_t      hash;
3140
0
  const char *name = NULL;
3141
0
  unsigned offset = 0;
3142
3143
0
  offset = dissect_diropargs(tvb, offset, pinfo, tree, "where", &hash, &name, (rpc_call_info_value*)data);
3144
3145
0
  col_append_fstr(pinfo->cinfo, COL_INFO, ", DH: 0x%08x/%s", hash, name);
3146
0
  proto_item_append_text(tree, ", REMOVE Call DH: 0x%08x/%s", hash, name);
3147
3148
0
  return offset;
3149
0
}
3150
3151
3152
/* NFSv2 RFC 1094, Page 18 */
3153
static int
3154
dissect_nfs2_lookup_call(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
3155
0
{
3156
0
  uint32_t      hash;
3157
0
  const char *name = NULL;
3158
0
  unsigned offset = 0;
3159
3160
0
  offset = dissect_diropargs(tvb, offset, pinfo, tree, "where", &hash, &name, (rpc_call_info_value*)data);
3161
3162
0
  col_append_fstr(pinfo->cinfo, COL_INFO, ", DH: 0x%08x/%s", hash, name);
3163
0
  proto_item_append_text(tree, ", LOOKUP Call DH: 0x%08x/%s", hash, name);
3164
3165
0
  return offset;
3166
0
}
3167
3168
3169
/* NFSv2 RFC 1094, Page 18 */
3170
static int
3171
dissect_diropres(tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
3172
     proto_tree *tree, const char *funcname, rpc_call_info_value* civ)
3173
0
{
3174
0
  uint32_t      status;
3175
0
  uint32_t      hash;
3176
0
  const char *err;
3177
3178
0
  offset = dissect_nfs2_status(tvb, offset, tree, &status);
3179
0
  switch (status) {
3180
0
    case 0:
3181
0
      offset = dissect_fhandle(tvb, offset, pinfo, tree, "file", &hash, civ);
3182
0
      offset = dissect_nfs2_fattr  (tvb, offset, tree, "attributes");
3183
0
      col_append_fstr(pinfo->cinfo, COL_INFO, ", FH: 0x%08x", hash);
3184
0
      proto_item_append_text(tree, ", %s Reply FH: 0x%08x", funcname, hash);
3185
0
    break;
3186
0
    default:
3187
0
      err = val_to_str_ext(pinfo->pool, status, &names_nfs2_stat_ext, "Unknown error: %u");
3188
0
      col_append_fstr(pinfo->cinfo, COL_INFO, " Error: %s", err);
3189
0
      proto_item_append_text(tree, ", %s Reply  Error: %s", funcname, err);
3190
0
    break;
3191
0
  }
3192
3193
0
  return offset;
3194
0
}
3195
3196
3197
/* nfsdata is simply a chunk of RPC opaque data (length, data, fill bytes) */
3198
static int
3199
dissect_nfsdata(tvbuff_t *tvb, packet_info* pinfo, unsigned offset, proto_tree *tree, int hf)
3200
0
{
3201
0
  offset = dissect_rpc_data(tvb, pinfo, tree, hf, offset);
3202
0
  return offset;
3203
0
}
3204
3205
3206
/* NFSv2 RFC 1094, Page 18 */
3207
static int
3208
dissect_nfs2_mkdir_reply(tvbuff_t *tvb, packet_info *pinfo,
3209
       proto_tree *tree, void *data)
3210
0
{
3211
0
  return dissect_diropres(tvb, 0, pinfo, tree, "MKDIR", (rpc_call_info_value*)data);
3212
0
}
3213
3214
3215
static int
3216
dissect_nfs2_create_reply(tvbuff_t *tvb, packet_info *pinfo,
3217
        proto_tree *tree, void *data _U_)
3218
0
{
3219
0
  return dissect_diropres(tvb, 0, pinfo, tree, "CREATE", (rpc_call_info_value*)data);
3220
0
}
3221
3222
3223
static int
3224
dissect_nfs2_lookup_reply(tvbuff_t *tvb, packet_info *pinfo,
3225
        proto_tree *tree, void *data _U_)
3226
0
{
3227
0
  return dissect_diropres(tvb, 0, pinfo, tree, "LOOKUP", (rpc_call_info_value*)data);
3228
0
}
3229
3230
3231
/* RFC 1094, Page 6 */
3232
static int
3233
dissect_nfs2_setattr_call(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
3234
0
{
3235
0
  uint32_t hash;
3236
0
  unsigned offset = 0;
3237
3238
0
  offset = dissect_fhandle(tvb, offset, pinfo, tree, "file", &hash, (rpc_call_info_value*)data);
3239
0
  offset = dissect_nfs2_sattr  (tvb, offset,        tree, "attributes");
3240
3241
0
  col_append_fstr(pinfo->cinfo, COL_INFO, ", FH: 0x%08x", hash);
3242
0
  proto_item_append_text(tree, ", SETATTR Call FH: 0x%08x", hash);
3243
0
  return offset;
3244
0
}
3245
3246
3247
/* NFSv2 RFC 1094, Page 6 */
3248
static int
3249
dissect_nfs2_readlink_reply(tvbuff_t *tvb, packet_info *pinfo,
3250
          proto_tree *tree, void *data _U_)
3251
0
{
3252
0
  uint32_t      status;
3253
0
  const char *err;
3254
0
  const char *name = NULL;
3255
0
  unsigned offset = 0;
3256
3257
0
  offset = dissect_nfs2_status(tvb, offset, tree, &status);
3258
0
  switch (status) {
3259
0
    case 0:
3260
0
      offset = dissect_nfsdata_reduced(R_NFS2_PATH, tvb, pinfo, offset, tree, hf_nfs2_readlink_data, &name);
3261
0
      col_append_fstr(pinfo->cinfo, COL_INFO, " Path: %s", name);
3262
0
      proto_item_append_text(tree, ", READLINK Reply Path: %s", name);
3263
0
    break;
3264
0
    default:
3265
0
      err = val_to_str_ext(pinfo->pool, status, &names_nfs2_stat_ext, "Unknown error: %u");
3266
0
      col_append_fstr(pinfo->cinfo, COL_INFO, " Error: %s", err);
3267
0
      proto_item_append_text(tree, ", READLINK Reply  Error: %s", err);
3268
0
    break;
3269
0
  }
3270
3271
0
  return offset;
3272
0
}
3273
3274
3275
/* NFSv2 RFC 1094, Page 7 */
3276
static int
3277
dissect_nfs2_read_call(tvbuff_t *tvb, packet_info *pinfo,
3278
           proto_tree *tree, void *data)
3279
0
{
3280
0
  uint32_t offset_value;
3281
0
  uint32_t count;
3282
0
  uint32_t totalcount;
3283
0
  uint32_t hash;
3284
0
  unsigned offset = 0;
3285
3286
0
  offset = dissect_fhandle(tvb, offset, pinfo, tree, "file", &hash, (rpc_call_info_value*)data);
3287
0
  proto_tree_add_item_ret_uint(tree, hf_nfs2_read_offset, tvb,
3288
0
    offset+0, 4, ENC_BIG_ENDIAN, &offset_value);
3289
0
  proto_tree_add_item_ret_uint(tree, hf_nfs2_read_count, tvb,
3290
0
    offset+4, 4, ENC_BIG_ENDIAN, &count);
3291
0
  proto_tree_add_item_ret_uint(tree, hf_nfs2_read_totalcount, tvb,
3292
0
    offset+8, 4, ENC_BIG_ENDIAN, &totalcount);
3293
0
  offset += 12;
3294
3295
0
  col_append_fstr(pinfo->cinfo, COL_INFO, ", FH: 0x%08x Offset: %u Count: %u TotalCount: %u",
3296
0
    hash, offset_value, count, totalcount);
3297
0
  proto_item_append_text(tree, ", READ Call FH: 0x%08x Offset: %u Count: %u TotalCount: %u",
3298
0
    hash, offset_value, count, totalcount);
3299
3300
0
  return offset;
3301
0
}
3302
3303
3304
/* NFSv2 RFC 1094, Page 7 */
3305
static int
3306
dissect_nfs2_read_reply(tvbuff_t *tvb, packet_info *pinfo,
3307
      proto_tree *tree, void *data _U_)
3308
0
{
3309
0
  uint32_t      status;
3310
0
  const char *err;
3311
0
  unsigned offset = 0;
3312
3313
0
  offset = dissect_nfs2_status(tvb, offset, tree, &status);
3314
0
  switch (status) {
3315
0
    case 0:
3316
0
      offset = dissect_nfs2_fattr(tvb, offset, tree, "attributes");
3317
0
      proto_item_append_text(tree, ", READ Reply");
3318
0
      offset = dissect_nfsdata_reduced(R_NFSDATA, tvb, pinfo, offset, tree, hf_nfs_data, NULL);
3319
0
    break;
3320
0
    default:
3321
0
      err = val_to_str_ext(pinfo->pool, status, &names_nfs2_stat_ext, "Unknown error: %u");
3322
0
      col_append_fstr(pinfo->cinfo, COL_INFO, " Error: %s", err);
3323
0
      proto_item_append_text(tree, ", READ Reply  Error: %s", err);
3324
0
    break;
3325
0
  }
3326
3327
0
  return offset;
3328
0
}
3329
3330
3331
/* NFSv2 RFC 1094, Page 8 */
3332
static int
3333
dissect_nfs2_write_call(tvbuff_t *tvb, packet_info *pinfo,
3334
      proto_tree *tree, void *data)
3335
0
{
3336
0
  uint32_t beginoffset;
3337
0
  uint32_t offset_value;
3338
0
  uint32_t totalcount;
3339
0
  uint32_t hash;
3340
0
  unsigned offset = 0;
3341
3342
0
  offset = dissect_fhandle(tvb, offset, pinfo, tree, "file", &hash, (rpc_call_info_value*)data);
3343
3344
0
  proto_tree_add_item_ret_uint(tree, hf_nfs2_write_beginoffset, tvb,
3345
0
    offset+0, 4, ENC_BIG_ENDIAN, &beginoffset);
3346
0
  proto_tree_add_item_ret_uint(tree, hf_nfs2_write_offset, tvb,
3347
0
    offset+4, 4, ENC_BIG_ENDIAN, &offset_value);
3348
0
  proto_tree_add_item_ret_uint(tree, hf_nfs2_write_totalcount, tvb,
3349
0
    offset+8, 4, ENC_BIG_ENDIAN, &totalcount);
3350
0
  offset += 12;
3351
3352
0
  col_append_fstr(pinfo->cinfo, COL_INFO, ", FH: 0x%08x BeginOffset: %u Offset: %u TotalCount: %u",
3353
0
    hash, beginoffset, offset_value, totalcount);
3354
0
  proto_item_append_text(tree, ", WRITE Call FH: 0x%08x BeginOffset: %u Offset: %u TotalCount: %u",
3355
0
    hash, beginoffset, offset_value, totalcount);
3356
3357
0
  offset = dissect_nfsdata(tvb, pinfo, offset, tree, hf_nfs_data);
3358
3359
0
  return offset;
3360
0
}
3361
3362
3363
/* NFSv2 RFC 1094, Page 8 */
3364
static int
3365
dissect_nfs2_mkdir_call(tvbuff_t *tvb, packet_info *pinfo,
3366
      proto_tree *tree, void *data)
3367
0
{
3368
0
  uint32_t      hash;
3369
0
  const char *name = NULL;
3370
0
  unsigned offset = 0;
3371
3372
0
  offset = dissect_diropargs(tvb, offset, pinfo, tree, "where", &hash, &name, (rpc_call_info_value*)data);
3373
0
  offset = dissect_nfs2_sattr    (tvb, offset,        tree, "attributes");
3374
3375
0
  col_append_fstr(pinfo->cinfo, COL_INFO, ", DH: 0x%08x/%s", hash, name);
3376
0
  proto_item_append_text(tree, ", MKDIR Call DH: 0x%08x/%s", hash, name);
3377
3378
0
  return offset;
3379
0
}
3380
3381
static int
3382
dissect_nfs2_create_call(tvbuff_t *tvb, packet_info *pinfo,
3383
       proto_tree *tree, void *data)
3384
0
{
3385
0
  uint32_t      hash;
3386
0
  const char *name = NULL;
3387
0
  unsigned offset = 0;
3388
3389
0
  offset = dissect_diropargs(tvb, offset, pinfo, tree, "where", &hash, &name, (rpc_call_info_value*)data);
3390
0
  offset = dissect_nfs2_sattr    (tvb, offset,        tree, "attributes");
3391
3392
0
  col_append_fstr(pinfo->cinfo, COL_INFO, ", DH: 0x%08x/%s", hash, name);
3393
0
  proto_item_append_text(tree, ", CREATE Call DH: 0x%08x/%s", hash, name);
3394
3395
0
  return offset;
3396
0
}
3397
3398
3399
/* NFSv2 RFC 1094, Page 9 */
3400
static int
3401
dissect_nfs2_rename_call(tvbuff_t *tvb, packet_info *pinfo,
3402
       proto_tree *tree, void *data)
3403
0
{
3404
0
  uint32_t      from_hash;
3405
0
  const char *from_name = NULL;
3406
0
  uint32_t      to_hash;
3407
0
  const char *to_name   = NULL;
3408
0
  unsigned offset = 0;
3409
3410
0
  offset = dissect_diropargs(tvb, offset, pinfo, tree, "from", &from_hash, &from_name, (rpc_call_info_value*)data);
3411
0
  offset = dissect_diropargs(tvb, offset, pinfo, tree, "to", &to_hash, &to_name, (rpc_call_info_value*)data);
3412
3413
0
  col_append_fstr(pinfo->cinfo, COL_INFO, ", From DH: 0x%08x/%s To DH: 0x%08x/%s",
3414
0
    from_hash, from_name, to_hash, to_name);
3415
0
  proto_item_append_text(tree, ", RENAME Call From DH: 0x%08x/%s To DH: 0x%08x/%s",
3416
0
    from_hash, from_name, to_hash, to_name);
3417
3418
0
  return offset;
3419
0
}
3420
3421
3422
/* NFSv2 RFC 1094, Page 9 */
3423
static int
3424
dissect_nfs2_link_call(tvbuff_t *tvb, packet_info *pinfo,
3425
           proto_tree *tree, void *data)
3426
0
{
3427
0
  uint32_t      from_hash;
3428
0
  uint32_t      to_hash;
3429
0
  const char *to_name = NULL;
3430
0
  unsigned offset = 0;
3431
3432
0
  offset = dissect_fhandle(tvb, offset, pinfo, tree, "from", &from_hash, (rpc_call_info_value*)data);
3433
0
  offset = dissect_diropargs(tvb, offset, pinfo, tree, "to", &to_hash, &to_name, (rpc_call_info_value*)data);
3434
3435
0
  col_append_fstr(pinfo->cinfo, COL_INFO, ", From DH: 0x%08x To DH: 0x%08x/%s",
3436
0
    from_hash, to_hash, to_name);
3437
0
  proto_item_append_text(tree, ", LINK Call From DH: 0x%08x To DH: 0x%08x/%s",
3438
0
    from_hash, to_hash, to_name);
3439
3440
0
  return offset;
3441
0
}
3442
3443
3444
/* NFSv2 RFC 1094, Page 10 */
3445
static int
3446
dissect_nfs2_symlink_call(tvbuff_t *tvb, packet_info *pinfo,
3447
        proto_tree *tree, void *data)
3448
0
{
3449
0
  uint32_t      from_hash;
3450
0
  const char *from_name = NULL;
3451
0
  const char *to_name   = NULL;
3452
0
  unsigned offset = 0;
3453
3454
0
  offset = dissect_diropargs(tvb, offset, pinfo, tree, "from", &from_hash, &from_name, (rpc_call_info_value*)data);
3455
0
  offset = dissect_path(tvb, pinfo, offset, tree, hf_nfs_symlink_to, &to_name);
3456
0
  offset = dissect_nfs2_sattr(tvb, offset, tree, "attributes");
3457
3458
0
  col_append_fstr(pinfo->cinfo, COL_INFO, ", From DH: 0x%08x/%s To %s",
3459
0
    from_hash, from_name, to_name);
3460
0
  proto_item_append_text(tree, ", SYMLINK Call From DH: 0x%08x/%s To %s",
3461
0
    from_hash, from_name, to_name);
3462
3463
0
  return offset;
3464
0
}
3465
3466
3467
/* NFSv2 RFC 1094, Page 11 */
3468
static int
3469
dissect_nfs2_readdir_call(tvbuff_t *tvb, packet_info *pinfo,
3470
        proto_tree *tree, void *data)
3471
0
{
3472
0
  uint32_t hash;
3473
0
  unsigned offset = 0;
3474
3475
0
  offset = dissect_fhandle(tvb, offset, pinfo, tree, "dir", &hash, (rpc_call_info_value*)data);
3476
3477
0
  proto_tree_add_item(tree, hf_nfs2_readdir_cookie, tvb, offset+ 0, 4, ENC_BIG_ENDIAN);
3478
0
  proto_tree_add_item(tree, hf_nfs2_readdir_count, tvb, offset+ 4, 4, ENC_BIG_ENDIAN);
3479
0
  offset += 8;
3480
3481
0
  col_append_fstr(pinfo->cinfo, COL_INFO, ", FH: 0x%08x", hash);
3482
0
  proto_item_append_text(tree, ", READDIR Call FH: 0x%08x", hash);
3483
3484
0
  return offset;
3485
0
}
3486
3487
3488
/* NFSv2 RFC 1094, Page 11 */
3489
static int
3490
dissect_readdir_entry(tvbuff_t *tvb, unsigned offset, packet_info *pinfo, proto_tree *tree, void *data _U_)
3491
0
{
3492
0
  proto_item *entry_item = NULL;
3493
0
  proto_tree *entry_tree = NULL;
3494
0
  unsigned    old_offset = offset;
3495
0
  uint32_t      fileid;
3496
0
  const char *name;
3497
3498
0
  if (tree) {
3499
0
    entry_item = proto_tree_add_item(tree, hf_nfs_readdir_entry, tvb,
3500
0
      offset+0, -1, ENC_NA);
3501
0
    entry_tree = proto_item_add_subtree(entry_item, ett_nfs_readdir_entry);
3502
0
  }
3503
3504
0
  proto_tree_add_item_ret_uint(entry_tree, hf_nfs2_readdir_entry_fileid, tvb,
3505
0
      offset, 4, ENC_BIG_ENDIAN, &fileid);
3506
0
  offset += 4;
3507
3508
0
  offset = dissect_filename(tvb, pinfo, offset, entry_tree,
3509
0
    hf_nfs2_readdir_entry_name, &name);
3510
0
  if (entry_item)
3511
0
    proto_item_set_text(entry_item, "Entry: file ID %u, name %s", fileid, name);
3512
3513
0
  proto_tree_add_item(entry_tree, hf_nfs2_readdir_entry_cookie, tvb, offset, 4, ENC_BIG_ENDIAN);
3514
0
  offset += 4;
3515
3516
  /* now we know, that a readdir entry is shorter */
3517
0
  if (entry_item) {
3518
0
    proto_item_set_len(entry_item, offset - old_offset);
3519
0
  }
3520
3521
0
  return offset;
3522
0
}
3523
3524
3525
/* NFSv2 RFC 1094, Page 11 */
3526
static int
3527
dissect_nfs2_readdir_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
3528
0
{
3529
0
  uint32_t      status;
3530
0
  uint32_t      eof_value;
3531
0
  const char *err;
3532
0
  unsigned offset = 0;
3533
3534
0
  offset = dissect_nfs2_status(tvb, offset, tree, &status);
3535
0
  switch (status) {
3536
0
    case 0:
3537
0
      proto_item_append_text(tree, ", READDIR Reply");
3538
3539
0
      offset = dissect_rpc_list(tvb, pinfo, tree, offset,
3540
0
        dissect_readdir_entry, NULL);
3541
0
      proto_tree_add_item_ret_uint(tree, hf_nfs_readdir_eof, tvb,
3542
0
          offset, 4, ENC_BIG_ENDIAN, &eof_value);
3543
0
      offset += 4;
3544
0
    break;
3545
0
    default:
3546
0
      err = val_to_str_ext(pinfo->pool, status, &names_nfs2_stat_ext, "Unknown error: %u");
3547
0
      col_append_fstr(pinfo->cinfo, COL_INFO, " Error: %s", err);
3548
0
      proto_item_append_text(tree, ", READDIR Reply  Error: %s", err);
3549
0
    break;
3550
0
  }
3551
3552
0
  return offset;
3553
0
}
3554
3555
3556
/* NFSv2 RFC 1094, Page 12 */
3557
static int
3558
dissect_nfs2_statfs_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
3559
0
{
3560
0
  uint32_t      status;
3561
0
  const char *err;
3562
0
  unsigned offset = 0;
3563
3564
0
  offset = dissect_nfs2_status(tvb, offset, tree, &status);
3565
0
  switch (status) {
3566
0
    case 0:
3567
0
      proto_tree_add_item(tree, hf_nfs2_statfs_tsize, tvb, offset+ 0, 4, ENC_BIG_ENDIAN);
3568
0
      proto_tree_add_item(tree, hf_nfs2_statfs_bsize, tvb, offset+ 4, 4, ENC_BIG_ENDIAN);
3569
0
      proto_tree_add_item(tree, hf_nfs2_statfs_blocks, tvb, offset+ 8, 4, ENC_BIG_ENDIAN);
3570
0
      proto_tree_add_item(tree, hf_nfs2_statfs_bfree, tvb, offset+12, 4, ENC_BIG_ENDIAN);
3571
0
      proto_tree_add_item(tree, hf_nfs2_statfs_bavail, tvb, offset+16, 4, ENC_BIG_ENDIAN);
3572
0
      offset += 20;
3573
0
      proto_item_append_text(tree, ", STATFS Reply");
3574
0
    break;
3575
0
    default:
3576
0
      err = val_to_str_ext(pinfo->pool, status, &names_nfs2_stat_ext, "Unknown error: %u");
3577
0
      col_append_fstr(pinfo->cinfo, COL_INFO, " Error: %s", err);
3578
0
      proto_item_append_text(tree, ", STATFS Reply  Error: %s", err);
3579
0
    break;
3580
0
  }
3581
3582
0
  return offset;
3583
0
}
3584
3585
3586
/* proc number, "proc name", dissect_request, dissect_reply */
3587
static const vsff nfs2_proc[] = {
3588
  { 0,  "NULL",   /* OK */
3589
  dissect_rpc_void,   dissect_rpc_void },
3590
  { 1,  "GETATTR",  /* OK */
3591
  dissect_nfs2_getattr_call,  dissect_nfs2_getattr_reply },
3592
  { 2,  "SETATTR",  /* OK */
3593
  dissect_nfs2_setattr_call,  dissect_nfs2_setattr_reply },
3594
  { 3,  "ROOT",   /* OK */
3595
  dissect_rpc_void,   dissect_rpc_void },
3596
  { 4,  "LOOKUP", /* OK */
3597
  dissect_nfs2_lookup_call, dissect_nfs2_lookup_reply },
3598
  { 5,  "READLINK", /* OK */
3599
  dissect_nfs2_readlink_call, dissect_nfs2_readlink_reply },
3600
  { 6,  "READ",   /* OK */
3601
  dissect_nfs2_read_call,   dissect_nfs2_read_reply },
3602
  { 7,  "WRITECACHE", /* OK */
3603
  dissect_rpc_void,   dissect_rpc_void },
3604
  { 8,  "WRITE",  /* OK */
3605
  dissect_nfs2_write_call,  dissect_nfs2_write_reply },
3606
  { 9,  "CREATE", /* OK */
3607
  dissect_nfs2_create_call, dissect_nfs2_create_reply },
3608
  { 10, "REMOVE", /* OK */
3609
  dissect_nfs2_remove_call, dissect_nfs2_remove_reply },
3610
  { 11, "RENAME", /* OK */
3611
  dissect_nfs2_rename_call, dissect_nfs2_rename_reply },
3612
  { 12, "LINK",   /* OK */
3613
  dissect_nfs2_link_call,   dissect_nfs2_link_reply },
3614
  { 13, "SYMLINK",  /* OK */
3615
  dissect_nfs2_symlink_call,  dissect_nfs2_symlink_reply },
3616
  { 14, "MKDIR",  /* OK */
3617
  dissect_nfs2_mkdir_call,  dissect_nfs2_mkdir_reply },
3618
  { 15, "RMDIR",  /* OK */
3619
  dissect_nfs2_rmdir_call,  dissect_nfs2_rmdir_reply },
3620
  { 16, "READDIR",  /* OK */
3621
  dissect_nfs2_readdir_call,  dissect_nfs2_readdir_reply },
3622
  { 17, "STATFS", /* OK */
3623
  dissect_nfs2_statfs_call, dissect_nfs2_statfs_reply },
3624
  { 0,  NULL, NULL, NULL }
3625
};
3626
3627
static const value_string nfs2_proc_vals[] = {
3628
  { 0,  "NULL" },
3629
  { 1,  "GETATTR" },
3630
  { 2,  "SETATTR" },
3631
  { 3,  "ROOT" },
3632
  { 4,  "LOOKUP" },
3633
  { 5,  "READLINK" },
3634
  { 6,  "READ" },
3635
  { 7,  "WRITECACHE" },
3636
  { 8,  "WRITE" },
3637
  { 9,  "CREATE" },
3638
  { 10, "REMOVE" },
3639
  { 11, "RENAME" },
3640
  { 12, "LINK" },
3641
  { 13, "SYMLINK" },
3642
  { 14, "MKDIR" },
3643
  { 15, "RMDIR" },
3644
  { 16, "READDIR" },
3645
  { 17, "STATFS" },
3646
  { 0,  NULL }
3647
};
3648
static value_string_ext nfs2_proc_vals_ext = VALUE_STRING_EXT_INIT(nfs2_proc_vals);
3649
3650
/* end of NFS Version 2 */
3651
3652
3653
/***************************/
3654
/* NFS Version 3, RFC 1813 */
3655
/***************************/
3656
3657
/* NFSv3 RFC 1813, Page 15 */
3658
static unsigned
3659
dissect_nfs3_filename(tvbuff_t *tvb, packet_info* pinfo, unsigned offset, proto_tree *tree, int hf, const char **string_ret)
3660
0
{
3661
0
  offset = dissect_rpc_string(tvb, pinfo, tree, hf, offset, string_ret);
3662
0
  return offset;
3663
0
}
3664
3665
3666
/* NFSv3 RFC 1813, Page 15 */
3667
static unsigned
3668
dissect_nfs3_path(tvbuff_t *tvb, packet_info* pinfo, unsigned offset, proto_tree *tree, int hf, const char **name)
3669
0
{
3670
0
  offset = dissect_rpc_string(tvb, pinfo, tree, hf, offset, name);
3671
0
  return offset;
3672
0
}
3673
3674
3675
/* NFSv3 RFC 1813, Page 15 */
3676
static unsigned
3677
dissect_nfs3_cookie_verf(tvbuff_t *tvb, unsigned offset, proto_tree *tree)
3678
0
{
3679
0
  proto_tree_add_bytes_format_value(tree, hf_nfs3_verifier, tvb, offset, NFS3_COOKIEVERFSIZE, NULL, "Opaque Data");
3680
0
  offset += NFS3_COOKIEVERFSIZE;
3681
0
  return offset;
3682
0
}
3683
3684
3685
/* NFSv3 RFC 1813, Page 16 */
3686
static unsigned
3687
dissect_nfs3_create_verf(tvbuff_t *tvb, unsigned offset, proto_tree *tree)
3688
0
{
3689
0
  proto_tree_add_bytes_format_value(tree, hf_nfs3_verifier, tvb, offset, NFS3_CREATEVERFSIZE, NULL, "Opaque Data");
3690
0
  offset += NFS3_CREATEVERFSIZE;
3691
0
  return offset;
3692
0
}
3693
3694
3695
/* NFSv3 RFC 1813, Page 16 */
3696
static unsigned
3697
dissect_nfs3_write_verf(tvbuff_t *tvb, unsigned offset, proto_tree *tree)
3698
0
{
3699
0
  proto_tree_add_bytes_format_value(tree, hf_nfs3_verifier, tvb, offset, NFS3_WRITEVERFSIZE, NULL, "Opaque Data");
3700
0
  offset += NFS3_WRITEVERFSIZE;
3701
0
  return offset;
3702
0
}
3703
3704
3705
/* RFC 1813, Page 16 */
3706
static unsigned
3707
dissect_nfs3_mode(tvbuff_t *tvb, unsigned offset, proto_tree *tree, uint32_t *mode)
3708
0
{
3709
0
  static int * const mode_bits[] = {
3710
0
    &hf_nfs3_mode_suid,
3711
0
    &hf_nfs3_mode_sgid,
3712
0
    &hf_nfs3_mode_sticky,
3713
0
    &hf_nfs3_mode_rusr,
3714
0
    &hf_nfs3_mode_wusr,
3715
0
    &hf_nfs3_mode_xusr,
3716
0
    &hf_nfs3_mode_rgrp,
3717
0
    &hf_nfs3_mode_wgrp,
3718
0
    &hf_nfs3_mode_xgrp,
3719
0
    &hf_nfs3_mode_roth,
3720
0
    &hf_nfs3_mode_woth,
3721
0
    &hf_nfs3_mode_xoth,
3722
0
    NULL
3723
0
  };
3724
3725
3726
0
  if (mode) {
3727
0
    *mode = tvb_get_ntohl(tvb, offset+0);
3728
0
  }
3729
3730
0
  proto_tree_add_bitmask(tree, tvb, offset, hf_nfs3_mode, ett_nfs3_mode, mode_bits, ENC_BIG_ENDIAN);
3731
3732
0
  offset += 4;
3733
0
  return offset;
3734
0
}
3735
3736
3737
/* NFSv3 RFC 1813, Page 16,17 */
3738
static const value_string names_nfs_nfsstat3[] =
3739
{
3740
  { 0,  "NFS3_OK" },
3741
  { 1,  "NFS3ERR_PERM" },
3742
  { 2,  "NFS3ERR_NOENT" },
3743
  { 5,  "NFS3ERR_IO" },
3744
  { 6,  "NFS3ERR_NXIO" },
3745
  { 13, "NFS3ERR_ACCES" },
3746
  { 17, "NFS3ERR_EXIST" },
3747
  { 18, "NFS3ERR_XDEV" },
3748
  { 19, "NFS3ERR_NODEV" },
3749
  { 20, "NFS3ERR_NOTDIR" },
3750
  { 21, "NFS3ERR_ISDIR" },
3751
  { 22, "NFS3ERR_INVAL" },
3752
  { 27, "NFS3ERR_FBIG" },
3753
  { 28, "NFS3ERR_NOSPC" },
3754
  { 30, "NFS3ERR_ROFS" },
3755
  { 31, "NFS3ERR_MLINK" },
3756
  { 63, "NFS3ERR_NAMETOOLONG" },
3757
  { 66, "NFS3ERR_NOTEMPTY" },
3758
  { 69, "NFS3ERR_DQUOT" },
3759
  { 70, "NFS3ERR_STALE" },
3760
  { 71, "NFS3ERR_REMOTE" },
3761
  { 10001,  "NFS3ERR_BADHANDLE" },
3762
  { 10002,  "NFS3ERR_NOT_SYNC" },
3763
  { 10003,  "NFS3ERR_BAD_COOKIE" },
3764
  { 10004,  "NFS3ERR_NOTSUPP" },
3765
  { 10005,  "NFS3ERR_TOOSMALL" },
3766
  { 10006,  "NFS3ERR_SERVERFAULT" },
3767
  { 10007,  "NFS3ERR_BADTYPE" },
3768
  { 10008,  "NFS3ERR_JUKEBOX" },
3769
  { 0,  NULL }
3770
};
3771
static value_string_ext names_nfs3_status_ext = VALUE_STRING_EXT_INIT(names_nfs_nfsstat3);
3772
3773
/* NFSv3 RFC 1813, Page 16 */
3774
static unsigned
3775
dissect_nfs3_status(tvbuff_t *tvb, unsigned offset, proto_tree *tree, uint32_t *status)
3776
0
{
3777
0
  uint32_t      nfsstat3;
3778
3779
0
  nfsstat3 = tvb_get_ntohl(tvb, offset+0);
3780
3781
0
  if (tree) {
3782
0
    proto_item *stat_item;
3783
0
    proto_tree_add_uint(tree, hf_nfs3_status, tvb, offset+0, 4, nfsstat3);
3784
0
    stat_item = proto_tree_add_uint(tree, hf_nfs_status, tvb, offset+0, 4, nfsstat3);
3785
0
    proto_item_set_hidden(stat_item);
3786
0
  }
3787
3788
0
  offset += 4;
3789
0
  *status = nfsstat3;
3790
0
  return offset;
3791
0
}
3792
3793
3794
static const value_string names_nfs_ftype3[] =
3795
{
3796
  { NF3REG,  "Regular File" },
3797
  { NF3DIR,  "Directory" },
3798
  { NF3BLK,  "Block Special Device" },
3799
  { NF3CHR,  "Character Special Device" },
3800
  { NF3LNK,  "Symbolic Link" },
3801
  { NF3SOCK, "Socket" },
3802
  { NF3FIFO, "Named Pipe" },
3803
  { 0,  NULL }
3804
};
3805
static value_string_ext names_nfs_ftype3_ext = VALUE_STRING_EXT_INIT(names_nfs_ftype3);
3806
3807
/* NFSv3 RFC 1813, Page 20 */
3808
static unsigned
3809
dissect_ftype3(tvbuff_t *tvb, unsigned offset, proto_tree *tree, int hf,
3810
         uint32_t* ftype3)
3811
0
{
3812
0
  uint32_t type;
3813
3814
0
  proto_tree_add_item_ret_uint(tree, hf, tvb, offset, 4, ENC_BIG_ENDIAN, &type);
3815
3816
0
  offset += 4;
3817
0
  *ftype3 = type;
3818
0
  return offset;
3819
0
}
3820
3821
3822
/* NFSv3 RFC 1813, Page 20 */
3823
static unsigned
3824
dissect_nfs3_specdata(tvbuff_t *tvb, unsigned offset, proto_tree *tree, const char *name)
3825
0
{
3826
0
  uint32_t      specdata1;
3827
0
  uint32_t      specdata2;
3828
3829
0
  specdata1 = tvb_get_ntohl(tvb, offset+0);
3830
0
  specdata2 = tvb_get_ntohl(tvb, offset+4);
3831
3832
0
  if (tree) {
3833
0
    proto_tree *specdata3_tree;
3834
3835
0
    specdata3_tree = proto_tree_add_subtree_format(tree, tvb, offset, 8,
3836
0
      ett_nfs3_specdata, NULL, "%s: %u,%u", name, specdata1, specdata2);
3837
3838
0
    proto_tree_add_uint(specdata3_tree, hf_nfs3_specdata1, tvb, offset+0, 4, specdata1);
3839
0
    proto_tree_add_uint(specdata3_tree, hf_nfs3_specdata2, tvb, offset+4, 4, specdata2);
3840
0
  }
3841
3842
0
  offset += 8;
3843
0
  return offset;
3844
0
}
3845
3846
3847
/* NFSv3 RFC 1813, Page 21 */
3848
unsigned
3849
dissect_nfs3_fh(tvbuff_t *tvb, unsigned offset, packet_info *pinfo, proto_tree *tree,
3850
    const char *name, uint32_t *hash, rpc_call_info_value *civ)
3851
0
{
3852
0
  unsigned      fh3_len;
3853
0
  unsigned      fh3_len_full;
3854
  /*unsigned    fh3_fill;*/
3855
0
  proto_tree *ftree;
3856
0
  int     fh_offset, fh_length;
3857
3858
0
  fh3_len = tvb_get_ntohl(tvb, offset+0);
3859
0
  fh3_len_full = rpc_roundup(fh3_len);
3860
  /*fh3_fill = fh3_len_full - fh3_len;*/
3861
3862
0
  ftree = proto_tree_add_subtree(tree, tvb, offset, 4+fh3_len_full,
3863
0
      ett_nfs3_fh, NULL, name);
3864
3865
  /* are we snooping fh to filenames ?*/
3866
0
  if ((!pinfo->fd->visited) && nfs_file_name_snooping) {
3867
    /* NFS v3 LOOKUP, CREATE, MKDIR, SYMLINK, MKNOD
3868
      calls might give us a mapping*/
3869
0
    if ( ((civ->prog == 100003)
3870
0
      &&((civ->vers == 3)
3871
0
      &&(!civ->request)
3872
0
      &&((civ->proc == 3)||(civ->proc == 8)||(civ->proc == 9)||(civ->proc == 10)||(civ->proc == 11))))
3873
0
    ) {
3874
0
      fh_length = tvb_get_ntohl(tvb, offset);
3875
0
      fh_offset = offset+4;
3876
0
      nfs_name_snoop_add_fh(civ->xid, tvb, fh_offset,
3877
0
                fh_length);
3878
0
    }
3879
3880
    /* NFS v3 READDIRPLUS calls might give us a mapping */
3881
0
    if ( (civ->prog == 100003)
3882
0
      &&(civ->vers == 3)
3883
0
      &&(civ->request)
3884
0
      &&((civ->proc == 17))
3885
0
    ) {
3886
0
      fh_length = tvb_get_ntohl(tvb, offset);
3887
0
      fh_offset = offset+4;
3888
0
      nfs_name_snoop_readdir_add_parent_fh(civ->xid, tvb, fh_offset, fh_length);
3889
0
    }
3890
3891
    /* MOUNT v3 MNT replies might give us a filehandle */
3892
0
    if ( (civ->prog == 100005)
3893
0
      &&(civ->vers == 3)
3894
0
      &&(!civ->request)
3895
0
      &&(civ->proc == 1)
3896
0
    ) {
3897
0
      fh_length = tvb_get_ntohl(tvb, offset);
3898
0
      fh_offset = offset+4;
3899
0
      nfs_name_snoop_add_fh(civ->xid, tvb, fh_offset,
3900
0
                fh_length);
3901
0
    }
3902
0
  }
3903
3904
0
  proto_tree_add_uint(ftree, hf_nfs_fh_length, tvb, offset+0, 4,
3905
0
      fh3_len);
3906
3907
  /* Handle WebNFS requests where filehandle may be 0 length */
3908
0
  if (fh3_len > 0)
3909
0
  {
3910
0
    dissect_fhandle_data(tvb, offset+4, pinfo, ftree, fh3_len, false, hash);
3911
3912
0
    offset += fh3_len_full;
3913
0
  }
3914
0
  else if (hash) {
3915
    /* Make sure hash is set regardless, as our caller expects it
3916
     * to be initialized */
3917
0
    *hash = 0;
3918
0
  }
3919
3920
0
  offset += 4;
3921
3922
0
  return offset;
3923
0
}
3924
3925
3926
/* NFSv3 RFC 1813, Page 21 */
3927
static unsigned
3928
dissect_nfstime3(tvbuff_t *tvb, unsigned offset, proto_tree *tree, int hf_time,
3929
     int hf_time_sec, int hf_time_nsec)
3930
0
{
3931
0
  uint32_t   seconds;
3932
0
  uint32_t   nseconds;
3933
0
  nstime_t ts;
3934
3935
0
  seconds = tvb_get_ntohl(tvb, offset+0);
3936
0
  nseconds = tvb_get_ntohl(tvb, offset+4);
3937
0
  ts.secs = seconds;
3938
0
  ts.nsecs = nseconds;
3939
3940
0
  if (tree) {
3941
0
    proto_item *time_item;
3942
0
    proto_tree *time_tree;
3943
3944
0
    time_item = proto_tree_add_time(tree, hf_time, tvb, offset, 8,
3945
0
        &ts);
3946
3947
0
    time_tree = proto_item_add_subtree(time_item, ett_nfs3_nfstime);
3948
3949
0
    proto_tree_add_uint(time_tree, hf_time_sec, tvb, offset, 4,
3950
0
          seconds);
3951
0
    proto_tree_add_uint(time_tree, hf_time_nsec, tvb, offset+4, 4,
3952
0
          nseconds);
3953
0
  }
3954
0
  offset += 8;
3955
0
  return offset;
3956
0
}
3957
3958
3959
/* NFSv3 RFC 1813, Page 22
3960
 * The levels parameter tells this helper how many levels up in the tree it
3961
 * should display useful info such as type,mode,uid,gid
3962
 * If level has the COL_INFO_LEVEL flag set it will also display
3963
 * this info in the info column.
3964
 */
3965
static unsigned
3966
dissect_nfs_fattr3(packet_info *pinfo, tvbuff_t *tvb, unsigned offset,
3967
       proto_tree *tree, const char *name, uint32_t levels)
3968
0
{
3969
0
  proto_item *fattr3_item = NULL;
3970
0
  proto_tree *fattr3_tree = NULL;
3971
0
  unsigned    old_offset  = offset;
3972
0
  uint32_t      type, mode, uid, gid;
3973
3974
0
  fattr3_tree = proto_tree_add_subtree(tree, tvb, offset, -1,
3975
0
      ett_nfs3_fattr, &fattr3_item, name);
3976
3977
  /* ftype */
3978
0
  offset = dissect_ftype3(tvb, offset, fattr3_tree, hf_nfs3_fattr_type, &type);
3979
3980
  /* mode */
3981
0
  offset = dissect_nfs3_mode(tvb, offset, fattr3_tree, &mode);
3982
3983
  /* nlink */
3984
0
  offset = dissect_rpc_uint32(tvb, fattr3_tree, hf_nfs3_fattr_nlink,
3985
0
    offset);
3986
3987
  /* uid */
3988
0
  uid = tvb_get_ntohl(tvb, offset);
3989
0
  offset = dissect_rpc_uint32(tvb, fattr3_tree, hf_nfs3_fattr_uid,
3990
0
    offset);
3991
3992
  /* gid */
3993
0
  gid = tvb_get_ntohl(tvb, offset);
3994
0
  offset = dissect_rpc_uint32(tvb, fattr3_tree, hf_nfs3_fattr_gid,
3995
0
    offset);
3996
3997
  /* size*/
3998
0
  offset = dissect_rpc_uint64(tvb, fattr3_tree, hf_nfs3_fattr_size,
3999
0
    offset);
4000
4001
  /* used */
4002
0
  offset = dissect_rpc_uint64(tvb, fattr3_tree, hf_nfs3_fattr_used,
4003
0
    offset);
4004
4005
  /* rdev */
4006
0
  offset = dissect_nfs3_specdata(tvb, offset, fattr3_tree, "rdev");
4007
4008
  /* fsid */
4009
0
  offset = dissect_rpc_uint64(tvb, fattr3_tree, hf_nfs3_fattr_fsid,
4010
0
    offset);
4011
4012
  /* fileid */
4013
0
  offset = dissect_rpc_uint64(tvb, fattr3_tree, hf_nfs3_fattr_fileid,
4014
0
    offset);
4015
4016
  /* atime */
4017
0
  offset = dissect_nfstime3 (tvb, offset, fattr3_tree, hf_nfs_atime, hf_nfs_atime_sec, hf_nfs_atime_nsec);
4018
4019
  /* mtime */
4020
0
  offset = dissect_nfstime3 (tvb, offset, fattr3_tree, hf_nfs_mtime, hf_nfs_mtime_sec, hf_nfs_mtime_nsec);
4021
4022
  /* ctime */
4023
0
  offset = dissect_nfstime3 (tvb, offset, fattr3_tree, hf_nfs_ctime, hf_nfs_ctime_sec, hf_nfs_ctime_nsec);
4024
4025
  /* now we know, that fattr3 is shorter */
4026
0
  proto_item_set_len(fattr3_item, offset - old_offset);
4027
4028
  /* put some nice info in COL_INFO for GETATTR replies */
4029
0
  if (levels & COL_INFO_LEVEL) {
4030
0
    levels &= (~COL_INFO_LEVEL);
4031
0
    col_append_fstr(pinfo->cinfo, COL_INFO,
4032
0
        "  %s mode: %04o uid: %u gid: %u",
4033
0
        val_to_str_ext(pinfo->pool, type, &names_nfs_ftype3_ext, "Unknown Type: 0x%x"),
4034
0
        mode&0x0fff, uid, gid);
4035
0
  }
4036
  /* populate the expansion lines with some nice useable info */
4037
0
  while ( fattr3_tree && levels-- ) {
4038
0
    proto_item_append_text(fattr3_tree, "  %s mode: %04o uid: %u gid: %u",
4039
0
        val_to_str_ext(pinfo->pool, type, &names_nfs_ftype3_ext, "Unknown Type: 0x%x"),
4040
0
        mode&0x0fff, uid, gid);
4041
0
    fattr3_tree = fattr3_tree->parent;
4042
0
  }
4043
4044
0
  return offset;
4045
0
}
4046
4047
4048
static const value_string value_follows[] =
4049
{
4050
  { 0, "no value" },
4051
  { 1, "value follows" },
4052
  { 0, NULL }
4053
};
4054
4055
4056
/* NFSv3 RFC 1813, Page 23 */
4057
unsigned
4058
dissect_nfs3_post_op_attr(tvbuff_t *tvb, unsigned offset, packet_info *pinfo, proto_tree *tree,
4059
       const char *name)
4060
0
{
4061
0
  proto_item *post_op_attr_item;
4062
0
  proto_tree *post_op_attr_tree;
4063
0
  unsigned    old_offset        = offset;
4064
0
  uint32_t      attributes_follow = 0;
4065
4066
0
  attributes_follow = tvb_get_ntohl(tvb, offset+0);
4067
4068
0
  post_op_attr_tree = proto_tree_add_subtree(tree, tvb, offset, -1,
4069
0
      ett_nfs3_post_op_attr, &post_op_attr_item, name);
4070
4071
0
  proto_tree_add_uint(post_op_attr_tree, hf_nfs3_attributes_follow, tvb, offset, 4, attributes_follow);
4072
4073
0
  offset += 4;
4074
0
  switch (attributes_follow) {
4075
0
    case true:
4076
0
      offset = dissect_nfs_fattr3(pinfo, tvb, offset,
4077
0
                post_op_attr_tree,
4078
0
                "attributes", 2);
4079
0
    break;
4080
0
    case false:
4081
      /* void */
4082
0
    break;
4083
0
  }
4084
4085
  /* now we know, that post_op_attr_tree is shorter */
4086
0
  proto_item_set_len(post_op_attr_item, offset - old_offset);
4087
4088
0
  return offset;
4089
0
}
4090
4091
4092
/* NFSv3 RFC 1813, Page 24 */
4093
static unsigned
4094
dissect_wcc_attr(tvbuff_t *tvb, unsigned offset, proto_tree *tree, const char *name)
4095
0
{
4096
0
  proto_item *wcc_attr_item;
4097
0
  proto_tree *wcc_attr_tree;
4098
0
  unsigned    old_offset    = offset;
4099
4100
0
  wcc_attr_tree = proto_tree_add_subtree(tree, tvb, offset, -1,
4101
0
      ett_nfs3_wcc_attr, &wcc_attr_item, name);
4102
4103
0
  offset = dissect_rpc_uint64(tvb, wcc_attr_tree, hf_nfs3_wcc_attr_size,
4104
0
    offset);
4105
0
  offset = dissect_nfstime3(tvb, offset, wcc_attr_tree, hf_nfs_mtime,
4106
0
    hf_nfs_mtime_sec, hf_nfs_mtime_nsec);
4107
0
  offset = dissect_nfstime3(tvb, offset, wcc_attr_tree, hf_nfs_ctime,
4108
0
    hf_nfs_ctime_sec, hf_nfs_ctime_nsec);
4109
  /* now we know, that wcc_attr_tree is shorter */
4110
0
  proto_item_set_len(wcc_attr_item, offset - old_offset);
4111
4112
0
  return offset;
4113
0
}
4114
4115
4116
/* NFSv3 RFC 1813, Page 24 */
4117
static unsigned
4118
dissect_pre_op_attr(tvbuff_t *tvb, unsigned offset, proto_tree *tree, const char *name)
4119
0
{
4120
0
  proto_item *pre_op_attr_item;
4121
0
  proto_tree *pre_op_attr_tree;
4122
0
  unsigned    old_offset       = offset;
4123
0
  uint32_t      attributes_follow;
4124
4125
0
  pre_op_attr_tree = proto_tree_add_subtree(tree, tvb, offset, -1,
4126
0
      ett_nfs3_pre_op_attr, &pre_op_attr_item, name);
4127
4128
0
  proto_tree_add_item_ret_uint(pre_op_attr_tree, hf_nfs3_attributes_follow, tvb, offset, 4, ENC_BIG_ENDIAN, &attributes_follow);
4129
0
  offset += 4;
4130
0
  switch (attributes_follow) {
4131
0
    case true:
4132
0
      offset = dissect_wcc_attr(tvb, offset, pre_op_attr_tree,
4133
0
          "attributes");
4134
0
    break;
4135
0
    case false:
4136
      /* void */
4137
0
    break;
4138
0
  }
4139
4140
  /* now we know, that pre_op_attr_tree is shorter */
4141
0
  proto_item_set_len(pre_op_attr_item, offset - old_offset);
4142
4143
0
  return offset;
4144
0
}
4145
4146
4147
/* NFSv3 RFC 1813, Page 24 */
4148
static unsigned
4149
dissect_wcc_data(tvbuff_t *tvb, unsigned offset, packet_info *pinfo, proto_tree *tree, const char *name)
4150
0
{
4151
0
  proto_item *wcc_data_item;
4152
0
  proto_tree *wcc_data_tree;
4153
0
  unsigned    old_offset    = offset;
4154
4155
0
  wcc_data_tree = proto_tree_add_subtree(tree, tvb, offset, -1,
4156
0
      ett_nfs3_wcc_data, &wcc_data_item, name);
4157
4158
0
  offset = dissect_pre_op_attr (tvb, offset, wcc_data_tree, "before");
4159
0
  offset = dissect_nfs3_post_op_attr(tvb, offset, pinfo, wcc_data_tree, "after" );
4160
4161
  /* now we know, that wcc_data is shorter */
4162
0
  proto_item_set_len(wcc_data_item, offset - old_offset);
4163
4164
0
  return offset;
4165
0
}
4166
4167
4168
/* NFSv3 RFC 1813, Page 25 */
4169
static unsigned
4170
dissect_nfs3_post_op_fh(tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
4171
        proto_tree *tree, const char *name, rpc_call_info_value *civ)
4172
0
{
4173
0
  proto_item *post_op_fh3_item;
4174
0
  proto_tree *post_op_fh3_tree;
4175
0
  unsigned    old_offset       = offset;
4176
0
  uint32_t      handle_follows;
4177
4178
0
  post_op_fh3_tree = proto_tree_add_subtree(tree, tvb, offset, -1,
4179
0
      ett_nfs3_post_op_fh, &post_op_fh3_item, name);
4180
4181
0
  proto_tree_add_item_ret_uint(post_op_fh3_tree, hf_nfs3_handle_follow, tvb, offset, 4, ENC_BIG_ENDIAN, &handle_follows);
4182
0
  offset += 4;
4183
0
  switch (handle_follows) {
4184
0
    case true:
4185
0
      offset = dissect_nfs3_fh(tvb, offset, pinfo, post_op_fh3_tree,
4186
0
          "handle", NULL, civ);
4187
0
    break;
4188
0
    case false:
4189
      /* void */
4190
0
    break;
4191
0
  }
4192
4193
  /* now we know, that post_op_fh3_tree is shorter */
4194
0
  if (post_op_fh3_item) {
4195
0
    proto_item_set_len(post_op_fh3_item, offset - old_offset);
4196
0
  }
4197
4198
0
  return offset;
4199
0
}
4200
4201
4202
/* NFSv3 RFC 1813, Page 25 */
4203
static unsigned
4204
dissect_set_mode3(tvbuff_t *tvb, unsigned offset, proto_tree *tree, const char *name)
4205
0
{
4206
0
  proto_item *set_mode3_item;
4207
0
  proto_tree *set_mode3_tree;
4208
0
  unsigned    old_offset     = offset;
4209
0
  uint32_t      set_it;
4210
0
  const char *set_it_name;
4211
4212
0
  set_it = tvb_get_ntohl(tvb, offset+0);
4213
4214
0
  set_it_name = val_to_str_const(set_it, value_follows, "Unknown");
4215
4216
0
  set_mode3_tree = proto_tree_add_subtree_format(tree, tvb, offset, -1,
4217
0
      ett_nfs3_set_mode, &set_mode3_item, "%s: %s", name, set_it_name);
4218
4219
0
  proto_tree_add_uint(set_mode3_tree, hf_nfs4_set_it_value_follows, tvb, offset, 4, set_it);
4220
4221
0
  offset += 4;
4222
4223
0
  switch (set_it) {
4224
0
    case 1:
4225
0
      offset = dissect_nfs3_mode(tvb, offset, set_mode3_tree, NULL);
4226
0
    break;
4227
0
    default:
4228
      /* void */
4229
0
    break;
4230
0
  }
4231
4232
  /* now we know, that set_mode3 is shorter */
4233
0
  proto_item_set_len(set_mode3_item, offset - old_offset);
4234
4235
0
  return offset;
4236
0
}
4237
4238
4239
/* NFSv3 RFC 1813, Page 26 */
4240
static unsigned
4241
dissect_set_uid3(tvbuff_t *tvb, unsigned offset, proto_tree *tree, const char *name)
4242
0
{
4243
0
  proto_item *set_uid3_item;
4244
0
  proto_tree *set_uid3_tree;
4245
0
  unsigned    old_offset    = offset;
4246
0
  uint32_t      set_it;
4247
0
  const char *set_it_name;
4248
4249
0
  set_it = tvb_get_ntohl(tvb, offset+0);
4250
0
  set_it_name = val_to_str_const(set_it, value_follows, "Unknown");
4251
4252
0
  set_uid3_tree = proto_tree_add_subtree_format(tree, tvb, offset, -1,
4253
0
      ett_nfs3_set_uid, &set_uid3_item, "%s: %s", name, set_it_name);
4254
4255
0
  proto_tree_add_uint(set_uid3_tree, hf_nfs4_set_it_value_follows, tvb, offset, 4, set_it);
4256
0
  offset += 4;
4257
4258
0
  switch (set_it) {
4259
0
    case 1:
4260
0
      offset = dissect_rpc_uint32(tvb, set_uid3_tree,
4261
0
                hf_nfs3_uid, offset);
4262
0
    break;
4263
0
    default:
4264
      /* void */
4265
0
    break;
4266
0
  }
4267
4268
  /* now we know, that set_uid3 is shorter */
4269
0
  proto_item_set_len(set_uid3_item, offset - old_offset);
4270
4271
0
  return offset;
4272
0
}
4273
4274
4275
/* NFSv3 RFC 1813, Page 26 */
4276
static unsigned
4277
dissect_set_gid3(tvbuff_t *tvb, unsigned offset, proto_tree *tree, const char *name)
4278
0
{
4279
0
  proto_item *set_gid3_item;
4280
0
  proto_tree *set_gid3_tree;
4281
0
  unsigned    old_offset    = offset;
4282
0
  uint32_t      set_it;
4283
0
  const char *set_it_name;
4284
4285
0
  set_it = tvb_get_ntohl(tvb, offset+0);
4286
4287
0
  set_it_name = val_to_str_const(set_it, value_follows, "Unknown");
4288
0
  set_gid3_tree = proto_tree_add_subtree_format(tree, tvb, offset, -1,
4289
0
      ett_nfs3_set_gid, &set_gid3_item, "%s: %s", name, set_it_name);
4290
4291
0
  proto_tree_add_uint(set_gid3_tree, hf_nfs4_set_it_value_follows, tvb, offset, 4, set_it);
4292
4293
0
  offset += 4;
4294
4295
0
  switch (set_it) {
4296
0
    case 1:
4297
0
      offset = dissect_rpc_uint32(tvb, set_gid3_tree,
4298
0
        hf_nfs3_gid, offset);
4299
0
    break;
4300
0
    default:
4301
      /* void */
4302
0
    break;
4303
0
  }
4304
4305
  /* now we know, that set_gid3 is shorter */
4306
0
  proto_item_set_len(set_gid3_item, offset - old_offset);
4307
4308
0
  return offset;
4309
0
}
4310
4311
4312
/* NFSv3 RFC 1813, Page 26 */
4313
static unsigned
4314
dissect_set_size3(tvbuff_t *tvb, unsigned offset, proto_tree *tree, const char *name)
4315
0
{
4316
0
  proto_item *set_size3_item;
4317
0
  proto_tree *set_size3_tree;
4318
0
  unsigned    old_offset     = offset;
4319
0
  uint32_t      set_it;
4320
0
  const char *set_it_name;
4321
4322
0
  set_it = tvb_get_ntohl(tvb, offset+0);
4323
4324
0
  set_it_name = val_to_str_const(set_it, value_follows, "Unknown");
4325
4326
0
  set_size3_tree = proto_tree_add_subtree_format(tree, tvb, offset, -1,
4327
0
      ett_nfs3_set_size, &set_size3_item, "%s: %s", name, set_it_name);
4328
0
  proto_tree_add_uint(set_size3_tree, hf_nfs4_set_it_value_follows, tvb, offset, 4, set_it);
4329
4330
0
  offset += 4;
4331
4332
0
  switch (set_it) {
4333
0
    case 1:
4334
0
      offset = dissect_rpc_uint64(tvb, set_size3_tree,
4335
0
        hf_nfs3_set_size, offset);
4336
0
    break;
4337
0
    default:
4338
      /* void */
4339
0
    break;
4340
0
  }
4341
4342
  /* now we know, that set_size3 is shorter */
4343
0
  proto_item_set_len(set_size3_item, offset - old_offset);
4344
4345
0
  return offset;
4346
0
}
4347
4348
4349
/* NFSv3 RFC 1813, Page 25 */
4350
#define DONT_CHANGE 0
4351
#define SET_TO_SERVER_TIME 1
4352
0
#define SET_TO_CLIENT_TIME 2
4353
4354
static const value_string time_how[] =
4355
{
4356
  { DONT_CHANGE,    "don't change" },
4357
  { SET_TO_SERVER_TIME, "set to server time" },
4358
  { SET_TO_CLIENT_TIME, "set to client time" },
4359
  { 0, NULL }
4360
};
4361
4362
4363
/* NFSv3 RFC 1813, Page 26 */
4364
static unsigned
4365
dissect_set_atime(tvbuff_t *tvb, unsigned offset, proto_tree *tree, const char *name)
4366
0
{
4367
0
  proto_item *set_atime_item;
4368
0
  proto_tree *set_atime_tree;
4369
0
  unsigned    old_offset     = offset;
4370
0
  uint32_t      set_it;
4371
0
  const char *set_it_name;
4372
4373
0
  set_it = tvb_get_ntohl(tvb, offset+0);
4374
4375
0
  set_it_name = val_to_str_const(set_it, time_how, "Unknown");
4376
4377
0
  set_atime_tree = proto_tree_add_subtree_format(tree, tvb, offset, -1,
4378
0
      ett_nfs3_set_atime, &set_atime_item, "%s: %s", name, set_it_name);
4379
4380
0
  proto_tree_add_uint(set_atime_tree, hf_nfs4_time_how, tvb, offset, 4, set_it);
4381
0
  offset += 4;
4382
4383
0
  switch (set_it) {
4384
0
    case SET_TO_CLIENT_TIME:
4385
0
      offset = dissect_nfstime3(tvb, offset, set_atime_tree,
4386
0
          hf_nfs_atime, hf_nfs_atime_sec, hf_nfs_atime_nsec);
4387
0
    break;
4388
0
    default:
4389
      /* void */
4390
0
    break;
4391
0
  }
4392
4393
  /* now we know, that set_atime is shorter */
4394
0
  proto_item_set_len(set_atime_item, offset - old_offset);
4395
4396
0
  return offset;
4397
0
}
4398
4399
4400
/* NFSv3 RFC 1813, Page 26 */
4401
static unsigned
4402
dissect_set_mtime(tvbuff_t *tvb, unsigned offset, proto_tree *tree, const char *name)
4403
0
{
4404
0
  proto_item *set_mtime_item;
4405
0
  proto_tree *set_mtime_tree;
4406
0
  unsigned    old_offset     = offset;
4407
0
  uint32_t      set_it;
4408
0
  const char *set_it_name;
4409
4410
0
  set_it = tvb_get_ntohl(tvb, offset+0);
4411
4412
0
  set_it_name = val_to_str_const(set_it, time_how, "Unknown");
4413
4414
0
  set_mtime_tree = proto_tree_add_subtree_format(tree, tvb, offset, -1,
4415
0
      ett_nfs3_set_mtime, &set_mtime_item, "%s: %s", name, set_it_name);
4416
0
  proto_tree_add_uint(set_mtime_tree, hf_nfs4_time_how, tvb, offset, 4, set_it);
4417
4418
0
  offset += 4;
4419
4420
0
  switch (set_it) {
4421
0
    case SET_TO_CLIENT_TIME:
4422
0
      offset = dissect_nfstime3(tvb, offset, set_mtime_tree,
4423
0
          hf_nfs_atime, hf_nfs_atime_sec, hf_nfs_atime_nsec);
4424
0
    break;
4425
0
    default:
4426
      /* void */
4427
0
    break;
4428
0
  }
4429
4430
  /* now we know, that set_mtime is shorter */
4431
0
  proto_item_set_len(set_mtime_item, offset - old_offset);
4432
4433
0
  return offset;
4434
0
}
4435
4436
4437
/* NFSv3 RFC 1813, Page 25..27 */
4438
static unsigned
4439
dissect_nfs3_sattr(tvbuff_t *tvb, unsigned offset, proto_tree *tree, const char *name)
4440
0
{
4441
0
  proto_item *sattr3_item;
4442
0
  proto_tree *sattr3_tree;
4443
0
  unsigned    old_offset  = offset;
4444
4445
0
  sattr3_tree = proto_tree_add_subtree(tree, tvb, offset, -1,
4446
0
      ett_nfs3_sattr, &sattr3_item, name);
4447
4448
0
  offset = dissect_set_mode3(tvb, offset, sattr3_tree, "mode");
4449
0
  offset = dissect_set_uid3 (tvb, offset, sattr3_tree, "uid");
4450
0
  offset = dissect_set_gid3 (tvb, offset, sattr3_tree, "gid");
4451
0
  offset = dissect_set_size3(tvb, offset, sattr3_tree, "size");
4452
0
  offset = dissect_set_atime(tvb, offset, sattr3_tree, "atime");
4453
0
  offset = dissect_set_mtime(tvb, offset, sattr3_tree, "mtime");
4454
4455
  /* now we know, that sattr3 is shorter */
4456
0
  proto_item_set_len(sattr3_item, offset - old_offset);
4457
4458
0
  return offset;
4459
0
}
4460
4461
4462
/* NFSv3 RFC 1813, Page 27 */
4463
static unsigned
4464
dissect_diropargs3(tvbuff_t *tvb, unsigned offset, packet_info *pinfo, proto_tree *tree,
4465
           const char *label, uint32_t *hash, const char **name, rpc_call_info_value *civ)
4466
0
{
4467
0
  proto_item *diropargs3_item;
4468
0
  proto_tree *diropargs3_tree;
4469
0
  unsigned    old_offset      = offset;
4470
0
  int     parent_offset, parent_len;
4471
0
  int     name_offset, name_len;
4472
4473
0
  diropargs3_tree = proto_tree_add_subtree(tree, tvb, offset, -1,
4474
0
      ett_nfs3_diropargs, &diropargs3_item, label);
4475
4476
0
  parent_offset = offset+4;
4477
0
  parent_len = tvb_get_ntohl(tvb, offset);
4478
0
  offset = dissect_nfs3_fh(tvb, offset, pinfo, diropargs3_tree, "dir", hash, civ);
4479
0
  name_offset = offset+4;
4480
0
  name_len = tvb_get_ntohl(tvb, offset);
4481
0
  offset = dissect_nfs3_filename(tvb, pinfo, offset, diropargs3_tree,
4482
0
    hf_nfs_name, name);
4483
4484
  /* are we snooping fh to filenames ?*/
4485
0
  if ((!pinfo->fd->visited) && nfs_file_name_snooping) {
4486
    /* v3 LOOKUP, CREATE, MKDIR, SYMLINK, MKNOD calls might give us a mapping*/
4487
0
    if ( (civ->prog == 100003)
4488
0
      &&(civ->vers == 3)
4489
0
      &&(civ->request)
4490
0
      &&((civ->proc == 3)||(civ->proc == 8)||(civ->proc == 9)||(civ->proc == 10)||(civ->proc == 11))
4491
0
    ) {
4492
0
      nfs_name_snoop_add_name(civ->xid, tvb,
4493
0
        name_offset, name_len,
4494
0
        parent_offset, parent_len, NULL);
4495
0
    }
4496
0
  }
4497
4498
4499
  /* now we know, that diropargs3 is shorter */
4500
0
  proto_item_set_len(diropargs3_item, offset - old_offset);
4501
4502
0
  return offset;
4503
0
}
4504
4505
4506
static int
4507
dissect_nfs3_remove_call(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
4508
0
{
4509
0
  uint32_t      hash = 0;
4510
0
  const char *name = NULL;
4511
0
  unsigned offset = 0;
4512
4513
0
  offset = dissect_diropargs3(tvb, offset, pinfo, tree, "object", &hash, &name, (rpc_call_info_value*)data);
4514
4515
0
  col_append_fstr(pinfo->cinfo, COL_INFO, ", DH: 0x%08x/%s", hash, name);
4516
0
  proto_item_append_text(tree, ", REMOVE Call DH: 0x%08x/%s", hash, name);
4517
4518
0
  return offset;
4519
0
}
4520
4521
4522
static int
4523
dissect_nfs3_null_call(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree, void *data _U_)
4524
0
{
4525
0
  proto_item_append_text(tree, ", NULL Call");
4526
4527
0
  return 0;
4528
0
}
4529
4530
4531
static int
4532
dissect_nfs3_null_reply(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree, void *data _U_)
4533
0
{
4534
0
  proto_item_append_text(tree, ", NULL Reply");
4535
4536
0
  return 0;
4537
0
}
4538
4539
4540
static int
4541
dissect_nfs3_rmdir_call(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
4542
0
{
4543
0
  uint32_t      hash = 0;
4544
0
  const char *name = NULL;
4545
0
  unsigned offset = 0;
4546
4547
0
  offset = dissect_diropargs3(tvb, offset, pinfo, tree, "object", &hash, &name, (rpc_call_info_value*)data);
4548
4549
0
  col_append_fstr(pinfo->cinfo, COL_INFO, ", DH: 0x%08x/%s", hash, name);
4550
0
  proto_item_append_text(tree, ", RMDIR Call DH: 0x%08x/%s", hash, name);
4551
4552
0
  return offset;
4553
0
}
4554
4555
4556
/* NFSv3 RFC 1813, Page 32,33 */
4557
static int
4558
dissect_nfs3_getattr_call(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
4559
0
{
4560
0
  uint32_t hash = 0;
4561
0
  unsigned offset = 0;
4562
4563
0
  offset = dissect_nfs3_fh(tvb, offset, pinfo, tree, "object", &hash, (rpc_call_info_value*)data);
4564
4565
0
  col_append_fstr(pinfo->cinfo, COL_INFO, ", FH: 0x%08x", hash);
4566
0
  proto_item_append_text(tree, ", GETATTR Call FH: 0x%08x", hash);
4567
4568
0
  return offset;
4569
0
}
4570
4571
4572
/* NFSv3 RFC 1813, Page 32,33 */
4573
static int
4574
dissect_nfs3_getattr_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
4575
0
{
4576
0
  uint32_t      status;
4577
0
  const char *err;
4578
0
  unsigned offset = 0;
4579
4580
0
  proto_item_append_text(tree, ", GETATTR Reply");
4581
4582
0
  offset = dissect_nfs3_status(tvb, offset, tree, &status);
4583
0
  switch (status) {
4584
0
    case 0:
4585
0
      offset = dissect_nfs_fattr3(pinfo, tvb, offset, tree, "obj_attributes", 2|COL_INFO_LEVEL);
4586
0
    break;
4587
0
    default:
4588
0
      err = val_to_str_ext(pinfo->pool, status, &names_nfs3_status_ext, "Unknown error: %u");
4589
0
      col_append_fstr(pinfo->cinfo, COL_INFO, " Error: %s", err);
4590
0
      proto_item_append_text(tree, "  Error: %s", err);
4591
0
    break;
4592
0
  }
4593
4594
0
  return offset;
4595
0
}
4596
4597
4598
/* NFSv3 RFC 1813, Page 33 */
4599
static unsigned
4600
dissect_sattrguard3(tvbuff_t *tvb, unsigned offset, proto_tree *tree, const char *name)
4601
0
{
4602
0
  proto_item *sattrguard3_item;
4603
0
  proto_tree *sattrguard3_tree;
4604
0
  unsigned    old_offset       = offset;
4605
0
  uint32_t      check;
4606
0
  const char *check_name;
4607
4608
0
  check = tvb_get_ntohl(tvb, offset+0);
4609
4610
0
  check_name = val_to_str_const(check, value_follows, "Unknown");
4611
4612
0
  sattrguard3_tree = proto_tree_add_subtree_format(tree, tvb, offset, -1,
4613
0
      ett_nfs3_sattrguard, &sattrguard3_item, "%s: %s", name, check_name);
4614
4615
0
  proto_tree_add_uint(sattrguard3_tree, hf_nfs3_sattrguard3, tvb, offset, 4, check);
4616
4617
4618
0
  offset += 4;
4619
4620
0
  switch (check) {
4621
0
    case true:
4622
0
      offset = dissect_nfstime3(tvb, offset, sattrguard3_tree,
4623
0
          hf_nfs_ctime, hf_nfs_ctime_sec, hf_nfs_ctime_nsec);
4624
0
    break;
4625
0
    case false:
4626
      /* void */
4627
0
    break;
4628
0
  }
4629
4630
  /* now we know, that sattrguard3 is shorter */
4631
0
  proto_item_set_len(sattrguard3_item, offset - old_offset);
4632
4633
0
  return offset;
4634
0
}
4635
4636
4637
/* NFSv3 RFC 1813, Page 33..36 */
4638
static int
4639
dissect_nfs3_setattr_call(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
4640
0
{
4641
0
  uint32_t hash = 0;
4642
0
  unsigned offset = 0;
4643
4644
0
  offset = dissect_nfs3_fh    (tvb, offset, pinfo, tree, "object", &hash, (rpc_call_info_value*)data);
4645
0
  offset = dissect_nfs3_sattr     (tvb, offset,        tree, "new_attributes");
4646
0
  offset = dissect_sattrguard3(tvb, offset,        tree, "guard");
4647
4648
0
  col_append_fstr(pinfo->cinfo, COL_INFO, ", FH: 0x%08x", hash);
4649
0
  proto_item_append_text(tree, ", SETATTR Call FH: 0x%08x", hash);
4650
4651
0
  return offset;
4652
0
}
4653
4654
4655
/* NFSv3 RFC 1813, Page 33..36 */
4656
static int
4657
dissect_nfs3_setattr_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
4658
0
{
4659
0
  uint32_t      status;
4660
0
  const char *err;
4661
0
  unsigned offset = 0;
4662
4663
0
  offset = dissect_nfs3_status(tvb, offset, tree, &status);
4664
0
  switch (status) {
4665
0
    case 0:
4666
0
      offset = dissect_wcc_data(tvb, offset, pinfo, tree, "obj_wcc");
4667
0
      proto_item_append_text(tree, ", SETATTR Reply");
4668
0
    break;
4669
0
    default:
4670
0
      offset = dissect_wcc_data(tvb, offset, pinfo, tree, "obj_wcc");
4671
4672
0
      err = val_to_str_ext(pinfo->pool, status, &names_nfs3_status_ext, "Unknown error: %u");
4673
0
      col_append_fstr(pinfo->cinfo, COL_INFO, " Error: %s", err);
4674
0
      proto_item_append_text(tree, ", SETATTR Reply  Error: %s", err);
4675
0
    break;
4676
0
  }
4677
4678
0
  return offset;
4679
0
}
4680
4681
4682
/* NFSv3 RFC 1813, Page 37..39 */
4683
static int
4684
dissect_nfs3_lookup_call(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
4685
0
{
4686
0
  uint32_t      hash = 0;
4687
0
  const char *name = NULL;
4688
0
  unsigned offset = 0;
4689
4690
0
  offset = dissect_diropargs3 (tvb, offset, pinfo, tree, "what", &hash, &name, (rpc_call_info_value*)data);
4691
4692
0
  col_append_fstr(pinfo->cinfo, COL_INFO, ", DH: 0x%08x/%s", hash, name);
4693
0
  proto_item_append_text(tree, ", LOOKUP Call DH: 0x%08x/%s", hash, name);
4694
4695
0
  return offset;
4696
0
}
4697
4698
4699
/* NFSv3 RFC 1813, Page 37..39 */
4700
static int
4701
dissect_nfs3_lookup_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
4702
0
{
4703
0
  uint32_t      status;
4704
0
  const char *err;
4705
0
  uint32_t      hash = 0;
4706
0
  unsigned offset = 0;
4707
4708
0
  offset = dissect_nfs3_status(tvb, offset, tree, &status);
4709
0
  switch (status) {
4710
0
    case 0:
4711
0
      offset = dissect_nfs3_fh(tvb, offset, pinfo, tree, "object", &hash, (rpc_call_info_value*)data);
4712
0
      offset = dissect_nfs3_post_op_attr(tvb, offset, pinfo, tree,
4713
0
        "obj_attributes");
4714
0
      offset = dissect_nfs3_post_op_attr(tvb, offset, pinfo, tree,
4715
0
        "dir_attributes");
4716
4717
0
      col_append_fstr(pinfo->cinfo, COL_INFO, ", FH: 0x%08x", hash);
4718
0
      proto_item_append_text(tree, ", LOOKUP Reply FH: 0x%08x", hash);
4719
0
    break;
4720
0
    default:
4721
0
      offset = dissect_nfs3_post_op_attr(tvb, offset, pinfo, tree,
4722
0
        "dir_attributes");
4723
4724
0
      err = val_to_str_ext(pinfo->pool, status, &names_nfs3_status_ext, "Unknown error: %u");
4725
0
      col_append_fstr(pinfo->cinfo, COL_INFO, " Error: %s", err);
4726
0
      proto_item_append_text(tree, ", LOOKUP Reply  Error: %s", err);
4727
0
    break;
4728
0
  }
4729
4730
0
  return offset;
4731
0
}
4732
4733
4734
static gchar*
4735
proto_item_get_text(wmem_allocator_t *pool, proto_item *item)
4736
0
{
4737
0
  field_info *fi = NULL;
4738
0
  gchar *result;
4739
4740
0
  if (item == NULL)
4741
0
    return NULL;
4742
4743
0
  fi = PITEM_FINFO(item);
4744
4745
0
  if (fi == NULL)
4746
0
    return NULL;
4747
4748
0
  if (fi->rep == NULL) {
4749
0
    fi->rep = wmem_new(PNODE_POOL(item), item_label_t);
4750
0
    proto_item_fill_label(fi, fi->rep->representation, NULL);
4751
0
  }
4752
4753
0
  result = wmem_strdup(pool, fi->rep->representation);
4754
0
  return result;
4755
0
}
4756
4757
static const value_string accvs[] = {
4758
  { 0x001,  "RD" },
4759
  { 0x002,  "LU" },
4760
  { 0x004,  "MD" },
4761
  { 0x008,  "XT" },
4762
  { 0x010,  "DL" },
4763
  { 0x020,  "XE" },
4764
  { 0x040,  "XAR" },
4765
  { 0x080,  "XAW" },
4766
  { 0x100,  "XAL" },
4767
  { 0,    NULL }
4768
};
4769
4770
static const true_false_string tfs_access_supp   = { "supported", "!NOT Supported!"};
4771
static const true_false_string tfs_access_rights = {"allowed", "*Access Denied*"};
4772
4773
proto_tree*
4774
display_access_items(tvbuff_t* tvb, unsigned offset, packet_info* pinfo, proto_tree *tree,
4775
         uint32_t amask, uint32_t rmask, char mtype, int version, wmem_strbuf_t* optext, const char *label)
4776
0
{
4777
0
  bool        nfsv3    = ((version == 3) ? true : false);
4778
0
  proto_item *access_item    = NULL;
4779
0
  proto_tree *access_subtree = NULL;
4780
0
  proto_item *access_subitem = NULL;
4781
0
  uint32_t      itype;
4782
4783
  /* XXX Legend (delete if desired)
4784
4785
     'C' CHECK access:      append label to both headers and create subtree and list
4786
     'N' NOT SUPPORTED:     append label to both headers
4787
     'S' SUPPORTED or not:  create subtree and list
4788
     'D' DENIED:            append label to both headers
4789
     'A' ALLOWED:           append label to both headers
4790
     'R' RIGHTS:            create subtree and list */
4791
4792
0
  switch (mtype) {
4793
0
    case 'C':
4794
0
      access_item = proto_tree_add_item(tree, hf_nfs_access_check, tvb,
4795
0
        offset, 4, ENC_BIG_ENDIAN);
4796
0
      access_subtree = proto_item_add_subtree(access_item,
4797
0
        (nfsv3 ? ett_nfs3_access : ett_nfs4_access));
4798
0
      break;
4799
0
    case 'S':
4800
0
      access_item = proto_tree_add_item(tree, hf_nfs_access_supported, tvb,
4801
0
        offset, 4, ENC_BIG_ENDIAN);
4802
0
      access_subtree = proto_item_add_subtree(access_item, ett_nfs4_access_supp);
4803
0
      break;
4804
0
    case 'R':
4805
0
      access_item = proto_tree_add_item(tree, hf_nfs_access_rights, tvb,
4806
0
        offset, 4, ENC_BIG_ENDIAN);
4807
0
      access_subtree = proto_item_add_subtree(access_item,
4808
0
        (nfsv3 ? ett_nfs3_access : ett_nfs4_access));
4809
0
      break;
4810
0
  }
4811
  /* Append label to the Info column and tree */
4812
0
  if (mtype != 'S' && mtype != 'R') {
4813
0
    if (nfsv3) {
4814
0
      col_append_fstr(pinfo->cinfo, COL_INFO, ", [%s:", label);
4815
0
    } else {
4816
0
      wmem_strbuf_append_printf (optext, ", [%s:", label);
4817
0
    }
4818
0
    proto_item_append_text(tree, ", [%s:", label);
4819
0
  }
4820
4821
0
  for (itype=0; itype < 9; itype++) {
4822
0
      if (mtype != 'S' && mtype != 'R' && (amask & accvs[itype].value)) {
4823
        /* List access type in Info column and tree */
4824
0
        if (nfsv3) {
4825
0
          col_append_fstr(pinfo->cinfo, COL_INFO, " %s", accvs[itype].strptr);
4826
0
        } else {
4827
0
          wmem_strbuf_append_printf (optext, " %s", accvs[itype].strptr);
4828
0
        }
4829
0
        proto_item_append_text(tree, " %s", accvs[itype].strptr);
4830
0
      }
4831
0
      if (mtype == 'C' || mtype == 'S' || mtype == 'R') {
4832
4833
0
        switch (itype) {
4834
0
          case 0:
4835
0
            access_subitem = proto_tree_add_item (access_subtree,
4836
0
              (mtype == 'S' ? hf_nfs_access_supp_read : hf_nfs_access_read),
4837
0
              tvb, offset, 4, ENC_BIG_ENDIAN);
4838
0
            break;
4839
0
          case 1:
4840
0
            access_subitem = proto_tree_add_item (access_subtree,
4841
0
              (mtype == 'S' ? hf_nfs_access_supp_lookup : hf_nfs_access_lookup),
4842
0
              tvb, offset, 4, ENC_BIG_ENDIAN);
4843
0
            break;
4844
0
          case 2:
4845
0
            access_subitem = proto_tree_add_item (access_subtree,
4846
0
              (mtype == 'S' ? hf_nfs_access_supp_modify : hf_nfs_access_modify),
4847
0
              tvb, offset, 4, ENC_BIG_ENDIAN);
4848
0
            break;
4849
0
          case 3:
4850
0
            access_subitem = proto_tree_add_item (access_subtree,
4851
0
              (mtype == 'S' ? hf_nfs_access_supp_extend : hf_nfs_access_extend),
4852
0
              tvb, offset, 4, ENC_BIG_ENDIAN);
4853
0
            break;
4854
0
          case 4:
4855
0
            access_subitem = proto_tree_add_item (access_subtree,
4856
0
              (mtype == 'S' ? hf_nfs_access_supp_delete : hf_nfs_access_delete),
4857
0
              tvb, offset, 4, ENC_BIG_ENDIAN);
4858
0
            break;
4859
0
          case 5:
4860
0
            access_subitem = proto_tree_add_item (access_subtree,
4861
0
              (mtype == 'S' ? hf_nfs_access_supp_execute : hf_nfs_access_execute),
4862
0
              tvb, offset, 4, ENC_BIG_ENDIAN);
4863
0
            break;
4864
0
          case 6:
4865
0
            if (nfsv3) access_subitem = NULL; else
4866
0
            access_subitem = proto_tree_add_item (access_subtree,
4867
0
              (mtype == 'S' ? hf_nfs_access_supp_xattr_read : hf_nfs_access_xattr_read),
4868
0
              tvb, offset, 4, ENC_BIG_ENDIAN);
4869
0
            break;
4870
0
          case 7:
4871
0
            if (nfsv3) access_subitem = NULL; else
4872
0
            access_subitem = proto_tree_add_item (access_subtree,
4873
0
              (mtype == 'S' ? hf_nfs_access_supp_xattr_write : hf_nfs_access_xattr_write),
4874
0
              tvb, offset, 4, ENC_BIG_ENDIAN);
4875
0
            break;
4876
0
          case 8:
4877
0
            if (nfsv3) access_subitem = NULL; else
4878
0
            access_subitem = proto_tree_add_item (access_subtree,
4879
0
              (mtype == 'S' ? hf_nfs_access_supp_xattr_list : hf_nfs_access_xattr_list),
4880
0
              tvb, offset, 4, ENC_BIG_ENDIAN);
4881
0
            break;
4882
0
          default:
4883
0
            access_subitem = NULL;
4884
0
            break;
4885
0
        }
4886
0
        if (!(rmask & accvs[itype].value) && access_subitem) {
4887
0
          const char* text_start = proto_item_get_text(pinfo->pool, access_subitem);
4888
0
          const char* text_end = text_start ? strrchr(text_start, ':') : NULL;
4889
0
          if (text_start && text_end)
4890
0
            proto_item_set_text(access_subitem, "%.*s: %s", (int)(text_end - text_start), text_start, mtype == 'C' ? "not asked" : "unknown");
4891
0
        } else if (mtype == 'C' && access_subitem) {
4892
0
          proto_item_append_text(access_subitem, "?" );
4893
0
        }
4894
0
      }
4895
0
  }
4896
0
  if (mtype != 'S' && mtype != 'R') {
4897
0
    if (nfsv3) {
4898
0
      col_append_str(pinfo->cinfo, COL_INFO, "]");
4899
0
    } else {
4900
0
      wmem_strbuf_append_printf (optext, "]");
4901
0
    }
4902
0
    proto_item_append_text(tree, "]");
4903
0
  }
4904
0
  return access_subtree = NULL;
4905
0
}
4906
4907
/* NFSv3 RFC 1813, Page 40..43 */
4908
/* NFSv4 RFC 3530, Page 140..142 */
4909
unsigned
4910
dissect_access_reply(tvbuff_t *tvb, unsigned offset, packet_info *pinfo, proto_tree *tree,
4911
         int version, wmem_strbuf_t *optext, rpc_call_info_value *civ)
4912
0
{
4913
0
  uint32_t     *acc_req;
4914
0
  uint32_t      acc_supp;
4915
0
  uint32_t      acc_rights;
4916
0
  uint32_t      mask_not_supp;
4917
0
  uint32_t      mask_denied;
4918
0
  uint32_t      mask_allowed;
4919
0
  uint32_t      mask_result;
4920
0
  uint32_t      e_check, e_rights;
4921
0
  bool        nfsv3   = ((version == 3) ? true : false);
4922
0
  bool        nfsv4   = ((version == 4) ? true : false);
4923
0
  bool        have_acc_supp = true;
4924
0
  proto_tree *access_tree;
4925
0
  proto_item *ditem;
4926
4927
  /* Retrieve the access mask from the call if available. It
4928
     will not be available if the packet containing the call is
4929
     missing or truncated. */
4930
0
  acc_req = (uint32_t *)civ->private_data;
4931
0
  if (nfsv4) {
4932
0
    acc_supp = tvb_get_ntohl(tvb, offset+0);
4933
0
  } else if (acc_req) {
4934
0
    acc_supp = *acc_req;
4935
0
  } else {
4936
0
    have_acc_supp = false;
4937
0
  }
4938
  /*  V3/V4 - Get access rights mask and create a subtree for it */
4939
0
  acc_rights = tvb_get_ntohl(tvb, (nfsv3 ? offset+0: offset+4));
4940
0
  if (!have_acc_supp) {
4941
    /* The v3 access call isn't available. Using acc_rights for
4942
       acc_supp ensures mask_allowed will be correct */
4943
0
    acc_supp = acc_rights;
4944
0
  }
4945
4946
  /* Create access masks: not_supported, denied, and allowed */
4947
0
  if (acc_req && have_acc_supp)
4948
0
    mask_not_supp = *acc_req ^ acc_supp;
4949
0
  else
4950
0
    mask_not_supp = 0;
4951
4952
0
  if (acc_req)
4953
0
    mask_result = *acc_req;
4954
0
  else
4955
0
    mask_result = acc_supp;
4956
4957
0
  e_check = acc_supp;
4958
0
  e_rights = acc_supp & acc_rights;  /* guard against broken implementations */
4959
0
  mask_denied =  e_check ^ e_rights;
4960
0
  mask_allowed = e_check & e_rights;
4961
4962
0
  if (nfsv4) {
4963
0
    if (mask_not_supp > 0) {
4964
0
      display_access_items(tvb, offset, pinfo, tree, mask_not_supp, mask_result, 'N', 4,
4965
0
        optext, "NOT Supported") ;
4966
0
    }
4967
0
    display_access_items(tvb, offset, pinfo, tree, acc_supp, mask_result, 'S', 4,
4968
0
      optext, "Supported");
4969
0
    offset+=4;
4970
0
  }
4971
0
  if (mask_denied > 0) {
4972
0
    display_access_items(tvb, offset, pinfo, tree, mask_denied, mask_result, 'D', version,
4973
0
      optext, "Access Denied") ;
4974
0
  }
4975
0
  if (mask_allowed > 0) {
4976
0
    display_access_items(tvb, offset, pinfo, tree, mask_allowed, mask_result, 'A', version,
4977
0
      optext, "Allowed") ;
4978
0
  }
4979
  /* Pass the OR'd masks rather than acc_rights so that display_access_items will
4980
     process types that have been denied access. Since proto_tree_add_item uses the
4981
     mask in the tvb (not the passed mask), the correct (denied) access is displayed. */
4982
0
  access_tree = display_access_items(tvb, offset, pinfo, tree,
4983
0
    (mask_allowed | mask_denied), mask_result, 'R', version, optext, NULL) ;
4984
4985
0
  ditem = proto_tree_add_boolean(access_tree, hf_nfs_access_denied, tvb,
4986
0
        offset, 4, (mask_denied > 0 ? true : false ));
4987
0
  proto_item_set_generated(ditem);
4988
4989
0
  return offset+4;
4990
0
}
4991
4992
4993
/* NFSv3 RFC 1813, Page 40..43 */
4994
static int
4995
dissect_nfs3_access_call(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
4996
0
{
4997
0
  unsigned offset = 0;
4998
0
  uint32_t fhhash = 0, *acc_request, amask;
4999
0
  rpc_call_info_value *civ = (rpc_call_info_value*)data;
5000
5001
0
  offset = dissect_nfs3_fh(tvb, offset, pinfo, tree, "object", &fhhash, civ);
5002
5003
  /* Get access mask to check and save it for comparison to the access reply. */
5004
0
  amask = tvb_get_ntohl(tvb, offset);
5005
0
  acc_request = (uint32_t *)wmem_memdup(wmem_file_scope(),  &amask, sizeof(uint32_t));
5006
0
  civ->private_data = acc_request;
5007
5008
  /* Append filehandle to Info column and main tree header */
5009
0
  col_append_fstr(pinfo->cinfo, COL_INFO, ", FH: 0x%08x", fhhash);
5010
0
  proto_item_append_text(tree, ", ACCESS Call, FH: 0x%08x", fhhash);
5011
5012
0
  display_access_items(tvb, offset, pinfo, tree, amask, amask, 'C', 3, NULL, "Check") ;
5013
5014
0
  offset+=4;
5015
0
  return offset;
5016
0
}
5017
5018
5019
/* NFSv3 RFC 1813, Page 40..43 */
5020
static int
5021
dissect_nfs3_access_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
5022
0
{
5023
0
  uint32_t      status;
5024
0
  const char *err;
5025
0
  unsigned offset = 0;
5026
5027
0
  offset = dissect_nfs3_status(tvb, offset, tree, &status);
5028
0
  offset = dissect_nfs3_post_op_attr(tvb, offset, pinfo, tree,
5029
0
          "obj_attributes");
5030
5031
0
  if (status == 0) {
5032
0
    proto_item_append_text(tree, ", ACCESS Reply");
5033
0
    offset = dissect_access_reply(tvb, offset, pinfo, tree, 3, NULL, (rpc_call_info_value*)data);
5034
0
  } else {
5035
0
    err = val_to_str_ext(pinfo->pool, status, &names_nfs3_status_ext, "Unknown error: %u");
5036
0
    col_append_fstr(pinfo->cinfo, COL_INFO, " Error: %s", err);
5037
0
    proto_item_append_text(tree, ", ACCESS Reply  Error: %s", err);
5038
0
  }
5039
0
  return offset;
5040
0
}
5041
5042
5043
/* NFSv3 RFC 1813, Page 44,45 */
5044
static int
5045
dissect_nfs3_readlink_call(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
5046
0
{
5047
0
  uint32_t hash = 0;
5048
0
  unsigned offset = 0;
5049
5050
0
  offset = dissect_nfs3_fh(tvb, offset, pinfo, tree, "object", &hash, (rpc_call_info_value*)data);
5051
5052
0
  col_append_fstr(pinfo->cinfo, COL_INFO, ", FH: 0x%08x", hash);
5053
0
  proto_item_append_text(tree, ", READLINK Call FH: 0x%08x", hash);
5054
5055
0
  return offset;
5056
0
}
5057
5058
5059
static int
5060
dissect_nfs3_readlink_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
5061
0
{
5062
0
  uint32_t      status;
5063
0
  const char *err;
5064
0
  const char *name = NULL;
5065
0
  unsigned offset = 0;
5066
5067
0
  offset = dissect_nfs3_status(tvb, offset, tree, &status);
5068
0
  switch (status) {
5069
0
    case 0:
5070
0
      offset = dissect_nfs3_post_op_attr(tvb, offset, pinfo, tree,
5071
0
        "symlink_attributes");
5072
0
      offset = dissect_nfsdata_reduced(R_NFS3_PATH, tvb, pinfo, offset, tree,
5073
0
        hf_nfs2_readlink_data, &name);
5074
5075
0
      col_append_fstr(pinfo->cinfo, COL_INFO, " Path: %s", name);
5076
0
      proto_item_append_text(tree, ", READLINK Reply Path: %s", name);
5077
0
    break;
5078
0
    default:
5079
0
      offset = dissect_nfs3_post_op_attr(tvb, offset, pinfo, tree,
5080
0
        "symlink_attributes");
5081
5082
0
      err = val_to_str_ext(pinfo->pool, status, &names_nfs3_status_ext, "Unknown error: %u");
5083
0
      col_append_fstr(pinfo->cinfo, COL_INFO, " Error: %s", err);
5084
0
      proto_item_append_text(tree, ", READLINK Reply  Error: %s", err);
5085
0
    break;
5086
0
  }
5087
5088
0
  return offset;
5089
0
}
5090
5091
5092
/* NFSv3 RFC 1813, Page 46..48 */
5093
static int
5094
dissect_nfs3_read_call(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
5095
0
{
5096
0
  uint64_t off;
5097
0
  uint32_t len;
5098
0
  uint32_t hash = 0;
5099
0
  unsigned offset = 0;
5100
5101
0
  offset = dissect_nfs3_fh(tvb, offset, pinfo, tree, "file", &hash, (rpc_call_info_value*)data);
5102
5103
0
  off = tvb_get_ntoh64(tvb, offset);
5104
0
  offset = dissect_rpc_uint64(tvb, tree, hf_nfs3_offset, offset);
5105
5106
0
  len = tvb_get_ntohl(tvb, offset);
5107
0
  offset = dissect_rpc_uint32(tvb, tree, hf_nfs3_count, offset);
5108
5109
5110
0
  col_append_fstr(pinfo->cinfo, COL_INFO,
5111
0
    ", FH: 0x%08x Offset: %" PRIu64 " Len: %u", hash, off, len);
5112
0
  proto_item_append_text(tree,
5113
0
    ", READ Call FH: 0x%08x Offset: %" PRIu64 " Len: %u", hash, off, len);
5114
5115
0
  return offset;
5116
0
}
5117
5118
5119
/* NFSv3 RFC 1813, Page 46..48 */
5120
static int
5121
dissect_nfs3_read_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
5122
0
{
5123
0
  uint32_t      status;
5124
0
  uint32_t      len;
5125
0
  const char *err;
5126
0
  unsigned offset = 0;
5127
5128
0
  offset = dissect_nfs3_status(tvb, offset, tree, &status);
5129
0
  switch (status) {
5130
0
    case 0:
5131
0
      offset = dissect_nfs3_post_op_attr(tvb, offset, pinfo, tree,
5132
0
        "file_attributes");
5133
0
      len = tvb_get_ntohl(tvb, offset);
5134
0
      offset = dissect_rpc_uint32(tvb, tree, hf_nfs3_count,
5135
0
        offset);
5136
0
      offset = dissect_rpc_bool(tvb, tree, hf_nfs3_read_eof,
5137
0
        offset);
5138
0
      col_append_fstr(pinfo->cinfo, COL_INFO, " Len: %u", len);
5139
0
      proto_item_append_text(tree, ", READ Reply Len: %u", len);
5140
0
      offset = dissect_nfsdata_reduced(R_NFSDATA, tvb, pinfo, offset, tree, hf_nfs_data, NULL);
5141
0
    break;
5142
0
    default:
5143
0
      offset = dissect_nfs3_post_op_attr(tvb, offset, pinfo, tree,
5144
0
        "file_attributes");
5145
5146
0
      err = val_to_str_ext(pinfo->pool, status, &names_nfs3_status_ext, "Unknown error: %u");
5147
0
      col_append_fstr(pinfo->cinfo, COL_INFO, " Error: %s", err);
5148
0
      proto_item_append_text(tree, ", READ Reply  Error: %s", err);
5149
0
    break;
5150
0
  }
5151
5152
0
  return offset;
5153
0
}
5154
5155
5156
/* NFSv3 RFC 1813, Page 49 */
5157
static const value_string names_stable_how[] = {
5158
  { UNSTABLE,  "UNSTABLE"  },
5159
  { DATA_SYNC, "DATA_SYNC" },
5160
  { FILE_SYNC, "FILE_SYNC" },
5161
  { 0, NULL }
5162
};
5163
5164
/* NFSv3 RFC 1813, Page 49 */
5165
static unsigned
5166
dissect_stable_how(tvbuff_t *tvb, unsigned offset, proto_tree *tree, int hfindex)
5167
0
{
5168
0
  proto_tree_add_item(tree, hfindex, tvb, offset, 4, ENC_BIG_ENDIAN);
5169
0
  offset += 4;
5170
5171
0
  return offset;
5172
0
}
5173
5174
/* NFSv3 RFC 1813, Page 49..54 */
5175
static int
5176
dissect_nfs3_write_call(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
5177
0
{
5178
0
  uint64_t off;
5179
0
  uint32_t len;
5180
0
  uint32_t stable;
5181
0
  uint32_t hash = 0;
5182
0
  unsigned offset = 0;
5183
0
  char* str_stable;
5184
5185
0
  offset = dissect_nfs3_fh(tvb, offset, pinfo, tree, "file", &hash, (rpc_call_info_value*)data);
5186
5187
0
  off = tvb_get_ntoh64(tvb, offset);
5188
0
  offset = dissect_rpc_uint64(tvb, tree, hf_nfs3_offset, offset);
5189
5190
0
  len = tvb_get_ntohl(tvb, offset);
5191
0
  offset = dissect_rpc_uint32(tvb, tree, hf_nfs3_count, offset);
5192
5193
0
  stable = tvb_get_ntohl(tvb, offset);
5194
0
  offset = dissect_stable_how(tvb, offset, tree, hf_nfs3_write_stable);
5195
5196
0
  str_stable = val_to_str(pinfo->pool, stable, names_stable_how, "Stable: %u");
5197
0
  col_append_fstr(pinfo->cinfo, COL_INFO, ", FH: 0x%08x Offset: %" PRIu64 " Len: %u %s",
5198
0
    hash, off, len, str_stable);
5199
0
  proto_item_append_text(tree, ", WRITE Call FH: 0x%08x Offset: %" PRIu64 " Len: %u %s",
5200
0
    hash, off, len, str_stable);
5201
5202
0
  offset = dissect_nfsdata   (tvb, pinfo, offset, tree, hf_nfs_data);
5203
5204
0
  return offset;
5205
0
}
5206
5207
5208
/* NFSv3 RFC 1813, Page 49..54 */
5209
static int
5210
dissect_nfs3_write_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
5211
0
{
5212
0
  uint32_t      status;
5213
0
  uint32_t      len;
5214
0
  uint32_t      stable;
5215
0
  const char *err;
5216
0
  unsigned offset = 0;
5217
0
  char* str_stable;
5218
5219
0
  offset = dissect_nfs3_status(tvb, offset, tree, &status);
5220
0
  switch (status) {
5221
0
    case 0:
5222
0
      offset = dissect_wcc_data(tvb, offset, pinfo, tree, "file_wcc");
5223
0
      len = tvb_get_ntohl(tvb, offset);
5224
0
      offset = dissect_rpc_uint32(tvb, tree, hf_nfs3_count,
5225
0
        offset);
5226
0
      stable = tvb_get_ntohl(tvb, offset);
5227
0
      offset = dissect_stable_how(tvb, offset, tree,
5228
0
        hf_nfs3_write_committed);
5229
0
      offset = dissect_nfs3_write_verf(tvb, offset, tree);
5230
5231
0
      str_stable = val_to_str(pinfo->pool, stable, names_stable_how, "Stable: %u");
5232
0
      col_append_fstr(pinfo->cinfo, COL_INFO, " Len: %u %s", len, str_stable);
5233
0
      proto_item_append_text(tree, ", WRITE Reply Len: %u %s", len, str_stable);
5234
0
    break;
5235
0
    default:
5236
0
      offset = dissect_wcc_data(tvb, offset, pinfo, tree, "file_wcc");
5237
5238
0
      err = val_to_str_ext(pinfo->pool, status, &names_nfs3_status_ext, "Unknown error: %u");
5239
0
      col_append_fstr(pinfo->cinfo, COL_INFO, " Error: %s", err);
5240
0
      proto_item_append_text(tree, ", WRITE Reply  Error: %s", err);
5241
0
    break;
5242
0
  }
5243
5244
0
  return offset;
5245
0
}
5246
5247
5248
/* NFSv3 RFC 1813, Page 54 */
5249
static const value_string names_createmode3[] = {
5250
  { UNCHECKED, "UNCHECKED" },
5251
  { GUARDED,   "GUARDED" },
5252
  { EXCLUSIVE, "EXCLUSIVE" },
5253
  { 0, NULL }
5254
};
5255
5256
/* NFSv3 RFC 1813, Page 54 */
5257
static unsigned
5258
dissect_createmode3(tvbuff_t *tvb, unsigned offset, proto_tree *tree, uint32_t* mode)
5259
0
{
5260
0
  uint32_t mode_value;
5261
5262
0
  mode_value = tvb_get_ntohl(tvb, offset + 0);
5263
0
  if (tree)
5264
0
    proto_tree_add_uint(tree, hf_nfs3_createmode, tvb, offset+0, 4, mode_value);
5265
0
  offset += 4;
5266
5267
0
  *mode = mode_value;
5268
0
  return offset;
5269
0
}
5270
5271
5272
/* NFSv3 RFC 1813, Page 54..58 */
5273
static int
5274
dissect_nfs3_create_call(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
5275
0
{
5276
0
  uint32_t      mode;
5277
0
  uint32_t      hash = 0;
5278
0
  const char *name = NULL;
5279
0
  unsigned offset = 0;
5280
0
  char* str_mode;
5281
5282
0
  offset = dissect_diropargs3 (tvb, offset, pinfo, tree, "where", &hash, &name, (rpc_call_info_value*)data);
5283
0
  offset = dissect_createmode3(tvb, offset, tree, &mode);
5284
0
  switch (mode) {
5285
0
    case UNCHECKED:
5286
0
    case GUARDED:
5287
0
      offset = dissect_nfs3_sattr(tvb, offset, tree, "obj_attributes");
5288
0
    break;
5289
0
    case EXCLUSIVE:
5290
0
      offset = dissect_nfs3_create_verf(tvb, offset, tree);
5291
0
    break;
5292
0
  }
5293
5294
0
  str_mode = val_to_str(pinfo->pool, mode, names_createmode3, "Unknown Mode: %u");
5295
0
  col_append_fstr(pinfo->cinfo, COL_INFO, ", DH: 0x%08x/%s Mode: %s", hash, name, str_mode);
5296
0
  proto_item_append_text(tree, ", CREATE Call DH: 0x%08x/%s Mode: %s", hash, name, str_mode);
5297
5298
0
  return offset;
5299
0
}
5300
5301
5302
/* NFSv3 RFC 1813, Page 54..58 */
5303
static int
5304
dissect_nfs3_create_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
5305
0
{
5306
0
  uint32_t      status;
5307
0
  const char *err;
5308
0
  unsigned offset = 0;
5309
5310
0
  offset = dissect_nfs3_status(tvb, offset, tree, &status);
5311
0
  switch (status) {
5312
0
    case 0:
5313
0
      offset = dissect_nfs3_post_op_fh (tvb, offset, pinfo, tree, "obj", (rpc_call_info_value*)data);
5314
0
      offset = dissect_nfs3_post_op_attr(tvb, offset, pinfo, tree,
5315
0
        "obj_attributes");
5316
0
      offset = dissect_wcc_data(tvb, offset, pinfo, tree, "dir_wcc");
5317
0
      proto_item_append_text(tree, ", CREATE Reply");
5318
0
    break;
5319
0
    default:
5320
0
      offset = dissect_wcc_data(tvb, offset, pinfo, tree, "dir_wcc");
5321
5322
0
      err = val_to_str_ext(pinfo->pool, status, &names_nfs3_status_ext, "Unknown error: %u");
5323
0
      col_append_fstr(pinfo->cinfo, COL_INFO, " Error: %s", err);
5324
0
      proto_item_append_text(tree, ", CREATE Reply  Error: %s", err);
5325
0
    break;
5326
0
  }
5327
5328
0
  return offset;
5329
0
}
5330
5331
5332
/* NFSv3 RFC 1813, Page 58..60 */
5333
static int
5334
dissect_nfs3_mkdir_call(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
5335
0
{
5336
0
  uint32_t      hash = 0;
5337
0
  const char *name = NULL;
5338
0
  unsigned offset = 0;
5339
5340
0
  offset = dissect_diropargs3(tvb, offset, pinfo, tree, "where", &hash, &name, (rpc_call_info_value*)data);
5341
0
  offset = dissect_nfs3_sattr    (tvb, offset, tree, "attributes");
5342
5343
0
  col_append_fstr(pinfo->cinfo, COL_INFO, ", DH: 0x%08x/%s", hash, name);
5344
0
  proto_item_append_text(tree, ", MKDIR Call DH: 0x%08x/%s", hash, name);
5345
5346
0
  return offset;
5347
0
}
5348
5349
5350
static int
5351
dissect_nfs3_mkdir_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
5352
0
{
5353
0
  uint32_t      status;
5354
0
  const char *err;
5355
0
  unsigned offset = 0;
5356
5357
0
  offset = dissect_nfs3_status(tvb, offset, tree, &status);
5358
0
  switch (status) {
5359
0
    case 0:
5360
0
      offset = dissect_nfs3_post_op_fh (tvb, offset, pinfo, tree, "obj", (rpc_call_info_value*)data);
5361
0
      offset = dissect_nfs3_post_op_attr(tvb, offset, pinfo, tree,
5362
0
        "obj_attributes");
5363
0
      offset = dissect_wcc_data(tvb, offset, pinfo, tree, "dir_wcc");
5364
0
      proto_item_append_text(tree, ", MKDIR Reply");
5365
0
    break;
5366
0
    default:
5367
0
      offset = dissect_wcc_data(tvb, offset, pinfo, tree, "dir_wcc");
5368
5369
0
      err = val_to_str_ext(pinfo->pool, status, &names_nfs3_status_ext, "Unknown error: %u");
5370
0
      col_append_fstr(pinfo->cinfo, COL_INFO, " Error: %s", err);
5371
0
      proto_item_append_text(tree, ", MKDIR Reply  Error: %s", err);
5372
0
    break;
5373
0
  }
5374
5375
0
  return offset;
5376
0
}
5377
5378
5379
/* NFSv3 RFC 1813, Page 61..63 */
5380
static int
5381
dissect_nfs3_symlink_call(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
5382
0
{
5383
0
  uint32_t      from_hash = 0;
5384
0
  const char *from_name = NULL;
5385
0
  const char *to_name   = NULL;
5386
0
  unsigned offset = 0;
5387
5388
0
  offset = dissect_diropargs3(tvb, offset, pinfo, tree, "where", &from_hash, &from_name, (rpc_call_info_value*)data);
5389
0
  offset = dissect_nfs3_sattr    (tvb, offset,        tree, "symlink_attributes");
5390
0
  offset = dissect_nfs3_path  (tvb, pinfo, offset,        tree, hf_nfs_symlink_to, &to_name);
5391
5392
0
  col_append_fstr(pinfo->cinfo, COL_INFO, ", From DH: 0x%08x/%s To %s",
5393
0
    from_hash, from_name, to_name);
5394
0
  proto_item_append_text(tree, ", SYMLINK Call From DH: 0x%08x/%s To %s",
5395
0
    from_hash, from_name, to_name);
5396
5397
0
  return offset;
5398
0
}
5399
5400
5401
static int
5402
dissect_nfs3_symlink_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
5403
0
{
5404
0
  uint32_t      status;
5405
0
  const char *err;
5406
0
  unsigned offset = 0;
5407
5408
0
  offset = dissect_nfs3_status(tvb, offset, tree, &status);
5409
0
  switch (status) {
5410
0
    case 0:
5411
0
      offset = dissect_nfs3_post_op_fh (tvb, offset, pinfo, tree, "obj", (rpc_call_info_value*)data);
5412
0
      offset = dissect_nfs3_post_op_attr(tvb, offset, pinfo, tree,
5413
0
        "obj_attributes");
5414
0
      offset = dissect_wcc_data(tvb, offset, pinfo, tree, "dir_wcc");
5415
0
      proto_item_append_text(tree, ", SYMLINK Reply");
5416
0
    break;
5417
0
    default:
5418
0
      offset = dissect_wcc_data(tvb, offset, pinfo, tree, "dir_wcc");
5419
5420
0
      err = val_to_str_ext(pinfo->pool, status, &names_nfs3_status_ext, "Unknown error: %u");
5421
0
      col_append_fstr(pinfo->cinfo, COL_INFO, " Error: %s", err);
5422
0
      proto_item_append_text(tree, ", SYMLINK Reply  Error: %s", err);
5423
0
    break;
5424
0
  }
5425
5426
0
  return offset;
5427
0
}
5428
5429
5430
/* NFSv3 RFC 1813, Page 63..66 */
5431
static int
5432
dissect_nfs3_mknod_call(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
5433
0
{
5434
0
  uint32_t      type;
5435
0
  uint32_t      hash = 0;
5436
0
  const char *name = NULL;
5437
0
  const char *type_str;
5438
0
  unsigned offset = 0;
5439
5440
0
  offset = dissect_diropargs3(tvb, offset, pinfo, tree, "where", &hash, &name, (rpc_call_info_value*)data);
5441
0
  offset = dissect_ftype3(tvb, offset, tree, hf_nfs3_ftype, &type);
5442
0
  switch (type) {
5443
0
    case NF3CHR:
5444
0
    case NF3BLK:
5445
0
      offset = dissect_nfs3_sattr(tvb, offset, tree, "dev_attributes");
5446
0
      offset = dissect_nfs3_specdata(tvb, offset, tree, "spec");
5447
0
    break;
5448
0
    case NF3SOCK:
5449
0
    case NF3FIFO:
5450
0
      offset = dissect_nfs3_sattr(tvb, offset, tree, "pipe_attributes");
5451
0
    break;
5452
0
    default:
5453
      /* nothing to do */
5454
0
    break;
5455
0
  }
5456
5457
0
  type_str = val_to_str_ext(pinfo->pool, type, &names_nfs_ftype3_ext, "Unknown type: %u");
5458
0
  col_append_fstr(pinfo->cinfo, COL_INFO, ", FH: 0x%08x/%s %s", hash, name, type_str);
5459
0
  proto_item_append_text(tree, ", MKNOD Call FH: 0x%08x/%s %s", hash, name, type_str);
5460
5461
0
  return offset;
5462
0
}
5463
5464
5465
static int
5466
dissect_nfs3_mknod_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
5467
0
{
5468
0
  uint32_t      status;
5469
0
  const char *err;
5470
0
  unsigned offset = 0;
5471
5472
0
  offset = dissect_nfs3_status(tvb, offset, tree, &status);
5473
0
  switch (status) {
5474
0
    case 0:
5475
0
      offset = dissect_nfs3_post_op_fh (tvb, offset, pinfo, tree, "obj", (rpc_call_info_value*)data);
5476
0
      offset = dissect_nfs3_post_op_attr(tvb, offset, pinfo, tree,
5477
0
        "obj_attributes");
5478
0
      offset = dissect_wcc_data(tvb, offset, pinfo, tree, "dir_wcc");
5479
0
      proto_item_append_text(tree, ", MKNOD Reply");
5480
0
    break;
5481
0
    default:
5482
0
      offset = dissect_wcc_data(tvb, offset, pinfo, tree, "dir_wcc");
5483
5484
0
      err = val_to_str_ext(pinfo->pool, status, &names_nfs3_status_ext, "Unknown error: %u");
5485
0
      col_append_fstr(pinfo->cinfo, COL_INFO, " Error: %s", err);
5486
0
      proto_item_append_text(tree, ", MKNOD Reply  Error: %s", err);
5487
0
    break;
5488
0
  }
5489
5490
0
  return offset;
5491
0
}
5492
5493
5494
/* NFSv3 RFC 1813, Page 67..69 */
5495
static int
5496
dissect_nfs3_remove_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
5497
0
{
5498
0
  uint32_t      status;
5499
0
  const char *err;
5500
0
  unsigned offset = 0;
5501
5502
0
  offset = dissect_nfs3_status(tvb, offset, tree, &status);
5503
0
  switch (status) {
5504
0
    case 0:
5505
0
      offset = dissect_wcc_data(tvb, offset, pinfo, tree, "dir_wcc");
5506
0
      proto_item_append_text(tree, ", REMOVE Reply");
5507
0
    break;
5508
0
    default:
5509
0
      offset = dissect_wcc_data(tvb, offset, pinfo, tree, "dir_wcc");
5510
0
      err = val_to_str_ext(pinfo->pool, status, &names_nfs3_status_ext, "Unknown error: %u");
5511
0
      col_append_fstr(pinfo->cinfo, COL_INFO, " Error: %s", err);
5512
0
      proto_item_append_text(tree, ", REMOVE Reply  Error: %s", err);
5513
0
    break;
5514
0
  }
5515
5516
0
  return offset;
5517
0
}
5518
5519
5520
static int
5521
dissect_nfs3_rmdir_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
5522
0
{
5523
0
  uint32_t      status;
5524
0
  const char *err;
5525
0
  unsigned offset = 0;
5526
5527
0
  offset = dissect_nfs3_status(tvb, offset, tree, &status);
5528
0
  switch (status) {
5529
0
    case 0:
5530
0
      offset = dissect_wcc_data(tvb, offset, pinfo, tree, "dir_wcc");
5531
0
      proto_item_append_text(tree, ", RMDIR Reply");
5532
0
    break;
5533
0
    default:
5534
0
      offset = dissect_wcc_data(tvb, offset, pinfo, tree, "dir_wcc");
5535
0
      err = val_to_str_ext(pinfo->pool, status, &names_nfs3_status_ext, "Unknown error: %u");
5536
0
      col_append_fstr(pinfo->cinfo, COL_INFO, " Error: %s", err);
5537
0
      proto_item_append_text(tree, ", RMDIR Reply  Error: %s", err);
5538
0
    break;
5539
0
  }
5540
5541
0
  return offset;
5542
0
}
5543
5544
5545
/* NFSv3 RFC 1813, Page 71..74 */
5546
static int
5547
dissect_nfs3_rename_call(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
5548
0
{
5549
0
  uint32_t      from_hash = 0;
5550
0
  const char *from_name = NULL;
5551
0
  uint32_t      to_hash   = 0;
5552
0
  const char *to_name   = NULL;
5553
0
  unsigned offset = 0;
5554
5555
0
  offset = dissect_diropargs3(tvb, offset, pinfo, tree, "from", &from_hash, &from_name, (rpc_call_info_value*)data);
5556
0
  offset = dissect_diropargs3(tvb, offset, pinfo, tree, "to", &to_hash, &to_name, (rpc_call_info_value*)data);
5557
5558
0
  col_append_fstr(pinfo->cinfo, COL_INFO, ", From DH: 0x%08x/%s To DH: 0x%08x/%s",
5559
0
    from_hash, from_name, to_hash, to_name);
5560
0
  proto_item_append_text(tree, ", RENAME Call From DH: 0x%08x/%s To DH: 0x%08x/%s",
5561
0
    from_hash, from_name, to_hash, to_name);
5562
5563
0
  return offset;
5564
0
}
5565
5566
5567
/* NFSv3 RFC 1813, Page 71..74 */
5568
static int
5569
dissect_nfs3_rename_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
5570
0
{
5571
0
  uint32_t      status;
5572
0
  const char *err;
5573
0
  unsigned offset = 0;
5574
5575
0
  offset = dissect_nfs3_status(tvb, offset, tree, &status);
5576
0
  switch (status) {
5577
0
    case 0:
5578
0
      offset = dissect_wcc_data(tvb, offset, pinfo, tree, "fromdir_wcc");
5579
0
      offset = dissect_wcc_data(tvb, offset, pinfo, tree, "todir_wcc");
5580
0
      proto_item_append_text(tree, ", RENAME Reply");
5581
0
    break;
5582
0
    default:
5583
0
      offset = dissect_wcc_data(tvb, offset, pinfo, tree, "fromdir_wcc");
5584
0
      offset = dissect_wcc_data(tvb, offset, pinfo, tree, "todir_wcc");
5585
5586
0
      err = val_to_str_ext(pinfo->pool, status, &names_nfs3_status_ext, "Unknown error: %u");
5587
0
      col_append_fstr(pinfo->cinfo, COL_INFO, " Error: %s", err);
5588
0
      proto_item_append_text(tree, ", RENAME Reply  Error: %s", err);
5589
0
    break;
5590
0
  }
5591
5592
0
  return offset;
5593
0
}
5594
5595
5596
/* NFSv3 RFC 1813, Page 74..76 */
5597
static int
5598
dissect_nfs3_link_call(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
5599
0
{
5600
0
  uint32_t      from_hash = 0;
5601
0
  uint32_t      to_hash   = 0;
5602
0
  const char *to_name   = NULL;
5603
0
  unsigned offset = 0;
5604
5605
0
  offset = dissect_nfs3_fh(tvb, offset, pinfo, tree, "file", &from_hash, (rpc_call_info_value*)data);
5606
0
  offset = dissect_diropargs3(tvb, offset, pinfo, tree, "link", &to_hash, &to_name, (rpc_call_info_value*)data);
5607
5608
0
  col_append_fstr(pinfo->cinfo, COL_INFO, ", From DH: 0x%08x To DH: 0x%08x/%s",
5609
0
    from_hash, to_hash, to_name);
5610
0
  proto_item_append_text(tree, ", LINK Call From DH: 0x%08x To DH: 0x%08x/%s",
5611
0
    from_hash, to_hash, to_name);
5612
5613
0
  return offset;
5614
0
}
5615
5616
5617
/* NFSv3 RFC 1813, Page 74..76 */
5618
static int
5619
dissect_nfs3_link_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
5620
0
{
5621
0
  uint32_t      status;
5622
0
  const char *err;
5623
0
  unsigned offset = 0;
5624
5625
0
  offset = dissect_nfs3_status(tvb, offset, tree, &status);
5626
0
  switch (status) {
5627
0
    case 0:
5628
0
      offset = dissect_nfs3_post_op_attr(tvb, offset, pinfo, tree,
5629
0
        "file_attributes");
5630
0
      offset = dissect_wcc_data(tvb, offset, pinfo, tree, "linkdir_wcc");
5631
0
      proto_item_append_text(tree, ", LINK Reply");
5632
0
    break;
5633
0
    default:
5634
0
      offset = dissect_nfs3_post_op_attr(tvb, offset, pinfo, tree,
5635
0
        "file_attributes");
5636
0
      offset = dissect_wcc_data(tvb, offset, pinfo, tree, "linkdir_wcc");
5637
5638
0
      err = val_to_str_ext(pinfo->pool, status, &names_nfs3_status_ext, "Unknown error: %u");
5639
0
      col_append_fstr(pinfo->cinfo, COL_INFO, " Error: %s", err);
5640
0
      proto_item_append_text(tree, ", LINK Reply  Error: %s", err);
5641
0
    break;
5642
0
  }
5643
5644
0
  return offset;
5645
0
}
5646
5647
5648
/* NFSv3 RFC 1813, Page 76..80 */
5649
static int
5650
dissect_nfs3_readdir_call(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
5651
0
{
5652
0
  uint32_t hash = 0;
5653
0
  unsigned offset = 0;
5654
5655
0
  offset = dissect_nfs3_fh(tvb, offset, pinfo, tree, "dir", &hash, (rpc_call_info_value*)data);
5656
0
  offset = dissect_rpc_uint64(tvb, tree, hf_nfs3_cookie, offset);
5657
0
  offset = dissect_nfs3_cookie_verf(tvb, offset, tree);
5658
0
  offset = dissect_rpc_uint32(tvb, tree, hf_nfs3_count, offset);
5659
5660
0
  col_append_fstr(pinfo->cinfo, COL_INFO, ", FH: 0x%08x", hash);
5661
0
  proto_item_append_text(tree, ", READDIR Call FH: 0x%08x", hash);
5662
5663
0
  return offset;
5664
0
}
5665
5666
5667
/* NFSv3 RFC 1813, Page 76..80 */
5668
static int
5669
dissect_entry3(tvbuff_t *tvb, unsigned offset, packet_info *pinfo, proto_tree *tree, void *data _U_)
5670
0
{
5671
0
  proto_item *entry_item;
5672
0
  proto_tree *entry_tree;
5673
0
  unsigned    old_offset = offset;
5674
0
  const char *name       = NULL;
5675
5676
0
  entry_item = proto_tree_add_item(tree, hf_nfs_readdir_entry, tvb, offset+0, -1, ENC_NA);
5677
0
  entry_tree = proto_item_add_subtree(entry_item, ett_nfs_readdir_entry);
5678
5679
0
  offset = dissect_rpc_uint64(tvb, entry_tree, hf_nfs3_readdir_entry_fileid, offset);
5680
5681
0
  offset = dissect_nfs3_filename(tvb, pinfo, offset, entry_tree,  hf_nfs3_readdir_entry_name, &name);
5682
0
  proto_item_set_text(entry_item, "Entry: name %s", name);
5683
5684
0
  col_append_fstr(pinfo->cinfo, COL_INFO, " %s", name);
5685
5686
0
  offset = dissect_rpc_uint64(tvb, entry_tree, hf_nfs3_readdir_entry_cookie, offset);
5687
5688
  /* now we know, that a readdir entry is shorter */
5689
0
  proto_item_set_len(entry_item, offset - old_offset);
5690
5691
0
  return offset;
5692
0
}
5693
5694
5695
/* NFSv3 RFC 1813, Page 76..80 */
5696
static int
5697
dissect_nfs3_readdir_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
5698
0
{
5699
0
  uint32_t      status;
5700
0
  const char *err;
5701
0
  unsigned offset = 0;
5702
5703
0
  offset = dissect_nfs3_status(tvb, offset, tree, &status);
5704
0
  switch (status) {
5705
0
    case 0:
5706
0
      proto_item_append_text(tree, ", READDIR Reply");
5707
5708
0
      offset = dissect_nfs3_post_op_attr(tvb, offset, pinfo, tree,
5709
0
        "dir_attributes");
5710
0
      offset = dissect_nfs3_cookie_verf(tvb, offset, tree);
5711
0
      offset = dissect_rpc_list(tvb, pinfo, tree, offset,
5712
0
        dissect_entry3, NULL);
5713
0
      proto_tree_add_item(tree, hf_nfs_readdir_eof, tvb,
5714
0
          offset+ 0, 4, ENC_BIG_ENDIAN);
5715
0
      offset += 4;
5716
0
    break;
5717
0
    default:
5718
0
      offset = dissect_nfs3_post_op_attr(tvb, offset, pinfo, tree,
5719
0
        "dir_attributes");
5720
5721
0
      err = val_to_str_ext(pinfo->pool, status, &names_nfs3_status_ext, "Unknown error: %u");
5722
0
      col_append_fstr(pinfo->cinfo, COL_INFO, " Error: %s", err);
5723
0
      proto_item_append_text(tree, ", READDIR Reply  Error: %s", err);
5724
0
    break;
5725
0
  }
5726
5727
0
  return offset;
5728
0
}
5729
5730
5731
/* NFSv3 RFC 1813, Page 80..83 */
5732
static int
5733
dissect_nfs3_readdirplus_call(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
5734
0
{
5735
0
  uint32_t hash = 0;
5736
0
  unsigned offset = 0;
5737
5738
0
  offset = dissect_nfs3_fh(tvb, offset, pinfo, tree, "dir", &hash, (rpc_call_info_value*)data);
5739
0
  offset = dissect_rpc_uint64(tvb, tree, hf_nfs3_cookie, offset);
5740
0
  offset = dissect_nfs3_cookie_verf(tvb, offset, tree);
5741
0
  offset = dissect_rpc_uint32(tvb, tree, hf_nfs3_count_dircount,
5742
0
    offset);
5743
0
  offset = dissect_rpc_uint32(tvb, tree, hf_nfs3_count_maxcount,
5744
0
    offset);
5745
5746
0
  col_append_fstr(pinfo->cinfo, COL_INFO, ", FH: 0x%08x", hash);
5747
0
  proto_item_append_text(tree, ", READDIRPLUS Call FH: 0x%08x", hash);
5748
5749
0
  return offset;
5750
0
}
5751
5752
5753
/* NFSv3 RFC 1813, Page 80..83 */
5754
static int
5755
dissect_nfs3_entryplus(tvbuff_t *tvb, unsigned offset, packet_info *pinfo, proto_tree *tree, void *data)
5756
0
{
5757
0
  proto_item *entry_item;
5758
0
  proto_tree *entry_tree;
5759
0
  int fh_follows_offset;
5760
0
  bool fh_follows;
5761
0
  int fh_offset;
5762
0
  int fh_length;
5763
0
  unsigned    old_offset = offset;
5764
0
  const char *name       = NULL;
5765
0
  rpc_call_info_value *civ = (rpc_call_info_value *)data;
5766
5767
0
  entry_item = proto_tree_add_item(tree, hf_nfs_readdir_entry, tvb, offset+0, -1, ENC_NA);
5768
0
  entry_tree = proto_item_add_subtree(entry_item, ett_nfs_readdir_entry);
5769
5770
0
  offset = dissect_rpc_uint64(tvb, entry_tree, hf_nfs3_readdirplus_entry_fileid, offset);
5771
5772
0
  offset = dissect_nfs3_filename(tvb, pinfo, offset, entry_tree,  hf_nfs3_readdirplus_entry_name, &name);
5773
5774
0
  proto_item_set_text(entry_item, "Entry: name %s", name);
5775
5776
0
  col_append_fstr(pinfo->cinfo, COL_INFO, " %s", name);
5777
5778
0
  offset = dissect_rpc_uint64(tvb, entry_tree, hf_nfs3_readdirplus_entry_cookie,
5779
0
    offset);
5780
5781
0
  offset = dissect_nfs3_post_op_attr(tvb, offset, pinfo, entry_tree, "name_attributes");
5782
5783
  /* are we snooping fh to filenames ?*/
5784
0
  if ((!pinfo->fd->visited) && nfs_file_name_snooping) {
5785
    /* v3 READDIRPLUS replies might give us a mapping */
5786
0
    if ( (civ->prog == 100003)
5787
0
      &&(civ->vers == 3)
5788
0
      &&(!civ->request)
5789
0
      &&((civ->proc == 17))
5790
0
    ) {
5791
0
      fh_follows_offset = offset;
5792
0
      fh_follows = tvb_get_ntohl(tvb, fh_follows_offset);
5793
0
      if (fh_follows == true) {
5794
0
        fh_length = tvb_get_ntohl(tvb, fh_follows_offset+4);
5795
0
        fh_offset = fh_follows_offset+4+4;
5796
0
        nfs_name_snoop_readdir_add_child_fh_name(civ->xid, tvb, fh_offset, fh_length, name);
5797
0
      }
5798
0
    }
5799
0
  }
5800
5801
0
  offset = dissect_nfs3_post_op_fh(tvb, offset, pinfo, entry_tree, "name_handle", civ);
5802
5803
  /* now we know, that a readdirplus entry is shorter */
5804
0
  proto_item_set_len(entry_item, offset - old_offset);
5805
5806
0
  return offset;
5807
0
}
5808
5809
5810
/* NFSv3 RFC 1813, Page 80..83 */
5811
static int
5812
dissect_nfs3_readdirplus_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
5813
0
{
5814
0
  uint32_t      status;
5815
0
  const char *err;
5816
0
  unsigned offset = 0;
5817
5818
0
  offset = dissect_nfs3_status(tvb, offset, tree, &status);
5819
0
  switch (status) {
5820
0
    case 0:
5821
0
      proto_item_append_text(tree, ", READDIRPLUS Reply");
5822
5823
0
      offset = dissect_nfs3_post_op_attr(tvb, offset, pinfo, tree,
5824
0
        "dir_attributes");
5825
0
      offset = dissect_nfs3_cookie_verf(tvb, offset, tree);
5826
0
      offset = dissect_rpc_list(tvb, pinfo, tree, offset,
5827
0
        dissect_nfs3_entryplus, data);
5828
0
      proto_tree_add_item(tree, hf_nfs_readdir_eof, tvb,
5829
0
          offset+ 0, 4, ENC_BIG_ENDIAN);
5830
0
      offset += 4;
5831
0
    break;
5832
0
    default:
5833
0
      offset = dissect_nfs3_post_op_attr(tvb, offset, pinfo, tree,
5834
0
        "dir_attributes");
5835
5836
0
      err = val_to_str_ext(pinfo->pool, status, &names_nfs3_status_ext, "Unknown error: %u");
5837
0
      col_append_fstr(pinfo->cinfo, COL_INFO, " Error: %s", err);
5838
0
      proto_item_append_text(tree, ", READDIRPLUS Reply  Error: %s", err);
5839
0
    break;
5840
0
  }
5841
5842
0
  return offset;
5843
0
}
5844
5845
5846
/* NFSv3 RFC 1813, Page 84..86 */
5847
static int
5848
dissect_nfs3_fsstat_call(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
5849
0
{
5850
0
  uint32_t hash = 0;
5851
0
  unsigned offset = 0;
5852
5853
0
  offset = dissect_nfs3_fh(tvb, offset, pinfo, tree, "object", &hash, (rpc_call_info_value*)data);
5854
5855
0
  col_append_fstr(pinfo->cinfo, COL_INFO, ", FH: 0x%08x", hash);
5856
0
  proto_item_append_text(tree, ", FSSTAT Call DH: 0x%08x", hash);
5857
0
  return offset;
5858
0
}
5859
5860
5861
static int
5862
dissect_nfs3_fsstat_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
5863
0
{
5864
0
  uint32_t      status;
5865
0
  uint32_t      invarsec;
5866
0
  const char *err;
5867
0
  unsigned offset = 0;
5868
5869
0
  offset = dissect_nfs3_status(tvb, offset, tree, &status);
5870
0
  switch (status) {
5871
0
    case 0:
5872
0
      offset = dissect_nfs3_post_op_attr(tvb, offset, pinfo, tree,
5873
0
        "obj_attributes");
5874
0
      offset = dissect_rpc_uint64(tvb, tree, hf_nfs3_fsstat_resok_tbytes,
5875
0
        offset);
5876
0
      offset = dissect_rpc_uint64(tvb, tree, hf_nfs3_fsstat_resok_fbytes,
5877
0
        offset);
5878
0
      offset = dissect_rpc_uint64(tvb, tree, hf_nfs3_fsstat_resok_abytes,
5879
0
        offset);
5880
0
      offset = dissect_rpc_uint64(tvb, tree, hf_nfs3_fsstat_resok_tfiles,
5881
0
        offset);
5882
0
      offset = dissect_rpc_uint64(tvb, tree, hf_nfs3_fsstat_resok_ffiles,
5883
0
        offset);
5884
0
      offset = dissect_rpc_uint64(tvb, tree, hf_nfs3_fsstat_resok_afiles,
5885
0
        offset);
5886
0
      invarsec = tvb_get_ntohl(tvb, offset + 0);
5887
0
      if (tree)
5888
0
        proto_tree_add_uint(tree, hf_nfs3_fsstat_invarsec, tvb,
5889
0
        offset+0, 4, invarsec);
5890
0
      offset += 4;
5891
5892
0
      proto_item_append_text(tree, ", FSSTAT Reply");
5893
0
    break;
5894
0
    default:
5895
0
      offset = dissect_nfs3_post_op_attr(tvb, offset, pinfo, tree,
5896
0
        "obj_attributes");
5897
5898
0
      err = val_to_str_ext(pinfo->pool, status, &names_nfs3_status_ext, "Unknown error: %u");
5899
0
      col_append_fstr(pinfo->cinfo, COL_INFO, " Error: %s", err);
5900
0
      proto_item_append_text(tree, ", FSSTAT Reply  Error: %s", err);
5901
0
    break;
5902
0
  }
5903
5904
0
  return offset;
5905
0
}
5906
5907
5908
16
#define FSF3_LINK        0x00000001
5909
16
#define FSF3_SYMLINK     0x00000002
5910
16
#define FSF3_HOMOGENEOUS 0x00000008
5911
16
#define FSF3_CANSETTIME  0x00000010
5912
5913
static const true_false_string tfs_nfs_pathconf =
5914
  { "is valid for all files", "should be get for every single file" };
5915
5916
5917
/* NFSv3 RFC 1813, Page 86..90 */
5918
static int
5919
dissect_nfs3_fsinfo_call(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
5920
0
{
5921
0
  uint32_t hash = 0;
5922
0
  unsigned offset = 0;
5923
5924
0
  offset = dissect_nfs3_fh(tvb, offset, pinfo, tree, "object", &hash, (rpc_call_info_value*)data);
5925
5926
0
  col_append_fstr(pinfo->cinfo, COL_INFO, ", FH: 0x%08x", hash);
5927
0
  proto_item_append_text(tree, ", FSINFO Call DH: 0x%08x", hash);
5928
0
  return offset;
5929
0
}
5930
5931
5932
static int
5933
dissect_nfs3_fsinfo_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
5934
0
{
5935
0
  uint32_t      status;
5936
0
  static int * const properties[] = {
5937
0
    &hf_nfs3_fsinfo_properties_setattr,
5938
0
    &hf_nfs3_fsinfo_properties_pathconf,
5939
0
    &hf_nfs3_fsinfo_properties_symlinks,
5940
0
    &hf_nfs3_fsinfo_properties_hardlinks,
5941
0
    NULL
5942
0
  };
5943
0
  unsigned offset = 0;
5944
5945
0
  offset = dissect_nfs3_status(tvb, offset, tree, &status);
5946
0
  switch (status) {
5947
0
    case 0:
5948
0
      offset = dissect_nfs3_post_op_attr(tvb, offset, pinfo, tree,
5949
0
        "obj_attributes");
5950
0
      proto_tree_add_item(tree, hf_nfs3_fsinfo_rtmax, tvb, offset, 4, ENC_BIG_ENDIAN);
5951
0
      offset += 4;
5952
0
      proto_tree_add_item(tree, hf_nfs3_fsinfo_rtpref, tvb, offset, 4, ENC_BIG_ENDIAN);
5953
0
      offset += 4;
5954
0
      proto_tree_add_item(tree, hf_nfs3_fsinfo_rtmult, tvb, offset, 4, ENC_BIG_ENDIAN);
5955
0
      offset += 4;
5956
0
      proto_tree_add_item(tree, hf_nfs3_fsinfo_wtmax, tvb, offset, 4, ENC_BIG_ENDIAN);
5957
0
      offset += 4;
5958
0
      proto_tree_add_item(tree, hf_nfs3_fsinfo_wtpref, tvb, offset, 4, ENC_BIG_ENDIAN);
5959
0
      offset += 4;
5960
0
      proto_tree_add_item(tree, hf_nfs3_fsinfo_wtmult, tvb, offset, 4, ENC_BIG_ENDIAN);
5961
0
      offset += 4;
5962
0
      proto_tree_add_item(tree, hf_nfs3_fsinfo_dtpref, tvb, offset, 4, ENC_BIG_ENDIAN);
5963
0
      offset += 4;
5964
5965
0
      offset = dissect_rpc_uint64(tvb, tree,  hf_nfs3_fsinfo_maxfilesize, offset);
5966
0
      offset = dissect_nfstime3(tvb, offset, tree, hf_nfs_dtime, hf_nfs_dtime_sec,
5967
0
        hf_nfs_dtime_nsec);
5968
5969
0
      proto_tree_add_bitmask(tree, tvb, offset, hf_nfs3_fsinfo_properties, ett_nfs3_fsinfo_properties, properties, ENC_BIG_ENDIAN);
5970
0
      offset += 4;
5971
5972
0
      proto_item_append_text(tree, ", FSINFO Reply");
5973
0
      break;
5974
0
    default:
5975
0
    {
5976
0
      const char *err;
5977
5978
0
      offset = dissect_nfs3_post_op_attr(tvb, offset, pinfo, tree,
5979
0
        "obj_attributes");
5980
5981
0
      err = val_to_str_ext(pinfo->pool, status, &names_nfs3_status_ext, "Unknown error: %u");
5982
0
      col_append_fstr(pinfo->cinfo, COL_INFO, " Error: %s", err);
5983
0
      proto_item_append_text(tree, ", FSINFO Reply  Error: %s", err);
5984
0
      break;
5985
0
    }
5986
0
  }
5987
5988
0
  return offset;
5989
0
}
5990
5991
5992
/* NFSv3 RFC 1813, Page 90..92 */
5993
static int
5994
dissect_nfs3_pathconf_call(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
5995
0
{
5996
0
  uint32_t hash = 0;
5997
0
  unsigned offset = 0;
5998
5999
0
  offset = dissect_nfs3_fh(tvb, offset, pinfo, tree, "object", &hash, (rpc_call_info_value*)data);
6000
6001
0
  col_append_fstr(pinfo->cinfo, COL_INFO, ", FH: 0x%08x", hash);
6002
0
  proto_item_append_text(tree, ", PATHCONF Call DH: 0x%08x", hash);
6003
0
  return offset;
6004
0
}
6005
6006
6007
static int
6008
dissect_nfs3_pathconf_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
6009
0
{
6010
0
  uint32_t      status;
6011
0
  uint32_t      linkmax;
6012
0
  uint32_t      name_max;
6013
0
  const char *err;
6014
0
  unsigned offset = 0;
6015
6016
0
  offset = dissect_nfs3_status(tvb, offset, tree, &status);
6017
0
  switch (status) {
6018
0
    case 0:
6019
0
      offset = dissect_nfs3_post_op_attr(tvb, offset, pinfo, tree,
6020
0
        "obj_attributes");
6021
0
      linkmax = tvb_get_ntohl(tvb, offset + 0);
6022
0
      if (tree)
6023
0
        proto_tree_add_uint(tree, hf_nfs3_pathconf_linkmax, tvb,
6024
0
        offset+0, 4, linkmax);
6025
0
      offset += 4;
6026
0
      name_max = tvb_get_ntohl(tvb, offset + 0);
6027
0
      if (tree)
6028
0
        proto_tree_add_uint(tree, hf_nfs3_pathconf_name_max, tvb,
6029
0
        offset+0, 4, name_max);
6030
0
      offset += 4;
6031
0
      offset = dissect_rpc_bool(tvb, tree,
6032
0
        hf_nfs3_pathconf_no_trunc, offset);
6033
0
      offset = dissect_rpc_bool(tvb, tree,
6034
0
        hf_nfs3_pathconf_chown_restricted, offset);
6035
0
      offset = dissect_rpc_bool(tvb, tree,
6036
0
        hf_nfs3_pathconf_case_insensitive, offset);
6037
0
      offset = dissect_rpc_bool(tvb, tree,
6038
0
        hf_nfs3_pathconf_case_preserving, offset);
6039
6040
0
      proto_item_append_text(tree, ", PATHCONF Reply");
6041
0
    break;
6042
0
    default:
6043
0
      offset = dissect_nfs3_post_op_attr(tvb, offset, pinfo, tree,
6044
0
        "obj_attributes");
6045
6046
0
      err = val_to_str_ext(pinfo->pool, status, &names_nfs3_status_ext, "Unknown error: %u");
6047
0
      col_append_fstr(pinfo->cinfo, COL_INFO, " Error: %s", err);
6048
0
      proto_item_append_text(tree, ", PATHCONF Reply  Error: %s", err);
6049
0
    break;
6050
0
  }
6051
6052
0
  return offset;
6053
0
}
6054
6055
6056
/* NFSv3 RFC 1813, Page 92..95 */
6057
static int
6058
dissect_nfs3_commit_call(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
6059
0
{
6060
0
  uint32_t hash = 0;
6061
0
  unsigned offset = 0;
6062
6063
0
  offset = dissect_nfs3_fh(tvb, offset, pinfo, tree, "file", &hash, (rpc_call_info_value*)data);
6064
0
  offset = dissect_rpc_uint64(tvb, tree, hf_nfs3_offset, offset);
6065
0
  offset = dissect_rpc_uint32(tvb, tree, hf_nfs3_count, offset);
6066
6067
0
  col_append_fstr(pinfo->cinfo, COL_INFO, ", FH: 0x%08x", hash);
6068
0
  proto_item_append_text(tree, ", COMMIT Call FH: 0x%08x", hash);
6069
6070
0
  return offset;
6071
0
}
6072
6073
6074
/* NFSv3 RFC 1813, Page 92..95 */
6075
static int
6076
dissect_nfs3_commit_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
6077
0
{
6078
0
  uint32_t      status;
6079
0
  const char *err;
6080
0
  unsigned offset = 0;
6081
6082
0
  offset = dissect_nfs3_status(tvb, offset, tree, &status);
6083
0
  switch (status) {
6084
0
    case 0:
6085
0
      offset = dissect_wcc_data  (tvb, offset, pinfo, tree, "file_wcc");
6086
0
      offset = dissect_nfs3_write_verf(tvb, offset, tree);
6087
6088
0
      proto_item_append_text(tree, ", COMMIT Reply");
6089
0
    break;
6090
0
    default:
6091
0
      offset = dissect_wcc_data(tvb, offset, pinfo, tree, "file_wcc");
6092
6093
0
      err = val_to_str_ext(pinfo->pool, status, &names_nfs3_status_ext, "Unknown error: %u");
6094
0
      col_append_fstr(pinfo->cinfo, COL_INFO, " Error: %s", err);
6095
0
      proto_item_append_text(tree, ", COMMIT Reply  Error: %s", err);
6096
0
    break;
6097
0
  }
6098
6099
0
  return offset;
6100
0
}
6101
6102
/*************************************************************************************
6103
*  NFS Version 4.1, RFC 5661.  Note that error 19 NFS4ERR_NOTDIR defined in RFC 3010
6104
*  was eliminated in RFC 3530 (NFSv4) which replaced RFC 3010 and remains so in
6105
*  RFC 5661. Nevertheless, it has been included in this table in the event that some
6106
*  RFC 3010 implementations still exist out there.
6107
**************************************************************************************/
6108
static const value_string names_nfs4_status[] = {
6109
  { 0,  "NFS4_OK"         },
6110
  { 1,  "NFS4ERR_PERM"          },
6111
  { 2,  "NFS4ERR_NOENT"         },
6112
  { 5,  "NFS4ERR_IO"          },
6113
  { 6,  "NFS4ERR_NXIO"          },
6114
  { 13, "NFS4ERR_ACCESS"        },
6115
  { 17, "NFS4ERR_EXIST"         },
6116
  { 18, "NFS4ERR_XDEV"          },
6117
  { 19, "NFS4ERR_DQUOT"         },
6118
  { 20, "NFS4ERR_NOTDIR"        },
6119
  { 21, "NFS4ERR_ISDIR"         },
6120
  { 22, "NFS4ERR_INVAL"         },
6121
  { 27, "NFS4ERR_FBIG"          },
6122
  { 28, "NFS4ERR_NOSPC"         },
6123
  { 30, "NFS4ERR_ROFS"          },
6124
  { 31, "NFS4ERR_MLINK"         },
6125
  { 63, "NFS4ERR_NAMETOOLONG"       },
6126
  { 66, "NFS4ERR_NOTEMPTY"        },
6127
  { 69, "NFS4ERR_DQUOT"         },
6128
  { 70, "NFS4ERR_STALE"         },
6129
  { 10001,  "NFS4ERR_BADHANDLE"       },
6130
  { 10003,  "NFS4ERR_BAD_COOKIE"        },
6131
  { 10004,  "NFS4ERR_NOTSUPP"       },
6132
  { 10005,  "NFS4ERR_TOOSMALL"        },
6133
  { 10006,  "NFS4ERR_SERVERFAULT"       },
6134
  { 10007,  "NFS4ERR_BADTYPE"       },
6135
  { 10008,  "NFS4ERR_DELAY"         },
6136
  { 10009,  "NFS4ERR_SAME"          },
6137
  { 10010,  "NFS4ERR_DENIED"        },
6138
  { 10011,  "NFS4ERR_EXPIRED"       },
6139
  { 10012,  "NFS4ERR_LOCKED"        },
6140
  { 10013,  "NFS4ERR_GRACE"         },
6141
  { 10014,  "NFS4ERR_FHEXPIRED"       },
6142
  { 10015,  "NFS4ERR_SHARE_DENIED"        },
6143
  { 10016,  "NFS4ERR_WRONGSEC"        },
6144
  { 10017,  "NFS4ERR_CLID_INUSE"        },
6145
  { 10018,  "NFS4ERR_RESOURCE"        },
6146
  { 10019,  "NFS4ERR_MOVED"         },
6147
  { 10020,  "NFS4ERR_NOFILEHANDLE"        },
6148
  { 10021,  "NFS4ERR_MINOR_VERS_MISMATCH"     },
6149
  { 10022,  "NFS4ERR_STALE_CLIENTID"      },
6150
  { 10023,  "NFS4ERR_STALE_STATEID"       },
6151
  { 10024,  "NFS4ERR_OLD_STATEID"       },
6152
  { 10025,  "NFS4ERR_BAD_STATEID"       },
6153
  { 10026,  "NFS4ERR_BAD_SEQID"       },
6154
  { 10027,  "NFS4ERR_NOT_SAME"        },
6155
  { 10028,  "NFS4ERR_LOCK_RANGE"        },
6156
  { 10029,  "NFS4ERR_SYMLINK"       },
6157
  { 10030,  "NFS4ERR_READDIR_NOSPC"       },
6158
  { 10031,  "NFS4ERR_LEASE_MOVED"       },
6159
  { 10032,  "NFS4ERR_ATTRNOTSUPP"       },
6160
  { 10033,  "NFS4ERR_NO_GRACE"        },
6161
  { 10034,  "NFS4ERR_RECLAIM_BAD"       },
6162
  { 10035,  "NFS4ERR_RECLAIM_CONFLICT"      },
6163
  { 10036,  "NFS4ERR_BADXDR"        },
6164
  { 10037,  "NFS4ERR_LOCKS_HELD"        },
6165
  { 10038,  "NFS4ERR_OPENMODE"        },
6166
  { 10039,  "NFS4ERR_BADOWNER"        },
6167
  { 10040,  "NFS4ERR_BADCHAR"       },
6168
  { 10041,  "NFS4ERR_BADNAME"       },
6169
  { 10042,  "NFS4ERR_BAD_RANGE"       },
6170
  { 10043,  "NFS4ERR_LOCK_NOTSUPP"        },
6171
  { 10044,  "NFS4ERR_OP_ILLEGAL"        },
6172
  { 10045,  "NFS4ERR_DEADLOCK"        },
6173
  { 10046,  "NFS4ERR_FILE_OPEN"       },
6174
  { 10047,  "NFS4ERR_ADMIN_REVOKED"       },
6175
  { 10048,  "NFS4ERR_CB_PATH_DOWN"        },
6176
  { 10049,  "NFS4ERR_BADIOMODE"       },
6177
  { 10050,  "NFS4ERR_BADLAYOUT"       },
6178
  { 10051,  "NFS4ERR_BAD_SESSION_DIGEST"      },
6179
  { 10052,  "NFS4ERR_BADSESSION"        },
6180
  { 10053,  "NFS4ERR_BADSLOT"       },
6181
  { 10054,  "NFS4ERR_COMPLETE_ALREADY"      },
6182
  { 10055,  "NFS4ERR_CONN_NOT_BOUND_TO_SESSION" },
6183
  { 10056,  "NFS4ERR_DELEG_ALREADY_WANTED"      },
6184
  { 10057,  "NFS4ERR_BACK_CHAN_BUSY"      },
6185
  { 10058,  "NFS4ERR_LAYOUTTRYLATER"      },
6186
  { 10059,  "NFS4ERR_LAYOUTUNAVAILABLE"     },
6187
  { 10060,  "NFS4ERR_NOMATCHING_LAYOUT"     },
6188
  { 10061,  "NFS4ERR_RECALLCONFLICT"      },
6189
  { 10062,  "NFS4ERR_UNKNOWN_LAYOUTTYPE"      },
6190
  { 10063,  "NFS4ERR_SEQ_MISORDERED"      },
6191
  { 10064,  "NFS4ERR_SEQUENCE_POS"        },
6192
  { 10065,  "NFS4ERR_REQ_TOO_BIG"       },
6193
  { 10066,  "NFS4ERR_REP_TOO_BIG"       },
6194
  { 10067,  "NFS4ERR_REP_TOO_BIG_TO_CACHE"      },
6195
  { 10068,  "NFS4ERR_RETRY_UNCACHED_REP"      },
6196
  { 10069,  "NFS4ERR_UNSAFE_COMPOUND"     },
6197
  { 10070,  "NFS4ERR_TOO_MANY_OPS"        },
6198
  { 10071,  "NFS4ERR_OP_NOT_IN_SESSION"     },
6199
  { 10072,  "NFS4ERR_HASH_ALG_UNSUPP"     },
6200
  { 10073,  "NFS4ERR_CONN_BINDING_NOT_ENFORCED" },
6201
  { 10074,  "NFS4ERR_CLIENTID_BUSY"       },
6202
  { 10075,  "NFS4ERR_PNFS_IO_HOLE"        },
6203
  { 10076,  "NFS4ERR_SEQ_FALSE_RETRY"     },
6204
  { 10077,  "NFS4ERR_BAD_HIGH_SLOT"       },
6205
  { 10078,  "NFS4ERR_DEADSESSION"       },
6206
  { 10079,  "NFS4ERR_ENCR_ALG_UNSUPP"     },
6207
  { 10080,  "NFS4ERR_PNFS_NO_LAYOUT"      },
6208
  { 10081,  "NFS4ERR_NOT_ONLY_OP"       },
6209
  { 10082,  "NFS4ERR_WRONG_CRED"        },
6210
  { 10083,  "NFS4ERR_WRONG_TYPE"        },
6211
  { 10084,  "NFS4ERR_DIRDELEG_UNAVAIL"      },
6212
  { 10085,  "NFS4ERR_REJECT_DELEG"        },
6213
  { 10086,  "NFS4ERR_RETURNCONFLICT"      },
6214
  { 10087,  "NFS4ERR_DELEG_REVOKED"       },
6215
  { 10088,  "NFS4ERR_PARTNER_NOTSUPP"     },
6216
  { 10089,  "NFS4ERR_PARTNER_NO_AUTH"     },
6217
  { 10090,  "NFS4ERR_UNION_NOTSUPP"       },
6218
  { 10091,  "NFS4ERR_OFFLOAD_DENIED"      },
6219
  { 10092,  "NFS4ERR_WRONG_LFS"       },
6220
  { 10093,  "NFS4ERR_BADLABEL"        },
6221
  { 10094,  "NFS4ERR_OFFLOAD_NO_REQS"     },
6222
  { 10095,  "NFS4ERR_NOXATTR"       },
6223
  { 10096,  "NFS4ERR_XATTR2BIG"       },
6224
  { 0,  NULL }
6225
};
6226
static value_string_ext names_nfs4_status_ext = VALUE_STRING_EXT_INIT(names_nfs4_status);
6227
6228
static const value_string fattr4_names[] = {
6229
0
#define FATTR4_SUPPORTED_ATTRS     0
6230
  { FATTR4_SUPPORTED_ATTRS,    "Supported_Attrs"  },
6231
0
#define FATTR4_TYPE                1
6232
  { FATTR4_TYPE,               "Type"},
6233
0
#define FATTR4_FH_EXPIRE_TYPE      2
6234
  { FATTR4_FH_EXPIRE_TYPE,     "FH_Expire_Type" },
6235
0
#define FATTR4_CHANGE              3
6236
  { FATTR4_CHANGE,             "Change"},
6237
0
#define FATTR4_SIZE                4
6238
  { FATTR4_SIZE,             "Size" },
6239
0
#define FATTR4_LINK_SUPPORT        5
6240
  { FATTR4_LINK_SUPPORT,       "Link_Support" },
6241
0
#define FATTR4_SYMLINK_SUPPORT     6
6242
  { FATTR4_SYMLINK_SUPPORT,    "Symlink_Support"  },
6243
0
#define FATTR4_NAMED_ATTR          7
6244
  { FATTR4_NAMED_ATTR,         "Named_Attr" },
6245
0
#define FATTR4_FSID                8
6246
  { FATTR4_FSID,               "FSID" },
6247
0
#define FATTR4_UNIQUE_HANDLES      9
6248
  { FATTR4_UNIQUE_HANDLES,     "Unique_Handles" },
6249
0
#define FATTR4_LEASE_TIME          10
6250
  { FATTR4_LEASE_TIME,         "Lease_Time" },
6251
0
#define FATTR4_RDATTR_ERROR        11
6252
  { FATTR4_RDATTR_ERROR,       "RDAttr_Error" },
6253
0
#define FATTR4_ACL                 12
6254
  { FATTR4_ACL,                "ACL"  },
6255
0
#define FATTR4_ACLSUPPORT          13
6256
  { FATTR4_ACLSUPPORT,         "ACLSupport" },
6257
0
#define FATTR4_ARCHIVE             14
6258
  { FATTR4_ARCHIVE,            "Archive"  },
6259
0
#define FATTR4_CANSETTIME          15
6260
  { FATTR4_CANSETTIME,         "CanSetTime" },
6261
0
#define FATTR4_CASE_INSENSITIVE    16
6262
  { FATTR4_CASE_INSENSITIVE,   "Case_Insensitive" },
6263
0
#define FATTR4_CASE_PRESERVING     17
6264
  { FATTR4_CASE_PRESERVING,    "Case_Preserving"  },
6265
0
#define FATTR4_CHOWN_RESTRICTED    18
6266
  { FATTR4_CHOWN_RESTRICTED,   "Chown_Restricted" },
6267
0
#define FATTR4_FILEHANDLE          19
6268
  { FATTR4_FILEHANDLE,         "Filehandle" },
6269
0
#define FATTR4_FILEID              20
6270
  { FATTR4_FILEID,             "FileId" },
6271
0
#define FATTR4_FILES_AVAIL         21
6272
  { FATTR4_FILES_AVAIL,        "Files_Avail"  },
6273
0
#define FATTR4_FILES_FREE          22
6274
  { FATTR4_FILES_FREE,         "Files_Free" },
6275
0
#define FATTR4_FILES_TOTAL         23
6276
  { FATTR4_FILES_TOTAL,        "Files_Total"  },
6277
0
#define FATTR4_FS_LOCATIONS        24
6278
  { FATTR4_FS_LOCATIONS,       "FS_Locations" },
6279
0
#define FATTR4_HIDDEN              25
6280
  { FATTR4_HIDDEN,             "Hidden" },
6281
0
#define FATTR4_HOMOGENEOUS         26
6282
  { FATTR4_HOMOGENEOUS,        "Homogeneous"  },
6283
0
#define FATTR4_MAXFILESIZE         27
6284
  { FATTR4_MAXFILESIZE,        "MaxFileSize"  },
6285
0
#define FATTR4_MAXLINK             28
6286
  { FATTR4_MAXLINK,            "MaxLink"  },
6287
0
#define FATTR4_MAXNAME             29
6288
  { FATTR4_MAXNAME,            "MaxName"  },
6289
0
#define FATTR4_MAXREAD             30
6290
  { FATTR4_MAXREAD,            "MaxRead"  },
6291
0
#define FATTR4_MAXWRITE            31
6292
  { FATTR4_MAXWRITE,           "MaxWrite" },
6293
0
#define FATTR4_MIMETYPE            32
6294
  { FATTR4_MIMETYPE,           "MimeType" },
6295
0
#define FATTR4_MODE                33
6296
  { FATTR4_MODE,               "Mode" },
6297
0
#define FATTR4_NO_TRUNC            34
6298
  { FATTR4_NO_TRUNC,           "No_Trunc" },
6299
0
#define FATTR4_NUMLINKS            35
6300
  { FATTR4_NUMLINKS,           "NumLinks" },
6301
0
#define FATTR4_OWNER               36
6302
  { FATTR4_OWNER,              "Owner"  },
6303
0
#define FATTR4_OWNER_GROUP         37
6304
  { FATTR4_OWNER_GROUP,        "Owner_Group"  },
6305
0
#define FATTR4_QUOTA_AVAIL_HARD    38
6306
  { FATTR4_QUOTA_AVAIL_HARD,   "Quota_Avail_Hard" },
6307
0
#define FATTR4_QUOTA_AVAIL_SOFT    39
6308
  { FATTR4_QUOTA_AVAIL_SOFT,   "Quota_Avail_Soft" },
6309
0
#define FATTR4_QUOTA_USED          40
6310
  { FATTR4_QUOTA_USED,         "Quota_Used" },
6311
0
#define FATTR4_RAWDEV              41
6312
  { FATTR4_RAWDEV,             "RawDev" },
6313
0
#define FATTR4_SPACE_AVAIL         42
6314
  { FATTR4_SPACE_AVAIL,        "Space_Avail"  },
6315
0
#define FATTR4_SPACE_FREE          43
6316
  { FATTR4_SPACE_FREE,         "Space_Free" },
6317
0
#define FATTR4_SPACE_TOTAL         44
6318
  { FATTR4_SPACE_TOTAL,        "Space_Total"  },
6319
0
#define FATTR4_SPACE_USED          45
6320
  { FATTR4_SPACE_USED,         "Space_Used" },
6321
0
#define FATTR4_SYSTEM              46
6322
  { FATTR4_SYSTEM,             "System" },
6323
0
#define FATTR4_TIME_ACCESS         47
6324
  { FATTR4_TIME_ACCESS,        "Time_Access"  },
6325
0
#define FATTR4_TIME_ACCESS_SET     48
6326
  { FATTR4_TIME_ACCESS_SET,    "Time_Access_Set"  },
6327
0
#define FATTR4_TIME_BACKUP         49
6328
  { FATTR4_TIME_BACKUP,        "Time_Backup"  },
6329
0
#define FATTR4_TIME_CREATE         50
6330
  { FATTR4_TIME_CREATE,        "Time_Create"  },
6331
0
#define FATTR4_TIME_DELTA          51
6332
  { FATTR4_TIME_DELTA,         "Time_Delta" },
6333
0
#define FATTR4_TIME_METADATA       52
6334
  { FATTR4_TIME_METADATA,      "Time_Metadata"  },
6335
0
#define FATTR4_TIME_MODIFY         53
6336
  { FATTR4_TIME_MODIFY,        "Time_Modify"  },
6337
0
#define FATTR4_TIME_MODIFY_SET     54
6338
  { FATTR4_TIME_MODIFY_SET,    "Time_Modify_Set"  },
6339
0
#define FATTR4_MOUNTED_ON_FILEID   55
6340
  { FATTR4_MOUNTED_ON_FILEID,  "Mounted_on_FileId"  },
6341
0
#define FATTR4_DIR_NOTIF_DELAY     56
6342
  { FATTR4_DIR_NOTIF_DELAY,    "Dir_Notif_Delay"  },
6343
0
#define FATTR4_DIRENT_NOTIF_DELAY  57
6344
  { FATTR4_DIRENT_NOTIF_DELAY, "Dirent_Notif_Delay" },
6345
0
#define FATTR4_DACL                58
6346
  { FATTR4_DACL,               "DACL"                },
6347
0
#define FATTR4_SACL                59
6348
  { FATTR4_SACL,               "SACL"                },
6349
#define FATTR4_CHANGE_POLICY       60
6350
  { FATTR4_CHANGE_POLICY,      "Change_Policy"    },
6351
#define FATTR4_FS_STATUS           61
6352
  { FATTR4_FS_STATUS,          "FS_Status"      },
6353
0
#define FATTR4_FS_LAYOUT_TYPE      62
6354
  { FATTR4_FS_LAYOUT_TYPE,     "FS_Layout_Type"   },
6355
#define FATTR4_LAYOUT_HINT         63
6356
  { FATTR4_LAYOUT_HINT,        "Layout_hint"    },
6357
#define FATTR4_LAYOUT_TYPE         64
6358
  { FATTR4_LAYOUT_TYPE,        "Layout_type"    },
6359
0
#define FATTR4_LAYOUT_BLKSIZE      65
6360
  { FATTR4_LAYOUT_BLKSIZE,     "Layout_blksize"   },
6361
#define FATTR4_LAYOUT_ALIGNMENT    66
6362
  { FATTR4_LAYOUT_ALIGNMENT,   "Layout_alignment" },
6363
#define FATTR4_FS_LOCATIONS_INFO   67
6364
  { FATTR4_FS_LOCATIONS_INFO,  "FS_Locations_info"  },
6365
0
#define FATTR4_MDSTHRESHOLD        68
6366
  { FATTR4_MDSTHRESHOLD,       "MDS_Threshold"    },
6367
#define FATTR4_RETENTION_GET       69
6368
  { FATTR4_RETENTION_GET,      "Retention_Get"    },
6369
#define FATTR4_RETENTION_SET       70
6370
  { FATTR4_RETENTION_SET,      "Retention_Set"    },
6371
#define FATTR4_RETENTEVT_GET       71
6372
  { FATTR4_RETENTEVT_GET,      "RetentEvt_Get"    },
6373
#define FATTR4_RETENTEVT_SET       72
6374
  { FATTR4_RETENTEVT_SET,      "RetentEvt_Set"    },
6375
#define FATTR4_RETENTION_HOLD      73
6376
  { FATTR4_RETENTION_HOLD,     "Retention_Hold"   },
6377
#define FATTR4_MODE_SET_MASKED     74
6378
  { FATTR4_MODE_SET_MASKED,    "Mode_Set_Masked"  },
6379
0
#define FATTR4_SUPPATTR_EXCLCREAT  75
6380
  { FATTR4_SUPPATTR_EXCLCREAT, "Suppattr_ExclCreat" },
6381
0
#define FATTR4_FS_CHARSET_CAP      76
6382
  { FATTR4_FS_CHARSET_CAP,     "FS_Charset_Cap"   },
6383
0
#define FATTR4_CLONE_BLOCKSIZE     77
6384
  { FATTR4_CLONE_BLOCKSIZE,    "Clone_Block_Size"   },
6385
0
#define FATTR4_SPACE_FREED         78
6386
  { FATTR4_SPACE_FREED,        "Space_Freed"    },
6387
0
#define FATTR4_CHANGE_ATTR_TYPE    79
6388
  { FATTR4_CHANGE_ATTR_TYPE,   "Change_Attr_Type"   },
6389
0
#define FATTR4_SECURITY_LABEL      80
6390
  { FATTR4_SECURITY_LABEL,     "Security_Label"   },
6391
0
#define FATTR4_MODE_UMASK          81
6392
  { FATTR4_MODE_UMASK,         "Mode_Umask"     },
6393
0
#define FATTR4_XATTR_SUPPORT       82
6394
  { FATTR4_XATTR_SUPPORT,      "Xattr_Support"    },
6395
0
#define FATTR4_OFFLINE             83
6396
  { FATTR4_OFFLINE,            "Offline"                    },
6397
0
#define FATTR4_TIME_DELEG_ACCESS   84
6398
  { FATTR4_TIME_DELEG_ACCESS,  "Time_Deleg_Access"          },
6399
0
#define FATTR4_TIME_DELEG_MODIFY   85
6400
  { FATTR4_TIME_DELEG_MODIFY,  "Time_Deleg_Modify"          },
6401
  { 0,  NULL  }
6402
};
6403
static value_string_ext fattr4_names_ext = VALUE_STRING_EXT_INIT(fattr4_names);
6404
6405
static unsigned
6406
dissect_nfs4_status(tvbuff_t *tvb, unsigned offset, proto_tree *tree, uint32_t *status)
6407
0
{
6408
0
  uint32_t      stat;
6409
0
  proto_item *stat_item;
6410
6411
0
  proto_tree_add_item_ret_uint(tree, hf_nfs4_status, tvb, offset+0, 4, ENC_BIG_ENDIAN, &stat);
6412
0
  stat_item = proto_tree_add_uint(tree, hf_nfs_status, tvb, offset+0, 4, stat);
6413
0
  proto_item_set_hidden(stat_item);
6414
6415
0
  if (status)
6416
0
    *status = stat;
6417
6418
0
  return offset + 4;
6419
0
}
6420
6421
6422
static unsigned
6423
dissect_nfs_utf8string(tvbuff_t *tvb, packet_info* pinfo, unsigned offset,
6424
           proto_tree *tree, int hf, const char **string_ret)
6425
0
{
6426
  /* TODO: this dissector is subject to change; do not remove */
6427
0
  return dissect_rpc_string(tvb, pinfo, tree, hf, offset, string_ret);
6428
0
}
6429
6430
6431
/*
6432
 *  Generic function to dissect bitmap4 and optionally its corresponding
6433
 *  opaque data.
6434
 */
6435
static unsigned
6436
dissect_nfs4_bitmap(tvbuff_t *tvb, unsigned offset, packet_info *pinfo, proto_tree *tree,
6437
  rpc_call_info_value *civ, uint32_t opcode, uint32_t fh_idx,
6438
  nfs4_bitmap_info_t *bitmap_info, nfs4_bitmap_type_t type,
6439
  const char *name)
6440
0
{
6441
0
  unsigned attr_offset;
6442
0
  int hf_item = 0;
6443
0
  uint32_t i, j;
6444
0
  uint32_t count;
6445
0
  uint32_t bitmap;
6446
0
  uint32_t bit_num;
6447
0
  uint32_t bit_set;
6448
0
  uint32_t num_bitmaps;
6449
0
  uint32_t end_offset;
6450
0
  uint32_t mask_offset;
6451
0
  uint32_t opaque_offset;
6452
0
  uint32_t opaque_length = 0;
6453
0
  uint32_t opaque_padding = 0;
6454
0
  bool no_idx = false;
6455
0
  bool first_attr = false;
6456
0
  bool skip_attr_values = false;
6457
6458
0
  header_field_info *hfinfo;
6459
6460
0
  proto_item *name_tree   = tree;
6461
0
  proto_item *bitmap_item = NULL;
6462
0
  proto_tree *bitmap_tree = NULL;
6463
0
  proto_item *attr_item   = NULL;
6464
0
  proto_tree *attr_tree   = NULL;
6465
0
  proto_item *attr_count  = NULL;
6466
6467
  /* Get the number of bitmap masks */
6468
0
  num_bitmaps = tvb_get_ntohl(tvb, offset);
6469
0
  mask_offset = offset + 4;  /* Offset of first bitmap mask */
6470
0
  opaque_offset = mask_offset + 4*num_bitmaps;
6471
6472
0
  if (type == NFS4_BITMAP_VALUES) {
6473
    /* Get the length of opaque including padding */
6474
0
    opaque_length = tvb_get_ntohl(tvb, opaque_offset);
6475
0
    opaque_padding = WS_PADDING_TO_4(opaque_length);
6476
0
    opaque_offset += 4;  /* Starting offset of bitmap values */
6477
0
  }
6478
6479
  /* Offset after the bitmap mask and values regardless of type */
6480
0
  end_offset = opaque_offset + opaque_length + opaque_padding;
6481
6482
0
  if (name != NULL) {
6483
    /* Add subtree if name is given -- all bitmap data will be
6484
     * under this main tree */
6485
0
    name_tree = proto_tree_add_subtree(tree, tvb, offset, end_offset - offset,
6486
0
              ett_nfs4_bitmap, NULL, name);
6487
0
  }
6488
6489
0
  if (num_bitmaps > MAX_BITMAPS) {
6490
0
    proto_tree_add_uint(name_tree, hf_nfs4_huge_bitmap_length, tvb, offset, 4, num_bitmaps);
6491
0
    expert_add_info(pinfo, name_tree, &ei_nfs_too_many_bitmaps);
6492
0
    return end_offset;
6493
0
  } else if (bitmap_info->hf_mask_count) {
6494
    /* Display the number of bitmap masks if the label is given */
6495
0
    proto_tree_add_uint(name_tree, *bitmap_info->hf_mask_count, tvb, offset, 4, num_bitmaps);
6496
0
  }
6497
6498
  /* Count the number of non-zero masks */
6499
0
  count = 0;
6500
0
  for (i = 0; i < num_bitmaps; i++) {
6501
0
    bitmap = tvb_get_ntohl(tvb, mask_offset + 4*i);
6502
0
    if (bitmap > 0)
6503
0
      count++;
6504
0
  }
6505
6506
  /* If there is only one non-zero bitmap, don't display the bitmap index "[x]". */
6507
0
  if (count <= 1)
6508
0
    no_idx = true;
6509
6510
  /* Set the offset to the first value */
6511
0
  offset = opaque_offset;
6512
6513
  /* set i to num_bitmaps if each bitmap is zero */
6514
0
  for (i = 0; i < num_bitmaps; i++) {
6515
0
    bitmap = tvb_get_ntohl(tvb, mask_offset + 4*i);
6516
0
    if (bitmap)
6517
0
      break;
6518
0
  }
6519
6520
  /* Show mask label when the number of bitmap masks is zero or each bitmap is zero */
6521
0
  if (num_bitmaps == i && name == NULL && name_tree && bitmap_info->hf_mask_label) {
6522
    /* Get header field to add the mask index to the field name */
6523
0
    hfinfo = proto_registrar_get_nth(*bitmap_info->hf_mask_label);
6524
0
    bitmap_tree = proto_tree_add_subtree_format(name_tree, tvb, mask_offset-4, 4 + 4*num_bitmaps,
6525
0
            ett_nfs4_bitmap, NULL, "%s:", hfinfo->name);
6526
0
  }
6527
6528
0
  for (i = 0; i < num_bitmaps; i++) {
6529
0
    bitmap = tvb_get_ntohl(tvb, mask_offset);
6530
6531
0
    if (bitmap) {
6532
0
      if (name_tree && bitmap_info->hf_mask_label) {
6533
0
        if (no_idx) {
6534
0
          bitmap_item = proto_tree_add_uint(name_tree, *bitmap_info->hf_mask_label, tvb,
6535
0
              mask_offset, 4, bitmap);
6536
0
        } else {
6537
          /* Get header field to add the mask index to the field name */
6538
0
          hfinfo = proto_registrar_get_nth(*bitmap_info->hf_mask_label);
6539
0
          bitmap_item = proto_tree_add_uint_format(name_tree, *bitmap_info->hf_mask_label, tvb,
6540
0
              mask_offset, 4, bitmap, "%s[%u]: 0x%08x", hfinfo->name, i, bitmap);
6541
0
        }
6542
0
        bitmap_tree = proto_item_add_subtree(bitmap_item, ett_nfs4_bitmap);
6543
0
        first_attr = true;
6544
6545
0
        if (bitmap_info->hf_item_count) {
6546
          /* Count the number of attribute bits set */
6547
0
          for (j = 0, count = 0; j < 32; j++)
6548
0
            count += ((bitmap >> j) & 1);
6549
0
          hfinfo = proto_registrar_get_nth(*bitmap_info->hf_item_count);
6550
0
          attr_count = proto_tree_add_uint_format(bitmap_tree, *bitmap_info->hf_item_count, tvb, mask_offset,
6551
0
              4, count, "%u %s%s", count, hfinfo->name, plurality(count, "", "s"));
6552
0
          proto_item_set_hidden(attr_count);
6553
0
          proto_item_set_generated(attr_count);
6554
0
        }
6555
0
      }
6556
6557
0
      for (j = 0; j < 32; j++) {
6558
0
        bit_num = 32*i + j;
6559
0
        bit_set = ((bitmap >> j) & 1);
6560
0
        if (bit_set) {
6561
0
          if (bitmap_tree) {
6562
0
            if (bitmap_info->vse_names_ext) {
6563
              /* Append this attribute name to the 'attr mask' header line */
6564
0
              proto_item_append_text(bitmap_tree, (first_attr ? " (%s" : ", %s"),
6565
0
                val_to_str_ext(pinfo->pool, bit_num, bitmap_info->vse_names_ext, "Unknown: %u"));
6566
0
              first_attr = false;
6567
0
            }
6568
6569
            /* Get correct item label */
6570
0
            if (bitmap_info->get_item_label)
6571
0
              hf_item = bitmap_info->get_item_label(bit_num);
6572
0
            else if (bitmap_info->hf_item_label)
6573
0
              hf_item = *bitmap_info->hf_item_label;
6574
6575
0
            if (hf_item > 0) {
6576
              /* Display label */
6577
0
              attr_item = proto_tree_add_uint(bitmap_tree, hf_item, tvb, offset, 0, bit_num);
6578
0
            }
6579
0
          }
6580
6581
0
          attr_offset = offset;
6582
6583
0
          if (skip_attr_values && attr_item) {
6584
            /* Skip dissecting anymore attribute values since
6585
             * a previous attribute value was not dissected */
6586
0
            attr_tree = proto_item_add_subtree(attr_item, ett_nfs4_bitmap);
6587
0
            expert_add_info(pinfo, attr_tree, &ei_nfs_bitmap_skip_value);
6588
0
          } else if (type == NFS4_BITMAP_VALUES && attr_item) {
6589
            /* Display bit value */
6590
0
            attr_tree = proto_item_add_subtree(attr_item, ett_nfs4_bitmap);
6591
0
            if (bitmap_info->dissect_battr)
6592
0
              offset = bitmap_info->dissect_battr(tvb, offset, pinfo, civ, opcode, fh_idx,
6593
0
                  attr_tree, attr_item, bit_num, bitmap_info->battr_data);
6594
0
            if (offset == attr_offset) {
6595
              /* No value was dissected, this attribute is most likely not
6596
               * supported yet so stop dissecting the rest of the bitmap data */
6597
0
              expert_add_info(pinfo, attr_tree, &ei_nfs_bitmap_no_dissector);
6598
0
              skip_attr_values = true;
6599
0
            }
6600
0
          }
6601
6602
0
          if (attr_item)
6603
0
            proto_item_set_len(attr_item, offset - attr_offset);
6604
0
        }
6605
0
      }
6606
6607
0
      if (bitmap_tree && !first_attr)
6608
0
        proto_item_append_text(bitmap_tree, ")");
6609
0
    }
6610
0
    mask_offset += 4;
6611
0
  }
6612
6613
0
  if (type == NFS4_BITMAP_VALUES) {
6614
0
    count = end_offset - offset;
6615
0
    if (bitmap_info->hf_btmap_data && offset == opaque_offset) {
6616
      /* Display opaque data */
6617
0
      offset = dissect_nfsdata(tvb, pinfo, offset-4, name_tree, *bitmap_info->hf_btmap_data);
6618
0
    } else if (count == opaque_padding) {
6619
      /* Everything is good, just consume the padding bytes */
6620
0
      offset += opaque_padding;
6621
0
    } else if (count > 0) {
6622
      /* There are still bytes remaining from the opaque
6623
       * just consume the bytes */
6624
0
      expert_add_info(pinfo, name_tree, &ei_nfs_bitmap_undissected_data);
6625
0
      offset = dissect_rpc_bytes(tvb, pinfo, name_tree, hf_nfs4_bitmap_data, offset, count, false, NULL);
6626
0
    }
6627
0
  }
6628
6629
0
  return offset;
6630
0
}
6631
6632
6633
/*
6634
 * When using RPC-over-RDMA, certain opaque data are eligible for DDP
6635
 * (direct data placement), so these must be reduced by sending just
6636
 * the opaque length with the rest of the NFS packet and the opaque
6637
 * data is sent separately using RDMA (RFC 8267).
6638
 */
6639
static unsigned
6640
dissect_nfsdata_reduced(rdma_reduce_type_t rtype, tvbuff_t *tvb, packet_info* pinfo, unsigned offset,
6641
      proto_tree *tree, int hf, const char **name)
6642
0
{
6643
0
  if (rpcrdma_is_reduced()) {
6644
    /*
6645
     * The opaque data is reduced so just increment the offset
6646
     * since there is no actual data yet.
6647
     */
6648
0
    offset += 4;
6649
    /* Add offset (from the end) where the opaque data should be */
6650
0
    rpcrdma_insert_offset(tvb_reported_length_remaining(tvb, offset));
6651
0
    if (name) {
6652
      /* Return non-NULL string */
6653
0
      *name = "";
6654
0
    }
6655
0
  } else {
6656
    /* No data reduction, dissect the opaque data */
6657
0
    switch (rtype) {
6658
0
      case R_UTF8STRING:
6659
0
        offset = dissect_nfs_utf8string(tvb, pinfo, offset, tree, hf, name);
6660
0
        break;
6661
0
      case R_NFS2_PATH:
6662
0
        offset = dissect_path(tvb, pinfo, offset, tree, hf, name);
6663
0
        break;
6664
0
      case R_NFS3_PATH:
6665
0
        offset = dissect_nfs3_path(tvb, pinfo, offset, tree, hf, name);
6666
0
        break;
6667
0
      case R_NFSDATA:
6668
0
        offset = dissect_nfsdata(tvb, pinfo, offset, tree, hf);
6669
0
        break;
6670
0
    }
6671
0
  }
6672
0
  return offset;
6673
0
}
6674
6675
6676
static unsigned
6677
dissect_nfs4_deviceid(tvbuff_t *tvb, unsigned offset, proto_tree *tree)
6678
0
{
6679
0
  proto_tree_add_item(tree, hf_nfs4_deviceid, tvb, offset, 16, ENC_NA);
6680
0
  offset += 16;
6681
0
  return offset;
6682
0
}
6683
6684
6685
static unsigned
6686
dissect_nfs4_sessionid(tvbuff_t *tvb, unsigned offset, proto_tree *tree)
6687
0
{
6688
0
  proto_tree_add_item(tree, hf_nfs4_sessionid, tvb, offset, 16, ENC_NA);
6689
0
  offset += 16;
6690
0
  return offset;
6691
0
}
6692
6693
6694
static unsigned
6695
dissect_nfs4_specdata(tvbuff_t *tvb, unsigned offset, proto_tree *tree)
6696
0
{
6697
0
  offset = dissect_rpc_uint32(tvb, tree, hf_nfs4_specdata1, offset);
6698
0
  offset = dissect_rpc_uint32(tvb, tree, hf_nfs4_specdata2, offset);
6699
0
  return offset;
6700
0
}
6701
6702
static const value_string names_ftype4[] = {
6703
  { NF4REG,   "NF4REG"  },
6704
  { NF4DIR,   "NF4DIR"  },
6705
  { NF4BLK,   "NF4BLK"  },
6706
  { NF4CHR,   "NF4CHR"  },
6707
  { NF4LNK,   "NF4LNK"  },
6708
  { NF4SOCK,  "NF4SOCK" },
6709
  { NF4FIFO,  "NF4FIFO" },
6710
  { NF4ATTRDIR, "NF4ATTRDIR"  },
6711
  { NF4NAMEDATTR, "NF4NAMEDATTR"  },
6712
  { 0,  NULL }
6713
};
6714
6715
6716
static unsigned
6717
dissect_nfs4_lock_owner(tvbuff_t *tvb, packet_info* pinfo, unsigned offset, proto_tree *tree)
6718
0
{
6719
0
  proto_tree *newftree;
6720
6721
0
  newftree = proto_tree_add_subtree(tree, tvb, offset, 4, ett_nfs4_lock_owner, NULL, "Owner");
6722
0
  offset   = dissect_rpc_uint64(tvb, newftree, hf_nfs4_clientid, offset);
6723
0
  offset   = dissect_nfsdata(tvb, pinfo, offset, newftree, hf_nfs4_lock_owner);
6724
6725
0
  return offset;
6726
0
}
6727
6728
6729
static unsigned
6730
dissect_nfs4_pathname(tvbuff_t *tvb, packet_info* pinfo, unsigned offset, proto_tree *tree)
6731
0
{
6732
0
  uint32_t      comp_count, i;
6733
0
  proto_item *fitem;
6734
0
  proto_tree *newftree;
6735
6736
0
  fitem = proto_tree_add_item_ret_uint(tree, hf_nfs4_pathname_components, tvb, offset, 4, ENC_BIG_ENDIAN, &comp_count);
6737
0
  offset += 4;
6738
6739
0
  newftree = proto_item_add_subtree(fitem, ett_nfs4_pathname);
6740
6741
0
  for (i = 0; i < comp_count; i++)
6742
0
    offset = dissect_nfs_utf8string(tvb, pinfo, offset, newftree, hf_nfs4_component, NULL);
6743
0
  return offset;
6744
0
}
6745
6746
6747
static unsigned
6748
dissect_nfs4_nfstime(tvbuff_t *tvb, unsigned offset, proto_tree *tree)
6749
0
{
6750
0
  nstime_t ts;
6751
0
  proto_item *item;
6752
6753
0
  ts.secs = tvb_get_ntoh64(tvb, offset+0);
6754
0
  ts.nsecs = tvb_get_ntohl(tvb, offset+8);
6755
0
  item = proto_tree_add_time(tree, hf_nfs4_time, tvb, offset, 12, &ts);
6756
0
  tree = proto_item_add_subtree(item, ett_nfs4_nfstime);
6757
0
  offset = dissect_rpc_uint64(tvb, tree, hf_nfs4_time_seconds, offset);
6758
0
  offset = dissect_rpc_uint32(tvb, tree, hf_nfs4_time_nseconds, offset);
6759
6760
0
  return offset;
6761
0
}
6762
6763
static const value_string names_time_how4[] = {
6764
#define SET_TO_SERVER_TIME4 0
6765
  { SET_TO_SERVER_TIME4,  "SET_TO_SERVER_TIME4" },
6766
0
#define SET_TO_CLIENT_TIME4 1
6767
  { SET_TO_CLIENT_TIME4,  "SET_TO_CLIENT_TIME4" },
6768
  { 0,  NULL  }
6769
};
6770
6771
static unsigned
6772
dissect_nfs4_settime(tvbuff_t *tvb, unsigned offset,
6773
         proto_tree *tree, const char *name _U_)
6774
0
{
6775
0
  uint32_t set_it;
6776
6777
0
  proto_tree_add_item_ret_uint(tree, hf_nfs4_time_how4, tvb, offset+0, 4, ENC_BIG_ENDIAN, &set_it);
6778
0
  offset += 4;
6779
6780
0
  if (set_it == SET_TO_CLIENT_TIME4)
6781
0
    offset = dissect_nfs4_nfstime(tvb, offset, tree);
6782
6783
0
  return offset;
6784
0
}
6785
6786
static unsigned
6787
dissect_nfs4_fsid(tvbuff_t *tvb, unsigned offset, proto_tree *tree, const char *name)
6788
0
{
6789
0
  proto_tree *newftree;
6790
6791
0
  newftree = proto_tree_add_subtree(tree, tvb, offset, 0, ett_nfs4_fsid, NULL, name);
6792
0
  offset = dissect_rpc_uint64(tvb, newftree, hf_nfs4_fsid_major, offset);
6793
0
  offset = dissect_rpc_uint64(tvb, newftree, hf_nfs4_fsid_minor, offset);
6794
0
  return offset;
6795
0
}
6796
6797
/* ACE type values  */
6798
static const value_string names_acetype4[] = {
6799
#define ACE4_TYPE_ACCESS_ALLOWED  0x00000000
6800
  { ACE4_TYPE_ACCESS_ALLOWED, "Access_Allowed"  },
6801
#define ACE4_TYPE_ACCESS_DENIED   0x00000001
6802
  { ACE4_TYPE_ACCESS_DENIED,  "access_denied" },
6803
#define ACE4_TYPE_SYSTEM_AUDIT    0x00000002
6804
  { ACE4_TYPE_SYSTEM_AUDIT,   "system_audit" },
6805
#define ACE4_TYPE_SYSTEM_ALARM    0x00000003
6806
  { ACE4_TYPE_SYSTEM_ALARM,   "system_alarm" },
6807
  { 0,  NULL }
6808
};
6809
6810
/* ACE flag values */
6811
16
#define ACE4_FLAG_FILE_INHERIT             0x00000001
6812
16
#define ACE4_FLAG_DIRECTORY_INHERIT        0x00000002
6813
16
#define ACE4_FLAG_NO_PROPAGATE_INHERIT     0x00000004
6814
16
#define ACE4_FLAG_INHERIT_ONLY             0x00000008
6815
16
#define ACE4_FLAG_SUCCESSFUL_ACCESS        0x00000010
6816
16
#define ACE4_FLAG_FAILED_ACCESS            0x00000020
6817
16
#define ACE4_FLAG_IDENTIFIER_GROUP         0x00000040
6818
16
#define ACE4_FLAG_INHERITED_ACE            0x00000080
6819
6820
static unsigned
6821
dissect_nfs_aceflags4(tvbuff_t *tvb, unsigned offset, packet_info *pinfo _U_, proto_tree *ace_tree)
6822
0
{
6823
0
    static int * const flags[] = {
6824
0
        &hf_nfs4_aceflag_file_inherit,
6825
0
        &hf_nfs4_aceflag_dir_inherit,
6826
0
        &hf_nfs4_aceflag_no_prop_inherit,
6827
0
        &hf_nfs4_aceflag_inherit_only,
6828
0
        &hf_nfs4_aceflag_successful_access,
6829
0
        &hf_nfs4_aceflag_failed_access,
6830
0
        &hf_nfs4_aceflag_id_group,
6831
0
        &hf_nfs4_aceflag_inherited_ace,
6832
0
        NULL
6833
0
    };
6834
6835
0
    proto_tree_add_bitmask(ace_tree, tvb, offset, hf_nfs4_aceflags, ett_nfs4_aceflag, flags, ENC_BIG_ENDIAN);
6836
6837
0
    offset += 4;
6838
0
    return offset;
6839
0
}
6840
6841
6842
/* ACE4 permissions for files */
6843
static const value_string  acemask4_perms_file[] = {
6844
#define ACE4_READ_DATA             0x00000001
6845
  { ACE4_READ_DATA,            "Read_Data"  },
6846
#define ACE4_WRITE_DATA            0x00000002
6847
  { ACE4_WRITE_DATA,           "Write_Data" },
6848
#define ACE4_APPEND_DATA           0x00000004
6849
  { ACE4_APPEND_DATA,          "Append_Data"  },
6850
  { 0, NULL }
6851
};
6852
/* Abbreviated ACE4 permissions for files */
6853
static const value_string  acemask4_abbrev_perms_file[] = {
6854
  { ACE4_READ_DATA,            "RdData"  },
6855
  { ACE4_WRITE_DATA,           "WrData" },
6856
  { ACE4_APPEND_DATA,          "AppData"  },
6857
  { 0, NULL }
6858
};
6859
6860
/* ACE4 permissions for dirs */
6861
static const value_string  acemask4_perms_dir[] = {
6862
#define ACE4_LIST_DIRECTORY        0x00000001
6863
  { ACE4_LIST_DIRECTORY,       "List_Dir" },
6864
#define ACE4_ADD_FILE              0x00000002
6865
  { ACE4_ADD_FILE,             "Add_File" },
6866
#define ACE4_ADD_SUBDIRECTORY      0x00000004
6867
  { ACE4_ADD_SUBDIRECTORY,     "Add_Subdir" },
6868
  { 0, NULL }
6869
};
6870
/* Abbreviated ACE4 permissions for dirs */
6871
static const value_string  acemask4_abbrev_perms_dir[] = {
6872
  { ACE4_LIST_DIRECTORY,       "LstDir" },
6873
  { ACE4_ADD_FILE,             "AddFile" },
6874
  { ACE4_ADD_SUBDIRECTORY,     "AddSubD" },
6875
  { 0, NULL }
6876
};
6877
6878
/* ACE4 permissions for objects of unknown type */
6879
static const value_string  acemask4_perms_unkwn[] = {
6880
  { ACE4_READ_DATA,            "Read_Data / List_Dir" },
6881
  { ACE4_WRITE_DATA,           "Write_Data / Add_File" },
6882
  { ACE4_APPEND_DATA,          "Append_Data / Add_SubDir" },
6883
  { 0, NULL }
6884
};
6885
/* Abbreviated ACE4 permissions for objects of unknown type */
6886
static const value_string  acemask4_abbrev_perms_unkwn[] = {
6887
  { ACE4_READ_DATA,            "RdData/LstDir" },
6888
  { ACE4_WRITE_DATA,           "WrData/AddFile" },
6889
  { ACE4_APPEND_DATA,          "AppData/AddSubD" },
6890
  { 0, NULL }
6891
};
6892
6893
/* ACE4 permissions for object types 0x8 and above */
6894
static const value_string  acemask4_perms_8_and_above[] = {
6895
#define ACE4_READ_NAMED_ATTRS      0x00000008
6896
  { ACE4_READ_NAMED_ATTRS,     "Read_Named_Attrs" },
6897
#define ACE4_WRITE_NAMED_ATTRS     0x00000010
6898
  { ACE4_WRITE_NAMED_ATTRS,    "Write_Named_Attrs" },
6899
#define ACE4_EXECUTE               0x00000020
6900
  { ACE4_EXECUTE,              "Execute" },
6901
#define ACE4_DELETE_CHILD          0x00000040
6902
  { ACE4_DELETE_CHILD,         "Delete_Child" },
6903
#define ACE4_READ_ATTRIBUTES       0x00000080
6904
  { ACE4_READ_ATTRIBUTES,      "Read_Attributes" },
6905
#define ACE4_WRITE_ATTRIBUTES      0x00000100
6906
  { ACE4_WRITE_ATTRIBUTES,     "Write_Attributes" },
6907
#define ACE4_WRITE_RETENTION       0x00000200
6908
  { ACE4_WRITE_RETENTION,      "Write_Retention" },
6909
#define ACE4_WRITE_RETENTION_HOLD  0x00000400
6910
  { ACE4_WRITE_RETENTION_HOLD, "Write_Retention_Hold" },
6911
#define ACE4_DELETE                0x00010000
6912
  { ACE4_DELETE,               "Delete" },
6913
#define ACE4_READ_ACL              0x00020000
6914
  { ACE4_READ_ACL,             "Read_ACL" },
6915
#define ACE4_WRITE_ACL             0x00040000
6916
  { ACE4_WRITE_ACL,            "Write_ACL" },
6917
#define ACE4_WRITE_OWNER           0x00080000
6918
  { ACE4_WRITE_OWNER,          "Write_Owner" },
6919
0
#define ACE4_SYNCHRONIZE           0x00100000
6920
  { ACE4_SYNCHRONIZE,          "Synchronize" },
6921
  { 0, NULL }
6922
};
6923
static value_string_ext acemask4_perms_8_and_above_ext = VALUE_STRING_EXT_INIT(acemask4_perms_8_and_above);
6924
6925
/* Abbreviated ACE4 permissions for object types 0x8 and above */
6926
static const value_string  acemask4_abbrev_perms_8_and_above[] = {
6927
  { ACE4_READ_NAMED_ATTRS,     "RdNamAt" },
6928
  { ACE4_WRITE_NAMED_ATTRS,    "WrNamAt" },
6929
  { ACE4_EXECUTE,              "Exec" },
6930
  { ACE4_DELETE_CHILD,         "DelChld" },
6931
  { ACE4_READ_ATTRIBUTES,      "RdAttrs" },
6932
  { ACE4_WRITE_ATTRIBUTES,     "WrAttrs" },
6933
  { ACE4_WRITE_RETENTION,      "WrRet" },
6934
  { ACE4_WRITE_RETENTION_HOLD, "WrRetHld" },
6935
  { ACE4_DELETE,               "Del" },
6936
  { ACE4_READ_ACL,             "RdACL" },
6937
  { ACE4_WRITE_ACL,            "WrACL" },
6938
  { ACE4_WRITE_OWNER,          "WrOwn" },
6939
  { ACE4_SYNCHRONIZE,          "Sync" },
6940
  { 0, NULL }
6941
};
6942
static value_string_ext acemask4_abbrev_perms_8_and_above_ext = VALUE_STRING_EXT_INIT(acemask4_abbrev_perms_8_and_above);
6943
6944
static unsigned
6945
dissect_nfs4_acemask(tvbuff_t *tvb, packet_info* pinfo, unsigned offset, proto_tree *ace_tree, uint32_t acetype4, uint32_t obj_type)
6946
0
{
6947
0
  const char *type   = NULL;
6948
0
  const char *atype  = NULL;
6949
0
  uint32_t       acemask   = tvb_get_ntohl(tvb, offset);
6950
0
  uint32_t       acemask_bit = 1;
6951
0
  bool         first_perm  = true;
6952
0
  proto_item  *acemask_item;
6953
0
  proto_tree  *acemask_tree;
6954
6955
0
  acemask_item = proto_tree_add_uint(ace_tree, hf_nfs4_acemask, tvb, offset, 4, acemask);
6956
0
  acemask_tree = proto_item_add_subtree(acemask_item, ett_nfs4_acemask);
6957
0
  proto_item_append_text(acemask_item, "  (");
6958
6959
0
  while (acemask_bit <= ACE4_SYNCHRONIZE)
6960
0
  {
6961
0
    if (acemask_bit & acemask) {
6962
0
      if (acemask_bit <= 0x4) {
6963
0
        if (obj_type) {
6964
0
          if  (obj_type == NF4REG) {
6965
0
            type = val_to_str(pinfo->pool, acemask_bit, acemask4_perms_file, "Unknown: %u");
6966
0
            atype = val_to_str(pinfo->pool, acemask_bit, acemask4_abbrev_perms_file, "Unknown: %u");
6967
0
          } else if (obj_type == NF4DIR) {
6968
0
            type = val_to_str(pinfo->pool, acemask_bit, acemask4_perms_dir, "Unknown: %u");
6969
0
            atype = val_to_str(pinfo->pool, acemask_bit, acemask4_abbrev_perms_dir, "Unknown: %u");
6970
0
          }
6971
0
        } else {
6972
0
          type = val_to_str(pinfo->pool, acemask_bit, acemask4_perms_unkwn, "Unknown: %u");
6973
0
          atype = val_to_str(pinfo->pool, acemask_bit, acemask4_abbrev_perms_unkwn, "Unknown: %u");
6974
0
        }
6975
0
      } else {
6976
0
        type = val_to_str_ext(pinfo->pool, acemask_bit, &acemask4_perms_8_and_above_ext, "Unknown: %u");
6977
0
        atype = val_to_str_ext(pinfo->pool, acemask_bit, &acemask4_abbrev_perms_8_and_above_ext, "Unknown: %u");
6978
0
      }
6979
0
      proto_tree_add_uint_format(acemask_tree, hf_nfs4_ace_permission, tvb, offset, 4,
6980
0
        acemask_bit, "%s: %s (0x%08x)", val_to_str(pinfo->pool, acetype4, names_acetype4, "Unknown: %u"), type, acemask_bit);
6981
0
      proto_item_append_text(acemask_item, first_perm ? "%s" : ", %s", atype);
6982
0
      first_perm = false;
6983
0
    }
6984
0
    acemask_bit <<= 1;
6985
0
  }
6986
0
  proto_item_append_text(acemask_item, ")");
6987
6988
0
  offset += 4;
6989
6990
0
  return offset;
6991
0
}
6992
6993
/* Decode exactly one ACE (type, flags, mask, permissions, and who) */
6994
static unsigned
6995
dissect_nfs4_ace(tvbuff_t *tvb, unsigned offset, packet_info *pinfo, proto_tree *tree, int ace_number,
6996
         uint32_t obj_type)
6997
0
{
6998
0
  uint32_t      acetype4 = 0;
6999
0
  const char *acetype4_str;
7000
0
  proto_tree *ace_tree = NULL;
7001
7002
0
  if (tree) {
7003
0
    proto_item *ace_item = NULL;
7004
7005
0
    acetype4 = tvb_get_ntohl(tvb, offset);
7006
0
    acetype4_str = val_to_str(pinfo->pool, acetype4, names_acetype4, "Unknown: %u");
7007
7008
    /* Display the ACE type and create a subtree for this ACE */
7009
0
    if (ace_number == 0) {
7010
0
      ace_item = proto_tree_add_uint_format(tree, hf_nfs4_acetype, tvb, offset, 4,
7011
0
        acetype4, "ACE Type: %s (%u)", acetype4_str, acetype4);
7012
0
    } else {
7013
0
      ace_item = proto_tree_add_uint_format(tree, hf_nfs4_acetype, tvb, offset, 4,
7014
0
        acetype4, "%u. ACE Type: %s (%u)", ace_number, acetype4_str, acetype4);
7015
0
    }
7016
0
    ace_tree = proto_item_add_subtree(ace_item, ett_nfs4_ace);
7017
0
  }
7018
7019
0
  offset += 4;
7020
7021
0
  if (tree) {
7022
0
    offset = dissect_nfs_aceflags4(tvb, offset, pinfo, ace_tree);
7023
0
    offset = dissect_nfs4_acemask(tvb, pinfo, offset, ace_tree, acetype4, obj_type);
7024
0
  } else {
7025
0
    offset += 8;
7026
0
  }
7027
7028
0
  offset = dissect_nfs_utf8string(tvb, pinfo, offset, ace_tree, hf_nfs4_who, NULL);
7029
7030
0
  return offset;
7031
0
}
7032
7033
16
#define ACL4_AUTO_INHERIT 0x00000001
7034
16
#define ACL4_PROTECTED    0x00000002
7035
16
#define ACL4_DEFAULTED    0x00000004
7036
7037
static int * const aclflags_fields[] = {
7038
  &hf_nfs4_aclflag_auto_inherit,
7039
  &hf_nfs4_aclflag_protected,
7040
  &hf_nfs4_aclflag_defaulted,
7041
  NULL
7042
};
7043
7044
static unsigned
7045
dissect_nfs4_aclflags(tvbuff_t *tvb, unsigned offset, proto_tree *tree)
7046
0
{
7047
0
  proto_tree_add_bitmask(tree, tvb, offset, hf_nfs4_aclflags,
7048
0
    ett_nfs4_aclflag, aclflags_fields, ENC_BIG_ENDIAN);
7049
0
  offset += 4;
7050
7051
0
  return offset;
7052
0
}
7053
7054
static unsigned
7055
dissect_nfs4_fattr_acl(tvbuff_t *tvb, unsigned offset, packet_info *pinfo, proto_item *attr_item,
7056
           proto_tree *tree, uint32_t obj_type, uint32_t attr_num)
7057
0
{
7058
0
  uint32_t num_aces;
7059
0
  uint32_t ace_number;
7060
7061
0
  if (attr_num != FATTR4_ACL)
7062
0
    offset = dissect_nfs4_aclflags(tvb, offset, tree);
7063
7064
0
  num_aces = tvb_get_ntohl(tvb, offset);
7065
0
  if (tree && num_aces > 0) {
7066
0
    proto_tree_add_uint(tree, hf_nfs4_num_aces, tvb, offset, 4, num_aces);
7067
0
    proto_item_append_text(attr_item, " (%u ACEs)", num_aces);
7068
0
  }
7069
0
  offset += 4;
7070
7071
  /* Tree or not, this for loop is required due dissect_nfs_utf8string() call */
7072
0
  for (ace_number = 1; ace_number<=num_aces; ace_number++)
7073
0
    offset = dissect_nfs4_ace(tvb, offset, pinfo, tree, ace_number, obj_type);
7074
7075
0
  return offset;
7076
0
}
7077
7078
16
#define ACL4_SUPPORT_ALLOW_ACL  0x00000001
7079
16
#define ACL4_SUPPORT_DENY_ACL 0x00000002
7080
16
#define ACL4_SUPPORT_AUDIT_ACL  0x00000004
7081
16
#define ACL4_SUPPORT_ALARM_ACL  0x00000008
7082
7083
static int * const aclsupport_fields[] = {
7084
  &hf_nfs4_aclsupport_allow_acl,
7085
  &hf_nfs4_aclsupport_deny_acl,
7086
  &hf_nfs4_aclsupport_audit_acl,
7087
  &hf_nfs4_aclsupport_alarm_acl,
7088
  NULL
7089
};
7090
7091
static unsigned
7092
dissect_nfs4_fattr_aclsupport(tvbuff_t *tvb, unsigned offset, proto_tree *tree)
7093
0
{
7094
0
  proto_tree_add_bitmask(tree, tvb, offset, hf_nfs4_fattr_aclsupport,
7095
0
    ett_nfs4_fattr_aclsupport, aclsupport_fields, ENC_BIG_ENDIAN);
7096
0
  offset += 4;
7097
7098
0
  return offset;
7099
0
}
7100
7101
static unsigned
7102
dissect_nfs4_fh(tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
7103
    proto_tree *tree, const char *name,
7104
    uint32_t *hash, int *fh_offset_ptr, int *fh_length_ptr,
7105
    rpc_call_info_value *civ, uint32_t opcode, uint32_t fh_idx)
7106
0
{
7107
0
  int fh_offset, fh_length;
7108
7109
0
  fh_length = tvb_get_ntohl(tvb, offset);
7110
0
  fh_offset = offset+4;
7111
7112
  /* are we snooping fh to filenames ?*/
7113
0
  if ((!pinfo->fd->visited) && nfs_file_name_snooping) {
7114
    /* NFS v4 GETFH, GETATTR and READDIR replies might give us a mapping */
7115
    /* TODO: Matching NFS v4 READDIR name entry with entry filehandle attribute and with READDIR directory name is not supported yet */
7116
0
    if (civ->prog == NFS_PROGRAM && civ->vers == 4 && !civ->request && civ->proc == 1 && (opcode == NFS4_OP_GETFH || opcode == NFS4_OP_GETATTR)) {
7117
0
      nfs_name_snoop_add_fh(((uint64_t)fh_idx << 32) | civ->xid, tvb, fh_offset, fh_length);
7118
0
    }
7119
0
  }
7120
7121
0
  if (fh_offset_ptr)
7122
0
    *fh_offset_ptr = fh_offset;
7123
0
  if (fh_length_ptr)
7124
0
    *fh_length_ptr = fh_length;
7125
7126
0
  return dissect_nfs3_fh(tvb, offset, pinfo, tree, name, hash, civ);
7127
0
}
7128
7129
7130
static int
7131
dissect_nfs4_server(tvbuff_t *tvb, unsigned offset, packet_info *pinfo, proto_tree *tree, void *data _U_)
7132
0
{
7133
0
  return dissect_nfs_utf8string(tvb, pinfo, offset, tree, hf_nfs4_server, NULL);
7134
0
}
7135
7136
7137
static int
7138
dissect_nfs4_fs_location(tvbuff_t *tvb, unsigned offset, packet_info *pinfo, proto_tree *tree, void *data _U_)
7139
0
{
7140
0
  proto_tree *newftree;
7141
7142
0
  newftree = proto_tree_add_subtree(tree, tvb, offset, 0, ett_nfs4_fs_location, NULL, "fs_location4");
7143
7144
0
  offset = dissect_rpc_array(tvb, pinfo, newftree, offset, dissect_nfs4_server, hf_nfs4_servers);
7145
0
  offset = dissect_nfs4_pathname(tvb, pinfo, offset, newftree);
7146
7147
0
  return offset;
7148
0
}
7149
7150
7151
static unsigned
7152
dissect_nfs4_fs_locations(tvbuff_t *tvb, packet_info *pinfo, unsigned offset,
7153
        proto_tree *tree, const char *name)
7154
0
{
7155
0
  proto_tree *newftree;
7156
7157
0
  newftree = proto_tree_add_subtree(tree, tvb, offset, 0, ett_nfs4_fs_locations, NULL, name);
7158
7159
0
  offset = dissect_nfs4_pathname(tvb, pinfo, offset, newftree);
7160
7161
0
  offset = dissect_rpc_array(tvb, pinfo, newftree, offset,
7162
0
    dissect_nfs4_fs_location, hf_nfs4_fslocation);
7163
7164
0
  return offset;
7165
0
}
7166
7167
/* RFC5661 - '14.4. UTF-8 Capabilities' */
7168
16
#define FSCHARSET_CAP4_CONTAINS_NON_UTF8  0x00000001
7169
16
#define FSCHARSET_CAP4_ALLOWS_ONLY_UTF8   0x00000002
7170
7171
static unsigned
7172
dissect_nfs4_fattr_fs_charset_cap(tvbuff_t *tvb, unsigned offset, proto_tree *tree)
7173
0
{
7174
0
  int * const fs_charset_cap_fields[] = {
7175
0
    &hf_nfs4_fs_charset_cap_nonutf8,
7176
0
    &hf_nfs4_fs_charset_cap_utf8,
7177
0
    NULL
7178
0
  };
7179
7180
0
  proto_tree_add_bitmask(tree, tvb, offset, hf_nfs4_fattr_fs_charset_cap,
7181
0
    ett_nfs4_fattr_fs_charset_cap, fs_charset_cap_fields, ENC_BIG_ENDIAN);
7182
0
  offset += 4;
7183
7184
0
  return offset;
7185
0
}
7186
7187
static unsigned
7188
dissect_nfs4_mode(tvbuff_t *tvb, unsigned offset, proto_tree *tree)
7189
0
{
7190
0
  static int * const modes[] = {
7191
0
    &hf_nfs2_mode_set_user_id,
7192
0
    &hf_nfs2_mode_set_group_id,
7193
0
    &hf_nfs2_mode_save_swap_text,
7194
0
    &hf_nfs2_mode_read_owner,
7195
0
    &hf_nfs2_mode_write_owner,
7196
0
    &hf_nfs2_mode_exec_owner,
7197
0
    &hf_nfs2_mode_read_group,
7198
0
    &hf_nfs2_mode_write_group,
7199
0
    &hf_nfs2_mode_exec_group,
7200
0
    &hf_nfs2_mode_read_other,
7201
0
    &hf_nfs2_mode_write_other,
7202
0
    &hf_nfs2_mode_exec_other,
7203
0
    NULL
7204
0
  };
7205
7206
0
  proto_tree_add_bitmask(tree, tvb, offset, hf_nfs2_mode, ett_nfs2_mode, modes, ENC_BIG_ENDIAN);
7207
7208
0
  offset += 4;
7209
0
  return offset;
7210
0
}
7211
7212
0
#define FH4_PERSISTENT         0x00000000
7213
16
#define FH4_NOEXPIRE_WITH_OPEN 0x00000001
7214
16
#define FH4_VOLATILE_ANY       0x00000002
7215
16
#define FH4_VOL_MIGRATION      0x00000004
7216
16
#define FH4_VOL_RENAME         0x00000008
7217
7218
static const value_string nfs4_fattr4_fh_expire_type_names[] = {
7219
  { FH4_PERSISTENT, "FH4_PERSISTENT" },
7220
  { 0, NULL }
7221
};
7222
7223
static int * const nfs4_fattr_fh_expire_type_fields[] = {
7224
  &hf_nfs4_fattr_fh_expiry_noexpire_with_open,
7225
  &hf_nfs4_fattr_fh_expiry_volatile_any,
7226
  &hf_nfs4_fattr_fh_expiry_vol_migration,
7227
  &hf_nfs4_fattr_fh_expiry_vol_rename,
7228
  NULL
7229
};
7230
7231
static unsigned
7232
dissect_nfs4_fattr_fh_expire_type(tvbuff_t *tvb, unsigned offset, proto_tree *tree)
7233
0
{
7234
0
  uint32_t    expire_type;
7235
7236
0
  expire_type = tvb_get_ntohl(tvb, offset + 0);
7237
7238
0
  if (expire_type == FH4_PERSISTENT)
7239
0
    proto_tree_add_item(tree, hf_nfs4_fattr_fh_expire_type, tvb, offset, 4, ENC_BIG_ENDIAN);
7240
0
  else
7241
0
    proto_tree_add_bitmask(tree, tvb, offset, hf_nfs4_fattr_fh_expire_type,
7242
0
      ett_nfs4_fattr_fh_expire_type, nfs4_fattr_fh_expire_type_fields,
7243
0
      ENC_BIG_ENDIAN);
7244
7245
0
  offset += 4;
7246
7247
0
  return offset;
7248
0
}
7249
7250
7251
static unsigned
7252
dissect_nfs_fs_layout_type(tvbuff_t *tvb, proto_tree *tree, unsigned offset)
7253
0
{
7254
0
  unsigned count, i;
7255
7256
0
  count = tvb_get_ntohl(tvb, offset);
7257
0
  offset += 4;
7258
7259
0
  for (i = 0; i < count; i++)
7260
0
    offset = dissect_rpc_uint32(tvb, tree, hf_nfs4_layout_type, offset);
7261
7262
0
  return offset;
7263
0
}
7264
7265
7266
static const value_string th4_names_file[] = {
7267
0
#define TH4_READ_SIZE             0
7268
  { TH4_READ_SIZE,    "Read_Size"   },
7269
0
#define TH4_WRITE_SIZE            1
7270
  { TH4_WRITE_SIZE,   "Write_Size"    },
7271
0
#define TH4_READ_IOSIZE           2
7272
  { TH4_READ_IOSIZE,  "Read_IO_Size"    },
7273
0
#define TH4_WRITE_IOSIZE          3
7274
  { TH4_WRITE_IOSIZE, "Write_IO_Size"   },
7275
  { 0,  NULL  }
7276
};
7277
static value_string_ext th4_names_ext_file = VALUE_STRING_EXT_INIT(th4_names_file);
7278
7279
7280
/* Dissect the threshold_item4 bit attribute for the files layout type */
7281
static unsigned
7282
dissect_nfs4_threshold_item_file(tvbuff_t *tvb, unsigned offset, packet_info *pinfo _U_,
7283
    rpc_call_info_value *civ _U_, uint32_t opcode _U_, uint32_t fh_idx _U_,
7284
    proto_tree *attr_tree, proto_item *attr_item _U_,
7285
    uint32_t bit_num, void *battr_data _U_)
7286
0
{
7287
0
  uint64_t size;
7288
7289
0
  switch (bit_num) {
7290
0
    case TH4_READ_SIZE:
7291
0
    case TH4_WRITE_SIZE:
7292
0
    case TH4_READ_IOSIZE:
7293
0
    case TH4_WRITE_IOSIZE:
7294
0
      size = tvb_get_ntoh64(tvb, offset);
7295
0
      offset = dissect_rpc_uint64(tvb, attr_tree, hf_nfs4_length, offset);
7296
0
      proto_item_append_text(attr_tree, " = %" PRIu64, size);
7297
0
      break;
7298
0
  }
7299
0
  return offset;
7300
0
}
7301
7302
7303
/* Dissect the threshold_item4 structure */
7304
static int
7305
dissect_nfs4_threshold_item(tvbuff_t *tvb, unsigned offset, packet_info *pinfo, proto_tree *tree, void *data)
7306
0
{
7307
0
  uint32_t layout_type;
7308
0
  static nfs4_bitmap_info_t *bitmap_info_p;
7309
7310
  /* Bitmap info for the files layout type */
7311
0
  static nfs4_bitmap_info_t bitmap_info_files = {
7312
0
    .vse_names_ext = &th4_names_ext_file,
7313
0
    .dissect_battr = dissect_nfs4_threshold_item_file,
7314
0
    .hf_mask_label = &hf_nfs4_mdsthreshold_hint_mask,
7315
0
    .hf_item_label = &hf_nfs4_mdsthreshold_hint_file,
7316
0
    .hf_item_count = &hf_nfs4_mdsthreshold_hint_count,
7317
0
    .hf_mask_count = &hf_nfs4_mdsthreshold_mask_count
7318
0
  };
7319
7320
  /* Bitmap info for an unsupported layout type,
7321
   * just display the bitmap mask and its data */
7322
0
  static nfs4_bitmap_info_t bitmap_info_default = {
7323
0
    .hf_mask_label = &hf_nfs4_mdsthreshold_hint_mask,
7324
0
    .hf_mask_count = &hf_nfs4_mdsthreshold_mask_count,
7325
0
    .hf_btmap_data = &hf_nfs4_bitmap_data,
7326
0
  };
7327
7328
  /* Get layout type */
7329
0
  layout_type = tvb_get_ntohl(tvb, offset);
7330
0
  offset = dissect_rpc_uint32(tvb, tree, hf_nfs4_layout_type, offset);
7331
7332
0
  switch (layout_type) {
7333
0
    case LAYOUT4_NFSV4_1_FILES:
7334
0
      bitmap_info_p = &bitmap_info_files;
7335
0
      break;
7336
0
    default:
7337
0
      bitmap_info_p = &bitmap_info_default;
7338
0
      break;
7339
0
  }
7340
0
  return dissect_nfs4_bitmap(tvb, offset, pinfo, tree, (rpc_call_info_value *)data, -1, -1, bitmap_info_p, NFS4_BITMAP_VALUES, NULL);
7341
0
}
7342
7343
7344
/* Dissect the fattr4_mdsthreshold structure */
7345
static unsigned
7346
dissect_nfs4_mdsthreshold(tvbuff_t *tvb, packet_info *pinfo, unsigned offset, proto_tree *tree)
7347
0
{
7348
0
  int mds_offset = offset;
7349
7350
0
  offset = dissect_rpc_array(tvb, pinfo, tree, offset,
7351
0
    dissect_nfs4_threshold_item, hf_nfs4_mdsthreshold_item);
7352
0
  proto_item_set_len(tree, offset - mds_offset);
7353
7354
0
  return offset;
7355
0
}
7356
7357
7358
static unsigned
7359
dissect_nfs4_security_label(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, unsigned offset)
7360
0
{
7361
7362
0
  offset = dissect_rpc_uint32(tvb, tree, hf_nfs4_fattr_security_label_lfs, offset);
7363
0
  offset = dissect_rpc_uint32(tvb, tree, hf_nfs4_fattr_security_label_pi, offset);
7364
0
  offset = dissect_nfs_utf8string(tvb, pinfo, offset, tree,
7365
0
    hf_nfs4_fattr_security_label_context, NULL);
7366
7367
0
  return offset;
7368
0
}
7369
7370
static unsigned
7371
dissect_nfs4_mode_umask(tvbuff_t *tvb, proto_tree *tree, unsigned offset)
7372
0
{
7373
0
  offset = dissect_nfs4_mode(tvb, offset, tree);
7374
0
  offset = dissect_rpc_uint32(tvb, tree, hf_nfs4_fattr_umask_mask, offset);
7375
0
  return offset;
7376
0
}
7377
7378
0
#define FATTR4_BITMAP_ONLY 0
7379
0
#define FATTR4_DISSECT_VALUES 1
7380
7381
#define CHANGE_TYPE_IS_MONOTONIC_INCR 0
7382
#define CHANGE_TYPE_IS_VERSION_COUNTER 1
7383
#define CHANGE_TYPE_IS_VERSION_COUNTER_NOPNFS 2
7384
#define CHANGE_TYPE_IS_TIME_METADATA 3
7385
#define CHANGE_TYPE_IS_UNDEFINED 4
7386
7387
static const value_string names_nfs_change_attr_types[] =
7388
{
7389
  { CHANGE_TYPE_IS_MONOTONIC_INCR,  "CHANGE_TYPE_IS_MONOTONIC_INCR" },
7390
  { CHANGE_TYPE_IS_VERSION_COUNTER, "CHANGE_TYPE_IS_VERSION_COUNTER"  },
7391
  { CHANGE_TYPE_IS_VERSION_COUNTER_NOPNFS,  "CHANGE_TYPE_IS_VERSION_COUNTER_NOPNFS" },
7392
  { CHANGE_TYPE_IS_TIME_METADATA, "CHANGE_TYPE_IS_TIME_METADATA"  },
7393
  { CHANGE_TYPE_IS_UNDEFINED, "CHANGE_TYPE_IS_UNDEFINED"  },
7394
  { 0,  NULL  }
7395
};
7396
7397
static unsigned
7398
dissect_nfs4_fattrs(tvbuff_t *tvb, unsigned offset, packet_info *pinfo, proto_tree *tree, int type, rpc_call_info_value *civ, uint32_t opcode, uint32_t fh_idx);
7399
7400
/* Display attribute as either required or recommended */
7401
static unsigned
7402
nfs4_fattr_item_label(uint32_t attr_num)
7403
0
{
7404
0
  return (attr_num <= FATTR4_RDATTR_ERROR ||
7405
0
    attr_num == FATTR4_FILEHANDLE ||
7406
0
    attr_num == FATTR4_SUPPATTR_EXCLCREAT) ?
7407
0
    hf_nfs4_reqd_attr: hf_nfs4_reco_attr;
7408
7409
0
}
7410
7411
/* Dissect the value of the attribute given by attr_num */
7412
static unsigned
7413
dissect_nfs4_fattr_value(tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
7414
    rpc_call_info_value *civ, uint32_t opcode, uint32_t fh_idx,
7415
    proto_tree *attr_tree,
7416
    proto_item *attr_item, uint32_t attr_num, void *battr_data)
7417
0
{
7418
0
  uint32_t *fattr_obj_type_p = (uint32_t *)battr_data;
7419
0
  switch (attr_num) {
7420
0
    case FATTR4_SUPPORTED_ATTRS:
7421
0
    case FATTR4_SUPPATTR_EXCLCREAT:
7422
0
      offset = dissect_nfs4_fattrs(tvb, offset, pinfo, attr_tree, FATTR4_BITMAP_ONLY, civ, opcode, fh_idx);
7423
0
      break;
7424
7425
0
    case FATTR4_TYPE:
7426
0
      *fattr_obj_type_p = tvb_get_ntohl(tvb, offset);
7427
0
      if (attr_tree)
7428
0
        proto_tree_add_item(attr_tree, hf_nfs4_ftype, tvb, offset, 4,
7429
0
          ENC_BIG_ENDIAN);
7430
0
      offset += 4;
7431
0
      break;
7432
7433
0
    case FATTR4_FH_EXPIRE_TYPE:
7434
0
      offset = dissect_nfs4_fattr_fh_expire_type(tvb, offset, attr_tree);
7435
0
      break;
7436
7437
0
    case FATTR4_CHANGE:
7438
0
      offset = dissect_rpc_uint64(tvb, attr_tree, hf_nfs4_changeid, offset);
7439
0
      break;
7440
7441
0
    case FATTR4_SIZE:
7442
0
      offset = dissect_rpc_uint64(tvb, attr_tree, hf_nfs4_fattr_size, offset);
7443
0
      break;
7444
7445
0
    case FATTR4_LINK_SUPPORT:
7446
0
      offset = dissect_rpc_bool(tvb,
7447
0
        attr_tree, hf_nfs4_fattr_link_support, offset);
7448
0
      break;
7449
7450
0
    case FATTR4_SYMLINK_SUPPORT:
7451
0
      offset = dissect_rpc_bool(tvb, attr_tree, hf_nfs4_fattr_symlink_support, offset);
7452
0
      break;
7453
7454
0
    case FATTR4_NAMED_ATTR:
7455
0
      offset = dissect_rpc_bool(tvb, attr_tree, hf_nfs4_fattr_named_attr, offset);
7456
0
      break;
7457
7458
0
    case FATTR4_FSID:
7459
0
      offset = dissect_nfs4_fsid(tvb, offset, attr_tree, "fattr4_fsid");
7460
0
      break;
7461
7462
0
    case FATTR4_UNIQUE_HANDLES:
7463
0
      offset = dissect_rpc_bool(tvb, attr_tree, hf_nfs4_fattr_unique_handles, offset);
7464
0
      break;
7465
7466
0
    case FATTR4_LEASE_TIME:
7467
0
      offset = dissect_rpc_uint32(tvb, attr_tree, hf_nfs4_fattr_lease_time, offset);
7468
0
      break;
7469
7470
0
    case FATTR4_RDATTR_ERROR:
7471
0
      offset = dissect_nfs4_status(tvb, offset, attr_tree, NULL);
7472
0
      break;
7473
7474
0
    case FATTR4_ACL:
7475
0
    case FATTR4_DACL:
7476
0
    case FATTR4_SACL:
7477
0
      offset = dissect_nfs4_fattr_acl(tvb, offset, pinfo, attr_item, attr_tree,
7478
0
        *fattr_obj_type_p, attr_num);
7479
0
      break;
7480
7481
0
    case FATTR4_ACLSUPPORT:
7482
0
      offset = dissect_nfs4_fattr_aclsupport(tvb, offset, attr_tree);
7483
0
      break;
7484
7485
0
    case FATTR4_ARCHIVE:
7486
0
      offset = dissect_rpc_bool(tvb, attr_tree, hf_nfs4_fattr_archive, offset);
7487
0
      break;
7488
7489
0
    case FATTR4_CANSETTIME:
7490
0
      offset = dissect_rpc_bool(tvb, attr_tree, hf_nfs4_fattr_cansettime, offset);
7491
0
      break;
7492
7493
0
    case FATTR4_CASE_INSENSITIVE:
7494
0
      offset = dissect_rpc_bool(tvb, attr_tree, hf_nfs4_fattr_case_insensitive, offset);
7495
0
      break;
7496
7497
0
    case FATTR4_CASE_PRESERVING:
7498
0
      offset = dissect_rpc_bool(tvb, attr_tree, hf_nfs4_fattr_case_preserving, offset);
7499
0
      break;
7500
7501
0
    case FATTR4_CHOWN_RESTRICTED:
7502
0
      offset = dissect_rpc_bool(tvb, attr_tree, hf_nfs4_fattr_chown_restricted, offset);
7503
0
      break;
7504
7505
0
    case FATTR4_FILEID:
7506
0
      offset = dissect_rpc_uint64(tvb, attr_tree, hf_nfs4_fattr_fileid, offset);
7507
0
      break;
7508
7509
0
    case FATTR4_FILES_AVAIL:
7510
0
      offset = dissect_rpc_uint64(tvb, attr_tree, hf_nfs4_fattr_files_avail, offset);
7511
0
      break;
7512
7513
0
    case FATTR4_FILEHANDLE:
7514
0
      offset = dissect_nfs4_fh(tvb, offset, pinfo, attr_tree, "fattr4_filehandle", NULL, NULL, NULL, civ, opcode, fh_idx);
7515
0
      break;
7516
7517
0
    case FATTR4_FILES_FREE:
7518
0
      offset = dissect_rpc_uint64(tvb, attr_tree, hf_nfs4_fattr_files_free, offset);
7519
0
      break;
7520
7521
0
    case FATTR4_FILES_TOTAL:
7522
0
      offset = dissect_rpc_uint64(tvb, attr_tree, hf_nfs4_fattr_files_total, offset);
7523
0
      break;
7524
7525
0
    case FATTR4_FS_LOCATIONS:
7526
0
      offset = dissect_nfs4_fs_locations(tvb, pinfo, offset, attr_tree,
7527
0
        "fattr4_fs_locations");
7528
0
      break;
7529
7530
0
    case FATTR4_HIDDEN:
7531
0
      offset = dissect_rpc_bool(tvb, attr_tree, hf_nfs4_fattr_hidden, offset);
7532
0
      break;
7533
7534
0
    case FATTR4_HOMOGENEOUS:
7535
0
      offset = dissect_rpc_bool(tvb, attr_tree, hf_nfs4_fattr_homogeneous, offset);
7536
0
      break;
7537
7538
0
    case FATTR4_MAXFILESIZE:
7539
0
      offset = dissect_rpc_uint64(tvb, attr_tree, hf_nfs4_fattr_maxfilesize, offset);
7540
0
      break;
7541
7542
0
    case FATTR4_MAXLINK:
7543
0
      offset = dissect_rpc_uint32(tvb, attr_tree, hf_nfs4_fattr_maxlink, offset);
7544
0
      break;
7545
7546
0
    case FATTR4_MAXNAME:
7547
0
      offset = dissect_rpc_uint32(tvb, attr_tree, hf_nfs4_fattr_maxname, offset);
7548
0
      break;
7549
7550
0
    case FATTR4_MAXREAD:
7551
0
      offset = dissect_rpc_uint64(tvb, attr_tree, hf_nfs4_fattr_maxread, offset);
7552
0
      break;
7553
7554
0
    case FATTR4_MAXWRITE:
7555
0
      offset = dissect_rpc_uint64(tvb, attr_tree, hf_nfs4_fattr_maxwrite, offset);
7556
0
      break;
7557
7558
0
    case FATTR4_MIMETYPE:
7559
0
      offset = dissect_nfs_utf8string(tvb, pinfo, offset, attr_tree,  hf_nfs4_fattr_mimetype,
7560
0
        NULL);
7561
0
      break;
7562
7563
0
    case FATTR4_MODE:
7564
0
      offset = dissect_nfs4_mode(tvb, offset, attr_tree);
7565
0
      break;
7566
7567
0
    case FATTR4_NO_TRUNC:
7568
0
      offset = dissect_rpc_bool(tvb, attr_tree, hf_nfs4_fattr_no_trunc, offset);
7569
0
      break;
7570
7571
0
    case FATTR4_NUMLINKS:
7572
0
      offset = dissect_rpc_uint32(tvb, attr_tree, hf_nfs4_fattr_numlinks, offset);
7573
0
      break;
7574
7575
0
    case FATTR4_OWNER:
7576
0
      offset = dissect_nfs_utf8string(tvb, pinfo, offset, attr_tree,  hf_nfs4_fattr_owner,
7577
0
        NULL);
7578
0
      break;
7579
7580
0
    case FATTR4_OWNER_GROUP:
7581
0
      offset = dissect_nfs_utf8string(tvb, pinfo, offset, attr_tree,
7582
0
        hf_nfs4_fattr_owner_group, NULL);
7583
0
      break;
7584
7585
0
    case FATTR4_QUOTA_AVAIL_HARD:
7586
0
      offset = dissect_rpc_uint64(tvb, attr_tree, hf_nfs4_fattr_quota_hard, offset);
7587
0
      break;
7588
7589
0
    case FATTR4_QUOTA_AVAIL_SOFT:
7590
0
      offset = dissect_rpc_uint64(tvb, attr_tree, hf_nfs4_fattr_quota_soft, offset);
7591
0
      break;
7592
7593
0
    case FATTR4_QUOTA_USED:
7594
0
      offset = dissect_rpc_uint64(tvb, attr_tree, hf_nfs4_fattr_quota_used, offset);
7595
0
      break;
7596
7597
0
    case FATTR4_RAWDEV:
7598
0
      offset = dissect_nfs4_specdata(tvb, offset, attr_tree);
7599
0
      break;
7600
7601
0
    case FATTR4_SPACE_AVAIL:
7602
0
      offset = dissect_rpc_uint64(tvb, attr_tree, hf_nfs4_fattr_space_avail, offset);
7603
0
      break;
7604
7605
0
    case FATTR4_SPACE_FREE:
7606
0
      offset = dissect_rpc_uint64(tvb, attr_tree, hf_nfs4_fattr_space_free, offset);
7607
0
      break;
7608
7609
0
    case FATTR4_SPACE_TOTAL:
7610
0
      offset = dissect_rpc_uint64(tvb, attr_tree, hf_nfs4_fattr_space_total, offset);
7611
0
      break;
7612
7613
0
    case FATTR4_SPACE_USED:
7614
0
      offset = dissect_rpc_uint64(tvb, attr_tree, hf_nfs4_fattr_space_used, offset);
7615
0
      break;
7616
7617
0
    case FATTR4_SYSTEM:
7618
0
      if (attr_tree)
7619
0
        dissect_rpc_bool(tvb, attr_tree, hf_nfs4_fattr_system, offset);
7620
0
      offset += 4;
7621
0
      break;
7622
7623
0
    case FATTR4_TIME_ACCESS:
7624
0
    case FATTR4_TIME_BACKUP:
7625
0
    case FATTR4_TIME_CREATE:
7626
0
    case FATTR4_TIME_DELTA:
7627
0
    case FATTR4_TIME_METADATA:
7628
0
    case FATTR4_TIME_MODIFY:
7629
0
    case FATTR4_DIR_NOTIF_DELAY:
7630
0
    case FATTR4_DIRENT_NOTIF_DELAY:
7631
0
    case FATTR4_TIME_DELEG_ACCESS:
7632
0
    case FATTR4_TIME_DELEG_MODIFY:
7633
0
      if (attr_tree)
7634
0
        dissect_nfs4_nfstime(tvb, offset, attr_tree);
7635
0
      offset += 12;
7636
0
      break;
7637
7638
0
    case FATTR4_TIME_ACCESS_SET:
7639
0
    case FATTR4_TIME_MODIFY_SET:
7640
0
      offset = dissect_nfs4_settime(tvb, offset, attr_tree, "settime4");
7641
0
      break;
7642
7643
0
    case FATTR4_MOUNTED_ON_FILEID:
7644
0
      offset = dissect_rpc_uint64(tvb, attr_tree, hf_nfs4_fattr_mounted_on_fileid,
7645
0
             offset);
7646
0
      break;
7647
7648
0
    case FATTR4_FS_LAYOUT_TYPE:
7649
0
      offset = dissect_nfs_fs_layout_type(tvb, attr_tree, offset);
7650
0
      break;
7651
7652
0
    case FATTR4_LAYOUT_BLKSIZE:
7653
0
      offset = dissect_rpc_uint32(tvb, attr_tree, hf_nfs4_fattr_layout_blksize,
7654
0
            offset);
7655
0
      break;
7656
7657
0
    case FATTR4_MDSTHRESHOLD:
7658
0
      offset = dissect_nfs4_mdsthreshold(tvb, pinfo, offset, attr_tree);
7659
0
      break;
7660
7661
0
    case FATTR4_CLONE_BLOCKSIZE:
7662
0
      offset = dissect_rpc_uint32(tvb, attr_tree, hf_nfs4_fattr_clone_blocksize,
7663
0
            offset);
7664
0
      break;
7665
7666
0
    case FATTR4_SPACE_FREED:
7667
0
      offset = dissect_rpc_uint64(tvb, attr_tree, hf_nfs4_fattr_space_freed,
7668
0
            offset);
7669
0
      break;
7670
7671
0
    case FATTR4_CHANGE_ATTR_TYPE:
7672
0
      offset = dissect_rpc_uint32(tvb, attr_tree, hf_nfs4_fattr_change_attr_type,
7673
0
            offset);
7674
0
      break;
7675
7676
0
    case FATTR4_SECURITY_LABEL:
7677
0
      offset = dissect_nfs4_security_label(tvb, pinfo, attr_tree, offset);
7678
0
      break;
7679
7680
0
    case FATTR4_MODE_UMASK:
7681
0
      offset = dissect_nfs4_mode_umask(tvb, attr_tree, offset);
7682
0
      break;
7683
7684
0
    case FATTR4_XATTR_SUPPORT:
7685
0
      offset = dissect_rpc_bool(tvb,
7686
0
        attr_tree, hf_nfs4_fattr_xattr_support, offset);
7687
0
      break;
7688
7689
0
    case FATTR4_OFFLINE:
7690
0
      offset = dissect_rpc_bool(tvb,
7691
0
        attr_tree, hf_nfs4_fattr_offline, offset);
7692
0
      break;
7693
7694
0
    case FATTR4_FS_CHARSET_CAP:
7695
0
      offset = dissect_nfs4_fattr_fs_charset_cap(tvb, offset, attr_tree);
7696
0
      break;
7697
7698
0
    default:
7699
0
      break;
7700
0
  }
7701
7702
0
  return offset;
7703
0
}
7704
7705
/* Display each attrmask bitmap and optionally dissect the value. */
7706
static unsigned
7707
dissect_nfs4_fattrs(tvbuff_t *tvb, unsigned offset, packet_info *pinfo, proto_tree *tree, int type, rpc_call_info_value *civ, uint32_t opcode, uint32_t fh_idx)
7708
0
{
7709
0
  static uint32_t fattr_obj_type = 0;
7710
0
  nfs4_bitmap_type_t bitmap_type;
7711
0
  static nfs4_bitmap_info_t bitmap_info = {
7712
0
    .vse_names_ext  = &fattr4_names_ext,
7713
0
    .dissect_battr  = dissect_nfs4_fattr_value,
7714
0
    .battr_data     = &fattr_obj_type,
7715
0
    .hf_mask_label  = &hf_nfs4_attr_mask,
7716
0
    .hf_item_count  = &hf_nfs4_attr_count,
7717
0
    .get_item_label = nfs4_fattr_item_label
7718
0
  };
7719
7720
0
  fattr_obj_type = 0;
7721
0
  bitmap_type = (type == FATTR4_BITMAP_ONLY) ? NFS4_BITMAP_MASK : NFS4_BITMAP_VALUES;
7722
7723
0
  return dissect_nfs4_bitmap(tvb, offset, pinfo, tree, civ, opcode, fh_idx, &bitmap_info, bitmap_type, NULL);
7724
0
}
7725
7726
static const value_string names_open4_share_access[] = {
7727
#define  OPEN4_SHARE_ACCESS_WANT_NO_PREFERENCE     0x0000
7728
  { OPEN4_SHARE_ACCESS_WANT_NO_PREFERENCE, "OPEN4_SHARE_ACCESS_WANT_NO_PREFERENCE" },
7729
#define OPEN4_SHARE_ACCESS_READ 0x00000001
7730
  { OPEN4_SHARE_ACCESS_READ, "OPEN4_SHARE_ACCESS_READ" },
7731
#define OPEN4_SHARE_ACCESS_WRITE 0x00000002
7732
  { OPEN4_SHARE_ACCESS_WRITE, "OPEN4_SHARE_ACCESS_WRITE" },
7733
#define OPEN4_SHARE_ACCESS_BOTH 0x00000003
7734
  { OPEN4_SHARE_ACCESS_BOTH, "OPEN4_SHARE_ACCESS_BOTH" },
7735
#define  OPEN4_SHARE_ACCESS_WANT_READ_DELEG        0x0100
7736
  { OPEN4_SHARE_ACCESS_WANT_READ_DELEG, "OPEN4_SHARE_ACCESS_WANT_READ_DELEG" },
7737
#define  OPEN4_SHARE_ACCESS_WANT_WRITE_DELEG       0x0200
7738
  { OPEN4_SHARE_ACCESS_WANT_WRITE_DELEG, "OPEN4_SHARE_ACCESS_WANT_WRITE_DELEG" },
7739
#define  OPEN4_SHARE_ACCESS_WANT_ANY_DELEG         0x0300
7740
  { OPEN4_SHARE_ACCESS_WANT_ANY_DELEG, "OPEN4_SHARE_ACCESS_WANT_ANY_DELEG" },
7741
#define  OPEN4_SHARE_ACCESS_WANT_NO_DELEG          0x0400
7742
  { OPEN4_SHARE_ACCESS_WANT_NO_DELEG, "OPEN4_SHARE_ACCESS_WANT_NO_DELEG" },
7743
#define  OPEN4_SHARE_ACCESS_WANT_CANCEL            0x0500
7744
  { OPEN4_SHARE_ACCESS_WANT_CANCEL, "OPEN4_SHARE_ACCESS_WANT_CANCEL" },
7745
16
#define OPEN4_SHARE_ACCESS_WANT_SIGNAL_DELEG_WHEN_RESRC_AVAIL 0x00010000
7746
  { OPEN4_SHARE_ACCESS_WANT_SIGNAL_DELEG_WHEN_RESRC_AVAIL,
7747
    "OPEN4_SHARE_ACCESS_WANT_SIGNAL_DELEG_WHEN_RESRC_AVAIL"},
7748
16
#define OPEN4_SHARE_ACCESS_WANT_PUSH_DELEG_WHEN_UNCONTENDED  0x00020000
7749
  { OPEN4_SHARE_ACCESS_WANT_PUSH_DELEG_WHEN_UNCONTENDED,
7750
   "OPEN4_SHARE_ACCESS_WANT_PUSH_DELEG_WHEN_UNCONTENDED"},
7751
16
#define OPEN4_SHARE_ACCESS_WANT_DELEG_TIMESTAMPS 0x00100000
7752
  {OPEN4_SHARE_ACCESS_WANT_DELEG_TIMESTAMPS,
7753
   "OPEN4_SHARE_ACCESS_WANT_DELEG_TIMESTAMPS"},
7754
  { 0, NULL }
7755
};
7756
static value_string_ext names_open4_share_access_ext = VALUE_STRING_EXT_INIT(names_open4_share_access);
7757
7758
static unsigned
7759
dissect_nfs4_open_share_access(tvbuff_t *tvb, unsigned offset, proto_tree *tree)
7760
0
{
7761
0
  proto_item *notify_item;
7762
0
  proto_tree *notify_tree;
7763
0
  unsigned      share_access;
7764
0
  unsigned      want_flags;
7765
0
  unsigned      want_notify_flags;
7766
7767
0
  want_notify_flags = tvb_get_ntohl(tvb, offset);
7768
0
  share_access = want_notify_flags & 0x3;
7769
0
  want_flags = want_notify_flags & 0xff00;
7770
0
  want_notify_flags &= 0x130000;
7771
0
  proto_tree_add_uint(tree, hf_nfs4_open_share_access, tvb, offset, 4, share_access);
7772
0
  if (want_flags)
7773
0
    proto_tree_add_uint(tree, hf_nfs4_want_flags, tvb, offset, 4, want_flags);
7774
0
  if (want_notify_flags) {
7775
0
    notify_item = proto_tree_add_uint(tree, hf_nfs4_want_notify_flags, tvb, offset, 4, want_notify_flags);
7776
7777
0
    notify_tree = proto_item_add_subtree(notify_item, ett_nfs4_want_notify_flags);
7778
0
    proto_tree_add_item(notify_tree, hf_nfs4_want_signal_deleg_when_resrc_avail, tvb, offset, 4, ENC_BIG_ENDIAN);
7779
0
    proto_tree_add_item(notify_tree, hf_nfs4_want_push_deleg_when_uncontended, tvb, offset, 4, ENC_BIG_ENDIAN);
7780
0
  }
7781
0
  offset += 4;
7782
7783
0
  return offset;
7784
0
}
7785
7786
static const value_string names_open4_share_deny[] = {
7787
#define OPEN4_SHARE_DENY_NONE 0x00000000
7788
  { OPEN4_SHARE_DENY_NONE, "OPEN4_SHARE_DENY_NONE" },
7789
#define OPEN4_SHARE_DENY_READ 0x00000001
7790
  { OPEN4_SHARE_DENY_READ, "OPEN4_SHARE_DENY_READ" },
7791
#define OPEN4_SHARE_DENY_WRITE 0x00000002
7792
  { OPEN4_SHARE_DENY_WRITE, "OPEN4_SHARE_DENY_WRITE" },
7793
#define OPEN4_SHARE_DENY_BOTH 0x00000003
7794
  { OPEN4_SHARE_DENY_BOTH, "OPEN4_SHARE_DENY_BOTH" },
7795
  { 0, NULL }
7796
};
7797
7798
7799
static unsigned
7800
dissect_nfs4_open_share_deny(tvbuff_t *tvb, unsigned offset, proto_tree *tree)
7801
0
{
7802
0
  proto_tree_add_item(tree, hf_nfs4_open_share_deny, tvb, offset, 4, ENC_BIG_ENDIAN);
7803
0
  offset += 4;
7804
7805
0
  return offset;
7806
0
}
7807
7808
7809
static unsigned
7810
dissect_nfs4_open_owner(tvbuff_t *tvb, packet_info* pinfo, unsigned offset, proto_tree *tree)
7811
0
{
7812
0
  offset = dissect_rpc_uint64(tvb, tree, hf_nfs4_clientid, offset);
7813
0
  offset = dissect_nfsdata(tvb, pinfo, offset, tree, hf_nfs4_open_owner);
7814
7815
0
  return offset;
7816
0
}
7817
7818
7819
static unsigned
7820
dissect_nfs4_open_claim_delegate_cur(tvbuff_t *tvb, packet_info* pinfo, unsigned offset,
7821
             proto_tree *tree)
7822
0
{
7823
0
  offset = dissect_nfs4_stateid(tvb, offset, tree, NULL);
7824
0
  offset = dissect_nfs_utf8string(tvb, pinfo, offset, tree, hf_nfs4_component, NULL);
7825
7826
0
  return offset;
7827
0
}
7828
7829
0
#define CLAIM_NULL    0
7830
0
#define CLAIM_PREVIOUS    1
7831
0
#define CLAIM_DELEGATE_CUR  2
7832
0
#define CLAIM_DELEGATE_PREV 3
7833
#define CLAIM_FH    4
7834
#define CLAIM_DELEG_CUR_FH  5
7835
#define CLAIM_DELEG_CUR_PREV_FH 6
7836
7837
static const value_string names_claim_type4[] = {
7838
  { CLAIM_NULL,    "CLAIM_NULL"  },
7839
  { CLAIM_PREVIOUS,    "CLAIM_PREVIOUS" },
7840
  { CLAIM_DELEGATE_CUR,  "CLAIM_DELEGATE_CUR" },
7841
  { CLAIM_DELEGATE_PREV,   "CLAIM_DELEGATE_PREV" },
7842
  { CLAIM_FH,    "CLAIM_FH" },
7843
  { CLAIM_DELEG_CUR_FH,  "CLAIM_DELEG_CUR_FH"},
7844
  { CLAIM_DELEG_CUR_PREV_FH, "CLAIN_DELEG_CUR_PREV_FH"},
7845
  { 0, NULL }
7846
};
7847
7848
/* XXX - need a better place to populate name than here, maybe? */
7849
static unsigned
7850
dissect_nfs4_open_claim(tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
7851
  proto_tree *tree, const char **name,
7852
  int current_fh_offset, int current_fh_length,
7853
  rpc_call_info_value *civ, uint32_t fh_idx)
7854
0
{
7855
0
  unsigned      open_claim_type4;
7856
0
  proto_item *fitem;
7857
0
  proto_tree *newftree = NULL;
7858
0
  uint32_t      name_offset, name_len;
7859
7860
0
  if (name)
7861
0
    *name = NULL; /* will be filled later for CLAIM_NULL */
7862
7863
0
  open_claim_type4 = tvb_get_ntohl(tvb, offset);
7864
0
  fitem = proto_tree_add_uint(tree, hf_nfs4_open_claim_type, tvb,
7865
0
            offset+0, 4, open_claim_type4);
7866
0
  offset += 4;
7867
7868
0
  newftree = proto_item_add_subtree(fitem, ett_nfs4_open_claim);
7869
7870
0
  switch (open_claim_type4)
7871
0
  {
7872
0
    case CLAIM_NULL:
7873
0
      if (nfs_file_name_snooping) {
7874
0
        name_offset = offset+4;
7875
0
        name_len = tvb_get_ntohl(tvb, offset);
7876
0
        nfs_name_snoop_add_name(((uint64_t)fh_idx << 32) | civ->xid, tvb,
7877
0
          name_offset, name_len, current_fh_offset, current_fh_length, NULL);
7878
0
      }
7879
0
      offset = dissect_nfs_utf8string(tvb, pinfo, offset, newftree, hf_nfs4_component, name);
7880
0
      break;
7881
7882
0
    case CLAIM_PREVIOUS:
7883
0
      offset = dissect_rpc_uint32(tvb, newftree, hf_nfs4_delegate_type, offset);
7884
0
      break;
7885
7886
0
    case CLAIM_DELEGATE_CUR:
7887
0
      offset = dissect_nfs4_open_claim_delegate_cur(tvb, pinfo, offset, newftree);
7888
0
      break;
7889
7890
0
    case CLAIM_DELEGATE_PREV:
7891
0
      offset = dissect_nfs_utf8string(tvb, pinfo, offset, newftree, hf_nfs4_component, NULL);
7892
0
      break;
7893
7894
0
    default:
7895
0
      break;
7896
0
  }
7897
7898
0
  return offset;
7899
0
}
7900
7901
static const value_string names_createmode4[] = {
7902
  { UNCHECKED4, "UNCHECKED4" },
7903
  { GUARDED4, "GUARDED4" },
7904
  { EXCLUSIVE4, "EXCLUSIVE4" },
7905
  { EXCLUSIVE4_1, "EXCLUSIVE4_1" },
7906
  { 0, NULL }
7907
};
7908
7909
7910
static unsigned
7911
dissect_nfs4_createhow(tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
7912
           proto_tree *tree, rpc_call_info_value *civ)
7913
0
{
7914
0
  unsigned mode;
7915
7916
0
  mode = tvb_get_ntohl(tvb, offset);
7917
0
  proto_tree_add_uint(tree, hf_nfs4_createmode, tvb, offset, 4, mode);
7918
0
  offset += 4;
7919
7920
0
  switch (mode)
7921
0
  {
7922
0
  case UNCHECKED4:
7923
0
  case GUARDED4:
7924
0
    offset = dissect_nfs4_fattrs(tvb, offset, pinfo, tree, FATTR4_DISSECT_VALUES, civ, -1, -1);
7925
0
    break;
7926
7927
0
  case EXCLUSIVE4:
7928
0
    offset = dissect_rpc_uint64(tvb, tree, hf_nfs4_verifier, offset);
7929
0
    break;
7930
7931
0
  case EXCLUSIVE4_1:
7932
0
    offset = dissect_rpc_uint64(tvb, tree, hf_nfs4_verifier, offset);
7933
0
    offset = dissect_nfs4_fattrs(tvb, offset, pinfo, tree, FATTR4_DISSECT_VALUES, civ, -1, -1);
7934
0
    break;
7935
7936
0
  default:
7937
0
    break;
7938
0
  }
7939
7940
0
  return offset;
7941
0
}
7942
7943
7944
#define OPEN4_NOCREATE        0
7945
0
#define OPEN4_CREATE        1
7946
static const value_string names_opentype4[] = {
7947
  { OPEN4_NOCREATE, "OPEN4_NOCREATE"  },
7948
  { OPEN4_CREATE, "OPEN4_CREATE" },
7949
  { 0, NULL }
7950
};
7951
7952
static unsigned
7953
dissect_nfs4_openflag(tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
7954
  proto_tree *tree, rpc_call_info_value *civ)
7955
0
{
7956
0
  unsigned      opentype4;
7957
0
  proto_item *fitem;
7958
0
  proto_tree *newftree;
7959
7960
0
  opentype4 = tvb_get_ntohl(tvb, offset);
7961
0
  fitem = proto_tree_add_uint(tree, hf_nfs4_opentype, tvb,
7962
0
    offset+0, 4, opentype4);
7963
0
  offset += 4;
7964
7965
0
  newftree = proto_item_add_subtree(fitem, ett_nfs4_opentype);
7966
7967
0
  switch (opentype4)
7968
0
  {
7969
0
    case OPEN4_CREATE:
7970
0
      offset = dissect_nfs4_createhow(tvb, offset, pinfo, newftree, civ);
7971
0
      break;
7972
7973
0
    default:
7974
0
      break;
7975
0
  }
7976
7977
0
  return offset;
7978
0
}
7979
7980
7981
static unsigned
7982
dissect_nfs4_clientaddr(tvbuff_t *tvb, packet_info* pinfo, unsigned offset, proto_tree *tree)
7983
0
{
7984
0
  const char *universal_ip_address = NULL;
7985
0
  const char *protocol     = NULL;
7986
0
  unsigned  b1, b2, b3, b4, b5, b6, b7, b8, b9, b10;
7987
0
  uint16_t port;
7988
0
  int addr_offset;
7989
0
  uint32_t ipv4;
7990
0
  ws_in6_addr ipv6;
7991
0
  address addr;
7992
0
  proto_item* ti;
7993
7994
0
  offset = dissect_rpc_string(tvb, pinfo, tree, hf_nfs4_r_netid, offset, &protocol);
7995
0
  addr_offset = offset;
7996
0
  offset = dissect_rpc_string(tvb, pinfo, tree, hf_nfs4_r_addr, offset, &universal_ip_address);
7997
7998
0
  if (strlen(protocol) == 3 && strncmp(protocol, "tcp", 3) == 0) {
7999
0
    if (universal_ip_address && sscanf(universal_ip_address, "%u.%u.%u.%u.%u.%u",
8000
0
               &b1, &b2, &b3, &b4, &b5, &b6) == 6) {
8001
      /* IPv4: h1.h2.h3.h4.p1.p2 */
8002
0
      port = (b5<<8) | b6;
8003
0
      ipv4 = g_htonl((b1<<24) | (b2<<16) | (b3<<8) | b4);
8004
0
      set_address(&addr, AT_IPv4, 4, &ipv4);
8005
0
      ti = proto_tree_add_ipv4_format(tree, hf_nfs4_universal_address_ipv4, tvb, addr_offset, offset-addr_offset, ipv4, "IPv4 address %s, protocol=%s, port=%u",
8006
0
        address_to_str(pinfo->pool, &addr), protocol, port);
8007
0
      proto_item_set_generated(ti);
8008
0
    } else if (universal_ip_address && sscanf(universal_ip_address, "%u.%u",
8009
0
               &b1, &b2) == 2) {
8010
      /* Some clients (linux) sometimes send only the port. */
8011
0
      port = (b1<<8) | b2;
8012
0
      ti = proto_tree_add_ipv4_format(tree, hf_nfs4_universal_address_ipv4, tvb, addr_offset, offset-addr_offset, 0, "ip address NOT SPECIFIED, protocol=%s, port=%u", protocol, port);
8013
0
      proto_item_set_generated(ti);
8014
0
    } else if (universal_ip_address && sscanf(universal_ip_address,
8015
0
            "%2x:%2x:%2x:%2x:%2x:%2x:%2x:%2x.%u.%u",
8016
0
            &b1, &b2, &b3, &b4, &b5, &b6, &b7, &b8, &b9, &b10) == 10) {
8017
0
      port = (b9<<8) | b10;
8018
0
      memset(&ipv6, 0, sizeof(ipv6));
8019
0
      ipv6.bytes[0] = b1; ipv6.bytes[1] = b2; ipv6.bytes[2] = b3; ipv6.bytes[3] = b4;
8020
0
      ipv6.bytes[4] = b5; ipv6.bytes[5] = b6; ipv6.bytes[6] = b7; ipv6.bytes[7] = b8;
8021
0
      set_address(&addr, AT_IPv6, 16, &ipv6);
8022
0
      ti = proto_tree_add_ipv6_format(tree, hf_nfs4_universal_address_ipv6, tvb, addr_offset, offset-addr_offset, &ipv6, "IPv6 address %s, protocol=%s, port=%u",
8023
0
        address_to_str(pinfo->pool, &addr), protocol, port);
8024
0
      proto_item_set_generated(ti);
8025
0
    } else {
8026
0
      ti = proto_tree_add_ipv4_format(tree, hf_nfs4_universal_address_ipv4, tvb, addr_offset, offset-addr_offset, 0, "Invalid address");
8027
0
      proto_item_set_generated(ti);
8028
0
    }
8029
0
  }
8030
0
  return offset;
8031
0
}
8032
8033
8034
static unsigned
8035
dissect_nfs4_cb_client4(tvbuff_t *tvb, packet_info* pinfo, unsigned offset, proto_tree *tree)
8036
0
{
8037
0
  proto_tree *cb_location;
8038
0
  proto_item *fitem;
8039
0
  unsigned    old_offset;
8040
8041
0
  nfs4_cb_register_prog(tvb, offset);
8042
0
  offset = dissect_rpc_uint32(tvb, tree, hf_nfs4_cb_program, offset);
8043
0
  old_offset = offset;
8044
0
  cb_location = proto_tree_add_subtree(tree, tvb, offset, 0, ett_nfs4_clientaddr, &fitem, "cb_location");
8045
8046
0
  offset = dissect_nfs4_clientaddr(tvb, pinfo, offset, cb_location);
8047
0
  proto_item_set_len(fitem, offset - old_offset);
8048
8049
0
  return offset;
8050
0
}
8051
8052
8053
static const value_string names_stable_how4[] = {
8054
#define UNSTABLE4 0
8055
  { UNSTABLE4,  "UNSTABLE4" },
8056
#define DATA_SYNC4 1
8057
  { DATA_SYNC4, "DATA_SYNC4"  },
8058
#define FILE_SYNC4 2
8059
  { FILE_SYNC4, "FILE_SYNC4"  },
8060
  { 0,  NULL  }
8061
};
8062
8063
static unsigned
8064
dissect_nfs4_stable_how(tvbuff_t *tvb, packet_info* pinfo, unsigned offset, proto_tree *tree, const char *name)
8065
0
{
8066
0
  unsigned stable_how4;
8067
8068
0
  stable_how4 = tvb_get_ntohl(tvb, offset);
8069
0
  proto_tree_add_uint_format(tree, hf_nfs4_stable_how, tvb,
8070
0
      offset+0, 4, stable_how4, "%s: %s (%u)", name,
8071
0
      val_to_str(pinfo->pool, stable_how4, names_stable_how4, "%u"), stable_how4);
8072
0
  offset += 4;
8073
8074
0
  return offset;
8075
0
}
8076
8077
static const value_string names_data_content[] = {
8078
  { 0,  "DATA"  },
8079
  { 1,  "HOLE"  },
8080
  { 0, NULL }
8081
};
8082
8083
static const value_string names_setxattr_options[] = {
8084
  { 0,  "EITHER"  },
8085
  { 1,  "CREATE"  },
8086
  { 2,  "REPLACE"  },
8087
  { 0, NULL }
8088
};
8089
8090
static unsigned
8091
dissect_nfs4_listxattr_names(tvbuff_t *tvb, packet_info* pinfo, unsigned offset, proto_tree *tree)
8092
0
{
8093
0
  uint32_t      comp_count, i;
8094
0
  proto_item *fitem;
8095
0
  proto_tree *newftree;
8096
8097
0
  fitem = proto_tree_add_item_ret_uint(tree, hf_nfs4_listxattr_names_len, tvb, offset, 4, ENC_BIG_ENDIAN, &comp_count);
8098
0
  offset += 4;
8099
8100
0
  newftree = proto_item_add_subtree(fitem, ett_nfs4_listxattr_names);
8101
8102
0
  for (i = 0; i < comp_count; i++)
8103
0
    offset = dissect_nfs_utf8string(tvb, pinfo, offset, newftree, hf_nfs4_xattrkey, NULL);
8104
0
  return offset;
8105
0
}
8106
8107
static unsigned
8108
dissect_nfs4_gdd_time(tvbuff_t *tvb, unsigned offset, proto_tree *tree, int hfindex)
8109
0
{
8110
0
  proto_item *item;
8111
0
  proto_tree *subtree;
8112
8113
0
  item = proto_tree_add_item(tree, hfindex, tvb, offset, 12, ENC_NA);
8114
0
  subtree = proto_item_add_subtree(item, ett_nfs4_notify_delay);
8115
0
  return dissect_nfs4_nfstime(tvb, offset, subtree);
8116
0
}
8117
8118
static unsigned
8119
dissect_nfs4_gdd_fattrs(tvbuff_t *tvb, unsigned offset, packet_info *pinfo, proto_tree *tree, int type,
8120
      rpc_call_info_value *civ, int hfindex, uint32_t opcode, uint32_t fh_idx)
8121
0
{
8122
0
  proto_item *item;
8123
0
  proto_tree *subtree;
8124
0
  int len;
8125
8126
0
  len = tvb_get_ntohl(tvb, offset);
8127
8128
0
  item = proto_tree_add_item(tree, hfindex, tvb, offset, len * 4, ENC_NA);
8129
0
  subtree = proto_item_add_subtree(item, ett_nfs4_notify_attrs);
8130
0
  return dissect_nfs4_fattrs(tvb, offset, pinfo, subtree, type, civ, opcode, fh_idx);
8131
0
}
8132
8133
/* NFSv4 Operations  */
8134
static const value_string names_nfs4_operation[] = {
8135
  { NFS4_OP_ACCESS,                "ACCESS"  },
8136
  { NFS4_OP_CLOSE,                 "CLOSE"  },
8137
  { NFS4_OP_COMMIT,                "COMMIT"  },
8138
  { NFS4_OP_CREATE,                "CREATE"  },
8139
  { NFS4_OP_DELEGPURGE,            "DELEGPURGE"  },
8140
  { NFS4_OP_DELEGRETURN,           "DELEGRETURN"  },
8141
  { NFS4_OP_GETATTR,               "GETATTR"  },
8142
  { NFS4_OP_GETFH,                 "GETFH"  },
8143
  { NFS4_OP_LINK,                  "LINK"  },
8144
  { NFS4_OP_LOCK,                  "LOCK"  },
8145
  { NFS4_OP_LOCKT,                 "LOCKT"  },
8146
  { NFS4_OP_LOCKU,                 "LOCKU"  },
8147
  { NFS4_OP_LOOKUP,                "LOOKUP"  },
8148
  { NFS4_OP_LOOKUPP,               "LOOKUPP"  },
8149
  { NFS4_OP_NVERIFY,               "NVERIFY"  },
8150
  { NFS4_OP_OPEN,                  "OPEN"  },
8151
  { NFS4_OP_OPENATTR,              "OPENATTR"  },
8152
  { NFS4_OP_OPEN_CONFIRM,          "OPEN_CONFIRM"  },
8153
  { NFS4_OP_OPEN_DOWNGRADE,        "OPEN_DOWNGRADE"  },
8154
  { NFS4_OP_PUTFH,                 "PUTFH"  },
8155
  { NFS4_OP_PUTPUBFH,              "PUTPUBFH"  },
8156
  { NFS4_OP_PUTROOTFH,             "PUTROOTFH"  },
8157
  { NFS4_OP_READ,                  "READ"  },
8158
  { NFS4_OP_READDIR,               "READDIR"  },
8159
  { NFS4_OP_READLINK,              "READLINK"  },
8160
  { NFS4_OP_REMOVE,                "REMOVE"  },
8161
  { NFS4_OP_RENAME,                "RENAME"  },
8162
  { NFS4_OP_RENEW,                 "RENEW"  },
8163
  { NFS4_OP_RESTOREFH,             "RESTOREFH"  },
8164
  { NFS4_OP_SAVEFH,                "SAVEFH"  },
8165
  { NFS4_OP_SECINFO,               "SECINFO"  },
8166
  { NFS4_OP_SETATTR,               "SETATTR"  },
8167
  { NFS4_OP_SETCLIENTID,           "SETCLIENTID"  },
8168
  { NFS4_OP_SETCLIENTID_CONFIRM,   "SETCLIENTID_CONFIRM"  },
8169
  { NFS4_OP_VERIFY,                "VERIFY"  },
8170
  { NFS4_OP_WRITE,                 "WRITE"  },
8171
  { NFS4_OP_RELEASE_LOCKOWNER,     "RELEASE_LOCKOWNER"  },
8172
  { NFS4_OP_BACKCHANNEL_CTL,       "BACKCHANNEL_CTL"  },
8173
  { NFS4_OP_BIND_CONN_TO_SESSION,  "BIND_CONN_TO_SESSION"  },
8174
  { NFS4_OP_EXCHANGE_ID,           "EXCHANGE_ID"  },
8175
  { NFS4_OP_CREATE_SESSION,        "CREATE_SESSION"  },
8176
  { NFS4_OP_DESTROY_SESSION,       "DESTROY_SESSION"  },
8177
  { NFS4_OP_FREE_STATEID,          "FREE_STATEID"  },
8178
  { NFS4_OP_GET_DIR_DELEGATION,    "GET_DIR_DELEGATION"  },
8179
  { NFS4_OP_GETDEVINFO,            "GETDEVINFO"  },
8180
  { NFS4_OP_GETDEVLIST,            "GETDEVLIST"  },
8181
  { NFS4_OP_LAYOUTCOMMIT,          "LAYOUTCOMMIT"  },
8182
  { NFS4_OP_LAYOUTGET,             "LAYOUTGET"  },
8183
  { NFS4_OP_LAYOUTRETURN,          "LAYOUTRETURN"  },
8184
  { NFS4_OP_SECINFO_NO_NAME,       "SECINFO_NO_NAME"  },
8185
  { NFS4_OP_SEQUENCE,              "SEQUENCE"  },
8186
  { NFS4_OP_SET_SSV,               "SET_SSV"  },
8187
  { NFS4_OP_TEST_STATEID,          "TEST_STATEID"  },
8188
  { NFS4_OP_WANT_DELEGATION,       "WANT_DELEG"  },
8189
  { NFS4_OP_DESTROY_CLIENTID,      "DESTROY_CLIENTID"  },
8190
  { NFS4_OP_RECLAIM_COMPLETE,      "RECLAIM_COMPLETE"  },
8191
  { NFS4_OP_ALLOCATE,              "ALLOCATE"  },
8192
  { NFS4_OP_COPY,                  "COPY"  },
8193
  { NFS4_OP_COPY_NOTIFY,           "COPY_NOTIFY"  },
8194
  { NFS4_OP_DEALLOCATE,            "DEALLOCATE"  },
8195
  { NFS4_OP_IO_ADVISE,             "IO_ADVISE"  },
8196
  { NFS4_OP_LAYOUTERROR,           "LAYOUTERROR"  },
8197
  { NFS4_OP_LAYOUTSTATS,           "LAYOUTSTATS"  },
8198
  { NFS4_OP_OFFLOAD_CANCEL,        "OFFLOAD_CANCEL"  },
8199
  { NFS4_OP_OFFLOAD_STATUS,        "OFFLOAD_STATUS"  },
8200
  { NFS4_OP_READ_PLUS,             "READ_PLUS"  },
8201
  { NFS4_OP_SEEK,                  "SEEK"  },
8202
  { NFS4_OP_WRITE_SAME,            "WRITE_SAME"  },
8203
  { NFS4_OP_CLONE,                 "CLONE"  },
8204
  { NFS4_OP_GETXATTR,              "GETXATTR"  },
8205
  { NFS4_OP_SETXATTR,              "SETXATTR"  },
8206
  { NFS4_OP_LISTXATTRS,            "LISTXATTRS"  },
8207
  { NFS4_OP_REMOVEXATTR,           "REMOVEXATTR"  },
8208
  { NFS4_OP_ILLEGAL,               "ILLEGAL"  },
8209
  { 0, NULL  }
8210
};
8211
8212
static value_string_ext names_nfs4_operation_ext = VALUE_STRING_EXT_INIT(names_nfs4_operation);
8213
8214
/* Each subtree number in this array corresponds to the associated item in the above
8215
*  'names_nfs4_operation array[]' array. */
8216
static int *nfs4_operation_ett[] =
8217
{
8218
   &ett_nfs4_access ,
8219
   &ett_nfs4_close ,
8220
   &ett_nfs4_commit ,
8221
   &ett_nfs4_create ,
8222
   &ett_nfs4_delegpurge ,
8223
   &ett_nfs4_delegreturn ,
8224
   &ett_nfs4_getattr ,
8225
   &ett_nfs4_getfh ,
8226
   &ett_nfs4_link ,
8227
   &ett_nfs4_lock ,
8228
   &ett_nfs4_lockt ,
8229
   &ett_nfs4_locku ,
8230
   &ett_nfs4_lookup ,
8231
   &ett_nfs4_lookupp ,
8232
   &ett_nfs4_nverify ,
8233
   &ett_nfs4_open ,
8234
   &ett_nfs4_openattr ,
8235
   &ett_nfs4_open_confirm ,
8236
   &ett_nfs4_open_downgrade ,
8237
   &ett_nfs4_putfh ,
8238
   &ett_nfs4_putpubfh ,
8239
   &ett_nfs4_putrootfh ,
8240
   &ett_nfs4_read ,
8241
   &ett_nfs4_readdir ,
8242
   &ett_nfs4_readlink ,
8243
   &ett_nfs4_remove ,
8244
   &ett_nfs4_rename ,
8245
   &ett_nfs4_renew ,
8246
   &ett_nfs4_restorefh ,
8247
   &ett_nfs4_savefh ,
8248
   &ett_nfs4_secinfo ,
8249
   &ett_nfs4_setattr ,
8250
   &ett_nfs4_setclientid ,
8251
   &ett_nfs4_setclientid_confirm ,
8252
   &ett_nfs4_verify ,
8253
   &ett_nfs4_write,
8254
   &ett_nfs4_release_lockowner,
8255
   &ett_nfs4_backchannel_ctl,
8256
   &ett_nfs4_bind_conn_to_session,
8257
   &ett_nfs4_exchange_id,
8258
   &ett_nfs4_create_session,
8259
   &ett_nfs4_destroy_session,
8260
   &ett_nfs4_free_stateid,
8261
   &ett_nfs4_get_dir_delegation,
8262
   &ett_nfs4_getdevinfo,
8263
   &ett_nfs4_getdevlist,
8264
   &ett_nfs4_layoutcommit,
8265
   &ett_nfs4_layoutget,
8266
   &ett_nfs4_layoutreturn,
8267
   &ett_nfs4_secinfo_no_name,
8268
   &ett_nfs4_sequence,
8269
   NULL, /* set ssv */
8270
   &ett_nfs4_test_stateid,
8271
   NULL, /* want delegation */
8272
   &ett_nfs4_destroy_clientid,
8273
   &ett_nfs4_reclaim_complete,
8274
   &ett_nfs4_allocate,
8275
   &ett_nfs4_copy,
8276
   &ett_nfs4_copy_notify,
8277
   &ett_nfs4_deallocate,
8278
   &ett_nfs4_io_advise,
8279
   &ett_nfs4_layouterror,
8280
   &ett_nfs4_layoutstats,
8281
   &ett_nfs4_offload_cancel,
8282
   &ett_nfs4_offload_status,
8283
   &ett_nfs4_read_plus,
8284
   &ett_nfs4_seek,
8285
   &ett_nfs4_write_same,
8286
   &ett_nfs4_clone,
8287
   &ett_nfs4_getxattr,
8288
   &ett_nfs4_setxattr,
8289
   &ett_nfs4_listxattr,
8290
   &ett_nfs4_removexattr,
8291
};
8292
8293
8294
static unsigned
8295
dissect_nfs4_dirlist(tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
8296
         proto_tree *tree, rpc_call_info_value *civ, uint32_t opcode, uint32_t fh_idx)
8297
0
{
8298
0
  uint32_t      val_follows;
8299
0
  uint32_t      name_len;
8300
0
  char     *name;
8301
0
  proto_tree *dirlist_tree;
8302
0
  proto_item *eitem;
8303
0
  proto_tree *entry_tree;
8304
8305
0
  dirlist_tree = proto_tree_add_subtree(tree, tvb, offset, 0, ett_nfs4_dirlist, NULL, "Directory Listing");
8306
8307
0
  while (1)
8308
0
  {
8309
0
    val_follows = tvb_get_ntohl(tvb, offset);
8310
0
    if (val_follows) {
8311
0
      int start_off = offset;
8312
8313
      /* Make sure we have 16 bytes (value follows + cookie + name length) */
8314
0
      name_len = tvb_get_ntohl(tvb, offset + 12);
8315
0
      tvb_ensure_bytes_exist(tvb, offset, 16 + name_len);
8316
      /*
8317
      * Get the entry name and create subtree of field nfs.name
8318
      */
8319
0
      name = (char*)tvb_get_string_enc(pinfo->pool, tvb, offset + 16, name_len, ENC_UTF_8);
8320
8321
0
      eitem = proto_tree_add_string_format(
8322
0
        dirlist_tree, hf_nfs_name, tvb, offset, -1, name, "Entry: %s", name);
8323
0
      entry_tree = proto_item_add_subtree(eitem, ett_nfs4_dir_entry);
8324
8325
      /* Value Follows: <Yes|No> */
8326
0
      proto_tree_add_boolean(entry_tree, hf_nfs4_value_follows, tvb, offset, 4, val_follows);
8327
0
      offset += 4;
8328
8329
      /* Directory entry cookie */
8330
0
      if (entry_tree)
8331
0
        dissect_rpc_uint64(tvb, entry_tree, hf_nfs4_cookie, offset);
8332
0
      offset += 8;
8333
8334
      /* Directory entry name (nfs.entry_name) */
8335
0
      offset = dissect_nfs_utf8string(tvb, pinfo, offset, entry_tree, hf_nfs4_dir_entry_name, NULL);
8336
8337
      /* Attrmask(s) */
8338
0
      offset = dissect_nfs4_fattrs(tvb, offset, pinfo, entry_tree, FATTR4_DISSECT_VALUES, civ, opcode, fh_idx);
8339
0
      proto_item_set_len(eitem, offset - start_off);
8340
0
    } else {
8341
0
      break;
8342
0
    }
8343
0
  }
8344
0
  if (dirlist_tree) {
8345
0
    proto_tree_add_boolean(dirlist_tree, hf_nfs4_value_follows, tvb, offset, 4, val_follows);
8346
0
    offset += 4;
8347
    /* The last entry in this packet has been reached but do more follow? */
8348
0
    offset = dissect_rpc_bool(tvb, dirlist_tree, hf_nfs4_dirlist_eof, offset);
8349
0
  } else {
8350
0
    offset += 8;
8351
0
  }
8352
0
  return offset;
8353
0
}
8354
8355
static unsigned
8356
dissect_nfs4_change_info(tvbuff_t *tvb, unsigned offset,
8357
       proto_tree *tree, const char *name)
8358
0
{
8359
0
  proto_tree *newftree;
8360
0
  proto_tree *fitem;
8361
0
  int         old_offset = offset;
8362
8363
0
  newftree = proto_tree_add_subtree(tree, tvb, offset, 0, ett_nfs4_change_info, &fitem, name);
8364
8365
0
  offset = dissect_rpc_bool(  tvb, newftree, hf_nfs4_change_info_atomic, offset);
8366
0
  offset = dissect_rpc_uint64(tvb, newftree, hf_nfs4_changeid_before,    offset);
8367
0
  offset = dissect_rpc_uint64(tvb, newftree, hf_nfs4_changeid_after,     offset);
8368
0
  proto_item_set_len(fitem, offset - old_offset);
8369
8370
0
  return offset;
8371
0
}
8372
8373
8374
static const value_string names_nfs_lock_type4[] =
8375
{
8376
#define READ_LT 1
8377
  { READ_LT,  "READ_LT" },
8378
#define WRITE_LT 2
8379
  { WRITE_LT, "WRITE_LT"  },
8380
#define READW_LT 3
8381
  { READW_LT, "READW_LT"  },
8382
#define WRITEW_LT 4
8383
  { WRITEW_LT,  "WRITEW_LT" },
8384
#define RELEASE_STATE 5
8385
  { RELEASE_STATE,  "RELEASE_STATE" },
8386
  { 0,  NULL  }
8387
};
8388
8389
static unsigned
8390
dissect_nfs4_lockdenied(tvbuff_t *tvb, packet_info* pinfo, unsigned offset, proto_tree *tree)
8391
0
{
8392
0
  offset = dissect_rpc_uint64(tvb, tree, hf_nfs4_offset, offset);
8393
0
  offset = dissect_rpc_uint64(tvb, tree, hf_nfs4_length, offset);
8394
0
  offset = dissect_rpc_uint32(tvb, tree, hf_nfs4_lock_type, offset);
8395
0
  offset = dissect_nfs4_lock_owner(tvb, pinfo, offset, tree);
8396
0
  return offset;
8397
0
}
8398
8399
8400
16
#define OPEN4_RESULT_CONFIRM    0x00000002
8401
16
#define OPEN4_RESULT_LOCKTYPE_POSIX 0x00000004
8402
16
#define OPEN4_RESULT_PRESERVE_UNLINKED  0x00000008
8403
16
#define OPEN4_RESULT_MAY_NOTIFY_LOCK  0x00000020
8404
8405
static int * const open4_result_flag_fields[] = {
8406
  &hf_nfs4_open_rflags_confirm,
8407
  &hf_nfs4_open_rflags_locktype_posix,
8408
  &hf_nfs4_open_rflags_preserve_unlinked,
8409
  &hf_nfs4_open_rflags_may_notify_lock,
8410
  NULL
8411
};
8412
8413
static unsigned
8414
dissect_nfs4_open_rflags(tvbuff_t *tvb, unsigned offset, proto_tree *tree)
8415
0
{
8416
0
  proto_tree_add_bitmask(tree, tvb, offset, hf_nfs4_open_rflags,
8417
0
      ett_nfs4_open_result_flags, open4_result_flag_fields, ENC_BIG_ENDIAN);
8418
0
  offset += 4;
8419
8420
0
  return offset;
8421
0
}
8422
8423
8424
static unsigned
8425
dissect_nfs4_stateid(tvbuff_t *tvb, unsigned offset, proto_tree *tree, uint16_t *hash)
8426
0
{
8427
0
  uint16_t     stateid_hash;
8428
0
  uint32_t     other_hash;
8429
0
  proto_item  *sitem, *hitem, *oth_item;
8430
0
  proto_tree  *stateid_tree;
8431
0
  int    old_offset = offset;
8432
8433
0
  sitem = proto_tree_add_bytes_format(tree, hf_nfs4_stateid, tvb, offset, 16, NULL, "StateID");
8434
0
  stateid_tree = proto_item_add_subtree(sitem, ett_nfs4_stateid);
8435
8436
0
  stateid_hash = crc16_ccitt_tvb_offset(tvb, offset, 16);
8437
0
  hitem = proto_tree_add_uint(stateid_tree, hf_nfs4_stateid_hash, tvb, offset, 16, stateid_hash);
8438
0
  proto_item_set_generated(hitem);
8439
8440
0
  offset = dissect_rpc_uint32(tvb, sitem, hf_nfs4_seqid_stateid, offset);
8441
8442
0
  proto_tree_add_item(stateid_tree, hf_nfs4_stateid_other, tvb, offset, 12, ENC_NA);
8443
8444
0
  other_hash = crc32_ccitt_tvb_offset(tvb, offset, 12);
8445
0
  oth_item = proto_tree_add_uint(stateid_tree, hf_nfs4_stateid_other_hash, tvb, offset, 12, other_hash);
8446
0
  proto_item_set_generated(oth_item);
8447
0
  offset+=12;
8448
8449
0
  if (hash)
8450
0
    *hash = stateid_hash;
8451
8452
0
  proto_item_set_len(sitem, offset - old_offset);
8453
8454
0
  return offset;
8455
0
}
8456
8457
8458
static unsigned
8459
dissect_nfs4_open_read_delegation(tvbuff_t *tvb, unsigned offset,
8460
      packet_info *pinfo, proto_tree *tree)
8461
0
{
8462
0
  offset = dissect_nfs4_stateid(tvb, offset, tree, NULL);
8463
0
  offset = dissect_rpc_bool(tvb, tree, hf_nfs4_recall4, offset);
8464
0
  offset = dissect_nfs4_ace(tvb, offset, pinfo, tree, 0, 0);
8465
8466
0
  return offset;
8467
0
}
8468
8469
8470
static unsigned
8471
dissect_nfs4_modified_limit(tvbuff_t *tvb, unsigned offset, proto_tree *tree)
8472
0
{
8473
0
  offset = dissect_rpc_uint32(tvb, tree, hf_nfs4_num_blocks, offset);
8474
0
  offset = dissect_rpc_uint32(tvb, tree, hf_nfs4_bytes_per_block, offset);
8475
8476
0
  return offset;
8477
0
}
8478
8479
8480
static unsigned
8481
dissect_nfs4_state_protect_bitmap(tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
8482
        proto_tree *tree, const char *name)
8483
0
{
8484
0
  static nfs4_bitmap_info_t bitmap_info = {
8485
0
    .vse_names_ext = &names_nfs4_operation_ext,
8486
0
    .hf_mask_label = &hf_nfs4_op_mask,
8487
0
    .hf_item_label = &hf_nfs4_op
8488
0
  };
8489
8490
0
  return dissect_nfs4_bitmap(tvb, offset, pinfo, tree, NULL, -1, -1, &bitmap_info, NFS4_BITMAP_MASK, name);
8491
0
}
8492
8493
0
#define SP4_NONE                                0
8494
0
#define SP4_MACH_CRED                           1
8495
0
#define SP4_SSV                                 2
8496
static const value_string names_state_protect_how4[] = {
8497
  { SP4_NONE, "SP4_NONE"  },
8498
  { SP4_MACH_CRED,  "SP4_MACH_CRED" },
8499
  { SP4_SSV,  "SP4_SSV" },
8500
  { 0,    NULL }
8501
};
8502
8503
static unsigned
8504
dissect_nfs4_state_protect_ops(tvbuff_t *tvb, unsigned offset,
8505
    packet_info *pinfo, proto_tree *tree)
8506
0
{
8507
0
  offset = dissect_nfs4_state_protect_bitmap(tvb, offset, pinfo, tree, "spo_must_enforce");
8508
0
  offset = dissect_nfs4_state_protect_bitmap(tvb, offset, pinfo, tree, "spo_must_allow");
8509
0
  return offset;
8510
0
}
8511
8512
8513
static int
8514
dissect_oid(tvbuff_t *tvb, unsigned int offset, packet_info *pinfo _U_, proto_tree* tree, void* data _U_)
8515
0
{
8516
0
  int length = tvb_reported_length(tvb);
8517
0
  proto_tree_add_item(tree, hf_nfs4_sec_oid, tvb, 0, length, ENC_NA);
8518
0
  return offset + 4 + length + (4 - length%4) % 4;
8519
0
}
8520
8521
static int
8522
dissect_nfs4_sec_oid(tvbuff_t *tvb, unsigned offset, packet_info *pinfo, proto_tree *tree, void *data _U_)
8523
0
{
8524
0
  return dissect_rpc_opaque_data(tvb, offset, tree, pinfo,
8525
0
        hf_nfs4_sec_oid, false, 0, false, NULL, dissect_oid);
8526
0
}
8527
8528
static unsigned
8529
dissect_nfs4_ssv_sp_parms(tvbuff_t *tvb, unsigned offset, packet_info *pinfo, proto_tree *tree)
8530
0
{
8531
0
  offset = dissect_nfs4_state_protect_ops(tvb, offset, pinfo, tree);
8532
0
  offset = dissect_rpc_array(tvb, pinfo, tree, offset, dissect_nfs4_sec_oid, hf_nfs4_sp_parms_hash_algs);
8533
0
  offset = dissect_rpc_array(tvb, pinfo, tree, offset, dissect_nfs4_sec_oid, hf_nfs4_sp_parms_encr_algs);
8534
0
  offset = dissect_rpc_uint32(tvb, tree, hf_nfs4_state_protect_window, offset);
8535
0
  offset = dissect_rpc_uint32(tvb, tree, hf_nfs4_state_protect_num_gss_handles, offset);
8536
0
  return offset;
8537
0
}
8538
8539
8540
static unsigned
8541
dissect_nfs4_ssv_prot_info(tvbuff_t *tvb, unsigned offset, packet_info *pinfo, proto_tree *tree)
8542
0
{
8543
0
  offset = dissect_nfs4_state_protect_ops(tvb, offset, pinfo, tree);
8544
0
  offset = dissect_rpc_uint32(tvb, tree, hf_nfs4_prot_info_hash_alg, offset);
8545
0
  offset = dissect_rpc_uint32(tvb, tree, hf_nfs4_prot_info_encr_alg, offset);
8546
0
  offset = dissect_rpc_uint32(tvb, tree, hf_nfs4_prot_info_svv_length, offset);
8547
0
  offset = dissect_rpc_uint32(tvb, tree, hf_nfs4_prot_info_spi_window, offset);
8548
0
  offset = dissect_nfsdata(tvb, pinfo, offset, tree, hf_nfs4_gsshandle);
8549
0
  return offset;
8550
0
}
8551
8552
8553
static unsigned
8554
dissect_nfs4_state_protect_a(tvbuff_t *tvb, unsigned offset, packet_info *pinfo, proto_tree *tree)
8555
0
{
8556
0
  unsigned stateprotect;
8557
8558
0
  proto_tree_add_item_ret_uint(tree, hf_nfs4_state_protect_how, tvb, offset+0, 4, ENC_BIG_ENDIAN, &stateprotect);
8559
0
  offset += 4;
8560
8561
0
  switch (stateprotect) {
8562
0
    case SP4_NONE:
8563
0
      break;
8564
0
    case SP4_MACH_CRED:
8565
0
      offset = dissect_nfs4_state_protect_ops(tvb, offset, pinfo, tree);
8566
0
      break;
8567
0
    case SP4_SSV:
8568
0
      offset = dissect_nfs4_ssv_sp_parms(tvb, offset, pinfo, tree);
8569
0
      break;
8570
0
    default:
8571
0
      break;
8572
0
  }
8573
0
  return offset;
8574
0
}
8575
8576
8577
static unsigned
8578
dissect_nfs4_state_protect_r(tvbuff_t *tvb, unsigned offset,
8579
    packet_info *pinfo, proto_tree *tree)
8580
0
{
8581
0
  unsigned stateprotect;
8582
8583
0
  proto_tree_add_item_ret_uint(tree, hf_nfs4_state_protect_how, tvb, offset+0, 4,
8584
0
          ENC_BIG_ENDIAN, &stateprotect);
8585
0
  offset += 4;
8586
8587
0
  switch (stateprotect) {
8588
0
    case SP4_NONE:
8589
0
      break;
8590
0
    case SP4_MACH_CRED:
8591
0
      offset = dissect_nfs4_state_protect_ops(tvb, offset, pinfo, tree);
8592
0
      break;
8593
0
    case SP4_SSV:
8594
0
      offset = dissect_nfs4_ssv_prot_info(tvb, offset, pinfo, tree);
8595
0
      break;
8596
0
    default:
8597
0
      break;
8598
0
  }
8599
0
  return offset;
8600
0
}
8601
8602
8603
0
#define NFS_LIMIT_SIZE            1
8604
0
#define NFS_LIMIT_BLOCKS          2
8605
static const value_string names_limit_by4[] = {
8606
  { NFS_LIMIT_SIZE,   "NFS_LIMIT_SIZE"  },
8607
  { NFS_LIMIT_BLOCKS, "NFS_LIMIT_BLOCKS" },
8608
  { 0,      NULL }
8609
};
8610
8611
static unsigned
8612
dissect_nfs4_space_limit(tvbuff_t *tvb, unsigned offset,
8613
       proto_tree *tree)
8614
0
{
8615
0
  unsigned limitby;
8616
8617
0
  proto_tree_add_item_ret_uint(tree, hf_nfs4_limit_by, tvb, offset+0, 4, ENC_BIG_ENDIAN, &limitby);
8618
0
  offset += 4;
8619
8620
0
  switch (limitby)
8621
0
  {
8622
0
  case NFS_LIMIT_SIZE:
8623
0
    offset = dissect_rpc_uint64(tvb, tree, hf_nfs4_filesize,
8624
0
      offset);
8625
0
    break;
8626
8627
0
  case NFS_LIMIT_BLOCKS:
8628
0
    offset = dissect_nfs4_modified_limit(tvb, offset, tree);
8629
0
    break;
8630
8631
0
  default:
8632
0
    break;
8633
0
  }
8634
8635
0
  return offset;
8636
0
}
8637
8638
8639
static unsigned
8640
dissect_nfs4_open_write_delegation(tvbuff_t *tvb, unsigned offset,
8641
  packet_info *pinfo, proto_tree *tree)
8642
0
{
8643
0
  offset = dissect_nfs4_stateid(tvb, offset, tree, NULL);
8644
0
  offset = dissect_rpc_bool(tvb, tree, hf_nfs4_recall, offset);
8645
0
  offset = dissect_nfs4_space_limit(tvb, offset, tree);
8646
0
  offset = dissect_nfs4_ace(tvb, offset, pinfo, tree, 0, 0);
8647
8648
0
  return offset;
8649
0
}
8650
8651
8652
0
#define OPEN_DELEGATE_NONE 0
8653
0
#define OPEN_DELEGATE_READ 1
8654
0
#define OPEN_DELEGATE_WRITE 2
8655
0
#define OPEN_DELEGATE_NONE_EXT 3 /* new to v4.1 */
8656
0
#define OPEN_DELEGATE_READ_ATTRS_DELEG 4  /* New to V4.2 */
8657
0
#define OPEN_DELEGATE_WRITE_ATTRS_DELEG 5
8658
static const value_string names_open_delegation_type4[] = {
8659
  { OPEN_DELEGATE_NONE, "OPEN_DELEGATE_NONE" },
8660
  { OPEN_DELEGATE_READ, "OPEN_DELEGATE_READ" },
8661
  { OPEN_DELEGATE_WRITE,  "OPEN_DELEGATE_WRITE" },
8662
  { OPEN_DELEGATE_NONE_EXT, "OPEN_DELEGATE_NONE_EXT"},
8663
  { OPEN_DELEGATE_READ_ATTRS_DELEG, "OPEN_DELEGATE_READ_ATTRS_DELEG"},
8664
  { OPEN_DELEGATE_WRITE_ATTRS_DELEG, "OPEN_DELEGATE_WRITE_ATTRS_DELEG"},
8665
  { 0,  NULL }
8666
};
8667
8668
#define WND4_NOT_WANTED 0
8669
0
#define WND4_CONTENTION 1
8670
0
#define WND4_RESOURCE 2
8671
#define WND4_NOT_SUPP_FTYPE 3
8672
#define WND4_WRITE_DELEG_NOT_SUPP_FTYPE 4
8673
#define WND4_NOT_SUPP_UPGRADE 5
8674
#define WND4_NOT_SUPP_DOWNGRADE 6
8675
#define WND4_CANCELLED 7
8676
#define WND4_IS_DIR 8
8677
static const value_string names_why_no_delegation4[] = {
8678
  { WND4_NOT_WANTED,     "WND4_NOT_WANTED" },
8679
  { WND4_CONTENTION,     "WND4_CONTENTION" },
8680
  { WND4_RESOURCE,       "WND4_RESOURCE" },
8681
  { WND4_NOT_SUPP_FTYPE,     "WND4_NOT_SUPP_FTYPE" },
8682
  { WND4_WRITE_DELEG_NOT_SUPP_FTYPE, "WND4_WRITE_DELEG_NOT_SUPP_FTYPE" },
8683
  { WND4_NOT_SUPP_UPGRADE,     "WND4_NOT_SUPP_UPGRADE" },
8684
  { WND4_NOT_SUPP_DOWNGRADE,   "WND4_NOT_SUPP_DOWNGRADE" },
8685
  { WND4_CANCELLED,      "WND4_CANCELLED" },
8686
  { WND4_IS_DIR,       "WND4_IS_DIR" },
8687
  { 0,        NULL }
8688
};
8689
8690
static unsigned
8691
dissect_nfs4_open_delegation(tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
8692
  proto_tree *tree)
8693
0
{
8694
0
  unsigned delegation_type;
8695
0
  proto_tree *newftree, *wndftree;
8696
0
  proto_item *fitem, *wnditem;
8697
0
  uint32_t ond_why;
8698
8699
0
  fitem = proto_tree_add_item_ret_uint(tree, hf_nfs4_open_delegation_type, tvb,
8700
0
    offset+0, 4, ENC_BIG_ENDIAN, &delegation_type);
8701
0
  newftree = proto_item_add_subtree(fitem, ett_nfs4_open_delegation);
8702
0
  offset += 4;
8703
8704
0
  switch (delegation_type)
8705
0
  {
8706
0
    case OPEN_DELEGATE_NONE:
8707
0
      break;
8708
8709
0
    case OPEN_DELEGATE_READ:
8710
0
    case OPEN_DELEGATE_READ_ATTRS_DELEG:
8711
0
      offset = dissect_nfs4_open_read_delegation(tvb, offset, pinfo, newftree);
8712
0
      break;
8713
8714
0
    case OPEN_DELEGATE_WRITE:
8715
0
    case OPEN_DELEGATE_WRITE_ATTRS_DELEG:
8716
0
      offset = dissect_nfs4_open_write_delegation(tvb, offset, pinfo, newftree);
8717
0
      break;
8718
0
    case OPEN_DELEGATE_NONE_EXT:
8719
0
      wnditem = proto_tree_add_item_ret_uint(newftree, hf_nfs4_why_no_delegation, tvb, offset, 4, ENC_BIG_ENDIAN, &ond_why);
8720
0
      offset += 4;
8721
0
      switch (ond_why) {
8722
0
      case WND4_CONTENTION:
8723
0
        wndftree = proto_item_add_subtree(wnditem, ett_nfs4_open_why_no_deleg);
8724
0
        offset = dissect_rpc_bool(tvb, wndftree, hf_nfs4_ond_server_will_push_deleg, offset);
8725
0
        break;
8726
0
      case WND4_RESOURCE:
8727
0
        wndftree = proto_item_add_subtree(wnditem, ett_nfs4_open_why_no_deleg);
8728
0
        offset = dissect_rpc_bool(tvb, wndftree, hf_nfs4_ond_server_will_signal_avail, offset);
8729
0
        break;
8730
0
      default:
8731
0
        break;
8732
0
      }
8733
0
      break;
8734
0
    default:
8735
0
      break;
8736
0
  }
8737
8738
0
  return offset;
8739
0
}
8740
8741
8742
static unsigned
8743
dissect_nfs_rpcsec_gss_info(tvbuff_t *tvb, packet_info *pinfo, unsigned offset, proto_tree *tree)
8744
0
{
8745
0
  offset = dissect_nfs4_sec_oid(tvb, offset, pinfo, tree, NULL);
8746
0
  offset = dissect_rpc_uint32(tvb, tree, hf_nfs4_qop, offset);
8747
0
  offset = dissect_rpc_uint32(tvb, tree,
8748
0
    hf_nfs4_secinfo_rpcsec_gss_info_service, offset);
8749
8750
0
  return offset;
8751
0
}
8752
8753
8754
static unsigned
8755
dissect_nfs4_open_to_lock_owner(tvbuff_t *tvb, packet_info* pinfo, unsigned offset, proto_tree *tree)
8756
0
{
8757
0
  offset = dissect_rpc_uint32(tvb, tree, hf_nfs4_seqid, offset);
8758
0
  offset = dissect_nfs4_stateid(tvb, offset, tree, NULL);
8759
0
  offset = dissect_rpc_uint32(tvb, tree, hf_nfs4_lock_seqid, offset);
8760
0
  offset = dissect_nfs4_lock_owner(tvb, pinfo, offset, tree);
8761
8762
0
  return offset;
8763
0
}
8764
8765
8766
static unsigned
8767
dissect_nfs4_exist_lock_owner(tvbuff_t *tvb, unsigned offset, proto_tree *tree)
8768
0
{
8769
0
  offset = dissect_nfs4_stateid(tvb, offset, tree, NULL);
8770
0
  offset = dissect_rpc_uint32(tvb, tree, hf_nfs4_lock_seqid, offset);
8771
8772
0
  return offset;
8773
0
}
8774
8775
8776
static unsigned
8777
dissect_nfs4_locker(tvbuff_t *tvb, packet_info* pinfo, unsigned offset, proto_tree *tree)
8778
0
{
8779
0
  unsigned new_lock_owner;
8780
8781
0
  new_lock_owner = tvb_get_ntohl(tvb, offset);
8782
0
  offset = dissect_rpc_bool(tvb, tree, hf_nfs4_new_lock_owner, offset);
8783
8784
0
  if (new_lock_owner)
8785
0
    offset = dissect_nfs4_open_to_lock_owner(tvb, pinfo, offset, tree);
8786
0
  else
8787
0
    offset = dissect_nfs4_exist_lock_owner(tvb, offset, tree);
8788
8789
0
  return offset;
8790
0
}
8791
8792
static const value_string read_plus_content_names[] = {
8793
0
#define NFS4_CONTENT_DATA                 0
8794
  { NFS4_CONTENT_DATA,    "Data"  },
8795
0
#define NFS4_CONTENT_HOLE             1
8796
  { NFS4_CONTENT_HOLE,    "Hole"  },
8797
  { 0,  NULL  }
8798
};
8799
static value_string_ext read_plus_content_names_ext = VALUE_STRING_EXT_INIT(read_plus_content_names);
8800
8801
static int
8802
dissect_nfs4_read_plus_content(tvbuff_t *tvb, unsigned offset, packet_info *pinfo, proto_tree *tree, void *data _U_)
8803
0
{
8804
0
  proto_tree *ss_tree;
8805
0
  proto_item *ss_fitem;
8806
0
  unsigned    type;
8807
8808
0
  ss_fitem = proto_tree_add_item_ret_uint(tree, hf_nfs4_read_plus_content_type,
8809
0
            tvb, offset, 4, ENC_BIG_ENDIAN, &type);
8810
0
  ss_tree = proto_item_add_subtree(ss_fitem, ett_nfs4_read_plus_content_sub);
8811
0
  offset += 4;
8812
8813
0
  switch (type) {
8814
0
    case NFS4_CONTENT_DATA:
8815
0
      offset = dissect_rpc_uint64(tvb, ss_tree, hf_nfs4_offset, offset);
8816
0
      dissect_rpc_uint32(tvb, ss_tree, hf_nfs4_read_data_length, offset); /* don't change offset */
8817
0
      offset = dissect_nfsdata(tvb, pinfo, offset, ss_tree, hf_nfs_data);
8818
0
      break;
8819
0
    case NFS4_CONTENT_HOLE:
8820
0
      offset = dissect_rpc_uint64(tvb, ss_tree, hf_nfs4_offset, offset);
8821
0
      offset = dissect_rpc_uint64(tvb, ss_tree, hf_nfs4_length, offset);
8822
0
      break;
8823
0
    default:
8824
0
      break;
8825
0
  }
8826
8827
0
  return offset;
8828
0
}
8829
8830
static unsigned
8831
dissect_nfs4_client_id(tvbuff_t *tvb, packet_info* pinfo, unsigned offset, proto_tree *tree)
8832
0
{
8833
0
  offset = dissect_rpc_uint64(tvb, tree, hf_nfs4_verifier, offset);
8834
0
  offset = dissect_rpc_data(tvb, pinfo, tree, hf_nfs4_client_id, offset);
8835
8836
0
  return offset;
8837
0
}
8838
8839
8840
static unsigned
8841
dissect_nfs4_newtime(tvbuff_t *tvb, unsigned offset, proto_tree *tree)
8842
0
{
8843
0
  unsigned new_time;
8844
8845
0
  new_time = tvb_get_ntohl(tvb, offset);
8846
0
  offset = dissect_rpc_bool(tvb, tree, hf_nfs4_newtime, offset);
8847
8848
0
  if (new_time) {
8849
0
    offset = dissect_nfs4_nfstime(tvb, offset, tree);
8850
0
  }
8851
8852
0
  return offset;
8853
0
}
8854
8855
8856
static unsigned
8857
dissect_nfs4_newsize(tvbuff_t *tvb, unsigned offset, proto_tree *tree)
8858
0
{
8859
0
  unsigned new_size;
8860
8861
0
  new_size = tvb_get_ntohl(tvb, offset);
8862
0
  offset = dissect_rpc_bool(tvb, tree, hf_nfs4_newsize, offset);
8863
8864
0
  if (new_size) {
8865
0
    offset = dissect_rpc_uint64(tvb, tree, hf_nfs4_length, offset);
8866
0
  }
8867
8868
0
  return offset;
8869
0
}
8870
8871
8872
static unsigned
8873
dissect_nfs4_newoffset(tvbuff_t *tvb, unsigned offset, proto_tree *tree)
8874
0
{
8875
0
  unsigned new_offset;
8876
8877
0
  new_offset = tvb_get_ntohl(tvb, offset);
8878
0
  offset = dissect_rpc_bool(tvb, tree, hf_nfs4_newoffset, offset);
8879
8880
0
  if (new_offset) {
8881
0
    offset = dissect_rpc_uint64(tvb, tree, hf_nfs4_offset, offset);
8882
0
  }
8883
8884
0
  return offset;
8885
0
}
8886
8887
static const value_string io_advise_names[] = {
8888
#define IO_ADVISE4_NORMAL                 0
8889
  { IO_ADVISE4_NORMAL,    "Normal"  },
8890
#define IO_ADVISE4_SEQUENTIAL             1
8891
  { IO_ADVISE4_SEQUENTIAL,    "Sequential"  },
8892
#define IO_ADVISE4_SEQUENTIAL_BACKWARDS   2
8893
  { IO_ADVISE4_SEQUENTIAL_BACKWARDS,    "Sequential Backwards"  },
8894
#define IO_ADVISE4_RANDOM                 3
8895
  { IO_ADVISE4_RANDOM,    "Random"  },
8896
#define IO_ADVISE4_WILLNEED               4
8897
  { IO_ADVISE4_WILLNEED,    "Will Need" },
8898
#define IO_ADVISE4_WILLNEED_OPPORTUNISTIC 5
8899
  { IO_ADVISE4_WILLNEED_OPPORTUNISTIC,    "Will Need Opportunistic" },
8900
#define IO_ADVISE4_DONTNEED               6
8901
  { IO_ADVISE4_DONTNEED,    "Don't Need"  },
8902
#define IO_ADVISE4_NOREUSE                7
8903
  { IO_ADVISE4_NOREUSE,    "No Reuse" },
8904
#define IO_ADVISE4_READ                   8
8905
  { IO_ADVISE4_READ,    "Read"  },
8906
#define IO_ADVISE4_WRITE                  9
8907
  { IO_ADVISE4_WRITE,    "Write"  },
8908
#define IO_ADVISE4_INIT_PROXIMITY         10
8909
  { IO_ADVISE4_INIT_PROXIMITY,    "Init Proximity"  },
8910
  { 0,  NULL  }
8911
};
8912
static value_string_ext io_advise_names_ext = VALUE_STRING_EXT_INIT(io_advise_names);
8913
8914
static unsigned
8915
dissect_nfs4_io_hints(tvbuff_t *tvb, unsigned offset, packet_info *pinfo, proto_tree *tree)
8916
0
{
8917
0
  static nfs4_bitmap_info_t bitmap_info = {
8918
0
    .vse_names_ext = &io_advise_names_ext,
8919
0
    .hf_mask_label = &hf_nfs4_io_hints_mask,
8920
0
    .hf_item_label = &hf_nfs4_io_advise_hint,
8921
0
    .hf_item_count = &hf_nfs4_io_hint_count,
8922
0
  };
8923
8924
0
  return dissect_nfs4_bitmap(tvb, offset, pinfo, tree, NULL, -1, -1, &bitmap_info, NFS4_BITMAP_MASK, NULL);
8925
0
}
8926
8927
static const value_string cb_recall_any_names[] = {
8928
/* RFC 5661 Network File System (NFS) Version 4 Minor Version 1 Protocol */
8929
#define RCA4_TYPE_MASK_RDATA_DLG    0
8930
  { RCA4_TYPE_MASK_RDATA_DLG,   "Read Delegation" },
8931
#define RCA4_TYPE_MASK_WDATA_DLG    1
8932
  { RCA4_TYPE_MASK_WDATA_DLG,   "Write Delegation"  },
8933
#define RCA4_TYPE_MASK_DIR_DLG      2
8934
  { RCA4_TYPE_MASK_DIR_DLG,     "Directory Delegation"  },
8935
#define RCA4_TYPE_MASK_FILE_LAYOUT    3
8936
  { RCA4_TYPE_MASK_FILE_LAYOUT,   "File Layout" },
8937
#define RCA4_TYPE_MASK_BLK_LAYOUT   4
8938
  { RCA4_TYPE_MASK_BLK_LAYOUT,    "Block Layout"  },
8939
#define RCA4_TYPE_MASK_OBJ_LAYOUT_MIN   8
8940
  { RCA4_TYPE_MASK_OBJ_LAYOUT_MIN,    "Object Layout Min" },
8941
#define RCA4_TYPE_MASK_OBJ_LAYOUT_MAX   9
8942
  { RCA4_TYPE_MASK_OBJ_LAYOUT_MAX,    "Object Layout Max" },
8943
#define RCA4_TYPE_MASK_OTHER_LAYOUT_MIN   12
8944
  { RCA4_TYPE_MASK_OTHER_LAYOUT_MIN,  "Other Layout Min"  },
8945
#define RCA4_TYPE_MASK_OTHER_LAYOUT_MAX   15
8946
  { RCA4_TYPE_MASK_OTHER_LAYOUT_MAX,  "Other Layout Max"  },
8947
8948
/* RFC 8435 Parallel NFS (pNFS) Flexible File Layout */
8949
#define RCA4_TYPE_MASK_FF_LAYOUT_MIN    16
8950
  { RCA4_TYPE_MASK_FF_LAYOUT_MIN,   "Flexible File Layout Min"  },
8951
#define RCA4_TYPE_MASK_FF_LAYOUT_MAX    17
8952
  { RCA4_TYPE_MASK_FF_LAYOUT_MAX,   "Flexible File Layout Max"  },
8953
  { 0,  NULL  }
8954
};
8955
static value_string_ext cb_recall_any_names_ext = VALUE_STRING_EXT_INIT(cb_recall_any_names);
8956
8957
static unsigned
8958
dissect_nfs4_cb_recall_any_mask(tvbuff_t *tvb, unsigned offset, packet_info *pinfo, proto_tree *tree)
8959
0
{
8960
0
  static nfs4_bitmap_info_t bitmap_info = {
8961
0
    .vse_names_ext = &cb_recall_any_names_ext,
8962
0
    .hf_mask_count = &hf_nfs4_cb_recall_any_count,
8963
0
    .hf_mask_label = &hf_nfs4_cb_recall_any_mask,
8964
0
    .hf_item_label = &hf_nfs4_cb_recall_any_item,
8965
0
  };
8966
8967
0
  return dissect_nfs4_bitmap(tvb, offset, pinfo, tree, NULL, -1, -1, &bitmap_info, NFS4_BITMAP_MASK, NULL);
8968
0
}
8969
8970
static unsigned
8971
dissect_nfs4_app_data_block(tvbuff_t *tvb, unsigned offset, proto_tree *tree, uint32_t *hash)
8972
0
{
8973
0
  proto_item *fitem;
8974
8975
0
  uint32_t    pattern_hash;
8976
0
  unsigned    pattern_len;
8977
8978
0
  offset = dissect_rpc_uint64(tvb, tree, hf_nfs4_offset, offset);
8979
0
  offset = dissect_rpc_uint32(tvb, tree, hf_nfs4_block_size, offset);
8980
0
  offset = dissect_rpc_uint32(tvb, tree, hf_nfs4_block_count, offset);
8981
0
  offset = dissect_rpc_uint32(tvb, tree, hf_nfs4_reloff_blocknum, offset);
8982
0
  offset = dissect_rpc_uint32(tvb, tree, hf_nfs4_blocknum, offset);
8983
0
  offset = dissect_rpc_uint32(tvb, tree, hf_nfs4_reloff_pattern, offset);
8984
8985
0
  pattern_len = tvb_get_ntohl(tvb, offset);
8986
0
  offset += 4;
8987
8988
0
  pattern_hash = crc32_ccitt_tvb_offset(tvb, offset, pattern_len);
8989
0
  fitem = proto_tree_add_uint(tree, hf_nfs4_pattern_hash, tvb, offset, pattern_len, pattern_hash);
8990
0
  proto_item_set_generated(fitem);
8991
0
  proto_item_set_len(fitem, pattern_len);
8992
8993
0
  offset += pattern_len;
8994
8995
0
  if (hash)
8996
0
    *hash = pattern_hash;
8997
8998
0
  return offset;
8999
0
}
9000
9001
static unsigned
9002
dissect_nfs4_io_time(tvbuff_t *tvb, unsigned offset, proto_tree *tree, const char *timer_mode)
9003
0
{
9004
0
  proto_tree *newtree;
9005
9006
0
  newtree = proto_tree_add_subtree_format(tree, tvb, offset, 0, ett_nfs4_io_time, NULL, "%s", timer_mode);
9007
0
  offset = dissect_nfs4_nfstime(tvb, offset, newtree);
9008
9009
0
  return offset;
9010
0
}
9011
9012
static unsigned
9013
dissect_nfs4_io_latency(tvbuff_t *tvb, unsigned offset, proto_tree *tree, const char *io_mode)
9014
0
{
9015
0
  proto_tree *newtree;
9016
9017
0
  newtree = proto_tree_add_subtree_format(tree, tvb, offset, 0, ett_nfs4_io_latency, NULL, "%s Latency", io_mode);
9018
9019
0
  offset = dissect_rpc_uint64(tvb, newtree, hf_nfs4_ff_ops_requested, offset);
9020
0
  offset = dissect_rpc_uint64(tvb, newtree, hf_nfs4_ff_bytes_requested, offset);
9021
0
  offset = dissect_rpc_uint64(tvb, newtree, hf_nfs4_ff_ops_completed, offset);
9022
0
  offset = dissect_rpc_uint64(tvb, newtree, hf_nfs4_ff_bytes_completed, offset);
9023
0
  offset = dissect_rpc_uint64(tvb, newtree, hf_nfs4_ff_bytes_not_delivered, offset);
9024
9025
0
  offset = dissect_nfs4_io_time(tvb, offset, newtree, "Busy time");
9026
0
  offset = dissect_nfs4_io_time(tvb, offset, newtree, "Completion time");
9027
9028
0
  return offset;
9029
0
}
9030
9031
static unsigned
9032
dissect_nfs4_io_info(tvbuff_t *tvb, unsigned offset, proto_tree *tree, const char *io_mode)
9033
0
{
9034
0
  proto_tree *newtree;
9035
9036
0
  newtree = proto_tree_add_subtree_format(tree, tvb, offset, 0, ett_nfs4_io_info, NULL, "%s Info", io_mode);
9037
9038
0
  offset = dissect_rpc_uint64(tvb, newtree, hf_nfs4_io_count, offset);
9039
0
  offset = dissect_rpc_uint64(tvb, newtree, hf_nfs4_io_bytes, offset);
9040
9041
0
  return offset;
9042
0
}
9043
9044
static unsigned
9045
dissect_nfs4_layoutstats(tvbuff_t *tvb, unsigned offset, packet_info *pinfo, proto_tree *tree, rpc_call_info_value *civ, bool has_layout_type)
9046
0
{
9047
0
  unsigned      layout_type = LAYOUT4_NO_LAYOUT_TYPE;
9048
0
  proto_tree *netaddr;
9049
0
  proto_item *fitem;
9050
0
  unsigned    old_offset;
9051
0
  uint32_t      last_fh_hash    = 0;
9052
9053
  /* FIXME: Are these here or in the caller? Check for layoutcommit */
9054
0
  offset = dissect_nfs4_io_info(tvb, offset, tree, "Read");
9055
0
  offset = dissect_nfs4_io_info(tvb, offset, tree, "Write");
9056
0
  offset = dissect_nfs4_deviceid(tvb, offset, tree);
9057
9058
0
  if (has_layout_type) {
9059
0
    layout_type = tvb_get_ntohl(tvb, offset);
9060
0
    offset = dissect_rpc_uint32(tvb, tree, hf_nfs4_layout_type, offset);
9061
0
  }
9062
9063
  /* If not flex files layout type eat the rest and move on.. */
9064
0
  if (!has_layout_type || layout_type == LAYOUT4_FLEX_FILES) {
9065
9066
    /* NFS Flex Files */
9067
0
    if (has_layout_type)
9068
0
      offset += 4; /* Skip past opaque count */
9069
9070
    /* The netaddr */
9071
0
    old_offset = offset;
9072
0
    netaddr = proto_tree_add_subtree(tree, tvb, offset, 0, ett_nfs4_clientaddr, &fitem, "DS address");
9073
9074
0
    offset = dissect_nfs4_clientaddr(tvb, pinfo, offset, netaddr);
9075
0
    proto_item_set_len(fitem, offset - old_offset);
9076
9077
    /* The file handle */
9078
0
    offset = dissect_nfs4_fh(tvb, offset, pinfo, tree, "Filehandle", &last_fh_hash, NULL, NULL, civ, -1, -1);
9079
9080
    /* Read Latency */
9081
0
    offset = dissect_nfs4_io_latency(tvb, offset, tree, "Read");
9082
9083
    /* Write Latency */
9084
0
    offset = dissect_nfs4_io_latency(tvb, offset, tree, "Write");
9085
9086
    /* Duration */
9087
0
    offset = dissect_nfs4_io_time(tvb, offset, tree, "Duration");
9088
9089
    /* Local? */
9090
0
    offset = dissect_rpc_bool(tvb, tree, hf_nfs4_ff_local, offset);
9091
0
  } else {
9092
0
    offset = dissect_nfsdata(tvb, pinfo, offset, tree, hf_nfs4_layoutstats);
9093
0
  }
9094
9095
0
  return offset;
9096
0
}
9097
9098
static unsigned
9099
dissect_nfs4_ff_io_stats(tvbuff_t *tvb, unsigned offset, packet_info *pinfo, proto_tree *tree, rpc_call_info_value *civ)
9100
0
{
9101
0
  offset = dissect_rpc_uint64(tvb, tree, hf_nfs4_offset, offset);
9102
0
  offset = dissect_rpc_uint64(tvb, tree, hf_nfs4_length, offset);
9103
0
  offset = dissect_nfs4_stateid(tvb, offset, tree, NULL);
9104
9105
  /* Note that we've already determined that we are in the Flex File Layout Type */
9106
0
  offset = dissect_nfs4_layoutstats(tvb, offset, pinfo, tree, civ, false);
9107
9108
0
  return offset;
9109
0
}
9110
9111
static unsigned
9112
dissect_nfs4_device_errors(tvbuff_t *tvb, unsigned offset, proto_tree *tree)
9113
0
{
9114
0
  proto_item *sub_fitem;
9115
0
  proto_tree *ss_tree;
9116
0
  proto_tree *subtree;
9117
0
  proto_item *ss_fitem;
9118
0
  unsigned    i;
9119
0
  unsigned    count;
9120
9121
0
  unsigned      opcode;
9122
9123
0
  count = tvb_get_ntohl(tvb, offset);
9124
0
  sub_fitem = proto_tree_add_item(tree, hf_nfs4_device_error_count,
9125
0
          tvb, offset, 4, ENC_BIG_ENDIAN);
9126
0
  offset += 4;
9127
9128
0
  subtree = proto_item_add_subtree(sub_fitem, ett_nfs4_device_errors_sub);
9129
0
  for (i = 0; i < count; i++) {
9130
0
    ss_fitem = proto_tree_add_uint_format(subtree, hf_nfs4_device_errors_index,
9131
0
              tvb, offset+0, 4, i, "Error [%u]", i);
9132
0
    ss_tree = proto_item_add_subtree(ss_fitem,
9133
0
             ett_nfs4_device_errors_sub);
9134
0
    offset = dissect_nfs4_deviceid(tvb, offset, ss_tree);
9135
0
    offset = dissect_nfs4_status(tvb, offset, ss_tree, NULL);
9136
9137
0
    opcode = tvb_get_ntohl(tvb, offset);
9138
0
    proto_tree_add_uint(ss_tree, hf_nfs4_io_error_op, tvb, offset, 4, opcode);
9139
0
    offset += 4;
9140
0
  }
9141
9142
0
  return offset;
9143
0
}
9144
9145
static unsigned
9146
dissect_nfs4_ff_io_error(tvbuff_t *tvb, unsigned offset, proto_tree *tree)
9147
0
{
9148
0
  proto_tree *newtree;
9149
9150
  /* FIXME */
9151
0
  newtree = proto_tree_add_subtree_format(tree, tvb, offset, 0, ett_nfs4_io_latency, NULL, "IO errors");
9152
9153
0
  offset = dissect_rpc_uint64(tvb, newtree, hf_nfs4_ff_ioerrs_offset, offset);
9154
0
  offset = dissect_rpc_uint64(tvb, newtree, hf_nfs4_ff_ioerrs_length, offset);
9155
0
  offset = dissect_nfs4_stateid(tvb, offset, newtree, NULL);
9156
9157
0
  offset = dissect_nfs4_device_errors(tvb, offset, newtree);
9158
9159
0
  return offset;
9160
0
}
9161
9162
static unsigned
9163
dissect_nfs4_layoutreturn(tvbuff_t *tvb, unsigned offset, packet_info *pinfo, proto_tree *tree, rpc_call_info_value *civ)
9164
0
{
9165
0
  unsigned returntype;
9166
0
  unsigned layout_type;
9167
9168
0
  proto_item *sub_fitem;
9169
0
  proto_tree *ss_tree;
9170
0
  proto_tree *subtree;
9171
0
  proto_item *ss_fitem;
9172
0
  unsigned    i;
9173
0
  unsigned    count;
9174
9175
0
  offset = dissect_rpc_bool(tvb, tree, hf_nfs4_reclaim, offset);
9176
9177
0
  layout_type = tvb_get_ntohl(tvb, offset);
9178
0
  offset = dissect_rpc_uint32(tvb, tree, hf_nfs4_layout_type, offset);
9179
9180
0
  offset = dissect_rpc_uint32(tvb, tree, hf_nfs4_iomode, offset);
9181
9182
0
  returntype = tvb_get_ntohl(tvb, offset);
9183
0
  offset = dissect_rpc_uint32(tvb, tree, hf_nfs4_layout_return_type, offset);
9184
0
  if (returntype == 1) { /* RETURN_FILE */
9185
0
    offset = dissect_rpc_uint64(tvb, tree, hf_nfs4_offset, offset);
9186
0
    offset = dissect_rpc_uint64(tvb, tree, hf_nfs4_length, offset);
9187
0
    offset = dissect_nfs4_stateid(tvb, offset, tree, NULL);
9188
9189
    /* If not flex files layout type eat the rest and move on.. */
9190
0
    if (layout_type == LAYOUT4_FLEX_FILES) {
9191
0
      offset += 4; /* Skip past opaque count */
9192
9193
      /* Get the errors */
9194
0
      count = tvb_get_ntohl(tvb, offset);
9195
0
      sub_fitem = proto_tree_add_item(tree, hf_nfs4_ff_ioerrs_count,
9196
0
              tvb, offset, 4, ENC_BIG_ENDIAN);
9197
0
      offset += 4;
9198
9199
0
      subtree = proto_item_add_subtree(sub_fitem, ett_nfs4_ff_ioerrs_sub);
9200
0
      for (i = 0; i < count; i++) {
9201
0
        ss_fitem = proto_tree_add_uint_format(subtree, hf_nfs4_ff_ioerrs_index,
9202
0
                  tvb, offset+0, 4, i, "IO Error [%u]", i);
9203
0
        ss_tree = proto_item_add_subtree(ss_fitem,
9204
0
                 ett_nfs4_ff_ioerrs_sub);
9205
9206
0
        offset = dissect_nfs4_ff_io_error(tvb, offset, ss_tree);
9207
0
      }
9208
9209
      /* Get the stats */
9210
0
      count = tvb_get_ntohl(tvb, offset);
9211
0
      sub_fitem = proto_tree_add_item(tree, hf_nfs4_ff_iostats_count,
9212
0
              tvb, offset, 4, ENC_BIG_ENDIAN);
9213
0
      offset += 4;
9214
9215
0
      subtree = proto_item_add_subtree(sub_fitem, ett_nfs4_ff_iostats_sub);
9216
0
      for (i = 0; i < count; i++) {
9217
0
        ss_fitem = proto_tree_add_uint_format(subtree, hf_nfs4_ff_iostats_index,
9218
0
                  tvb, offset+0, 4, i, "IO Stat [%u]", i);
9219
0
        ss_tree = proto_item_add_subtree(ss_fitem,
9220
0
                 ett_nfs4_ff_iostats_sub);
9221
9222
0
        offset = dissect_nfs4_ff_io_stats(tvb, offset, pinfo, ss_tree, civ);
9223
0
      }
9224
9225
0
    } else {
9226
0
      offset = dissect_nfsdata(tvb, pinfo, offset, tree, hf_nfs4_lrf_body_content);
9227
0
    }
9228
0
  }
9229
9230
0
  return offset;
9231
0
}
9232
9233
static unsigned
9234
dissect_nfs_layoutreturn_stateid(tvbuff_t *tvb, proto_tree *tree, unsigned offset)
9235
0
{
9236
0
  unsigned lrs_present;
9237
9238
0
  lrs_present = tvb_get_ntohl(tvb, offset);
9239
0
  offset = dissect_rpc_bool(tvb, tree, hf_nfs4_lrs_present, offset);
9240
9241
0
  if (lrs_present) {
9242
0
    offset = dissect_nfs4_stateid(tvb, offset, tree, NULL);
9243
0
  }
9244
9245
0
  return offset;
9246
0
}
9247
9248
static const value_string notify_type4[] = {
9249
#define NOTIFY4_CHANGE_CHILD_ATTRS  0
9250
  { NOTIFY4_CHANGE_CHILD_ATTRS, "Change Child Attrs" },
9251
#define NOTIFY4_CHANGE_DIR_ATTRS  1
9252
  { NOTIFY4_CHANGE_DIR_ATTRS, "Change Dir Attrs" },
9253
#define NOTIFY4_REMOVE_ENTRY    2
9254
  { NOTIFY4_REMOVE_ENTRY, "Remove Entry" },
9255
#define NOTIFY4_ADD_ENTRY   3
9256
  { NOTIFY4_ADD_ENTRY, "Add Entry" },
9257
#define NOTIFY4_RENAME_ENTRY    4
9258
  { NOTIFY4_RENAME_ENTRY, "Rename Entry" },
9259
#define NOTIFY4_CHANGE_COOKIE_VERIFIER  5
9260
  { NOTIFY4_CHANGE_COOKIE_VERIFIER, "Change Cookie Verifier" },
9261
  /*
9262
   * Added in NFSv4.1 bis document
9263
   */
9264
#define NOTIFY4_GFLAG_EXTEND    6
9265
  { NOTIFY4_GFLAG_EXTEND, "RFC8881bis Extensions Supported" },
9266
#define NOTIFY4_AUFLAG_VALID    7
9267
  { NOTIFY4_AUFLAG_VALID, "Lookup Authorization Flags Valid" },
9268
#define NOTIFY4_AUFLAG_OWNER  8
9269
  { NOTIFY4_AUFLAG_OWNER, "Owner LOOKUP Authorized" },
9270
#define NOTIFY4_AUFLAG_GROUP    9
9271
  { NOTIFY4_AUFLAG_GROUP, "Group LOOKUP Authorized" },
9272
#define NOTIFY4_AUFLAG_OTHER    10
9273
  { NOTIFY4_AUFLAG_OTHER, "Other LOOKUP Authorized" },
9274
#define NOTIFY4_CHANGE_AUTH   11
9275
  { NOTIFY4_CHANGE_AUTH, "LOOKUP Authorization Change" },
9276
#define NOTIFY4_CFLAG_ORDER   12
9277
  { NOTIFY4_CFLAG_ORDER, "Directory Ordering Info Requested" },
9278
#define NOTIFY4_AUFLAG_GANOW    13
9279
  { NOTIFY4_AUFLAG_GANOW, "GETATTRs Require No Access Checks" },
9280
#define NOTIFY4_AUFLAG_GALATER    14
9281
  { NOTIFY4_AUFLAG_GALATER, "GETATTRs Require Access Checks" },
9282
#define NOTIFY4_CHANGE_GA   15
9283
  { NOTIFY4_CHANGE_GA, "GETATTR Authorization Change" },
9284
#define NOTIFY4_CHANGE_AMASK    16
9285
  { NOTIFY4_CHANGE_AMASK, "Update to Change Notification Mask" },
9286
  { 0,  NULL  }
9287
};
9288
static value_string_ext notify_type4_ext = VALUE_STRING_EXT_INIT(notify_type4);
9289
9290
static unsigned
9291
dissect_nfs4_notify_type4_bitmap(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, unsigned offset, uint32_t opcode, uint32_t fh_idx)
9292
0
{
9293
0
  static nfs4_bitmap_info_t bitmap_info = {
9294
0
    .vse_names_ext = &notify_type4_ext,
9295
0
    .hf_mask_label = &hf_nfs4_notify_mask,
9296
0
    .hf_item_label = &hf_nfs4_notify_type,
9297
0
  };
9298
9299
0
  return dissect_nfs4_bitmap(tvb, offset, pinfo, tree, NULL, opcode, fh_idx, &bitmap_info, NFS4_BITMAP_MASK,
9300
0
           NULL);
9301
0
}
9302
9303
static const value_string notify_deviceid_type4[] = {
9304
#define NOTIFY_DEVICEID4_CHANGE      1
9305
  { NOTIFY_DEVICEID4_CHANGE, "Change" },
9306
#define NOTIFY_DEVICEID4_DELETE      2
9307
  { NOTIFY_DEVICEID4_DELETE, "Delete" },
9308
  { 0,  NULL  }
9309
};
9310
static value_string_ext notify_deviceid_type4_ext = VALUE_STRING_EXT_INIT(notify_deviceid_type4);
9311
9312
9313
static unsigned
9314
dissect_nfs4_notify_deviceid_bitmap(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, unsigned offset)
9315
0
{
9316
0
  static nfs4_bitmap_info_t bitmap_info = {
9317
0
    .vse_names_ext = &notify_deviceid_type4_ext,
9318
0
    .hf_mask_label = &hf_nfs4_notify_deviceid_mask,
9319
0
    .hf_item_label = &hf_nfs4_notify_deviceid_type,
9320
0
  };
9321
9322
0
  return dissect_nfs4_bitmap(tvb, offset, pinfo, tree, NULL, -1, -1, &bitmap_info, NFS4_BITMAP_MASK, NULL);
9323
0
}
9324
9325
9326
static unsigned
9327
dissect_nfs4_devices_file(tvbuff_t *tvb, packet_info* pinfo, unsigned offset, proto_tree *tree)
9328
0
{
9329
0
  unsigned i, j;
9330
0
  uint32_t num_indices, num_multipath, num_addr;
9331
9332
  /* dissect indices */
9333
0
  num_indices = tvb_get_ntohl(tvb, offset);
9334
0
  offset += 4;
9335
0
  for (i = 0; i < num_indices; i++) {
9336
0
    offset = dissect_rpc_uint32(tvb, tree, hf_nfs4_deviceidx, offset);
9337
0
  }
9338
9339
0
  num_multipath = tvb_get_ntohl(tvb, offset);
9340
0
  offset += 4;
9341
0
  for (i = 0; i < num_multipath; i++) {
9342
0
    num_addr = tvb_get_ntohl(tvb, offset);
9343
0
    offset += 4;
9344
0
    for (j = 0; j < num_addr; j++) {
9345
0
      offset = dissect_rpc_string(tvb, pinfo, tree, hf_nfs4_r_netid, offset, NULL);
9346
0
      offset = dissect_rpc_string(tvb, pinfo, tree, hf_nfs4_r_addr, offset, NULL);
9347
0
    }
9348
0
  }
9349
9350
0
  return offset;
9351
0
}
9352
9353
static unsigned
9354
dissect_nfs4_devices_flexfile(tvbuff_t *tvb, packet_info* pinfo, unsigned offset, proto_tree *tree)
9355
0
{
9356
0
  unsigned i;
9357
0
  uint32_t num_addr;
9358
0
  uint32_t num_vers;
9359
9360
  /* dissect indices */
9361
0
  num_addr = tvb_get_ntohl(tvb, offset);
9362
0
  offset += 4;
9363
0
  for (i = 0; i < num_addr; i++) {
9364
0
    offset = dissect_rpc_string(tvb, pinfo, tree, hf_nfs4_r_netid, offset,
9365
0
              NULL);
9366
0
    offset = dissect_rpc_string(tvb, pinfo, tree, hf_nfs4_r_addr, offset,
9367
0
              NULL);
9368
0
  }
9369
9370
0
  num_vers = tvb_get_ntohl(tvb, offset);
9371
0
  offset += 4;
9372
9373
0
  for (i = 0; i < num_vers; i++) {
9374
0
    offset = dissect_rpc_uint32(tvb, tree, hf_nfs4_ff_version, offset);
9375
0
    offset = dissect_rpc_uint32(tvb, tree, hf_nfs4_ff_minorversion,
9376
0
            offset);
9377
0
    offset = dissect_rpc_uint32(tvb, tree, hf_nfs4_ff_rsize,
9378
0
            offset);
9379
0
    offset = dissect_rpc_uint32(tvb, tree, hf_nfs4_ff_wsize,
9380
0
            offset);
9381
0
    offset = dissect_rpc_bool(tvb, tree, hf_nfs4_ff_tightly_coupled,
9382
0
          offset);
9383
0
  }
9384
9385
0
  return offset;
9386
0
}
9387
9388
static const value_string scsi_vol_type_names[] = {
9389
0
#define PNFS_SCSI_VOLUME_SLICE  1
9390
  { PNFS_SCSI_VOLUME_SLICE,   "Slice" },
9391
0
#define PNFS_SCSI_VOLUME_CONCAT 2
9392
  { PNFS_SCSI_VOLUME_CONCAT,  "Concat" },
9393
0
#define PNFS_SCSI_VOLUME_STRIPE 3
9394
  { PNFS_SCSI_VOLUME_STRIPE,  "Stripe" },
9395
0
#define PNFS_SCSI_VOLUME_BASE 4
9396
  { PNFS_SCSI_VOLUME_BASE,    "Base" },
9397
  { 0,  NULL }
9398
};
9399
9400
static const value_string scsi_vpd_designator_type_names[] = {
9401
#define PS_DESIGNATOR_T10 1
9402
  { PS_DESIGNATOR_T10,  "T10" },
9403
#define PS_DESIGNATOR_EUI64 2
9404
  { PS_DESIGNATOR_EUI64,  "EUI64" },
9405
#define PS_DESIGNATOR_NAA 3
9406
  { PS_DESIGNATOR_NAA,  "NAA" },
9407
#define PS_DESIGNATOR_NAME  8
9408
  { PS_DESIGNATOR_NAME, "Name" },
9409
  { 0,  NULL }
9410
};
9411
9412
static const value_string scsi_vpd_code_set_names[] = {
9413
#define PS_CODE_SET_BINARY  1
9414
  { PS_CODE_SET_BINARY, "binary" },
9415
#define PS_CODE_SET_ASCII 2
9416
  { PS_CODE_SET_ASCII,  "ASCII" },
9417
#define PS_CODE_SET_UTF8  3
9418
  { PS_CODE_SET_UTF8, "UTF8" },
9419
  { 0,  NULL }
9420
};
9421
9422
static const value_string scsi_extent_state_names[] = {
9423
#define PNFS_SCSI_EXT_READ_WRITE_DATA    0
9424
  { PNFS_SCSI_EXT_READ_WRITE_DATA,  "READ_WRITE_DATA" },
9425
#define PNFS_SCSI_EXT_READ_DATA      1
9426
  { PNFS_SCSI_EXT_READ_DATA,  "READ_DATA" },
9427
#define PNFS_SCSI_EXT_INVALID_DATA     2
9428
  { PNFS_SCSI_EXT_INVALID_DATA, "INVALID_DATA" },
9429
#define PNFS_SCSI_EXT_NONE_DATA      3
9430
  { PNFS_SCSI_EXT_NONE_DATA,  "NONE_DATA" },
9431
  { 0,  NULL }
9432
};
9433
9434
static unsigned
9435
dissect_nfs4_devices_scsi_base_volume(tvbuff_t *tvb, unsigned offset, proto_tree *tree)
9436
0
{
9437
0
  uint32_t desig_len;
9438
9439
0
  offset = dissect_rpc_uint32(tvb, tree, hf_nfs4_devaddr_scsi_vpd_code_set, offset);
9440
0
  offset = dissect_rpc_uint32(tvb, tree, hf_nfs4_devaddr_scsi_vpd_designator_type, offset);
9441
9442
0
  desig_len = tvb_get_ntohl(tvb, offset);
9443
0
  offset += 4;
9444
0
  proto_tree_add_item(tree, hf_nfs4_devaddr_scsi_vpd_designator,
9445
0
    tvb, offset, desig_len, ENC_NA);
9446
0
  offset += desig_len;
9447
9448
0
  proto_tree_add_item(tree, hf_nfs4_devaddr_scsi_private_key,
9449
0
    tvb, offset, 8, ENC_NA);
9450
0
  offset += 8;
9451
9452
0
  return offset;
9453
0
}
9454
9455
static unsigned
9456
dissect_nfs4_vol_indices(tvbuff_t *tvb, unsigned offset, proto_tree *tree)
9457
0
{
9458
0
  unsigned i;
9459
0
  uint32_t num_vols;
9460
0
  proto_item *indices_item;
9461
0
  proto_tree *indices_tree;
9462
9463
0
  num_vols = tvb_get_ntohl(tvb, offset);
9464
0
  offset += 4;
9465
0
  if (num_vols == 0)
9466
0
    return offset;
9467
9468
0
  indices_tree = proto_tree_add_subtree_format(tree, tvb, offset, 0,
9469
0
        ett_nfs4_scsi_layout_vol_indices, &indices_item,
9470
0
        "volume indices");
9471
0
  for (i = 0; i < num_vols; i++) {
9472
0
    proto_tree_add_item(indices_tree, hf_nfs4_devaddr_scsi_vol_ref_index,
9473
0
        tvb, offset, 4, ENC_BIG_ENDIAN);
9474
0
  }
9475
0
  return offset;
9476
0
}
9477
9478
static unsigned
9479
dissect_nfs4_devices_scsi(tvbuff_t *tvb, unsigned offset, proto_tree *tree)
9480
0
{
9481
0
  unsigned i;
9482
0
  proto_item *vol_item;
9483
0
  proto_tree *vol_tree;
9484
0
  int old_offset = offset;
9485
0
  uint32_t num_vols;
9486
0
  uint32_t vol_type;
9487
9488
0
  num_vols = tvb_get_ntohl(tvb, offset);
9489
0
  offset += 4;
9490
9491
0
  for (i = 0; i < num_vols; i++) {
9492
9493
0
    vol_item = proto_tree_add_item_ret_uint(tree, hf_nfs4_devaddr_scsi_vol_type, tvb, offset, 4, ENC_BIG_ENDIAN, &vol_type);
9494
0
    vol_tree = proto_item_add_subtree(vol_item, ett_nfs4_scsi_layout_vol);
9495
0
    offset += 4;
9496
0
    proto_tree_add_uint(vol_tree, hf_nfs4_devaddr_scsi_vol_index, tvb, offset, 0, i);
9497
0
    switch (vol_type)
9498
0
    {
9499
0
    case PNFS_SCSI_VOLUME_SLICE:
9500
0
      proto_tree_add_item(vol_tree, hf_nfs4_devaddr_ssv_start, tvb, offset, 4, ENC_BIG_ENDIAN);
9501
0
      proto_tree_add_item(vol_tree, hf_nfs4_devaddr_ssv_length, tvb, offset, 4, ENC_BIG_ENDIAN);
9502
0
      proto_tree_add_item(vol_tree, hf_nfs4_devaddr_scsi_vol_ref_index, tvb, offset, 4, ENC_BIG_ENDIAN);
9503
0
      break;
9504
0
    case PNFS_SCSI_VOLUME_CONCAT:
9505
0
      offset = dissect_nfs4_vol_indices(tvb, offset, vol_tree);
9506
0
      break;
9507
0
    case PNFS_SCSI_VOLUME_STRIPE:
9508
0
      proto_tree_add_item(vol_tree, hf_nfs4_devaddr_ssv_stripe_unit, tvb, offset, 4, ENC_BIG_ENDIAN);
9509
0
      offset = dissect_nfs4_vol_indices(tvb, offset, vol_tree);
9510
0
      break;
9511
0
    case PNFS_SCSI_VOLUME_BASE:
9512
0
      offset = dissect_nfs4_devices_scsi_base_volume(tvb, offset, vol_tree);
9513
0
      break;
9514
0
    }
9515
9516
0
    proto_item_set_len(vol_item, offset - old_offset);
9517
0
    old_offset = offset;
9518
0
  }
9519
9520
0
  return offset;
9521
0
}
9522
9523
9524
static int
9525
dissect_nfs4_test_stateid_arg(tvbuff_t *tvb, unsigned offset, packet_info *pinfo _U_, proto_tree *tree, void *data _U_)
9526
0
{
9527
0
  return dissect_nfs4_stateid(tvb, offset, tree, NULL);
9528
0
}
9529
9530
9531
static int
9532
dissect_nfs4_test_stateid_res(tvbuff_t *tvb, unsigned offset, packet_info *pinfo _U_, proto_tree *tree, void *data _U_)
9533
0
{
9534
0
  return dissect_nfs4_status(tvb, offset, tree, NULL);
9535
0
}
9536
9537
static unsigned
9538
dissect_nfs4_netloc(tvbuff_t *tvb, packet_info* pinfo, unsigned offset, proto_tree *tree)
9539
0
{
9540
0
  unsigned netloc_type;
9541
0
  proto_tree *netaddr;
9542
0
  int old_offset;
9543
0
  proto_item *fitem;
9544
9545
  /* netloc type */
9546
0
  netloc_type = tvb_get_ntohl(tvb, offset);
9547
0
  offset = dissect_rpc_uint32(tvb, tree, hf_nfs4_netloc_type, offset);
9548
9549
0
  switch (netloc_type) {
9550
0
  case NL4_NAME:
9551
0
    offset = dissect_nfs_utf8string(tvb, pinfo, offset, tree, hf_nfs4_nl_name, NULL);
9552
0
    break;
9553
0
  case NL4_URL:
9554
0
    offset = dissect_nfs_utf8string(tvb, pinfo, offset, tree, hf_nfs4_nl_url, NULL);
9555
0
    break;
9556
0
  case NL4_NETADDR:
9557
0
    old_offset = offset;
9558
0
    netaddr = proto_tree_add_subtree(tree, tvb, offset, 0, ett_nfs4_clientaddr, &fitem, "netaddr");
9559
9560
0
    offset = dissect_nfs4_clientaddr(tvb, pinfo, offset, netaddr);
9561
0
    proto_item_set_len(fitem, offset - old_offset);
9562
0
    break;
9563
0
  default:
9564
    /* back up to re-read the length field when treating as
9565
     * opaque */
9566
0
    offset -= 4;
9567
0
    offset = dissect_nfsdata(tvb, pinfo, offset, tree, hf_nfs4_netloc);
9568
0
    break;
9569
0
  }
9570
9571
0
  return offset;
9572
0
}
9573
9574
static unsigned
9575
dissect_nfs4_copy_reqs(tvbuff_t *tvb, unsigned offset, proto_tree *tree)
9576
0
{
9577
0
  offset = dissect_rpc_bool(tvb, tree, hf_nfs4_consecutive, offset);
9578
0
  offset = dissect_rpc_bool(tvb, tree, hf_nfs4_synchronous, offset);
9579
9580
0
  return offset;
9581
0
}
9582
9583
static unsigned
9584
dissect_nfs4_write_response(tvbuff_t *tvb, packet_info* pinfo, unsigned offset, proto_tree *tree)
9585
0
{
9586
0
  proto_item *sub_fitem;
9587
0
  proto_tree *ss_tree;
9588
0
  proto_tree *subtree;
9589
0
  proto_item *ss_fitem;
9590
0
  unsigned    i;
9591
0
  uint32_t      count;
9592
9593
  /* Number of callback stateids */
9594
0
  sub_fitem = proto_tree_add_item_ret_uint(tree, hf_nfs4_callback_stateids,
9595
0
      tvb, offset, 4, ENC_BIG_ENDIAN, &count);
9596
0
  offset += 4;
9597
9598
0
  subtree = proto_item_add_subtree(sub_fitem, ett_nfs4_callback_stateids_sub);
9599
0
  for (i = 0; i < count; i++) {
9600
0
    ss_fitem = proto_tree_add_uint(subtree,
9601
0
        hf_nfs4_callback_stateids_index,
9602
0
        tvb, offset, 4, i);
9603
9604
0
    ss_tree = proto_item_add_subtree(ss_fitem,
9605
0
        ett_nfs4_callback_stateids_sub);
9606
0
    offset = dissect_nfs4_stateid(tvb, offset, ss_tree, NULL);
9607
0
  }
9608
9609
0
  offset = dissect_rpc_uint64(tvb, tree, hf_nfs4_length, offset);
9610
0
  offset = dissect_nfs4_stable_how(tvb, pinfo, offset, tree, "committed");
9611
0
  offset = dissect_rpc_uint64(tvb, tree, hf_nfs4_verifier, offset);
9612
9613
0
  return offset;
9614
0
}
9615
9616
static unsigned
9617
dissect_nfs4_source_servers(tvbuff_t *tvb, packet_info* pinfo, unsigned offset, proto_tree *tree)
9618
0
{
9619
0
  proto_item *sub_fitem;
9620
0
  proto_tree *ss_tree;
9621
0
  proto_tree *subtree;
9622
0
  proto_item *ss_fitem;
9623
0
  unsigned    i;
9624
0
  uint32_t      source_servers;
9625
9626
  /* Number of source servers */
9627
0
  sub_fitem = proto_tree_add_item_ret_uint(tree, hf_nfs4_source_servers,
9628
0
      tvb, offset, 4, ENC_BIG_ENDIAN, &source_servers);
9629
0
  offset += 4;
9630
9631
0
  subtree = proto_item_add_subtree(sub_fitem, ett_nfs4_source_servers_sub);
9632
0
  for (i = 0; i < source_servers; i++) {
9633
0
    ss_fitem = proto_tree_add_uint(subtree,
9634
0
        hf_nfs4_source_server_index,
9635
0
        tvb, offset, 4, i);
9636
9637
0
    ss_tree = proto_item_add_subtree(ss_fitem,
9638
0
        ett_nfs4_source_servers_sub);
9639
9640
0
    offset = dissect_nfs4_netloc(tvb, pinfo, offset, ss_tree);
9641
0
  }
9642
9643
0
  return offset;
9644
0
}
9645
9646
static unsigned
9647
dissect_nfs4_deviceaddr(tvbuff_t *tvb, packet_info* pinfo, unsigned offset, proto_tree *tree)
9648
0
{
9649
0
  unsigned layout_type;
9650
9651
  /* layout type */
9652
0
  layout_type = tvb_get_ntohl(tvb, offset);
9653
0
  offset = dissect_rpc_uint32(tvb, tree, hf_nfs4_layout_type, offset);
9654
9655
  /* skip length */
9656
0
  offset+=4;
9657
9658
0
  switch (layout_type) {
9659
0
  case LAYOUT4_NFSV4_1_FILES:
9660
0
    offset = dissect_nfs4_devices_file(tvb, pinfo, offset, tree);
9661
0
    break;
9662
0
  case LAYOUT4_FLEX_FILES:
9663
0
    offset = dissect_nfs4_devices_flexfile(tvb, pinfo, offset, tree);
9664
0
    break;
9665
0
  case LAYOUT4_SCSI:
9666
0
    offset = dissect_nfs4_devices_scsi(tvb, offset, tree);
9667
0
  break;
9668
0
  default:
9669
    /* back up to re-read the length field when treating as
9670
     * opaque */
9671
0
    offset -= 4;
9672
0
    offset = dissect_nfsdata(tvb, pinfo, offset, tree, hf_nfs4_getdevinfo);
9673
0
    break;
9674
0
  }
9675
9676
0
  return offset;
9677
0
}
9678
9679
9680
static unsigned
9681
dissect_nfs4_devicelist(tvbuff_t *tvb, unsigned offset, proto_tree *tree)
9682
0
{
9683
0
  unsigned count;
9684
0
  unsigned i;
9685
9686
0
  count = tvb_get_ntohl(tvb, offset);
9687
0
  offset = dissect_rpc_uint32(tvb, tree, hf_nfs4_devicenum, offset);
9688
0
  for (i = 0; i < count; i++)
9689
0
    offset = dissect_nfs4_deviceid(tvb, offset, tree);
9690
9691
0
  return offset;
9692
0
}
9693
9694
9695
static unsigned
9696
dissect_rpc_serverowner4(tvbuff_t *tvb, packet_info* pinfo, unsigned offset, proto_tree *tree)
9697
0
{
9698
0
  offset = dissect_rpc_uint64(tvb, tree, hf_nfs4_minorid, offset);
9699
0
  offset = dissect_nfsdata(tvb, pinfo, offset, tree, hf_nfs4_majorid);
9700
0
  return offset;
9701
0
}
9702
9703
9704
static unsigned
9705
dissect_rpc_chanattrs4(tvbuff_t *tvb, unsigned offset, proto_tree *tree, const char *name)
9706
0
{
9707
0
  proto_tree *chan_attrs_tree;
9708
0
  unsigned i, count, rdma_ird_len;
9709
9710
0
  rdma_ird_len = tvb_get_ntohl(tvb, offset + 24);
9711
0
  count = 28 + rdma_ird_len * 4;
9712
9713
0
  chan_attrs_tree = proto_tree_add_subtree(tree, tvb, offset, count, ett_nfs4_chan_attrs, NULL, name);
9714
9715
0
  offset = dissect_rpc_uint32(tvb, chan_attrs_tree, hf_nfs4_padsize, offset);
9716
0
  offset = dissect_rpc_uint32(tvb, chan_attrs_tree, hf_nfs4_maxreqsize, offset);
9717
0
  offset = dissect_rpc_uint32(tvb, chan_attrs_tree, hf_nfs4_maxrespsize, offset);
9718
0
  offset = dissect_rpc_uint32(tvb, chan_attrs_tree, hf_nfs4_maxrespsizecached, offset);
9719
0
  offset = dissect_rpc_uint32(tvb, chan_attrs_tree, hf_nfs4_maxops, offset);
9720
0
  offset = dissect_rpc_uint32(tvb, chan_attrs_tree, hf_nfs4_maxreqs, offset);
9721
0
  offset += 4;
9722
0
  for (i = 0; i < rdma_ird_len; i++) {
9723
0
    offset = dissect_rpc_uint32(tvb, tree, hf_nfs4_rdmachanattrs, offset);
9724
0
  }
9725
0
  return offset;
9726
0
}
9727
9728
9729
static unsigned
9730
dissect_rpc_nfs_impl_id4(tvbuff_t *tvb, packet_info* pinfo, unsigned offset, proto_tree *tree, const char *name)
9731
0
{
9732
0
  proto_tree *impl_id_tree;
9733
0
  unsigned i, count;
9734
9735
0
  count = tvb_get_ntohl(tvb, offset);
9736
0
  impl_id_tree = proto_tree_add_subtree(tree, tvb, offset, 4, ett_nfs4_clientowner, NULL, name);
9737
0
  offset += 4;
9738
9739
0
  for (i = 0; i < count; i++) {
9740
0
    proto_tree *date_tree;
9741
9742
0
    offset = dissect_nfs_utf8string(tvb, pinfo, offset, impl_id_tree, hf_nfs4_nii_domain, NULL);
9743
0
    offset = dissect_nfs_utf8string(tvb, pinfo, offset, impl_id_tree, hf_nfs4_nii_name, NULL);
9744
9745
0
    date_tree = proto_tree_add_subtree(impl_id_tree, tvb, offset, 12, ett_nfs4_clientowner, NULL, "Build timestamp(nii_date)");
9746
0
    offset = dissect_nfs4_nfstime(tvb, offset, date_tree);
9747
0
  }
9748
0
  return offset;
9749
0
}
9750
9751
9752
static unsigned
9753
dissect_rpc_secparms4(tvbuff_t *tvb, packet_info* pinfo, unsigned offset, proto_tree *parent_tree)
9754
0
{
9755
0
  unsigned count, i;
9756
0
  int array_offset;
9757
0
  proto_tree *array_tree;
9758
0
  proto_item *array_item;
9759
9760
0
  array_offset = offset;
9761
0
  array_tree = proto_tree_add_subtree(parent_tree, tvb, offset, 0, ett_nfs4_sec_parms_array, &array_item, "cb_sec_parms");
9762
9763
0
  count = tvb_get_ntohl(tvb, offset);
9764
0
  offset += 4;
9765
9766
0
  for (i = 0; i < count; i++) {
9767
0
    proto_item *item;
9768
0
    int item_offset = offset;
9769
0
    proto_tree *tree = proto_tree_add_subtree(array_tree, tvb, offset, 0, ett_nfs4_sec_parms_item, &item, "entry");
9770
0
    unsigned j, flavor = tvb_get_ntohl(tvb, offset);
9771
0
    offset = dissect_rpc_uint32(tvb, tree, hf_nfs4_flavor, offset);
9772
9773
0
    switch (flavor) {
9774
0
    case AUTH_NULL:
9775
0
      break;
9776
0
    case AUTH_UNIX: {
9777
0
      unsigned count2;
9778
0
      proto_tree *tree2;
9779
0
      offset = dissect_rpc_uint32(tvb, tree, hf_nfs4_stamp, offset);
9780
0
      offset = dissect_nfs_utf8string(tvb, pinfo, offset, tree, hf_nfs4_machinename, NULL);
9781
0
      offset = dissect_rpc_uint32(tvb, tree, hf_nfs4_uid, offset);
9782
0
      offset = dissect_rpc_uint32(tvb, tree, hf_nfs4_gid, offset);
9783
0
      count2 = tvb_get_ntohl(tvb, offset);
9784
0
      tree2 = proto_tree_add_subtree_format(tree, tvb, offset,
9785
0
          4+count2*4, ett_nfs4_gids, NULL, "auxiliary gids (%u)", count2);
9786
0
      offset += 4;
9787
0
      for (j = 0; j < count2; j++) {
9788
0
        offset = dissect_rpc_uint32(tvb, tree2, hf_nfs4_gid, offset);
9789
0
      }
9790
0
      break;
9791
0
    }
9792
0
    case RPCSEC_GSS:
9793
0
      offset = dissect_rpc_uint32(tvb, tree, hf_nfs4_service, offset);
9794
0
      proto_item_append_text(tree, ", Handle from server");
9795
0
      offset = dissect_nfsdata(tvb, pinfo, offset, tree, hf_nfs_data);
9796
0
      proto_item_append_text(tree, ", Handle from client");
9797
0
      offset = dissect_nfsdata(tvb, pinfo, offset, tree, hf_nfs_data);
9798
0
      break;
9799
0
    default:
9800
      /* Report fatal error as it is not possible to figure out item length and therefore
9801
       * not possible to continue parsing next item or continue parsing next packet. */
9802
0
      THROW(ReportedBoundsError);
9803
0
    }
9804
9805
0
    proto_item_set_len(item, offset - item_offset);
9806
0
  }
9807
9808
0
  proto_item_set_len(array_item, offset - array_offset);
9809
9810
0
  return offset;
9811
0
}
9812
9813
static unsigned
9814
dissect_nfs4_layoutget(tvbuff_t *tvb, unsigned offset, packet_info *pinfo, proto_tree *tree, rpc_call_info_value *civ)
9815
0
{
9816
0
  unsigned      layout_type;
9817
0
  unsigned      sub_num;
9818
0
  unsigned      nfl_util;
9819
0
  unsigned      lo_seg_count;
9820
0
  unsigned      i, j, k, lo_seg;
9821
0
  proto_tree *newtree;
9822
0
  proto_item *sub_fitem;
9823
0
  proto_tree *subtree;
9824
0
  proto_tree *nfl_item;
9825
0
  proto_tree *nfl_tree;
9826
9827
0
  static int * const layout_flags[] = {
9828
0
    &hf_nfs4_ff_layout_flags_no_layoutcommit,
9829
0
    &hf_nfs4_ff_layout_flags_no_io_thru_mds,
9830
0
    &hf_nfs4_ff_layout_flags_no_read_io,
9831
0
    NULL
9832
0
  };
9833
9834
0
  lo_seg_count = tvb_get_ntohl(tvb, offset);
9835
9836
0
  newtree = proto_tree_add_subtree_format(tree, tvb, offset, 4, ett_nfs4_layoutseg, NULL,
9837
0
                      "Layout Segment (count: %u)", lo_seg_count);
9838
0
  offset += 4;
9839
9840
0
  for (lo_seg = 0; lo_seg < lo_seg_count; lo_seg++) {
9841
0
    offset = dissect_rpc_uint64(tvb, newtree, hf_nfs4_offset, offset);
9842
0
    offset = dissect_rpc_uint64(tvb, newtree, hf_nfs4_length, offset);
9843
9844
0
    offset = dissect_rpc_uint32(tvb, newtree, hf_nfs4_iomode, offset);
9845
9846
0
    layout_type = tvb_get_ntohl(tvb, offset);
9847
0
    offset = dissect_rpc_uint32(tvb, newtree, hf_nfs4_layout_type, offset);
9848
9849
    /* If not files layout type eat the rest and move on.. */
9850
0
    if (layout_type == LAYOUT4_NFSV4_1_FILES) {
9851
      /* NFS Files */
9852
0
      offset += 4; /* Skip past opaque count */
9853
9854
0
      offset = dissect_nfs4_deviceid(tvb, offset, newtree);
9855
9856
      /* Get nfl_util and break it down into its components */
9857
0
      nfl_util = tvb_get_ntohl(tvb, offset);
9858
0
      nfl_item = proto_tree_add_uint(newtree, hf_nfs4_nfl_util, tvb, offset, 4, nfl_util);
9859
0
      nfl_tree = proto_item_add_subtree(nfl_item, ett_nfs4_nfl_util);
9860
0
      proto_tree_add_uint(nfl_tree, hf_nfs4_nfl_util_stripe_size, tvb, offset, 4, nfl_util&NFL4_UFLG_STRIPE_UNIT_SIZE_MASK);
9861
0
      proto_tree_add_uint(nfl_tree, hf_nfs4_nfl_util_commit_thru_mds, tvb, offset+3, 1, (nfl_util&NFL4_UFLG_COMMIT_THRU_MDS?1:0));
9862
0
      proto_tree_add_uint(nfl_tree, hf_nfs4_nfl_util_dense, tvb, offset+3, 1, (nfl_util&NFL4_UFLG_DENSE?1:0));
9863
0
      offset += 4;
9864
9865
0
      offset = dissect_rpc_uint32(tvb, newtree,
9866
0
          hf_nfs4_nfl_first_stripe_index, offset);
9867
0
      offset = dissect_rpc_uint64(tvb, newtree,
9868
0
          hf_nfs4_offset, offset);
9869
9870
0
      sub_num = tvb_get_ntohl(tvb, offset); /* Len of FH list */
9871
9872
0
      sub_fitem = proto_tree_add_item(newtree, hf_nfs4_nfl_fhs,
9873
0
          tvb, offset, 4, ENC_BIG_ENDIAN);
9874
0
      offset += 4;
9875
9876
0
      subtree = proto_item_add_subtree(sub_fitem,
9877
0
          ett_nfs4_layoutseg_sub);
9878
0
      for (i = 0; i < sub_num; i++)
9879
0
        offset = dissect_nfs4_fh(tvb, offset, pinfo,
9880
0
            subtree, "lo_filehandle",
9881
0
            NULL, NULL, NULL,
9882
0
            civ, -1, -1);
9883
0
    } else if (layout_type == LAYOUT4_FLEX_FILES) {
9884
0
      unsigned  ds_count, fh_count;
9885
0
      proto_item *ds_item, *mirrors_item, *subitem;
9886
0
      proto_tree *ds_tree, *mirrors_tree;
9887
0
      unsigned end_offset = offset;
9888
0
      unsigned mirror_start_offset, ds_start_offset;
9889
9890
      /* NFS Flex Files */
9891
0
      end_offset += tvb_get_ntohl(tvb, offset) + 4;
9892
0
      offset += 4; /* Skip past opaque count */
9893
9894
      /* stripe unit */
9895
0
      offset = dissect_rpc_uint64(tvb, newtree, hf_nfs4_stripeunit, offset);
9896
9897
      /* Len of mirror list */
9898
0
      sub_num = tvb_get_ntohl(tvb, offset);
9899
0
      mirrors_item = proto_tree_add_uint_format(newtree, hf_nfs4_nfl_mirrors,
9900
0
        tvb, offset, 4, sub_num, "Mirrors (%u)", sub_num);
9901
0
      offset += 4;
9902
9903
0
      mirrors_tree = proto_item_add_subtree(mirrors_item, ett_nfs4_layoutseg_sub);
9904
9905
0
      for (i = 0; i < sub_num; i++) {
9906
9907
0
        mirror_start_offset = offset;
9908
0
        subtree = proto_tree_add_subtree_format(mirrors_tree, tvb, offset, -1,
9909
0
            ett_nfs4_layoutseg_sub, &subitem,
9910
0
            "Mirror: %u", i);
9911
9912
        /* data server count */
9913
0
        ds_count = tvb_get_ntohl(tvb, offset);
9914
0
        offset += 4;
9915
9916
0
        for (j = 0; j < ds_count; j++) {
9917
0
          ds_start_offset = offset;
9918
0
          ds_tree = proto_tree_add_subtree_format(subtree, tvb, offset, -1,
9919
0
              ett_nfs4_layoutseg_sub, &ds_item,
9920
0
              "Data Server: %u", j);
9921
9922
0
          offset = dissect_nfs4_deviceid(tvb, offset,
9923
0
              ds_tree);
9924
0
          offset = dissect_rpc_uint32(tvb, ds_tree,
9925
0
              hf_nfs4_mirror_eff, offset);
9926
0
          offset = dissect_nfs4_stateid(tvb, offset,
9927
0
              ds_tree, NULL);
9928
9929
0
          fh_count = tvb_get_ntohl(tvb, offset);
9930
0
          offset += 4;
9931
9932
0
          for (k = 0; k < fh_count; k++)
9933
0
            offset = dissect_nfs4_fh(tvb, offset,
9934
0
              pinfo, ds_tree, "fh", NULL, NULL, NULL, civ, -1, -1);
9935
9936
0
          offset = dissect_nfs_utf8string(tvb, pinfo, offset,
9937
0
              ds_tree, hf_nfs4_ff_synthetic_owner,
9938
0
              NULL);
9939
0
          offset = dissect_nfs_utf8string(tvb, pinfo, offset,
9940
0
              ds_tree, hf_nfs4_ff_synthetic_owner_group,
9941
0
              NULL);
9942
9943
0
          proto_item_set_len(ds_item, offset - ds_start_offset);
9944
0
        }
9945
9946
0
        proto_item_set_len(subitem, offset - mirror_start_offset);
9947
0
      }
9948
9949
0
      proto_tree_add_bitmask(newtree, tvb, offset, hf_nfs4_ff_layout_flags,
9950
0
            ett_nfs4_ff_layout_flags, layout_flags, ENC_BIG_ENDIAN);
9951
0
      offset += 4;
9952
9953
0
      if (offset + 4 <= end_offset)
9954
0
        offset = dissect_rpc_uint32(tvb, newtree,
9955
0
            hf_nfs4_ff_stats_collect_hint,
9956
0
            offset);
9957
0
    } else if (layout_type == LAYOUT4_SCSI) {
9958
0
      unsigned  ext_count;
9959
0
      proto_tree *ext_tree;
9960
9961
0
      offset += 4; /* Skip past opaque count */
9962
9963
0
      ext_count = tvb_get_ntohl(tvb, offset);
9964
9965
0
      subtree = proto_tree_add_subtree_format(newtree, tvb, offset, 4,
9966
0
            ett_nfs4_layoutseg_sub, NULL, "SCSI Extents (count: %u)",
9967
0
            ext_count);
9968
0
      offset +=4;
9969
9970
0
      for (i = 0; i < ext_count; i++) {
9971
0
        ext_tree = proto_tree_add_subtree_format(subtree, tvb, offset, 4,
9972
0
              ett_nfs4_layoutseg_sub, NULL, "extent %u", i);
9973
0
        offset = dissect_nfs4_deviceid(tvb, offset, ext_tree);
9974
0
        offset = dissect_rpc_uint64(tvb, ext_tree,
9975
0
              hf_nfs4_scsil_ext_file_offset, offset);
9976
0
        offset = dissect_rpc_uint64(tvb, ext_tree,
9977
0
              hf_nfs4_scsil_ext_length, offset);
9978
0
        offset = dissect_rpc_uint64(tvb, ext_tree,
9979
0
              hf_nfs4_scsil_ext_vol_offset, offset);
9980
0
        offset = dissect_rpc_uint32(tvb, ext_tree,
9981
0
              hf_nfs4_scsil_ext_state, offset);
9982
0
      }
9983
0
    } else {
9984
0
      offset = dissect_nfsdata(tvb, pinfo, offset, newtree, hf_nfs4_layout);
9985
0
      continue;
9986
0
    }
9987
0
  }
9988
0
  return offset;
9989
0
}
9990
9991
9992
static unsigned
9993
dissect_nfs_create_session_flags(tvbuff_t *tvb, unsigned offset, proto_tree *tree, int hf_csa)
9994
0
{
9995
0
  int * const flags[] = {
9996
0
    &hf_nfs4_create_session_flags_persist,
9997
0
    &hf_nfs4_create_session_flags_conn_back_chan,
9998
0
    &hf_nfs4_create_session_flags_conn_rdma,
9999
0
    NULL
10000
0
  };
10001
10002
0
  proto_tree_add_bitmask(tree, tvb, offset, hf_csa, ett_nfs4_create_session_flags, flags, ENC_BIG_ENDIAN);
10003
0
  offset += 4;
10004
10005
0
  return offset;
10006
0
}
10007
10008
10009
enum channel_dir_from_client4 {
10010
  CDFC4_FORE = 0x1,
10011
  CDFC4_BACK = 0x2,
10012
  CDFC4_FORE_OR_BOTH = 0x3,
10013
  CDFC4_BACK_OR_BOTH = 0x7
10014
};
10015
10016
static const value_string names_channel_dir_from_client[] = {
10017
  { CDFC4_FORE,   "CDFC4_FORE" },
10018
  { CDFC4_BACK,   "CDFC4_BACK" },
10019
  { CDFC4_FORE_OR_BOTH, "CDFC4_FORE_OR_BOTH" },
10020
  { CDFC4_BACK_OR_BOTH, "CDFC4_BACK_OR_BOTH" },
10021
  { 0, NULL }
10022
};
10023
10024
enum channel_dir_from_server4 {
10025
  CDFS4_FORE = 0x1,
10026
  CDFS4_BACK = 0x2,
10027
  CDFS4_BOTH = 0x3
10028
};
10029
10030
static const value_string names_channel_dir_from_server[] = {
10031
  { CDFS4_FORE, "CDFS4_FORE" },
10032
  { CDFS4_BACK, "CDFS4_BACK" },
10033
  { CDFS4_BOTH, "CDFS4_BOTH" },
10034
  { 0, NULL }
10035
};
10036
10037
#define SECINFO_STYLE4_CURRENT_FH 0
10038
#define SECINFO_STYLE4_PARENT 1
10039
static const value_string names_secinfo_style4[] = {
10040
  { SECINFO_STYLE4_CURRENT_FH,  "SECINFO_STYLE4_CURRENT_FH" },
10041
  { SECINFO_STYLE4_PARENT,  "SECINFO_STYLE4_PARENT"     },
10042
  { 0, NULL }
10043
};
10044
10045
typedef struct _nfs4_operation_summary {
10046
    uint32_t         opcode;
10047
    bool           iserror;
10048
    wmem_strbuf_t *optext;
10049
} nfs4_operation_summary;
10050
10051
10052
/*
10053
 To try to determine which NFSv4 operations are most important in a
10054
  request, we categorize the operations into different "tiers".
10055
10056
 All operations falling into the highest tier (where 1 is highest, 5
10057
  is lowest) are considered to be the "most significant" operations.
10058
  This information is useful for display purposes, filtering, and for
10059
  response time calculations.
10060
10061
 For example, virtually all NFSv4 requests include a GETATTR.  But in
10062
  a request with PUTFH; CLOSE; GETATTR operations, CLOSE is the
10063
  significant operation.
10064
10065
 In a request with PUTFH; GETATTR operations, GETATTR is the
10066
  significant operation.  CLOSE has higher tier than GETATTR, which is
10067
  in a higher tier than PUTFH.
10068
10069
 In practice this seems to be a very reliable method of determining
10070
  the most significant operation(s).
10071
 */
10072
10073
static const int nfs4_operation_tiers[] = {
10074
     1 /* 0 */ ,
10075
     1 /* 1 */ ,
10076
     1 /* 2 */ ,
10077
     2 /* 3, NFS4_OP_ACCESS */ ,
10078
     1 /* 4, NFS4_OP_CLOSE */,
10079
     1 /* 5, NFS4_OP_COMMIT */,
10080
     1 /* 6, NFS4_OP_CREATE */,
10081
     1 /* 7, NFS4_OP_DELEGPURGE */,
10082
     1 /* 8, NFS4_OP_DELEGRETURN */,
10083
     3 /* 9, NFS4_OP_GETATTR */,
10084
     4 /* 10, NFS4_OP_GETFH */,
10085
     1 /* 11, NFS4_OP_LINK  */,
10086
     1 /* 12, NFS4_OP_LOCK */,
10087
     1 /* 13, NFS4_OP_LOCKT */,
10088
     1 /* 14, NFS4_OP_LOCKU */,
10089
     1 /* 15, NFS4_OP_LOOKUP */,
10090
     1 /* 16, NFS4_OP_LOOKUPP */,
10091
     2 /* 17, NFS4_OP_NVERIFY */,
10092
     1 /* 18, NFS4_OP_OPEN */,
10093
     1 /* 19, NFS4_OP_OPENATTR */,
10094
     1 /* 20, NFS4_OP_OPEN_CONFIRM */,
10095
     1 /* 21, NFS4_OP_OPEN_DOWNGRADE */,
10096
     4 /* 22, NFS4_OP_PUTFH */,
10097
     3 /* 23, NFS4_OP_PUTPUBFH  */,
10098
     3 /* 24, NFS4_OP_PUTROOTFH */,
10099
     1 /* 25, NFS4_OP_READ  */,
10100
     1 /* 26, NFS4_OP_READDIR */,
10101
     1 /* 27, NFS4_OP_READLINK  */,
10102
     1 /* 28, NFS4_OP_REMOVE */,
10103
     1 /* 29, NFS4_OP_RENAME */,
10104
     1 /* 30, NFS4_OP_RENEW */,
10105
     4 /* 31, NFS4_OP_RESTOREFH */,
10106
     4 /* 32, NFS4_OP_SAVEFH */,
10107
     1 /* 33, NFS4_OP_SECINFO */,
10108
     1 /* 34, NFS4_OP_SETATTR */,
10109
     1 /* 35, NFS4_OP_SETCLIENTID */,
10110
     1 /* 36, NFS4_OP_SETCLIENTID_CONFIRM */,
10111
     1 /* 37, NFS4_OP_VERIFY */,
10112
     1 /* 38, NFS4_OP_WRITE */,
10113
     1 /* 39, NFS4_OP_RELEASE_LOCKOWNER */,
10114
      /* Minor version 1 */
10115
     1 /* 40, NFS4_OP_BACKCHANNEL_CTL */,
10116
     1 /* 41, NFS4_OP_BIND_CONN_TO_SESSION */,
10117
     1 /* 42, NFS4_OP_EXCHANGE_ID */,
10118
     1 /* 43, NFS4_OP_CREATE_SESSION */,
10119
     1 /* 44, NFS4_OP_DESTROY_SESSION */,
10120
     1 /* 45, NFS4_OP_FREE_STATEID */,
10121
     1 /* 46, NFS4_OP_GET_DIR_DELEGATION */,
10122
     1 /* 47, NFS4_OP_GETDEVINFO */,
10123
     1 /* 48, NFS4_OP_GETDEVLIST */,
10124
     1 /* 49, NFS4_OP_LAYOUTCOMMIT */,
10125
     1 /* 50, NFS4_OP_LAYOUTGET */,
10126
     1 /* 51, NFS4_OP_LAYOUTRETURN */,
10127
     1 /* 52, NFS4_OP_SECINFO_NO_NAME */,
10128
     4 /* 53, NFS4_OP_SEQUENCE */,
10129
     1 /* 54, NFS4_OP_SET_SSV */,
10130
     1 /* 55, NFS4_OP_TEST_STATEID */,
10131
     1 /* 56, NFS4_OP_WANT_DELEGATION  */,
10132
     1 /* 57, NFS4_OP_DESTROY_CLIENTID  */,
10133
     1 /* 58, NFS4_OP_RECLAIM_COMPLETE */,
10134
      /* Minor version 2 */
10135
     1 /* 59, NFS4_OP_ALLOCATE */,
10136
     1 /* 60, NFS4_OP_COPY */,
10137
     1 /* 61, NFS4_OP_COPY_NOTIFY */,
10138
     1 /* 62, NFS4_OP_DEALLOCATE */,
10139
     1 /* 63, NFS4_OP_IO_ADVISE */,
10140
     1 /* 64, NFS4_OP_LAYOUTERROR */,
10141
     1 /* 65, NFS4_OP_LAYOUTSTATS */,
10142
     1 /* 66, NFS4_OP_OFFLOAD_CANCEL */,
10143
     1 /* 67, NFS4_OP_OFFLOAD_STATUS */,
10144
     1 /* 68, NFS4_OP_READ_PLUS */,
10145
     1 /* 69, NFS4_OP_SEEK */,
10146
     1 /* 70, NFS4_OP_WRITE_SAME */,
10147
     1 /* 71, NFS4_OP_CLONE */,
10148
     1 /* 72, NFS4_OP_GETXATTR */,
10149
     1 /* 73, NFS4_OP_SETXATTR */,
10150
     1 /* 74, NFS4_OP_LISTXATTRS */,
10151
     1 /* 75, NFS4_OP_REMOVEXATTR */,
10152
};
10153
10154
#define NFS4_OPERATION_TIER(op) \
10155
0
  ((op) < G_N_ELEMENTS(nfs4_operation_tiers) ? nfs4_operation_tiers[(op)] : 0)
10156
10157
static int * const nfs4_exchid_flags[] = {
10158
  &hf_nfs4_exchid_flags_confirmed_r,
10159
  &hf_nfs4_exchid_flags_upd_conf_rec_a,
10160
  &hf_nfs4_exchid_flags_pnfs_ds,
10161
  &hf_nfs4_exchid_flags_pnfs_mds,
10162
  &hf_nfs4_exchid_flags_non_pnfs,
10163
  &hf_nfs4_exchid_flags_bind_princ,
10164
  &hf_nfs4_exchid_flags_moved_migr,
10165
  &hf_nfs4_exchid_flags_moved_refer,
10166
  NULL
10167
};
10168
10169
typedef struct nfs4_tap_data {
10170
10171
  uint32_t    ops_counter;
10172
  nfs4_operation_summary *op_summary;
10173
  unsigned highest_tier;
10174
} nfs4_tap_data_t;
10175
10176
static unsigned
10177
dissect_nfs4_request_op(tvbuff_t *tvb, unsigned offset, packet_info *pinfo, proto_tree *tree, rpc_call_info_value *civ)
10178
0
{
10179
0
  const char *name      = NULL;
10180
0
  const char *source_name     = NULL;
10181
0
  const char *dest_name     = NULL;
10182
0
  const char *opname      = NULL;
10183
0
  unsigned      opcode;
10184
0
  unsigned      highest_tier    = 5;
10185
0
  unsigned      current_tier    = 5;
10186
0
  unsigned      first_operation = 1;
10187
  /*unsigned name_offset = 0;*/
10188
0
  uint16_t      sid_hash;
10189
0
  uint64_t      clientid        = 0;
10190
0
  uint32_t      ops;
10191
0
  uint32_t      ops_counter;
10192
0
  uint32_t      summary_counter;
10193
0
  uint32_t      string_length;
10194
0
  int       last_fh_offset  = 0;
10195
0
  int       last_fh_length  = 0;
10196
0
  uint32_t      last_fh_hash    = 0;
10197
0
  uint32_t      saved_fh_hash   = 0;
10198
0
  int       saved_fh_offset = 0;
10199
0
  int       saved_fh_length = 0;
10200
0
  uint32_t      length;
10201
0
  uint32_t      hash;
10202
0
  uint64_t      length64;
10203
0
  uint64_t      file_offset;
10204
0
  proto_item *fitem;
10205
0
  proto_tree *ftree;
10206
0
  proto_tree *newftree      = NULL;
10207
0
  nfs4_operation_summary *op_summary;
10208
0
  uint16_t    dst_sid_hash;
10209
0
  uint64_t    dst_file_offset;
10210
10211
0
  ops = tvb_get_ntohl(tvb, offset+0);
10212
10213
0
  fitem = proto_tree_add_uint_format(tree, hf_nfs4_ops_count, tvb, offset+0, 4, ops,
10214
0
    "Operations (count: %u)", ops);
10215
0
  offset += 4;
10216
10217
0
#define MAX_NFSV4_OPS 128
10218
0
  if (ops > MAX_NFSV4_OPS) {
10219
    /*  Limit the number of operations to something "reasonable."
10220
     *  This is an arbitrary number to keep us from attempting to
10221
     *  allocate too much memory below.
10222
     */
10223
0
    expert_add_info(pinfo, fitem, &ei_nfs_too_many_ops);
10224
0
    ops = MAX_NFSV4_OPS;
10225
0
  }
10226
10227
0
  op_summary = wmem_alloc0_array(pinfo->pool, nfs4_operation_summary, ops);
10228
10229
0
  ftree = proto_item_add_subtree(fitem, ett_nfs4_request_op);
10230
10231
0
  if (ops)
10232
0
    proto_item_append_text(proto_tree_get_parent(tree), ", Ops(%u):", ops);
10233
10234
0
  for (ops_counter=0; ops_counter<ops; ops_counter++)
10235
0
  {
10236
0
    op_summary[ops_counter].optext = wmem_strbuf_new(pinfo->pool, "");
10237
0
    opcode = tvb_get_ntohl(tvb, offset);
10238
0
    op_summary[ops_counter].opcode = opcode;
10239
10240
0
    fitem = proto_tree_add_uint(ftree, hf_nfs4_op, tvb, offset, 4, opcode);
10241
10242
    /* the opcodes are not contiguous */
10243
0
    if ((opcode < NFS4_OP_ACCESS || opcode > NFS4_LAST_OP)
10244
0
    &&  opcode != NFS4_OP_ILLEGAL)
10245
0
      break;
10246
10247
    /* all of the V4 ops are contiguous, except for NFS4_OP_ILLEGAL */
10248
0
    if (opcode == NFS4_OP_ILLEGAL) {
10249
0
      newftree = proto_item_add_subtree(fitem, ett_nfs4_illegal);
10250
0
    } else if (nfs4_operation_ett[opcode - 3]) {
10251
0
      newftree = proto_item_add_subtree(fitem, *nfs4_operation_ett[opcode - 3]);
10252
0
    } else {
10253
0
      break;
10254
0
    }
10255
10256
0
    opname = val_to_str_ext_const(opcode, &names_nfs4_operation_ext, "Unknown");
10257
0
    offset += 4;
10258
10259
0
    wmem_strbuf_append_printf(op_summary[ops_counter].optext, "%s", opname);
10260
10261
0
    proto_item_append_text(proto_tree_get_parent(tree),
10262
0
      "%s%s", ops_counter ? ", " : " ", opname);
10263
0
    proto_item_append_text(proto_tree_get_parent(ftree),
10264
0
      "%s%s", ops_counter ? ", " : ": ", opname);
10265
10266
0
    switch (opcode)
10267
0
    {
10268
0
    case NFS4_OP_ACCESS:
10269
0
      {
10270
0
        uint32_t *acc_request, amask;
10271
10272
        /* Get access mask to check and save it for comparison in the reply. */
10273
0
        amask = tvb_get_ntohl(tvb, offset);
10274
0
        acc_request = (uint32_t *)wmem_memdup(wmem_file_scope(),  &amask, sizeof(uint32_t));
10275
0
        civ->private_data = acc_request;
10276
10277
0
        if (last_fh_hash != 0)
10278
0
          wmem_strbuf_append_printf (op_summary[ops_counter].optext, " FH: 0x%08x", last_fh_hash);
10279
0
        display_access_items(tvb, offset, pinfo, fitem, amask, amask, 'C', 4,
10280
0
          op_summary[ops_counter].optext, "Check") ;
10281
0
        offset+=4;
10282
0
      }
10283
0
      break;
10284
10285
0
    case NFS4_OP_CLOSE:
10286
0
      offset = dissect_rpc_uint32(tvb, newftree, hf_nfs4_seqid, offset);
10287
0
      offset = dissect_nfs4_stateid(tvb, offset, newftree, &sid_hash);
10288
0
      wmem_strbuf_append_printf (op_summary[ops_counter].optext, " StateID: 0x%04x", sid_hash);
10289
0
      break;
10290
10291
0
    case NFS4_OP_COMMIT:
10292
0
      file_offset = tvb_get_ntoh64(tvb, offset);
10293
0
      offset = dissect_rpc_uint64(tvb, newftree, hf_nfs4_offset, offset);
10294
0
      length = tvb_get_ntohl(tvb, offset);
10295
0
      offset = dissect_rpc_uint32(tvb, newftree, hf_nfs4_count, offset);
10296
0
      if (last_fh_hash != 0)
10297
0
        wmem_strbuf_append_printf (op_summary[ops_counter].optext,
10298
0
          " FH: 0x%08x Offset: %"PRIu64" Len: %u",
10299
0
          last_fh_hash, file_offset, length);
10300
10301
0
      break;
10302
10303
0
    case NFS4_OP_CREATE:
10304
0
      {
10305
0
        unsigned create_type;
10306
10307
0
        create_type = tvb_get_ntohl(tvb, offset);
10308
0
        offset = dissect_rpc_uint32(tvb, newftree, hf_nfs4_ftype, offset);
10309
10310
0
        switch (create_type)
10311
0
        {
10312
0
        case NF4LNK:
10313
0
          offset = dissect_nfs_utf8string(tvb, pinfo, offset, newftree, hf_nfs4_linktext, NULL);
10314
0
          break;
10315
10316
0
        case NF4BLK:
10317
0
        case NF4CHR:
10318
0
          offset = dissect_nfs4_specdata(tvb, offset, newftree);
10319
0
          break;
10320
10321
0
        case NF4SOCK:
10322
0
        case NF4FIFO:
10323
0
        case NF4DIR:
10324
0
          break;
10325
10326
0
        default:
10327
0
          break;
10328
0
        }
10329
10330
0
        offset = dissect_nfs_utf8string(tvb, pinfo, offset, newftree, hf_nfs4_component, &name);
10331
0
        offset = dissect_nfs4_fattrs(tvb, offset, pinfo, newftree, FATTR4_DISSECT_VALUES, civ, opcode, -1);
10332
10333
0
        if (nfs_file_name_snooping) {
10334
0
          nfs_name_snoop_add_name(((uint64_t)ops_counter << 32) | civ->xid, tvb, -1, (int)strlen(name), last_fh_offset, last_fh_length, name);
10335
0
        }
10336
0
      }
10337
0
      break;
10338
10339
0
    case NFS4_OP_DELEGPURGE:
10340
0
      offset = dissect_rpc_uint64(tvb, newftree, hf_nfs4_clientid, offset);
10341
0
      break;
10342
10343
0
    case NFS4_OP_DELEGRETURN:
10344
0
      offset = dissect_nfs4_stateid(tvb, offset, newftree, &sid_hash);
10345
0
      wmem_strbuf_append_printf (op_summary[ops_counter].optext, " StateID: 0x%04x", sid_hash);
10346
0
      break;
10347
10348
0
    case NFS4_OP_GETATTR:
10349
0
      offset = dissect_nfs4_fattrs(tvb, offset, pinfo, newftree, FATTR4_BITMAP_ONLY, civ, opcode, -1);
10350
10351
0
      if (last_fh_hash != 0)
10352
0
        wmem_strbuf_append_printf (op_summary[ops_counter].optext, " FH: 0x%08x", last_fh_hash);
10353
10354
0
      break;
10355
10356
0
    case NFS4_OP_GETFH:
10357
0
      break;
10358
10359
0
    case NFS4_OP_LINK:
10360
0
      offset = dissect_nfs_utf8string(tvb, pinfo, offset, newftree, hf_nfs4_component, NULL);
10361
0
      break;
10362
10363
0
    case NFS4_OP_LOCK:
10364
0
      offset = dissect_rpc_uint32(tvb, newftree, hf_nfs4_lock_type, offset);
10365
0
      offset = dissect_rpc_bool(tvb, newftree, hf_nfs4_lock_reclaim, offset);
10366
0
      file_offset = tvb_get_ntoh64(tvb, offset);
10367
0
      offset = dissect_rpc_uint64(tvb, newftree, hf_nfs4_offset, offset);
10368
0
      length64 = tvb_get_ntoh64(tvb, offset);
10369
0
      offset = dissect_rpc_uint64(tvb, newftree, hf_nfs4_length, offset);
10370
0
      offset = dissect_nfs4_locker(tvb, pinfo, offset, newftree);
10371
0
      if (last_fh_hash != 0)
10372
0
        wmem_strbuf_append_printf (op_summary[ops_counter].optext, " FH: 0x%08x", last_fh_hash);
10373
0
      wmem_strbuf_append_printf (op_summary[ops_counter].optext, " Offset: %"PRIu64, file_offset);
10374
0
      if (length64 == UINT64_C(0xffffffffffffffff))
10375
0
        wmem_strbuf_append_printf (op_summary[ops_counter].optext, " Length: <End of File>");
10376
0
      else
10377
0
        wmem_strbuf_append_printf (op_summary[ops_counter].optext, " Length: %"PRIu64, length64);
10378
0
      break;
10379
10380
0
    case NFS4_OP_LOCKT:
10381
0
      offset = dissect_rpc_uint32(tvb, newftree, hf_nfs4_lock_type, offset);
10382
0
      offset = dissect_rpc_uint64(tvb, newftree, hf_nfs4_offset, offset);
10383
0
      offset = dissect_rpc_uint64(tvb, newftree, hf_nfs4_length, offset);
10384
0
      offset = dissect_nfs4_lock_owner(tvb, pinfo, offset, newftree);
10385
0
      break;
10386
10387
0
    case NFS4_OP_LOCKU:
10388
0
      offset = dissect_rpc_uint32(tvb, newftree, hf_nfs4_lock_type, offset);
10389
0
      offset = dissect_rpc_uint32(tvb, tree, hf_nfs4_seqid, offset);
10390
0
      offset = dissect_nfs4_stateid(tvb, offset, newftree, NULL);
10391
0
      file_offset = tvb_get_ntoh64(tvb, offset);
10392
0
      offset = dissect_rpc_uint64(tvb, newftree, hf_nfs4_offset, offset);
10393
0
      length64 = tvb_get_ntoh64(tvb, offset);
10394
0
      offset = dissect_rpc_uint64(tvb, newftree, hf_nfs4_length, offset);
10395
0
      if (last_fh_hash != 0)
10396
0
        wmem_strbuf_append_printf (op_summary[ops_counter].optext, " FH: 0x%08x", last_fh_hash);
10397
0
      wmem_strbuf_append_printf (op_summary[ops_counter].optext, " Offset: %"PRIu64, file_offset);
10398
0
      if (length64 == UINT64_C(0xffffffffffffffff))
10399
0
        wmem_strbuf_append_printf (op_summary[ops_counter].optext, " Length: <End of File>");
10400
0
      else
10401
0
        wmem_strbuf_append_printf (op_summary[ops_counter].optext, " Length: %"PRIu64, length64);
10402
0
      break;
10403
10404
0
    case NFS4_OP_LOOKUP:
10405
      /*name_offset = offset;*/
10406
0
      offset = dissect_nfs_utf8string(tvb, pinfo, offset, newftree, hf_nfs4_component, &name);
10407
0
      if (nfs_file_name_snooping) {
10408
0
        nfs_name_snoop_add_name(((uint64_t)ops_counter << 32) | civ->xid, tvb, -1, (int)strlen(name), last_fh_offset, last_fh_length, name);
10409
0
      }
10410
0
      wmem_strbuf_append_printf (op_summary[ops_counter].optext, " ");
10411
0
      if (last_fh_hash != 0)
10412
0
        wmem_strbuf_append_printf (op_summary[ops_counter].optext, "DH: 0x%08x/", last_fh_hash);
10413
0
      if (name != NULL)
10414
0
        wmem_strbuf_append_printf (op_summary[ops_counter].optext, "%s", name);
10415
0
      break;
10416
10417
0
    case NFS4_OP_LOOKUPP:
10418
0
      break;
10419
10420
0
    case NFS4_OP_NVERIFY:
10421
0
      offset = dissect_nfs4_fattrs(tvb, offset, pinfo, newftree, FATTR4_DISSECT_VALUES, civ, opcode, -1);
10422
0
      if (last_fh_hash != 0)
10423
0
        wmem_strbuf_append_printf (op_summary[ops_counter].optext, " FH: 0x%08x", last_fh_hash);
10424
0
      break;
10425
10426
0
    case NFS4_OP_OPEN:
10427
0
      offset = dissect_rpc_uint32(tvb, newftree, hf_nfs4_seqid, offset);
10428
0
      offset = dissect_nfs4_open_share_access(tvb, offset, newftree);
10429
0
      offset = dissect_nfs4_open_share_deny(tvb, offset, newftree);
10430
0
      offset = dissect_nfs4_open_owner(tvb, pinfo, offset, newftree);
10431
0
      offset = dissect_nfs4_openflag(tvb, offset, pinfo, newftree, civ);
10432
0
      offset = dissect_nfs4_open_claim(tvb, offset, pinfo, newftree, &name, last_fh_offset, last_fh_length, civ, ops_counter);
10433
0
      wmem_strbuf_append_printf (op_summary[ops_counter].optext, " ");
10434
0
      if (last_fh_hash != 0) {
10435
0
        if (name != NULL)
10436
0
          wmem_strbuf_append_printf (op_summary[ops_counter].optext, "DH: 0x%08x/", last_fh_hash);
10437
0
        else
10438
0
          wmem_strbuf_append_printf (op_summary[ops_counter].optext, "FH: 0x%08x", last_fh_hash);
10439
0
      }
10440
0
      if (name != NULL)
10441
0
        wmem_strbuf_append_printf (op_summary[ops_counter].optext, "%s", name);
10442
0
      break;
10443
10444
0
    case NFS4_OP_OPENATTR:
10445
0
      offset = dissect_rpc_bool(tvb, newftree, hf_nfs4_attr_dir_create, offset);
10446
0
      break;
10447
10448
0
    case NFS4_OP_OPEN_CONFIRM:
10449
0
      offset = dissect_nfs4_stateid(tvb, offset, newftree, NULL);
10450
0
      offset = dissect_rpc_uint32(tvb, newftree, hf_nfs4_seqid, offset);
10451
0
      break;
10452
10453
0
    case NFS4_OP_OPEN_DOWNGRADE:
10454
0
      offset = dissect_nfs4_stateid(tvb, offset, newftree, NULL);
10455
0
      offset = dissect_rpc_uint32(tvb, newftree, hf_nfs4_seqid, offset);
10456
0
      offset = dissect_nfs4_open_share_access(tvb, offset, newftree);
10457
0
      offset = dissect_nfs4_open_share_deny(tvb, offset, newftree);
10458
0
      break;
10459
10460
0
    case NFS4_OP_PUTFH:
10461
0
      offset = dissect_nfs4_fh(tvb, offset, pinfo, newftree, "FileHandle", &last_fh_hash, &last_fh_offset, &last_fh_length, civ, opcode, -1);
10462
0
      break;
10463
10464
0
    case NFS4_OP_PUTPUBFH:
10465
0
      break;
10466
10467
0
    case NFS4_OP_PUTROOTFH:
10468
0
      if (nfs_file_name_snooping)
10469
0
        nfs_name_snoop_add_name(((uint64_t)ops_counter << 32) | civ->xid, tvb, -1, 1, 0, 0, "/");
10470
0
      break;
10471
10472
0
    case NFS4_OP_READ:
10473
0
      offset = dissect_nfs4_stateid(tvb, offset, newftree, &sid_hash);
10474
0
      file_offset = tvb_get_ntoh64(tvb, offset);
10475
0
      offset = dissect_rpc_uint64(tvb, newftree, hf_nfs4_offset, offset);
10476
0
      length = tvb_get_ntohl(tvb, offset);
10477
0
      offset = dissect_rpc_uint32(tvb, newftree, hf_nfs4_count, offset);
10478
0
      if (sid_hash != 0)
10479
0
        wmem_strbuf_append_printf (op_summary[ops_counter].optext,
10480
0
          " StateID: 0x%04x Offset: %" PRIu64 " Len: %u",
10481
0
          sid_hash, file_offset, length);
10482
0
      break;
10483
10484
0
    case NFS4_OP_READDIR:
10485
0
      offset = dissect_rpc_uint64(tvb, newftree, hf_nfs4_cookie, offset);
10486
0
      offset = dissect_rpc_uint64(tvb, newftree, hf_nfs4_cookie_verf, offset);
10487
0
      offset = dissect_rpc_uint32(tvb, newftree, hf_nfs4_count_dircount, offset);
10488
0
      offset = dissect_rpc_uint32(tvb, newftree, hf_nfs4_count_maxcount, offset);
10489
0
      offset = dissect_nfs4_fattrs(tvb, offset, pinfo, newftree, FATTR4_BITMAP_ONLY, civ, opcode, -1);
10490
0
      if (last_fh_hash != 0)
10491
0
        wmem_strbuf_append_printf (op_summary[ops_counter].optext, " FH: 0x%08x", last_fh_hash);
10492
0
      break;
10493
10494
0
    case NFS4_OP_READLINK:
10495
0
      break;
10496
10497
0
    case NFS4_OP_TEST_STATEID:
10498
0
      offset = dissect_rpc_array(tvb, pinfo, newftree, offset, dissect_nfs4_test_stateid_arg, hf_nfs4_test_stateid_arg);
10499
0
      break;
10500
10501
0
    case NFS4_OP_DESTROY_CLIENTID:
10502
0
      offset = dissect_rpc_uint64(tvb, newftree, hf_nfs4_clientid, offset);
10503
0
      break;
10504
0
    case NFS4_OP_RECLAIM_COMPLETE:
10505
0
      offset = dissect_rpc_bool(tvb, newftree, hf_nfs4_reclaim_one_fs, offset);
10506
0
      break;
10507
10508
0
    case NFS4_OP_REMOVE:
10509
0
      offset = dissect_nfs_utf8string(tvb, pinfo, offset, newftree, hf_nfs4_component, &name);
10510
0
      wmem_strbuf_append_printf (op_summary[ops_counter].optext, " ");
10511
0
      if (last_fh_hash != 0)
10512
0
        wmem_strbuf_append_printf (op_summary[ops_counter].optext, "DH: 0x%08x/", last_fh_hash);
10513
0
      if (name != NULL)
10514
0
        wmem_strbuf_append_printf (op_summary[ops_counter].optext, "%s", name);
10515
0
      break;
10516
10517
0
    case NFS4_OP_RENAME:
10518
0
      offset = dissect_nfs_utf8string(tvb, pinfo, offset, newftree, hf_nfs4_component, &source_name);
10519
0
      offset = dissect_nfs_utf8string(tvb, pinfo, offset, newftree, hf_nfs4_component, &dest_name);
10520
0
      wmem_strbuf_append_printf (op_summary[ops_counter].optext, " From: %s To: %s",
10521
0
        source_name ? source_name : "Unknown", dest_name ? dest_name : "Unknown");
10522
0
      break;
10523
10524
0
    case NFS4_OP_RENEW:
10525
0
      clientid = tvb_get_ntoh64(tvb, offset);
10526
0
      offset = dissect_rpc_uint64(tvb, newftree, hf_nfs4_clientid, offset);
10527
0
      wmem_strbuf_append_printf (op_summary[ops_counter].optext, " CID: 0x%016"PRIx64, clientid);
10528
10529
0
      break;
10530
10531
0
    case NFS4_OP_RESTOREFH:
10532
0
      last_fh_offset = saved_fh_offset;
10533
0
      last_fh_length = saved_fh_length;
10534
0
      last_fh_hash = saved_fh_hash;
10535
0
      break;
10536
10537
0
    case NFS4_OP_SAVEFH:
10538
0
      saved_fh_offset = last_fh_offset;
10539
0
      saved_fh_length = last_fh_length;
10540
0
      saved_fh_hash = last_fh_hash;
10541
0
      break;
10542
10543
0
    case NFS4_OP_SECINFO:
10544
0
      offset = dissect_nfs_utf8string(tvb, pinfo, offset, newftree,
10545
0
        hf_nfs4_component, NULL);
10546
0
      break;
10547
10548
0
    case NFS4_OP_SECINFO_NO_NAME:
10549
0
      proto_tree_add_item(newftree, hf_nfs4_secinfo_style, tvb, offset, 4, ENC_BIG_ENDIAN);
10550
0
      offset += 4;
10551
0
      break;
10552
10553
0
    case NFS4_OP_SETATTR:
10554
0
      offset = dissect_nfs4_stateid(tvb, offset, newftree, NULL);
10555
0
      offset = dissect_nfs4_fattrs(tvb, offset, pinfo, newftree, FATTR4_DISSECT_VALUES, civ, opcode, -1);
10556
0
      if (last_fh_hash != 0)
10557
0
        wmem_strbuf_append_printf (op_summary[ops_counter].optext, " FH: 0x%08x", last_fh_hash);
10558
0
      break;
10559
10560
0
    case NFS4_OP_SETCLIENTID:
10561
0
      {
10562
0
        proto_tree *client_tree = NULL;
10563
0
        proto_tree *callback_tree = NULL;
10564
10565
0
        client_tree = proto_tree_add_subtree(newftree, tvb, offset, 0, ett_nfs4_client_id, NULL, "client");
10566
10567
0
        offset = dissect_nfs4_client_id(tvb, pinfo, offset, client_tree);
10568
10569
0
        callback_tree = proto_tree_add_subtree(newftree, tvb, offset, 0, ett_nfs4_cb_client, NULL, "callback");
10570
10571
0
        offset = dissect_nfs4_cb_client4(tvb, pinfo, offset, callback_tree);
10572
10573
0
        offset = dissect_rpc_uint32(tvb, newftree, hf_nfs4_callback_ident,
10574
0
          offset);
10575
0
      }
10576
0
      break;
10577
10578
0
    case NFS4_OP_SETCLIENTID_CONFIRM:
10579
0
      offset = dissect_rpc_uint64(tvb, newftree, hf_nfs4_clientid, offset);
10580
0
      offset = dissect_rpc_uint64(tvb, newftree, hf_nfs4_verifier, offset);
10581
0
      break;
10582
10583
0
    case NFS4_OP_VERIFY:
10584
0
      offset = dissect_nfs4_fattrs(tvb, offset, pinfo, newftree, FATTR4_DISSECT_VALUES, civ, opcode, -1);
10585
0
      break;
10586
10587
0
    case NFS4_OP_WRITE:
10588
0
      offset = dissect_nfs4_stateid(tvb, offset, newftree, &sid_hash);
10589
0
      file_offset = tvb_get_ntoh64(tvb, offset);
10590
0
      offset = dissect_rpc_uint64(tvb, newftree, hf_nfs4_offset, offset);
10591
0
      offset = dissect_nfs4_stable_how(tvb, pinfo, offset, newftree, "stable");
10592
0
      string_length = tvb_get_ntohl(tvb, offset+0);
10593
0
      dissect_rpc_uint32(tvb, newftree, hf_nfs4_write_data_length, offset); /* don't change offset */
10594
0
      offset = dissect_nfsdata(tvb, pinfo, offset, newftree, hf_nfs_data);
10595
0
      if (sid_hash != 0)
10596
0
        wmem_strbuf_append_printf (op_summary[ops_counter].optext,
10597
0
          " StateID: 0x%04x Offset: %"PRIu64" Len: %u",
10598
0
          sid_hash, file_offset, string_length);
10599
0
      break;
10600
10601
0
    case NFS4_OP_RELEASE_LOCKOWNER:
10602
0
      offset = dissect_nfs4_lock_owner(tvb, pinfo, offset, newftree);
10603
0
      break;
10604
10605
      /* Minor Version 1 */
10606
0
    case NFS4_OP_BACKCHANNEL_CTL:
10607
0
      nfs4_cb_register_prog(tvb, offset);
10608
0
      offset = dissect_rpc_uint32(tvb, newftree, hf_nfs4_cb_program, offset);
10609
0
      offset = dissect_rpc_secparms4(tvb, pinfo, offset, newftree);
10610
0
      break;
10611
0
    case NFS4_OP_BIND_CONN_TO_SESSION:
10612
0
      offset = dissect_nfs4_sessionid(tvb, offset, newftree);
10613
0
      offset = dissect_rpc_uint32(tvb, newftree, hf_nfs4_bctsa_dir, offset);
10614
0
      offset = dissect_rpc_bool(tvb, newftree, hf_nfs4_bctsa_use_conn_in_rdma_mode, offset);
10615
0
      break;
10616
10617
0
    case NFS4_OP_EXCHANGE_ID:
10618
0
      {
10619
0
      proto_tree *eia_clientowner_tree;
10620
10621
0
      eia_clientowner_tree = proto_tree_add_subtree(newftree, tvb, offset, 0, ett_nfs4_clientowner, NULL, "eia_clientowner");
10622
0
      offset = dissect_rpc_uint64(tvb, eia_clientowner_tree, hf_nfs4_verifier, offset);
10623
0
      offset = dissect_nfsdata(tvb, pinfo, offset, eia_clientowner_tree, hf_nfs_data);
10624
10625
0
      proto_tree_add_bitmask(eia_clientowner_tree, tvb, offset, hf_nfs4_exchid_call_flags, ett_nfs4_exchangeid_call_flags, nfs4_exchid_flags, ENC_BIG_ENDIAN);
10626
0
      offset += 4;
10627
10628
0
      offset = dissect_nfs4_state_protect_a(tvb, offset, pinfo, newftree);
10629
0
      offset = dissect_rpc_nfs_impl_id4(tvb, pinfo, offset, newftree, "eia_client_impl_id");
10630
0
      }
10631
0
      break;
10632
10633
0
    case NFS4_OP_CREATE_SESSION:
10634
0
      offset = dissect_rpc_uint64(tvb, newftree, hf_nfs4_clientid, offset);
10635
0
      offset = dissect_rpc_uint32(tvb, newftree, hf_nfs4_seqid, offset);
10636
0
      offset = dissect_nfs_create_session_flags(tvb, offset, newftree,
10637
0
        hf_nfs4_create_session_flags_csa);
10638
0
      offset = dissect_rpc_chanattrs4(tvb, offset, newftree, "csa_fore_chan_attrs");
10639
0
      offset = dissect_rpc_chanattrs4(tvb, offset, newftree, "csa_back_chan_attrs");
10640
0
      nfs4_cb_register_prog(tvb, offset);
10641
0
      offset = dissect_rpc_uint32(tvb, newftree, hf_nfs4_cb_program, offset);
10642
0
      offset = dissect_rpc_secparms4(tvb, pinfo, offset, newftree);
10643
0
      break;
10644
10645
0
    case NFS4_OP_DESTROY_SESSION:
10646
0
      offset = dissect_nfs4_sessionid(tvb, offset, newftree);
10647
0
      break;
10648
0
    case NFS4_OP_FREE_STATEID:
10649
0
      offset = dissect_nfs4_stateid(tvb, offset, newftree, &sid_hash);
10650
0
      wmem_strbuf_append_printf(op_summary[ops_counter].optext, " StateID: 0x%04x", sid_hash);
10651
0
      break;
10652
10653
0
    case NFS4_OP_GET_DIR_DELEGATION:
10654
0
      offset = dissect_rpc_bool(tvb, newftree, hf_nfs4_gdd_signal_deleg_avail, offset);
10655
0
      offset = dissect_nfs4_notify_type4_bitmap(tvb, newftree, pinfo, offset, opcode, -1);
10656
0
      offset = dissect_nfs4_gdd_time(tvb, offset, newftree, hf_nfs4_gdd_child_attr_delay);
10657
0
      offset = dissect_nfs4_gdd_time(tvb, offset, newftree, hf_nfs4_gdd_dir_attr_delay);
10658
0
      offset = dissect_nfs4_gdd_fattrs(tvb, offset, pinfo, newftree,
10659
0
               FATTR4_BITMAP_ONLY, civ, hf_nfs4_gdd_child_attrs, opcode, -1);
10660
0
      offset = dissect_nfs4_gdd_fattrs(tvb, offset, pinfo, newftree,
10661
0
               FATTR4_BITMAP_ONLY, civ, hf_nfs4_gdd_dir_attrs, opcode, -1);
10662
0
      break;
10663
10664
      /* pNFS */
10665
0
    case NFS4_OP_LAYOUTGET:
10666
0
      offset = dissect_rpc_bool(tvb, newftree, hf_nfs4_layout_avail, offset);
10667
0
      offset = dissect_rpc_uint32(tvb, newftree, hf_nfs4_layout_type, offset);
10668
0
      offset = dissect_rpc_uint32(tvb, newftree, hf_nfs4_iomode, offset);
10669
0
      offset = dissect_rpc_uint64(tvb, newftree, hf_nfs4_offset, offset);
10670
0
      offset = dissect_rpc_uint64(tvb, newftree, hf_nfs4_length, offset);
10671
0
      offset = dissect_rpc_uint64(tvb, newftree, hf_nfs4_length_minlength, offset);
10672
0
      offset = dissect_nfs4_stateid(tvb, offset, newftree, NULL);
10673
0
      offset = dissect_rpc_uint32(tvb, newftree, hf_nfs4_count_maxcount,
10674
0
                    offset);
10675
0
      break;
10676
10677
0
    case NFS4_OP_LAYOUTCOMMIT:
10678
0
      offset = dissect_rpc_uint64(tvb, newftree, hf_nfs4_offset, offset);
10679
0
      offset = dissect_rpc_uint64(tvb, newftree, hf_nfs4_length, offset);
10680
0
      offset = dissect_rpc_bool(tvb, newftree, hf_nfs4_reclaim, offset);
10681
0
      offset = dissect_nfs4_stateid(tvb, offset, newftree, NULL);
10682
0
      offset = dissect_nfs4_newoffset(tvb, offset, newftree);
10683
0
      offset = dissect_nfs4_newtime(tvb, offset, newftree);
10684
0
      offset = dissect_rpc_uint32(tvb, newftree, hf_nfs4_layout_type, offset);
10685
0
      offset = dissect_nfsdata(tvb, pinfo, offset, newftree, hf_nfs4_layoutupdate);
10686
0
      break;
10687
10688
0
    case NFS4_OP_LAYOUTRETURN:
10689
0
      offset = dissect_nfs4_layoutreturn(tvb, offset, pinfo, newftree, civ);
10690
0
      break;
10691
10692
0
    case NFS4_OP_GETDEVINFO:
10693
0
      offset = dissect_nfs4_deviceid(tvb, offset, newftree);
10694
0
      offset = dissect_rpc_uint32(tvb, newftree, hf_nfs4_layout_type, offset);
10695
0
      offset = dissect_rpc_uint32(tvb, newftree, hf_nfs4_count_maxcount, offset);
10696
0
      offset = dissect_nfs4_notify_deviceid_bitmap(tvb, newftree, pinfo, offset);
10697
0
      break;
10698
10699
0
    case NFS4_OP_GETDEVLIST:
10700
0
      offset = dissect_rpc_uint32(tvb, newftree, hf_nfs4_layout_type, offset);
10701
0
      offset = dissect_rpc_uint32(tvb, newftree, hf_nfs4_count_maxcount, offset);
10702
0
      offset = dissect_rpc_uint64(tvb, newftree, hf_nfs4_cookie, offset);
10703
0
      offset = dissect_rpc_uint64(tvb, newftree, hf_nfs4_cookie_verf, offset);
10704
0
      break;
10705
10706
0
    case NFS4_OP_SEQUENCE:
10707
0
      offset = dissect_nfs4_sessionid(tvb, offset, newftree);
10708
0
      offset = dissect_rpc_uint32(tvb, newftree, hf_nfs4_seqid, offset);
10709
0
      offset = dissect_rpc_uint32(tvb, newftree, hf_nfs4_slotid, offset);
10710
0
      offset = dissect_rpc_uint32(tvb, newftree, hf_nfs4_high_slotid, offset);
10711
0
      offset = dissect_rpc_bool(tvb, newftree, hf_nfs4_cachethis, offset);
10712
0
      break;
10713
10714
0
    case NFS4_OP_ALLOCATE:
10715
0
      offset = dissect_nfs4_stateid(tvb, offset, newftree, &sid_hash);
10716
0
      file_offset = tvb_get_ntoh64(tvb, offset);
10717
0
      offset = dissect_rpc_uint64(tvb, newftree, hf_nfs4_offset, offset);
10718
0
      length64 = tvb_get_ntoh64(tvb, offset);
10719
0
      offset = dissect_rpc_uint64(tvb, newftree, hf_nfs4_length, offset);
10720
0
      if (sid_hash != 0)
10721
0
        wmem_strbuf_append_printf (op_summary[ops_counter].optext,
10722
0
          " StateID: 0x%04x"
10723
0
          " Offset: %" PRIu64
10724
0
          " Len: %" PRIu64,
10725
0
          sid_hash, file_offset, length64);
10726
0
      break;
10727
10728
0
    case NFS4_OP_COPY:
10729
10730
0
      offset = dissect_nfs4_stateid(tvb, offset, newftree, &sid_hash);
10731
0
      offset = dissect_nfs4_stateid(tvb, offset, newftree, &dst_sid_hash);
10732
0
      file_offset = tvb_get_ntoh64(tvb, offset);
10733
0
      offset = dissect_rpc_uint64(tvb, newftree, hf_nfs4_offset, offset);
10734
0
      dst_file_offset = tvb_get_ntoh64(tvb, offset);
10735
0
      offset = dissect_rpc_uint64(tvb, newftree, hf_nfs4_offset, offset);
10736
0
      length64 = tvb_get_ntoh64(tvb, offset);
10737
0
      offset = dissect_rpc_uint64(tvb, newftree, hf_nfs4_length, offset);
10738
0
      if (sid_hash != 0)
10739
0
        wmem_strbuf_append_printf (op_summary[ops_counter].optext,
10740
0
          " Src StateID: 0x%04x"
10741
0
          " Offset: %" PRIu64
10742
0
          " Len: %" PRIu64,
10743
0
          sid_hash, file_offset, length64);
10744
10745
0
      offset = dissect_rpc_bool(tvb, newftree, hf_nfs4_consecutive, offset);
10746
0
      offset = dissect_rpc_bool(tvb, newftree, hf_nfs4_synchronous, offset);
10747
10748
      /* FIXME: Report consecutive and sync? */
10749
10750
0
      if (dst_sid_hash != 0)
10751
0
        wmem_strbuf_append_printf (op_summary[ops_counter].optext,
10752
0
          " Dst StateID: 0x%04x"
10753
0
          " Offset: %" PRIu64,
10754
0
          dst_sid_hash, dst_file_offset);
10755
10756
0
      offset = dissect_nfs4_source_servers(tvb, pinfo, offset, newftree);
10757
0
      break;
10758
10759
0
    case NFS4_OP_COPY_NOTIFY:
10760
0
      offset = dissect_nfs4_stateid(tvb, offset, newftree, &sid_hash);
10761
0
      if (sid_hash != 0)
10762
0
        wmem_strbuf_append_printf (op_summary[ops_counter].optext,
10763
0
          " StateID: 0x%04x",
10764
0
          sid_hash);
10765
10766
0
      offset = dissect_nfs4_netloc(tvb, pinfo, offset, newftree);
10767
10768
0
      break;
10769
10770
0
    case NFS4_OP_DEALLOCATE:
10771
0
      offset = dissect_nfs4_stateid(tvb, offset, newftree, &sid_hash);
10772
0
      file_offset = tvb_get_ntoh64(tvb, offset);
10773
0
      offset = dissect_rpc_uint64(tvb, newftree, hf_nfs4_offset, offset);
10774
0
      length64 = tvb_get_ntoh64(tvb, offset);
10775
0
      offset = dissect_rpc_uint64(tvb, newftree, hf_nfs4_length, offset);
10776
0
      if (sid_hash != 0)
10777
0
        wmem_strbuf_append_printf (op_summary[ops_counter].optext,
10778
0
          " StateID: 0x%04x"
10779
0
          " Offset: %" PRIu64
10780
0
          " Len: %" PRIu64,
10781
0
          sid_hash, file_offset, length64);
10782
0
      break;
10783
10784
0
    case NFS4_OP_IO_ADVISE:
10785
0
      offset = dissect_nfs4_stateid(tvb, offset, newftree, &sid_hash);
10786
0
      file_offset = tvb_get_ntoh64(tvb, offset);
10787
0
      offset = dissect_rpc_uint64(tvb, newftree, hf_nfs4_offset, offset);
10788
0
      length64 = tvb_get_ntoh64(tvb, offset);
10789
0
      offset = dissect_rpc_uint64(tvb, newftree, hf_nfs4_length, offset);
10790
0
      if (sid_hash != 0)
10791
0
        wmem_strbuf_append_printf (op_summary[ops_counter].optext,
10792
0
          " StateID: 0x%04x"
10793
0
          " Offset: %" PRIu64
10794
0
          " Len: %" PRIu64,
10795
0
          sid_hash, file_offset, length64);
10796
0
      offset = dissect_nfs4_io_hints(tvb, offset, pinfo, newftree);
10797
0
      break;
10798
10799
0
    case NFS4_OP_OFFLOAD_CANCEL:
10800
0
      offset = dissect_nfs4_stateid(tvb, offset, newftree, &sid_hash);
10801
0
      if (sid_hash != 0)
10802
0
        wmem_strbuf_append_printf (op_summary[ops_counter].optext,
10803
0
          " StateID: 0x%04x",
10804
0
          sid_hash);
10805
0
      break;
10806
10807
0
    case NFS4_OP_OFFLOAD_STATUS:
10808
0
      offset = dissect_nfs4_stateid(tvb, offset, newftree, &sid_hash);
10809
0
      if (sid_hash != 0)
10810
0
        wmem_strbuf_append_printf (op_summary[ops_counter].optext,
10811
0
          " StateID: 0x%04x",
10812
0
          sid_hash);
10813
0
      break;
10814
10815
0
    case NFS4_OP_READ_PLUS:
10816
0
      offset = dissect_nfs4_stateid(tvb, offset, newftree, &sid_hash);
10817
0
      file_offset = tvb_get_ntoh64(tvb, offset);
10818
0
      offset = dissect_rpc_uint64(tvb, newftree, hf_nfs4_offset, offset);
10819
0
      length = tvb_get_ntohl(tvb, offset);
10820
0
      offset = dissect_rpc_uint32(tvb, newftree, hf_nfs4_count, offset);
10821
0
      if (sid_hash != 0)
10822
0
        wmem_strbuf_append_printf (op_summary[ops_counter].optext,
10823
0
          " StateID: 0x%04x Offset: %" PRIu64 " Len: %u",
10824
0
          sid_hash, file_offset, length);
10825
0
      break;
10826
10827
0
    case NFS4_OP_LAYOUTERROR:
10828
0
      file_offset = tvb_get_ntoh64(tvb, offset);
10829
0
      offset = dissect_rpc_uint64(tvb, newftree, hf_nfs4_offset, offset);
10830
0
      length = tvb_get_ntohl(tvb, offset);
10831
0
      offset = dissect_rpc_uint64(tvb, newftree, hf_nfs4_length, offset);
10832
0
      offset = dissect_nfs4_stateid(tvb, offset, newftree, &sid_hash);
10833
0
      if (sid_hash != 0)
10834
0
        wmem_strbuf_append_printf (op_summary[ops_counter].optext,
10835
0
          " StateID: 0x%04x Offset: %" PRIu64 " Len: %u",
10836
0
          sid_hash, file_offset, length);
10837
0
      offset = dissect_nfs4_device_errors(tvb, offset, newftree);
10838
0
      break;
10839
10840
0
    case NFS4_OP_LAYOUTSTATS:
10841
0
      file_offset = tvb_get_ntoh64(tvb, offset);
10842
0
      offset = dissect_rpc_uint64(tvb, newftree, hf_nfs4_offset, offset);
10843
0
      length = tvb_get_ntohl(tvb, offset);
10844
0
      offset = dissect_rpc_uint64(tvb, newftree, hf_nfs4_length, offset);
10845
0
      offset = dissect_nfs4_stateid(tvb, offset, newftree, &sid_hash);
10846
0
      if (sid_hash != 0)
10847
0
        wmem_strbuf_append_printf (op_summary[ops_counter].optext,
10848
0
          " StateID: 0x%04x Offset: %" PRIu64 " Len: %u",
10849
0
          sid_hash, file_offset, length);
10850
0
      offset = dissect_nfs4_layoutstats(tvb, offset, pinfo, newftree, civ, true);
10851
0
      break;
10852
10853
0
    case NFS4_OP_SEEK:
10854
0
      offset = dissect_nfs4_stateid(tvb, offset, newftree, &sid_hash);
10855
0
      file_offset = tvb_get_ntoh64(tvb, offset);
10856
0
      offset = dissect_rpc_uint64(tvb, newftree, hf_nfs4_offset, offset);
10857
0
      proto_tree_add_item(newftree, hf_nfs4_seek_data_content, tvb,
10858
0
            offset, 4, ENC_BIG_ENDIAN);
10859
0
      offset += 4;
10860
0
      if (sid_hash != 0)
10861
0
        wmem_strbuf_append_printf(op_summary[ops_counter].optext,
10862
0
          " StateID: 0x%04x Offset: %" PRIu64,
10863
0
          sid_hash, file_offset);
10864
0
      break;
10865
10866
0
    case NFS4_OP_WRITE_SAME:
10867
0
      offset = dissect_nfs4_stateid(tvb, offset, newftree, &sid_hash);
10868
0
      offset = dissect_nfs4_stable_how(tvb, pinfo, offset, newftree, "stable");
10869
0
      offset = dissect_nfs4_app_data_block(tvb, offset, newftree, &hash);
10870
0
      wmem_strbuf_append_printf(op_summary[ops_counter].optext,
10871
0
        "Pattern Hash: 0x%08x", hash);
10872
10873
0
      break;
10874
10875
0
    case NFS4_OP_CLONE:
10876
0
      offset = dissect_nfs4_stateid(tvb, offset, newftree, &sid_hash);
10877
0
      offset = dissect_nfs4_stateid(tvb, offset, newftree, &dst_sid_hash);
10878
0
      file_offset = tvb_get_ntoh64(tvb, offset);
10879
0
      offset = dissect_rpc_uint64(tvb, newftree, hf_nfs4_offset, offset);
10880
0
      dst_file_offset = tvb_get_ntoh64(tvb, offset);
10881
0
      offset = dissect_rpc_uint64(tvb, newftree, hf_nfs4_offset, offset);
10882
0
      length64 = tvb_get_ntoh64(tvb, offset);
10883
0
      offset = dissect_rpc_uint64(tvb, newftree, hf_nfs4_length, offset);
10884
0
      if (sid_hash != 0)
10885
0
        wmem_strbuf_append_printf (op_summary[ops_counter].optext,
10886
0
          " Src StateID: 0x%04x"
10887
0
          " Offset: %" PRIu64
10888
0
          " Len: %" PRIu64,
10889
0
          sid_hash, file_offset, length64);
10890
10891
0
      if (dst_sid_hash != 0)
10892
0
        wmem_strbuf_append_printf (op_summary[ops_counter].optext,
10893
0
          " Dst StateID: 0x%04x"
10894
0
          " Offset: %" PRIu64,
10895
0
          dst_sid_hash, dst_file_offset);
10896
10897
0
      break;
10898
10899
0
    case NFS4_OP_GETXATTR:
10900
0
      offset = dissect_nfs_utf8string(tvb, pinfo, offset, newftree, hf_nfs4_xattrkey, NULL);
10901
0
      break;
10902
10903
0
    case NFS4_OP_SETXATTR:
10904
0
      offset = dissect_rpc_uint32(tvb, newftree, hf_nfs4_setxattr_options, offset);
10905
0
      offset = dissect_nfs_utf8string(tvb, pinfo, offset, newftree, hf_nfs4_xattrkey, NULL);
10906
0
      offset = dissect_nfsdata(tvb, pinfo, offset, newftree, hf_nfs_data);
10907
0
      break;
10908
10909
0
    case NFS4_OP_LISTXATTRS:
10910
0
      offset = dissect_rpc_uint64(tvb, newftree, hf_nfs4_listxattr_cookie, offset);
10911
0
      offset = dissect_rpc_uint32(tvb, newftree, hf_nfs4_listxattr_maxcount, offset);
10912
0
      break;
10913
10914
0
    case NFS4_OP_REMOVEXATTR:
10915
0
      offset = dissect_nfs_utf8string(tvb, pinfo, offset, newftree, hf_nfs4_xattrkey, NULL);
10916
0
      break;
10917
10918
    /* In theory, it's possible to get this opcode */
10919
0
    case NFS4_OP_ILLEGAL:
10920
0
      break;
10921
10922
0
    default:
10923
0
      break;
10924
0
    }
10925
0
  }
10926
10927
  /* Detect which tiers are present in this packet */
10928
0
  for (summary_counter=0; summary_counter < ops_counter; summary_counter++)
10929
0
  {
10930
0
    current_tier = NFS4_OPERATION_TIER(op_summary[summary_counter].opcode);
10931
0
    if (current_tier < highest_tier)
10932
0
      highest_tier = current_tier;
10933
0
  }
10934
10935
  /* Display packet summary */
10936
0
  for (summary_counter=0; summary_counter < ops_counter; summary_counter++)
10937
0
  {
10938
0
    unsigned main_opcode;
10939
0
    proto_item *main_op_item = NULL;
10940
10941
0
    main_opcode = op_summary[summary_counter].opcode;
10942
0
    current_tier = NFS4_OPERATION_TIER(op_summary[summary_counter].opcode);
10943
10944
    /* Display summary info only for operations that are "most significant".
10945
       Controlled by a user option. */
10946
0
    if (current_tier == highest_tier || !display_major_nfs4_ops) {
10947
0
      if (current_tier == highest_tier) {
10948
0
        const char *main_opname = NULL;
10949
10950
        /* Display a filterable field of the most significant operations in all cases. */
10951
0
        main_opname = val_to_str_ext_const(main_opcode, &names_nfs4_operation_ext, "Unknown");
10952
0
        main_op_item = proto_tree_add_uint_format_value(tree, hf_nfs4_main_opcode, tvb, 0, 0,
10953
0
                    main_opcode, "%s (%u)", main_opname, main_opcode);
10954
0
        proto_item_set_generated(main_op_item);
10955
0
      }
10956
10957
0
      if (first_operation == 0)
10958
        /* Separator between operation text */
10959
0
        col_append_str(pinfo->cinfo, COL_INFO, " |");
10960
10961
0
      if (wmem_strbuf_get_len(op_summary[summary_counter].optext) > 0)
10962
0
        col_append_fstr(pinfo->cinfo, COL_INFO, " %s",
10963
0
          wmem_strbuf_get_str(op_summary[summary_counter].optext));
10964
10965
0
      first_operation = 0;
10966
0
    }
10967
0
  }
10968
10969
  /* Copy the information from the call info and store information about
10970
   * the operations here in private data.
10971
   */
10972
0
  rpc_call_info_value *tapdata = wmem_new0(pinfo->pool, rpc_call_info_value);
10973
0
  *tapdata = *civ;
10974
0
  nfs4_tap_data_t *ops_info = wmem_new0(pinfo->pool, nfs4_tap_data_t);
10975
0
  ops_info->op_summary = op_summary;
10976
0
  ops_info->ops_counter = ops_counter;
10977
0
  ops_info->highest_tier = highest_tier;
10978
0
  tapdata->private_data = ops_info;
10979
0
  tap_queue_packet(nfsv4_tap, pinfo, tapdata);
10980
10981
0
  return offset;
10982
0
}
10983
10984
10985
static int
10986
dissect_nfs4_compound_call(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
10987
0
{
10988
0
  const char *tag = NULL;
10989
0
  unsigned offset = 0;
10990
10991
0
  offset = dissect_nfs_utf8string(tvb, pinfo, offset, tree, hf_nfs4_tag, &tag);
10992
  /*
10993
   * Display the NFSv4 tag.  If it is empty, string generator will have returned "<EMPTY>",
10994
   * in which case don't display anything */
10995
0
  if (nfs_display_v4_tag && strncmp(tag, "<EMPTY>", 7) != 0)
10996
0
    col_append_fstr(pinfo->cinfo, COL_INFO, " %s", tag);
10997
10998
0
  offset = dissect_rpc_uint32(tvb, tree, hf_nfs4_minorversion, offset);
10999
0
  offset = dissect_nfs4_request_op(tvb, offset, pinfo, tree, (rpc_call_info_value*)data);
11000
11001
0
  return offset;
11002
0
}
11003
11004
11005
static int
11006
dissect_nfs4_secinfo_res(tvbuff_t *tvb, unsigned offset, packet_info *pinfo, proto_tree *tree, void *data _U_)
11007
0
{
11008
0
  unsigned flavor;
11009
0
  proto_item *fitem;
11010
0
  proto_tree *secftree;
11011
11012
0
  fitem = proto_tree_add_item_ret_uint(tree, hf_nfs4_secinfo_flavor, tvb, offset, 4,
11013
0
    ENC_BIG_ENDIAN, &flavor);
11014
0
  offset += 4;
11015
11016
0
  switch (flavor)
11017
0
  {
11018
0
    case RPCSEC_GSS:
11019
0
      secftree = proto_item_add_subtree(fitem, ett_nfs4_secinfo_flavor_info);
11020
0
      offset = dissect_nfs_rpcsec_gss_info(tvb, pinfo, offset, secftree);
11021
0
      break;
11022
11023
0
    default:
11024
0
      break;
11025
0
  }
11026
11027
0
  return offset;
11028
0
}
11029
11030
11031
static unsigned
11032
dissect_nfs4_offload_status_res(tvbuff_t *tvb, unsigned offset, proto_tree *tree)
11033
0
{
11034
0
  proto_item *sub_fitem;
11035
0
  proto_tree *ss_tree;
11036
0
  proto_tree *subtree;
11037
0
  proto_item *ss_fitem;
11038
0
  unsigned    i;
11039
0
  uint32_t      count;
11040
11041
  /* Number of osr_complete status */
11042
0
  sub_fitem = proto_tree_add_item_ret_uint(tree,
11043
0
      hf_nfs4_num_offload_status, tvb, offset, 4,
11044
0
      ENC_BIG_ENDIAN, &count);
11045
0
  offset += 4;
11046
11047
0
  subtree = proto_item_add_subtree(sub_fitem, ett_nfs4_osr_complete_sub);
11048
0
  for (i = 0; i < count; i++) {
11049
0
    ss_fitem = proto_tree_add_item(subtree,
11050
0
        hf_nfs4_offload_status_index,
11051
0
        tvb, offset, 4, ENC_BIG_ENDIAN);
11052
11053
0
    ss_tree = proto_item_add_subtree(ss_fitem,
11054
0
        ett_nfs4_osr_complete_sub);
11055
11056
0
    offset = dissect_rpc_uint32(tvb, ss_tree, hf_nfs4_status, offset);
11057
0
  }
11058
11059
0
  return offset;
11060
0
}
11061
11062
static unsigned
11063
dissect_nfs4_response_op(tvbuff_t *tvb, unsigned offset, packet_info *pinfo, proto_tree *tree, rpc_call_info_value *civ)
11064
0
{
11065
0
  unsigned      highest_tier    = 5;
11066
0
  unsigned      current_tier    = 5;
11067
0
  unsigned      first_operation = 1;
11068
0
  uint16_t      sid_hash      = 0;
11069
0
  uint32_t      last_fh_idx     = -1;
11070
0
  uint32_t      saved_fh_idx    = -1;
11071
0
  uint32_t      ops, ops_counter;
11072
0
  uint32_t      summary_counter;
11073
0
  uint32_t      opcode, status, nfstatus;
11074
0
  const char *opname;
11075
0
  proto_item *fitem, *ti;
11076
0
  proto_tree *ftree     = NULL;
11077
0
  proto_tree *newftree      = NULL;
11078
0
  nfs4_operation_summary *op_summary;
11079
11080
0
  ops = tvb_get_ntohl(tvb, offset+0);
11081
11082
0
  fitem = proto_tree_add_uint_format(tree, hf_nfs4_ops_count, tvb, offset+0, 4, ops,
11083
0
    "Operations (count: %u)", ops);
11084
0
  offset += 4;
11085
11086
0
  if (ops > MAX_NFSV4_OPS) {
11087
0
    expert_add_info(pinfo, fitem, &ei_nfs_too_many_ops);
11088
0
    ops = MAX_NFSV4_OPS;
11089
0
  }
11090
11091
0
  op_summary = wmem_alloc0_array(pinfo->pool, nfs4_operation_summary, ops);
11092
11093
0
  ftree = proto_item_add_subtree(fitem, ett_nfs4_response_op);
11094
11095
0
  proto_item_append_text(tree, ", Ops(%u):", ops);
11096
11097
0
  for (ops_counter = 0; ops_counter < ops; ops_counter++)
11098
0
  {
11099
0
    op_summary[ops_counter].optext = wmem_strbuf_new(pinfo->pool, "");
11100
0
    opcode = tvb_get_ntohl(tvb, offset);
11101
0
    op_summary[ops_counter].iserror = false;
11102
0
    op_summary[ops_counter].opcode = opcode;
11103
11104
    /* sanity check for bogus packets */
11105
0
    if ((opcode < NFS4_OP_ACCESS || opcode > NFS4_LAST_OP) &&
11106
0
      (opcode != NFS4_OP_ILLEGAL))
11107
0
      break;
11108
11109
0
    fitem = proto_tree_add_uint(ftree, hf_nfs4_op, tvb, offset, 4, opcode);
11110
11111
    /* all of the V4 ops are contiguous, except for NFS4_OP_ILLEGAL */
11112
0
    if (opcode == NFS4_OP_ILLEGAL) {
11113
0
      newftree = proto_item_add_subtree(fitem, ett_nfs4_illegal);
11114
0
    } else if (nfs4_operation_ett[opcode - 3]) {
11115
0
      newftree = proto_item_add_subtree(fitem, *nfs4_operation_ett[opcode - 3]);
11116
0
    } else {
11117
0
      break;
11118
0
    }
11119
11120
0
    opname = val_to_str_ext_const(opcode, &names_nfs4_operation_ext, "Unknown");
11121
0
    offset += 4;
11122
0
    wmem_strbuf_append_printf (op_summary[ops_counter].optext, "%s", opname);
11123
11124
0
    offset = dissect_nfs4_status(tvb, offset, newftree, &status);
11125
0
    if (status != NFS4_OK) {
11126
0
      proto_item_append_text(tree, " %s(%s)", opname,
11127
0
        val_to_str_ext(pinfo->pool, status, &names_nfs4_status_ext, "Unknown error: %u"));
11128
0
    } else {
11129
0
      proto_item_append_text(tree, " %s", opname);
11130
0
    }
11131
11132
    /*
11133
     * With the exception of NFS4_OP_LOCK, NFS4_OP_LOCKT,
11134
     * NFS4_OP_SETATTR, NFS4_OP_SETCLIENTID, and NFS4_OP_COPY, all other
11135
     * ops do *not* return data with the failed status code.
11136
     */
11137
0
    if (status != NFS4_OK
11138
0
    && opcode != NFS4_OP_LOCK
11139
0
    && opcode != NFS4_OP_LOCKT
11140
0
    && opcode != NFS4_OP_SETATTR
11141
0
    && opcode != NFS4_OP_SETCLIENTID
11142
0
    && opcode != NFS4_OP_COPY) {
11143
0
      op_summary[ops_counter].iserror = true;
11144
0
      continue;
11145
0
    }
11146
11147
    /* These parsing routines are only executed if the status is NFS4_OK */
11148
0
    switch (opcode)
11149
0
    {
11150
0
    case NFS4_OP_ACCESS:
11151
0
      offset = dissect_access_reply(tvb, offset, pinfo, fitem, 4, op_summary[ops_counter].optext, civ);
11152
0
      break;
11153
11154
0
    case NFS4_OP_CLOSE:
11155
0
      ti = proto_tree_add_item(newftree, hf_nfs4_stateid, tvb, offset, 16, ENC_NA);
11156
      /*
11157
       * RFC8881 18.2.4. CLOSE IMPLEMENTATION: The server SHOULD return the invalid special stateid
11158
       * (the "other" value is zero and the "seqid" field is NFS4_UINT32_MAX).
11159
       */
11160
0
      if (memcmp(tvb_get_ptr(tvb, offset, 16), "\xFF\xFF\xFF\xFF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 16) != 0)
11161
0
        expert_add_info(pinfo, ti, &ei_nfs4_stateid_deprecated);
11162
0
      offset += 16;
11163
0
      break;
11164
11165
0
    case NFS4_OP_COMMIT:
11166
0
      offset = dissect_rpc_uint64(tvb, newftree, hf_nfs4_verifier, offset);
11167
0
      break;
11168
11169
0
    case NFS4_OP_CREATE:
11170
0
      last_fh_idx = ops_counter;
11171
0
      offset = dissect_nfs4_change_info(tvb, offset, newftree, "change_info");
11172
0
      offset = dissect_nfs4_fattrs(tvb, offset, pinfo, newftree, FATTR4_BITMAP_ONLY, civ, opcode, last_fh_idx);
11173
0
      break;
11174
11175
0
    case NFS4_OP_GETATTR:
11176
0
      offset = dissect_nfs4_fattrs(tvb, offset, pinfo, newftree, FATTR4_DISSECT_VALUES, civ, opcode, last_fh_idx);
11177
0
      break;
11178
11179
0
    case NFS4_OP_GETFH:
11180
0
      offset = dissect_nfs4_fh(tvb, offset, pinfo, newftree, "Filehandle", NULL, NULL, NULL, civ, opcode, last_fh_idx);
11181
0
      break;
11182
11183
0
    case NFS4_OP_LINK:
11184
0
      offset = dissect_nfs4_change_info(tvb, offset, newftree, "change_info");
11185
0
      break;
11186
11187
0
    case NFS4_OP_LOOKUP:
11188
0
    case NFS4_OP_LOOKUPP:
11189
0
      last_fh_idx = ops_counter;
11190
0
      break;
11191
11192
0
    case NFS4_OP_LOCK:
11193
0
    case NFS4_OP_LOCKT:
11194
0
      if (status == NFS4_OK)
11195
0
      {
11196
0
        if (opcode == NFS4_OP_LOCK)
11197
0
          offset = dissect_nfs4_stateid(tvb, offset, newftree, NULL);
11198
0
      }
11199
0
      else
11200
0
      if (status == NFS4ERR_DENIED)
11201
0
        offset = dissect_nfs4_lockdenied(tvb, pinfo, offset, newftree);
11202
0
      break;
11203
11204
0
    case NFS4_OP_LOCKU:
11205
0
      offset = dissect_nfs4_stateid(tvb, offset, newftree, NULL);
11206
0
      break;
11207
11208
0
    case NFS4_OP_OPEN:
11209
0
      offset = dissect_nfs4_stateid(tvb, offset, newftree, &sid_hash);
11210
0
      offset = dissect_nfs4_change_info(tvb, offset, newftree,
11211
0
        "change_info");
11212
0
      offset = dissect_nfs4_open_rflags(tvb, offset, newftree);
11213
0
      offset = dissect_nfs4_fattrs(tvb, offset, pinfo, newftree, FATTR4_BITMAP_ONLY, civ, opcode, -1);
11214
0
      offset = dissect_nfs4_open_delegation(tvb, offset, pinfo, newftree);
11215
0
      wmem_strbuf_append_printf (op_summary[ops_counter].optext, " StateID: 0x%04x", sid_hash);
11216
0
      break;
11217
11218
0
    case NFS4_OP_OPEN_CONFIRM:
11219
0
    case NFS4_OP_OPEN_DOWNGRADE:
11220
0
      offset = dissect_nfs4_stateid(tvb, offset, newftree, NULL);
11221
0
      break;
11222
11223
0
    case NFS4_OP_PUTFH:
11224
0
    case NFS4_OP_PUTPUBFH:
11225
0
    case NFS4_OP_PUTROOTFH:
11226
0
      last_fh_idx = ops_counter;
11227
0
      break;
11228
11229
0
    case NFS4_OP_READ:
11230
0
      offset = dissect_rpc_uint32(tvb, newftree, hf_nfs4_eof, offset);
11231
0
      dissect_rpc_uint32(tvb, newftree, hf_nfs4_read_data_length, offset); /* don't change offset */
11232
0
      offset = dissect_nfsdata_reduced(R_NFSDATA, tvb, pinfo, offset, newftree, hf_nfs_data, NULL);
11233
0
      break;
11234
11235
0
    case NFS4_OP_READDIR:
11236
0
      offset = dissect_rpc_uint64(tvb, newftree, hf_nfs4_verifier, offset);
11237
0
      offset = dissect_nfs4_dirlist(tvb, offset, pinfo, newftree, civ, opcode, -1);
11238
0
      break;
11239
11240
0
    case NFS4_OP_READLINK:
11241
0
      offset = dissect_nfsdata_reduced(R_UTF8STRING, tvb, pinfo, offset, newftree, hf_nfs4_linktext, NULL);
11242
0
      break;
11243
11244
0
    case NFS4_OP_RECLAIM_COMPLETE:
11245
0
      break;
11246
11247
0
    case NFS4_OP_REMOVE:
11248
0
      offset = dissect_nfs4_change_info(tvb, offset, newftree, "change_info");
11249
0
      break;
11250
11251
0
    case NFS4_OP_RENAME:
11252
0
      offset = dissect_nfs4_change_info(tvb, offset, newftree, "source_cinfo");
11253
0
      offset = dissect_nfs4_change_info(tvb, offset, newftree, "target_cinfo");
11254
0
      break;
11255
11256
0
    case NFS4_OP_RESTOREFH:
11257
0
      last_fh_idx = saved_fh_idx;
11258
0
      break;
11259
11260
0
    case NFS4_OP_SAVEFH:
11261
0
      saved_fh_idx = last_fh_idx;
11262
0
      break;
11263
11264
0
    case NFS4_OP_SECINFO:
11265
0
    case NFS4_OP_SECINFO_NO_NAME:
11266
0
      offset = dissect_rpc_array(tvb, pinfo, newftree, offset,
11267
0
        dissect_nfs4_secinfo_res, hf_nfs4_secinfo_arr);
11268
0
      break;
11269
11270
0
    case NFS4_OP_SETATTR:
11271
0
      offset = dissect_nfs4_fattrs(tvb, offset, pinfo, newftree, FATTR4_BITMAP_ONLY, civ, opcode, -1);
11272
0
      break;
11273
11274
0
    case NFS4_OP_SETCLIENTID:
11275
0
      if (status == NFS4_OK) {
11276
0
        offset = dissect_rpc_uint64(tvb, newftree, hf_nfs4_clientid,
11277
0
          offset);
11278
0
        offset = dissect_rpc_uint64(tvb, newftree, hf_nfs4_verifier,
11279
0
          offset);
11280
0
      } else if (status == NFS4ERR_CLID_INUSE)
11281
        /*
11282
         * XXX: below function actually assumes
11283
         * this is for a callback.  Fix:
11284
         */
11285
0
        offset = dissect_nfs4_clientaddr(tvb, pinfo, offset, newftree);
11286
0
      break;
11287
11288
0
    case NFS4_OP_WRITE:
11289
0
      offset = dissect_rpc_uint32(tvb, newftree, hf_nfs4_count, offset);
11290
0
      offset = dissect_nfs4_stable_how(tvb, pinfo, offset, newftree,  "committed");
11291
0
      offset = dissect_rpc_uint64(tvb, newftree, hf_nfs4_verifier, offset);
11292
0
      break;
11293
11294
      /* Minor Version 1 */
11295
0
    case NFS4_OP_BIND_CONN_TO_SESSION:
11296
0
      offset = dissect_nfs4_sessionid(tvb, offset, newftree);
11297
0
      offset = dissect_rpc_uint32(tvb, newftree, hf_nfs4_bctsr_dir, offset);
11298
0
      offset = dissect_rpc_bool(tvb, newftree, hf_nfs4_bctsr_use_conn_in_rdma_mode, offset);
11299
0
      break;
11300
11301
0
    case NFS4_OP_EXCHANGE_ID: {
11302
0
        proto_tree *eir_server_owner_tree = NULL;
11303
11304
0
        offset = dissect_rpc_uint64(tvb, newftree, hf_nfs4_clientid, offset);
11305
0
        offset = dissect_rpc_uint32(tvb, newftree, hf_nfs4_seqid, offset);
11306
11307
0
        proto_tree_add_bitmask(newftree, tvb, offset, hf_nfs4_exchid_reply_flags, ett_nfs4_exchangeid_reply_flags, nfs4_exchid_flags, ENC_BIG_ENDIAN);
11308
0
        offset += 4;
11309
11310
0
        offset = dissect_nfs4_state_protect_r(tvb, offset, pinfo, newftree);
11311
11312
0
        eir_server_owner_tree = proto_tree_add_subtree(newftree, tvb, offset, 0, ett_nfs4_server_owner, NULL, "eir_server_owner");
11313
0
        offset = dissect_rpc_serverowner4(tvb, pinfo, offset, eir_server_owner_tree);
11314
0
        offset = dissect_nfsdata(tvb, pinfo, offset, newftree, hf_nfs4_serverscope4);
11315
0
        offset = dissect_rpc_nfs_impl_id4(tvb, pinfo, offset, newftree, "eir_server_impl_id");
11316
0
      }
11317
0
      break;
11318
0
    case NFS4_OP_CREATE_SESSION:
11319
0
      offset = dissect_nfs4_sessionid(tvb, offset, newftree);
11320
0
      offset = dissect_rpc_uint32(tvb, newftree,
11321
0
          hf_nfs4_seqid, offset);
11322
0
      offset = dissect_nfs_create_session_flags(tvb, offset, newftree,
11323
0
        hf_nfs4_create_session_flags_csr);
11324
0
      offset = dissect_rpc_chanattrs4(tvb, offset, newftree, "csr_fore_chan_attrs");
11325
0
      offset = dissect_rpc_chanattrs4(tvb, offset, newftree, "csr_back_chan_attrs");
11326
0
      break;
11327
11328
0
    case NFS4_OP_DESTROY_SESSION:
11329
0
      break;
11330
0
    case NFS4_OP_FREE_STATEID:
11331
0
      break;
11332
0
    case NFS4_OP_TEST_STATEID:
11333
0
      offset = dissect_rpc_array(tvb, pinfo, newftree, offset, dissect_nfs4_test_stateid_res, hf_nfs4_test_stateid_res);
11334
0
      break;
11335
11336
0
    case NFS4_OP_GET_DIR_DELEGATION:
11337
0
      nfstatus = tvb_get_ntohl(tvb, offset);
11338
0
      offset = dissect_rpc_uint32(tvb, newftree, hf_nfs4_gdd_non_fatal_status, offset);
11339
0
      if (nfstatus == GDD4_OK) {
11340
0
        offset = dissect_rpc_uint64(tvb, newftree, hf_nfs4_verifier, offset);
11341
0
        offset = dissect_nfs4_stateid(tvb, offset, newftree, &sid_hash);
11342
0
        offset = dissect_nfs4_notify_type4_bitmap(tvb, newftree, pinfo, offset, opcode, -1);
11343
0
        offset = dissect_nfs4_gdd_fattrs(tvb, offset, pinfo, newftree,
11344
0
               FATTR4_BITMAP_ONLY, civ, hf_nfs4_gdd_child_attrs, opcode, -1);
11345
0
        offset = dissect_nfs4_gdd_fattrs(tvb, offset, pinfo, newftree,
11346
0
               FATTR4_BITMAP_ONLY, civ, hf_nfs4_gdd_dir_attrs, opcode, -1);
11347
0
      } else if (nfstatus == GDD4_UNAVAIL) {
11348
0
        offset = dissect_rpc_uint32(tvb, newftree, hf_nfs4_gdd_signal_deleg_avail, offset);
11349
0
      }
11350
0
      break;
11351
11352
0
    case NFS4_OP_LAYOUTGET:
11353
0
      offset = dissect_rpc_bool(tvb, newftree, hf_nfs4_return_on_close,
11354
0
                    offset);
11355
0
      offset = dissect_nfs4_stateid(tvb, offset, newftree, NULL);
11356
0
      offset = dissect_nfs4_layoutget(tvb, offset, pinfo, newftree, civ);
11357
0
      break;
11358
11359
0
    case NFS4_OP_LAYOUTCOMMIT:
11360
0
      offset = dissect_nfs4_newsize(tvb, offset, newftree);
11361
0
      break;
11362
11363
0
    case NFS4_OP_LAYOUTRETURN:
11364
0
      offset = dissect_nfs_layoutreturn_stateid(tvb, newftree, offset);
11365
0
      break;
11366
11367
0
    case NFS4_OP_GETDEVINFO:
11368
0
      offset = dissect_nfs4_deviceaddr(tvb, pinfo, offset, newftree);
11369
0
      offset = dissect_nfs4_notify_deviceid_bitmap(tvb, newftree, pinfo, offset);
11370
0
      break;
11371
11372
0
    case NFS4_OP_GETDEVLIST:
11373
0
      offset = dissect_rpc_uint64(tvb, newftree, hf_nfs4_cookie, offset);
11374
0
      offset = dissect_rpc_uint64(tvb, newftree, hf_nfs4_cookie_verf, offset);
11375
0
      offset = dissect_nfs4_devicelist(tvb, offset, newftree);
11376
0
      offset = dissect_rpc_uint32(tvb, newftree, hf_nfs4_eof, offset);
11377
0
      break;
11378
11379
0
    case NFS4_OP_SEQUENCE:
11380
0
      {
11381
0
      static int * const sequence_flags[] = {
11382
0
        &hf_nfs4_sequence_status_flags_cb_path_down,
11383
0
        &hf_nfs4_sequence_status_flags_cb_gss_contexts_expiring,
11384
0
        &hf_nfs4_sequence_status_flags_cb_gss_contexts_expired,
11385
0
        &hf_nfs4_sequence_status_flags_expired_all_state_revoked,
11386
0
        &hf_nfs4_sequence_status_flags_expired_some_state_revoked,
11387
0
        &hf_nfs4_sequence_status_flags_admin_state_revoked,
11388
0
        &hf_nfs4_sequence_status_flags_recallable_state_revoked,
11389
0
        &hf_nfs4_sequence_status_flags_lease_moved,
11390
0
        &hf_nfs4_sequence_status_flags_restart_reclaim_needed,
11391
0
        &hf_nfs4_sequence_status_flags_cb_path_down_session,
11392
0
        &hf_nfs4_sequence_status_flags_backchannel_fault,
11393
0
        &hf_nfs4_sequence_status_flags_devid_changed,
11394
0
        &hf_nfs4_sequence_status_flags_devid_deleted,
11395
0
        NULL
11396
0
      };
11397
11398
0
      offset = dissect_nfs4_sessionid(tvb, offset, newftree);
11399
0
      offset = dissect_rpc_uint32(tvb, newftree, hf_nfs4_seqid, offset);
11400
0
      offset = dissect_rpc_uint32(tvb, newftree, hf_nfs4_slotid, offset);
11401
0
      offset = dissect_rpc_uint32(tvb, newftree, hf_nfs4_high_slotid, offset);
11402
0
      offset = dissect_rpc_uint32(tvb, newftree, hf_nfs4_target_high_slotid, offset);
11403
0
      proto_tree_add_bitmask(newftree, tvb, offset, hf_nfs4_sequence_status_flags, ett_nfs4_sequence_status_flags, sequence_flags, ENC_BIG_ENDIAN);
11404
0
      offset += 4;
11405
0
      }
11406
0
      break;
11407
11408
0
    case NFS4_OP_ALLOCATE:
11409
0
      break;
11410
11411
0
    case NFS4_OP_COPY:
11412
11413
0
      if (status == NFS4_OK) {
11414
0
        offset = dissect_nfs4_write_response(tvb, pinfo, offset, newftree);
11415
0
        offset = dissect_nfs4_copy_reqs(tvb, offset, newftree);
11416
0
      } else if (status == NFS4ERR_OFFLOAD_NO_REQS)
11417
0
        offset = dissect_nfs4_copy_reqs(tvb, offset, newftree);
11418
11419
0
      break;
11420
11421
0
    case NFS4_OP_COPY_NOTIFY:
11422
11423
0
      offset = dissect_nfs4_nfstime(tvb, offset, newftree);
11424
0
      offset = dissect_nfs4_stateid(tvb, offset, newftree, NULL);
11425
0
      offset = dissect_nfs4_source_servers(tvb, pinfo, offset, newftree);
11426
11427
0
      break;
11428
11429
0
    case NFS4_OP_DEALLOCATE:
11430
0
      break;
11431
11432
0
    case NFS4_OP_OFFLOAD_CANCEL:
11433
0
      break;
11434
11435
0
    case NFS4_OP_IO_ADVISE:
11436
0
      offset = dissect_nfs4_io_hints(tvb, offset, pinfo, newftree);
11437
0
      break;
11438
11439
0
    case NFS4_OP_OFFLOAD_STATUS:
11440
0
      offset = dissect_rpc_uint64(tvb, newftree, hf_nfs4_length, offset);
11441
0
      offset = dissect_nfs4_offload_status_res(tvb, offset, newftree);
11442
0
      break;
11443
11444
0
    case NFS4_OP_READ_PLUS:
11445
0
      if (status == NFS4_OK) {
11446
0
        offset = dissect_rpc_uint32(tvb, newftree, hf_nfs4_eof, offset);
11447
0
        offset = dissect_rpc_array(tvb, pinfo, newftree, offset, dissect_nfs4_read_plus_content, hf_nfs4_read_plus_contents);
11448
0
      }
11449
0
      break;
11450
11451
0
    case NFS4_OP_LAYOUTERROR:
11452
0
      break;
11453
11454
0
    case NFS4_OP_LAYOUTSTATS:
11455
0
      break;
11456
11457
0
    case NFS4_OP_SEEK:
11458
0
      offset = dissect_rpc_uint32(tvb, newftree, hf_nfs4_eof, offset);
11459
0
      offset = dissect_rpc_uint64(tvb, newftree, hf_nfs4_offset, offset);
11460
0
      break;
11461
11462
0
    case NFS4_OP_WRITE_SAME:
11463
0
      if (status == NFS4_OK) {
11464
0
        offset = dissect_nfs4_write_response(tvb, pinfo, offset, newftree);
11465
0
      }
11466
0
      break;
11467
11468
0
    case NFS4_OP_CLONE:
11469
0
      break;
11470
11471
0
    case NFS4_OP_GETXATTR:
11472
0
      if (status == NFS4_OK) {
11473
0
        offset = dissect_nfsdata(tvb, pinfo, offset, newftree, hf_nfs_data);
11474
0
      }
11475
0
      break;
11476
11477
0
    case NFS4_OP_SETXATTR:
11478
0
      if (status == NFS4_OK) {
11479
0
        offset = dissect_nfs4_change_info(tvb, offset, newftree, "cinfo");
11480
0
      }
11481
0
      break;
11482
11483
0
    case NFS4_OP_LISTXATTRS:
11484
0
      if (status == NFS4_OK) {
11485
0
        offset = dissect_rpc_uint64(tvb, newftree, hf_nfs4_listxattr_cookie, offset);
11486
0
        offset = dissect_nfs4_listxattr_names(tvb, pinfo, offset, newftree);
11487
0
        offset = dissect_rpc_uint32(tvb, newftree, hf_nfs4_listxattr_eof, offset);
11488
0
      }
11489
0
      break;
11490
11491
0
    case NFS4_OP_REMOVEXATTR:
11492
0
      if (status == NFS4_OK) {
11493
0
        offset = dissect_nfs4_change_info(tvb, offset, newftree, "cinfo");
11494
0
      }
11495
0
      break;
11496
11497
0
    default:
11498
0
      break;
11499
0
    }
11500
0
  }
11501
11502
  /* Detect which tiers are present in this packet */
11503
0
  for (summary_counter = 0; summary_counter < ops_counter; summary_counter++)
11504
0
  {
11505
0
    current_tier = NFS4_OPERATION_TIER(op_summary[summary_counter].opcode);
11506
0
    if (current_tier < highest_tier)
11507
0
      highest_tier = current_tier;
11508
0
  }
11509
11510
  /* Display packet summary */
11511
0
  for (summary_counter = 0; summary_counter < ops_counter; summary_counter++)
11512
0
  {
11513
0
    unsigned main_opcode;
11514
0
    proto_item *main_op_item = NULL;
11515
11516
0
    main_opcode = op_summary[summary_counter].opcode;
11517
0
    current_tier = NFS4_OPERATION_TIER(op_summary[summary_counter].opcode);
11518
11519
    /* Display summary info only for operations that are "most significant".
11520
     Controlled by a user option.
11521
     Display summary info for operations that return an error as well.  */
11522
0
    if (current_tier == highest_tier
11523
0
    || !display_major_nfs4_ops
11524
0
    || op_summary[summary_counter].iserror == true)
11525
0
    {
11526
0
      if (current_tier == highest_tier) {
11527
0
        const char *main_opname = NULL;
11528
11529
        /* Display a filterable field of the most significant operations in all cases. */
11530
0
        main_opname = val_to_str_ext_const(main_opcode, &names_nfs4_operation_ext, "Unknown");
11531
0
        main_op_item = proto_tree_add_uint_format_value(tree, hf_nfs4_main_opcode, tvb, 0, 0,
11532
0
                  main_opcode, "%s (%u)", main_opname, main_opcode);
11533
0
        proto_item_set_generated(main_op_item);
11534
0
      }
11535
11536
0
      if (first_operation == 0)
11537
        /* Separator between operation text */
11538
0
        col_append_str(pinfo->cinfo, COL_INFO, " |");
11539
11540
0
      if (wmem_strbuf_get_len(op_summary[summary_counter].optext) > 0)
11541
0
        col_append_fstr(pinfo->cinfo, COL_INFO, " %s",
11542
0
          wmem_strbuf_get_str(op_summary[summary_counter].optext));
11543
0
      first_operation = 0;
11544
0
    }
11545
0
  }
11546
11547
  /* Copy the information from the call info and store information about
11548
   * the operations here in private data.
11549
   */
11550
0
  rpc_call_info_value *tapdata = wmem_new0(pinfo->pool, rpc_call_info_value);
11551
0
  *tapdata = *civ;
11552
0
  nfs4_tap_data_t *ops_info = wmem_new0(pinfo->pool, nfs4_tap_data_t);
11553
0
  ops_info->op_summary = op_summary;
11554
0
  ops_info->ops_counter = ops_counter;
11555
0
  ops_info->highest_tier = highest_tier;
11556
0
  tapdata->private_data = ops_info;
11557
0
  tap_queue_packet(nfsv4_tap, pinfo, tapdata);
11558
11559
0
  return offset;
11560
0
}
11561
11562
11563
static int
11564
dissect_nfs4_compound_reply(tvbuff_t *tvb, packet_info *pinfo,  proto_tree *tree, void *data)
11565
0
{
11566
0
  uint32_t      status;
11567
0
  const char *tag = NULL;
11568
0
  unsigned offset = 0;
11569
11570
0
  offset = dissect_nfs4_status(tvb, offset, tree, &status);
11571
0
  offset = dissect_nfs_utf8string(tvb, pinfo, offset, tree, hf_nfs4_tag, &tag);
11572
  /*
11573
  * Display the NFSv4 tag. If it is empty, string generator will have returned "<EMPTY>", in
11574
  * which case don't display anything */
11575
0
  if (nfs_display_v4_tag && strncmp(tag, "<EMPTY>", 7) != 0)
11576
0
    col_append_fstr(pinfo->cinfo, COL_INFO, " %s", tag);
11577
11578
0
  offset = dissect_nfs4_response_op(tvb, offset, pinfo, tree, (rpc_call_info_value*)data);
11579
11580
0
  if (status != NFS4_OK)
11581
0
    col_append_fstr(pinfo->cinfo, COL_INFO, " Status: %s",
11582
0
        val_to_str_ext(pinfo->pool, status, &names_nfs4_status_ext, "Unknown error: %u"));
11583
11584
0
  return offset;
11585
0
}
11586
11587
11588
/* proc number, "proc name", dissect_request, dissect_reply */
11589
static const vsff nfs3_proc[] = {
11590
  { 0,  "NULL",   /* OK */
11591
  dissect_nfs3_null_call,   dissect_nfs3_null_reply },
11592
  { 1,  "GETATTR",  /* OK */
11593
  dissect_nfs3_getattr_call,  dissect_nfs3_getattr_reply },
11594
  { 2,  "SETATTR",  /* OK */
11595
  dissect_nfs3_setattr_call,  dissect_nfs3_setattr_reply },
11596
  { 3,  "LOOKUP", /* OK */
11597
  dissect_nfs3_lookup_call, dissect_nfs3_lookup_reply },
11598
  { 4,  "ACCESS", /* OK */
11599
  dissect_nfs3_access_call, dissect_nfs3_access_reply },
11600
  { 5,  "READLINK", /* OK */
11601
  dissect_nfs3_readlink_call, dissect_nfs3_readlink_reply },
11602
  { 6,  "READ",   /* OK */
11603
  dissect_nfs3_read_call,   dissect_nfs3_read_reply },
11604
  { 7,  "WRITE",  /* OK */
11605
  dissect_nfs3_write_call,  dissect_nfs3_write_reply },
11606
  { 8,  "CREATE", /* OK */
11607
  dissect_nfs3_create_call, dissect_nfs3_create_reply },
11608
  { 9,  "MKDIR",  /* OK */
11609
  dissect_nfs3_mkdir_call,  dissect_nfs3_mkdir_reply },
11610
  { 10, "SYMLINK",  /* OK */
11611
  dissect_nfs3_symlink_call,  dissect_nfs3_symlink_reply },
11612
  { 11, "MKNOD",  /* OK */
11613
  dissect_nfs3_mknod_call,  dissect_nfs3_mknod_reply },
11614
  { 12, "REMOVE", /* OK */
11615
  dissect_nfs3_remove_call, dissect_nfs3_remove_reply },
11616
  { 13, "RMDIR",  /* OK */
11617
  dissect_nfs3_rmdir_call,  dissect_nfs3_rmdir_reply },
11618
  { 14, "RENAME", /* OK */
11619
  dissect_nfs3_rename_call, dissect_nfs3_rename_reply },
11620
  { 15, "LINK",   /* OK */
11621
  dissect_nfs3_link_call,   dissect_nfs3_link_reply },
11622
  { 16, "READDIR",  /* OK */
11623
  dissect_nfs3_readdir_call,  dissect_nfs3_readdir_reply },
11624
  { 17, "READDIRPLUS",  /* OK */
11625
  dissect_nfs3_readdirplus_call,  dissect_nfs3_readdirplus_reply },
11626
  { 18, "FSSTAT", /* OK */
11627
  dissect_nfs3_fsstat_call, dissect_nfs3_fsstat_reply },
11628
  { 19, "FSINFO", /* OK */
11629
  dissect_nfs3_fsinfo_call, dissect_nfs3_fsinfo_reply },
11630
  { 20, "PATHCONF", /* OK */
11631
  dissect_nfs3_pathconf_call, dissect_nfs3_pathconf_reply },
11632
  { 21, "COMMIT", /* OK */
11633
  dissect_nfs3_commit_call, dissect_nfs3_commit_reply },
11634
  { 0,  NULL, NULL, NULL }
11635
};
11636
11637
static const value_string nfs3_proc_vals[] = {
11638
  { 0,  "NULL" },
11639
  { 1,  "GETATTR" },
11640
  { 2,  "SETATTR" },
11641
  { 3,  "LOOKUP" },
11642
  { 4,  "ACCESS" },
11643
  { 5,  "READLINK" },
11644
  { 6,  "READ" },
11645
  { 7,  "WRITE" },
11646
  { 8,  "CREATE" },
11647
  { 9,  "MKDIR" },
11648
  { 10, "SYMLINK" },
11649
  { 11, "MKNOD" },
11650
  { 12, "REMOVE" },
11651
  { 13, "RMDIR" },
11652
  { 14, "RENAME" },
11653
  { 15, "LINK" },
11654
  { 16, "READDIR" },
11655
  { 17, "READDIRPLUS" },
11656
  { 18, "FSSTAT" },
11657
  { 19, "FSINFO" },
11658
  { 20, "PATHCONF" },
11659
  { 21, "COMMIT" },
11660
  { 0,  NULL }
11661
};
11662
static value_string_ext nfs3_proc_vals_ext = VALUE_STRING_EXT_INIT(nfs3_proc_vals);
11663
11664
/* End of NFS Version 3 */
11665
11666
11667
/* the call to dissect_nfs3_null_call & dissect_nfs3_null_reply is
11668
 * intentional.  The V4 NULLPROC is the same as V3.
11669
 */
11670
static const vsff nfs4_proc[] = {
11671
  { 0, "NULL",
11672
  dissect_nfs3_null_call,   dissect_nfs3_null_reply },
11673
  { 1, "COMPOUND",
11674
  dissect_nfs4_compound_call, dissect_nfs4_compound_reply },
11675
  { 0, NULL, NULL, NULL }
11676
};
11677
11678
static const value_string nfs4_proc_vals[] = {
11679
  { 0, "NULL" },
11680
  { 1, "COMPOUND" },
11681
  { 0, NULL }
11682
};
11683
11684
static const rpc_prog_vers_info nfs_vers_info[] = {
11685
  { 2, nfs2_proc, &hf_nfs2_procedure },
11686
  { 3, nfs3_proc, &hf_nfs3_procedure },
11687
  { 4, nfs4_proc, &hf_nfs4_procedure },
11688
};
11689
11690
/*
11691
 * Union of the NFSv2, NFSv3, and NFSv4 status codes.
11692
 * Used for the "nfs.status" hidden field and in packet-nfsacl.c.
11693
 */
11694
static const value_string names_nfs_nfsstat[] = {
11695
  {    0,  "OK"            },
11696
  {    1,  "ERR_PERM"          },
11697
  {    2,  "ERR_NOENT"           },
11698
  {    5,  "ERR_IO"          },
11699
  {    6,  "ERR_NXIO"          },
11700
  {    11, "ERR_EAGAIN"          },
11701
  {    13, "ERR_ACCESS"          },
11702
  {    17, "ERR_EXIST"           },
11703
  {    18, "ERR_XDEV"          },
11704
  {    19, "ERR_NODEV"           },
11705
  {    20, "ERR_NOTDIR"          },
11706
  {    21, "ERR_ISDIR"           },
11707
  {    22, "ERR_INVAL"           },
11708
  {    26, "ERR_TXTBSY"          },
11709
  {    27, "ERR_FBIG"          },
11710
  {    28, "ERR_NOSPC"           },
11711
  {    30, "ERR_ROFS"          },
11712
  {    31, "ERR_MLINK"           },
11713
  {    45, "ERR_OPNOTSUPP"         },
11714
  {    63, "ERR_NAMETOOLONG"         },
11715
  {    66, "ERR_NOTEMPTY"          },
11716
  {    69, "ERR_DQUOT"           },
11717
  {    70, "ERR_STALE"           },
11718
  {    71, "ERR_REMOTE"          },
11719
  {    99, "ERR_WFLUSH"          },
11720
  { 10001, "ERR_BADHANDLE"         },
11721
  { 10002, "ERR_NOT_SYNC"          },
11722
  { 10003, "ERR_BAD_COOKIE"        },
11723
  { 10004, "ERR_NOTSUPP"           },
11724
  { 10005, "ERR_TOOSMALL"          },
11725
  { 10006, "ERR_SERVERFAULT"         },
11726
  { 10007, "ERR_BADTYPE"           },
11727
  { 10008, "ERR_DELAY"           },
11728
  { 10009, "ERR_SAME"          },
11729
  { 10010, "ERR_DENIED"          },
11730
  { 10011, "ERR_EXPIRED"           },
11731
  { 10012, "ERR_LOCKED"          },
11732
  { 10013, "ERR_GRACE"           },
11733
  { 10014, "ERR_FHEXPIRED"         },
11734
  { 10015, "ERR_SHARE_DENIED"        },
11735
  { 10016, "ERR_WRONGSEC"          },
11736
  { 10017, "ERR_CLID_INUSE"        },
11737
  { 10018, "ERR_RESOURCE"          },
11738
  { 10019, "ERR_MOVED"           },
11739
  { 10020, "ERR_NOFILEHANDLE"        },
11740
  { 10021, "ERR_MINOR_VERS_MISMATCH"       },
11741
  { 10022, "ERR_STALE_CLIENTID"        },
11742
  { 10023, "ERR_STALE_STATEID"         },
11743
  { 10024, "ERR_OLD_STATEID"         },
11744
  { 10025, "ERR_BAD_STATEID"         },
11745
  { 10026, "ERR_BAD_SEQID"         },
11746
  { 10027, "ERR_NOT_SAME"          },
11747
  { 10028, "ERR_LOCK_RANGE"        },
11748
  { 10029, "ERR_SYMLINK"           },
11749
  { 10030, "ERR_READDIR_NOSPC"         },
11750
  { 10031, "ERR_LEASE_MOVED"         },
11751
  { 10032, "ERR_ATTRNOTSUPP"         },
11752
  { 10033, "ERR_NO_GRACE"          },
11753
  { 10034, "ERR_RECLAIM_BAD"         },
11754
  { 10035, "ERR_RECLAIM_CONFLICT"        },
11755
  { 10036, "ERR_BADXDR"          },
11756
  { 10037, "ERR_LOCKS_HELD"        },
11757
  { 10038, "ERR_OPENMODE"          },
11758
  { 10039, "ERR_BADOWNER"          },
11759
  { 10040, "ERR_BADCHAR"           },
11760
  { 10041, "ERR_BADNAME"           },
11761
  { 10042, "ERR_BAD_RANGE"         },
11762
  { 10043, "ERR_LOCK_NOTSUPP"        },
11763
  { 10044, "ERR_OP_ILLEGAL"        },
11764
  { 10045, "ERR_DEADLOCK"          },
11765
  { 10046, "ERR_FILE_OPEN"         },
11766
  { 10047, "ERR_ADMIN_REVOKED"         },
11767
  { 10048, "ERR_CB_PATH_DOWN"        },
11768
  { 10049, "ERR_REPLAY_ME_or_BADIOMODE"      },
11769
  { 10050, "ERR_BADLAYOUT"         },
11770
  { 10051, "ERR_BAD_SESSION_DIGEST"      },
11771
  { 10052, "ERR_BADSESSION"        },
11772
  { 10053, "ERR_BADSLOT"           },
11773
  { 10054, "ERR_COMPLETE_ALREADY"        },
11774
  { 10055, "ERR_CONN_NOT_BOUND_TO_SESSION"     },
11775
  { 10056, "ERR_DELEG_ALREADY_WANTED"      },
11776
  { 10057, "ERR_BACK_CHAN_BUSY"        },
11777
  { 10058, "ERR_LAYOUTTRYLATER"        },
11778
  { 10059, "ERR_LAYOUTUNAVAILABLE"       },
11779
  { 10060, "ERR_NOMATCHING_LAYOUT"       },
11780
  { 10061, "ERR_RECALLCONFLICT"        },
11781
  { 10062, "ERR_UNKNOWN_LAYOUTTYPE"      },
11782
  { 10063, "ERR_SEQ_MISORDERED"        },
11783
  { 10064, "ERR_SEQUENCE_POS"        },
11784
  { 10065, "ERR_REQ_TOO_BIG"         },
11785
  { 10066, "ERR_REP_TOO_BIG"         },
11786
  { 10067, "ERR_REP_TOO_BIG_TO_CACHE"      },
11787
  { 10068, "ERR_RETRY_UNCACHED_REP"      },
11788
  { 10069, "ERR_UNSAFE_COMPOUND"         },
11789
  { 10070, "ERR_TOO_MANY_OPS"        },
11790
  { 10071, "ERR_OP_NOT_IN_SESSION"       },
11791
  { 10072, "ERR_HASH_ALG_UNSUPP"         },
11792
  { 10073, "NFS4ERR_CONN_BINDING_NOT_ENFORCED" },
11793
  { 10074, "ERR_CLIENTID_BUSY"         },
11794
  { 10075, "ERR_PNFS_IO_HOLE"        },
11795
  { 10076, "ERR_SEQ_FALSE_RETRY"         },
11796
  { 10077, "ERR_BAD_HIGH_SLOT"         },
11797
  { 10078, "ERR_DEADSESSION"         },
11798
  { 10079, "ERR_ENCR_ALG_UNSUPP"         },
11799
  { 10080, "ERR_PNFS_NO_LAYOUT"        },
11800
  { 10081, "ERR_NOT_ONLY_OP"         },
11801
  { 10082, "ERR_WRONG_CRED"        },
11802
  { 10083, "ERR_WRONG_TYPE"        },
11803
  { 10084, "ERR_DIRDELEG_UNAVAIL"        },
11804
  { 10085, "ERR_REJECT_DELEG"        },
11805
  { 10086, "ERR_RETURNCONFLICT"        },
11806
  { 10087, "ERR_DELEG_REVOKED"         },
11807
  { 10088, "ERR_PARTNER_NOTSUPP"         },
11808
  { 10089, "ERR_PARTNER_NO_AUTH"         },
11809
  { 10090, "ERR_UNION_NOTSUPP"         },
11810
  { 10091, "ERR_OFFLOAD_DENIED"        },
11811
  { 10092, "ERR_WRONG_LFS"         },
11812
  { 10093, "ERR_BADLABEL"          },
11813
  { 10094, "ERR_OFFLOAD_NO_REQS"         },
11814
  { 0,  NULL }
11815
};
11816
static value_string_ext names_nfs_nfsstat_ext = VALUE_STRING_EXT_INIT(names_nfs_nfsstat);
11817
11818
static const value_string iomode_names[] = {
11819
  { 1, "IOMODE_READ" },
11820
  { 2, "IOMODE_RW"   },
11821
  { 3, "IOMODE_ANY"  },
11822
  { 0, NULL }
11823
};
11824
11825
#if 0
11826
static const value_string stripetype_names[] = {
11827
  { 1, "STRIPE_SPARSE" },
11828
  { 2, "STRIPE_DENSE"  },
11829
  { 0, NULL }
11830
};
11831
#endif
11832
11833
static const value_string netloctype_names[] = {
11834
  { NL4_NAME, "NL4_NAME" },
11835
  { NL4_URL, "NL4_URL"  },
11836
  { NL4_NETADDR, "NL4_NETADDR"  },
11837
  { 0, NULL }
11838
};
11839
11840
static const value_string layouttype_names[] = {
11841
  { 1, "LAYOUT4_NFSV4_1_FILES" },
11842
  { 2, "LAYOUT4_OSD2_OBJECTS"  },
11843
  { 3, "LAYOUT4_BLOCK_VOLUME"  },
11844
  { 4, "LAYOUT4_FLEX_FILES"  },
11845
  { 5, "LAYOUT4_SCSI"  },
11846
  { 0, NULL }
11847
};
11848
11849
static const value_string layoutreturn_names[] = {
11850
  { 1, "RETURN_FILE" },
11851
  { 2, "RETURN_FSID" },
11852
  { 3, "RETURN_ALL"  },
11853
  { 0, NULL }
11854
};
11855
11856
static const value_string gdd_non_fatal_status_names[] = {
11857
  { 0,  "GDD4_OK"  },
11858
  { 1,  "GDD4_UNAVAIL"  },
11859
  { 0, NULL }
11860
};
11861
11862
static const value_string nfs_fh_obj_id[] = {
11863
  { 1, "NF4REG"      },
11864
  { 2, "NF4DIR"      },
11865
  { 3, "NF4BLK"      },
11866
  { 4, "NF4CHR"      },
11867
  { 5, "NF4LNK"      },
11868
  { 6, "NF4SOCK"     },
11869
  { 7, "NF4FIFO"     },
11870
  { 8, "NF4ATTRDIR"  },
11871
  { 9, "NF4NAMEDATTR"},
11872
  { 0, NULL }
11873
};
11874
11875
static const true_false_string nfs4_ro_boolean = {
11876
  "object is read only",
11877
  "object is *not* read-only"
11878
};
11879
11880
static const value_string layoutrecall_names[] = {
11881
  { 1, "RECALL_FILE" },
11882
  { 2, "RECALL_FSID" },
11883
  { 3, "RECALL_ALL"  },
11884
  { 0, NULL }
11885
};
11886
11887
/* NFS Callback */
11888
static int hf_nfs4_cb_procedure;
11889
static int hf_nfs4_cb_op;
11890
static int hf_nfs4_cb_truncate;
11891
static int hf_nfs4_cb_layoutrecall_type;
11892
static int hf_nfs4_cb_clorachanged;
11893
11894
static int ett_nfs4_cb_request_op;
11895
static int ett_nfs4_cb_resop;
11896
static int ett_nfs4_cb_getattr;
11897
static int ett_nfs4_cb_recall;
11898
static int ett_nfs4_cb_layoutrecall;
11899
static int ett_nfs4_cb_pushdeleg;
11900
static int ett_nfs4_cb_recallany;
11901
static int ett_nfs4_cb_recallableobjavail;
11902
static int ett_nfs4_cb_recallslot;
11903
static int ett_nfs4_cb_sequence;
11904
static int ett_nfs4_cb_wantscancelled;
11905
static int ett_nfs4_cb_notifylock;
11906
static int ett_nfs4_cb_notifydeviceid;
11907
static int ett_nfs4_cb_notify;
11908
static int ett_nfs4_cb_reflists;
11909
static int ett_nfs4_cb_refcalls;
11910
static int ett_nfs4_cb_illegal;
11911
11912
static const value_string names_nfs_cb_operation[] = {
11913
  { NFS4_OP_CB_GETATTR,      "CB_GETATTR" },
11914
  { NFS4_OP_CB_RECALL,       "CB_RECALL"  },
11915
  { NFS4_OP_CB_LAYOUTRECALL,     "CB_LAYOUTRECALL" },
11916
  { NFS4_OP_CB_NOTIFY,       "CB_NOTIFY" },
11917
  { NFS4_OP_CB_PUSH_DELEG,     "CB_PUSH_DELEG" },
11918
  { NFS4_OP_CB_RECALL_ANY,     "CB_RECALL_ANY" },
11919
  { NFS4_OP_CB_RECALLABLE_OBJ_AVAIL, "CB_RECALLABLE_OBJ_AVAIL" },
11920
  { NFS4_OP_CB_RECALL_SLOT,    "CB_RECALL_SLOT"},
11921
  { NFS4_OP_CB_SEQUENCE,       "CB_SEQUENCE" },
11922
  { NFS4_OP_CB_WANTS_CANCELLED,    "CB_WANTS_CANCELLED" },
11923
  { NFS4_OP_CB_NOTIFY_LOCK,    "CB_NOTIFY_LOCK" },
11924
  { NFS4_OP_CB_NOTIFY_DEVICEID,    "CB_NOTIFY_DEVICEID" },
11925
  { NFS4_OP_CB_OFFLOAD,      "CB_OFFLOAD" },
11926
  { NFS4_OP_CB_ILLEGAL,      "CB_ILLEGAL"},
11927
  { 0,  NULL }
11928
};
11929
static value_string_ext names_nfs_cb_operation_ext = VALUE_STRING_EXT_INIT(names_nfs_cb_operation);
11930
11931
static int *nfs4_cb_operation_ett[] =
11932
{
11933
  &ett_nfs4_cb_getattr,
11934
  &ett_nfs4_cb_recall,
11935
  &ett_nfs4_cb_layoutrecall,
11936
  &ett_nfs4_cb_notify,
11937
  &ett_nfs4_cb_pushdeleg,
11938
  &ett_nfs4_cb_recallany,
11939
  &ett_nfs4_cb_recallableobjavail,
11940
  &ett_nfs4_cb_recallslot,
11941
  &ett_nfs4_cb_sequence,
11942
  &ett_nfs4_cb_wantscancelled,
11943
  &ett_nfs4_cb_notifylock,
11944
  &ett_nfs4_cb_notifydeviceid,
11945
  &ett_nfs4_cb_illegal
11946
};
11947
11948
static unsigned
11949
dissect_nfs4_cb_referring_calls(tvbuff_t *tvb, unsigned offset, proto_tree *tree)
11950
0
{
11951
0
  unsigned      num_reflists, num_refcalls, i, j;
11952
0
  proto_tree *rl_tree, *rc_tree;
11953
11954
0
  num_reflists = tvb_get_ntohl(tvb, offset);
11955
0
  rl_tree = proto_tree_add_subtree_format(tree, tvb, offset, 4,
11956
0
      ett_nfs4_cb_reflists, NULL, "referring call lists (count: %u)", num_reflists);
11957
0
  offset += 4;
11958
11959
0
  for (i = 0; i < num_reflists; i++) {
11960
0
    offset = dissect_nfs4_sessionid(tvb, offset, rl_tree);
11961
0
    num_refcalls = tvb_get_ntohl(tvb, offset);
11962
0
    rc_tree = proto_tree_add_subtree_format(rl_tree, tvb, offset, 4,
11963
0
        ett_nfs4_cb_refcalls, NULL, "referring calls (count: %u)", num_refcalls);
11964
0
    offset += 4;
11965
0
    for (j = 0; j < num_refcalls; j++) {
11966
0
      offset = dissect_rpc_uint32(tvb, rc_tree, hf_nfs4_seqid, offset);
11967
0
      offset = dissect_rpc_uint32(tvb, rc_tree, hf_nfs4_slotid, offset);
11968
0
    }
11969
0
  }
11970
11971
0
  return offset;
11972
0
}
11973
11974
static unsigned
11975
dissect_nfs4_cb_layoutrecall(tvbuff_t *tvb, unsigned offset, proto_tree *tree, packet_info *pinfo, rpc_call_info_value *civ)
11976
0
{
11977
0
  unsigned recall_type;
11978
11979
0
  offset = dissect_rpc_uint32(tvb, tree, hf_nfs4_layout_type, offset);
11980
0
  offset = dissect_rpc_uint32(tvb, tree, hf_nfs4_iomode, offset);
11981
0
  offset = dissect_rpc_bool(tvb, tree, hf_nfs4_cb_clorachanged, offset);
11982
11983
0
  recall_type = tvb_get_ntohl(tvb, offset);
11984
0
  offset = dissect_rpc_uint32(tvb, tree, hf_nfs4_cb_layoutrecall_type, offset);
11985
11986
0
  if (recall_type == 1) { /* RECALL_FILE */
11987
0
    offset = dissect_nfs4_fh(tvb, offset, pinfo, tree, "FileHandle", NULL, NULL, NULL, civ, -1, -1);
11988
0
    offset = dissect_rpc_uint64(tvb, tree, hf_nfs4_offset, offset);
11989
0
    offset = dissect_rpc_uint64(tvb, tree, hf_nfs4_length, offset);
11990
0
    offset = dissect_nfs4_stateid(tvb, offset, tree, NULL);
11991
0
  } else if (recall_type == 2) { /* RECALL_FSID */
11992
0
    offset = dissect_nfs4_fsid(tvb, offset, tree, "fsid");
11993
0
  }
11994
11995
0
  return offset;
11996
0
}
11997
11998
0
#define BIT(__n)  (1 << __n)
11999
12000
static unsigned
12001
dissect_notify_entry4(tvbuff_t *tvb, unsigned offset, proto_tree *tree, packet_info *pinfo,
12002
          rpc_call_info_value *civ)
12003
0
{
12004
0
  offset = dissect_nfs_utf8string(tvb, pinfo, offset, tree, hf_nfs4_component, NULL);
12005
0
  return dissect_nfs4_fattrs(tvb, offset, pinfo, tree, FATTR4_DISSECT_VALUES, civ, -1, -1);
12006
0
}
12007
12008
static unsigned
12009
dissect_notify_remove4(tvbuff_t *tvb, unsigned offset, proto_tree *tree, packet_info *pinfo,
12010
           rpc_call_info_value *civ)
12011
0
{
12012
0
  offset = dissect_notify_entry4(tvb, offset, tree, pinfo, civ);
12013
0
  return dissect_rpc_uint64(tvb, tree, hf_nfs4_cookie, offset);
12014
0
}
12015
12016
static inline int
12017
dissect_prev_entry4(tvbuff_t *tvb, unsigned offset, proto_tree *tree, packet_info *pinfo,
12018
        rpc_call_info_value *civ)
12019
0
{
12020
0
  return dissect_notify_remove4(tvb, offset, tree, pinfo, civ);
12021
0
}
12022
12023
static unsigned
12024
dissect_notify_attr4(tvbuff_t *tvb, unsigned offset, proto_tree *tree, packet_info *pinfo,
12025
           rpc_call_info_value *civ)
12026
0
{
12027
0
  return dissect_notify_entry4(tvb, offset, tree, pinfo, civ);
12028
0
}
12029
12030
static unsigned
12031
dissect_notify_add4(tvbuff_t *tvb, unsigned offset, proto_tree *tree, packet_info *pinfo,
12032
           rpc_call_info_value *civ)
12033
0
{
12034
0
  uint32_t count;
12035
12036
  /* nad_old_entry */
12037
0
  count = tvb_get_ntohl(tvb, offset);
12038
0
  offset += 4;
12039
0
  if (count)
12040
0
    offset = dissect_notify_remove4(tvb, offset, tree, pinfo, civ);
12041
12042
  /* nad_new_entry */
12043
0
  offset = dissect_notify_entry4(tvb, offset, tree, pinfo, civ);
12044
12045
  /* nad_new_entry_cookie */
12046
0
  count = tvb_get_ntohl(tvb, offset);
12047
0
  offset += 4;
12048
0
  if (count)
12049
0
    offset = dissect_rpc_uint64(tvb, tree, hf_nfs4_cookie, offset);
12050
12051
  /* nad_prev_entry */
12052
0
  count = tvb_get_ntohl(tvb, offset);
12053
0
  offset += 4;
12054
0
  if (count)
12055
0
    offset = dissect_prev_entry4(tvb, offset, tree, pinfo, civ);
12056
12057
0
  return dissect_rpc_bool(tvb, tree, hf_nfs4_nad_last_entry, offset);
12058
0
}
12059
12060
static unsigned
12061
dissect_notify_rename4(tvbuff_t *tvb, unsigned offset, proto_tree *tree, packet_info *pinfo,
12062
           rpc_call_info_value *civ)
12063
0
{
12064
0
  offset = dissect_notify_remove4(tvb, offset, tree, pinfo, civ);
12065
0
  return dissect_notify_add4(tvb, offset, tree, pinfo, civ);
12066
0
}
12067
12068
static unsigned
12069
dissect_nfs4_cb_notify_args(tvbuff_t *tvb, unsigned offset, proto_tree *tree, packet_info *pinfo, rpc_call_info_value *civ)
12070
0
{
12071
0
  proto_tree *ctree;
12072
0
  uint32_t changes;
12073
0
  uint32_t i;
12074
12075
0
  offset = dissect_nfs4_stateid(tvb, offset, tree, NULL);
12076
0
  offset = dissect_nfs4_fh(tvb, offset, pinfo, tree, "FileHandle", NULL, NULL, NULL, civ, -1, -1);
12077
12078
0
  changes = tvb_get_ntohl(tvb, offset);
12079
0
  ctree = proto_tree_add_subtree_format(tree, tvb, offset, 4, ett_nfs4_cb_notify_changes,
12080
0
                NULL, "Changes (count: %u)", changes);
12081
0
  offset += 4;
12082
0
  for (i = 0; i < changes; ++i) {
12083
0
    uint32_t len, mask = 0;
12084
0
    proto_tree *ntree;
12085
12086
    /*
12087
     * Grab the first word of the bitmap. This will need to be modified if
12088
     * it ever spills into multiple words (unlikely).
12089
     */
12090
0
    len = tvb_get_ntohl(tvb, offset);
12091
0
    if (len)
12092
0
      mask = tvb_get_ntohl(tvb, offset + 4);
12093
0
    offset = dissect_nfs4_notify_type4_bitmap(tvb, ctree, pinfo, offset, -1, -1);
12094
12095
0
    len = tvb_get_ntohl(tvb, offset);
12096
0
    ntree = proto_tree_add_subtree_format(ctree, tvb, offset, 4,
12097
0
                  ett_nfs4_cb_notify_list_entries,
12098
0
                  NULL, "notify_vals (len: %u)", len);
12099
0
    offset += 4;
12100
12101
0
    if (mask & BIT(NOTIFY4_CHANGE_CHILD_ATTRS)) {
12102
0
      proto_tree *rtree;
12103
12104
0
      rtree = proto_tree_add_subtree(ntree, tvb, offset, 4,
12105
0
                   ett_nfs4_cb_notify_attr4_child,
12106
0
                   NULL, "Child Attr Change");
12107
0
      offset = dissect_notify_attr4(tvb, offset, rtree, pinfo, civ);
12108
0
    }
12109
0
    if (mask & BIT(NOTIFY4_CHANGE_DIR_ATTRS)) {
12110
0
      proto_tree *rtree;
12111
12112
0
      rtree = proto_tree_add_subtree(ntree, tvb, offset, 4,
12113
0
                   ett_nfs4_cb_notify_attr4_dir,
12114
0
                   NULL, "Dir Attr Change");
12115
0
      offset = dissect_notify_attr4(tvb, offset, rtree, pinfo, civ);
12116
0
    }
12117
0
    if (mask & BIT(NOTIFY4_REMOVE_ENTRY)) {
12118
0
      proto_tree *rtree;
12119
12120
0
      rtree = proto_tree_add_subtree(ntree, tvb, offset, 4,
12121
0
                   ett_nfs4_cb_notify_remove4,
12122
0
                   NULL, "Remove Entry");
12123
0
      offset = dissect_notify_remove4(tvb, offset, rtree, pinfo, civ);
12124
0
    }
12125
12126
0
    if (mask & BIT(NOTIFY4_ADD_ENTRY)) {
12127
0
      proto_tree *atree;
12128
12129
0
      atree = proto_tree_add_subtree(ntree, tvb, offset, 4,
12130
0
                   ett_nfs4_cb_notify_add4,
12131
0
                   NULL, "Add Entry");
12132
0
      offset = dissect_notify_add4(tvb, offset, atree, pinfo, civ);
12133
0
    }
12134
12135
0
    if (mask & BIT(NOTIFY4_RENAME_ENTRY)) {
12136
0
      proto_tree *rtree;
12137
12138
0
      rtree = proto_tree_add_subtree(ntree, tvb, offset, 4,
12139
0
                   ett_nfs4_cb_notify_rename4,
12140
0
                   NULL, "Rename Entry");
12141
0
      offset = dissect_notify_rename4(tvb, offset, rtree, pinfo, civ);
12142
0
    }
12143
    /* FIXME: NOTIFY4_CHANGE_COOKIE_VERIFIER */
12144
0
  }
12145
0
  return offset;
12146
0
}
12147
12148
static unsigned
12149
dissect_nfs4_cb_request(tvbuff_t *tvb, unsigned offset, packet_info *pinfo, proto_tree *tree, rpc_call_info_value *civ)
12150
0
{
12151
0
  uint32_t      ops, ops_counter;
12152
0
  uint32_t      status;
12153
0
  unsigned      opcode;
12154
0
  proto_item *fitem;
12155
0
  proto_tree *ftree;
12156
0
  proto_tree *newftree = NULL;
12157
0
  nfs4_operation_summary *op_summary;
12158
12159
0
  ops = tvb_get_ntohl(tvb, offset+0);
12160
12161
0
  ftree = proto_tree_add_subtree_format(tree, tvb, offset, 4, ett_nfs4_cb_request_op, NULL, "Operations (count: %u)", ops);
12162
0
  offset += 4;
12163
12164
0
  if (ops > MAX_NFSV4_OPS) {
12165
0
    expert_add_info(pinfo, ftree, &ei_nfs_too_many_ops);
12166
0
    ops = MAX_NFSV4_OPS;
12167
0
  }
12168
12169
0
  op_summary = wmem_alloc0_array(pinfo->pool, nfs4_operation_summary, ops);
12170
12171
0
  for (ops_counter=0; ops_counter<ops; ops_counter++)
12172
0
  {
12173
0
    opcode = tvb_get_ntohl(tvb, offset);
12174
0
    op_summary[ops_counter].iserror = false;
12175
0
    op_summary[ops_counter].opcode = opcode;
12176
0
    col_append_fstr(pinfo->cinfo, COL_INFO, "%c%s", ops_counter == 0?' ':';',
12177
0
        val_to_str_ext_const(opcode, &names_nfs_cb_operation_ext, "Unknown"));
12178
12179
0
    fitem = proto_tree_add_uint(ftree, hf_nfs4_cb_op, tvb, offset, 4, opcode);
12180
0
    offset += 4;
12181
12182
  /* the opcodes are not contiguous */
12183
0
    if ((opcode < NFS4_OP_CB_GETATTR || opcode > NFS4_OP_CB_OFFLOAD) &&
12184
0
        (opcode != NFS4_OP_CB_ILLEGAL))
12185
0
      break;
12186
12187
  /* all of the V4 ops are contiguous, except for NFS4_OP_ILLEGAL */
12188
0
    if (opcode == NFS4_OP_CB_ILLEGAL)
12189
0
      newftree = proto_item_add_subtree(fitem, ett_nfs4_cb_illegal);
12190
0
    else if (nfs4_cb_operation_ett[opcode - 3])
12191
0
      newftree = proto_item_add_subtree(fitem, *nfs4_cb_operation_ett[opcode - 3]);
12192
0
    else
12193
0
      break;
12194
12195
0
    switch (opcode)
12196
0
    {
12197
0
    case NFS4_OP_CB_RECALL:
12198
0
      offset = dissect_nfs4_stateid(tvb, offset, newftree, NULL);
12199
0
      offset = dissect_rpc_bool(tvb, newftree, hf_nfs4_cb_truncate, offset);
12200
0
      offset = dissect_nfs4_fh(tvb, offset, pinfo, newftree, "FileHandle", NULL, NULL, NULL, civ, opcode, -1);
12201
0
      break;
12202
0
    case NFS4_OP_CB_GETATTR:
12203
0
      offset = dissect_nfs4_fh(tvb, offset, pinfo, tree, "FileHandle", NULL, NULL, NULL, civ, opcode, -1);
12204
0
      offset = dissect_nfs4_fattrs(tvb, offset, pinfo, tree, FATTR4_BITMAP_ONLY, civ, opcode, -1);
12205
0
      break;
12206
0
    case NFS4_OP_CB_LAYOUTRECALL:
12207
0
      offset = dissect_nfs4_cb_layoutrecall(tvb, offset, newftree, pinfo, civ);
12208
0
      break;
12209
0
    case NFS4_OP_CB_RECALL_ANY:
12210
0
      offset = dissect_rpc_uint32(tvb, newftree, hf_nfs4_cb_recall_any_objs, offset);
12211
0
      offset = dissect_nfs4_cb_recall_any_mask(tvb, offset, pinfo, newftree);
12212
0
      break;
12213
0
    case NFS4_OP_CB_NOTIFY:
12214
0
      offset = dissect_nfs4_cb_notify_args(tvb, offset, newftree, pinfo, civ);
12215
0
      break;
12216
0
    case NFS4_OP_CB_PUSH_DELEG:
12217
0
    case NFS4_OP_CB_RECALLABLE_OBJ_AVAIL:
12218
0
    case NFS4_OP_CB_RECALL_SLOT:
12219
0
      break;
12220
0
    case NFS4_OP_CB_SEQUENCE:
12221
0
      offset = dissect_nfs4_sessionid(tvb, offset, newftree);
12222
0
      offset = dissect_rpc_uint32(tvb, newftree, hf_nfs4_seqid, offset);
12223
0
      offset = dissect_rpc_uint32(tvb, newftree, hf_nfs4_slotid, offset);
12224
0
      offset = dissect_rpc_uint32(tvb, newftree, hf_nfs4_high_slotid, offset);
12225
0
      offset = dissect_rpc_bool(tvb, newftree, hf_nfs4_cachethis, offset);
12226
0
      offset = dissect_nfs4_cb_referring_calls(tvb, offset, newftree);
12227
0
      break;
12228
0
    case NFS4_OP_CB_WANTS_CANCELLED:
12229
0
      break;
12230
0
    case NFS4_OP_CB_NOTIFY_LOCK:
12231
0
      offset = dissect_nfs4_fh(tvb, offset, pinfo, newftree, "FileHandle", NULL, NULL, NULL, civ, opcode, -1);
12232
0
      offset = dissect_nfs4_lock_owner(tvb, pinfo, offset, newftree);
12233
0
      break;
12234
0
    case NFS4_OP_CB_NOTIFY_DEVICEID:
12235
0
      break;
12236
0
    case NFS4_OP_CB_OFFLOAD:
12237
0
      offset = dissect_nfs4_fh(tvb, offset, pinfo, newftree, "FileHandle", NULL, NULL, NULL, civ, opcode, -1);
12238
0
      offset = dissect_nfs4_stateid(tvb, offset, newftree, NULL);
12239
0
      offset = dissect_nfs4_status(tvb, offset, newftree, &status);
12240
0
      if (status == NFS4_OK) {
12241
0
        offset = dissect_nfs4_write_response(tvb, pinfo, offset, newftree);
12242
0
      } else {
12243
0
        offset = dissect_rpc_uint64(tvb, newftree, hf_nfs4_bytes_copied, offset);
12244
0
      }
12245
0
      break;
12246
0
    case NFS4_OP_ILLEGAL:
12247
0
      break;
12248
0
    default:
12249
0
      break;
12250
0
    }
12251
0
  }
12252
12253
  /* Copy the information from the call info and store information about
12254
   * the operations here in private data.
12255
   */
12256
0
  rpc_call_info_value *tapdata = wmem_new0(pinfo->pool, rpc_call_info_value);
12257
0
  *tapdata = *civ;
12258
0
  nfs4_tap_data_t *ops_info = wmem_new0(pinfo->pool, nfs4_tap_data_t);
12259
0
  ops_info->op_summary = op_summary;
12260
0
  ops_info->ops_counter = ops_counter;
12261
0
  ops_info->highest_tier = 0;
12262
0
  tapdata->private_data = ops_info;
12263
0
  tap_queue_packet(nfsv4_tap, pinfo, tapdata);
12264
12265
0
  return offset;
12266
0
}
12267
12268
12269
static int
12270
dissect_nfs4_cb_compound_call(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
12271
0
{
12272
0
  const char *tag = NULL;
12273
0
  unsigned offset = 0;
12274
12275
0
  offset = dissect_nfs_utf8string(tvb, pinfo, offset, tree, hf_nfs4_tag, &tag);
12276
12277
0
  col_append_fstr(pinfo->cinfo, COL_INFO, " %s", tag);
12278
12279
0
  offset = dissect_rpc_uint32(tvb, tree, hf_nfs4_minorversion, offset);
12280
0
  offset = dissect_rpc_uint32(tvb, tree, hf_nfs4_callback_ident, offset);
12281
0
  offset = dissect_nfs4_cb_request(tvb, offset, pinfo, tree, (rpc_call_info_value*)data);
12282
12283
0
  return offset;
12284
0
}
12285
12286
12287
static unsigned
12288
dissect_nfs4_cb_resp_op(tvbuff_t *tvb, unsigned offset, packet_info *pinfo, proto_tree *tree, rpc_call_info_value *civ)
12289
0
{
12290
0
  uint32_t      ops, ops_counter;
12291
0
  uint32_t      opcode;
12292
0
  proto_item *fitem;
12293
0
  proto_tree *ftree;
12294
0
  proto_tree *newftree = NULL;
12295
0
  uint32_t      status;
12296
0
  nfs4_operation_summary *op_summary;
12297
12298
0
  ops   = tvb_get_ntohl(tvb, offset+0);
12299
0
  ftree = proto_tree_add_subtree_format(tree, tvb, offset, 4, ett_nfs4_cb_resop, NULL, "Operations (count: %u)", ops);
12300
0
  offset += 4;
12301
12302
0
  if (ops > MAX_NFSV4_OPS) {
12303
0
    expert_add_info(pinfo, ftree, &ei_nfs_too_many_ops);
12304
0
    ops = MAX_NFSV4_OPS;
12305
0
  }
12306
12307
0
  op_summary = wmem_alloc0_array(pinfo->pool, nfs4_operation_summary, ops);
12308
12309
0
  for (ops_counter = 0; ops_counter < ops; ops_counter++)
12310
0
  {
12311
0
    opcode = tvb_get_ntohl(tvb, offset);
12312
0
    op_summary[ops_counter].iserror = false;
12313
0
    op_summary[ops_counter].opcode = opcode;
12314
12315
    /* sanity check for bogus packets */
12316
0
    if ((opcode < NFS4_OP_CB_GETATTR || opcode > NFS4_OP_CB_OFFLOAD) &&
12317
0
      (opcode != NFS4_OP_ILLEGAL))
12318
0
      break;
12319
12320
0
    col_append_fstr(pinfo->cinfo, COL_INFO, "%c%s", ops_counter == 0 ? ' ' : ';',
12321
0
        val_to_str_ext_const(opcode, &names_nfs_cb_operation_ext, "Unknown"));
12322
12323
0
    fitem = proto_tree_add_uint(ftree, hf_nfs4_cb_op, tvb, offset, 4, opcode);
12324
0
    offset += 4;
12325
12326
    /* all of the V4 ops are contiguous, except for NFS4_OP_ILLEGAL */
12327
0
    if (opcode == NFS4_OP_ILLEGAL)
12328
0
      newftree = proto_item_add_subtree(fitem, ett_nfs4_illegal);
12329
0
    else if (nfs4_cb_operation_ett[opcode - 3])
12330
0
      newftree = proto_item_add_subtree(fitem, *nfs4_cb_operation_ett[opcode - 3]);
12331
0
    else
12332
0
      break;
12333
12334
0
    offset = dissect_nfs4_status(tvb, offset, newftree, &status);
12335
12336
    /* are there any ops that return data with a failure (?) */
12337
0
    if (status != NFS4_OK) {
12338
0
      op_summary[ops_counter].iserror = true;
12339
0
      continue;
12340
0
    }
12341
12342
    /* These parsing routines are only executed if the status is NFS4_OK */
12343
0
    switch (opcode)
12344
0
    {
12345
0
    case NFS4_OP_CB_RECALL:
12346
0
      break;
12347
0
    case NFS4_OP_CB_GETATTR:
12348
0
      offset = dissect_nfs4_fattrs(tvb, offset, pinfo, newftree, FATTR4_DISSECT_VALUES, civ, opcode, -1);
12349
0
      break;
12350
0
    case NFS4_OP_CB_LAYOUTRECALL:
12351
0
      break;
12352
0
    case NFS4_OP_CB_NOTIFY:
12353
0
    case NFS4_OP_CB_PUSH_DELEG:
12354
0
    case NFS4_OP_CB_RECALL_ANY:
12355
0
    case NFS4_OP_CB_RECALLABLE_OBJ_AVAIL:
12356
0
    case NFS4_OP_CB_RECALL_SLOT:
12357
0
      break;
12358
0
    case NFS4_OP_CB_SEQUENCE:
12359
0
      offset = dissect_nfs4_sessionid(tvb, offset, newftree);
12360
0
      offset = dissect_rpc_uint32(tvb, newftree, hf_nfs4_seqid, offset);
12361
0
      offset = dissect_rpc_uint32(tvb, newftree, hf_nfs4_slotid, offset);
12362
0
      offset = dissect_rpc_uint32(tvb, newftree, hf_nfs4_high_slotid, offset);
12363
0
      offset = dissect_rpc_uint32(tvb, newftree, hf_nfs4_target_high_slotid, offset);
12364
0
      break;
12365
0
    case NFS4_OP_CB_WANTS_CANCELLED:
12366
0
    case NFS4_OP_CB_NOTIFY_LOCK:
12367
0
    case NFS4_OP_CB_NOTIFY_DEVICEID:
12368
0
    case NFS4_OP_CB_OFFLOAD:
12369
0
      break;
12370
0
    case NFS4_OP_ILLEGAL:
12371
0
      break;
12372
0
    default:
12373
0
      break;
12374
0
    }
12375
0
  }
12376
12377
  /* Copy the information from the call info and store information about
12378
   * the operations here in private data.
12379
   */
12380
0
  rpc_call_info_value *tapdata = wmem_new0(pinfo->pool, rpc_call_info_value);
12381
0
  *tapdata = *civ;
12382
0
  nfs4_tap_data_t *ops_info = wmem_new0(pinfo->pool, nfs4_tap_data_t);
12383
0
  ops_info->op_summary = op_summary;
12384
0
  ops_info->ops_counter = ops_counter;
12385
0
  ops_info->highest_tier = 0;
12386
0
  tapdata->private_data = ops_info;
12387
0
  tap_queue_packet(nfsv4_tap, pinfo, tapdata);
12388
12389
0
  return offset;
12390
0
}
12391
12392
12393
static int
12394
dissect_nfs4_cb_compound_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
12395
0
{
12396
0
  uint32_t      status;
12397
0
  const char *tag = NULL;
12398
0
  unsigned offset = 0;
12399
12400
0
  offset = dissect_nfs4_status(tvb, offset, tree, &status);
12401
0
  offset = dissect_nfs_utf8string(tvb, pinfo, offset, tree, hf_nfs4_tag, &tag);
12402
0
  col_append_fstr(pinfo->cinfo, COL_INFO, " %s", tag);
12403
12404
0
  offset = dissect_nfs4_cb_resp_op(tvb, offset, pinfo, tree, (rpc_call_info_value*)data);
12405
12406
0
  return offset;
12407
0
}
12408
12409
12410
static const vsff nfs_cb_proc[] = {
12411
  { 0, "CB_NULL",
12412
    dissect_nfs3_null_call, dissect_nfs3_null_reply },
12413
  { 1, "CB_COMPOUND",
12414
    dissect_nfs4_cb_compound_call, dissect_nfs4_cb_compound_reply },
12415
  { 0, NULL, NULL, NULL }
12416
};
12417
12418
static const value_string nfs_cb_proc_vals[] = {
12419
  { 0, "CB_NULL" },
12420
  { 1, "CB_COMPOUND" },
12421
  { 0, NULL }
12422
};
12423
12424
/*
12425
 * NFS Callback version 1 is used by NFSv4.0 protocol and
12426
 * NFS Callback version 4 is used by NFSv4.1 and NFSv4.2 protocols.
12427
 * Other versions (including 2 and 3) are not defined nor used yet.
12428
 */
12429
static const rpc_prog_vers_info nfs_cb_vers_info[] = {
12430
  { 1, nfs_cb_proc, &hf_nfs4_cb_procedure },
12431
  { 4, nfs_cb_proc, &hf_nfs4_cb_procedure },
12432
};
12433
12434
#define NFS4_SRT_TABLE_INDEX 0
12435
#define NFS4_MAIN_OP_SRT_TABLE_INDEX 1
12436
#define NFS4_CB_SRT_TABLE_INDEX 2
12437
12438
typedef struct nfsv4_tap_data {
12439
12440
  uint32_t    ops_counter;
12441
  nfs4_operation_summary *op_summary;
12442
  uint32_t program;
12443
  uint32_t version;
12444
  uint32_t operation;
12445
  uint32_t xid;
12446
  bool request;
12447
  nstime_t req_time;
12448
} nfsv4_tap_data_t;
12449
12450
static void
12451
nfsstat_init(struct register_srt* srt _U_, GArray* srt_array)
12452
0
{
12453
0
  srt_stat_table *nfs_srt_table, *nfs_main_op_srt_table;
12454
12455
0
  nfs_srt_table = init_srt_table("NFSv4 Operations", NULL, srt_array, NFS4_LAST_OP + 1, "Operations", "nfs.opcode", NULL);
12456
0
  nfs_main_op_srt_table = init_srt_table("NFSv4 Main Operation", NULL, srt_array, NFS4_LAST_OP + 1, "Operations", "nfs.main_opcode", NULL);
12457
0
  for (uint32_t i = 0; i <= NFS4_LAST_OP; i++) {
12458
0
    init_srt_table_row(nfs_srt_table, i,
12459
0
      val_to_str_ext_const(i, &names_nfs4_operation_ext, "Unknown"));
12460
0
    init_srt_table_row(nfs_main_op_srt_table, i,
12461
0
      val_to_str_ext_const(i, &names_nfs4_operation_ext, "Unknown"));
12462
0
  }
12463
12464
0
  nfs_srt_table = init_srt_table("NFSv4 Callback Operations", NULL, srt_array, NFS4_OP_CB_OFFLOAD + 1, "Operations", "nfs.cb.operation", NULL);
12465
12466
0
  for (uint32_t i = 0; i <= NFS4_OP_CB_OFFLOAD; i++) {
12467
0
    init_srt_table_row(nfs_srt_table, i,
12468
0
      val_to_str_ext_const(i, &names_nfs4_operation_ext, "Unknown"));
12469
0
  }
12470
0
}
12471
12472
/* Hash table with NFS4 CB program numbers */
12473
static GHashTable *nfs4_cb_progs;
12474
12475
static void
12476
nfs4_cb_init(void)
12477
16
{
12478
16
  nfs4_cb_progs = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, NULL);
12479
16
}
12480
12481
static void
12482
nfs4_cb_cleanup(void)
12483
0
{
12484
0
  g_hash_table_destroy(nfs4_cb_progs);
12485
0
}
12486
12487
static void
12488
nfs4_cb_register_prog(tvbuff_t *tvb, int offset)
12489
0
{
12490
0
  uint32_t prog = tvb_get_ntohl(tvb, offset);
12491
12492
0
  if (g_hash_table_lookup(nfs4_cb_progs, GUINT_TO_POINTER(prog)) != NULL)
12493
0
    return;
12494
12495
0
  g_hash_table_insert(nfs4_cb_progs, GUINT_TO_POINTER(prog), GUINT_TO_POINTER(1));
12496
12497
  /* Register the CB protocol as RPC */
12498
0
  rpc_init_prog(proto_nfs_cb, prog, ett_nfs, G_N_ELEMENTS(nfs_cb_vers_info), nfs_cb_vers_info);
12499
0
}
12500
12501
static tap_packet_status
12502
nfsstat_packet(void *pss, packet_info *pinfo, epan_dissect_t *edt _U_, const void *prv, tap_flags_t flags _U_)
12503
0
{
12504
0
  srt_stat_table *nfs_srt_table, *nfs_main_op_srt_table;
12505
0
  srt_data_t *data = (srt_data_t *)pss;
12506
0
  const rpc_call_info_value *ri = (const rpc_call_info_value *)prv;
12507
0
  const nfs4_tap_data_t *ops_info = (const nfs4_tap_data_t *)ri->private_data;
12508
0
  uint32_t opcode;
12509
0
  unsigned current_tier;
12510
12511
  /* we are only interested in response packets */
12512
0
  if (ri->request) {
12513
0
    return TAP_PACKET_DONT_REDRAW;
12514
0
  }
12515
12516
0
  if (ri->prog == NFS_PROGRAM) {
12517
0
    nfs_srt_table = g_array_index(data->srt_array, srt_stat_table*, NFS4_SRT_TABLE_INDEX);
12518
0
    nfs_main_op_srt_table = g_array_index(data->srt_array, srt_stat_table*, NFS4_MAIN_OP_SRT_TABLE_INDEX);
12519
0
  } else if (g_hash_table_lookup(nfs4_cb_progs, GUINT_TO_POINTER(ri->prog)) != NULL) {
12520
0
    nfs_srt_table = g_array_index(data->srt_array, srt_stat_table*, NFS4_CB_SRT_TABLE_INDEX);
12521
0
    nfs_main_op_srt_table = NULL;
12522
0
  } else {
12523
0
    return TAP_PACKET_DONT_REDRAW;
12524
0
  }
12525
12526
  /* Add each of the operations seen to the table. Add operations
12527
   * considered the "main opcode" (in the highest tier in the
12528
   * compound procedure) to another table.
12529
   */
12530
0
  for (uint32_t ops = 0; ops < ops_info->ops_counter; ops++) {
12531
0
    opcode = ops_info->op_summary[ops].opcode;
12532
0
    if (opcode == NFS4_OP_ILLEGAL) {
12533
      /* Ignore the illegal opcode, it would create
12534
       * 10,000 empty SRT rows.
12535
       * Note NFS4_OP_CB_ILLEGAL is the same value;
12536
       * actually testing for it makes some compilers
12537
       * warn about a useless duplicate logical test.
12538
       */
12539
0
      continue;
12540
0
    }
12541
0
    add_srt_table_data(nfs_srt_table, opcode, &ri->req_time, pinfo);
12542
0
    if (nfs_main_op_srt_table) {
12543
0
      current_tier = NFS4_OPERATION_TIER(opcode);
12544
0
      if (current_tier == ops_info->highest_tier) {
12545
0
        add_srt_table_data(nfs_main_op_srt_table, opcode, &ri->req_time, pinfo);
12546
0
      }
12547
0
    }
12548
0
  }
12549
12550
0
  return TAP_PACKET_REDRAW;
12551
0
}
12552
12553
void
12554
proto_register_nfs(void)
12555
16
{
12556
16
  static hf_register_info hf[] = {
12557
16
    { &hf_nfs2_procedure, {
12558
16
      "V2 Procedure", "nfs.procedure_v2", FT_UINT32, BASE_DEC | BASE_EXT_STRING,
12559
16
      &nfs2_proc_vals_ext, 0, NULL, HFILL }},
12560
16
    { &hf_nfs3_procedure, {
12561
16
      "V3 Procedure", "nfs.procedure_v3", FT_UINT32, BASE_DEC | BASE_EXT_STRING,
12562
16
      &nfs3_proc_vals_ext, 0, NULL, HFILL }},
12563
16
    { &hf_nfs4_procedure, {
12564
16
      "V4 Procedure", "nfs.procedure_v4", FT_UINT32, BASE_DEC,
12565
16
      VALS(nfs4_proc_vals), 0, NULL, HFILL }},
12566
#if 0
12567
    { &hf_nfs4_impl_id_len, {
12568
      "Implementation ID length", "nfs.impl_id4.length", FT_UINT32, BASE_DEC,
12569
      NULL, 0, NULL, HFILL }},
12570
#endif
12571
16
    { &hf_nfs_fh_length, {
12572
16
      "length", "nfs.fh.length", FT_UINT32, BASE_DEC,
12573
16
      NULL, 0, "file handle length", HFILL }},
12574
16
    { &hf_nfs_fh_hash, {
12575
16
      "hash (CRC-32)", "nfs.fh.hash", FT_UINT32, BASE_HEX,
12576
16
      NULL, 0, "file handle hash", HFILL }},
12577
12578
12579
16
    { &hf_nfs_fh_mount_fileid, {
12580
16
      "fileid", "nfs.fh.mount.fileid", FT_UINT32, BASE_DEC,
12581
16
      NULL, 0, "mount point fileid", HFILL }},
12582
16
    { &hf_nfs_fh_mount_generation, {
12583
16
      "generation", "nfs.fh.mount.generation", FT_UINT32, BASE_HEX,
12584
16
      NULL, 0, "mount point generation", HFILL }},
12585
16
    { &hf_nfs_fh_flags, {
12586
16
      "Flags", "nfs.fh.flags", FT_UINT16, BASE_HEX,
12587
16
      NULL, 0, "file handle flags", HFILL }},
12588
16
    { &hf_nfs_fh_snapid, {
12589
16
      "snapid", "nfs.fh.snapid", FT_UINT8, BASE_DEC,
12590
16
      NULL, 0, "snapshot ID", HFILL }},
12591
16
    { &hf_nfs_fh_unused, {
12592
16
      "unused", "nfs.fh.unused", FT_UINT8, BASE_DEC,
12593
16
      NULL, 0, NULL, HFILL }},
12594
16
    { &hf_nfs_fh_fileid, {
12595
16
      "fileid", "nfs.fh.fileid", FT_UINT32, BASE_DEC,
12596
16
      NULL, 0, "file ID", HFILL }},
12597
16
    { &hf_nfs_fh_generation, {
12598
16
      "generation", "nfs.fh.generation", FT_UINT32, BASE_HEX,
12599
16
      NULL, 0, "inode generation", HFILL }},
12600
16
    { &hf_nfs_fh_fsid, {
12601
16
      "file system ID", "nfs.fh.fsid", FT_UINT32, BASE_CUSTOM,
12602
16
      CF_FUNC(nfs_fmt_fsid), 0, NULL, HFILL }},
12603
16
    { &hf_nfs_fh_export_fileid, {
12604
16
      "fileid", "nfs.fh.export.fileid", FT_UINT32, BASE_DEC,
12605
16
      NULL, 0, "export point fileid", HFILL }},
12606
16
    { &hf_nfs_fh_export_generation, {
12607
16
      "generation", "nfs.fh.export.generation", FT_UINT32, BASE_HEX,
12608
16
      NULL, 0, "export point generation", HFILL }},
12609
16
    { &hf_nfs_fh_export_snapid, {
12610
16
      "snapid", "nfs.fh.export.snapid", FT_UINT8, BASE_DEC,
12611
16
      NULL, 0, "export point snapid", HFILL }},
12612
16
    { &hf_nfs_fh_exportid, {
12613
16
      "exportid", "nfs.fh.exportid", FT_GUID, BASE_NONE,
12614
16
      NULL, 0, "Gluster/NFS exportid", HFILL }},
12615
16
    { &hf_nfs_fh_handle_type, {
12616
16
      "Handle type", "nfs.fh.handletype", FT_UINT32, BASE_DEC,
12617
16
      VALS(handle_type_strings), 0, "v4 handle type", HFILL }},
12618
16
    { &hf_nfs_fh_file_flag_mntpoint, {
12619
16
      "mount point", "nfs.fh.file.flag.mntpoint", FT_BOOLEAN, 16,
12620
16
      TFS(&tfs_set_notset), 0x0001, "file flag: mountpoint", HFILL }},
12621
16
    { &hf_nfs_fh_file_flag_snapdir, {
12622
16
      "snapdir", "nfs.fh.file.flag.snapdir", FT_BOOLEAN, 16,
12623
16
      TFS(&tfs_set_notset), 0x0002, "file flag: snapdir", HFILL }},
12624
16
    { &hf_nfs_fh_file_flag_snapdir_ent, {
12625
16
      "snapdir_ent", "nfs.fh.file.flag.snadir_ent", FT_BOOLEAN, 16,
12626
16
      TFS(&tfs_set_notset), 0x0004, "file flag: snapdir_ent", HFILL }},
12627
16
    { &hf_nfs_fh_file_flag_empty, {
12628
16
      "empty", "nfs.fh.file.flag.empty", FT_BOOLEAN, 16,
12629
16
      TFS(&tfs_set_notset), 0x0008, "file flag: empty", HFILL }},
12630
16
    { &hf_nfs_fh_file_flag_vbn_access, {
12631
16
      "vbn_access", "nfs.fh.file.flag.vbn_access", FT_BOOLEAN, 16,
12632
16
      TFS(&tfs_set_notset), 0x0010, "file flag: vbn_access", HFILL }},
12633
16
    { &hf_nfs_fh_file_flag_multivolume, {
12634
16
      "multivolume", "nfs.fh.file.flag.multivolume", FT_BOOLEAN, 16,
12635
16
      TFS(&tfs_set_notset), 0x0020, "file flag: multivolume", HFILL }},
12636
16
    { &hf_nfs_fh_file_flag_metadata, {
12637
16
      "metadata", "nfs.fh.file.flag.metadata", FT_BOOLEAN, 16,
12638
16
      TFS(&tfs_set_notset), 0x0040, "file flag: metadata", HFILL }},
12639
16
    { &hf_nfs_fh_file_flag_orphan, {
12640
16
      "orphan", "nfs.fh.file.flag.orphan", FT_BOOLEAN, 16,
12641
16
      TFS(&tfs_set_notset), 0x0080, "file flag: orphan", HFILL }},
12642
16
    { &hf_nfs_fh_file_flag_foster, {
12643
16
      "foster", "nfs.fh.file.flag.foster", FT_BOOLEAN, 16,
12644
16
      TFS(&tfs_set_notset), 0x0100, "file flag: foster", HFILL }},
12645
16
    { &hf_nfs_fh_file_flag_named_attr, {
12646
16
      "named_attr", "nfs.fh.file.flag.named_attr", FT_BOOLEAN, 16,
12647
16
      TFS(&tfs_set_notset), 0x0200, "file flag: named_attr", HFILL }},
12648
16
    { &hf_nfs_fh_file_flag_exp_snapdir, {
12649
16
      "exp_snapdir", "nfs.fh.file.flag.exp_snapdir", FT_BOOLEAN, 16,
12650
16
      TFS(&tfs_set_notset), 0x0400, "file flag: exp_snapdir", HFILL }},
12651
16
    { &hf_nfs_fh_file_flag_vfiler, {
12652
16
      "vfiler", "nfs.fh.file.flag.vfiler", FT_BOOLEAN, 16,
12653
16
      TFS(&tfs_set_notset), 0x0800, "file flag: vfiler", HFILL }},
12654
16
    { &hf_nfs_fh_file_flag_aggr, {
12655
16
      "aggr", "nfs.fh.file.flag.aggr", FT_BOOLEAN, 16,
12656
16
      TFS(&tfs_set_notset), 0x1000, "file flag: aggr", HFILL }},
12657
16
    { &hf_nfs_fh_file_flag_striped, {
12658
16
      "striped", "nfs.fh.file.flag.striped", FT_BOOLEAN, 16,
12659
16
      TFS(&tfs_set_notset), 0x2000, "file flag: striped", HFILL }},
12660
16
    { &hf_nfs_fh_file_flag_private, {
12661
16
      "private", "nfs.fh.file.flag.private", FT_BOOLEAN, 16,
12662
16
      TFS(&tfs_set_notset), 0x4000, "file flag: private", HFILL }},
12663
16
    { &hf_nfs_fh_file_flag_next_gen, {
12664
16
      "next_gen", "nfs.fh.file.flag.next_gen", FT_BOOLEAN, 16,
12665
16
      TFS(&tfs_set_notset), 0x8000, "file flag: next_gen", HFILL }},
12666
16
    { &hf_nfs_fh_fsid_major16_mask, {
12667
16
      "major", "nfs.fh.fsid.major", FT_UINT16, BASE_DEC,
12668
16
      NULL, 0xFF00, "major file system ID", HFILL }},
12669
16
    { &hf_nfs_fh_fsid_minor16_mask, {
12670
16
      "minor", "nfs.fh.fsid.minor", FT_UINT16, BASE_DEC,
12671
16
      NULL, 0x00FF, "minor file system ID", HFILL }},
12672
16
    { &hf_nfs_fh_fsid_major16, {
12673
16
      "major", "nfs.fh.fsid.major", FT_UINT16, BASE_DEC,
12674
16
      NULL, 0x0, "major file system ID", HFILL }},
12675
16
    { &hf_nfs_fh_fsid_minor16, {
12676
16
      "minor", "nfs.fh.fsid.minor", FT_UINT16, BASE_DEC,
12677
16
      NULL, 0x0, "minor file system ID", HFILL }},
12678
16
    { &hf_nfs_fh_fsid_major32, {
12679
16
      "major", "nfs.fh.fsid.major", FT_UINT32, BASE_DEC,
12680
16
      NULL, 0xfffc0000, "major file system ID", HFILL }},
12681
16
    { &hf_nfs_fh_fsid_minor32, {
12682
16
      "minor", "nfs.fh.fsid.minor", FT_UINT32, BASE_DEC,
12683
16
      NULL, 0x0003ffff, "minor file system ID", HFILL }},
12684
16
    { &hf_nfs_fh_fsid_inode, {
12685
16
      "inode", "nfs.fh.fsid.inode", FT_UINT32, BASE_DEC,
12686
16
      NULL, 0, "file system inode", HFILL }},
12687
16
    { &hf_nfs_fh_gfid, {
12688
16
      "gfid", "nfs.fh.gfid", FT_GUID, BASE_NONE,
12689
16
      NULL, 0, "Gluster/NFS GFID", HFILL }},
12690
16
    { &hf_nfs_fh_xfsid_major, {
12691
16
      "exported major", "nfs.fh.xfsid.major", FT_UINT16, BASE_DEC,
12692
16
      NULL, 0xFF00, "exported major file system ID", HFILL }},
12693
16
    { &hf_nfs_fh_xfsid_minor, {
12694
16
      "exported minor", "nfs.fh.xfsid.minor", FT_UINT16, BASE_DEC,
12695
16
      NULL, 0x00FF, "exported minor file system ID", HFILL }},
12696
16
    { &hf_nfs_fh_fstype, {
12697
16
      "file system type", "nfs.fh.fstype", FT_UINT32, BASE_DEC,
12698
16
      NULL, 0, NULL, HFILL }},
12699
16
    { &hf_nfs_fh_fn, {
12700
16
      "file number", "nfs.fh.fn", FT_UINT32, BASE_DEC,
12701
16
      NULL, 0, NULL, HFILL }},
12702
16
    { &hf_nfs_fh_fn_len, {
12703
16
      "length", "nfs.fh.fn.len", FT_UINT32, BASE_DEC,
12704
16
      NULL, 0, "file number length", HFILL }},
12705
16
    { &hf_nfs_fh_fn_inode, {
12706
16
      "inode", "nfs.fh.fn.inode", FT_UINT32, BASE_DEC,
12707
16
      NULL, 0, "file number inode", HFILL }},
12708
16
    { &hf_nfs_fh_fn_generation, {
12709
16
      "generation", "nfs.fh.fn.generation", FT_UINT32, BASE_DEC,
12710
16
      NULL, 0, "file number generation", HFILL }},
12711
16
    { &hf_nfs_fh_xfn, {
12712
16
      "exported file number", "nfs.fh.xfn", FT_UINT32, BASE_DEC,
12713
16
      NULL, 0, NULL, HFILL }},
12714
16
    { &hf_nfs_fh_xfn_len, {
12715
16
      "length", "nfs.fh.xfn.len", FT_UINT32, BASE_DEC,
12716
16
      NULL, 0, "exported file number length", HFILL }},
12717
16
    { &hf_nfs_fh_xfn_inode, {
12718
16
      "exported inode", "nfs.fh.xfn.inode", FT_UINT32, BASE_DEC,
12719
16
      NULL, 0, "exported file number inode", HFILL }},
12720
16
    { &hf_nfs_fh_xfn_generation, {
12721
16
      "generation", "nfs.fh.xfn.generation", FT_UINT32, BASE_DEC,
12722
16
      NULL, 0, "exported file number generation", HFILL }},
12723
16
    { &hf_nfs_fh_dentry, {
12724
16
      "dentry", "nfs.fh.dentry", FT_UINT32, BASE_HEX,
12725
16
      NULL, 0, "dentry (cookie)", HFILL }},
12726
#if 0
12727
    { &hf_nfs_fh_dev, {
12728
      "device", "nfs.fh.dev", FT_UINT32, BASE_DEC,
12729
      NULL, 0, NULL, HFILL }},
12730
#endif
12731
#if 0
12732
    { &hf_nfs_fh_xdev, {
12733
      "exported device", "nfs.fh.xdev", FT_UINT32, BASE_DEC,
12734
      NULL, 0, NULL, HFILL }},
12735
#endif
12736
16
    { &hf_nfs_fh_dirinode, {
12737
16
      "directory inode", "nfs.fh.dirinode", FT_UINT32, BASE_DEC,
12738
16
      NULL, 0, NULL, HFILL }},
12739
16
    { &hf_nfs_fh_pinode, {
12740
16
      "pseudo inode", "nfs.fh.pinode", FT_UINT32, BASE_HEX,
12741
16
      NULL, 0, NULL, HFILL }},
12742
16
    { &hf_nfs_fh_hp_len, {
12743
16
      "length", "nfs.fh.hp.len", FT_UINT32, BASE_DEC,
12744
16
      NULL, 0, "hash path length", HFILL }},
12745
16
    { &hf_nfs_fh_hp_key, {
12746
16
      "key", "nfs.fh.hp.key", FT_BYTES, BASE_NONE,
12747
16
      NULL, 0, NULL, HFILL }},
12748
16
    { &hf_nfs_fh_version, {
12749
16
      "version", "nfs.fh.version", FT_UINT8, BASE_DEC,
12750
16
      NULL, 0, "file handle layout version", HFILL }},
12751
16
    { &hf_nfs_fh_auth_type, {
12752
16
      "auth_type", "nfs.fh.auth_type", FT_UINT8, BASE_DEC,
12753
16
      VALS(auth_type_names), 0, "authentication type", HFILL }},
12754
16
    { &hf_nfs_fh_fsid_type, {
12755
16
      "fsid_type", "nfs.fh.fsid_type", FT_UINT8, BASE_DEC,
12756
16
      VALS(fsid_type_names), 0, "file system ID type", HFILL }},
12757
16
    { &hf_nfs_fh_fileid_type, {
12758
16
      "fileid_type", "nfs.fh.fileid_type", FT_UINT8, BASE_DEC,
12759
16
      VALS(fileid_type_names), 0, "file ID type", HFILL }},
12760
16
    { &hf_nfs_fh_obj_id, {
12761
16
      "Object type", "nfs.fh.obj.id", FT_UINT32, BASE_DEC,
12762
16
      VALS(nfs_fh_obj_id), 0, "Object ID", HFILL }},
12763
16
    { &hf_nfs_fh_ro_node, {
12764
16
      "RO_node", "nfs.fh.ro.node", FT_BOOLEAN, BASE_NONE,
12765
16
      TFS(&nfs4_ro_boolean), 0, "Read Only Node", HFILL }},
12766
16
    { &hf_nfs_fh_obj, {
12767
16
      "Object info", "nfs.fh.obj.info", FT_BYTES, BASE_NONE,
12768
16
      NULL, 0, "File/Dir/Object Info", HFILL }},
12769
16
    { &hf_nfs_fh_obj_fsid, {
12770
16
      "obj_fsid", "nfs.fh.obj.fsid", FT_UINT32, BASE_DEC,
12771
16
      NULL, 0, "File system ID of the object", HFILL }},
12772
16
    { &hf_nfs_fh_obj_kindid, {
12773
16
      "obj_kindid", "nfs.fh.obj.kindid", FT_UINT16, BASE_DEC,
12774
16
      NULL, 0, "KindID of the object", HFILL }},
12775
16
    { &hf_nfs_fh_obj_treeid, {
12776
16
      "obj_treeid", "nfs.fh.obj.treeid", FT_UINT16, BASE_DEC,
12777
16
      NULL, 0, "TreeID of the object", HFILL }},
12778
16
    { &hf_nfs_fh_obj_inode, {
12779
16
      "obj_inode", "nfs.fh.obj.inode", FT_UINT32, BASE_DEC,
12780
16
      NULL, 0, "Inode of the object", HFILL }},
12781
16
    { &hf_nfs_fh_obj_gen, {
12782
16
      "obj_gen", "nfs.fh.obj.gen", FT_UINT32, BASE_DEC,
12783
16
      NULL, 0, "Generation ID of the object", HFILL }},
12784
16
    { &hf_nfs_fh_ex, {
12785
16
      "Export info", "nfs.fh.ex.info", FT_BYTES, BASE_NONE,
12786
16
      NULL, 0, "Export Info (16 bytes)", HFILL }},
12787
16
    { &hf_nfs_fh_ex_fsid, {
12788
16
      "ex_fsid", "nfs.fh.ex.fsid", FT_UINT32, BASE_DEC,
12789
16
      NULL, 0, "File system ID of the object", HFILL }},
12790
16
    { &hf_nfs_fh_ex_kindid, {
12791
16
      "ex_kindid", "nfs.fh.ex.kindid", FT_UINT16, BASE_DEC,
12792
16
      NULL, 0, "KindID of the object", HFILL }},
12793
16
    { &hf_nfs_fh_ex_treeid, {
12794
16
      "ex_treeid", "nfs.fh.ex.treeid", FT_UINT16, BASE_DEC,
12795
16
      NULL, 0, "TreeID of the object", HFILL }},
12796
16
    { &hf_nfs_fh_ex_inode, {
12797
16
      "ex_inode", "nfs.fh.ex.inode", FT_UINT32, BASE_DEC,
12798
16
      NULL, 0, "Inode of the object", HFILL }},
12799
16
    { &hf_nfs_fh_ex_gen, {
12800
16
      "ex_gen", "nfs.fh.ex.gen", FT_UINT32, BASE_DEC,
12801
16
      NULL, 0, "Generation ID of the object", HFILL }},
12802
16
    { &hf_nfs_fh_flag, {
12803
16
      "flag", "nfs.fh.flag", FT_UINT32, BASE_HEX,
12804
16
      NULL, 0, "file handle flag", HFILL }},
12805
16
    { &hf_nfs_fh_endianness, {
12806
16
      "endianness", "nfs.fh.endianness", FT_BOOLEAN, BASE_NONE,
12807
16
      TFS(&tfs_endianness), 0x0, "server native endianness", HFILL }},
12808
16
    { &hf_nfs_fh_dc_opaque, {
12809
16
      "fh opaque data", "nfs.fh.dc.opaque", FT_BYTES, BASE_NONE,
12810
16
      NULL, 0, NULL, HFILL }},
12811
16
    { &hf_nfs_fh_dc_exportid, {
12812
16
      "export_id", "nfs.fh.dc.exportid", FT_UINT32, BASE_HEX,
12813
16
      NULL, 0, NULL, HFILL }},
12814
16
    { &hf_nfs_fh_dc_handle_type, {
12815
16
      "fh type", "nfs.fh.dc.type", FT_UINT8, BASE_DEC,
12816
16
      VALS(dcache_handle_types), 0, NULL, HFILL }},
12817
16
    { &hf_nfs4_fh_pd_share, {
12818
16
      "shareid", "nfs.fh.pd.shareid", FT_UINT32, BASE_DEC,
12819
16
      NULL, 0, NULL, HFILL }},
12820
16
    { &hf_nfs4_fh_pd_flags, {
12821
16
      "flags", "nfs.fh.pd.flags", FT_UINT32, BASE_HEX,
12822
16
      NULL, 0, NULL, HFILL }},
12823
16
    { &hf_nfs4_fh_pd_flags_reserved, {
12824
16
      "reserved", "nfs.fh.pd.flags.reserved", FT_UINT32, BASE_HEX,
12825
16
      NULL, PD_RESERVED_MASK, NULL, HFILL }},
12826
16
    { &hf_nfs4_fh_pd_flags_version, {
12827
16
      "version", "nfs.fh.pd.flags.version", FT_UINT32, BASE_DEC,
12828
16
      NULL, PD_VERSION_MASK, NULL, HFILL }},
12829
16
    { &hf_nfs4_fh_pd_sites, {
12830
16
      "sites", "nfs.fh.pd.sites", FT_UINT64, BASE_HEX,
12831
16
      NULL, 0, NULL, HFILL }},
12832
16
    { &hf_nfs4_fh_pd_sites_inum, {
12833
16
      "inum", "nfs.fh.pd.sites.inum", FT_UINT64, BASE_HEX,
12834
16
      NULL, PD_INUM_MASK, NULL, HFILL }},
12835
16
    { &hf_nfs4_fh_pd_sites_siteid, {
12836
16
      "siteid", "nfs.fh.pd.sites.siteid", FT_UINT16, BASE_DEC,
12837
16
      NULL, PD_SITEID_MASK, NULL, HFILL }},
12838
16
    { &hf_nfs4_fh_pd_spaces, {
12839
16
      "spaces", "nfs.fh.pd.spaces", FT_UINT64, BASE_HEX,
12840
16
      NULL, 0, NULL, HFILL }},
12841
16
    { &hf_nfs4_fh_pd_spaces_snapid, {
12842
16
      "snapid", "nfs.fh.pd.spaces.snapid", FT_UINT16, BASE_HEX,
12843
16
      NULL, PD_SNAPID_MASK, NULL, HFILL }},
12844
16
    { &hf_nfs4_fh_pd_spaces_container, {
12845
16
      "container", "nfs.fh.pd.spaces.container", FT_UINT64, BASE_DEC,
12846
16
      NULL, PD_CONTAINER_MASK, NULL, HFILL }},
12847
16
    { &hf_nfs4_fh_pd_container, {
12848
16
      "container", "nfs.fh.pd.container", FT_UINT64, BASE_DEC,
12849
16
      NULL, 0, NULL, HFILL }},
12850
16
    { &hf_nfs4_fh_pd_inum, {
12851
16
      "inum", "nfs.fh.pd.inum", FT_UINT64, BASE_DEC,
12852
16
      NULL, 0, NULL, HFILL }},
12853
16
    { &hf_nfs2_status, {
12854
16
      "Status", "nfs.status2", FT_UINT32, BASE_DEC|BASE_EXT_STRING,
12855
16
      &names_nfs2_stat_ext, 0, "Reply status", HFILL }},
12856
16
    { &hf_nfs_full_name, {
12857
16
      "Full Name", "nfs.full_name", FT_STRING, BASE_NONE,
12858
16
      NULL, 0, NULL, HFILL }},
12859
16
    { &hf_nfs_name, {
12860
16
      "Name", "nfs.name", FT_STRING, BASE_NONE,
12861
16
      NULL, 0, NULL, HFILL }},
12862
16
    { &hf_nfs2_readlink_data, {
12863
16
      "Data", "nfs.readlink.data", FT_STRING, BASE_NONE,
12864
16
      NULL, 0, "Symbolic Link Data", HFILL }},
12865
16
    { &hf_nfs2_read_offset, {
12866
16
      "Offset", "nfs.read.offset", FT_UINT32, BASE_DEC,
12867
16
      NULL, 0, "Read Offset", HFILL }},
12868
16
    { &hf_nfs2_read_count, {
12869
16
      "Count", "nfs.read.count", FT_UINT32, BASE_DEC,
12870
16
      NULL, 0, "Read Count", HFILL }},
12871
16
    { &hf_nfs2_read_totalcount, {
12872
16
      "Total Count", "nfs.read.totalcount", FT_UINT32, BASE_DEC,
12873
16
      NULL, 0, "Total Count (obsolete)", HFILL }},
12874
16
    { &hf_nfs_data, {
12875
16
      "Data", "nfs.data", FT_BYTES, BASE_NONE,
12876
16
      NULL, 0, NULL, HFILL }},
12877
16
    { &hf_nfs4_read_data_length, {
12878
16
      "Read length", "nfs.read.data_length", FT_UINT32, BASE_DEC,
12879
16
      NULL, 0, "Length of read response", HFILL }},
12880
16
    { &hf_nfs4_write_data_length, {
12881
16
      "Write length", "nfs.write.data_length", FT_UINT32, BASE_DEC,
12882
16
      NULL, 0, "Length of write request", HFILL }},
12883
16
    { &hf_nfs2_write_beginoffset, {
12884
16
      "Begin Offset", "nfs.write.beginoffset", FT_UINT32, BASE_DEC,
12885
16
      NULL, 0, "Begin offset (obsolete)", HFILL }},
12886
16
    { &hf_nfs2_write_offset, {
12887
16
      "Offset", "nfs.write.offset", FT_UINT32, BASE_DEC,
12888
16
      NULL, 0, NULL, HFILL }},
12889
16
    { &hf_nfs2_write_totalcount, {
12890
16
      "Total Count", "nfs.write.totalcount", FT_UINT32, BASE_DEC,
12891
16
      NULL, 0, "Total Count (obsolete)", HFILL }},
12892
16
    { &hf_nfs_symlink_to, {
12893
16
      "To", "nfs.symlink.to", FT_STRING, BASE_NONE,
12894
16
      NULL, 0, "Symbolic link destination name", HFILL }},
12895
16
    { &hf_nfs2_readdir_cookie, {
12896
16
      "Cookie", "nfs.readdir.cookie", FT_UINT32, BASE_DEC,
12897
16
      NULL, 0, "Directory Cookie", HFILL }},
12898
16
    { &hf_nfs2_readdir_count, {
12899
16
      "Count", "nfs.readdir.count", FT_UINT32, BASE_DEC,
12900
16
      NULL, 0, "Directory Count", HFILL }},
12901
12902
16
    { &hf_nfs_readdir_entry, {
12903
16
      "Entry", "nfs.readdir.entry", FT_NONE, BASE_NONE,
12904
16
      NULL, 0, "Directory Entry", HFILL }},
12905
12906
16
    { &hf_nfs2_readdir_entry_fileid, {
12907
16
      "File ID", "nfs.readdir.entry.fileid", FT_UINT32, BASE_DEC,
12908
16
      NULL, 0, NULL, HFILL }},
12909
12910
16
    { &hf_nfs2_readdir_entry_name, {
12911
16
      "Name", "nfs.readdir.entry.name", FT_STRING, BASE_NONE,
12912
16
      NULL, 0, NULL, HFILL }},
12913
12914
16
    { &hf_nfs2_readdir_entry_cookie, {
12915
16
      "Cookie", "nfs.readdir.entry.cookie", FT_UINT32, BASE_DEC,
12916
16
      NULL, 0, "Directory Cookie", HFILL }},
12917
12918
16
    { &hf_nfs3_readdir_entry_fileid, {
12919
16
      "File ID", "nfs.readdir.entry3.fileid", FT_UINT64, BASE_DEC,
12920
16
      NULL, 0, NULL, HFILL }},
12921
12922
16
    { &hf_nfs3_readdir_entry_name, {
12923
16
      "Name", "nfs.readdir.entry3.name", FT_STRING, BASE_NONE,
12924
16
      NULL, 0, NULL, HFILL }},
12925
12926
16
    { &hf_nfs3_readdir_entry_cookie, {
12927
16
      "Cookie", "nfs.readdir.entry3.cookie", FT_UINT64, BASE_DEC,
12928
16
      NULL, 0, "Directory Cookie", HFILL }},
12929
12930
16
    { &hf_nfs3_readdirplus_entry_fileid, {
12931
16
      "File ID", "nfs.readdirplus.entry.fileid", FT_UINT64, BASE_DEC,
12932
16
      NULL, 0, NULL, HFILL }},
12933
12934
16
    { &hf_nfs3_readdirplus_entry_name, {
12935
16
      "Name", "nfs.readdirplus.entry.name", FT_STRING, BASE_NONE,
12936
16
      NULL, 0, NULL, HFILL }},
12937
12938
16
    { &hf_nfs3_readdirplus_entry_cookie, {
12939
16
      "Cookie", "nfs.readdirplus.entry.cookie", FT_UINT64, BASE_DEC,
12940
16
      NULL, 0, "Directory Cookie", HFILL }},
12941
12942
16
    { &hf_nfs_readdir_eof, {
12943
16
      "EOF", "nfs.readdir.eof", FT_UINT32, BASE_DEC,
12944
16
      NULL, 0, NULL, HFILL }},
12945
12946
16
    { &hf_nfs2_statfs_tsize, {
12947
16
      "Transfer Size", "nfs.statfs.tsize", FT_UINT32, BASE_DEC,
12948
16
      NULL, 0, NULL, HFILL }},
12949
16
    { &hf_nfs2_statfs_bsize, {
12950
16
      "Block Size", "nfs.statfs.bsize", FT_UINT32, BASE_DEC,
12951
16
      NULL, 0, NULL, HFILL }},
12952
16
    { &hf_nfs2_statfs_blocks, {
12953
16
      "Total Blocks", "nfs.statfs.blocks", FT_UINT32, BASE_DEC,
12954
16
      NULL, 0, NULL, HFILL }},
12955
16
    { &hf_nfs2_statfs_bfree, {
12956
16
      "Free Blocks", "nfs.statfs.bfree", FT_UINT32, BASE_DEC,
12957
16
      NULL, 0, NULL, HFILL }},
12958
16
    { &hf_nfs2_statfs_bavail, {
12959
16
      "Available Blocks", "nfs.statfs.bavail", FT_UINT32, BASE_DEC,
12960
16
      NULL, 0, NULL, HFILL }},
12961
16
    { &hf_nfs3_ftype, {
12962
16
      "Type", "nfs.type", FT_UINT32, BASE_DEC|BASE_EXT_STRING,
12963
16
      &names_nfs_ftype3_ext, 0, "File Type", HFILL }},
12964
16
    { &hf_nfs3_status, {
12965
16
      "Status", "nfs.status3", FT_UINT32, BASE_DEC|BASE_EXT_STRING,
12966
16
      &names_nfs3_status_ext, 0, "Reply status", HFILL }},
12967
16
    { &hf_nfs3_read_eof, {
12968
16
      "EOF", "nfs.read.eof", FT_BOOLEAN, BASE_NONE,
12969
16
      TFS(&tfs_yes_no), 0x0, NULL, HFILL }},
12970
16
    { &hf_nfs3_write_stable, {
12971
16
      "Stable", "nfs.write.stable", FT_UINT32, BASE_DEC,
12972
16
      VALS(names_stable_how), 0, NULL, HFILL }},
12973
16
    { &hf_nfs3_write_committed, {
12974
16
      "Committed", "nfs.write.committed", FT_UINT32, BASE_DEC,
12975
16
      VALS(names_stable_how), 0, NULL, HFILL }},
12976
16
    { &hf_nfs3_createmode, {
12977
16
      "Create Mode", "nfs.createmode", FT_UINT32, BASE_DEC,
12978
16
      VALS(names_createmode3), 0, NULL, HFILL }},
12979
16
    { &hf_nfs3_fsstat_invarsec, {
12980
16
      "invarsec", "nfs.fsstat.invarsec", FT_UINT32, BASE_DEC,
12981
16
      NULL, 0, "probable number of seconds of file system invariance", HFILL }},
12982
16
    { &hf_nfs3_fsinfo_rtmax, {
12983
16
      "rtmax", "nfs.fsinfo.rtmax", FT_UINT32, BASE_DEC,
12984
16
      NULL, 0, "maximum READ request", HFILL }},
12985
16
    { &hf_nfs3_fsinfo_rtpref, {
12986
16
      "rtpref", "nfs.fsinfo.rtpref", FT_UINT32, BASE_DEC,
12987
16
      NULL, 0, "Preferred READ request size", HFILL }},
12988
16
    { &hf_nfs3_fsinfo_rtmult, {
12989
16
      "rtmult", "nfs.fsinfo.rtmult", FT_UINT32, BASE_DEC,
12990
16
      NULL, 0, "Suggested READ multiple", HFILL }},
12991
16
    { &hf_nfs3_fsinfo_wtmax, {
12992
16
      "wtmax", "nfs.fsinfo.wtmax", FT_UINT32, BASE_DEC,
12993
16
      NULL, 0, "Maximum WRITE request size", HFILL }},
12994
16
    { &hf_nfs3_fsinfo_wtpref, {
12995
16
      "wtpref", "nfs.fsinfo.wtpref", FT_UINT32, BASE_DEC,
12996
16
      NULL, 0, "Preferred WRITE request size", HFILL }},
12997
16
    { &hf_nfs3_fsinfo_wtmult, {
12998
16
      "wtmult", "nfs.fsinfo.wtmult", FT_UINT32, BASE_DEC,
12999
16
      NULL, 0, "Suggested WRITE multiple", HFILL }},
13000
16
    { &hf_nfs3_fsinfo_dtpref, {
13001
16
      "dtpref", "nfs.fsinfo.dtpref", FT_UINT32, BASE_DEC,
13002
16
      NULL, 0, "Preferred READDIR request", HFILL }},
13003
16
    { &hf_nfs3_fsinfo_maxfilesize, {
13004
16
      "maxfilesize", "nfs.fsinfo.maxfilesize", FT_UINT64, BASE_DEC,
13005
16
      NULL, 0, "Maximum file size", HFILL }},
13006
16
    { &hf_nfs3_fsinfo_properties, {
13007
16
      "Properties", "nfs.fsinfo.properties", FT_UINT32, BASE_HEX,
13008
16
      NULL, 0, "File System Properties", HFILL }},
13009
16
    { &hf_nfs3_fsinfo_properties_setattr, {
13010
16
      "SETATTR can set time on server", "nfs.fsinfo.properties.setattr", FT_BOOLEAN, 32,
13011
16
      TFS(&tfs_yes_no), FSF3_CANSETTIME, NULL, HFILL }},
13012
16
    { &hf_nfs3_fsinfo_properties_pathconf, {
13013
16
      "PATHCONF", "nfs.fsinfo.properties.pathconf", FT_BOOLEAN, 32,
13014
16
      TFS(&tfs_nfs_pathconf), FSF3_HOMOGENEOUS, NULL, HFILL }},
13015
16
    { &hf_nfs3_fsinfo_properties_symlinks, {
13016
16
      "File System supports symbolic links", "nfs.fsinfo.properties.symlinks", FT_BOOLEAN, 32,
13017
16
      TFS(&tfs_yes_no), FSF3_SYMLINK, NULL, HFILL }},
13018
16
    { &hf_nfs3_fsinfo_properties_hardlinks, {
13019
16
      "File System supports hard links", "nfs.fsinfo.properties.hardlinks", FT_BOOLEAN, 32,
13020
16
      TFS(&tfs_yes_no), FSF3_LINK, NULL, HFILL }},
13021
16
    { &hf_nfs3_pathconf_linkmax, {
13022
16
      "linkmax", "nfs.pathconf.linkmax", FT_UINT32, BASE_DEC,
13023
16
      NULL, 0, "Maximum number of hard links", HFILL }},
13024
16
    { &hf_nfs3_pathconf_name_max, {
13025
16
      "name_max", "nfs.pathconf.name_max", FT_UINT32, BASE_DEC,
13026
16
      NULL, 0, "Maximum file name length", HFILL }},
13027
16
    { &hf_nfs3_pathconf_no_trunc, {
13028
16
      "no_trunc", "nfs.pathconf.no_trunc", FT_BOOLEAN, BASE_NONE,
13029
16
      TFS(&tfs_yes_no), 0x0, "No long file name truncation", HFILL }},
13030
16
    { &hf_nfs3_pathconf_chown_restricted, {
13031
16
      "chown_restricted", "nfs.pathconf.chown_restricted", FT_BOOLEAN, BASE_NONE,
13032
16
      TFS(&tfs_yes_no), 0x0, "chown is restricted to root", HFILL }},
13033
16
    { &hf_nfs3_pathconf_case_insensitive, {
13034
16
      "case_insensitive", "nfs.pathconf.case_insensitive", FT_BOOLEAN, BASE_NONE,
13035
16
      TFS(&tfs_yes_no), 0x0, "file names are treated case insensitive", HFILL }},
13036
16
    { &hf_nfs3_pathconf_case_preserving, {
13037
16
      "case_preserving", "nfs.pathconf.case_preserving", FT_BOOLEAN, BASE_NONE,
13038
16
      TFS(&tfs_yes_no), 0x0, "file name cases are preserved", HFILL }},
13039
13040
#if 0
13041
    { &hf_nfs2_fattr_type, {
13042
      "type", "nfs.fattr.type", FT_UINT32, BASE_DEC,
13043
      NULL, 0, NULL, HFILL }},
13044
#endif
13045
13046
16
    { &hf_nfs2_fattr_nlink, {
13047
16
      "nlink", "nfs.fattr.nlink", FT_UINT32, BASE_DEC,
13048
16
      NULL, 0, NULL, HFILL }},
13049
13050
16
    { &hf_nfs2_fattr_uid, {
13051
16
      "uid", "nfs.fattr.uid", FT_UINT32, BASE_DEC,
13052
16
      NULL, 0, NULL, HFILL }},
13053
13054
16
    { &hf_nfs2_fattr_gid, {
13055
16
      "gid", "nfs.fattr.gid", FT_UINT32, BASE_DEC,
13056
16
      NULL, 0, NULL, HFILL }},
13057
13058
16
    { &hf_nfs2_fattr_size, {
13059
16
      "size", "nfs.fattr.size", FT_UINT32, BASE_DEC,
13060
16
      NULL, 0, NULL, HFILL }},
13061
13062
16
    { &hf_nfs2_fattr_blocksize, {
13063
16
      "blocksize", "nfs.fattr.blocksize", FT_UINT32, BASE_DEC,
13064
16
      NULL, 0, NULL, HFILL }},
13065
13066
16
    { &hf_nfs2_fattr_rdev, {
13067
16
      "rdev", "nfs.fattr.rdev", FT_UINT32, BASE_DEC,
13068
16
      NULL, 0, NULL, HFILL }},
13069
13070
16
    { &hf_nfs2_fattr_blocks, {
13071
16
      "blocks", "nfs.fattr.blocks", FT_UINT32, BASE_DEC,
13072
16
      NULL, 0, NULL, HFILL }},
13073
13074
16
    { &hf_nfs2_fattr_fsid, {
13075
16
      "fsid", "nfs.fattr.fsid", FT_UINT32, BASE_HEX,
13076
16
      NULL, 0, NULL, HFILL }},
13077
13078
16
    { &hf_nfs2_fattr_fileid, {
13079
16
      "fileid", "nfs.fattr.fileid", FT_UINT32, BASE_DEC,
13080
16
      NULL, 0, NULL, HFILL }},
13081
13082
16
    { &hf_nfs3_fattr_type, {
13083
16
      "Type", "nfs.fattr3.type", FT_UINT32, BASE_DEC|BASE_EXT_STRING,
13084
16
      &names_nfs_ftype3_ext, 0, NULL, HFILL }},
13085
13086
16
    { &hf_nfs3_fattr_nlink, {
13087
16
      "nlink", "nfs.fattr3.nlink", FT_UINT32, BASE_DEC,
13088
16
      NULL, 0, NULL, HFILL }},
13089
13090
16
    { &hf_nfs3_fattr_uid, {
13091
16
      "uid", "nfs.fattr3.uid", FT_UINT32, BASE_DEC,
13092
16
      NULL, 0, NULL, HFILL }},
13093
13094
16
    { &hf_nfs3_fattr_gid, {
13095
16
      "gid", "nfs.fattr3.gid", FT_UINT32, BASE_DEC,
13096
16
      NULL, 0, NULL, HFILL }},
13097
13098
16
    { &hf_nfs3_fattr_size, {
13099
16
      "size", "nfs.fattr3.size", FT_UINT64, BASE_DEC,
13100
16
      NULL, 0, NULL, HFILL }},
13101
13102
16
    { &hf_nfs3_fattr_used, {
13103
16
      "used", "nfs.fattr3.used", FT_UINT64, BASE_DEC,
13104
16
      NULL, 0, NULL, HFILL }},
13105
13106
#if 0
13107
    { &hf_nfs3_fattr_rdev, {
13108
      "rdev", "nfs.fattr3.rdev", FT_UINT32, BASE_DEC,
13109
      NULL, 0, NULL, HFILL }},
13110
#endif
13111
13112
16
    { &hf_nfs3_fattr_fsid, {
13113
16
      "fsid", "nfs.fattr3.fsid", FT_UINT64, BASE_HEX_DEC,
13114
16
      NULL, 0, NULL, HFILL }},
13115
13116
16
    { &hf_nfs3_fattr_fileid, {
13117
16
      "fileid", "nfs.fattr3.fileid", FT_UINT64, BASE_DEC,
13118
16
      NULL, 0, NULL, HFILL }},
13119
13120
16
    { &hf_nfs3_wcc_attr_size, {
13121
16
      "size", "nfs.wcc_attr.size", FT_UINT64, BASE_DEC,
13122
16
      NULL, 0, NULL, HFILL }},
13123
13124
16
    { &hf_nfs3_set_size, {
13125
16
      "size", "nfs.set_size", FT_UINT64, BASE_DEC,
13126
16
      NULL, 0, NULL, HFILL }},
13127
13128
16
    { &hf_nfs3_uid, {
13129
16
      "uid", "nfs.uid3", FT_UINT32, BASE_DEC,
13130
16
      NULL, 0, NULL, HFILL }},
13131
13132
16
    { &hf_nfs3_gid, {
13133
16
      "gid", "nfs.gid3", FT_UINT32, BASE_DEC,
13134
16
      NULL, 0, NULL, HFILL }},
13135
13136
16
    { &hf_nfs3_cookie, {
13137
16
      "cookie", "nfs.cookie3", FT_UINT64, BASE_DEC,
13138
16
      NULL, 0, NULL, HFILL }},
13139
13140
16
    { &hf_nfs3_offset, {
13141
16
      "offset", "nfs.offset3", FT_UINT64, BASE_DEC,
13142
16
      NULL, 0, NULL, HFILL }},
13143
13144
16
    { &hf_nfs3_count, {
13145
16
      "count", "nfs.count3", FT_UINT32, BASE_DEC,
13146
16
      NULL, 0, NULL, HFILL }},
13147
13148
16
    { &hf_nfs3_count_maxcount, {
13149
16
      "maxcount", "nfs.count3_maxcount", FT_UINT32, BASE_DEC,
13150
16
      NULL, 0, NULL, HFILL }},
13151
13152
16
    { &hf_nfs3_count_dircount, {
13153
16
      "dircount", "nfs.count3_dircount", FT_UINT32, BASE_DEC,
13154
16
      NULL, 0, NULL, HFILL }},
13155
13156
16
    { &hf_nfs3_fsstat_resok_tbytes, {
13157
16
      "Total bytes", "nfs.fsstat3_resok.tbytes", FT_UINT64, BASE_DEC,
13158
16
      NULL, 0, NULL, HFILL }},
13159
13160
16
    { &hf_nfs3_fsstat_resok_fbytes, {
13161
16
      "Free bytes", "nfs.fsstat3_resok.fbytes", FT_UINT64, BASE_DEC,
13162
16
      NULL, 0, NULL, HFILL }},
13163
13164
16
    { &hf_nfs3_fsstat_resok_abytes, {
13165
16
      "Available free bytes", "nfs.fsstat3_resok.abytes", FT_UINT64, BASE_DEC,
13166
16
      NULL, 0, NULL, HFILL }},
13167
13168
16
    { &hf_nfs3_fsstat_resok_tfiles, {
13169
16
      "Total file slots", "nfs.fsstat3_resok.tfiles", FT_UINT64, BASE_DEC,
13170
16
      NULL, 0, NULL, HFILL }},
13171
13172
16
    { &hf_nfs3_fsstat_resok_ffiles, {
13173
16
      "Free file slots", "nfs.fsstat3_resok.ffiles", FT_UINT64, BASE_DEC,
13174
16
      NULL, 0, NULL, HFILL }},
13175
13176
16
    { &hf_nfs3_fsstat_resok_afiles, {
13177
16
      "Available free file slots", "nfs.fsstat3_resok.afiles", FT_UINT64, BASE_DEC,
13178
16
      NULL, 0, NULL, HFILL }},
13179
13180
    /* NFSv4 */
13181
13182
16
    { &hf_nfs4_status, {
13183
16
      "Status", "nfs.nfsstat4", FT_UINT32, BASE_DEC|BASE_EXT_STRING,
13184
16
      &names_nfs4_status_ext, 0, "Reply status", HFILL }},
13185
13186
16
    { &hf_nfs4_op, {
13187
16
      "Opcode", "nfs.opcode", FT_UINT32, BASE_DEC|BASE_EXT_STRING,
13188
16
      &names_nfs4_operation_ext, 0, NULL, HFILL }},
13189
13190
16
    { &hf_nfs4_op_mask, {
13191
16
      "op_mask", "nfs.op_mask", FT_UINT32, BASE_HEX,
13192
16
      NULL, 0, "Operation Mask", HFILL }},
13193
13194
16
    { &hf_nfs4_main_opcode, {
13195
16
      "Main Opcode", "nfs.main_opcode", FT_UINT32, BASE_DEC|BASE_EXT_STRING,
13196
16
      &names_nfs4_operation_ext, 0, "Main Operation number", HFILL }},
13197
13198
16
    { &hf_nfs4_linktext, {
13199
16
      "Link Contents", "nfs.symlink.linktext", FT_STRING, BASE_NONE,
13200
16
      NULL, 0, "Symbolic link contents", HFILL }},
13201
13202
16
    { &hf_nfs4_dir_entry_name, {
13203
16
      "Name", "nfs.entry_name", FT_STRING, BASE_NONE,
13204
16
      NULL, 0, "Directory entry name", HFILL }},
13205
13206
16
    { &hf_nfs4_pathname_components, {
13207
16
      "pathname components", "nfs.pathname.component.count", FT_UINT32, BASE_DEC,
13208
16
      NULL, 0, "Number of Pathname component", HFILL }},
13209
13210
16
    { &hf_nfs4_component, {
13211
16
      "Name", "nfs.pathname.component", FT_STRING, BASE_NONE,
13212
16
      NULL, 0, "Pathname component", HFILL }},
13213
13214
16
    { &hf_nfs4_tag, {
13215
16
      "Tag", "nfs.tag", FT_STRING, BASE_NONE,
13216
16
      NULL, 0, NULL, HFILL }},
13217
13218
16
    { &hf_nfs4_ops_count, {
13219
16
      "Operations", "nfs.ops.count", FT_UINT32, BASE_DEC,
13220
16
      NULL, 0, "Number of Operations", HFILL }},
13221
13222
16
    { &hf_nfs4_clientid, {
13223
16
      "clientid", "nfs.clientid", FT_UINT64, BASE_HEX,
13224
16
      NULL, 0, "Client ID", HFILL }},
13225
13226
#if 0
13227
    { &hf_nfs4_ace, {
13228
      "ace", "nfs.ace", FT_STRING, BASE_NONE,
13229
      NULL, 0, "Access Control Entry", HFILL }},
13230
#endif
13231
13232
16
    { &hf_nfs4_recall, {
13233
16
      "Recall", "nfs.recall", FT_BOOLEAN, BASE_NONE,
13234
16
      TFS(&tfs_yes_no), 0x0, NULL, HFILL }},
13235
13236
16
    { &hf_nfs4_open_claim_type, {
13237
16
      "Claim Type", "nfs.open.claim_type", FT_UINT32, BASE_DEC,
13238
16
      VALS(names_claim_type4), 0, NULL, HFILL }},
13239
13240
16
    { &hf_nfs4_opentype, {
13241
16
      "Open Type", "nfs.open.opentype", FT_UINT32, BASE_DEC,
13242
16
      VALS(names_opentype4), 0, NULL, HFILL }},
13243
13244
16
    { &hf_nfs4_state_protect_how, {
13245
16
      "eia_state_protect", "nfs.exchange_id.state_protect", FT_UINT32, BASE_DEC,
13246
16
      VALS(names_state_protect_how4), 0, "State Protect How", HFILL }},
13247
13248
16
    { &hf_nfs4_limit_by, {
13249
16
      "Space Limit", "nfs.open.limit_by", FT_UINT32, BASE_DEC,
13250
16
      VALS(names_limit_by4), 0, "Limit By", HFILL }},
13251
13252
16
    { &hf_nfs4_open_delegation_type, {
13253
16
      "Delegation Type", "nfs.open.delegation_type", FT_UINT32, BASE_DEC,
13254
16
      VALS(names_open_delegation_type4), 0, NULL, HFILL }},
13255
13256
16
    { &hf_nfs4_why_no_delegation, {
13257
16
      "why no delegation", "nfs.open.why_no_delegation", FT_UINT32, BASE_DEC,
13258
16
      VALS(names_why_no_delegation4), 0, NULL, HFILL }},
13259
13260
16
    { &hf_nfs4_secinfo_style, {
13261
16
      "Secinfo Style", "nfs.secinfo.style", FT_UINT32, BASE_DEC,
13262
16
      VALS(names_secinfo_style4), 0, NULL, HFILL }},
13263
13264
16
    { &hf_nfs4_ftype, {
13265
16
      "ftype4", "nfs.nfs_ftype4", FT_UINT32, BASE_DEC,
13266
16
      VALS(names_ftype4), 0, NULL, HFILL }},
13267
13268
16
    { &hf_nfs4_change_info_atomic, {
13269
16
      "Atomic", "nfs.change_info.atomic", FT_BOOLEAN, BASE_NONE,
13270
16
      TFS(&tfs_yes_no), 0x0, NULL, HFILL }},
13271
13272
16
    { &hf_nfs4_open_share_access, {
13273
16
      "share_access", "nfs.open4.share_access", FT_UINT32, BASE_DEC | BASE_EXT_STRING,
13274
16
      &names_open4_share_access_ext, 0, NULL, HFILL }},
13275
13276
16
    { &hf_nfs4_open_share_deny, {
13277
16
      "share_deny", "nfs.open4.share_deny", FT_UINT32, BASE_DEC,
13278
16
      VALS(names_open4_share_deny), 0, NULL, HFILL }},
13279
13280
16
    { &hf_nfs4_want_flags, {
13281
16
      "wants", "nfs.want", FT_UINT32, BASE_HEX | BASE_EXT_STRING,
13282
16
      &names_open4_share_access_ext, 0, NULL, HFILL }},
13283
13284
16
    { &hf_nfs4_want_notify_flags, {
13285
16
      "want notification", "nfs.want_notification", FT_UINT32, BASE_HEX,
13286
16
      NULL, 0, NULL, HFILL }},
13287
13288
16
    { &hf_nfs4_want_signal_deleg_when_resrc_avail, {
13289
16
      "want_signal_deleg_when_resrc_avail",
13290
16
      "nfs.want_notification.when_resrc_avail", FT_BOOLEAN, 32,
13291
16
      TFS(&tfs_set_notset), OPEN4_SHARE_ACCESS_WANT_SIGNAL_DELEG_WHEN_RESRC_AVAIL, NULL, HFILL }},
13292
13293
16
    { &hf_nfs4_want_push_deleg_when_uncontended, {
13294
16
      "want_push_deleg_when_uncontended",
13295
16
      "nfs.want_push_deleg_when_uncontended", FT_BOOLEAN, 32,
13296
16
      TFS(&tfs_set_notset), OPEN4_SHARE_ACCESS_WANT_PUSH_DELEG_WHEN_UNCONTENDED, NULL, HFILL }},
13297
13298
16
    { &hf_nfs4_want_deleg_timestamps, {
13299
16
      "want_deleg_timestamps",
13300
16
      "nfs.want_deleg_timestamps", FT_BOOLEAN, 32,
13301
16
      TFS(&tfs_set_notset), OPEN4_SHARE_ACCESS_WANT_DELEG_TIMESTAMPS, NULL, HFILL }},
13302
13303
16
    { &hf_nfs4_seqid, {
13304
16
      "seqid", "nfs.seqid", FT_UINT32, BASE_HEX,
13305
16
      NULL, 0, "Sequence ID", HFILL }},
13306
13307
16
    { &hf_nfs4_lock_seqid, {
13308
16
      "lock_seqid", "nfs.lock_seqid", FT_UINT32, BASE_HEX,
13309
16
      NULL, 0, "Lock Sequence ID", HFILL }},
13310
13311
16
    { &hf_nfs4_reqd_attr, {
13312
16
      "reqd_attr", "nfs.attr", FT_UINT32, BASE_DEC | BASE_EXT_STRING,
13313
16
      &fattr4_names_ext, 0, "Required Attribute", HFILL }},
13314
13315
16
    { &hf_nfs4_reco_attr, {
13316
16
      "reco_attr", "nfs.attr", FT_UINT32, BASE_DEC | BASE_EXT_STRING,
13317
16
      &fattr4_names_ext, 0, "Recommended Attribute", HFILL }},
13318
13319
16
    { &hf_nfs4_attr_mask, {
13320
16
      "Attr mask", "nfs.attr_mask", FT_UINT32, BASE_HEX,
13321
16
      NULL, 0, "Attribute mask", HFILL }},
13322
13323
16
    { &hf_nfs4_attr_count, {
13324
16
      "Attr count", "nfs.attr_count", FT_UINT32, BASE_DEC,
13325
16
      NULL, 0, NULL, HFILL }},
13326
13327
16
    { &hf_nfs4_set_it_value_follows,  {
13328
16
      "set_it", "nfs.set_it", FT_UINT32, BASE_DEC,
13329
16
      VALS(value_follows), 0, "How To Set Time", HFILL }},
13330
13331
16
    { &hf_nfs4_time_how,  {
13332
16
      "set_it", "nfs.set_it", FT_UINT32, BASE_DEC,
13333
16
      VALS(time_how), 0, "How To Set Time", HFILL }},
13334
13335
16
    { &hf_nfs4_time_how4, {
13336
16
      "set_it", "nfs.set_it", FT_UINT32, BASE_DEC,
13337
16
      VALS(names_time_how4), 0, "How To Set Time", HFILL }},
13338
13339
16
    { &hf_nfs4_fattr_link_support, {
13340
16
      "fattr4_link_support", "nfs.fattr4_link_support", FT_BOOLEAN, BASE_NONE,
13341
16
      TFS(&tfs_yes_no), 0x0, NULL, HFILL }},
13342
13343
16
    { &hf_nfs4_fattr_symlink_support, {
13344
16
      "fattr4_symlink_support", "nfs.fattr4_symlink_support", FT_BOOLEAN, BASE_NONE,
13345
16
      TFS(&tfs_yes_no), 0x0, NULL, HFILL }},
13346
13347
16
    { &hf_nfs4_fattr_named_attr, {
13348
16
      "fattr4_named_attr", "nfs.fattr4_named_attr", FT_BOOLEAN, BASE_NONE,
13349
16
      TFS(&tfs_yes_no), 0x0, NULL, HFILL }},
13350
13351
16
    { &hf_nfs4_fattr_unique_handles, {
13352
16
      "fattr4_unique_handles", "nfs.fattr4_unique_handles", FT_BOOLEAN, BASE_NONE,
13353
16
      TFS(&tfs_yes_no), 0x0, NULL, HFILL }},
13354
13355
16
    { &hf_nfs4_fattr_archive, {
13356
16
      "fattr4_archive", "nfs.fattr4_archive", FT_BOOLEAN, BASE_NONE,
13357
16
      TFS(&tfs_yes_no), 0x0, NULL, HFILL }},
13358
13359
16
    { &hf_nfs4_fattr_cansettime, {
13360
16
      "fattr4_cansettime", "nfs.fattr4_cansettime", FT_BOOLEAN, BASE_NONE,
13361
16
      TFS(&tfs_yes_no), 0x0, NULL, HFILL }},
13362
13363
16
    { &hf_nfs4_fattr_case_insensitive, {
13364
16
      "fattr4_case_insensitive", "nfs.fattr4_case_insensitive", FT_BOOLEAN, BASE_NONE,
13365
16
      TFS(&tfs_yes_no), 0x0, NULL, HFILL }},
13366
13367
16
    { &hf_nfs4_fattr_case_preserving, {
13368
16
      "fattr4_case_preserving", "nfs.fattr4_case_preserving", FT_BOOLEAN, BASE_NONE,
13369
16
      TFS(&tfs_yes_no), 0x0, NULL, HFILL }},
13370
13371
16
    { &hf_nfs4_fattr_chown_restricted, {
13372
16
      "fattr4_chown_restricted", "nfs.fattr4_chown_restricted", FT_BOOLEAN, BASE_NONE,
13373
16
      TFS(&tfs_yes_no), 0x0, NULL, HFILL }},
13374
13375
16
    { &hf_nfs4_fattr_fh_expire_type, {
13376
16
      "fattr4_fh_expire_type", "nfs.fattr4_fh_expire_type", FT_UINT32, BASE_HEX,
13377
16
      VALS(nfs4_fattr4_fh_expire_type_names), 0, NULL, HFILL }},
13378
13379
16
    { &hf_nfs4_fattr_fh_expiry_noexpire_with_open, {
13380
16
      "noexpire_with_open", "nfs.fattr4_fh_expire_type.noexpire_with_open",
13381
16
      FT_BOOLEAN, 32,
13382
16
      NULL, FH4_NOEXPIRE_WITH_OPEN, NULL, HFILL }},
13383
16
    { &hf_nfs4_fattr_fh_expiry_volatile_any, {
13384
16
      "volatile_any", "nfs.fattr4_fh_expire_type.volatile_any",
13385
16
      FT_BOOLEAN, 32,
13386
16
      NULL, FH4_VOLATILE_ANY, NULL, HFILL }},
13387
16
    { &hf_nfs4_fattr_fh_expiry_vol_migration, {
13388
16
      "vol_migration", "nfs.fattr4_fh_expire_type.vol_migration",
13389
16
      FT_BOOLEAN, 32,
13390
16
      NULL, FH4_VOL_MIGRATION, NULL, HFILL }},
13391
16
    { &hf_nfs4_fattr_fh_expiry_vol_rename, {
13392
16
      "vol_rename", "nfs.fattr4_fh_expire_type.vol_rename",
13393
16
      FT_BOOLEAN, 32,
13394
16
      NULL, FH4_VOL_RENAME, NULL, HFILL }},
13395
13396
16
    { &hf_nfs4_fattr_hidden, {
13397
16
      "fattr4_hidden", "nfs.fattr4_hidden", FT_BOOLEAN, BASE_NONE,
13398
16
      TFS(&tfs_yes_no), 0x0, NULL, HFILL }},
13399
13400
16
    { &hf_nfs4_fattr_homogeneous, {
13401
16
      "fattr4_homogeneous", "nfs.fattr4_homogeneous", FT_BOOLEAN, BASE_NONE,
13402
16
      TFS(&tfs_yes_no), 0x0, NULL, HFILL }},
13403
13404
16
    { &hf_nfs4_fattr_mimetype, {
13405
16
      "fattr4_mimetype", "nfs.fattr4_mimetype", FT_STRING, BASE_NONE,
13406
16
      NULL, 0, NULL, HFILL }},
13407
13408
16
    { &hf_nfs4_fattr_no_trunc, {
13409
16
      "fattr4_no_trunc", "nfs.fattr4_no_trunc", FT_BOOLEAN, BASE_NONE,
13410
16
      TFS(&tfs_yes_no), 0x0, NULL, HFILL }},
13411
13412
16
    { &hf_nfs4_fattr_system, {
13413
16
      "fattr4_system", "nfs.fattr4_system", FT_BOOLEAN, BASE_NONE,
13414
16
      TFS(&tfs_yes_no), 0x0, NULL, HFILL }},
13415
13416
16
    { &hf_nfs4_who, {
13417
16
      "Who", "nfs.who", FT_STRING, BASE_NONE,
13418
16
      NULL, 0, NULL, HFILL }},
13419
13420
16
    { &hf_nfs4_server, {
13421
16
      "server", "nfs.server", FT_STRING, BASE_NONE,
13422
16
      NULL, 0, NULL, HFILL }},
13423
13424
16
    { &hf_nfs4_servers, {
13425
16
      "servers", "nfs.servers", FT_NONE, BASE_NONE,
13426
16
      NULL, 0, NULL, HFILL }},
13427
13428
16
    { &hf_nfs4_fslocation, {
13429
16
      "fs_location4", "nfs.fattr4.fs_location", FT_NONE, BASE_NONE,
13430
16
      NULL, 0, NULL, HFILL }},
13431
13432
16
    { &hf_nfs4_fattr_owner, {
13433
16
      "fattr4_owner", "nfs.fattr4_owner", FT_STRING, BASE_NONE,
13434
16
      NULL, 0, NULL, HFILL }},
13435
13436
16
    { &hf_nfs4_fattr_owner_group, {
13437
16
      "fattr4_owner_group", "nfs.fattr4_owner_group", FT_STRING, BASE_NONE,
13438
16
      NULL, 0, NULL, HFILL }},
13439
13440
16
    { &hf_nfs4_stable_how, {
13441
16
      "stable_how4", "nfs.stable_how4", FT_UINT32, BASE_DEC,
13442
16
      VALS(names_stable_how4), 0, NULL, HFILL }},
13443
13444
16
    { &hf_nfs4_dirlist_eof, {
13445
16
      "EOF", "nfs.dirlist4.eof", FT_BOOLEAN, BASE_NONE,
13446
16
      TFS(&tfs_yes_no), 0x0, "There are no more entries", HFILL }},
13447
13448
    /* StateID */
13449
16
    { &hf_nfs4_stateid,{
13450
16
      "StateID", "nfs.stateid", FT_BYTES, BASE_NONE,
13451
16
      NULL, 0, NULL, HFILL }},
13452
16
    { &hf_nfs4_stateid_hash,{
13453
16
      "StateID Hash", "nfs.stateid.hash", FT_UINT16, BASE_HEX,
13454
16
      NULL, 0, "CRC-16 hash", HFILL }},
13455
16
    { &hf_nfs4_seqid_stateid, {
13456
16
      "StateID seqid", "nfs.stateid.seqid", FT_UINT32, BASE_DEC,
13457
16
      NULL, 0, NULL, HFILL }},
13458
16
    { &hf_nfs4_stateid_other,{
13459
16
      "StateID Other", "nfs.stateid.other", FT_BYTES, BASE_NONE,
13460
16
      NULL, 0, "Unique component of StateID", HFILL }},
13461
16
    { &hf_nfs4_stateid_other_hash,{
13462
16
      "StateID Other hash", "nfs.stateid.other_hash", FT_UINT32, BASE_HEX,
13463
16
      NULL, 0, "CRC-32 hash", HFILL }},
13464
13465
16
    { &hf_nfs4_offset, {
13466
16
      "offset", "nfs.offset4", FT_UINT64, BASE_DEC,
13467
16
      NULL, 0, NULL, HFILL }},
13468
13469
16
    { &hf_nfs4_specdata1, {
13470
16
      "specdata1", "nfs.specdata1", FT_UINT32, BASE_DEC,
13471
16
      NULL, 0, NULL, HFILL }},
13472
13473
16
    { &hf_nfs4_specdata2, {
13474
16
      "specdata2", "nfs.specdata2", FT_UINT32, BASE_DEC,
13475
16
      NULL, 0, NULL, HFILL }},
13476
13477
16
    { &hf_nfs4_lock_type, {
13478
16
      "locktype", "nfs.locktype4", FT_UINT32, BASE_DEC,
13479
16
      VALS(names_nfs_lock_type4), 0, NULL, HFILL }},
13480
13481
16
    { &hf_nfs4_open_rflags, {
13482
16
      "result flags", "nfs.open_rflags", FT_UINT32, BASE_HEX,
13483
16
      NULL, 0, NULL, HFILL }},
13484
13485
16
    { &hf_nfs4_open_rflags_confirm, {
13486
16
      "confirm", "nfs.open_rflags.confirm",
13487
16
      FT_BOOLEAN, 32,
13488
16
      NULL, OPEN4_RESULT_CONFIRM, NULL, HFILL }},
13489
13490
16
    { &hf_nfs4_open_rflags_locktype_posix, {
13491
16
      "locktype posix", "nfs.open_rflags.locktype_posix",
13492
16
      FT_BOOLEAN, 32,
13493
16
      NULL, OPEN4_RESULT_LOCKTYPE_POSIX, NULL, HFILL }},
13494
13495
16
    { &hf_nfs4_open_rflags_preserve_unlinked, {
13496
16
      "preserve unlinked", "nfs.open_rflags.preserve_unlinked",
13497
16
      FT_BOOLEAN, 32,
13498
16
      NULL, OPEN4_RESULT_PRESERVE_UNLINKED, NULL, HFILL }},
13499
13500
16
    { &hf_nfs4_open_rflags_may_notify_lock, {
13501
16
      "may notify lock", "nfs.open_rflags.may_notify_lock",
13502
16
      FT_BOOLEAN, 32,
13503
16
      NULL, OPEN4_RESULT_MAY_NOTIFY_LOCK, NULL, HFILL }},
13504
13505
16
    { &hf_nfs4_reclaim, {
13506
16
      "reclaim", "nfs.reclaim4", FT_BOOLEAN, BASE_NONE,
13507
16
      TFS(&tfs_yes_no), 0x0, NULL, HFILL }},
13508
13509
16
    { &hf_nfs4_length, {
13510
16
      "length", "nfs.length4", FT_UINT64, BASE_DEC,
13511
16
      NULL, 0, NULL, HFILL }},
13512
13513
16
    { &hf_nfs4_changeid, {
13514
16
      "changeid", "nfs.changeid4", FT_UINT64, BASE_DEC,
13515
16
      NULL, 0, NULL, HFILL }},
13516
13517
16
    { &hf_nfs4_changeid_before, {
13518
16
      "changeid (before)", "nfs.changeid4.before", FT_UINT64, BASE_DEC,
13519
16
      NULL, 0, NULL, HFILL }},
13520
13521
16
    { &hf_nfs4_changeid_after, {
13522
16
      "changeid (after)", "nfs.changeid4.after", FT_UINT64, BASE_DEC,
13523
16
      NULL, 0, NULL, HFILL }},
13524
13525
16
    { &hf_nfs4_time, {
13526
16
      "nfstime4", "nfs.nfstime4", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL,
13527
16
      NULL, 0, NULL, HFILL }},
13528
13529
16
    { &hf_nfs4_time_seconds, {
13530
16
      "seconds", "nfs.nfstime4.seconds", FT_UINT64, BASE_DEC,
13531
16
      NULL, 0, NULL, HFILL }},
13532
13533
16
    { &hf_nfs4_time_nseconds, {
13534
16
      "nseconds", "nfs.nfstime4.nseconds", FT_UINT32, BASE_DEC,
13535
16
      NULL, 0, NULL, HFILL }},
13536
13537
16
    { &hf_nfs4_fsid_major, {
13538
16
      "fsid4.major", "nfs.fsid4.major", FT_UINT64, BASE_DEC,
13539
16
      NULL, 0, NULL, HFILL }},
13540
13541
16
    { &hf_nfs4_fsid_minor, {
13542
16
      "fsid4.minor", "nfs.fsid4.minor", FT_UINT64, BASE_DEC,
13543
16
      NULL, 0, NULL, HFILL }},
13544
13545
16
    { &hf_nfs4_acetype, {
13546
16
      "acetype", "nfs.acetype4", FT_UINT32, BASE_DEC,
13547
16
      VALS(names_acetype4), 0, NULL, HFILL }},
13548
13549
16
    { &hf_nfs4_aceflags, {
13550
16
      "ACE flags", "nfs.aceflags4", FT_UINT32, BASE_HEX,
13551
16
      NULL, 0, NULL, HFILL }},
13552
13553
16
    { &hf_nfs4_aceflag_file_inherit, {
13554
16
      "File_Inherit", "nfs.aceflag4.file_inherit", FT_BOOLEAN, 32,
13555
16
      TFS(&tfs_yes_no), ACE4_FLAG_FILE_INHERIT, NULL, HFILL }},
13556
13557
16
    { &hf_nfs4_aceflag_dir_inherit, {
13558
16
      "Directory_Inherit", "nfs.aceflag4.dir_inherit", FT_BOOLEAN, 32,
13559
16
      TFS(&tfs_yes_no), ACE4_FLAG_DIRECTORY_INHERIT, NULL, HFILL }},
13560
13561
16
    { &hf_nfs4_aceflag_no_prop_inherit, {
13562
16
      "No_Propagate_Inherit", "nfs.aceflag4.no_prop_inherit", FT_BOOLEAN, 32,
13563
16
      TFS(&tfs_yes_no), ACE4_FLAG_NO_PROPAGATE_INHERIT, NULL, HFILL }},
13564
13565
16
    { &hf_nfs4_aceflag_inherit_only, {
13566
16
      "Inherit_Only", "nfs.aceflag4.inherit_only", FT_BOOLEAN, 32,
13567
16
      TFS(&tfs_yes_no), ACE4_FLAG_INHERIT_ONLY, NULL, HFILL }},
13568
13569
16
    { &hf_nfs4_aceflag_successful_access, {
13570
16
      "Successful_Access", "nfs.aceflag4.successful_access", FT_BOOLEAN, 32,
13571
16
      TFS(&tfs_yes_no), ACE4_FLAG_SUCCESSFUL_ACCESS, NULL, HFILL }},
13572
13573
16
    { &hf_nfs4_aceflag_failed_access, {
13574
16
      "Failed_access", "nfs.aceflag4.failed_access", FT_BOOLEAN, 32,
13575
16
      TFS(&tfs_yes_no), ACE4_FLAG_FAILED_ACCESS, NULL, HFILL }},
13576
13577
16
    { &hf_nfs4_aceflag_id_group, {
13578
16
      "Identifier_Group", "nfs.aceflag4.id_group", FT_BOOLEAN, 32,
13579
16
      TFS(&tfs_yes_no), ACE4_FLAG_IDENTIFIER_GROUP, NULL, HFILL }},
13580
13581
16
    { &hf_nfs4_aceflag_inherited_ace, {
13582
16
      "Inherited_ACE", "nfs.aceflag4.inherited_ace", FT_BOOLEAN, 32,
13583
16
      TFS(&tfs_yes_no), ACE4_FLAG_INHERITED_ACE, NULL, HFILL }},
13584
13585
16
    { &hf_nfs4_acemask, {
13586
16
      "ACE mask", "nfs.acemask4", FT_UINT32, BASE_HEX,
13587
16
      NULL, 0, NULL, HFILL }},
13588
13589
16
    { &hf_nfs4_ace_permission, {
13590
16
      "perm", "nfs.ace_perm4", FT_UINT32, BASE_HEX,
13591
16
      NULL, 0, NULL, HFILL }},
13592
13593
16
    { &hf_nfs4_fattr_size, {
13594
16
      "size", "nfs.fattr4.size", FT_UINT64, BASE_DEC,
13595
16
      NULL, 0, NULL, HFILL }},
13596
13597
16
    { &hf_nfs4_fattr_lease_time, {
13598
16
      "lease_time", "nfs.fattr4.lease_time", FT_UINT32, BASE_DEC,
13599
16
      NULL, 0, "Duration of the lease at server in seconds", HFILL }},
13600
13601
16
    { &hf_nfs4_fattr_aclsupport, {
13602
16
      "aclsupport", "nfs.fattr4.aclsupport", FT_UINT32, BASE_DEC,
13603
16
      NULL, 0, NULL, HFILL }},
13604
13605
16
    { &hf_nfs4_aclsupport_allow_acl, {
13606
16
      "ALLOW", "nfs.fattr4.aclsupport.allow_acl", FT_BOOLEAN, 32,
13607
16
      NULL, ACL4_SUPPORT_ALLOW_ACL, NULL, HFILL }},
13608
13609
16
    { &hf_nfs4_aclsupport_deny_acl, {
13610
16
      "DENY", "nfs.fattr4.aclsupport.deny_acl", FT_BOOLEAN, 32,
13611
16
      NULL, ACL4_SUPPORT_DENY_ACL, NULL, HFILL }},
13612
13613
16
    { &hf_nfs4_aclsupport_audit_acl, {
13614
16
      "AUDIT", "nfs.fattr4.aclsupport.audit_acl", FT_BOOLEAN, 32,
13615
16
      NULL, ACL4_SUPPORT_AUDIT_ACL, NULL, HFILL }},
13616
13617
16
    { &hf_nfs4_aclsupport_alarm_acl, {
13618
16
      "ALARM", "nfs.fattr4.aclsupport.alarm_acl", FT_BOOLEAN, 32,
13619
16
      NULL, ACL4_SUPPORT_ALARM_ACL, NULL, HFILL }},
13620
13621
16
    { &hf_nfs4_fattr_fileid, {
13622
16
      "fileid", "nfs.fattr4.fileid", FT_UINT64, BASE_DEC,
13623
16
      NULL, 0, NULL, HFILL }},
13624
13625
16
    { &hf_nfs4_fattr_files_avail, {
13626
16
      "files_avail", "nfs.fattr4.files_avail", FT_UINT64, BASE_DEC,
13627
16
      NULL, 0, NULL, HFILL }},
13628
13629
16
    { &hf_nfs4_fattr_files_free, {
13630
16
      "files_free", "nfs.fattr4.files_free", FT_UINT64, BASE_DEC,
13631
16
      NULL, 0, NULL, HFILL }},
13632
13633
16
    { &hf_nfs4_fattr_files_total, {
13634
16
      "files_total", "nfs.fattr4.files_total", FT_UINT64, BASE_DEC,
13635
16
      NULL, 0, NULL, HFILL }},
13636
13637
16
    { &hf_nfs4_fattr_maxfilesize, {
13638
16
      "maxfilesize", "nfs.fattr4.maxfilesize", FT_UINT64, BASE_DEC,
13639
16
      NULL, 0, NULL, HFILL }},
13640
13641
16
    { &hf_nfs4_fattr_maxlink, {
13642
16
      "maxlink", "nfs.fattr4.maxlink", FT_UINT32, BASE_DEC,
13643
16
      NULL, 0, NULL, HFILL }},
13644
13645
16
    { &hf_nfs4_fattr_maxname, {
13646
16
      "maxname", "nfs.fattr4.maxname", FT_UINT32, BASE_DEC,
13647
16
      NULL, 0, NULL, HFILL }},
13648
13649
16
    { &hf_nfs4_fattr_numlinks, {
13650
16
      "numlinks", "nfs.fattr4.numlinks", FT_UINT32, BASE_DEC,
13651
16
      NULL, 0, NULL, HFILL }},
13652
13653
16
    { &hf_nfs4_delegate_type, {
13654
16
      "delegate_type", "nfs.delegate_type", FT_UINT32, BASE_DEC,
13655
16
      NULL, 0, NULL, HFILL }},
13656
13657
16
    { &hf_nfs4_secinfo_flavor, {
13658
16
      "flavor", "nfs.secinfo.flavor", FT_UINT32, BASE_DEC,
13659
16
      VALS(rpc_auth_flavor), 0, NULL, HFILL }},
13660
13661
16
    { &hf_nfs4_num_blocks, {
13662
16
      "num_blocks", "nfs.num_blocks", FT_UINT32, BASE_DEC,
13663
16
      NULL, 0, NULL, HFILL }},
13664
13665
16
    { &hf_nfs4_bytes_per_block, {
13666
16
      "bytes_per_block", "nfs.bytes_per_block", FT_UINT32, BASE_DEC,
13667
16
      NULL, 0, NULL, HFILL }},
13668
13669
16
    { &hf_nfs4_eof, {
13670
16
      "eof", "nfs.eof", FT_UINT32, BASE_DEC,
13671
16
      NULL, 0, NULL, HFILL }},
13672
13673
16
    { &hf_nfs4_fattr_maxread, {
13674
16
      "maxread", "nfs.fattr4.maxread", FT_UINT64, BASE_DEC,
13675
16
      NULL, 0, NULL, HFILL }},
13676
13677
16
    { &hf_nfs4_fattr_maxwrite, {
13678
16
      "maxwrite", "nfs.fattr4.maxwrite", FT_UINT64, BASE_DEC,
13679
16
      NULL, 0, NULL, HFILL }},
13680
13681
16
    { &hf_nfs4_fattr_quota_hard, {
13682
16
      "quota_hard", "nfs.fattr4.quota_hard", FT_UINT64, BASE_DEC,
13683
16
      NULL, 0, NULL, HFILL }},
13684
13685
16
    { &hf_nfs4_fattr_quota_soft, {
13686
16
      "quota_soft", "nfs.fattr4.quota_soft", FT_UINT64, BASE_DEC,
13687
16
      NULL, 0, NULL, HFILL }},
13688
13689
16
    { &hf_nfs4_fattr_quota_used, {
13690
16
      "quota_used", "nfs.fattr4.quota_used", FT_UINT64, BASE_DEC,
13691
16
      NULL, 0, NULL, HFILL }},
13692
13693
16
    { &hf_nfs4_fattr_space_avail, {
13694
16
      "space_avail", "nfs.fattr4.space_avail", FT_UINT64, BASE_DEC,
13695
16
      NULL, 0, NULL, HFILL }},
13696
13697
16
    { &hf_nfs4_fattr_space_free, {
13698
16
      "space_free", "nfs.fattr4.space_free", FT_UINT64, BASE_DEC,
13699
16
      NULL, 0, NULL, HFILL }},
13700
13701
16
    { &hf_nfs4_fattr_space_total, {
13702
16
      "space_total", "nfs.fattr4.space_total", FT_UINT64, BASE_DEC,
13703
16
      NULL, 0, NULL, HFILL }},
13704
13705
16
    { &hf_nfs4_fattr_space_used, {
13706
16
      "space_used", "nfs.fattr4.space_used", FT_UINT64, BASE_DEC,
13707
16
      NULL, 0, NULL, HFILL }},
13708
13709
16
    { &hf_nfs4_fattr_mounted_on_fileid, {
13710
16
      "fileid", "nfs.fattr4.mounted_on_fileid", FT_UINT64, BASE_DEC,
13711
16
      NULL, 0, NULL, HFILL }},
13712
13713
16
    { &hf_nfs4_fattr_layout_blksize, {
13714
16
      "blksize", "nfs.fattr4.layout_blksize", FT_UINT32, BASE_DEC,
13715
16
      NULL, 0, NULL, HFILL }},
13716
13717
16
    { &hf_nfs4_mdsthreshold_item, {
13718
16
      "threshold_item4", "nfs.fattr4.threshold_item", FT_NONE, BASE_NONE,
13719
16
      NULL, 0, NULL, HFILL }},
13720
13721
16
    { &hf_nfs4_mdsthreshold_hint_mask, {
13722
16
      "hint mask", "nfs.fattr4.threshold_item.hint_mask", FT_UINT32, BASE_HEX,
13723
16
      NULL, 0, "MDS threshold hint mask", HFILL }},
13724
13725
16
    { &hf_nfs4_mdsthreshold_hint_count, {
13726
16
      "hint", "nfs.fattr4.threshold_item.hint_count", FT_UINT32, BASE_DEC,
13727
16
      NULL, 0, "MDS threshold hint count", HFILL }},
13728
13729
16
    { &hf_nfs4_mdsthreshold_mask_count, {
13730
16
      "number of masks", "nfs.fattr4.threshold_item.mask_count", FT_UINT32, BASE_DEC,
13731
16
      NULL, 0, "MDS threshold hint mask count", HFILL }},
13732
13733
16
    { &hf_nfs4_mdsthreshold_hint_file, {
13734
16
      "hint", "nfs.fattr4.threshold_item.hint", FT_UINT32, BASE_DEC | BASE_EXT_STRING,
13735
16
      &th4_names_ext_file, 0, "MDS threshold hint", HFILL }},
13736
13737
16
    { &hf_nfs4_fattr_security_label_lfs, {
13738
16
      "label_format", "nfs.fattr4.security_label.lfs", FT_UINT32, BASE_DEC,
13739
16
      NULL, 0, NULL, HFILL }},
13740
13741
16
    { &hf_nfs4_fattr_umask_mask, {
13742
16
      "umask", "nfs.fattr4.umask", FT_UINT32, BASE_OCT,
13743
16
      NULL, 0, NULL, HFILL }},
13744
13745
16
    { &hf_nfs4_fattr_xattr_support, {
13746
16
      "fattr4_xattr_support", "nfs.fattr4_xattr_support", FT_BOOLEAN, BASE_NONE,
13747
16
      TFS(&tfs_yes_no), 0x0, NULL, HFILL }},
13748
13749
16
    { &hf_nfs4_fattr_offline, {
13750
16
      "fattr4_offline", "nfs.fattr4_offline", FT_BOOLEAN, BASE_NONE,
13751
16
      TFS(&tfs_yes_no), 0x0, NULL, HFILL }},
13752
13753
16
    { &hf_nfs4_fattr_security_label_pi, {
13754
16
      "policy_id", "nfs.fattr4.security_label.pi", FT_UINT32, BASE_DEC,
13755
16
      NULL, 0, NULL, HFILL }},
13756
13757
16
    { &hf_nfs4_fattr_security_label_context, {
13758
16
      "context", "nfs.fattr4.security_label.context", FT_STRING, BASE_NONE,
13759
16
      NULL, 0, NULL, HFILL }},
13760
13761
16
    { &hf_nfs4_fattr_fs_charset_cap, {
13762
16
      "fs_charset_cap", "nfs.fattr4.fs_charset_cap", FT_UINT32, BASE_HEX,
13763
16
      NULL, 0, NULL, HFILL }},
13764
13765
16
    { &hf_nfs4_fs_charset_cap_nonutf8, {
13766
16
      "CONTAINS_NON_UTF8", "nfs.fattr4.fs_charset_cap.nonutf8", FT_BOOLEAN, 32,
13767
16
      NULL, FSCHARSET_CAP4_CONTAINS_NON_UTF8, NULL, HFILL }},
13768
13769
16
    { &hf_nfs4_fs_charset_cap_utf8, {
13770
16
      "ALLOWS_ONLY_UTF8", "nfs.fattr4.fs_charset_cap.utf8", FT_BOOLEAN, 32,
13771
16
      NULL, FSCHARSET_CAP4_ALLOWS_ONLY_UTF8, NULL, HFILL }},
13772
13773
16
    { &hf_nfs4_verifier, {
13774
16
      "verifier", "nfs.verifier4", FT_UINT64, BASE_HEX,
13775
16
      NULL, 0, NULL, HFILL }},
13776
13777
16
    { &hf_nfs4_value_follows, {
13778
16
      "Value Follows", "nfs.value_follows", FT_BOOLEAN, BASE_NONE,
13779
16
      TFS(&tfs_yes_no), 0x0, NULL, HFILL }},
13780
13781
16
    { &hf_nfs4_cookie, {
13782
16
      "cookie", "nfs.cookie4", FT_UINT64, BASE_DEC,
13783
16
      NULL, 0, NULL, HFILL }},
13784
13785
16
    { &hf_nfs4_cookie_verf, {
13786
16
      "cookie_verf", "nfs.cookie_verf4", FT_UINT64, BASE_DEC,
13787
16
      NULL, 0, NULL, HFILL }},
13788
13789
#if 0
13790
    { &hf_nfs4_cb_location, {
13791
      "cb_location", "nfs.cb_location", FT_UINT32, BASE_DEC,
13792
      NULL, 0, NULL, HFILL }},
13793
#endif
13794
13795
16
    { &hf_nfs4_cb_program, {
13796
16
      "cb_program", "nfs.cb_program", FT_UINT32, BASE_HEX,
13797
16
      NULL, 0, NULL, HFILL }},
13798
13799
16
    { &hf_nfs4_recall4, {
13800
16
      "recall", "nfs.recall4", FT_BOOLEAN, BASE_NONE,
13801
16
      TFS(&tfs_yes_no), 0x0, NULL, HFILL }},
13802
13803
16
    { &hf_nfs4_filesize, {
13804
16
      "filesize", "nfs.filesize", FT_UINT64, BASE_DEC,
13805
16
      NULL, 0, NULL, HFILL }},
13806
13807
16
    { &hf_nfs4_count, {
13808
16
      "count", "nfs.count4", FT_UINT32, BASE_DEC,
13809
16
      NULL, 0, NULL, HFILL }},
13810
13811
16
    { &hf_nfs4_count_dircount, {
13812
16
      "dircount", "nfs.dircount", FT_UINT32, BASE_DEC,
13813
16
      NULL, 0, NULL, HFILL }},
13814
13815
16
    { &hf_nfs4_count_maxcount, {
13816
16
      "maxcount", "nfs.maxcount", FT_UINT32, BASE_DEC,
13817
16
      NULL, 0, NULL, HFILL }},
13818
13819
16
    { &hf_nfs4_minorversion, {
13820
16
      "minorversion", "nfs.minorversion", FT_UINT32, BASE_DEC,
13821
16
      NULL, 0, NULL, HFILL }},
13822
13823
16
    { &hf_nfs_atime, {
13824
16
      "atime", "nfs.atime", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL,
13825
16
      NULL, 0, "Access Time", HFILL }},
13826
13827
16
    { &hf_nfs_atime_sec, {
13828
16
      "seconds", "nfs.atime.sec", FT_UINT32, BASE_DEC,
13829
16
      NULL, 0, "Access Time, Seconds", HFILL }},
13830
13831
16
    { &hf_nfs_atime_nsec, {
13832
16
      "nano seconds", "nfs.atime.nsec", FT_UINT32, BASE_DEC,
13833
16
      NULL, 0, "Access Time, Nano-seconds", HFILL }},
13834
13835
16
    { &hf_nfs_atime_usec, {
13836
16
      "micro seconds", "nfs.atime.usec", FT_UINT32, BASE_DEC,
13837
16
      NULL, 0, "Access Time, Micro-seconds", HFILL }},
13838
13839
16
    { &hf_nfs_mtime, {
13840
16
      "mtime", "nfs.mtime", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL,
13841
16
      NULL, 0, "Modify Time", HFILL }},
13842
13843
16
    { &hf_nfs_mtime_sec, {
13844
16
      "seconds", "nfs.mtime.sec", FT_UINT32, BASE_DEC,
13845
16
      NULL, 0, "Modify Seconds", HFILL }},
13846
13847
16
    { &hf_nfs_mtime_nsec, {
13848
16
      "nano seconds", "nfs.mtime.nsec", FT_UINT32, BASE_DEC,
13849
16
      NULL, 0, "Modify Time, Nano-seconds", HFILL }},
13850
13851
16
    { &hf_nfs_mtime_usec, {
13852
16
      "micro seconds", "nfs.mtime.usec", FT_UINT32, BASE_DEC,
13853
16
      NULL, 0, "Modify Time, Micro-seconds", HFILL }},
13854
13855
16
    { &hf_nfs_ctime, {
13856
16
      "ctime", "nfs.ctime", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL,
13857
16
      NULL, 0, "Creation Time", HFILL }},
13858
13859
16
    { &hf_nfs_ctime_sec, {
13860
16
      "seconds", "nfs.ctime.sec", FT_UINT32, BASE_DEC,
13861
16
      NULL, 0, "Creation Time, Seconds", HFILL }},
13862
13863
16
    { &hf_nfs_ctime_nsec, {
13864
16
      "nano seconds", "nfs.ctime.nsec", FT_UINT32, BASE_DEC,
13865
16
      NULL, 0, "Creation Time, Nano-seconds", HFILL }},
13866
13867
16
    { &hf_nfs_ctime_usec, {
13868
16
      "micro seconds", "nfs.ctime.usec", FT_UINT32, BASE_DEC,
13869
16
      NULL, 0, "Creation Time, Micro-seconds", HFILL }},
13870
13871
16
    { &hf_nfs_dtime, {
13872
16
      "time delta", "nfs.dtime", FT_RELATIVE_TIME, BASE_NONE,
13873
16
      NULL, 0, NULL, HFILL }},
13874
13875
16
    { &hf_nfs_dtime_sec, {
13876
16
      "seconds", "nfs.dtime.sec", FT_UINT32, BASE_DEC,
13877
16
      NULL, 0, "Time Delta, Seconds", HFILL }},
13878
13879
16
    { &hf_nfs_dtime_nsec, {
13880
16
      "nano seconds", "nfs.dtime.nsec", FT_UINT32, BASE_DEC,
13881
16
      NULL, 0, "Time Delta, Nano-seconds", HFILL }},
13882
13883
16
    { &hf_nfs4_open_owner, {
13884
16
      "owner", "nfs.open_owner4", FT_BYTES, BASE_NONE,
13885
16
      NULL, 0, NULL, HFILL }},
13886
13887
16
    { &hf_nfs4_lock_owner, {
13888
16
      "owner", "nfs.lock_owner4", FT_BYTES, BASE_NONE,
13889
16
      NULL, 0, NULL, HFILL }},
13890
13891
16
    { &hf_nfs4_createmode, {
13892
16
      "Create Mode", "nfs.createmode4", FT_UINT32, BASE_DEC,
13893
16
      VALS(names_createmode4), 0, NULL, HFILL }},
13894
13895
16
    { &hf_nfs4_secinfo_rpcsec_gss_info_service, {
13896
16
      "service", "nfs.secinfo.rpcsec_gss_info.service", FT_UINT32, BASE_DEC,
13897
16
      VALS(rpc_authgss_svc), 0, NULL, HFILL }},
13898
13899
16
    { &hf_nfs4_attr_dir_create, {
13900
16
      "attribute dir create", "nfs.openattr4.createdir", FT_BOOLEAN, BASE_NONE,
13901
16
      TFS(&tfs_yes_no), 0x0, NULL, HFILL }},
13902
13903
16
    { &hf_nfs4_new_lock_owner, {
13904
16
      "new lock owner?", "nfs.lock.locker.new_lock_owner", FT_BOOLEAN, BASE_NONE,
13905
16
      TFS(&tfs_yes_no), 0x0, NULL, HFILL }},
13906
13907
16
    { &hf_nfs4_ond_server_will_push_deleg, {
13908
16
      "server will push deleg?", "nfs.ond.server_will_push_deleg", FT_BOOLEAN, BASE_NONE,
13909
16
      TFS(&tfs_yes_no), 0x0, NULL, HFILL }},
13910
13911
16
    { &hf_nfs4_ond_server_will_signal_avail, {
13912
16
      "server will signal avail?", "nfs.ond.server_will_signal-avail", FT_BOOLEAN, BASE_NONE,
13913
16
      TFS(&tfs_yes_no), 0x0, NULL, HFILL }},
13914
13915
16
    { &hf_nfs4_lock_reclaim, {
13916
16
      "reclaim?", "nfs.lock.reclaim", FT_BOOLEAN, BASE_NONE,
13917
16
      TFS(&tfs_yes_no), 0x0, NULL, HFILL }},
13918
13919
16
    { &hf_nfs4_sec_oid, {
13920
16
      "oid", "nfs.secinfo.flavor_info.rpcsec_gss_info.oid", FT_OID, BASE_NONE,
13921
16
      NULL, 0, NULL, HFILL }},
13922
13923
16
    { &hf_nfs4_qop, {
13924
16
      "qop", "nfs.secinfo.flavor_info.rpcsec_gss_info.qop", FT_UINT32, BASE_DEC,
13925
16
      NULL, 0, NULL, HFILL }},
13926
13927
16
    { &hf_nfs4_client_id, {
13928
16
      "id", "nfs.nfs_client_id4.id", FT_BYTES, BASE_NONE,
13929
16
      NULL, 0, NULL, HFILL }},
13930
13931
16
    { &hf_nfs4_aclflags, {
13932
16
      "ACL flags", "nfs.acl.flags", FT_UINT32, BASE_DEC,
13933
16
      NULL, 0, NULL, HFILL }},
13934
13935
16
    { &hf_nfs4_aclflag_auto_inherit, {
13936
16
      "AUTO_INHERIT", "nfs.acl.flags.auto_inherit", FT_BOOLEAN, 32,
13937
16
      NULL, ACL4_AUTO_INHERIT, NULL, HFILL }},
13938
13939
16
    { &hf_nfs4_aclflag_protected, {
13940
16
      "PROTECTED", "nfs.acl.flags.protected", FT_BOOLEAN, 32,
13941
16
      NULL, ACL4_PROTECTED, NULL, HFILL }},
13942
13943
16
    { &hf_nfs4_aclflag_defaulted, {
13944
16
      "DEFAULTED", "nfs.acl.flags.defaulted", FT_BOOLEAN, 32,
13945
16
      NULL, ACL4_DEFAULTED, NULL, HFILL }},
13946
13947
16
    { &hf_nfs4_num_aces, {
13948
16
      "ACE count", "nfs.num_aces", FT_UINT32, BASE_DEC,
13949
16
      NULL, 0, "Number of ACEs", HFILL }},
13950
13951
16
    { &hf_nfs4_callback_ident, {
13952
16
      "callback_ident", "nfs.callback.ident", FT_UINT32, BASE_HEX,
13953
16
      NULL, 0, "Callback Identifier", HFILL }},
13954
13955
16
    { &hf_nfs4_gsshandle, {
13956
16
      "gsshandle4", "nfs.gsshandle4", FT_BYTES, BASE_NONE,
13957
16
      NULL, 0, NULL, HFILL }},
13958
13959
16
    { &hf_nfs4_r_netid, {
13960
16
      "r_netid", "nfs.r_netid", FT_STRING, BASE_NONE,
13961
16
      NULL, 0, NULL, HFILL }},
13962
13963
16
    { &hf_nfs4_r_addr, {
13964
16
      "r_addr", "nfs.r_addr", FT_STRING, BASE_NONE,
13965
16
      NULL, 0, NULL, HFILL }},
13966
13967
16
    { &hf_nfs_fh_fhandle_data, {
13968
16
      "FileHandle", "nfs.fhandle", FT_BYTES, BASE_NONE,
13969
16
      NULL, 0, "Opaque nfs filehandle", HFILL }},
13970
13971
16
    { &hf_nfs4_secinfo_arr, {
13972
16
      "Flavors Info", "nfs.flavors.info", FT_NONE, BASE_NONE,
13973
16
      NULL, 0, NULL, HFILL }},
13974
13975
16
    { &hf_nfs3_gxfh_utlfield, {
13976
16
      "utility", "nfs.gxfh3.utility", FT_UINT8, BASE_HEX,
13977
16
      NULL, 0, NULL, HFILL }},
13978
13979
16
    { &hf_nfs3_gxfh_utlfield_tree, {
13980
16
      "tree R/W", "nfs.gxfh3.utlfield.tree", FT_BOOLEAN, 8,
13981
16
      TFS(&tfs_read_write), NFS3GX_FH_TREE_MASK, NULL, HFILL }},
13982
13983
16
    { &hf_nfs3_gxfh_utlfield_jun, {
13984
16
      "broken junction", "nfs.gxfh3.utlfield.junction", FT_BOOLEAN, 8,
13985
16
      TFS(&tfs_yes_no), NFS3GX_FH_JUN_MASK, NULL, HFILL }},
13986
13987
16
    { &hf_nfs3_gxfh_utlfield_ver, {
13988
16
      "file handle version", "nfs.gxfh3.utlfield.version", FT_UINT8, BASE_HEX,
13989
16
      NULL, NFS3GX_FH_VER_MASK, NULL, HFILL }},
13990
13991
16
    { &hf_nfs3_gxfh_volcnt, {
13992
16
      "volume count", "nfs.gxfh3.volcnt", FT_UINT8, BASE_HEX_DEC,
13993
16
      NULL, 0, NULL, HFILL }},
13994
13995
16
    { &hf_nfs3_gxfh_epoch, {
13996
16
      "epoch", "nfs.gxfh3.epoch", FT_UINT16, BASE_HEX_DEC,
13997
16
      NULL, 0, NULL, HFILL }},
13998
13999
16
    { &hf_nfs3_gxfh_ldsid, {
14000
16
      "local dsid", "nfs.gxfh3.ldsid", FT_UINT32, BASE_HEX_DEC,
14001
16
      NULL, 0, NULL, HFILL }},
14002
14003
16
    { &hf_nfs3_gxfh_cid, {
14004
16
      "cluster id", "nfs.gxfh3.cid", FT_UINT16, BASE_HEX_DEC,
14005
16
      NULL, 0, NULL, HFILL }},
14006
14007
16
    { &hf_nfs3_gxfh_resv, {
14008
16
      "reserved", "nfs.gxfh3.reserved", FT_UINT16, BASE_HEX_DEC,
14009
16
      NULL, 0, NULL, HFILL }},
14010
14011
16
    { &hf_nfs3_gxfh_sfhflags, {
14012
16
      "flags", "nfs.gxfh3.sfhflags", FT_UINT8, BASE_HEX,
14013
16
      NULL, 0, NULL, HFILL }},
14014
14015
16
    { &hf_nfs3_gxfh_sfhflags_resv1, {
14016
16
      "reserved", "nfs.gxfh3.sfhflags.reserve1", FT_UINT8, BASE_HEX,
14017
16
      NULL, SPINNP_FH_FLAG_RESV1, NULL, HFILL }},
14018
14019
16
    { &hf_nfs3_gxfh_sfhflags_resv2, {
14020
16
      "reserved", "nfs.gxfh3.sfhflags.reserv2", FT_UINT8, BASE_HEX,
14021
16
      NULL, SPINNP_FH_FLAG_RESV2, NULL, HFILL }},
14022
14023
16
    { &hf_nfs3_gxfh_sfhflags_ontap7G, {
14024
16
      "ontap-7g", "nfs.gxfh3.sfhflags.ontap7g", FT_UINT8, BASE_HEX,
14025
16
      NULL, SPINNP_FH_FLAG_ONTAP_MASK, NULL, HFILL }},
14026
14027
16
    { &hf_nfs3_gxfh_sfhflags_ontapGX, {
14028
16
      "ontap-gx", "nfs.gxfh3.sfhflags.ontapgx", FT_UINT8, BASE_HEX,
14029
16
      NULL, SPINNP_FH_FLAG_ONTAP_MASK, NULL, HFILL }},
14030
14031
16
    { &hf_nfs3_gxfh_sfhflags_striped, {
14032
16
      "striped", "nfs.gxfh3.sfhflags.striped", FT_BOOLEAN, 8,
14033
16
      TFS(&tfs_set_notset), SPINNP_FH_FLAG_STRIPED_MASK, NULL, HFILL }},
14034
14035
16
    { &hf_nfs3_gxfh_sfhflags_empty, {
14036
16
      "empty", "nfs.gxfh3.sfhflags.empty", FT_BOOLEAN, 8,
14037
16
      TFS(&tfs_set_notset), SPINNP_FH_FLAG_EMPTY_MASK, NULL, HFILL }},
14038
14039
16
    { &hf_nfs3_gxfh_sfhflags_snapdirent, {
14040
16
      "snap dir ent", "nfs.gxfh3.sfhflags.snapdirent", FT_BOOLEAN, 8,
14041
16
      TFS(&tfs_set_notset), SPINNP_FH_FLAG_SNAPDIR_ENT_MASK, NULL, HFILL }},
14042
14043
16
    { &hf_nfs3_gxfh_sfhflags_snapdir, {
14044
16
      "snap dir", "nfs.gxfh3.sfhflags.snapdir", FT_BOOLEAN, 8,
14045
16
      TFS(&tfs_set_notset), SPINNP_FH_FLAG_SNAPDIR_MASK, NULL, HFILL }},
14046
14047
16
    { &hf_nfs3_gxfh_sfhflags_streamdir, {
14048
16
      "stream dir", "nfs.gxfh3.sfhflags.streamdir", FT_BOOLEAN, 8,
14049
16
      TFS(&tfs_set_notset), SPINNP_FH_FLAG_STREAMDIR_MASK, NULL, HFILL }},
14050
14051
16
    { &hf_nfs3_gxfh_spinfid, {
14052
16
      "spin file id", "nfs.gxfh3.spinfid", FT_UINT32, BASE_HEX_DEC,
14053
16
      NULL, 0, NULL, HFILL }},
14054
14055
16
    { &hf_nfs3_gxfh_spinfuid, {
14056
16
      "spin file unique id", "nfs.gxfh3.spinfuid", FT_UINT32, BASE_HEX_DEC,
14057
16
      NULL, 0, NULL, HFILL }},
14058
14059
16
    { &hf_nfs3_gxfh_exportptid, {
14060
16
      "export point id", "nfs.gxfh3.exportptid", FT_UINT32, BASE_HEX_DEC,
14061
16
      NULL, 0, NULL, HFILL }},
14062
14063
16
    { &hf_nfs3_gxfh_exportptuid, {
14064
16
      "export point unique id", "nfs.gxfh3.exportptuid", FT_UINT32, BASE_HEX_DEC,
14065
16
      NULL, 0, NULL, HFILL }},
14066
14067
16
    { &hf_nfs3_verifier, {
14068
16
      "Verifier", "nfs.verifier", FT_BYTES, BASE_NONE,
14069
16
      NULL, 0, NULL, HFILL }},
14070
14071
16
    { &hf_nfs3_specdata1, {
14072
16
      "specdata1", "nfs.specdata1", FT_UINT32, BASE_DEC,
14073
16
      NULL, 0, NULL, HFILL }},
14074
14075
16
    { &hf_nfs3_specdata2, {
14076
16
      "specdata2", "nfs.specdata2", FT_UINT32, BASE_DEC,
14077
16
      NULL, 0, NULL, HFILL }},
14078
14079
16
    { &hf_nfs3_attributes_follow, {
14080
16
      "attributes_follow", "nfs.attributes_follow", FT_UINT32, BASE_DEC,
14081
16
      VALS(value_follows), 0, NULL, HFILL }},
14082
14083
16
    { &hf_nfs3_handle_follow, {
14084
16
      "handle_follow", "nfs.handle_follow", FT_UINT32, BASE_DEC,
14085
16
      VALS(value_follows), 0, NULL, HFILL }},
14086
14087
16
    { &hf_nfs3_sattrguard3, {
14088
16
      "check", "nfs.sattrguard3", FT_UINT32, BASE_DEC,
14089
16
      VALS(value_follows), 0, NULL, HFILL }},
14090
14091
16
    { &hf_nfs4_length_minlength, {
14092
16
      "min length", "nfs.minlength4", FT_UINT64, BASE_DEC,
14093
16
      NULL, 0, NULL, HFILL }},
14094
14095
16
    { &hf_nfs4_layout_type, {
14096
16
      "layout type", "nfs.layouttype", FT_UINT32, BASE_DEC,
14097
16
      VALS(layouttype_names), 0, NULL, HFILL }},
14098
14099
16
    { &hf_nfs4_layout_return_type, {
14100
16
      "return type", "nfs.returntype", FT_UINT32, BASE_DEC,
14101
16
      VALS(layoutreturn_names), 0, NULL, HFILL }},
14102
14103
16
    { &hf_nfs4_lrf_body_content, {
14104
16
      "lrf_body_content", "nfs.lrf_body_content", FT_BYTES, BASE_NONE,
14105
16
      NULL, 0, NULL, HFILL }},
14106
14107
16
    { &hf_nfs4_iomode, {
14108
16
      "IO mode", "nfs.iomode", FT_UINT32, BASE_DEC,
14109
16
      VALS(iomode_names), 0, NULL, HFILL }},
14110
14111
#if 0
14112
    { &hf_nfs4_stripetype, {
14113
      "stripe type", "nfs.stripetype", FT_UINT32, BASE_DEC,
14114
      VALS(stripetype_names), 0, NULL, HFILL }},
14115
#endif
14116
14117
16
    { &hf_nfs4_stripeunit, {
14118
16
      "stripe unit", "nfs.stripeunit", FT_UINT64, BASE_DEC,
14119
16
      NULL, 0, NULL, HFILL }},
14120
14121
#if 0
14122
    { &hf_nfs4_util, {
14123
      "util", "nfs.util", FT_UINT32, BASE_DEC,
14124
      NULL, 0, NULL, HFILL }},
14125
#endif
14126
14127
#if 0
14128
    { &hf_nfs4_first_stripe_idx, {
14129
      "first stripe index", "nfs.stripeindex", FT_UINT32, BASE_DEC,
14130
      NULL, 0, NULL, HFILL }},
14131
#endif
14132
14133
#if 0
14134
    { &hf_nfs4_pattern_offset, {
14135
      "layout pattern offset", "nfs.patternoffset", FT_UINT64, BASE_DEC,
14136
      NULL, 0, NULL, HFILL }},
14137
#endif
14138
14139
16
    { &hf_nfs4_notify_mask, {
14140
16
      "notify_mask", "nfs.notify_mask", FT_UINT32, BASE_HEX,
14141
16
      NULL, 0, NULL, HFILL }},
14142
14143
16
    { &hf_nfs4_notify_type, {
14144
16
      "notify_type", "nfs.notify_type", FT_UINT32,
14145
16
      BASE_DEC | BASE_EXT_STRING, &notify_type4_ext, 0, NULL, HFILL }},
14146
14147
16
    { &hf_nfs4_notify_deviceid_mask, {
14148
16
      "notify_deviceid_mask", "nfs.notify_deviceid_mask", FT_UINT32, BASE_HEX,
14149
16
      NULL, 0, NULL, HFILL }},
14150
14151
16
    { &hf_nfs4_notify_deviceid_type, {
14152
16
      "notify_deviceid_type", "nfs.notify_deviceid_type", FT_UINT32,
14153
16
      BASE_DEC | BASE_EXT_STRING, &notify_deviceid_type4_ext, 0, NULL, HFILL }},
14154
14155
16
    { &hf_nfs4_newtime, {
14156
16
      "new time?", "nfs.newtime", FT_BOOLEAN, BASE_NONE,
14157
16
      TFS(&tfs_yes_no), 0x0, NULL, HFILL }},
14158
14159
16
    { &hf_nfs4_newoffset, {
14160
16
      "new offset?", "nfs.newoffset", FT_BOOLEAN, BASE_NONE,
14161
16
      TFS(&tfs_yes_no), 0x0, NULL, HFILL }},
14162
14163
16
    { &hf_nfs4_newsize, {
14164
16
      "new size?", "nfs.newsize", FT_BOOLEAN, BASE_NONE,
14165
16
      TFS(&tfs_yes_no), 0x0, NULL, HFILL }},
14166
14167
16
    { &hf_nfs4_layout_avail, {
14168
16
      "layout available?", "nfs.layoutavail", FT_BOOLEAN, BASE_NONE,
14169
16
      TFS(&tfs_yes_no), 0x0, NULL, HFILL }},
14170
14171
#if 0
14172
    { &hf_nfs4_mdscommit, {
14173
      "MDS commit?", "nfs.mdscommit", FT_BOOLEAN, BASE_NONE,
14174
      TFS(&tfs_yes_no), 0x0, NULL, HFILL }},
14175
#endif
14176
14177
16
    { &hf_nfs4_layoutupdate, {
14178
16
      "layout update", "nfs.layoutupdate", FT_BYTES, BASE_NONE,
14179
16
      NULL, 0, NULL, HFILL }},
14180
14181
16
    { &hf_nfs4_deviceid, {
14182
16
      "device ID", "nfs.deviceid", FT_BYTES, BASE_NONE,
14183
16
      NULL, 0, NULL, HFILL }},
14184
14185
16
    { &hf_nfs4_devicenum, {
14186
16
      "num devices", "nfs.devicenum4", FT_UINT32, BASE_DEC,
14187
16
      NULL, 0, NULL, HFILL }},
14188
14189
16
    { &hf_nfs4_deviceidx, {
14190
16
      "device index", "nfs.deviceidx", FT_UINT32, BASE_DEC,
14191
16
      NULL, 0, NULL, HFILL }},
14192
14193
16
    { &hf_nfs4_layout, {
14194
16
      "layout", "nfs.layout", FT_BYTES, BASE_NONE,
14195
16
      NULL, 0, NULL, HFILL }},
14196
14197
#if 0
14198
    { &hf_nfs4_layout_count, {
14199
      "layout", "nfs.layoutcount", FT_UINT32, BASE_DEC,
14200
      NULL, 0, "layout count", HFILL }},
14201
#endif
14202
14203
14204
#if 0
14205
    { &hf_nfs4_stripedevs, {
14206
      "stripe devs", "nfs.stripedevs", FT_UINT32, BASE_DEC,
14207
      NULL, 0, NULL, HFILL }},
14208
#endif
14209
14210
#if 0
14211
    { &hf_nfs4_devaddr, {
14212
      "device addr", "nfs.devaddr", FT_BYTES, BASE_NONE,
14213
      NULL, 0, NULL, HFILL }},
14214
#endif
14215
14216
16
    { &hf_nfs4_devaddr_ssv_start, {
14217
16
      "slice start", "nfs.devaddr.ssv_start", FT_UINT32, BASE_DEC,
14218
16
      NULL, 0, NULL, HFILL }},
14219
14220
16
    { &hf_nfs4_devaddr_ssv_length, {
14221
16
      "slice length", "nfs.devaddr.ssv_length", FT_UINT32, BASE_DEC,
14222
16
      NULL, 0, NULL, HFILL }},
14223
14224
16
    { &hf_nfs4_devaddr_scsi_vol_type, {
14225
16
      "SCSI volume type", "nfs.devaddr.scsi_volume_type", FT_UINT32, BASE_DEC,
14226
16
      VALS(scsi_vol_type_names), 0, NULL, HFILL }},
14227
14228
16
    { &hf_nfs4_devaddr_scsi_vol_index, {
14229
16
      "volume index", "nfs.devaddr.scsi_volume_index", FT_UINT32, BASE_DEC,
14230
16
      NULL, 0, NULL, HFILL }},
14231
14232
16
    { &hf_nfs4_devaddr_scsi_vol_ref_index, {
14233
16
      "volume index ref", "nfs.devaddr.scsi_volume_ref_index", FT_UINT32, BASE_DEC,
14234
16
      NULL, 0, NULL, HFILL }},
14235
14236
16
    { &hf_nfs4_devaddr_ssv_stripe_unit, {
14237
16
      "stripe size", "nfs.devaddr.ssv_stripe_unit", FT_UINT32, BASE_DEC,
14238
16
      NULL, 0, NULL, HFILL }},
14239
14240
16
    { &hf_nfs4_devaddr_scsi_vpd_code_set, {
14241
16
      "VPD code set", "nfs.devaddr.scsi_vpd_code_set", FT_UINT32, BASE_DEC,
14242
16
      VALS(scsi_vpd_code_set_names), 0, NULL, HFILL }},
14243
14244
16
    { &hf_nfs4_devaddr_scsi_vpd_designator_type, {
14245
16
      "VPD designator type", "nfs.devaddr.scsi_vpd_designator_type", FT_UINT32, BASE_DEC,
14246
16
      VALS(scsi_vpd_designator_type_names), 0, NULL, HFILL }},
14247
14248
16
    { &hf_nfs4_devaddr_scsi_vpd_designator, {
14249
16
      "VPD designator", "nfs.devaddr.scsi_vpd_designator",
14250
16
      FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
14251
14252
16
    { &hf_nfs4_devaddr_scsi_private_key, {
14253
16
      "private key", "nfs.devaddr.scsi_private_key",
14254
16
      FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
14255
14256
16
    { &hf_nfs4_scsil_ext_file_offset, {
14257
16
      "file offset", "nfs.scsil_ext_file_offset", FT_UINT64, BASE_DEC,
14258
16
      NULL, 0, NULL, HFILL }},
14259
14260
16
    { &hf_nfs4_scsil_ext_length, {
14261
16
      "length", "nfs.scsil_ext_length", FT_UINT64, BASE_DEC,
14262
16
      NULL, 0, NULL, HFILL }},
14263
14264
16
    { &hf_nfs4_scsil_ext_vol_offset, {
14265
16
      "volume offset", "nfs.scsill_ext_vol_offset", FT_UINT64, BASE_DEC,
14266
16
      NULL, 0, NULL, HFILL }},
14267
14268
16
    { &hf_nfs4_scsil_ext_state, {
14269
16
      "extent state", "nfs.scsil_ext_state", FT_UINT32, BASE_DEC,
14270
16
      VALS(scsi_extent_state_names), 0, NULL, HFILL }},
14271
14272
16
    { &hf_nfs4_return_on_close, {
14273
16
      "return on close?", "nfs.retclose4", FT_BOOLEAN, BASE_NONE,
14274
16
      TFS(&tfs_yes_no), 0x0, NULL, HFILL }},
14275
14276
16
    { &hf_nfs4_nfl_mirrors, {
14277
16
      "Mirror", "nfs.nfl_mirrors", FT_UINT32, BASE_DEC,
14278
16
      NULL, 0, NULL, HFILL }},
14279
14280
16
    { &hf_nfs4_nfl_util, {
14281
16
      "nfl_util", "nfs.nfl_util", FT_UINT32, BASE_HEX,
14282
16
      NULL, 0, NULL, HFILL }},
14283
14284
16
    { &hf_nfs4_nfl_util_stripe_size, {
14285
16
      "stripe size", "nfs.nfl_util.stripe_size", FT_UINT32, BASE_DEC,
14286
16
      NULL, 0, NULL, HFILL }},
14287
14288
16
    { &hf_nfs4_nfl_util_commit_thru_mds, {
14289
16
      "commit thru mds", "nfs.nfl_util.commit_thru_mds", FT_UINT32, BASE_DEC,
14290
16
      NULL, 0, NULL, HFILL }},
14291
14292
16
    { &hf_nfs4_nfl_util_dense, {
14293
16
      "dense layout", "nfs.nfl_util.dense", FT_UINT32, BASE_DEC,
14294
16
      NULL, 0, NULL, HFILL }},
14295
14296
16
    { &hf_nfs4_nfl_fhs, {
14297
16
      "file handles", "nfs.nfl_fhs", FT_UINT32, BASE_HEX,
14298
16
      NULL, 0, NULL, HFILL }},
14299
14300
16
    { &hf_nfs4_mirror_eff, {
14301
16
      "mirror efficiency", "nfs.nff_mirror_eff", FT_UINT32, BASE_HEX,
14302
16
      NULL, 0, NULL, HFILL }},
14303
14304
16
    { &hf_nfs4_nfl_first_stripe_index, {
14305
16
      "first stripe to use index", "nfs.nfl_first_stripe_index", FT_UINT32, BASE_DEC,
14306
16
      NULL, 0, NULL, HFILL }},
14307
14308
16
    { &hf_nfs4_slotid, {
14309
16
      "slot id", "nfs.slotid", FT_UINT32, BASE_DEC,
14310
16
      NULL, 0, NULL, HFILL }},
14311
14312
16
    { &hf_nfs4_high_slotid, {
14313
16
      "high slot id", "nfs.high_slotid", FT_UINT32, BASE_DEC,
14314
16
      NULL, 0, NULL, HFILL }},
14315
16
    { &hf_nfs4_target_high_slotid, {
14316
16
      "target high slot id", "nfs.target_high_slotid", FT_UINT32, BASE_DEC,
14317
16
      NULL, 0, NULL, HFILL }},
14318
14319
16
    { &hf_nfs4_serverscope4, {
14320
16
      "server scope", "nfs.scope", FT_BYTES, BASE_NONE,
14321
16
      NULL, 0, NULL, HFILL }},
14322
14323
16
    { &hf_nfs4_minorid, {
14324
16
      "minor ID", "nfs.minorid4", FT_UINT64, BASE_DEC,
14325
16
      NULL, 0, NULL, HFILL }},
14326
14327
16
    { &hf_nfs4_majorid, {
14328
16
      "major ID", "nfs.majorid4", FT_BYTES, BASE_NONE,
14329
16
      NULL, 0, NULL, HFILL }},
14330
14331
16
    { &hf_nfs4_padsize, {
14332
16
      "hdr pad size", "nfs.padsize4", FT_UINT32, BASE_DEC,
14333
16
      NULL, 0, NULL, HFILL }},
14334
14335
#if 0
14336
    { &hf_nfs4_cbrenforce, {
14337
      "binding enforce?", "nfs.cbrenforce4", FT_BOOLEAN, BASE_NONE,
14338
      TFS(&tfs_yes_no), 0x0, NULL, HFILL }},
14339
#endif
14340
14341
#if 0
14342
    { &hf_nfs4_hashalg, {
14343
      "hash alg", "nfs.hashalg4", FT_UINT32, BASE_DEC,
14344
      NULL, 0, NULL, HFILL }},
14345
#endif
14346
14347
#if 0
14348
    { &hf_nfs4_ssvlen, {
14349
      "ssv len", "nfs.ssvlen4", FT_UINT32, BASE_DEC,
14350
      NULL, 0, NULL, HFILL }},
14351
#endif
14352
14353
16
    { &hf_nfs4_maxreqsize, {
14354
16
      "max req size", "nfs.maxreqsize4", FT_UINT32, BASE_DEC,
14355
16
      NULL, 0, NULL, HFILL }},
14356
14357
16
    { &hf_nfs4_maxrespsize, {
14358
16
      "max resp size", "nfs.maxrespsize4", FT_UINT32, BASE_DEC,
14359
16
      NULL, 0, NULL, HFILL }},
14360
14361
16
    { &hf_nfs4_maxrespsizecached, {
14362
16
      "max resp size cached", "nfs.maxrespsizecached4", FT_UINT32, BASE_DEC,
14363
16
      NULL, 0, NULL, HFILL }},
14364
14365
16
    { &hf_nfs4_maxops, {
14366
16
      "max ops", "nfs.maxops4", FT_UINT32, BASE_DEC,
14367
16
      NULL, 0, NULL, HFILL }},
14368
14369
16
    { &hf_nfs4_maxreqs, {
14370
16
      "max reqs", "nfs.maxreqs4", FT_UINT32, BASE_DEC,
14371
16
      NULL, 0, NULL, HFILL }},
14372
14373
16
    { &hf_nfs4_rdmachanattrs, {
14374
16
      "RDMA chan attrs", "nfs.rdmachanattrs4", FT_UINT32, BASE_DEC,
14375
16
      NULL, 0, NULL, HFILL }},
14376
14377
16
    { &hf_nfs4_machinename, {
14378
16
      "machine name", "nfs.machinename4", FT_STRING, BASE_NONE,
14379
16
      NULL, 0, NULL, HFILL }},
14380
14381
16
    { &hf_nfs4_flavor, {
14382
16
      "flavor", "nfs.flavor4", FT_UINT32, BASE_DEC,
14383
16
      VALS(rpc_auth_flavor), 0, NULL, HFILL }},
14384
14385
16
    { &hf_nfs4_stamp, {
14386
16
      "stamp", "nfs.stamp4", FT_UINT32, BASE_HEX,
14387
16
      NULL, 0, NULL, HFILL }},
14388
14389
16
    { &hf_nfs4_uid, {
14390
16
      "uid", "nfs.uid4", FT_UINT32, BASE_DEC,
14391
16
      NULL, 0, NULL, HFILL }},
14392
14393
16
    { &hf_nfs4_gid, {
14394
16
      "gid", "nfs.gid4", FT_UINT32, BASE_DEC,
14395
16
      NULL, 0, NULL, HFILL }},
14396
14397
16
    { &hf_nfs4_service, {
14398
16
      "service", "nfs.service4", FT_UINT32, BASE_DEC,
14399
16
      VALS(rpc_authgss_svc), 0, NULL, HFILL }},
14400
14401
16
    { &hf_nfs_access_check,
14402
16
      { "Check access", "nfs.access_check",
14403
16
      FT_UINT32, BASE_HEX,
14404
16
      NULL, 0x0,
14405
16
      "Access type(s) to be checked", HFILL }
14406
16
    },
14407
16
    { &hf_nfs_access_supported,
14408
16
      { "Supported types (of requested)", "nfs.access_supported",
14409
16
      FT_UINT32, BASE_HEX,
14410
16
      NULL, 0x0,
14411
16
      "Access types (of those requested) that the server can reliably verify", HFILL }
14412
16
    },
14413
16
    { &hf_nfs_access_rights,
14414
16
      { "Access rights (of requested)", "nfs.access_rights",
14415
16
      FT_UINT32, BASE_HEX,
14416
16
      NULL, 0x0,
14417
16
      "Access rights for the types requested", HFILL }
14418
16
    },
14419
16
    { &hf_nfs_access_supp_read,
14420
16
      { "0x001 READ", "nfs.access_supp_read",
14421
16
      FT_BOOLEAN, 32,
14422
16
      TFS(&tfs_access_supp), NFS_ACCESS_MASK_READ,
14423
16
      NULL, HFILL }
14424
16
    },
14425
16
    { &hf_nfs_access_supp_lookup,
14426
16
      { "0x002 LOOKUP", "nfs.access_supp_lookup",
14427
16
      FT_BOOLEAN, 32,
14428
16
      TFS(&tfs_access_supp), NFS_ACCESS_MASK_LOOKUP,
14429
16
      NULL, HFILL }
14430
16
    },
14431
16
    { &hf_nfs_access_supp_modify,
14432
16
      { "0x004 MODIFY", "nfs.access_supp_modify",
14433
16
      FT_BOOLEAN, 32,
14434
16
      TFS(&tfs_access_supp), NFS_ACCESS_MASK_MODIFY,
14435
16
      NULL, HFILL }
14436
16
    },
14437
16
    { &hf_nfs_access_supp_extend,
14438
16
      { "0x008 EXTEND", "nfs.access_supp_extend",
14439
16
      FT_BOOLEAN, 32,
14440
16
      TFS(&tfs_access_supp), NFS_ACCESS_MASK_EXTEND,
14441
16
      NULL, HFILL }
14442
16
    },
14443
16
    { &hf_nfs_access_supp_delete,
14444
16
      { "0x010 DELETE", "nfs.access_supp_delete",
14445
16
      FT_BOOLEAN, 32,
14446
16
      TFS(&tfs_access_supp), NFS_ACCESS_MASK_DELETE,
14447
16
      NULL, HFILL }
14448
16
    },
14449
16
    { &hf_nfs_access_supp_execute,
14450
16
      { "0x020 EXECUTE", "nfs.access_supp_execute",
14451
16
      FT_BOOLEAN, 32,
14452
16
      TFS(&tfs_access_supp), NFS_ACCESS_MASK_EXECUTE,
14453
16
      NULL, HFILL }
14454
16
    },
14455
16
    { &hf_nfs_access_supp_xattr_read,
14456
16
      { "0x040 XATTR READ", "nfs.access_supp_xattr_read",
14457
16
      FT_BOOLEAN, 32,
14458
16
      TFS(&tfs_access_supp), NFS_ACCESS_MASK_XATTR_READ,
14459
16
      NULL, HFILL }
14460
16
    },
14461
16
    { &hf_nfs_access_supp_xattr_write,
14462
16
      { "0x080 XATTR WRITE", "nfs.access_supp_xattr_write",
14463
16
      FT_BOOLEAN, 32,
14464
16
      TFS(&tfs_access_supp), NFS_ACCESS_MASK_XATTR_WRITE,
14465
16
      NULL, HFILL }
14466
16
    },
14467
16
    { &hf_nfs_access_supp_xattr_list,
14468
16
      { "0x100 XATTR LIST", "nfs.access_supp_xattr_list",
14469
16
      FT_BOOLEAN, 32,
14470
16
      TFS(&tfs_access_supp), NFS_ACCESS_MASK_XATTR_LIST,
14471
16
      NULL, HFILL }
14472
16
    },
14473
16
    { &hf_nfs_access_read,
14474
16
      { "0x001 READ", "nfs.access_read",
14475
16
      FT_BOOLEAN, 32,
14476
16
      TFS(&tfs_access_rights), NFS_ACCESS_MASK_READ,
14477
16
      NULL, HFILL }
14478
16
    },
14479
16
    { &hf_nfs_access_lookup,
14480
16
      { "0x002 LOOKUP", "nfs.access_lookup",
14481
16
      FT_BOOLEAN, 32,
14482
16
      TFS(&tfs_access_rights), NFS_ACCESS_MASK_LOOKUP,
14483
16
      NULL, HFILL }
14484
16
    },
14485
16
    { &hf_nfs_access_modify,
14486
16
      { "0x004 MODIFY", "nfs.access_modify",
14487
16
      FT_BOOLEAN, 32,
14488
16
      TFS(&tfs_access_rights), NFS_ACCESS_MASK_MODIFY,
14489
16
      NULL, HFILL }
14490
16
    },
14491
16
    { &hf_nfs_access_extend,
14492
16
      { "0x008 EXTEND", "nfs.access_extend",
14493
16
      FT_BOOLEAN, 32,
14494
16
      TFS(&tfs_access_rights), NFS_ACCESS_MASK_EXTEND,
14495
16
      NULL, HFILL }
14496
16
    },
14497
16
    { &hf_nfs_access_delete,
14498
16
      { "0x010 DELETE", "nfs.access_delete",
14499
16
      FT_BOOLEAN, 32,
14500
16
      TFS(&tfs_access_rights), NFS_ACCESS_MASK_DELETE,
14501
16
      NULL, HFILL }
14502
16
    },
14503
16
    { &hf_nfs_access_execute,
14504
16
      { "0x020 EXECUTE", "nfs.access_execute",
14505
16
      FT_BOOLEAN, 32,
14506
16
      TFS(&tfs_access_rights), NFS_ACCESS_MASK_EXECUTE,
14507
16
      NULL, HFILL }
14508
16
    },
14509
16
    { &hf_nfs_access_xattr_read,
14510
16
      { "0x040 XATTR READ", "nfs.access_xattr_read",
14511
16
      FT_BOOLEAN, 32,
14512
16
      TFS(&tfs_access_rights), NFS_ACCESS_MASK_XATTR_READ,
14513
16
      NULL, HFILL }
14514
16
    },
14515
16
    { &hf_nfs_access_xattr_write,
14516
16
      { "0x080 XATTR WRITE", "nfs.access_xattr_write",
14517
16
      FT_BOOLEAN, 32,
14518
16
      TFS(&tfs_access_rights), NFS_ACCESS_MASK_XATTR_WRITE,
14519
16
      NULL, HFILL }
14520
16
    },
14521
16
    { &hf_nfs_access_xattr_list,
14522
16
      { "0x100 XATTR LIST", "nfs.access_xattr_list",
14523
16
      FT_BOOLEAN, 32,
14524
16
      TFS(&tfs_access_rights), NFS_ACCESS_MASK_XATTR_LIST,
14525
16
      NULL, HFILL }
14526
16
    },
14527
16
    { &hf_nfs_access_denied,
14528
16
      { "Access Denied", "nfs.access_denied",
14529
16
      FT_BOOLEAN, BASE_NONE,
14530
16
      NULL, 0x0,
14531
16
      "True if access has been denied to one or more of the requested types", HFILL }
14532
16
    },
14533
16
    { &hf_nfs4_sessionid, {
14534
16
      "sessionid", "nfs.session_id4", FT_BYTES, BASE_NONE,
14535
16
      NULL, 0, NULL, HFILL }},
14536
16
    { &hf_nfs4_exchid_call_flags, {
14537
16
      "flags", "nfs.exchange_id.call_flags", FT_UINT32, BASE_HEX,
14538
16
      NULL, 0, NULL, HFILL}},
14539
16
    { &hf_nfs4_exchid_reply_flags, {
14540
16
      "flags", "nfs.exchange_id.reply_flags", FT_UINT32, BASE_HEX,
14541
16
      NULL, 0, NULL, HFILL}},
14542
16
    { &hf_nfs4_exchid_flags_moved_refer, {
14543
16
      "EXCHGID4_FLAG_SUPP_MOVED_REFER", "nfs.exchange_id.flags.moved_refer", FT_BOOLEAN, 32,
14544
16
      TFS(&tfs_set_notset), 0x00000001, NULL, HFILL}},
14545
16
    { &hf_nfs4_exchid_flags_moved_migr, {
14546
16
      "EXCHGID4_FLAG_SUPP_MOVED_MIGR", "nfs.exchange_id.flags.moved_migr", FT_BOOLEAN, 32,
14547
16
      TFS(&tfs_set_notset), 0x00000002, NULL, HFILL}},
14548
16
    { &hf_nfs4_exchid_flags_bind_princ, {
14549
16
      "EXCHGID4_FLAG_BIND_PRINC_STATEID", "nfs.exchange_id.flags.bind_princ", FT_BOOLEAN, 32,
14550
16
      TFS(&tfs_set_notset), 0x00000100, NULL, HFILL}},
14551
16
    { &hf_nfs4_exchid_flags_non_pnfs, {
14552
16
      "EXCHGID4_FLAG_USE_NON_PNFS", "nfs.exchange_id.flags.non_pnfs", FT_BOOLEAN, 32,
14553
16
      TFS(&tfs_set_notset), 0x00010000, NULL, HFILL}},
14554
16
    { &hf_nfs4_exchid_flags_pnfs_mds, {
14555
16
      "EXCHGID4_FLAG_USE_PNFS_MDS", "nfs.exchange_id.flags.pnfs_mds", FT_BOOLEAN, 32,
14556
16
      TFS(&tfs_set_notset), 0x00020000, NULL, HFILL}},
14557
16
    { &hf_nfs4_exchid_flags_pnfs_ds, {
14558
16
      "EXCHGID4_FLAG_USE_PNFS_DS", "nfs.exchange_id.flags.pnfs_ds", FT_BOOLEAN, 32,
14559
16
      TFS(&tfs_set_notset), 0x00040000, NULL, HFILL}},
14560
16
    { &hf_nfs4_exchid_flags_upd_conf_rec_a, {
14561
16
      "EXCHGID4_FLAG_UPD_CONFIRMED_REC_A", "nfs.exchange_id.flags.confirmed_rec_a",
14562
16
      FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x40000000, NULL, HFILL}},
14563
16
    { &hf_nfs4_exchid_flags_confirmed_r, {
14564
16
      "EXCHGID4_FLAG_CONFIRMED_R", "nfs.exchange_id.flags.confirmed_r", FT_BOOLEAN, 32,
14565
16
      TFS(&tfs_set_notset), 0x80000000, NULL, HFILL}},
14566
16
    { &hf_nfs4_sp_parms_hash_algs, {
14567
16
      "State Protect hash algorithms", "nfs.sp_parms4_hash_algs", FT_NONE, BASE_NONE,
14568
16
      NULL, 0, NULL, HFILL }},
14569
16
    { &hf_nfs4_sp_parms_encr_algs, {
14570
16
      "State Protect encryption algorithms", "nfs.sp_parms4_encr_algs", FT_NONE, BASE_NONE,
14571
16
      NULL, 0, NULL, HFILL }},
14572
16
    { &hf_nfs4_prot_info_hash_alg, {
14573
16
      "Prot Info hash algorithm", "nfs.prot_info4_hash_alg", FT_UINT32, BASE_HEX,
14574
16
      NULL, 0, NULL, HFILL }},
14575
16
    { &hf_nfs4_prot_info_encr_alg, {
14576
16
      "Prot Info encryption algorithm", "nfs.prot_info4_encr_alg", FT_UINT32, BASE_HEX,
14577
16
      NULL, 0, NULL, HFILL }},
14578
16
    { &hf_nfs4_prot_info_svv_length, {
14579
16
      "Prot Info svv_length", "nfs.prot_info4_svv_length", FT_UINT32, BASE_HEX,
14580
16
      NULL, 0, NULL, HFILL }},
14581
16
    { &hf_nfs4_prot_info_spi_window, {
14582
16
      "Prot Info spi window", "nfs.prot_info4_spi_window", FT_UINT32, BASE_HEX,
14583
16
      NULL, 0, NULL, HFILL }},
14584
16
    { &hf_nfs4_state_protect_window, {
14585
16
      "State Protect window", "nfs.state_protect_window", FT_UINT32, BASE_HEX,
14586
16
      NULL, 0, NULL, HFILL }},
14587
16
    { &hf_nfs4_state_protect_num_gss_handles, {
14588
16
      "State Protect num gss handles", "nfs.state_protect_num_gss_handles", FT_UINT32, BASE_HEX,
14589
16
      NULL, 0, NULL, HFILL }},
14590
16
    { &hf_nfs4_nii_domain, {
14591
16
      "Implementor DNS domain name(nii_domain)", "nfs.nii_domain4", FT_STRING, BASE_NONE,
14592
16
      NULL, 0, NULL, HFILL }},
14593
16
    { &hf_nfs4_nii_name, {
14594
16
      "Implementation product name(nii_name)", "nfs.nii_name4", FT_STRING, BASE_NONE,
14595
16
      NULL, 0, NULL, HFILL }},
14596
16
    { &hf_nfs4_create_session_flags_csa, {
14597
16
      "csa_flags", "nfs.create_session_flags", FT_UINT32, BASE_HEX,
14598
16
      NULL, 0, NULL, HFILL }},
14599
16
    { &hf_nfs4_create_session_flags_csr, {
14600
16
      "csr_flags", "nfs.create_session_flags", FT_UINT32, BASE_HEX,
14601
16
      NULL, 0, NULL, HFILL }},
14602
16
    { &hf_nfs4_create_session_flags_persist, {
14603
16
      "CREATE_SESSION4_FLAG_PERSIST", "nfs.create_session.flags.persist", FT_BOOLEAN, 32,
14604
16
      TFS(&tfs_set_notset), 0x00000001, NULL, HFILL}},
14605
16
    { &hf_nfs4_create_session_flags_conn_back_chan, {
14606
16
      "CREATE_SESSION4_FLAG_CONN_BACK_CHAN", "nfs.create_session.flags.conn_back_chan",
14607
16
      FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x00000002, NULL, HFILL}},
14608
16
    { &hf_nfs4_create_session_flags_conn_rdma, {
14609
16
      "CREATE_SESSION4_FLAG_CONN_RDMA", "nfs.create_session.flags.conn_rdma",
14610
16
      FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x00000004, NULL, HFILL}},
14611
16
    { &hf_nfs4_cachethis, {
14612
16
      "cache this?", "nfs.cachethis4", FT_BOOLEAN, BASE_NONE,
14613
16
      TFS(&tfs_yes_no), 0x0, NULL, HFILL }},
14614
16
    { &hf_nfs4_reclaim_one_fs, {
14615
16
      "reclaim one fs?", "nfs.reclaim_one_fs4", FT_BOOLEAN,
14616
16
      BASE_NONE, TFS(&tfs_yes_no), 0x0, NULL, HFILL }},
14617
16
    { &hf_nfs4_cb_procedure, {
14618
16
       "CB Procedure", "nfs.cb_procedure", FT_UINT32, BASE_DEC,
14619
16
      VALS(nfs_cb_proc_vals), 0, NULL, HFILL }},
14620
16
    { &hf_nfs4_cb_op, {
14621
16
        "Opcode", "nfs.cb.operation", FT_UINT32, BASE_DEC|BASE_EXT_STRING,
14622
16
        &names_nfs_cb_operation_ext, 0, NULL, HFILL }},
14623
16
    { &hf_nfs4_lrs_present, {
14624
16
      "StateID present?", "nfs.lrs_present", FT_BOOLEAN, BASE_NONE,
14625
16
      TFS(&tfs_yes_no), 0x0, NULL, HFILL }},
14626
16
    { &hf_nfs4_cb_truncate, {
14627
16
        "Truncate?", "nfs.truncate", FT_BOOLEAN, BASE_NONE,
14628
16
        TFS(&tfs_yes_no), 0, NULL, HFILL }},
14629
16
    { &hf_nfs4_cb_layoutrecall_type, {
14630
16
      "recall type", "nfs.recalltype", FT_UINT32, BASE_DEC,
14631
16
      VALS(layoutrecall_names), 0, NULL, HFILL }},
14632
16
    { &hf_nfs4_cb_clorachanged, {
14633
16
      "Clora changed", "nfs.clorachanged", FT_BOOLEAN, BASE_NONE,
14634
16
      TFS(&tfs_yes_no), 0, NULL, HFILL }},
14635
14636
16
    { &hf_nfs4_bctsa_dir, {
14637
16
      "bctsa_dir", "nfs.bctsa_dir", FT_UINT32, BASE_HEX,
14638
16
      VALS(names_channel_dir_from_client), 0, NULL, HFILL }},
14639
16
    { &hf_nfs4_bctsa_use_conn_in_rdma_mode, {
14640
16
      "bctsa_use_conn_in_rdma_mode", "nfs.bctsa_use_conn_in_rdma_mode", FT_BOOLEAN, BASE_NONE,
14641
16
      NULL, 0, NULL, HFILL }},
14642
16
    { &hf_nfs4_bctsr_dir, {
14643
16
      "bctsr_dir", "nfs.bctsr_dir", FT_UINT32, BASE_HEX,
14644
16
      VALS(names_channel_dir_from_server), 0, NULL, HFILL }},
14645
16
    { &hf_nfs4_bctsr_use_conn_in_rdma_mode, {
14646
16
      "bctsr_use_conn_in_rdma_mode", "nfs.bctsr_use_conn_in_rdma_mode", FT_BOOLEAN, BASE_NONE,
14647
16
      NULL, 0, NULL, HFILL }},
14648
14649
16
    { &hf_nfs3_mode, {
14650
16
      "Mode", "nfs.mode3", FT_UINT32, BASE_OCT,
14651
16
      NULL, 0, NULL, HFILL }},
14652
14653
16
    { &hf_nfs3_mode_suid, {
14654
16
      "S_ISUID", "nfs.mode3.suid", FT_BOOLEAN, 32,
14655
16
      TFS(&tfs_yes_no), 0x00000800, NULL, HFILL }},
14656
14657
16
    { &hf_nfs3_mode_sgid, {
14658
16
      "S_ISGID", "nfs.mode3.sgid", FT_BOOLEAN, 32,
14659
16
      TFS(&tfs_yes_no), 0x00000400, NULL, HFILL }},
14660
14661
16
    { &hf_nfs3_mode_sticky, {
14662
16
      "S_ISVTX", "nfs.mode3.sticky", FT_BOOLEAN, 32,
14663
16
      TFS(&tfs_yes_no), 0x00000200, NULL, HFILL }},
14664
14665
16
    { &hf_nfs3_mode_rusr, {
14666
16
      "S_IRUSR", "nfs.mode3.rusr", FT_BOOLEAN, 32,
14667
16
      TFS(&tfs_yes_no), 0x00000100, NULL, HFILL }},
14668
14669
16
    { &hf_nfs3_mode_wusr, {
14670
16
      "S_IWUSR", "nfs.mode3.wusr", FT_BOOLEAN, 32,
14671
16
      TFS(&tfs_yes_no), 0x00000080, NULL, HFILL }},
14672
14673
16
    { &hf_nfs3_mode_xusr, {
14674
16
      "S_IXUSR", "nfs.mode3.xusr", FT_BOOLEAN, 32,
14675
16
      TFS(&tfs_yes_no), 0x00000040, NULL, HFILL }},
14676
14677
16
    { &hf_nfs3_mode_rgrp, {
14678
16
      "S_IRGRP", "nfs.mode3.rgrp", FT_BOOLEAN, 32,
14679
16
      TFS(&tfs_yes_no), 0x00000020, NULL, HFILL }},
14680
14681
16
    { &hf_nfs3_mode_wgrp, {
14682
16
      "S_IWGRP", "nfs.mode3.wgrp", FT_BOOLEAN, 32,
14683
16
      TFS(&tfs_yes_no), 0x00000010, NULL, HFILL }},
14684
14685
16
    { &hf_nfs3_mode_xgrp, {
14686
16
      "S_IXGRP", "nfs.mode3.xgrp", FT_BOOLEAN, 32,
14687
16
      TFS(&tfs_yes_no), 0x00000008, NULL, HFILL }},
14688
14689
16
    { &hf_nfs3_mode_roth, {
14690
16
      "S_IROTH", "nfs.mode3.roth", FT_BOOLEAN, 32,
14691
16
      TFS(&tfs_yes_no), 0x00000004, NULL, HFILL }},
14692
14693
16
    { &hf_nfs3_mode_woth, {
14694
16
      "S_IWOTH", "nfs.mode3.woth", FT_BOOLEAN, 32,
14695
16
      TFS(&tfs_yes_no), 0x00000002, NULL, HFILL }},
14696
14697
16
    { &hf_nfs3_mode_xoth, {
14698
16
      "S_IXOTH", "nfs.mode3.xoth", FT_BOOLEAN, 32,
14699
16
      TFS(&tfs_yes_no), 0x00000001, NULL, HFILL }},
14700
14701
16
    { &hf_nfs2_ftype, {
14702
16
      "type", "nfs.ftype", FT_UINT32, BASE_DEC|BASE_EXT_STRING,
14703
16
      &nfs2_ftype_ext, 0, NULL, HFILL }},
14704
14705
16
    { &hf_nfs2_mode, {
14706
16
      "mode", "nfs.mode", FT_UINT32, BASE_OCT,
14707
16
      NULL, 0, NULL, HFILL }},
14708
14709
16
    { &hf_nfs2_mode_name, {
14710
16
      "Name", "nfs.mode.name", FT_UINT32, BASE_DEC,
14711
16
      VALS(nfs2_mode_names), 0160000, NULL, HFILL }},
14712
14713
16
    { &hf_nfs2_mode_set_user_id, {
14714
16
      "Set user id on exec", "nfs.mode.set_user_id", FT_BOOLEAN, 32,
14715
16
      TFS(&tfs_yes_no), 04000, NULL, HFILL }},
14716
14717
16
    { &hf_nfs2_mode_set_group_id, {
14718
16
      "Set group id on exec", "nfs.mode.set_group_id", FT_BOOLEAN, 32,
14719
16
      TFS(&tfs_yes_no), 02000, NULL, HFILL }},
14720
14721
16
    { &hf_nfs2_mode_save_swap_text, {
14722
16
      "Save swapped text even after use", "nfs.mode.save_swap_text", FT_BOOLEAN, 32,
14723
16
      TFS(&tfs_yes_no), 01000, NULL, HFILL }},
14724
14725
16
    { &hf_nfs2_mode_read_owner, {
14726
16
      "Read permission for owner", "nfs.mode.read_owner", FT_BOOLEAN, 32,
14727
16
      TFS(&tfs_yes_no), 0400, NULL, HFILL }},
14728
14729
16
    { &hf_nfs2_mode_write_owner, {
14730
16
      "Write permission for owner", "nfs.mode.write_owner", FT_BOOLEAN, 32,
14731
16
      TFS(&tfs_yes_no), 0200, NULL, HFILL }},
14732
14733
16
    { &hf_nfs2_mode_exec_owner, {
14734
16
      "Execute permission for owner", "nfs.mode.exec_owner", FT_BOOLEAN, 32,
14735
16
      TFS(&tfs_yes_no), 0100, NULL, HFILL }},
14736
14737
16
    { &hf_nfs2_mode_read_group, {
14738
16
      "Read permission for group", "nfs.mode.read_group", FT_BOOLEAN, 32,
14739
16
      TFS(&tfs_yes_no), 040, NULL, HFILL }},
14740
14741
16
    { &hf_nfs2_mode_write_group, {
14742
16
      "Write permission for group", "nfs.mode.write_group", FT_BOOLEAN, 32,
14743
16
      TFS(&tfs_yes_no), 020, NULL, HFILL }},
14744
14745
16
    { &hf_nfs2_mode_exec_group, {
14746
16
      "Execute permission for group", "nfs.mode.exec_group", FT_BOOLEAN, 32,
14747
16
      TFS(&tfs_yes_no), 010, NULL, HFILL }},
14748
14749
16
    { &hf_nfs2_mode_read_other, {
14750
16
      "Read permission for others", "nfs.mode.read_other", FT_BOOLEAN, 32,
14751
16
      TFS(&tfs_yes_no), 04, NULL, HFILL }},
14752
14753
16
    { &hf_nfs2_mode_write_other, {
14754
16
      "Write permission for others", "nfs.mode.write_other", FT_BOOLEAN, 32,
14755
16
      TFS(&tfs_yes_no), 02, NULL, HFILL }},
14756
14757
16
    { &hf_nfs2_mode_exec_other, {
14758
16
      "Execute permission for others", "nfs.mode.exec_other", FT_BOOLEAN, 32,
14759
16
      TFS(&tfs_yes_no), 01, NULL, HFILL }},
14760
14761
16
    { &hf_nfs4_sequence_status_flags, {
14762
16
      "status flags", "nfs.sequence.flags", FT_UINT32, BASE_HEX,
14763
16
      NULL, 0, NULL, HFILL }},
14764
14765
16
    { &hf_nfs4_sequence_status_flags_cb_path_down, {
14766
16
      "SEQ4_STATUS_CB_PATH_DOWN", "nfs.sequence.flags.cb_path_down", FT_BOOLEAN, 32,
14767
16
      TFS(&tfs_set_notset), 0x00000001, NULL, HFILL}},
14768
14769
16
    { &hf_nfs4_sequence_status_flags_cb_gss_contexts_expiring, {
14770
16
      "SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRING", "nfs.sequence.flags.cb_gss_contexts_expiring",
14771
16
      FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x00000002, NULL, HFILL}},
14772
14773
16
    { &hf_nfs4_sequence_status_flags_cb_gss_contexts_expired, {
14774
16
      "SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRED", "nfs.sequence.flags.cb_gss_contexts_expired",
14775
16
      FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x00000004, NULL, HFILL}},
14776
14777
16
    { &hf_nfs4_sequence_status_flags_expired_all_state_revoked, {
14778
16
      "SEQ4_STATUS_EXPIRED_ALL_STATE_REVOKED", "nfs.sequence.flags.expired_all_state_revoked",
14779
16
      FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x00000008, NULL, HFILL}},
14780
14781
16
    { &hf_nfs4_sequence_status_flags_expired_some_state_revoked, {
14782
16
      "SEQ4_STATUS_EXPIRED_SOME_STATE_REVOKED", "nfs.sequence.flags.expired_some_state_revoked",
14783
16
      FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x00000010, NULL, HFILL}},
14784
14785
16
    { &hf_nfs4_sequence_status_flags_admin_state_revoked, {
14786
16
      "SEQ4_STATUS_ADMIN_STATE_REVOKED", "nfs.sequence.flags.admin_state_revoked",
14787
16
      FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x00000020, NULL, HFILL}},
14788
14789
16
    { &hf_nfs4_sequence_status_flags_recallable_state_revoked, {
14790
16
      "SEQ4_STATUS_RECALLABLE_STATE_REVOKED", "nfs.sequence.flags.recallable_state_revoked",
14791
16
      FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x00000040, NULL, HFILL}},
14792
14793
16
    { &hf_nfs4_sequence_status_flags_lease_moved, {
14794
16
      "SEQ4_STATUS_LEASE_MOVED", "nfs.sequence.flags.lease_moved", FT_BOOLEAN, 32,
14795
16
      TFS(&tfs_set_notset), 0x00000080, NULL, HFILL}},
14796
14797
16
    { &hf_nfs4_sequence_status_flags_restart_reclaim_needed, {
14798
16
      "SEQ4_STATUS_RESTART_RECLAIM_NEEDED", "nfs.sequence.flags.restart_reclaim_needed",
14799
16
      FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x00000100, NULL, HFILL}},
14800
14801
16
    { &hf_nfs4_sequence_status_flags_cb_path_down_session, {
14802
16
      "SEQ4_STATUS_CB_PATH_DOWN_SESSION", "nfs.sequence.flags.cb_path_down_session",
14803
16
      FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x00000200, NULL, HFILL}},
14804
14805
16
    { &hf_nfs4_sequence_status_flags_backchannel_fault, {
14806
16
      "SEQ4_STATUS_BACKCHANNEL_FAULT", "nfs.sequence.flags.backchannel_fault", FT_BOOLEAN, 32,
14807
16
      TFS(&tfs_set_notset), 0x00000400, NULL, HFILL}},
14808
14809
16
    { &hf_nfs4_sequence_status_flags_devid_changed, {
14810
16
      "SEQ4_STATUS_DEVID_CHANGED", "nfs.sequence.flags.devid_changed", FT_BOOLEAN, 32,
14811
16
      TFS(&tfs_set_notset), 0x00000800, NULL, HFILL}},
14812
14813
16
    { &hf_nfs4_sequence_status_flags_devid_deleted, {
14814
16
      "SEQ4_STATUS_DEVID_DELETED", "nfs.sequence.flags.devid_deleted", FT_BOOLEAN, 32,
14815
16
      TFS(&tfs_set_notset), 0x00001000, NULL, HFILL}},
14816
14817
16
    { &hf_nfs4_test_stateid_arg, {
14818
16
      "StateID List", "nfs.test_stateid.stateids",
14819
16
      FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL}},
14820
14821
16
    { &hf_nfs4_test_stateid_res, {
14822
16
      "StateID Result List", "nfs.test_stateid.results",
14823
16
      FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL}},
14824
14825
16
    { &hf_nfs4_seek_data_content, {
14826
16
      "data content", "nfs.data_content", FT_UINT32, BASE_DEC,
14827
16
      VALS(names_data_content), 0, NULL, HFILL }},
14828
14829
16
    { &hf_nfs4_bitmap_data, {
14830
16
      "Undissected bitmap data", "nfs.bitmap_data", FT_BYTES, BASE_NONE,
14831
16
      NULL, 0, NULL, HFILL }},
14832
14833
16
    { &hf_nfs4_huge_bitmap_length, {
14834
16
      "Huge bitmap length", "nfs.huge_bitmap_length", FT_UINT32, BASE_DEC,
14835
16
      NULL, 0, NULL, HFILL }},
14836
14837
16
    { &hf_nfs4_universal_address_ipv4, {
14838
16
      "universal_address", "nfs.universal_address.ipv4", FT_IPv4, BASE_NONE,
14839
16
      NULL, 0, NULL, HFILL }},
14840
14841
16
    { &hf_nfs4_universal_address_ipv6, {
14842
16
      "universal_address", "nfs.universal_address.ipv6", FT_IPv6, BASE_NONE,
14843
16
      NULL, 0, NULL, HFILL }},
14844
14845
16
    { &hf_nfs4_getdevinfo, {
14846
16
      "dev info", "nfs.devinfo", FT_BYTES,
14847
16
      BASE_NONE, NULL, 0, NULL, HFILL }},
14848
14849
16
    { &hf_nfs4_ff_version, {
14850
16
      "version", "nfs.ff.version", FT_UINT32, BASE_DEC,
14851
16
      NULL, 0, NULL, HFILL }},
14852
14853
16
    { &hf_nfs4_ff_minorversion, {
14854
16
      "minorversion", "nfs.ff.minorversion", FT_UINT32,
14855
16
      BASE_DEC, NULL, 0, NULL, HFILL }},
14856
14857
16
    { &hf_nfs4_ff_rsize, {
14858
16
      "max_rsize", "nfs.ff.rsize", FT_UINT32,
14859
16
      BASE_DEC, NULL, 0, NULL, HFILL }},
14860
14861
16
    { &hf_nfs4_ff_wsize, {
14862
16
      "max_wsize", "nfs.ff.wsize", FT_UINT32,
14863
16
      BASE_DEC, NULL, 0, NULL, HFILL }},
14864
14865
16
    { &hf_nfs4_ff_tightly_coupled, {
14866
16
                        "tightly coupled", "nfs.ff.tightly_coupled",
14867
16
      FT_BOOLEAN, BASE_NONE, TFS(&tfs_yes_no), 0x0,
14868
16
      NULL, HFILL }},
14869
14870
16
    { &hf_nfs4_ff_layout_flags, {
14871
16
      "layout flags", "nfs.ff.layout_flags", FT_UINT32, BASE_HEX,
14872
16
      NULL, 0, NULL, HFILL }},
14873
14874
16
    { &hf_nfs4_ff_synthetic_owner, {
14875
16
      "synthetic owner", "nfs.ff.synthetic_owner", FT_STRING, BASE_NONE,
14876
16
      NULL, 0, NULL, HFILL }},
14877
14878
16
    { &hf_nfs4_ff_synthetic_owner_group, {
14879
16
      "synthetic group", "nfs.ff.synthetic_owner_group", FT_STRING, BASE_NONE,
14880
16
      NULL, 0, NULL, HFILL }},
14881
14882
16
    { &hf_nfs4_ff_layout_flags_no_layoutcommit, {
14883
16
      "FLAG_NO_LAYOUTCOMMIT", "nfs.ff.layout_flags.no_layoutcommit", FT_BOOLEAN, 32,
14884
16
      TFS(&tfs_set_notset), 0x00000001, NULL, HFILL}},
14885
14886
16
    { &hf_nfs4_ff_layout_flags_no_io_thru_mds, {
14887
16
      "FLAG_NO_IO_THRU_MDS", "nfs.ff.layout_flags.no_io_thru_mds", FT_BOOLEAN, 32,
14888
16
      TFS(&tfs_set_notset), 0x00000002, NULL, HFILL}},
14889
14890
16
    { &hf_nfs4_ff_layout_flags_no_read_io, {
14891
16
      "FLAG_NO_READ_IO", "nfs.ff.layout_flags.no_read_io", FT_BOOLEAN, 32,
14892
16
      TFS(&tfs_set_notset), 0x00000004, NULL, HFILL}},
14893
14894
16
    { &hf_nfs4_ff_stats_collect_hint, {
14895
16
      "stats collect hint", "nfs.ff.stats_collect_hint", FT_UINT32, BASE_DEC,
14896
16
      NULL, 0, "Layoutstats sampling period hint, Seconds", HFILL }},
14897
14898
16
    { &hf_nfs4_fattr_clone_blocksize, {
14899
16
      "clone block size", "nfs.fattr4.clone_block_size", FT_UINT32, BASE_DEC,
14900
16
      NULL, 0, NULL, HFILL }},
14901
14902
16
    { &hf_nfs4_fattr_space_freed, {
14903
16
      "space freed", "nfs.fattr4.space_freed", FT_UINT64, BASE_DEC,
14904
16
      NULL, 0, NULL, HFILL }},
14905
14906
16
    { &hf_nfs4_fattr_change_attr_type, {
14907
16
      "change attr type", "nfs.fattr4.change_attr_type", FT_UINT32, BASE_DEC,
14908
16
      VALS(names_nfs_change_attr_types), 0, NULL, HFILL }},
14909
14910
16
    { &hf_nfs4_callback_stateids, {
14911
16
      "Callback StateIds", "nfs.callback_ids", FT_UINT32, BASE_DEC,
14912
16
      NULL, 0, NULL, HFILL }},
14913
14914
16
    { &hf_nfs4_callback_stateids_index, {
14915
16
      "Callback Id", "nfs.ff.callback_id_index", FT_UINT32, BASE_DEC,
14916
16
      NULL, 0, NULL, HFILL }},
14917
14918
16
    { &hf_nfs4_num_offload_status, {
14919
16
      "Number of offload status", "nfs.num_offload_status", FT_UINT32, BASE_DEC,
14920
16
      NULL, 0, NULL, HFILL }},
14921
14922
16
    { &hf_nfs4_offload_status_index, {
14923
16
      "nfsstat4", "nfs.offload_status", FT_UINT32, BASE_DEC,
14924
16
      NULL, 0, NULL, HFILL }},
14925
14926
16
    { &hf_nfs4_consecutive, {
14927
16
      "copy consecutively?", "nfs.consecutive", FT_BOOLEAN, BASE_NONE,
14928
16
      TFS(&tfs_yes_no), 0x0, NULL, HFILL }},
14929
14930
16
    { &hf_nfs4_netloc, {
14931
16
      "net loc", "nfs.netloc", FT_BYTES,
14932
16
      BASE_NONE, NULL, 0, NULL, HFILL }},
14933
14934
16
    { &hf_nfs4_netloc_type, {
14935
16
      "netloc type", "nfs.netloctype", FT_UINT32, BASE_DEC,
14936
16
      VALS(netloctype_names), 0, NULL, HFILL }},
14937
14938
16
    { &hf_nfs4_nl_name, {
14939
16
      "net loc name", "nfs.nl_name", FT_STRING, BASE_NONE,
14940
16
      NULL, 0, NULL, HFILL }},
14941
14942
16
    { &hf_nfs4_nl_url, {
14943
16
      "net loc url", "nfs.nl_url", FT_STRING, BASE_NONE,
14944
16
      NULL, 0, NULL, HFILL }},
14945
14946
16
    { &hf_nfs4_source_servers, {
14947
16
      "Source Server count", "nfs.source_servers", FT_UINT32, BASE_DEC,
14948
16
      NULL, 0, NULL, HFILL }},
14949
14950
16
    { &hf_nfs4_source_server_index, {
14951
16
      "Source Server", "nfs.ff.source_server_index", FT_UINT32, BASE_DEC,
14952
16
      NULL, 0, NULL, HFILL }},
14953
14954
16
    { &hf_nfs4_synchronous, {
14955
16
      "copy synchronous?", "nfs.synchronous", FT_BOOLEAN, BASE_NONE,
14956
16
      TFS(&tfs_yes_no), 0x0, NULL, HFILL }},
14957
14958
16
    { &hf_nfs4_io_hints_mask, {
14959
16
      "Hint mask", "nfs.hint.mask", FT_UINT32, BASE_HEX,
14960
16
      NULL, 0, NULL, HFILL }},
14961
14962
16
    { &hf_nfs4_io_hint_count, {
14963
16
      "Hint count", "nfs.hint.count", FT_UINT32, BASE_DEC,
14964
16
      NULL, 0, NULL, HFILL }},
14965
14966
16
    { &hf_nfs4_io_advise_hint, {
14967
16
      "Hint", "nfs.hint.hint", FT_UINT32, BASE_DEC | BASE_EXT_STRING,
14968
16
      &io_advise_names_ext, 0, NULL, HFILL }},
14969
14970
16
    { &hf_nfs4_cb_recall_any_objs, {
14971
16
      "Objects to keep", "nfs.objects_to_keep", FT_UINT32, BASE_DEC,
14972
16
      NULL, 0, NULL, HFILL }},
14973
14974
16
    { &hf_nfs4_cb_recall_any_count, {
14975
16
      "Number of masks", "nfs.mask.count", FT_UINT32, BASE_DEC,
14976
16
      NULL, 0, NULL, HFILL }},
14977
14978
16
    { &hf_nfs4_cb_recall_any_mask, {
14979
16
      "Type mask", "nfs.mask", FT_UINT32, BASE_HEX,
14980
16
      NULL, 0, NULL, HFILL }},
14981
14982
16
    { &hf_nfs4_cb_recall_any_item, {
14983
16
      "Type", "nfs.mask.item", FT_UINT32, BASE_DEC | BASE_EXT_STRING,
14984
16
      &cb_recall_any_names_ext, 0, NULL, HFILL }},
14985
14986
16
    { &hf_nfs4_bytes_copied, {
14987
16
      "bytes copied", "nfs.bytes_copied", FT_UINT64, BASE_DEC,
14988
16
      NULL, 0, NULL, HFILL }},
14989
14990
16
    { &hf_nfs4_read_plus_contents, {
14991
16
      "Contents", "nfs.contents",
14992
16
      FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }},
14993
14994
16
    { &hf_nfs4_read_plus_content_type, {
14995
16
      "Content Type", "nfs.content.type", FT_UINT32, BASE_DEC | BASE_EXT_STRING,
14996
16
      &read_plus_content_names_ext, 0, NULL, HFILL }},
14997
14998
16
    { &hf_nfs4_block_size, {
14999
16
      "Content index", "nfs.content.index", FT_UINT32, BASE_DEC,
15000
16
      NULL, 0, NULL, HFILL }},
15001
15002
16
    { &hf_nfs4_block_count, {
15003
16
      "Number of Blocks", "nfs.adb.block.count", FT_UINT32, BASE_DEC,
15004
16
      NULL, 0, NULL, HFILL }},
15005
15006
16
    { &hf_nfs4_reloff_blocknum, {
15007
16
      "Relative Offset Block Number", "nfs.adb.block.reloff_num", FT_UINT32, BASE_DEC,
15008
16
      NULL, 0, NULL, HFILL }},
15009
15010
16
    { &hf_nfs4_blocknum, {
15011
16
      "Block Number", "nfs.adb.block.num", FT_UINT32, BASE_DEC,
15012
16
      NULL, 0, NULL, HFILL }},
15013
15014
16
    { &hf_nfs4_reloff_pattern, {
15015
16
      "Relative Offset Pattern", "nfs.adb.pattern.reloff", FT_UINT32, BASE_DEC,
15016
16
      NULL, 0, NULL, HFILL }},
15017
15018
16
    { &hf_nfs4_pattern_hash, {
15019
16
      "hash (CRC-32)", "nfs.adb.pattern_hash", FT_UINT32, BASE_HEX,
15020
16
      NULL, 0, "ADB pattern hash", HFILL }},
15021
15022
16
    { &hf_nfs4_xattrkey, {
15023
16
      "Name", "nfs.xattr.key", FT_STRING, BASE_NONE,
15024
16
      NULL, 0, "Xattr key", HFILL }},
15025
15026
16
    { &hf_nfs4_setxattr_options, {
15027
16
      "setxattr options", "nfs.setxattr.options", FT_UINT32, BASE_DEC,
15028
16
      VALS(names_setxattr_options), 0, NULL, HFILL }},
15029
15030
16
    { &hf_nfs4_listxattr_maxcount, {
15031
16
      "maxcount", "nfs.lisxtattr.maxcount", FT_UINT32, BASE_DEC,
15032
16
      NULL, 0, "Lixtxattr maxcount", HFILL }},
15033
15034
16
    { &hf_nfs4_listxattr_cookie, {
15035
16
      "cookie", "nfs.lisxtattr.cookie", FT_UINT64, BASE_DEC,
15036
16
      NULL, 0, "Lixtxattr cookie", HFILL }},
15037
15038
16
    { &hf_nfs4_listxattr_names_len, {
15039
16
      "xattr names count", "nfs.listxattr.names.count", FT_UINT32, BASE_DEC,
15040
16
      NULL, 0, "Number of xattrkey names", HFILL }},
15041
15042
16
    { &hf_nfs4_listxattr_eof, {
15043
16
      "eof", "nfs.lisxtattr.eof", FT_UINT32, BASE_DEC,
15044
16
      NULL, 0, "Lixtxattr eof", HFILL }},
15045
15046
16
    { &hf_nfs4_gdd_non_fatal_status, {
15047
16
      "Non-fatal status", "nfs.gdd.non_fatal_status", FT_UINT32, BASE_DEC,
15048
16
      VALS(gdd_non_fatal_status_names), 0,
15049
16
      "GET_DIR_DELEGATION non-fatal status code", HFILL }},
15050
15051
16
    { &hf_nfs4_gdd_signal_deleg_avail, {
15052
16
      "Signal delegation available", "nfs.gdd.signal_deleg_avail", FT_BOOLEAN, BASE_NONE,
15053
16
      TFS(&tfs_yes_no), 0x0, NULL, HFILL }},
15054
15055
16
    { &hf_nfs4_gdd_child_attr_delay, {
15056
16
      "Child attr notification delay", "nfs.gdd.child_attr_delay",
15057
16
      FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL}},
15058
15059
16
    { &hf_nfs4_gdd_dir_attr_delay, {
15060
16
      "Dir attr notification delay", "nfs.gdd.dir_attr_delay",
15061
16
      FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL}},
15062
15063
16
    { &hf_nfs4_gdd_child_attrs, {
15064
16
      "Child notification attrs", "nfs.gdd.child_attrs",
15065
16
      FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL}},
15066
15067
16
    { &hf_nfs4_gdd_dir_attrs, {
15068
16
      "Dir notification attrs", "nfs.gdd.dir_attrs",
15069
16
      FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL}},
15070
15071
16
    { &hf_nfs4_nad_last_entry, {
15072
16
      "last entry?", "nfs.notify.add.last_entry", FT_BOOLEAN, BASE_NONE,
15073
16
      TFS(&tfs_yes_no), 0x0, NULL, HFILL }},
15074
15075
16
    { &hf_nfs4_ff_local, {
15076
16
      "client used cache?", "nfs.ff.local", FT_BOOLEAN, BASE_NONE,
15077
16
      TFS(&tfs_yes_no), 0x0, NULL, HFILL }},
15078
15079
16
    { &hf_nfs4_io_count, {
15080
16
      "count", "nfs.io_count", FT_UINT64, BASE_DEC,
15081
16
      NULL, 0, NULL, HFILL }},
15082
15083
16
    { &hf_nfs4_io_bytes, {
15084
16
      "bytes", "nfs.io_bytes", FT_UINT64, BASE_DEC,
15085
16
      NULL, 0, NULL, HFILL }},
15086
15087
16
    { &hf_nfs4_ff_ops_requested, {
15088
16
      "ops requested", "nfs.ff.ops_requested", FT_UINT64, BASE_DEC,
15089
16
      NULL, 0, NULL, HFILL }},
15090
15091
16
    { &hf_nfs4_ff_bytes_requested, {
15092
16
      "bytes requested", "nfs.ff.bytes_requested", FT_UINT64, BASE_DEC,
15093
16
      NULL, 0, NULL, HFILL }},
15094
15095
16
    { &hf_nfs4_ff_ops_completed, {
15096
16
      "ops completed", "nfs.ff.ops_completed", FT_UINT64, BASE_DEC,
15097
16
      NULL, 0, NULL, HFILL }},
15098
15099
16
    { &hf_nfs4_ff_bytes_completed, {
15100
16
      "bytes completed", "nfs.ff.bytes_completed", FT_UINT64, BASE_DEC,
15101
16
      NULL, 0, NULL, HFILL }},
15102
15103
16
    { &hf_nfs4_ff_bytes_not_delivered, {
15104
16
      "bytes not delivered", "nfs.ff.bytes_not_delivered", FT_UINT64, BASE_DEC,
15105
16
      NULL, 0, NULL, HFILL }},
15106
15107
16
    { &hf_nfs4_layoutstats, {
15108
16
      "Layout Stats", "nfs.layoutstats", FT_BYTES, BASE_NONE,
15109
16
      NULL, 0, NULL, HFILL }},
15110
15111
16
    { &hf_nfs4_device_error_count, {
15112
16
      "Device Error count", "nfs.device_error_count", FT_UINT32, BASE_DEC,
15113
16
      NULL, 0, NULL, HFILL }},
15114
15115
16
    { &hf_nfs4_device_errors_index, {
15116
16
      "Device Error index", "nfs.device_errors_index", FT_UINT32, BASE_DEC,
15117
16
      NULL, 0, NULL, HFILL }},
15118
15119
16
    { &hf_nfs4_ff_ioerrs_count, {
15120
16
      "IO Errors count", "nfs.ff.ioerrs_count", FT_UINT32, BASE_DEC,
15121
16
      NULL, 0, NULL, HFILL }},
15122
15123
16
    { &hf_nfs4_ff_ioerrs_index, {
15124
16
      "IO Errors index", "nfs.ff.ioerrs_index", FT_UINT32, BASE_DEC,
15125
16
      NULL, 0, NULL, HFILL }},
15126
15127
16
    { &hf_nfs4_ff_ioerrs_length, {
15128
16
      "length", "nfs.ff.ioerrs_length", FT_UINT64, BASE_DEC,
15129
16
      NULL, 0, NULL, HFILL }},
15130
15131
16
    { &hf_nfs4_ff_ioerrs_offset, {
15132
16
      "offset", "nfs.ff.ioerrs_offset", FT_UINT64, BASE_DEC,
15133
16
      NULL, 0, NULL, HFILL }},
15134
15135
16
    { &hf_nfs4_ff_iostats_count, {
15136
16
      "IO Stats count", "nfs.ff.iostats_count", FT_UINT32, BASE_DEC,
15137
16
      NULL, 0, NULL, HFILL }},
15138
15139
16
    { &hf_nfs4_ff_iostats_index, {
15140
16
      "IO Stats index", "nfs.ff.iostats_index", FT_UINT32, BASE_DEC,
15141
16
      NULL, 0, NULL, HFILL }},
15142
15143
16
    { &hf_nfs4_io_error_op, {
15144
16
      "OP", "nfs.ff_ioerrs_op", FT_UINT32, BASE_DEC|BASE_EXT_STRING,
15145
16
      &names_nfs4_operation_ext, 0, NULL, HFILL }},
15146
15147
  /* Hidden field for v2, v3, and v4 status */
15148
16
    { &hf_nfs_status, {
15149
16
      "Status", "nfs.status", FT_UINT32, BASE_DEC | BASE_EXT_STRING,
15150
16
      &names_nfs_nfsstat_ext, 0, "Reply status", HFILL }}
15151
16
  };
15152
15153
16
  static int *ett[] = {
15154
16
    &ett_nfs,
15155
16
    &ett_nfs_fh_encoding,
15156
16
    &ett_nfs_fh_fsid,
15157
16
    &ett_nfs_fh_file,
15158
16
    &ett_nfs_fh_mount,
15159
16
    &ett_nfs_fh_export,
15160
16
    &ett_nfs_fh_xfsid,
15161
16
    &ett_nfs_fh_fn,
15162
16
    &ett_nfs_fh_xfn,
15163
16
    &ett_nfs_fh_hp,
15164
16
    &ett_nfs_fh_auth,
15165
16
    &ett_nfs_fhandle,
15166
16
    &ett_nfs_timeval,
15167
16
    &ett_nfs_fattr,
15168
16
    &ett_nfs_fh_obj,
15169
16
    &ett_nfs_fh_ex,
15170
16
    &ett_nfs_readdir_entry,
15171
16
    &ett_nfs_utf8string,
15172
15173
16
    &ett_nfs2_mode,
15174
16
    &ett_nfs2_sattr,
15175
16
    &ett_nfs2_diropargs,
15176
15177
16
    &ett_nfs3_gxfh_utlfield,
15178
16
    &ett_nfs3_gxfh_sfhfield,
15179
16
    &ett_nfs3_gxfh_sfhflags,
15180
16
    &ett_nfs3_mode,
15181
16
    &ett_nfs3_specdata,
15182
16
    &ett_nfs3_fh,
15183
16
    &ett_nfs3_nfstime,
15184
16
    &ett_nfs3_fattr,
15185
16
    &ett_nfs3_post_op_fh,
15186
16
    &ett_nfs3_sattr,
15187
16
    &ett_nfs3_diropargs,
15188
16
    &ett_nfs3_sattrguard,
15189
16
    &ett_nfs3_set_mode,
15190
16
    &ett_nfs3_set_uid,
15191
16
    &ett_nfs3_set_gid,
15192
16
    &ett_nfs3_set_size,
15193
16
    &ett_nfs3_set_atime,
15194
16
    &ett_nfs3_set_mtime,
15195
16
    &ett_nfs3_pre_op_attr,
15196
16
    &ett_nfs3_post_op_attr,
15197
16
    &ett_nfs3_wcc_attr,
15198
16
    &ett_nfs3_wcc_data,
15199
16
    &ett_nfs3_access,
15200
16
    &ett_nfs3_fsinfo_properties,
15201
15202
16
    &ett_nfs4_fh_file,
15203
16
    &ett_nfs4_fh_file_flags,
15204
16
    &ett_nfs4_fh_export,
15205
16
    &ett_nfs4_compound_call,
15206
16
    &ett_nfs4_request_op,
15207
16
    &ett_nfs4_response_op,
15208
16
    &ett_nfs4_access,
15209
16
    &ett_nfs4_access_supp,
15210
16
    &ett_nfs4_close,
15211
16
    &ett_nfs4_commit,
15212
16
    &ett_nfs4_create,
15213
16
    &ett_nfs4_delegpurge,
15214
16
    &ett_nfs4_delegreturn,
15215
16
    &ett_nfs4_getattr,
15216
16
    &ett_nfs4_getattr_args,
15217
16
    &ett_nfs4_getattr_resp,
15218
16
    &ett_nfs4_resok4,
15219
16
    &ett_nfs4_obj_attrs,
15220
16
    &ett_nfs4_fattr_new_attr_vals,
15221
16
    &ett_nfs4_fattr4_attrmask,
15222
16
    &ett_nfs4_attribute,
15223
16
    &ett_nfs4_getfh,
15224
16
    &ett_nfs4_link,
15225
16
    &ett_nfs4_lock,
15226
16
    &ett_nfs4_lockt,
15227
16
    &ett_nfs4_locku,
15228
16
    &ett_nfs4_lookup,
15229
16
    &ett_nfs4_lookupp,
15230
16
    &ett_nfs4_nverify,
15231
16
    &ett_nfs4_open,
15232
16
    &ett_nfs4_openattr,
15233
16
    &ett_nfs4_open_confirm,
15234
16
    &ett_nfs4_open_downgrade,
15235
16
    &ett_nfs4_putfh,
15236
16
    &ett_nfs4_putpubfh,
15237
16
    &ett_nfs4_putrootfh,
15238
16
    &ett_nfs4_read,
15239
16
    &ett_nfs4_readdir,
15240
16
    &ett_nfs4_readlink,
15241
16
    &ett_nfs4_test_stateid,
15242
16
    &ett_nfs4_destroy_clientid,
15243
16
    &ett_nfs4_reclaim_complete,
15244
16
    &ett_nfs4_remove,
15245
16
    &ett_nfs4_rename,
15246
16
    &ett_nfs4_renew,
15247
16
    &ett_nfs4_restorefh,
15248
16
    &ett_nfs4_savefh,
15249
16
    &ett_nfs4_setattr,
15250
16
    &ett_nfs4_setclientid,
15251
16
    &ett_nfs4_setclientid_confirm,
15252
16
    &ett_nfs4_verify,
15253
16
    &ett_nfs4_write,
15254
16
    &ett_nfs4_release_lockowner,
15255
16
    &ett_nfs4_backchannel_ctl,
15256
16
    &ett_nfs4_bind_conn_to_session,
15257
16
    &ett_nfs4_exchange_id,
15258
16
    &ett_nfs4_create_session,
15259
16
    &ett_nfs4_destroy_session,
15260
16
    &ett_nfs4_free_stateid,
15261
16
    &ett_nfs4_get_dir_delegation,
15262
16
    &ett_nfs4_secinfo_no_name,
15263
16
    &ett_nfs4_sequence,
15264
16
    &ett_nfs4_layoutget,
15265
16
    &ett_nfs4_layoutcommit,
15266
16
    &ett_nfs4_layoutreturn,
15267
16
    &ett_nfs4_getdevinfo,
15268
16
    &ett_nfs4_getdevlist,
15269
16
    &ett_nfs4_seek,
15270
16
    &ett_nfs4_allocate,
15271
16
    &ett_nfs4_deallocate,
15272
16
    &ett_nfs4_illegal,
15273
16
    &ett_nfs4_verifier,
15274
16
    &ett_nfs4_dirlist,
15275
16
    &ett_nfs4_dir_entry,
15276
16
    &ett_nfs4_pathname,
15277
16
    &ett_nfs4_change_info,
15278
16
    &ett_nfs4_open_delegation,
15279
16
    &ett_nfs4_open_why_no_deleg,
15280
16
    &ett_nfs4_open_claim,
15281
16
    &ett_nfs4_opentype,
15282
16
    &ett_nfs4_lock_owner,
15283
16
    &ett_nfs4_cb_client,
15284
16
    &ett_nfs4_client_id,
15285
16
    &ett_nfs4_clientowner,
15286
16
    &ett_nfs4_exchangeid_call_flags,
15287
16
    &ett_nfs4_exchangeid_reply_flags,
15288
16
    &ett_nfs4_server_owner,
15289
16
    &ett_nfs4_bitmap,
15290
16
    &ett_nfs4_attr_request,
15291
16
    &ett_nfs4_fattr,
15292
16
    &ett_nfs4_fsid,
15293
16
    &ett_nfs4_fs_locations,
15294
16
    &ett_nfs4_fs_location,
15295
16
    &ett_nfs4_open_result_flags,
15296
16
    &ett_nfs4_secinfo,
15297
16
    &ett_nfs4_secinfo_flavor_info,
15298
16
    &ett_nfs4_stateid,
15299
16
    &ett_nfs4_fattr_fh_expire_type,
15300
16
    &ett_nfs4_fattr_aclsupport,
15301
16
    &ett_nfs4_fattr_fs_charset_cap,
15302
16
    &ett_nfs4_aclflag,
15303
16
    &ett_nfs4_ace,
15304
16
    &ett_nfs4_clientaddr,
15305
16
    &ett_nfs4_aceflag,
15306
16
    &ett_nfs4_acemask,
15307
16
    &ett_nfs4_slotid,
15308
16
    &ett_nfs4_sr_status,
15309
16
    &ett_nfs4_serverscope,
15310
16
    &ett_nfs4_minorid,
15311
16
    &ett_nfs4_majorid,
15312
16
    &ett_nfs4_persist,
15313
16
    &ett_nfs4_backchan,
15314
16
    &ett_nfs4_rdmamode,
15315
16
    &ett_nfs4_padsize,
15316
16
    &ett_nfs4_cbrenforce,
15317
16
    &ett_nfs4_hashalg,
15318
16
    &ett_nfs4_ssvlen,
15319
16
    &ett_nfs4_maxreqsize,
15320
16
    &ett_nfs4_maxrespsize,
15321
16
    &ett_nfs4_maxrespsizecached,
15322
16
    &ett_nfs4_maxops,
15323
16
    &ett_nfs4_maxreqs,
15324
16
    &ett_nfs4_streamchanattrs,
15325
16
    &ett_nfs4_rdmachanattrs,
15326
16
    &ett_nfs4_sec_parms_array,
15327
16
    &ett_nfs4_sec_parms_item,
15328
16
    &ett_nfs4_gids,
15329
16
    &ett_nfs4_machinename,
15330
16
    &ett_nfs4_flavor,
15331
16
    &ett_nfs4_stamp,
15332
16
    &ett_nfs4_uid,
15333
16
    &ett_nfs4_gid,
15334
16
    &ett_nfs4_service,
15335
16
    &ett_nfs4_sessionid,
15336
16
    &ett_nfs4_layoutseg,
15337
16
    &ett_nfs4_layoutseg_sub,
15338
16
    &ett_nfs4_nfl_util,
15339
16
    &ett_nfs4_cb_request_op,
15340
16
    &ett_nfs4_cb_resop,
15341
16
    &ett_nfs4_cb_getattr,
15342
16
    &ett_nfs4_cb_recall,
15343
16
    &ett_nfs4_cb_layoutrecall,
15344
16
    &ett_nfs4_cb_pushdeleg,
15345
16
    &ett_nfs4_cb_recallany,
15346
16
    &ett_nfs4_cb_recallableobjavail,
15347
16
    &ett_nfs4_cb_recallslot,
15348
16
    &ett_nfs4_cb_sequence,
15349
16
    &ett_nfs4_cb_wantscancelled,
15350
16
    &ett_nfs4_cb_notifylock,
15351
16
    &ett_nfs4_cb_notifydeviceid,
15352
16
    &ett_nfs4_cb_notify,
15353
16
    &ett_nfs4_cb_reflists,
15354
16
    &ett_nfs4_cb_refcalls,
15355
16
    &ett_nfs4_cb_illegal,
15356
16
    &ett_nfs4_chan_attrs,
15357
16
    &ett_nfs4_create_session_flags,
15358
16
    &ett_nfs4_sequence_status_flags,
15359
16
    &ett_nfs4_want_notify_flags,
15360
16
    &ett_nfs4_ff_layout_flags,
15361
16
    &ett_nfs4_scsi_layout_vol,
15362
16
    &ett_nfs4_scsi_layout_vol_indices,
15363
16
    &ett_nfs4_layoutstats,
15364
16
    &ett_nfs4_io_info,
15365
16
    &ett_nfs4_io_latency,
15366
16
    &ett_nfs4_io_time,
15367
16
    &ett_nfs4_callback_stateids_sub,
15368
16
    &ett_nfs4_source_servers_sub,
15369
16
    &ett_nfs4_copy,
15370
16
    &ett_nfs4_copy_notify,
15371
16
    &ett_nfs4_device_errors_sub,
15372
16
    &ett_nfs4_layouterror,
15373
16
    &ett_nfs4_ff_ioerrs_sub,
15374
16
    &ett_nfs4_ff_iostats_sub,
15375
16
    &ett_nfs4_clone,
15376
16
    &ett_nfs4_getxattr,
15377
16
    &ett_nfs4_setxattr,
15378
16
    &ett_nfs4_listxattr,
15379
16
    &ett_nfs4_removexattr,
15380
16
    &ett_nfs4_offload_cancel,
15381
16
    &ett_nfs4_offload_status,
15382
16
    &ett_nfs4_osr_complete_sub,
15383
16
    &ett_nfs4_io_advise,
15384
16
    &ett_nfs4_read_plus,
15385
16
    &ett_nfs4_read_plus_content_sub,
15386
16
    &ett_nfs4_write_same,
15387
16
    &ett_nfs4_fh_pd_flags,
15388
16
    &ett_nfs4_fh_pd_sites,
15389
16
    &ett_nfs4_fh_pd_spaces,
15390
16
    &ett_nfs4_listxattr_names,
15391
16
    &ett_nfs4_notify_delay,
15392
16
    &ett_nfs4_notify_attrs,
15393
16
    &ett_nfs4_cb_notify_changes,
15394
16
    &ett_nfs4_cb_notify_list_entries,
15395
16
    &ett_nfs4_cb_notify_attr4_dir,
15396
16
    &ett_nfs4_cb_notify_attr4_child,
15397
16
    &ett_nfs4_cb_notify_remove4,
15398
16
    &ett_nfs4_cb_notify_add4,
15399
16
    &ett_nfs4_cb_notify_rename4,
15400
16
    &ett_nfs4_nfstime,
15401
16
  };
15402
15403
16
  static ei_register_info ei[] = {
15404
16
    { &ei_nfs_too_many_ops, { "nfs.too_many_ops", PI_PROTOCOL, PI_NOTE, "Too many operations", EXPFILL }},
15405
16
    { &ei_nfs_not_vnx_file, { "nfs.not_vnx_file", PI_UNDECODED, PI_WARN, "Not a Celerra|VNX file handle", EXPFILL }},
15406
16
    { &ei_nfs_too_many_bitmaps, { "nfs.too_many_bitmaps", PI_PROTOCOL, PI_NOTE, "Too many bitmap array items", EXPFILL }},
15407
16
    { &ei_nfs_bitmap_no_dissector, { "nfs.bitmap_no_dissector", PI_PROTOCOL, PI_WARN,
15408
16
      "Unknown dissector for bitmap attribute", EXPFILL }},
15409
16
    { &ei_nfs_bitmap_skip_value, { "nfs.bitmap_skip_value", PI_PROTOCOL, PI_WARN,
15410
16
      "Not dissecting value since a previous value was not dissected", EXPFILL }},
15411
16
    { &ei_nfs_bitmap_undissected_data, { "nfs.bitmap_undissected_data", PI_PROTOCOL, PI_WARN,
15412
16
      "There is some bitmap data left undissected", EXPFILL }},
15413
16
    { &ei_nfs4_stateid_deprecated, { "nfs.stateid.deprecated", PI_PROTOCOL, PI_WARN, "State ID deprecated in CLOSE responses [RFC7530 16.2.5]", EXPFILL }},
15414
16
    { &ei_nfs_file_system_cycle, { "nfs.file_system_cycle", PI_PROTOCOL, PI_WARN, "Possible file system cycle detected", EXPFILL }},
15415
16
  };
15416
15417
16
  module_t *nfs_module;
15418
16
  expert_module_t* expert_nfs;
15419
15420
16
  proto_nfs = proto_register_protocol("Network File System", "NFS", "nfs");
15421
15422
  /* "protocols" registered just for Decode As */
15423
16
  proto_nfs_unknown = proto_register_protocol_in_name_only("Unknown NFS", "nfs_unknown", "nfs.unknown", proto_nfs, FT_PROTOCOL);
15424
16
  proto_nfs_svr4 = proto_register_protocol_in_name_only("SVR4", "svr4", "nfs.svr4", proto_nfs, FT_PROTOCOL);
15425
16
  proto_nfs_knfsd_le = proto_register_protocol_in_name_only("KNFSD_LE", "knfsd_le", "nfs.knfsd_le", proto_nfs, FT_PROTOCOL);
15426
16
  proto_nfs_nfsd_le = proto_register_protocol_in_name_only("NFSD_LE", "nfsd_le", "nfs.nfsd_le", proto_nfs, FT_PROTOCOL);
15427
16
  proto_nfs_knfsd_new = proto_register_protocol_in_name_only("KNFSD_NEW", "knfsd_new", "nfs.knfsd_new", proto_nfs, FT_PROTOCOL);
15428
16
  proto_nfs_ontap_v3 = proto_register_protocol_in_name_only("ONTAP_V3", "ontap_v3", "nfs.ontap_v3", proto_nfs, FT_PROTOCOL);
15429
16
  proto_nfs_ontap_v4 = proto_register_protocol_in_name_only("ONTAP_V4", "ontap_v4", "nfs.ontap_v4", proto_nfs, FT_PROTOCOL);
15430
16
  proto_nfs_ontap_gx_v3 = proto_register_protocol_in_name_only("ONTAP_GX_V3", "ontap_gx_v3", "nfs.ontap_gx_v3", proto_nfs, FT_PROTOCOL);
15431
16
  proto_nfs_celerra_vnx = proto_register_protocol_in_name_only("CELERRA_VNX", "celerra_vnx", "nfs.celerra_vnx", proto_nfs, FT_PROTOCOL);
15432
16
  proto_nfs_gluster = proto_register_protocol_in_name_only("GLUSTER", "gluster", "nfs.gluster", proto_nfs, FT_PROTOCOL);
15433
16
  proto_nfs_dcache = proto_register_protocol_in_name_only("dCache", "dcache", "nfs.dcache", proto_nfs, FT_PROTOCOL);
15434
16
  proto_nfs_primary_data = proto_register_protocol_in_name_only("Primary_Data", "pd", "nfs.primary_data", proto_nfs, FT_PROTOCOL);
15435
15436
  /* "protocols" registered just for ONC-RPC Service Response Time */
15437
16
  proto_nfs_cb = proto_register_protocol_in_name_only("Network File System CB", "NFS CB", "nfs.cb", proto_nfs, FT_PROTOCOL);
15438
15439
  /* "protocol" registered just for NFSv4 Service Response Time (the
15440
   * protocol short name is used for, e.g. the GUI menu item.) */
15441
16
  proto_nfsv4 = proto_register_protocol_in_name_only("Network File System v4", "NFSv4", "nfsv4", proto_nfs, FT_PROTOCOL);
15442
15443
16
  proto_register_field_array(proto_nfs, hf, array_length(hf));
15444
16
  proto_register_subtree_array(ett, array_length(ett));
15445
16
  expert_nfs = expert_register_protocol(proto_nfs);
15446
16
  expert_register_field_array(expert_nfs, ei, array_length(ei));
15447
15448
16
  nfs_module = prefs_register_protocol(proto_nfs, NULL);
15449
16
  prefs_register_bool_preference(nfs_module, "file_name_snooping",
15450
16
               "Snoop FH to filename mappings",
15451
16
               "Whether the dissector should snoop the FH to"
15452
16
               " filename mappings by looking inside certain packets",
15453
16
               &nfs_file_name_snooping);
15454
16
  prefs_register_bool_preference(nfs_module, "file_full_name_snooping",
15455
16
               "Snoop full path to filenames",
15456
16
               "Whether the dissector should snoop the full pathname"
15457
16
               " for files for matching FH's",
15458
16
               &nfs_file_name_full_snooping);
15459
16
  prefs_register_bool_preference(nfs_module, "fhandle_find_both_reqrep",
15460
16
               "Fhandle filters finds both request/response",
15461
16
               "With this option display filters for nfs fhandles"
15462
16
               " (nfs.fh.{name|full_name|hash}) will find both the request"
15463
16
               " and response packets for a RPC call, even if the actual"
15464
16
               " fhandle is only present in one of the packets",
15465
16
               &nfs_fhandle_reqrep_matching);
15466
16
  prefs_register_bool_preference(nfs_module, "display_nfsv4_tag",
15467
16
               "Display NFSv4 tag in info Column",
15468
16
               "When enabled, this option will print the NFSv4 tag"
15469
16
               " (if one exists) in the Info column in the Summary pane",
15470
16
          &nfs_display_v4_tag);
15471
16
  prefs_register_bool_preference(nfs_module, "display_major_nfsv4_ops",
15472
16
               "Display only 'significant' NFSv4 Operations in info Column",
15473
16
               "When enabled, shows only the significant NFSv4 Operations"
15474
16
               " in the info column.  Others (like GETFH, PUTFH, etc) are not displayed",
15475
16
          &display_major_nfs4_ops);
15476
15477
16
  prefs_register_obsolete_preference(nfs_module, "default_fhandle_type");
15478
15479
16
  nfs_name_snoop_known    = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope());
15480
16
  nfs_file_handles        = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope());
15481
16
  nfs_fhandle_frame_table = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope());
15482
16
  register_init_routine(nfs_name_snoop_init);
15483
16
  register_cleanup_routine(nfs_name_snoop_cleanup);
15484
16
  register_init_routine(nfs4_cb_init);
15485
16
  register_cleanup_routine(nfs4_cb_cleanup);
15486
15487
16
  nfs_fhandle_table = register_decode_as_next_proto(proto_nfs, "nfs_fhandle.type",
15488
16
                "NFS File Handle types", nfs_prompt);
15489
15490
16
  nfsv4_tap = register_tap("nfsv4");
15491
15492
16
  register_srt_table(proto_nfsv4, "nfsv4", 1, nfsstat_packet, nfsstat_init, NULL);
15493
16
}
15494
15495
15496
void
15497
proto_reg_handoff_nfs(void)
15498
16
{
15499
16
  dissector_handle_t fhandle_handle;
15500
15501
  /* Register the protocol as RPC */
15502
16
  rpc_init_prog(proto_nfs, NFS_PROGRAM, ett_nfs,
15503
16
      G_N_ELEMENTS(nfs_vers_info), nfs_vers_info);
15504
15505
16
  fhandle_handle = create_dissector_handle(dissect_fhandle_data_SVR4, proto_nfs_svr4);
15506
16
  dissector_add_for_decode_as("nfs_fhandle.type", fhandle_handle);
15507
15508
16
  fhandle_handle = create_dissector_handle(dissect_fhandle_data_LINUX_KNFSD_LE, proto_nfs_knfsd_le);
15509
16
  dissector_add_for_decode_as("nfs_fhandle.type", fhandle_handle);
15510
15511
16
  fhandle_handle = create_dissector_handle(dissect_fhandle_data_LINUX_NFSD_LE, proto_nfs_nfsd_le);
15512
16
  dissector_add_for_decode_as("nfs_fhandle.type", fhandle_handle);
15513
15514
16
  fhandle_handle = create_dissector_handle(dissect_fhandle_data_LINUX_KNFSD_NEW, proto_nfs_knfsd_new);
15515
16
  dissector_add_for_decode_as("nfs_fhandle.type", fhandle_handle);
15516
15517
16
  fhandle_handle = create_dissector_handle(dissect_fhandle_data_NETAPP, proto_nfs_ontap_v3);
15518
16
  dissector_add_for_decode_as("nfs_fhandle.type", fhandle_handle);
15519
15520
16
  fhandle_handle = create_dissector_handle(dissect_fhandle_data_NETAPP_V4, proto_nfs_ontap_v4);
15521
16
  dissector_add_for_decode_as("nfs_fhandle.type", fhandle_handle);
15522
15523
16
  fhandle_handle = create_dissector_handle(dissect_fhandle_data_NETAPP_GX_v3, proto_nfs_ontap_gx_v3);
15524
16
  dissector_add_for_decode_as("nfs_fhandle.type", fhandle_handle);
15525
15526
16
  fhandle_handle = create_dissector_handle(dissect_fhandle_data_CELERRA_VNX, proto_nfs_celerra_vnx);
15527
16
  dissector_add_for_decode_as("nfs_fhandle.type", fhandle_handle);
15528
15529
16
  fhandle_handle = create_dissector_handle(dissect_fhandle_data_GLUSTER, proto_nfs_gluster);
15530
16
  dissector_add_for_decode_as("nfs_fhandle.type", fhandle_handle);
15531
15532
16
  fhandle_handle = create_dissector_handle(dissect_fhandle_data_DCACHE, proto_nfs_dcache);
15533
16
  dissector_add_for_decode_as("nfs_fhandle.type", fhandle_handle);
15534
15535
16
  fhandle_handle = create_dissector_handle(dissect_fhandle_data_PRIMARY_DATA, proto_nfs_primary_data);
15536
16
  dissector_add_for_decode_as("nfs_fhandle.type", fhandle_handle);
15537
15538
16
  fhandle_handle = create_dissector_handle(dissect_fhandle_data_unknown, proto_nfs_unknown);
15539
16
  dissector_add_for_decode_as("nfs_fhandle.type", fhandle_handle);
15540
16
}
15541
15542
/*
15543
 * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
15544
 *
15545
 * Local variables:
15546
 * c-basic-offset: 8
15547
 * tab-width: 8
15548
 * indent-tabs-mode: t
15549
 * End:
15550
 *
15551
 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
15552
 * :indentSize=8:tabSize=8:noTabs=false:
15553
 */