aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-fcp.c
diff options
context:
space:
mode:
authorEvan Huus <eapache@gmail.com>2012-12-08 03:04:55 +0000
committerEvan Huus <eapache@gmail.com>2012-12-08 03:04:55 +0000
commitdf71a9a669ca18609020c829182051ed1db10d08 (patch)
treedd3aad030ad1ac742cdeb352e1dec9f407554ea2 /epan/dissectors/packet-fcp.c
parent40eca5f0de867c1f7089152a028fe6006aa8bd5c (diff)
Fix some compiler warnings under gcc.
svn path=/trunk/; revision=46466
Diffstat (limited to 'epan/dissectors/packet-fcp.c')
-rw-r--r--epan/dissectors/packet-fcp.c33
1 files changed, 22 insertions, 11 deletions
diff --git a/epan/dissectors/packet-fcp.c b/epan/dissectors/packet-fcp.c
index 7c538745cd..ab1194c587 100644
--- a/epan/dissectors/packet-fcp.c
+++ b/epan/dissectors/packet-fcp.c
@@ -36,6 +36,10 @@
#include "packet-fcp.h"
#include "packet-fcels.h"
+typedef struct _fcp_proto_data_t {
+ guint16 lun;
+} fcp_proto_data_t;
+
/* Initialize the protocol and registered fields */
static int proto_fcp = -1;
static int hf_fcp_multilun = -1;
@@ -391,6 +395,7 @@ dissect_fcp_cmnd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, pro
int tvb_len, tvb_rlen;
fcp_request_data_t *request_data = NULL;
proto_item *hidden_item;
+ fcp_proto_data_t *proto_data;
/* Determine the length of the FCP part of the packet */
flags = tvb_get_guint8(tvb, offset+10);
@@ -423,8 +428,11 @@ dissect_fcp_cmnd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, pro
if (fchdr->itlq)
fchdr->itlq->lun = lun;
- if (!pinfo->fd->flags.visited)
- p_add_proto_data(pinfo->fd, proto_fcp, (void*)lun);
+ if (!pinfo->fd->flags.visited) {
+ proto_data = se_alloc(sizeof(fcp_proto_data_t));
+ proto_data->lun = lun;
+ p_add_proto_data(pinfo->fd, proto_fcp, proto_data);
+ }
request_data = (fcp_request_data_t*)se_tree_lookup32(fcp_conv_data->luns, lun);
if (!request_data) {
@@ -663,9 +671,10 @@ dissect_fcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
fc_hdr *fchdr;
guint8 r_ctl;
conversation_t *fc_conv;
- fcp_conv_data_t *fcp_conv_data;
+ fcp_conv_data_t *fcp_conv_data = NULL;
fcp_request_data_t *request_data = NULL;
gboolean els;
+ fcp_proto_data_t *proto_data;
fchdr = (fc_hdr *)pinfo->private_data;
@@ -695,22 +704,24 @@ dissect_fcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
pinfo->ptype, pinfo->srcport,
pinfo->destport, 0);
if (fc_conv != NULL) {
-
fcp_conv_data = conversation_get_proto_data(fc_conv, proto_fcp);
- if (!fcp_conv_data) {
- fcp_conv_data = se_alloc(sizeof(fcp_conv_data_t));
- fcp_conv_data->luns = se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK, "FCP Luns");
- conversation_add_proto_data(fc_conv, proto_fcp, fcp_conv_data);
- }
+ }
+ if (!fcp_conv_data) {
+ fcp_conv_data = se_alloc(sizeof(fcp_conv_data_t));
+ fcp_conv_data->luns = se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK, "FCP Luns");
+ conversation_add_proto_data(fc_conv, proto_fcp, fcp_conv_data);
}
/* Lun is only populated by FCP_IU_CMD, and subsequent packets assume the same lun.
The only way that consistently works is to save the lun on the first pass when packets
are guaranteed to be parsed consecutively */
if (!pinfo->fd->flags.visited) {
- p_add_proto_data(pinfo->fd, proto_fcp, (void*)fchdr->itlq->lun);
+ proto_data = se_alloc(sizeof(fcp_proto_data_t));
+ proto_data->lun = fchdr->itlq->lun;
+ p_add_proto_data(pinfo->fd, proto_fcp, proto_data);
} else {
- fchdr->itlq->lun = (guint16)p_get_proto_data(pinfo->fd, proto_fcp);
+ proto_data = p_get_proto_data(pinfo->fd, proto_fcp);
+ fchdr->itlq->lun = proto_data->lun;
}
if ((r_ctl != FCP_IU_CMD) && (r_ctl != FCP_IU_UNSOL_CTL)) {