packet/gluster: Add GF_CBK_CACHE_INVALADATION dissector bits

As part of Gluster UPCALL infrastructure support, a new rpc
CBK procedure has been added to gluster_cbk_actors program in
order to send CACHE-INVALIDATION callback requests from
the GlusterFS server to its client.

This change is to include that procedure to the wireshark dissector.

Files containing definitions related to this new RPC procedure added -
https://github.com/gluster/glusterfs/blob/master/rpc/rpc-lib/src/protocol-common.h#L129
https://github.com/gluster/glusterfs/blob/master/rpc/xdr/src/glusterfs3-xdr.x#L47
https://github.com/gluster/glusterfs/blob/master/libglusterfs/src/upcall-utils.h

bug:11880
Change-Id: I18616b00616c6a612417913373c1b9c900f4972c
Signed-off-by: Soumya Koduri <skoduri@redhat.com>
Reviewed-on: https://code.wireshark.org/review/12565
Reviewed-by: Niels de Vos <ndevos@redhat.com>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
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>
This commit is contained in:
Soumya Koduri 2015-12-11 16:21:34 +05:30 committed by Anders Broman
parent 4d17b275e7
commit 3b706bab62
3 changed files with 91 additions and 2 deletions

View File

@ -303,6 +303,9 @@ enum gf_cbk_procnum {
GF_CBK_NULL = 0,
GF_CBK_FETCHSPEC,
GF_CBK_INO_FLUSH,
GF_CBK_EVENT_NOTIFY,
GF_CBK_GET_SNAPS,
GF_CBK_CACHE_INVALIDATION,
GF_CBK_MAXVALUE
};
@ -442,6 +445,12 @@ enum glusterd_ops {
GD_OP_MAX
};
/* based on enum gf_upcall_event_ from libglusterfs/src/upcall-utils.h */
enum gf_upcall_event {
GF_UPCALL_EVENT_NULL,
GF_UPCALL_CACHE_INVALIDATION,
};
extern int
gluster_rpc_dissect_dict(proto_tree *tree, tvbuff_t *tvb, int hfindex,
int offset);
@ -453,4 +462,7 @@ extern int
glusterfs_gfs3_3_op_common_reply(tvbuff_t *tvb,
packet_info *pinfo, proto_tree *tree, void* data _U_);
extern int
glusterfs_rpc_dissect_gf_iatt(proto_tree *tree, tvbuff_t *tvb, int hfindex,
int offset);
#endif /* __PACKET_GLUSTER_H__ */

View File

@ -259,7 +259,7 @@ glusterfs_rpc_dissect_mode(proto_tree *tree, tvbuff_t *tvb, int hfindex,
/*
* from rpc/xdr/src/glusterfs3-xdr.c:xdr_gf_iatt()
*/
static int
int
glusterfs_rpc_dissect_gf_iatt(proto_tree *tree, tvbuff_t *tvb, int hfindex,
int offset)
{

View File

@ -62,6 +62,16 @@ static gint hf_gluster_hndsk_flags = -1;
static gint ett_gluster_cbk = -1;
static gint ett_gluster_hndsk = -1;
/* CBK_CACHE_INVALIDATION */
static gint hf_gluster_cbk_gfid = -1;
static gint hf_gluster_cbk_upcall_event_type = -1;
static gint hf_gluster_cbk_ci_flags = -1;
static gint hf_gluster_cbk_ci_expire_time_attr = -1;
static gint hf_gluster_cbk_ci_stat = -1;
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;
/* procedures for GLUSTER_HNDSK_PROGRAM */
static int
gluster_hndsk_setvolume_reply(tvbuff_t *tvb, packet_info *pinfo,
@ -176,6 +186,27 @@ gluster_hndsk_2_event_notify_reply(tvbuff_t *tvb,
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,
packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
{
int offset = 0;
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 = 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);
offset = glusterfs_rpc_dissect_gf_iatt(tree, tvb,
hf_gluster_cbk_ci_parent_stat, offset);
offset = glusterfs_rpc_dissect_gf_iatt(tree, tvb,
hf_gluster_cbk_ci_oldparent_stat, offset);
offset = gluster_rpc_dissect_dict(tree, tvb, hf_gluster_cbk_xdata, offset);
return offset;
}
static int
gluster_hndsk_dissect_common_reply(tvbuff_t *tvb,
packet_info *pinfo, proto_tree *tree, void* data _U_)
@ -316,6 +347,10 @@ static const vsff gluster_cbk_proc[] = {
{ GF_CBK_NULL, "NULL", dissect_rpc_void, dissect_rpc_void },
{ GF_CBK_FETCHSPEC, "FETCHSPEC", dissect_rpc_unknown, dissect_rpc_unknown },
{ GF_CBK_INO_FLUSH, "INO_FLUSH", dissect_rpc_unknown, dissect_rpc_unknown },
{ GF_CBK_EVENT_NOTIFY, "EVENTNOTIFY", dissect_rpc_unknown, dissect_rpc_unknown },
{ GF_CBK_GET_SNAPS, "GETSNAPS", dissect_rpc_unknown, dissect_rpc_unknown },
{ GF_CBK_CACHE_INVALIDATION, "CACHE_INVALIDATION",
gluster_cbk_cache_invalidation_call, dissect_rpc_unknown },
{ 0, NULL, NULL, NULL }
};
static const rpc_prog_vers_info gluster_cbk_vers_info[] = {
@ -325,9 +360,19 @@ static const value_string gluster_cbk_proc_vals[] = {
{ GF_CBK_NULL, "NULL" },
{ GF_CBK_FETCHSPEC, "FETCHSPEC" },
{ GF_CBK_INO_FLUSH, "INO_FLUSH" },
{ GF_CBK_EVENT_NOTIFY, "EVENTNOTIFY" },
{ GF_CBK_GET_SNAPS, "GETSNAPS" },
{ GF_CBK_CACHE_INVALIDATION, "CACHE_INVALIDATION" },
{ 0, NULL }
};
static const value_string gluster_cbk_upcall_event_type[] = {
{ GF_UPCALL_EVENT_NULL, "NULL" },
{ GF_UPCALL_CACHE_INVALIDATION, "CACHE_INVALIDATION" },
{ 0, NULL }
};
static value_string_ext gluster_cbk_upcall_event_type_ext = VALUE_STRING_EXT_INIT(gluster_cbk_upcall_event_type);
void
proto_register_gluster_cbk(void)
{
@ -338,7 +383,39 @@ proto_register_gluster_cbk(void)
{ "GlusterFS Callback", "glusterfs.cbk.proc",
FT_UINT32, BASE_DEC,
VALS(gluster_cbk_proc_vals), 0, NULL, HFILL }
}
},
{ &hf_gluster_cbk_gfid,
{ "GFID", "glusterfs.cbk.gfid", FT_STRING, BASE_NONE,
NULL, 0, NULL, HFILL }
},
{ &hf_gluster_cbk_upcall_event_type,
{ "Event Type", "glusterfs.cbk.upcall.event_type", FT_UINT32, BASE_DEC | BASE_EXT_STRING,
&gluster_cbk_upcall_event_type_ext, 0, NULL, HFILL }
},
{ &hf_gluster_cbk_ci_flags,
{ "Flags", "glusterfs.cbk.cache_invalidation.flags", FT_UINT32, BASE_DEC_HEX,
NULL, 0, NULL, HFILL }
},
{ &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 }
},
{ &hf_gluster_cbk_ci_stat,
{ "Stat", "glusterfs.cbk.cache_invalidation.stat", FT_NONE, BASE_NONE, NULL,
0, NULL, HFILL }
},
{ &hf_gluster_cbk_ci_parent_stat,
{ "Parent Stat", "glusterfs.cbk.cache_invalidation.parent.stat", FT_NONE, BASE_NONE, NULL,
0, NULL, HFILL }
},
{ &hf_gluster_cbk_ci_oldparent_stat,
{ "Old Parent Stat", "glusterfs.cbk.cache_invalidation.oldparent.stat",
FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }
},
{ &hf_gluster_cbk_xdata,
{ "Xdata", "glusterfs.cbk.xdata", FT_STRING, BASE_NONE,
NULL, 0, NULL, HFILL }
},
};
/* Setup protocol subtree array */