Wireshark-dev: [Wireshark-dev] [PATCH 13/16] NFS: Fix dissecting NFS4 mode

From: Pali Rohár <pali@xxxxxxxxxx>
Date: Fri, 13 Sep 2024 23:08:48 +0200
NFS4 mode does not contain NFS2 name (file type) bits.
---
 epan/dissectors/packet-nfs.c | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/epan/dissectors/packet-nfs.c b/epan/dissectors/packet-nfs.c
index 60f11ff842b7..e34b5b3f053b 100644
--- a/epan/dissectors/packet-nfs.c
+++ b/epan/dissectors/packet-nfs.c
@@ -7173,7 +7173,26 @@ dissect_nfs4_fattr_fs_charset_cap(tvbuff_t *tvb, int offset, proto_tree *tree)
 static int
 dissect_nfs4_mode(tvbuff_t *tvb, int offset, proto_tree *tree)
 {
-	return dissect_nfs2_mode(tvb, offset, tree);
+	static int * const modes[] = {
+		&hf_nfs2_mode_set_user_id,
+		&hf_nfs2_mode_set_group_id,
+		&hf_nfs2_mode_save_swap_text,
+		&hf_nfs2_mode_read_owner,
+		&hf_nfs2_mode_write_owner,
+		&hf_nfs2_mode_exec_owner,
+		&hf_nfs2_mode_read_group,
+		&hf_nfs2_mode_write_group,
+		&hf_nfs2_mode_exec_group,
+		&hf_nfs2_mode_read_other,
+		&hf_nfs2_mode_write_other,
+		&hf_nfs2_mode_exec_other,
+		NULL
+	};
+
+	proto_tree_add_bitmask(tree, tvb, offset, hf_nfs2_mode, ett_nfs2_mode, modes, ENC_BIG_ENDIAN);
+
+	offset += 4;
+	return offset;
 }
 
 #define FH4_PERSISTENT         0x00000000
-- 
2.20.1