aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-glusterfs_hndsk.c
diff options
context:
space:
mode:
authorNiels de Vos <ndevos@redhat.com>2016-09-18 15:41:17 +0200
committerAnders Broman <a.broman58@gmail.com>2016-09-18 20:31:14 +0000
commit763f7510e37c907e57c53b0dce1b6072ae4a0759 (patch)
tree50dad61b7b82a238fb0dbfe08e92e7ca6ece9d08 /epan/dissectors/packet-glusterfs_hndsk.c
parent9dad78a6fcb7c9f14c25235b95f19b27701e4326 (diff)
glusterfs: decode upcall flags for cache-invalidation
Add decoding of the upcall->flags value. This mask currently used do give hints about the cache-invalidation structures. Change-Id: I4a3ab03bec6e2a2c9f8c7bbf17babb2bc93c9d7b Signed-off-by: Niels de Vos <ndevos@redhat.com> Reviewed-on: https://code.wireshark.org/review/17776 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-glusterfs_hndsk.c')
-rw-r--r--epan/dissectors/packet-glusterfs_hndsk.c114
1 files changed, 110 insertions, 4 deletions
diff --git a/epan/dissectors/packet-glusterfs_hndsk.c b/epan/dissectors/packet-glusterfs_hndsk.c
index 15e59d1116..f6422a4dd6 100644
--- a/epan/dissectors/packet-glusterfs_hndsk.c
+++ b/epan/dissectors/packet-glusterfs_hndsk.c
@@ -60,9 +60,10 @@ static gint hf_gluster_hndsk_flags = -1;
/* Initialize the subtree pointers */
static gint ett_gluster_cbk = -1;
+static gint ett_gluster_cbk_flags = -1;
static gint ett_gluster_hndsk = -1;
-/* CBK_CACHE_INVALIDATION */
+/* upcall, used for cache-invalidation etc. */
static gint hf_gluster_cbk_gfid = -1;
static gint hf_gluster_cbk_upcall_event_type = -1;
static gint hf_gluster_cbk_ci_flags = -1;
@@ -72,6 +73,20 @@ static gint hf_gluster_cbk_ci_parent_stat = -1;
static gint hf_gluster_cbk_ci_oldparent_stat = -1;
static gint hf_gluster_cbk_xdata = -1;
+/* flags for upcall */
+static gint hg_gluster_cbk_upcall_flag_nlink = -1;
+static gint hg_gluster_cbk_upcall_flag_mode = -1;
+static gint hg_gluster_cbk_upcall_flag_own = -1;
+static gint hg_gluster_cbk_upcall_flag_size = -1;
+static gint hg_gluster_cbk_upcall_flag_times = -1;
+static gint hg_gluster_cbk_upcall_flag_atime = -1;
+static gint hg_gluster_cbk_upcall_flag_perm = -1;
+static gint hg_gluster_cbk_upcall_flag_rename = -1;
+static gint hg_gluster_cbk_upcall_flag_forget = -1;
+static gint hg_gluster_cbk_upcall_flag_parent_times = -1;
+static gint hg_gluster_cbk_upcall_flag_xattr = -1;
+static gint hg_gluster_cbk_upcall_flag_xattr_rm = -1;
+
/* procedures for GLUSTER_HNDSK_PROGRAM */
static int
gluster_hndsk_setvolume_reply(tvbuff_t *tvb, packet_info *pinfo,
@@ -186,6 +201,34 @@ gluster_hndsk_2_event_notify_reply(tvbuff_t *tvb,
return offset;
}
+static int
+glusterfs_rpc_dissect_upcall_flags(proto_tree *tree, tvbuff_t *tvb, int offset)
+{
+ static const int *flag_bits[] = {
+ &hg_gluster_cbk_upcall_flag_nlink,
+ &hg_gluster_cbk_upcall_flag_mode,
+ &hg_gluster_cbk_upcall_flag_own,
+ &hg_gluster_cbk_upcall_flag_size,
+ &hg_gluster_cbk_upcall_flag_times,
+ &hg_gluster_cbk_upcall_flag_atime,
+ &hg_gluster_cbk_upcall_flag_perm,
+ &hg_gluster_cbk_upcall_flag_rename,
+ &hg_gluster_cbk_upcall_flag_forget,
+ &hg_gluster_cbk_upcall_flag_parent_times,
+ &hg_gluster_cbk_upcall_flag_xattr,
+ &hg_gluster_cbk_upcall_flag_xattr_rm,
+ NULL
+ };
+
+ if (tree)
+ proto_tree_add_bitmask(tree, tvb, offset,
+ hf_gluster_cbk_ci_flags, ett_gluster_cbk_flags,
+ flag_bits, ENC_BIG_ENDIAN);
+
+ offset += 4;
+ return offset;
+}
+
/* In rpc/xdr/src/glusterfs3-xdr.c. xdr_gfs3_cbk_cache_invalidation_req */
static int
gluster_cbk_cache_invalidation_call(tvbuff_t *tvb,
@@ -195,7 +238,7 @@ gluster_cbk_cache_invalidation_call(tvbuff_t *tvb,
offset = dissect_rpc_string(tvb, tree, hf_gluster_cbk_gfid, offset, NULL);
offset = dissect_rpc_uint32(tvb, tree, hf_gluster_cbk_upcall_event_type, offset);
- offset = dissect_rpc_uint32(tvb, tree, hf_gluster_cbk_ci_flags, offset);
+ offset = glusterfs_rpc_dissect_upcall_flags(tree, tvb, offset);
offset = dissect_rpc_uint32(tvb, tree, hf_gluster_cbk_ci_expire_time_attr, offset);
offset = glusterfs_rpc_dissect_gf_iatt(tree, tvb,
hf_gluster_cbk_ci_stat, offset);
@@ -398,7 +441,7 @@ proto_register_gluster_cbk(void)
},
{ &hf_gluster_cbk_ci_expire_time_attr,
{ "Expire Time Attr", "glusterfs.cbk.cache_invalidation.expire_time_attr",
- FT_UINT32, BASE_OCT, NULL, 0, NULL, HFILL }
+ FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }
},
{ &hf_gluster_cbk_ci_stat,
{ "Stat", "glusterfs.cbk.cache_invalidation.stat", FT_NONE, BASE_NONE, NULL,
@@ -416,11 +459,74 @@ proto_register_gluster_cbk(void)
{ "Xdata", "glusterfs.cbk.xdata", FT_STRING, BASE_NONE,
NULL, 0, NULL, HFILL }
},
+
+ /* upcall flags from libglusterfs/src/upcall-utils.h */
+ { &hg_gluster_cbk_upcall_flag_nlink,
+ { "NLINK", "glusterfs.cbk.cache_invalidation.flag.nlink",
+ FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x00000001,
+ NULL, HFILL }
+ },
+ { &hg_gluster_cbk_upcall_flag_mode,
+ { "MODE", "glusterfs.cbk.cache_invalidation.flag.mode",
+ FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x00000002,
+ NULL, HFILL }
+ },
+ { &hg_gluster_cbk_upcall_flag_own,
+ { "OWN", "glusterfs.cbk.cache_invalidation.flag.own",
+ FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x00000004,
+ NULL, HFILL }
+ },
+ { &hg_gluster_cbk_upcall_flag_size,
+ { "SIZE", "glusterfs.cbk.cache_invalidation.flag.size",
+ FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x00000008,
+ NULL, HFILL }
+ },
+ { &hg_gluster_cbk_upcall_flag_times,
+ { "TIMES", "glusterfs.cbk.cache_invalidation.flag.times",
+ FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x00000010,
+ NULL, HFILL }
+ },
+ { &hg_gluster_cbk_upcall_flag_atime,
+ { "ATIME", "glusterfs.cbk.cache_invalidation.flag.atime",
+ FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x00000020,
+ NULL, HFILL }
+ },
+ { &hg_gluster_cbk_upcall_flag_perm,
+ { "PERM", "glusterfs.cbk.cache_invalidation.flag.perm",
+ FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x00000040,
+ NULL, HFILL }
+ },
+ { &hg_gluster_cbk_upcall_flag_rename,
+ { "RENAME", "glusterfs.cbk.cache_invalidation.flag.rename",
+ FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x00000080,
+ NULL, HFILL }
+ },
+ { &hg_gluster_cbk_upcall_flag_forget,
+ { "FORGET", "glusterfs.cbk.cache_invalidation.flag.forget",
+ FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x00000100,
+ NULL, HFILL }
+ },
+ { &hg_gluster_cbk_upcall_flag_parent_times,
+ { "PARENT_TIMES", "glusterfs.cbk.cache_invalidation.flag.parent_times",
+ FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x00000200,
+ NULL, HFILL }
+ },
+ { &hg_gluster_cbk_upcall_flag_xattr,
+ { "XATTR", "glusterfs.cbk.cache_invalidation.flag.xattr",
+ FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x00000400,
+ NULL, HFILL }
+ },
+ { &hg_gluster_cbk_upcall_flag_xattr_rm,
+ { "XATTR_RM", "glusterfs.cbk.cache_invalidation.flag.xattr_rm",
+ FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x00000800,
+ NULL, HFILL }
+ },
};
/* Setup protocol subtree array */
static gint *ett[] = {
- &ett_gluster_cbk
+ &ett_gluster_cbk,
+ &ett_gluster_cbk_flags
};
/* Register the protocol name and description */