forked from osmocom/wireshark
Remove Fibre Channel specific fields from packet_info and just have the fc_hdr or fc_data_t structure passed between all necessary dissectors.
svn path=/trunk/; revision=53569
This commit is contained in:
parent
d4c4e24351
commit
a9dd765d47
|
@ -29,6 +29,7 @@
|
|||
|
||||
#include <epan/packet.h>
|
||||
#include <epan/etypes.h>
|
||||
#include "packet-fc.h"
|
||||
|
||||
#define BRDWLK_MAX_PACKET_CNT 0xFFFF
|
||||
#define BRDWLK_TRUNCATED_BIT 0x8
|
||||
|
@ -219,6 +220,7 @@ dissect_brdwlk(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
gint len, reported_len, plen;
|
||||
guint16 pkt_cnt;
|
||||
gboolean dropped_packets;
|
||||
fc_data_t fc_data;
|
||||
|
||||
/* Make entries in Protocol column and Info column on summary display */
|
||||
col_set_str(pinfo->cinfo, COL_PROTOCOL, "Boardwalk");
|
||||
|
@ -227,12 +229,13 @@ dissect_brdwlk(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
|
||||
sof = (tvb_get_guint8(tvb, offset) & 0xF0) >> 4;
|
||||
|
||||
fc_data.sof_eof = 0;
|
||||
if ((sof == FCM_DELIM_SOFI3) || (sof == FCM_DELIM_SOFI2) || (sof == FCM_DELIM_SOFI1)
|
||||
|| (sof == FCM_DELIM_SOFI4)) {
|
||||
pinfo->sof_eof = PINFO_SOF_FIRST_FRAME;
|
||||
fc_data.sof_eof = FC_DATA_SOF_FIRST_FRAME;
|
||||
}
|
||||
else if (sof == FCM_DELIM_SOFF) {
|
||||
pinfo->sof_eof = PINFO_SOF_SOFF;
|
||||
fc_data.sof_eof = FC_DATA_SOF_SOFF;
|
||||
}
|
||||
|
||||
if (tree) {
|
||||
|
@ -331,10 +334,10 @@ dissect_brdwlk(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
|
||||
eof = tvb_get_guint8(tvb, offset+3);
|
||||
if (eof != FCM_DELIM_EOFN) {
|
||||
pinfo->sof_eof |= PINFO_EOF_LAST_FRAME;
|
||||
fc_data.sof_eof |= FC_DATA_EOF_LAST_FRAME;
|
||||
}
|
||||
else if (eof != FCM_DELIM_EOFT) {
|
||||
pinfo->sof_eof |= PINFO_EOF_INVALID;
|
||||
fc_data.sof_eof |= FC_DATA_EOF_INVALID;
|
||||
}
|
||||
|
||||
if (tree) {
|
||||
|
@ -363,8 +366,9 @@ dissect_brdwlk(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
}
|
||||
}
|
||||
|
||||
fc_data.ethertype = ETHERTYPE_BRDWALK;
|
||||
next_tvb = tvb_new_subset(tvb, 2, len, reported_len);
|
||||
call_dissector_with_data(fc_dissector_handle, next_tvb, pinfo, tree, GUINT_TO_POINTER((guint)ETHERTYPE_BRDWALK));
|
||||
call_dissector_with_data(fc_dissector_handle, next_tvb, pinfo, tree, &fc_data);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
|
||||
#include <epan/packet.h>
|
||||
#include <epan/prefs.h>
|
||||
#include "packet-fc.h"
|
||||
|
||||
void proto_register_cpfi(void);
|
||||
void proto_reg_handoff_cpfi(void);
|
||||
|
@ -315,6 +316,7 @@ dissect_cpfi(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *tree, void *
|
|||
proto_tree *cpfi_tree = NULL;
|
||||
gint length, reported_length, body_length, reported_body_length;
|
||||
guint8 frame_type;
|
||||
fc_data_t fc_data;
|
||||
|
||||
frame_type = (tvb_get_ntohl (message_tvb, 0) & CPFI_FRAME_TYPE_MASK) >> CPFI_FRAME_TYPE_SHIFT;
|
||||
|
||||
|
@ -360,10 +362,10 @@ dissect_cpfi(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *tree, void *
|
|||
}
|
||||
|
||||
/* Set up the frame controls - can we do better than this? */
|
||||
pinfo->sof_eof = 0;
|
||||
pinfo->sof_eof = PINFO_SOF_FIRST_FRAME;
|
||||
pinfo->sof_eof |= PINFO_EOF_LAST_FRAME;
|
||||
pinfo->sof_eof |= PINFO_EOF_INVALID;
|
||||
fc_data.sof_eof = 0;
|
||||
fc_data.sof_eof = FC_DATA_SOF_FIRST_FRAME;
|
||||
fc_data.sof_eof |= FC_DATA_EOF_LAST_FRAME;
|
||||
fc_data.sof_eof |= FC_DATA_EOF_INVALID;
|
||||
|
||||
/* dissect the message */
|
||||
|
||||
|
@ -372,7 +374,8 @@ dissect_cpfi(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *tree, void *
|
|||
dissect_cpfi_header(header_tvb, pinfo, cpfi_tree);
|
||||
|
||||
body_tvb = tvb_new_subset(message_tvb, 8, body_length, reported_body_length);
|
||||
call_dissector(fc_handle, body_tvb, pinfo, tree);
|
||||
fc_data.ethertype = 0;
|
||||
call_dissector_with_data(fc_handle, body_tvb, pinfo, tree, &fc_data);
|
||||
|
||||
/* add more info, now that FC added its */
|
||||
proto_item_append_text(cpfi_item, direction_and_port_string, left, arrow, right);
|
||||
|
|
|
@ -686,7 +686,7 @@ static const value_string fc_els_proto_val[] = {
|
|||
|
||||
/* Code to actually dissect the packets */
|
||||
static void
|
||||
dissect_fc_helper (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean is_ifcp, guint ethertype)
|
||||
dissect_fc_helper (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean is_ifcp, fc_data_t* fc_data)
|
||||
{
|
||||
/* Set up structures needed to add the protocol subtree and manage it */
|
||||
proto_item *ti=NULL, *hidden_item;
|
||||
|
@ -762,10 +762,7 @@ dissect_fc_helper (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean
|
|||
param = tvb_get_ntohl (tvb, offset+20);
|
||||
seq_id = tvb_get_guint8 (tvb, offset+12);
|
||||
|
||||
pinfo->oxid = fchdr.oxid;
|
||||
pinfo->rxid = fchdr.rxid;
|
||||
pinfo->ptype = PT_EXCHG;
|
||||
pinfo->r_ctl = fchdr.r_ctl;
|
||||
|
||||
/* set up a conversation and conversation data */
|
||||
/* TODO treat the fc address s_id==00.00.00 as a wildcard matching anything */
|
||||
|
@ -844,11 +841,11 @@ dissect_fc_helper (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean
|
|||
* (i) The SOF bits indicate that this is the first frame OR
|
||||
* (ii) This is an SOFf frame and seqcnt is 0.
|
||||
*/
|
||||
is_1frame_inseq = (((pinfo->sof_eof & PINFO_SOF_FIRST_FRAME) == PINFO_SOF_FIRST_FRAME) ||
|
||||
(((pinfo->sof_eof & PINFO_SOF_SOFF) == PINFO_SOF_SOFF) &&
|
||||
is_1frame_inseq = (((fc_data->sof_eof & FC_DATA_SOF_FIRST_FRAME) == FC_DATA_SOF_FIRST_FRAME) ||
|
||||
(((fc_data->sof_eof & FC_DATA_SOF_SOFF) == FC_DATA_SOF_SOFF) &&
|
||||
(fchdr.seqcnt == 0)));
|
||||
|
||||
is_lastframe_inseq = ((pinfo->sof_eof & PINFO_EOF_LAST_FRAME) == PINFO_EOF_LAST_FRAME);
|
||||
is_lastframe_inseq = ((fc_data->sof_eof & FC_DATA_EOF_LAST_FRAME) == FC_DATA_EOF_LAST_FRAME);
|
||||
|
||||
is_lastframe_inseq |= fchdr.fctl & FC_FCTL_SEQ_LAST;
|
||||
/*is_valid_frame = ((pinfo->sof_eof & 0x40) == 0x40);*/
|
||||
|
@ -1087,13 +1084,13 @@ dissect_fc_helper (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean
|
|||
* and are never fragmented and so we ignore the frag_size assertion for
|
||||
* these frames.
|
||||
*/
|
||||
if ((ethertype == ETHERTYPE_UNK) || (ethertype == ETHERTYPE_FCFT)) {
|
||||
if ((fc_data->ethertype == ETHERTYPE_UNK) || (fc_data->ethertype == ETHERTYPE_FCFT)) {
|
||||
if ((frag_size < MDSHDR_TRAILER_SIZE) ||
|
||||
((frag_size == MDSHDR_TRAILER_SIZE) && (ftype != FC_FTYPE_LINKCTL) &&
|
||||
(ftype != FC_FTYPE_BLS) && (ftype != FC_FTYPE_OHMS)))
|
||||
THROW(ReportedBoundsError);
|
||||
frag_size -= MDSHDR_TRAILER_SIZE;
|
||||
} else if (ethertype == ETHERTYPE_BRDWALK) {
|
||||
} else if (fc_data->ethertype == ETHERTYPE_BRDWALK) {
|
||||
if ((frag_size <= 8) ||
|
||||
((frag_size == MDSHDR_TRAILER_SIZE) && (ftype != FC_FTYPE_LINKCTL) &&
|
||||
(ftype != FC_FTYPE_BLS) && (ftype != FC_FTYPE_OHMS)))
|
||||
|
@ -1163,7 +1160,7 @@ dissect_fc_helper (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean
|
|||
col_append_str (pinfo->cinfo, COL_INFO, " (Bogus Fragment)");
|
||||
} else {
|
||||
|
||||
frag_id = ((pinfo->oxid << 16) ^ seq_id) | is_exchg_resp ;
|
||||
frag_id = ((fchdr.oxid << 16) ^ seq_id) | is_exchg_resp ;
|
||||
|
||||
/* We assume that all frames are of the same max size */
|
||||
fcfrag_head = fragment_add (&fc_reassembly_table,
|
||||
|
@ -1232,14 +1229,19 @@ dissect_fc_helper (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean
|
|||
static int
|
||||
dissect_fc (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
|
||||
{
|
||||
dissect_fc_helper (tvb, pinfo, tree, FALSE, GPOINTER_TO_UINT(data));
|
||||
fc_data_t* fc_data = (fc_data_t*)data;
|
||||
|
||||
dissect_fc_helper (tvb, pinfo, tree, FALSE, fc_data);
|
||||
return tvb_length(tvb);
|
||||
}
|
||||
|
||||
static void
|
||||
dissect_fc_ifcp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
||||
static int
|
||||
dissect_fc_ifcp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
|
||||
{
|
||||
dissect_fc_helper (tvb, pinfo, tree, TRUE, 0);
|
||||
fc_data_t* fc_data = (fc_data_t*)data;
|
||||
|
||||
dissect_fc_helper (tvb, pinfo, tree, TRUE, fc_data);
|
||||
return tvb_length(tvb);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1259,6 +1261,7 @@ dissect_fcsof(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
|
|||
const gint FCSOF_TRAILER_LEN = 8;
|
||||
const gint FCSOF_HEADER_LEN = 4;
|
||||
gint frame_len_for_checksum = 0;
|
||||
fc_data_t fc_data;
|
||||
|
||||
col_set_str(pinfo->cinfo, COL_PROTOCOL, "FC");
|
||||
|
||||
|
@ -1309,21 +1312,22 @@ dissect_fcsof(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
|
|||
bytes_remaining = tvb_length_remaining(tvb, 4);
|
||||
next_tvb = tvb_new_subset(tvb, 4, bytes_remaining, -1);
|
||||
|
||||
pinfo->sof_eof = 0;
|
||||
fc_data.ethertype = 0;
|
||||
fc_data.sof_eof = 0;
|
||||
if (sof == FC_SOFI2 || sof == FC_SOFI3) {
|
||||
pinfo->sof_eof = PINFO_SOF_FIRST_FRAME;
|
||||
fc_data.sof_eof = FC_DATA_SOF_FIRST_FRAME;
|
||||
} else if (sof == FC_SOFF) {
|
||||
pinfo->sof_eof = PINFO_SOF_SOFF;
|
||||
fc_data.sof_eof = FC_DATA_SOF_SOFF;
|
||||
}
|
||||
|
||||
if (eof == EOFT_POS || eof == EOFT_NEG) {
|
||||
pinfo->sof_eof |= PINFO_EOF_LAST_FRAME;
|
||||
fc_data.sof_eof |= FC_DATA_EOF_LAST_FRAME;
|
||||
} else if (eof == EOFDTI_NEG || eof == EOFDTI_POS) {
|
||||
pinfo->sof_eof |= PINFO_EOF_INVALID;
|
||||
fc_data.sof_eof |= FC_DATA_EOF_INVALID;
|
||||
}
|
||||
|
||||
/* Call FC dissector */
|
||||
call_dissector(fc_handle, next_tvb, pinfo, tree);
|
||||
call_dissector_with_data(fc_handle, next_tvb, pinfo, tree, &fc_data);
|
||||
}
|
||||
|
||||
/* Register the protocol with Wireshark */
|
||||
|
@ -1529,7 +1533,7 @@ proto_register_fc(void)
|
|||
/* Register the protocol name and description */
|
||||
proto_fc = proto_register_protocol ("Fibre Channel", "FC", "fc");
|
||||
fc_handle = new_register_dissector ("fc", dissect_fc, proto_fc);
|
||||
register_dissector ("fc_ifcp", dissect_fc_ifcp, proto_fc);
|
||||
new_register_dissector ("fc_ifcp", dissect_fc_ifcp, proto_fc);
|
||||
fc_tap = register_tap("fc");
|
||||
|
||||
/* Required function calls to register the header fields and subtrees used */
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#ifndef __PACKET_FC_H_
|
||||
#define __PACKET_FC_H_
|
||||
|
||||
#include <epan/conversation.h>
|
||||
#include "packet-scsi.h"
|
||||
#include "ws_symbol_export.h"
|
||||
|
||||
|
@ -146,4 +147,20 @@ typedef struct _fc_hdr {
|
|||
guint32 relative_offset;
|
||||
} fc_hdr;
|
||||
|
||||
#define FC_DATA_SOF_FIRST_FRAME 0x1
|
||||
#define FC_DATA_SOF_SOFF 0x2
|
||||
#define FC_DATA_EOF_LAST_FRAME 0x80
|
||||
#define FC_DATA_EOF_INVALID 0x40
|
||||
|
||||
/* Data structure to pass into FC dissector */
|
||||
typedef struct _fc_data {
|
||||
guint ethertype;
|
||||
guint8 sof_eof; /**< FC's SOF/EOF encoding passed to FC decoder
|
||||
* Bit 7 set if Last frame in sequence
|
||||
* Bit 6 set if invalid frame content
|
||||
* Bit 2 set if SOFf
|
||||
* Bit 1 set if first frame in sequence
|
||||
*/
|
||||
} fc_data_t;
|
||||
|
||||
#endif /* __PACKET_FC_H_ */
|
||||
|
|
|
@ -134,8 +134,8 @@ get_gs_server (guint8 gstype, guint8 gssubtype)
|
|||
}
|
||||
|
||||
/* Code to actually dissect the packets */
|
||||
static void
|
||||
dissect_fcct (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
||||
static int
|
||||
dissect_fcct (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
|
||||
{
|
||||
|
||||
/* Set up structures needed to add the protocol subtree and manage it */
|
||||
|
@ -208,12 +208,15 @@ dissect_fcct (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
}
|
||||
/* We do not change the starting offset for the next protocol in the
|
||||
* chain since the fc_ct header is common to the sub-protocols.
|
||||
* Pass the fchdr* received from parent dissector through to sub-protocols
|
||||
*/
|
||||
next_tvb = tvb_new_subset_remaining (tvb, 0);
|
||||
if (!dissector_try_uint (fcct_gserver_table, server, next_tvb, pinfo,
|
||||
tree)) {
|
||||
if (!dissector_try_uint_new(fcct_gserver_table, server, next_tvb, pinfo,
|
||||
tree, TRUE, data)) {
|
||||
call_dissector (data_handle, next_tvb, pinfo, tree);
|
||||
}
|
||||
|
||||
return tvb_length(tvb);
|
||||
}
|
||||
|
||||
/* Register the protocol with Wireshark */
|
||||
|
@ -291,7 +294,7 @@ proto_reg_handoff_fcct (void)
|
|||
{
|
||||
dissector_handle_t fcct_handle;
|
||||
|
||||
fcct_handle = create_dissector_handle (dissect_fcct, proto_fcct);
|
||||
fcct_handle = new_create_dissector_handle (dissect_fcct, proto_fcct);
|
||||
dissector_add_uint("fc.ftype", FC_FTYPE_FCCT, fcct_handle);
|
||||
|
||||
data_handle = find_dissector ("data");
|
||||
|
|
|
@ -1580,8 +1580,8 @@ dissect_fcdns_rjt (tvbuff_t *tvb, proto_tree *req_tree)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
dissect_fcdns (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
||||
static int
|
||||
dissect_fcdns (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
|
||||
{
|
||||
/* Set up structures needed to add the protocol subtree and manage it */
|
||||
proto_item *ti = NULL;
|
||||
|
@ -1594,6 +1594,8 @@ dissect_fcdns (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
conversation_t *conversation;
|
||||
fcdns_conv_data_t *cdata;
|
||||
fcdns_conv_key_t ckey, *req_key;
|
||||
fc_hdr *fchdr = (fc_hdr *)data;
|
||||
|
||||
|
||||
tvb_memcpy (tvb, (guint8 *)&cthdr, offset, FCCT_PRMBL_SIZE);
|
||||
cthdr.revision = tvb_get_guint8 (tvb, offset);
|
||||
|
@ -1625,12 +1627,12 @@ dissect_fcdns (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
|
||||
if ((opcode != FCCT_MSG_ACC) && (opcode != FCCT_MSG_RJT)) {
|
||||
conversation = find_conversation (pinfo->fd->num, &pinfo->src, &pinfo->dst,
|
||||
pinfo->ptype, pinfo->oxid,
|
||||
pinfo->rxid, NO_PORT2);
|
||||
pinfo->ptype, fchdr->oxid,
|
||||
fchdr->rxid, NO_PORT2);
|
||||
if (!conversation) {
|
||||
conversation = conversation_new (pinfo->fd->num, &pinfo->src, &pinfo->dst,
|
||||
pinfo->ptype, pinfo->oxid,
|
||||
pinfo->rxid, NO_PORT2);
|
||||
pinfo->ptype, fchdr->oxid,
|
||||
fchdr->rxid, NO_PORT2);
|
||||
}
|
||||
|
||||
ckey.conv_idx = conversation->index;
|
||||
|
@ -1659,8 +1661,8 @@ dissect_fcdns (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
else {
|
||||
/* Opcode is ACC or RJT */
|
||||
conversation = find_conversation (pinfo->fd->num, &pinfo->src, &pinfo->dst,
|
||||
pinfo->ptype, pinfo->oxid,
|
||||
pinfo->rxid, NO_PORT2);
|
||||
pinfo->ptype, fchdr->oxid,
|
||||
fchdr->rxid, NO_PORT2);
|
||||
isreq = 0;
|
||||
if (!conversation) {
|
||||
if (opcode == FCCT_MSG_ACC) {
|
||||
|
@ -1670,7 +1672,7 @@ dissect_fcdns (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
/* No record of what this accept is for. Can't decode */
|
||||
proto_tree_add_text (fcdns_tree, tvb, 0, -1,
|
||||
"No record of Exchg. Unable to decode MSG_ACC/RJT");
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -1703,7 +1705,7 @@ dissect_fcdns (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
/* No record of what this accept is for. Can't decode */
|
||||
proto_tree_add_text (fcdns_tree, tvb, 0, -1,
|
||||
"No record of Exchg. Unable to decode MSG_ACC/RJT");
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1854,6 +1856,8 @@ dissect_fcdns (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return tvb_length(tvb);
|
||||
}
|
||||
|
||||
/* Register the protocol with Wireshark */
|
||||
|
@ -1947,7 +1951,7 @@ proto_register_fcdns (void)
|
|||
proto_register_subtree_array(ett, array_length(ett));
|
||||
register_init_routine (&fcdns_init_protocol);
|
||||
|
||||
dns_handle = create_dissector_handle (dissect_fcdns, proto_fcdns);
|
||||
dns_handle = new_create_dissector_handle (dissect_fcdns, proto_fcdns);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -1829,8 +1829,8 @@ dissect_fcels_lsrjt (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
dissect_fcels (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
||||
static int
|
||||
dissect_fcels (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
|
||||
{
|
||||
|
||||
/* Set up structures needed to add the protocol subtree and manage it */
|
||||
|
@ -1846,6 +1846,7 @@ dissect_fcels (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
guint options;
|
||||
address dstaddr;
|
||||
guint8 addrdata[3];
|
||||
fc_hdr *fchdr = (fc_hdr *)data;
|
||||
|
||||
/* Make entries in Protocol column and Info column on summary display */
|
||||
col_set_str(pinfo->cinfo, COL_PROTOCOL, "FC ELS");
|
||||
|
@ -1868,7 +1869,7 @@ dissect_fcels (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
expert_add_info_format(pinfo, ti, &ei_fcels_src_unknown,
|
||||
"Unknown source address type: %u",
|
||||
pinfo->src.type);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
srcfc = (guint8 *)pinfo->src.data;
|
||||
|
@ -1884,13 +1885,13 @@ dissect_fcels (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
options = NO_PORT2;
|
||||
}
|
||||
conversation = find_conversation (pinfo->fd->num, &pinfo->dst, &pinfo->src,
|
||||
pinfo->ptype, pinfo->oxid,
|
||||
pinfo->rxid, options);
|
||||
pinfo->ptype, fchdr->oxid,
|
||||
fchdr->rxid, options);
|
||||
|
||||
if (!conversation) {
|
||||
conversation = conversation_new (pinfo->fd->num, &pinfo->dst, &pinfo->src,
|
||||
pinfo->ptype, pinfo->oxid,
|
||||
pinfo->rxid, options);
|
||||
pinfo->ptype, fchdr->oxid,
|
||||
fchdr->rxid, options);
|
||||
}
|
||||
|
||||
ckey.conv_idx = conversation->index;
|
||||
|
@ -1919,8 +1920,8 @@ dissect_fcels (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
|
||||
options = NO_PORT2;
|
||||
conversation = find_conversation (pinfo->fd->num, &pinfo->dst, &pinfo->src,
|
||||
pinfo->ptype, pinfo->oxid,
|
||||
pinfo->rxid, options);
|
||||
pinfo->ptype, fchdr->oxid,
|
||||
fchdr->rxid, options);
|
||||
if (!conversation) {
|
||||
/* FLOGI has two ways to save state: without the src and using just
|
||||
* the port (ALPA) part of the address. Try both.
|
||||
|
@ -1932,7 +1933,7 @@ dissect_fcels (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
expert_add_info_format(pinfo, ti, &ei_fcels_dst_unknown,
|
||||
"Unknown destination address type: %u",
|
||||
pinfo->dst.type);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
dstfc = (guint8 *)pinfo->dst.data;
|
||||
|
@ -1941,23 +1942,23 @@ dissect_fcels (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
addrdata[2] = dstfc[2];
|
||||
SET_ADDRESS (&dstaddr, AT_FC, 3, addrdata);
|
||||
conversation = find_conversation (pinfo->fd->num, &dstaddr, &pinfo->src,
|
||||
pinfo->ptype, pinfo->oxid,
|
||||
pinfo->rxid, options);
|
||||
pinfo->ptype, fchdr->oxid,
|
||||
fchdr->rxid, options);
|
||||
}
|
||||
|
||||
if (!conversation) {
|
||||
/* Finally check for FLOGI with both NO_PORT2 and NO_ADDR2 set */
|
||||
options = NO_ADDR2 | NO_PORT2;
|
||||
conversation = find_conversation (pinfo->fd->num, &pinfo->src, &pinfo->dst,
|
||||
pinfo->ptype, pinfo->oxid,
|
||||
pinfo->rxid, options);
|
||||
pinfo->ptype, fchdr->oxid,
|
||||
fchdr->rxid, options);
|
||||
if (!conversation) {
|
||||
if (tree && (opcode == FC_ELS_ACC)) {
|
||||
/* No record of what this accept is for. Can't decode */
|
||||
acc_tree = proto_item_add_subtree (ti, ett_fcels_acc);
|
||||
proto_tree_add_text (acc_tree, tvb, offset, tvb_length (tvb),
|
||||
"No record of Exchange. Unable to decode ACC");
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
failed_opcode = 0;
|
||||
}
|
||||
|
@ -1978,7 +1979,7 @@ dissect_fcels (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
proto_tree_add_text (acc_tree, tvb, offset,
|
||||
tvb_length (tvb),
|
||||
"No record of Exchg. Unable to decode ACC");
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if (opcode == FC_ELS_ACC)
|
||||
|
@ -1993,7 +1994,7 @@ dissect_fcels (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
acc_tree = proto_item_add_subtree (ti, ett_fcels_acc);
|
||||
proto_tree_add_text (acc_tree, tvb, offset, tvb_length (tvb),
|
||||
"No record of ELS Req. Unable to decode ACC");
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2112,6 +2113,8 @@ dissect_fcels (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
call_dissector (data_handle, tvb, pinfo, tree);
|
||||
break;
|
||||
}
|
||||
|
||||
return tvb_length(tvb);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -2575,7 +2578,7 @@ proto_reg_handoff_fcels (void)
|
|||
{
|
||||
dissector_handle_t els_handle;
|
||||
|
||||
els_handle = create_dissector_handle (dissect_fcels, proto_fcels);
|
||||
els_handle = new_create_dissector_handle (dissect_fcels, proto_fcels);
|
||||
dissector_add_uint("fc.ftype", FC_FTYPE_ELS, els_handle);
|
||||
|
||||
data_handle = find_dissector ("data");
|
||||
|
|
|
@ -763,8 +763,8 @@ dissect_fcfcs_rjt (tvbuff_t *tvb, proto_tree *tree)
|
|||
|
||||
}
|
||||
|
||||
static void
|
||||
dissect_fcfcs (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
||||
static int
|
||||
dissect_fcfcs (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
|
||||
{
|
||||
|
||||
/* Set up structures needed to add the protocol subtree and manage it */
|
||||
|
@ -778,6 +778,7 @@ dissect_fcfcs (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
fcfcs_conv_key_t ckey, *req_key;
|
||||
int opcode,
|
||||
failed_opcode = 0;
|
||||
fc_hdr *fchdr = (fc_hdr *)data;
|
||||
|
||||
/* Make entries in Protocol column and Info column on summary display */
|
||||
col_set_str(pinfo->cinfo, COL_PROTOCOL, "FC-FCS");
|
||||
|
@ -798,12 +799,12 @@ dissect_fcfcs (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
|
||||
if ((opcode != FCCT_MSG_ACC) && (opcode != FCCT_MSG_RJT)) {
|
||||
conversation = find_conversation (pinfo->fd->num, &pinfo->src, &pinfo->dst,
|
||||
pinfo->ptype, pinfo->oxid,
|
||||
pinfo->rxid, NO_PORT2);
|
||||
pinfo->ptype, fchdr->oxid,
|
||||
fchdr->rxid, NO_PORT2);
|
||||
if (!conversation) {
|
||||
conversation = conversation_new (pinfo->fd->num, &pinfo->src, &pinfo->dst,
|
||||
pinfo->ptype, pinfo->oxid,
|
||||
pinfo->rxid, NO_PORT2);
|
||||
pinfo->ptype, fchdr->oxid,
|
||||
fchdr->rxid, NO_PORT2);
|
||||
}
|
||||
|
||||
ckey.conv_idx = conversation->index;
|
||||
|
@ -832,8 +833,8 @@ dissect_fcfcs (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
else {
|
||||
/* Opcode is ACC or RJT */
|
||||
conversation = find_conversation (pinfo->fd->num, &pinfo->src, &pinfo->dst,
|
||||
pinfo->ptype, pinfo->oxid,
|
||||
pinfo->rxid, NO_PORT2);
|
||||
pinfo->ptype, fchdr->oxid,
|
||||
fchdr->rxid, NO_PORT2);
|
||||
isreq = 0;
|
||||
if (!conversation) {
|
||||
if (opcode == FCCT_MSG_ACC) {
|
||||
|
@ -843,7 +844,7 @@ dissect_fcfcs (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
/* No record of what this accept is for. Can't decode */
|
||||
proto_tree_add_text (fcfcs_tree, tvb, 0, tvb_length (tvb),
|
||||
"No record of Exchg. Unable to decode MSG_ACC/RJT");
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -876,7 +877,7 @@ dissect_fcfcs (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
/* No record of what this accept is for. Can't decode */
|
||||
proto_tree_add_text (fcfcs_tree, tvb, 0, tvb_length (tvb),
|
||||
"No record of Exchg. Unable to decode MSG_ACC/RJT");
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -978,6 +979,8 @@ dissect_fcfcs (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
call_dissector (data_handle, tvb, pinfo, fcfcs_tree);
|
||||
break;
|
||||
}
|
||||
|
||||
return tvb_length(tvb);
|
||||
}
|
||||
|
||||
/* Register the protocol with Wireshark */
|
||||
|
@ -1099,7 +1102,7 @@ proto_reg_handoff_fcfcs (void)
|
|||
{
|
||||
dissector_handle_t fcs_handle;
|
||||
|
||||
fcs_handle = create_dissector_handle (dissect_fcfcs, proto_fcfcs);
|
||||
fcs_handle = new_create_dissector_handle (dissect_fcfcs, proto_fcfcs);
|
||||
|
||||
dissector_add_uint("fcct.server", FCCT_GSRVR_FCS, fcs_handle);
|
||||
|
||||
|
|
|
@ -578,8 +578,8 @@ dissect_fcfzs_rjt(tvbuff_t *tvb, proto_tree *tree)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
dissect_fcfzs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
||||
static int
|
||||
dissect_fcfzs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
|
||||
{
|
||||
|
||||
/* Set up structures needed to add the protocol subtree and manage it */
|
||||
|
@ -593,6 +593,7 @@ dissect_fcfzs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
fcfzs_conv_data_t *cdata;
|
||||
fcfzs_conv_key_t ckey, *req_key;
|
||||
gboolean isreq = TRUE;
|
||||
fc_hdr *fchdr = (fc_hdr *)data;
|
||||
|
||||
/* Make entries in Protocol column and Info column on summary display */
|
||||
col_set_str(pinfo->cinfo, COL_PROTOCOL, "Zone Server");
|
||||
|
@ -617,12 +618,12 @@ dissect_fcfzs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
|
||||
if ((opcode != FCCT_MSG_ACC) && (opcode != FCCT_MSG_RJT)) {
|
||||
conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst,
|
||||
pinfo->ptype, pinfo->oxid,
|
||||
pinfo->rxid, NO_PORT2);
|
||||
pinfo->ptype, fchdr->oxid,
|
||||
fchdr->rxid, NO_PORT2);
|
||||
if (!conversation) {
|
||||
conversation = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst,
|
||||
pinfo->ptype, pinfo->oxid,
|
||||
pinfo->rxid, NO_PORT2);
|
||||
pinfo->ptype, fchdr->oxid,
|
||||
fchdr->rxid, NO_PORT2);
|
||||
}
|
||||
|
||||
ckey.conv_idx = conversation->index;
|
||||
|
@ -652,8 +653,8 @@ dissect_fcfzs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
else {
|
||||
/* Opcode is ACC or RJT */
|
||||
conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst,
|
||||
pinfo->ptype, pinfo->oxid,
|
||||
pinfo->rxid, NO_PORT2);
|
||||
pinfo->ptype, fchdr->oxid,
|
||||
fchdr->rxid, NO_PORT2);
|
||||
isreq = FALSE;
|
||||
if (!conversation) {
|
||||
if (opcode == FCCT_MSG_ACC) {
|
||||
|
@ -663,7 +664,7 @@ dissect_fcfzs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
/* No record of what this accept is for. Can't decode */
|
||||
proto_tree_add_text(fcfzs_tree, tvb, 0, tvb_length(tvb),
|
||||
"No record of Exchg. Unable to decode MSG_ACC");
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -693,7 +694,7 @@ dissect_fcfzs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
/* No record of what this accept is for. Can't decode */
|
||||
proto_tree_add_text(fcfzs_tree, tvb, 0, tvb_length(tvb),
|
||||
"No record of Exchg. Unable to decode MSG_ACC/RJT");
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -754,6 +755,8 @@ dissect_fcfzs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
call_dissector(data_handle, tvb, pinfo, tree);
|
||||
break;
|
||||
}
|
||||
|
||||
return tvb_length(tvb);
|
||||
}
|
||||
|
||||
/* Register the protocol with Wireshark */
|
||||
|
@ -921,7 +924,7 @@ proto_reg_handoff_fcfzs(void)
|
|||
{
|
||||
dissector_handle_t fzs_handle;
|
||||
|
||||
fzs_handle = create_dissector_handle(dissect_fcfzs, proto_fcfzs);
|
||||
fzs_handle = new_create_dissector_handle(dissect_fcfzs, proto_fcfzs);
|
||||
dissector_add_uint("fcct.server", FCCT_GSRVR_FZS, fzs_handle);
|
||||
|
||||
data_handle = find_dissector("data");
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
|
||||
#include <epan/packet.h>
|
||||
#include <epan/prefs.h>
|
||||
#include "packet-fc.h"
|
||||
|
||||
#define FCIP_ENCAP_HEADER_LEN 28
|
||||
#define FCIP_MIN_HEADER_LEN 16 /* upto frame len field */
|
||||
|
@ -376,6 +377,7 @@ dissect_fcip (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
|||
proto_item *ti;
|
||||
proto_tree *fcip_tree = NULL;
|
||||
tvbuff_t *next_tvb;
|
||||
fc_data_t fc_data;
|
||||
|
||||
if (bytes_remaining < FCIP_ENCAP_HEADER_LEN) {
|
||||
return FALSE;
|
||||
|
@ -469,28 +471,29 @@ dissect_fcip (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
|||
/* Call the FC Dissector if this is carrying an FC frame */
|
||||
if (!FCIP_IS_SF(pflags)) {
|
||||
/* Set the SOF/EOF flags in the packet_info header */
|
||||
pinfo->sof_eof = 0;
|
||||
fc_data.sof_eof = 0;
|
||||
|
||||
if (sof) {
|
||||
if ((sof == FCIP_SOFi3) || (sof == FCIP_SOFi2) || (sof == FCIP_SOFi4)) {
|
||||
pinfo->sof_eof = PINFO_SOF_FIRST_FRAME;
|
||||
fc_data.sof_eof = FC_DATA_SOF_FIRST_FRAME;
|
||||
}
|
||||
else if (sof == FCIP_SOFf) {
|
||||
pinfo->sof_eof = PINFO_SOF_SOFF;
|
||||
fc_data.sof_eof = FC_DATA_SOF_SOFF;
|
||||
}
|
||||
|
||||
if (eof != FCIP_EOFn) {
|
||||
pinfo->sof_eof |= PINFO_EOF_LAST_FRAME;
|
||||
fc_data.sof_eof |= FC_DATA_EOF_LAST_FRAME;
|
||||
}
|
||||
else if (eof != FCIP_EOFt) {
|
||||
pinfo->sof_eof |= PINFO_EOF_INVALID;
|
||||
fc_data.sof_eof |= FC_DATA_EOF_INVALID;
|
||||
}
|
||||
}
|
||||
|
||||
/* Special frame bit is not set */
|
||||
next_tvb = tvb_new_subset_remaining (tvb, FCIP_ENCAP_HEADER_LEN+4);
|
||||
if (fc_handle) {
|
||||
call_dissector (fc_handle, next_tvb, pinfo, tree);
|
||||
fc_data.ethertype = 0;
|
||||
call_dissector_with_data(fc_handle, next_tvb, pinfo, tree, &fc_data);
|
||||
}
|
||||
else if (data_handle) {
|
||||
call_dissector (data_handle, next_tvb, pinfo, tree);
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include <epan/etypes.h>
|
||||
#include <epan/expert.h>
|
||||
#include <epan/wmem/wmem.h>
|
||||
#include "packet-fc.h"
|
||||
|
||||
#define FCOE_HEADER_LEN 14 /* header: version, SOF, and padding */
|
||||
#define FCOE_TRAILER_LEN 8 /* trailer: CRC, EOF, and padding */
|
||||
|
@ -131,6 +132,7 @@ dissect_fcoe(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
gboolean crc_exists;
|
||||
guint32 crc_computed = 0;
|
||||
guint32 crc = 0;
|
||||
fc_data_t fc_data;
|
||||
|
||||
/*
|
||||
* For now, handle both the version defined before and after August 2007.
|
||||
|
@ -251,23 +253,24 @@ dissect_fcoe(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
}
|
||||
|
||||
/* Set the SOF/EOF flags in the packet_info header */
|
||||
pinfo->sof_eof = 0;
|
||||
fc_data.sof_eof = 0;
|
||||
if (sof == FCOE_SOFi3 || sof == FCOE_SOFi2 || sof == FCOE_SOFi4) {
|
||||
pinfo->sof_eof = PINFO_SOF_FIRST_FRAME;
|
||||
fc_data.sof_eof = FC_DATA_SOF_FIRST_FRAME;
|
||||
} else if (sof == FCOE_SOFf) {
|
||||
pinfo->sof_eof = PINFO_SOF_SOFF;
|
||||
fc_data.sof_eof = FC_DATA_SOF_SOFF;
|
||||
}
|
||||
|
||||
if (eof != FCOE_EOFn) {
|
||||
pinfo->sof_eof |= PINFO_EOF_LAST_FRAME;
|
||||
fc_data.sof_eof |= FC_DATA_EOF_LAST_FRAME;
|
||||
} else if (eof != FCOE_EOFt) {
|
||||
pinfo->sof_eof |= PINFO_EOF_INVALID;
|
||||
fc_data.sof_eof |= FC_DATA_EOF_INVALID;
|
||||
}
|
||||
|
||||
/* Call the FC Dissector if this is carrying an FC frame */
|
||||
fc_data.ethertype = 0;
|
||||
|
||||
if (fc_handle) {
|
||||
call_dissector(fc_handle, next_tvb, pinfo, tree);
|
||||
call_dissector_with_data(fc_handle, next_tvb, pinfo, tree, &fc_data);
|
||||
} else if (data_handle) {
|
||||
call_dissector(data_handle, next_tvb, pinfo, tree);
|
||||
}
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include <epan/wmem/wmem.h>
|
||||
#include <errno.h>
|
||||
#include "packet-infiniband.h"
|
||||
#include "packet-fc.h"
|
||||
|
||||
#ifdef HAVE_ARPA_INET_H
|
||||
# include <arpa/inet.h>
|
||||
|
@ -184,6 +185,7 @@ dissect_fcoib(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U
|
|||
guint32 crc_computed = 0;
|
||||
guint32 crc = 0;
|
||||
gboolean packet_match_manual;
|
||||
fc_data_t fc_data;
|
||||
|
||||
tree = proto_tree_get_root(tree); /* we don't want to add FCoIB under the Infiniband tree */
|
||||
|
||||
|
@ -319,23 +321,24 @@ dissect_fcoib(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U
|
|||
}
|
||||
|
||||
/* Set the SOF/EOF flags in the packet_info header */
|
||||
pinfo->sof_eof = 0;
|
||||
fc_data.sof_eof = 0;
|
||||
if (sof == FCOIB_SOFi3 || sof == FCOIB_SOFi2 || sof == FCOIB_SOFi4) {
|
||||
pinfo->sof_eof = PINFO_SOF_FIRST_FRAME;
|
||||
fc_data.sof_eof = FC_DATA_SOF_FIRST_FRAME;
|
||||
} else if (sof == FCOIB_SOFf) {
|
||||
pinfo->sof_eof = PINFO_SOF_SOFF;
|
||||
fc_data.sof_eof = FC_DATA_SOF_SOFF;
|
||||
}
|
||||
|
||||
if (eof != FCOIB_EOFn) {
|
||||
pinfo->sof_eof |= PINFO_EOF_LAST_FRAME;
|
||||
fc_data.sof_eof |= FC_DATA_EOF_LAST_FRAME;
|
||||
} else if (eof != FCOIB_EOFt) {
|
||||
pinfo->sof_eof |= PINFO_EOF_INVALID;
|
||||
fc_data.sof_eof |= FC_DATA_EOF_INVALID;
|
||||
}
|
||||
|
||||
/* Call the FC Dissector if this is carrying an FC frame */
|
||||
fc_data.ethertype = 0;
|
||||
|
||||
if (fc_handle) {
|
||||
call_dissector(fc_handle, next_tvb, pinfo, tree);
|
||||
call_dissector_with_data(fc_handle, next_tvb, pinfo, tree, &fc_data);
|
||||
} else if (data_handle) {
|
||||
call_dissector(data_handle, next_tvb, pinfo, tree);
|
||||
}
|
||||
|
|
|
@ -618,11 +618,11 @@ dissect_fcp_xfer_rdy(tvbuff_t *tvb, proto_tree *tree)
|
|||
}
|
||||
|
||||
static void
|
||||
dissect_fcp_srr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
||||
dissect_fcp_srr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, fc_hdr *fchdr)
|
||||
{
|
||||
guint8 r_ctl;
|
||||
|
||||
r_ctl = pinfo->r_ctl & 0xf;
|
||||
r_ctl = fchdr->r_ctl & 0xf;
|
||||
if (r_ctl == FCP_IU_UNSOL_CTL) { /* request */
|
||||
proto_tree_add_item(tree, hf_fcp_srr_ox_id, tvb, 4, 2, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_item(tree, hf_fcp_srr_rx_id, tvb, 6, 2, ENC_BIG_ENDIAN);
|
||||
|
@ -643,7 +643,7 @@ static const value_string fcp_els_iu_val[] = {
|
|||
* Dissect FC-4 ELS for FCP.
|
||||
*/
|
||||
static void
|
||||
dissect_fcp_els(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
||||
dissect_fcp_els(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, fc_hdr *fchdr)
|
||||
{
|
||||
guint8 op;
|
||||
|
||||
|
@ -655,7 +655,7 @@ dissect_fcp_els(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
|
||||
switch (op) { /* XXX should switch based on conv for LS_ACC */
|
||||
case FC_ELS_SRR:
|
||||
dissect_fcp_srr(tvb, pinfo, tree);
|
||||
dissect_fcp_srr(tvb, pinfo, tree, fchdr);
|
||||
break;
|
||||
default:
|
||||
call_dissector(data_handle, tvb, pinfo, tree);
|
||||
|
@ -668,7 +668,7 @@ dissect_fcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
|
|||
{
|
||||
proto_item *ti = NULL;
|
||||
proto_tree *fcp_tree = NULL;
|
||||
fc_hdr *fchdr;
|
||||
fc_hdr *fchdr = (fc_hdr *)data;
|
||||
guint8 r_ctl;
|
||||
conversation_t *fc_conv;
|
||||
fcp_conv_data_t *fcp_conv_data = NULL;
|
||||
|
@ -676,12 +676,10 @@ dissect_fcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
|
|||
gboolean els;
|
||||
fcp_proto_data_t *proto_data;
|
||||
|
||||
fchdr = (fc_hdr *)data;
|
||||
|
||||
/* Make entries in Protocol column and Info column on summary display */
|
||||
col_set_str(pinfo->cinfo, COL_PROTOCOL, "FCP");
|
||||
|
||||
r_ctl = pinfo->r_ctl;
|
||||
r_ctl = fchdr->r_ctl;
|
||||
els = (r_ctl & 0xf0) == FC_RCTL_LINK_DATA;
|
||||
r_ctl &= 0xF;
|
||||
|
||||
|
@ -751,7 +749,7 @@ dissect_fcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
|
|||
}
|
||||
|
||||
if (els) {
|
||||
dissect_fcp_els(tvb, pinfo, fcp_tree);
|
||||
dissect_fcp_els(tvb, pinfo, fcp_tree, fchdr);
|
||||
return tvb_length(tvb);
|
||||
}
|
||||
|
||||
|
|
|
@ -1758,8 +1758,8 @@ static fcswils_func_table_t fcswils_func_table[FC_SWILS_MAXCODE] = {
|
|||
};
|
||||
|
||||
/* Code to actually dissect the packets */
|
||||
static void
|
||||
dissect_fcswils(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
||||
static int
|
||||
dissect_fcswils(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
|
||||
{
|
||||
proto_item *ti = NULL;
|
||||
guint8 opcode;
|
||||
|
@ -1771,6 +1771,7 @@ dissect_fcswils(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
proto_tree *swils_tree = NULL;
|
||||
guint8 isreq = FC_SWILS_REQ;
|
||||
tvbuff_t *next_tvb;
|
||||
fc_hdr *fchdr = (fc_hdr *)data;
|
||||
|
||||
/* Make entries in Protocol column and Info column on summary display */
|
||||
col_set_str(pinfo->cinfo, COL_PROTOCOL, "SW_ILS");
|
||||
|
@ -1787,12 +1788,12 @@ dissect_fcswils(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
/* Register conversation if this is not a response */
|
||||
if ((opcode != FC_SWILS_SWACC) && (opcode != FC_SWILS_SWRJT)) {
|
||||
conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst,
|
||||
pinfo->ptype, pinfo->oxid,
|
||||
pinfo->rxid, NO_PORT2);
|
||||
pinfo->ptype, fchdr->oxid,
|
||||
fchdr->rxid, NO_PORT2);
|
||||
if (!conversation) {
|
||||
conversation = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst,
|
||||
pinfo->ptype, pinfo->oxid,
|
||||
pinfo->rxid, NO_PORT2);
|
||||
pinfo->ptype, fchdr->oxid,
|
||||
fchdr->rxid, NO_PORT2);
|
||||
}
|
||||
|
||||
ckey.conv_idx = conversation->index;
|
||||
|
@ -1819,15 +1820,15 @@ dissect_fcswils(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
else {
|
||||
/* Opcode is ACC or RJT */
|
||||
conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst,
|
||||
pinfo->ptype, pinfo->oxid,
|
||||
pinfo->rxid, NO_PORT2);
|
||||
pinfo->ptype, fchdr->oxid,
|
||||
fchdr->rxid, NO_PORT2);
|
||||
isreq = FC_SWILS_RPLY;
|
||||
if (!conversation) {
|
||||
if (tree && (opcode == FC_SWILS_SWACC)) {
|
||||
/* No record of what this accept is for. Can't decode */
|
||||
proto_tree_add_text(swils_tree, tvb, 0, tvb_length(tvb),
|
||||
"No record of Exchg. Unable to decode SW_ACC");
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -1847,7 +1848,7 @@ dissect_fcswils(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
/* No record of what this accept is for. Can't decode */
|
||||
proto_tree_add_text(swils_tree, tvb, 0, tvb_length(tvb),
|
||||
"No record of SW_ILS Req. Unable to decode SW_ACC");
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1882,6 +1883,7 @@ dissect_fcswils(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
call_dissector(data_handle, next_tvb, pinfo, tree);
|
||||
}
|
||||
|
||||
return tvb_length(tvb);
|
||||
}
|
||||
|
||||
/* Register the protocol with Wireshark */
|
||||
|
@ -2568,7 +2570,7 @@ proto_reg_handoff_fcswils(void)
|
|||
{
|
||||
dissector_handle_t swils_handle;
|
||||
|
||||
swils_handle = create_dissector_handle(dissect_fcswils, proto_fcswils);
|
||||
swils_handle = new_create_dissector_handle(dissect_fcswils, proto_fcswils);
|
||||
dissector_add_uint("fc.ftype", FC_FTYPE_SWILS, swils_handle);
|
||||
|
||||
data_handle = find_dissector("data");
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include <epan/to_str.h>
|
||||
#include <epan/etypes.h>
|
||||
#include <epan/expert.h>
|
||||
#include "packet-fc.h"
|
||||
|
||||
/*
|
||||
* FIP protocol information.
|
||||
|
@ -494,10 +495,12 @@ dissect_fip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
case FIP_DT_LOGO:
|
||||
case FIP_DT_ELP: {
|
||||
tvbuff_t *ls_tvb;
|
||||
fc_data_t fc_data = {ETHERTYPE_FIP, 0};
|
||||
|
||||
subtree = proto_item_add_subtree(item, ett_fip_dt_caps);
|
||||
fip_desc_type_len(subtree, desc_tvb);
|
||||
ls_tvb = tvb_new_subset(desc_tvb, 4, dlen - 4, -1);
|
||||
call_dissector(fc_handle, ls_tvb, pinfo, subtree);
|
||||
call_dissector_with_data(fc_handle, ls_tvb, pinfo, subtree, &fc_data);
|
||||
proto_item_append_text(item, "%u bytes", dlen - 4);
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include <epan/prefs.h>
|
||||
#include <epan/conversation.h>
|
||||
#include "packet-tcp.h"
|
||||
#include "packet-fc.h"
|
||||
|
||||
#define iFCP_ENCAP_HEADER_LEN 28
|
||||
#define iFCP_MIN_HEADER_LEN 16 /* upto frame len field */
|
||||
|
@ -321,6 +322,7 @@ dissect_ifcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, voi
|
|||
proto_tree *frame_len_tree=NULL;
|
||||
proto_tree *sof_tree=NULL;
|
||||
proto_tree *eof_tree=NULL;
|
||||
fc_data_t fc_data;
|
||||
|
||||
/* verify we have a full header (do we need to do this? */
|
||||
if(tvb_length(tvb)<iFCP_ENCAP_HEADER_LEN){
|
||||
|
@ -463,31 +465,32 @@ dissect_ifcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, voi
|
|||
|
||||
/* Call the FC Dissector if this is carrying an FC frame */
|
||||
/* Set the SOF/EOF flags in the packet_info header */
|
||||
pinfo->sof_eof = 0;
|
||||
fc_data.sof_eof = 0;
|
||||
|
||||
switch(sof){
|
||||
case iFCP_SOFi3:
|
||||
case iFCP_SOFi2:
|
||||
case iFCP_SOFi4:
|
||||
pinfo->sof_eof = PINFO_SOF_FIRST_FRAME;
|
||||
fc_data.sof_eof = FC_DATA_SOF_FIRST_FRAME;
|
||||
break;
|
||||
case iFCP_SOFf:
|
||||
pinfo->sof_eof = PINFO_SOF_SOFF;
|
||||
fc_data.sof_eof = FC_DATA_SOF_SOFF;
|
||||
break;
|
||||
default:
|
||||
if(sof){
|
||||
if (eof != iFCP_EOFn) {
|
||||
pinfo->sof_eof |= PINFO_EOF_LAST_FRAME;
|
||||
fc_data.sof_eof |= FC_DATA_EOF_LAST_FRAME;
|
||||
} else if (eof != iFCP_EOFt) {
|
||||
pinfo->sof_eof |= PINFO_EOF_INVALID;
|
||||
fc_data.sof_eof |= FC_DATA_EOF_INVALID;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
next_tvb=tvb_new_subset(tvb, offset, frame_len-offset-4, frame_len-offset-4);
|
||||
fc_data.ethertype = 0;
|
||||
|
||||
if(fc_handle){
|
||||
call_dissector(fc_handle, next_tvb, pinfo, parent_tree);
|
||||
call_dissector_with_data(fc_handle, next_tvb, pinfo, parent_tree, &fc_data);
|
||||
} else if(data_handle){
|
||||
call_dissector(data_handle, next_tvb, pinfo, parent_tree);
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include <epan/packet.h>
|
||||
#include <etypes.h>
|
||||
#include <epan/prefs.h>
|
||||
#include "packet-fc.h"
|
||||
|
||||
#define MDSHDR_VERSION_OFFSET 0
|
||||
|
||||
|
@ -143,6 +144,7 @@ dissect_mdshdr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
tvbuff_t *next_tvb;
|
||||
guint8 sof, eof;
|
||||
int trailer_start = 0; /*0 means "no trailer found"*/
|
||||
fc_data_t fc_data;
|
||||
|
||||
col_set_str(pinfo->cinfo, COL_PROTOCOL, "MDS Header");
|
||||
|
||||
|
@ -164,21 +166,21 @@ dissect_mdshdr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
eof = MDSHDR_EOF_UNKNOWN;
|
||||
}
|
||||
|
||||
pinfo->sof_eof = 0;
|
||||
fc_data.sof_eof = 0;
|
||||
|
||||
if ((sof == MDSHDR_SOFi3) || (sof == MDSHDR_SOFi2) || (sof == MDSHDR_SOFi1)
|
||||
|| (sof == MDSHDR_SOFi4)) {
|
||||
pinfo->sof_eof = PINFO_SOF_FIRST_FRAME;
|
||||
fc_data.sof_eof = FC_DATA_SOF_FIRST_FRAME;
|
||||
}
|
||||
else if (sof == MDSHDR_SOFf) {
|
||||
pinfo->sof_eof = PINFO_SOF_SOFF;
|
||||
fc_data.sof_eof = FC_DATA_SOF_SOFF;
|
||||
}
|
||||
|
||||
if (eof != MDSHDR_EOFn) {
|
||||
pinfo->sof_eof |= PINFO_EOF_LAST_FRAME;
|
||||
fc_data.sof_eof |= FC_DATA_EOF_LAST_FRAME;
|
||||
}
|
||||
else if (eof != MDSHDR_EOFt) {
|
||||
pinfo->sof_eof |= PINFO_EOF_INVALID;
|
||||
fc_data.sof_eof |= FC_DATA_EOF_INVALID;
|
||||
}
|
||||
|
||||
if (tree) {
|
||||
|
@ -240,7 +242,8 @@ dissect_mdshdr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
|
||||
/* Call the Fibre Channel dissector */
|
||||
if (fc_dissector_handle) {
|
||||
call_dissector_with_data(fc_dissector_handle, next_tvb, pinfo, tree, GUINT_TO_POINTER((guint)ETHERTYPE_FCFT));
|
||||
fc_data.ethertype = ETHERTYPE_FCFT;
|
||||
call_dissector_with_data(fc_dissector_handle, next_tvb, pinfo, tree, &fc_data);
|
||||
}
|
||||
else {
|
||||
call_dissector(data_handle, next_tvb, pinfo, tree);
|
||||
|
|
|
@ -48,11 +48,6 @@
|
|||
#define P2P_DIR_UL 0
|
||||
#define P2P_DIR_DL 1
|
||||
|
||||
#define PINFO_SOF_FIRST_FRAME 0x1
|
||||
#define PINFO_SOF_SOFF 0x2
|
||||
#define PINFO_EOF_LAST_FRAME 0x80
|
||||
#define PINFO_EOF_INVALID 0x40
|
||||
|
||||
typedef struct _packet_info {
|
||||
const char *current_proto; /**< name of protocol currently being dissected */
|
||||
column_info *cinfo; /**< Column formatting information */
|
||||
|
@ -137,15 +132,6 @@ typedef struct _packet_info {
|
|||
outbound (P2P_DIR_SENT)
|
||||
inbound (P2P_DIR_RECV)
|
||||
unknown (P2P_DIR_UNKNOWN) */
|
||||
guint16 oxid; /**< next 2 fields reqd to identify fibre */
|
||||
guint16 rxid; /**< channel conversations */
|
||||
guint8 r_ctl; /**< R_CTL field in Fibre Channel Protocol */
|
||||
guint8 sof_eof; /**< FC's SOF/EOF encoding passed to FC decoder
|
||||
* Bit 7 set if Last frame in sequence
|
||||
* Bit 6 set if invalid frame content
|
||||
* Bit 2 set if SOFf
|
||||
* Bit 1 set if first frame in sequence
|
||||
*/
|
||||
|
||||
/**< Extra data for handling of decryption of GSSAPI wrapped tvbuffs.
|
||||
Caller sets decrypt_gssapi_tvb if this service is requested.
|
||||
|
|
Loading…
Reference in New Issue