Wireshark-dev: [Wireshark-dev] [PATCH 11/16] NFS: Dissect NFS4 nfstime4 into human readable for

From: Pali Rohár <pali@xxxxxxxxxx>
Date: Fri, 13 Sep 2024 23:08:46 +0200
---
 epan/dissectors/packet-nfs.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/epan/dissectors/packet-nfs.c b/epan/dissectors/packet-nfs.c
index 1d6d49b9b6fe..cd5e82d02382 100644
--- a/epan/dissectors/packet-nfs.c
+++ b/epan/dissectors/packet-nfs.c
@@ -457,6 +457,7 @@ static int hf_nfs4_length;
 static int hf_nfs4_changeid;
 static int hf_nfs4_changeid_before;
 static int hf_nfs4_changeid_after;
+static int hf_nfs4_time;
 static int hf_nfs4_time_seconds;
 static int hf_nfs4_time_nseconds;
 static int hf_nfs4_fsid_major;
@@ -940,6 +941,7 @@ static int ett_nfs4_write_same;
 static int ett_nfs4_listxattr_names;
 static int ett_nfs4_notify_delay;
 static int ett_nfs4_notify_attrs;
+static int ett_nfs4_nfstime;
 
 static expert_field ei_nfs_too_many_ops;
 static expert_field ei_nfs_not_vnx_file;
@@ -6751,6 +6753,13 @@ dissect_nfs4_pathname(tvbuff_t *tvb, int offset, proto_tree *tree)
 static int
 dissect_nfs4_nfstime(tvbuff_t *tvb, int offset, proto_tree *tree)
 {
+	nstime_t ts;
+	proto_item *item;
+
+	ts.secs = tvb_get_ntoh64(tvb, offset+0);
+	ts.nsecs = tvb_get_ntohl(tvb, offset+8);
+	item = proto_tree_add_time(tree, hf_nfs4_time, tvb, offset, 8, &ts);
+	tree = proto_item_add_subtree(item, ett_nfs4_nfstime);
 	offset = dissect_rpc_uint64(tvb, tree, hf_nfs4_time_seconds, offset);
 	offset = dissect_rpc_uint32(tvb, tree, hf_nfs4_time_nseconds, offset);
 
@@ -13205,6 +13214,10 @@ proto_register_nfs(void)
 			"changeid (after)", "nfs.changeid4.after", FT_UINT64, BASE_DEC,
 			NULL, 0, NULL, HFILL }},
 
+		{ &hf_nfs4_time, {
+			"nfstime4", "nfs.nfstime4", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL,
+			NULL, 0, NULL, HFILL }},
+
 		{ &hf_nfs4_time_seconds, {
 			"seconds", "nfs.nfstime4.seconds", FT_UINT64, BASE_DEC,
 			NULL, 0, NULL, HFILL }},
@@ -15053,6 +15066,7 @@ proto_register_nfs(void)
 		&ett_nfs4_listxattr_names,
 		&ett_nfs4_notify_delay,
 		&ett_nfs4_notify_attrs,
+		&ett_nfs4_nfstime,
 	};
 
 	static ei_register_info ei[] = {
-- 
2.20.1