aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-glusterfs.c
diff options
context:
space:
mode:
authorNiels de Vos <ndevos@redhat.com>2014-05-29 11:21:56 +0200
committerMichael Mann <mmann78@netscape.net>2014-06-16 15:48:44 +0000
commit9ac8052fb10bf88f51dc35872d69d234eaa451fb (patch)
treea89e3fe438dd41bfb2ce15bb509497a45e04d3ba /epan/dissectors/packet-glusterfs.c
parent2f369b216fc18624a2e8b2c6bc1da80f964e54d7 (diff)
glusterfs: correctly decode GFIDs that are passed in a dict
When a dict structure is passed by GlusterFS, the values are not encoded normally. We now assume that the GFID in the dict is in network-order, but this will be incorrect for Big Endian systems. The majority of Gluster deployments are on Little Endian, and the GFID is displayed correctly for this case. I am sorry for the few users on Big Endian Gluster environments, they will see some GFIDs in Wireshark that don't exist on the Gluster volume. With this change, it is also made possible to filter on the GFID that is contained inside of the dict. Change-Id: I62a265eca34df23a507403397012cf652d43ca54 Reported-by: Vikhyat Umrao <vumrao@redhat.com> Signed-off-by: Niels de Vos <ndevos@redhat.com> Reviewed-on: https://code.wireshark.org/review/1856 Reviewed-by: Evan Huus <eapache@gmail.com> Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/dissectors/packet-glusterfs.c')
-rw-r--r--epan/dissectors/packet-glusterfs.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/epan/dissectors/packet-glusterfs.c b/epan/dissectors/packet-glusterfs.c
index 4dcd8e0e91..968d0155c8 100644
--- a/epan/dissectors/packet-glusterfs.c
+++ b/epan/dissectors/packet-glusterfs.c
@@ -532,8 +532,6 @@ gluster_rpc_dissect_dict(proto_tree *tree, tvbuff_t *tvb, int hfindex, int offse
/* read the key, '\0' terminated */
key = tvb_get_stringz(wmem_packet_scope(), tvb, offset, &key_len);
start_offset2 = offset;
- if (tree)
- dict_item = proto_tree_add_text(subtree, tvb, offset, -1, "%s: ", key);
offset += key_len;
/* read the value, possibly '\0' terminated */
@@ -546,24 +544,28 @@ gluster_rpc_dissect_dict(proto_tree *tree, tvbuff_t *tvb, int hfindex, int offse
char *gfid_s;
e_guid_t gfid;
- /* Gluster is not very endianness friendly */
- tvb_get_letohguid(tvb, offset, &gfid);
+ tvb_get_ntohguid(tvb, offset, &gfid);
gfid_s = guid_to_ep_str(&gfid);
- proto_item_append_text(dict_item, "%s", gfid_s);
+ dict_item = proto_tree_add_guid_format(subtree, hf_glusterfs_gfid,
+ tvb, offset, 16, &gfid,
+ "%s: %s", key, 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));
+ dict_item = proto_tree_add_text(subtree, tvb, offset, -1,
+ "%s: 0x%.8x%.8x%.8x", key,
+ tvb_get_letohl(tvb, offset + 0),
+ tvb_get_letohl(tvb, offset + 4),
+ tvb_get_letohl(tvb, offset + 8));
} else {
value = tvb_get_string(wmem_packet_scope(), tvb, offset, value_len);
- proto_item_append_text(dict_item, "%s", value);
+ dict_item = proto_tree_add_text(subtree, tvb, offset, -1, "%s: %s",
+ key, value);
}
}
offset += value_len;
- proto_item_set_len (dict_item, offset - start_offset2);
+ if (tree)
+ proto_item_set_len (dict_item, offset - start_offset2);
}
if (roundup) {