summaryrefslogtreecommitdiff
path: root/epan/dissectors/packet-glusterfs.c
diff options
context:
space:
mode:
authorPascal Quantin <pascal.quantin@gmail.com>2013-03-21 19:49:21 +0000
committerPascal Quantin <pascal.quantin@gmail.com>2013-03-21 19:49:21 +0000
commit722b981c9f37ae115feef9ede712a9376b066e22 (patch)
treecc4d61411e7bfb4fe5909a8466b228c28e6adffb /epan/dissectors/packet-glusterfs.c
parent3cfaf471f0ed7cae12a2b973d25d4903ccf51b00 (diff)
downloadwireshark-722b981c9f37ae115feef9ede712a9376b066e22.tar.gz
From Niels de Vos via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7310 :
glusterfs: improve endianness handling and displaying of dict contents svn path=/trunk/; revision=48461
Diffstat (limited to 'epan/dissectors/packet-glusterfs.c')
-rw-r--r--epan/dissectors/packet-glusterfs.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/epan/dissectors/packet-glusterfs.c b/epan/dissectors/packet-glusterfs.c
index d4e80f4374..56f90939e0 100644
--- a/epan/dissectors/packet-glusterfs.c
+++ b/epan/dissectors/packet-glusterfs.c
@@ -512,11 +512,11 @@ gluster_rpc_dissect_dict(proto_tree *tree, tvbuff_t *tvb, int hfindex, int offse
items = tvb_get_ntohl(tvb, offset);
proto_item_append_text(subtree_item, ", contains %d item%s", items, items == 1 ? "" : "s");
- proto_tree_add_text(subtree, tvb, offset, 4, "Items: %d", items);
if (len == 0)
return offset;
+ proto_tree_add_text(subtree, tvb, offset, 4, "Items: %d", items);
offset += 4;
for (i = 0; i < items; i++) {
@@ -534,15 +534,27 @@ gluster_rpc_dissect_dict(proto_tree *tree, tvbuff_t *tvb, int hfindex, int offse
offset += key_len;
/* read the value, possibly '\0' terminated */
- value = tvb_get_ephemeral_string(tvb, offset, value_len);
if (tree) {
/* keys named "gfid-req" contain a GFID in hex */
if (value_len == 16 && !strncmp("gfid-req", key, 8)) {
- char *gfid;
- gfid = guid_to_str((e_guid_t*) value);
- proto_item_append_text(dict_item, "%s", gfid);
- } else
+ char *gfid_s;
+ e_guid_t gfid;
+
+ /* Gluster is not very endianness friendly */
+ tvb_get_letohguid(tvb, offset, &gfid);
+
+ gfid_s = guid_to_str(&gfid);
+ proto_item_append_text(dict_item, "%s", gfid_s);
+ /* this is a changelog in binary format */
+ } else if (value_len == 12 && !strncmp("trusted.afr.", key, 12)) {
+ proto_item_append_text(dict_item, "0x%.8x%.8x%.8x",
+ tvb_get_letohl(tvb, offset + 0),
+ tvb_get_letohl(tvb, offset + 4),
+ tvb_get_letohl(tvb, offset + 8));
+ } else {
+ value = tvb_get_ephemeral_string(tvb, offset, value_len);
proto_item_append_text(dict_item, "%s", value);
+ }
}
offset += value_len;
proto_item_set_len (dict_item, offset - start_offset2);