From Dinesh Dutt:

fix the Fibre Channel reassembly code;

	fix handling of addresses in FC frames encapsulated inside
	various internal Cisco protocols;

	display link state records & descriptors better so as to improve
	readability & reduce the need to expand tree to find useful
	information;

	handle older versions of SW_RSCN;

	fix saving of device type from Inquiry command;

	add another Ethertype used internally in Cisco switches.

svn path=/trunk/; revision=7283
This commit is contained in:
Guy Harris 2003-03-05 07:41:24 +00:00
parent 05c41a279f
commit 6e797c5b9d
6 changed files with 99 additions and 41 deletions

View File

@ -1,7 +1,7 @@
/* etypes.h
* Defines ethernet packet types, similar to tcpdump's ethertype.h
*
* $Id: etypes.h,v 1.31 2003/03/02 15:50:55 gerald Exp $
* $Id: etypes.h,v 1.32 2003/03/05 07:41:23 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -199,6 +199,11 @@
#define ETHERTYPE_LOOP 0x9000 /* used for layer 2 testing (do i see my own frames on the wire) */
#endif
#ifndef ETHERTYPE_FCFT
/* type used to transport FC frames+MDS hdr internal to Cisco's MDS switch */
#define ETHERTYPE_FCFT 0xFCFC
#endif
extern const value_string etype_vals[];
#endif /* etypes.h */

View File

@ -2,7 +2,7 @@
* Routines for Fibre Channel Decoding (FC Header, Link Ctl & Basic Link Svc)
* Copyright 2001, Dinesh G Dutt <ddutt@cisco.com>
*
* $Id: packet-fc.c,v 1.4 2003/03/04 06:47:09 guy Exp $
* $Id: packet-fc.c,v 1.5 2003/03/05 07:41:23 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -55,6 +55,7 @@
#define FC_HEADER_SIZE 24
#define FC_RCTL_EISL 0x50
#define MDSHDR_TRAILER_SIZE 6
/* Size of various fields in FC header in bytes */
#define FC_RCTL_SIZE 1
@ -471,8 +472,8 @@ dissect_fc (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
seqcnt = tvb_get_ntohs (tvb, offset+14);
param = tvb_get_ntohl (tvb, offset+20);
SET_ADDRESS (&pinfo->dst, AT_FC, 3, tvb_get_ptr (tvb, 1, 3));
SET_ADDRESS (&pinfo->src, AT_FC, 3, tvb_get_ptr (tvb, 5, 3));
SET_ADDRESS (&pinfo->dst, AT_FC, 3, tvb_get_ptr (tvb, offset+1, 3));
SET_ADDRESS (&pinfo->src, AT_FC, 3, tvb_get_ptr (tvb, offset+5, 3));
pinfo->oxid = tvb_get_ntohs (tvb, offset+16);
pinfo->rxid = tvb_get_ntohs (tvb, offset+18);
pinfo->ptype = PT_EXCHG;
@ -648,6 +649,15 @@ dissect_fc (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
frag_size = tvb_reported_length (tvb)-FC_HEADER_SIZE;
/* If there is an MDS header, we need to subtract the MDS trailer size */
if ((pinfo->ethertype == ETHERTYPE_UNK) || (pinfo->ethertype == ETHERTYPE_FCFT)) {
frag_size -= MDSHDR_TRAILER_SIZE;
}
else if (pinfo->ethertype == ETHERTYPE_BRDWALK) {
frag_size -= 8; /* 4 byte of FC CRC +
4 bytes of error+EOF = 8 bytes */
}
if (!is_lastframe_inseq) {
/* Show this only as a fragmented FC frame */
if (check_col (pinfo->cinfo, COL_INFO)) {
@ -659,7 +669,7 @@ dissect_fc (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
* present, if we're configured to reassemble.
*/
if ((ftype != FC_FTYPE_LINKCTL) && (ftype != FC_FTYPE_BLS) &&
seqcnt && fc_reassemble &&
(!is_lastframe_inseq || seqcnt) && fc_reassemble &&
tvb_bytes_exist(tvb, FC_HEADER_SIZE, frag_size)) {
/* Add this to the list of fragments */
frag_id = (pinfo->oxid << 16) | is_exchg_resp;
@ -669,7 +679,7 @@ dissect_fc (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
fc_fragment_table,
seqcnt * fc_max_frame_size,
frag_size,
TRUE);
!is_lastframe_inseq);
if (fcfrag_head) {
next_tvb = tvb_new_real_data (fcfrag_head->data,

View File

@ -2,7 +2,7 @@
* Routines for FC Inter-switch link services
* Copyright 2001, Dinesh G Dutt <ddutt@cisco.com>
*
* $Id: packet-fcswils.c,v 1.2 2003/01/30 22:25:03 deniel Exp $
* $Id: packet-fcswils.c,v 1.3 2003/03/05 07:41:23 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -57,8 +57,9 @@
#include "packet-fc.h"
#include "packet-fcswils.h"
#define FC_SWILS_RPLY 0x0
#define FC_SWILS_REQ 0x1
#define FC_SWILS_RPLY 0x0
#define FC_SWILS_REQ 0x1
#define FC_SWILS_RSCN_DEVENTRY_SIZE 20
/* Zone name has the structure:
* name_len (1 byte), rsvd (3 bytes), name (m bytes), fill (n bytes)
@ -594,15 +595,8 @@ dissect_swils_fspf_hdr (tvbuff_t *tvb, proto_tree *tree, int offset)
}
static void
dissect_swils_fspf_lsrechdr (tvbuff_t *tvb, proto_tree *lsrec_tree, int offset)
dissect_swils_fspf_lsrechdr (tvbuff_t *tvb, proto_tree *tree, int offset)
{
proto_tree *tree;
proto_item *subti;
subti = proto_tree_add_text (lsrec_tree, tvb, offset, 24,
"Link State Record Header");
tree = proto_item_add_subtree (subti, ett_fcswils_lsrechdr);
proto_tree_add_item (tree, hf_swils_lsrh_lsr_type, tvb, offset, 1, 0);
proto_tree_add_text (tree, tvb, offset+2, 2, "LSR Age: %d secs",
tvb_get_ntohs (tvb, offset+2));
@ -634,23 +628,31 @@ dissect_swils_fspf_lsrec (tvbuff_t *tvb, proto_tree *tree, int offset,
{
int i, j, num_ldrec;
proto_item *subti1, *subti;
proto_tree *lsrec_tree, *ldrec_tree;
proto_tree *lsrec_tree, *ldrec_tree, *lsrechdr_tree;
if (tree) {
for (j = 0; j < num_lsrec; j++) {
num_ldrec = tvb_get_ntohs (tvb, offset+26);
subti = proto_tree_add_text (tree, tvb, offset, (28+num_ldrec*16),
"Link State Record %d", j);
"Link State Record %d (Domain %d)", j,
tvb_get_guint8 (tvb, offset+15));
lsrec_tree = proto_item_add_subtree (subti, ett_fcswils_lsrec);
dissect_swils_fspf_lsrechdr (tvb, lsrec_tree, offset);
subti = proto_tree_add_text (lsrec_tree, tvb, offset, 24,
"Link State Record Header");
lsrechdr_tree = proto_item_add_subtree (subti,
ett_fcswils_lsrechdr);
dissect_swils_fspf_lsrechdr (tvb, lsrechdr_tree, offset);
proto_tree_add_text (tree, tvb, offset+26, 2, "Number of Links: %d",
num_ldrec);
offset += 28;
for (i = 0; i < num_ldrec; i++) {
subti1 = proto_tree_add_text (tree, tvb, offset, 16,
"Link Descriptor %d", i);
subti1 = proto_tree_add_text (lsrec_tree, tvb, offset, 16,
"Link Descriptor %d "
"(Neighbor domain %d)", i,
tvb_get_guint8 (tvb, offset+3));
ldrec_tree = proto_item_add_subtree (subti1, ett_fcswils_ldrec);
dissect_swils_fspf_ldrec (tvb, ldrec_tree, offset);
offset += 16;
@ -705,6 +707,8 @@ dissect_swils_lsack (tvbuff_t *tvb, proto_tree *lsa_tree, guint8 isreq _U_)
/* Set up structures needed to add the protocol subtree and manage it */
int offset = 0;
int num_lsrechdr, i;
proto_item *subti;
proto_tree *lsrechdr_tree;
if (lsa_tree) {
dissect_swils_fspf_hdr (tvb, lsa_tree, offset);
@ -720,7 +724,12 @@ dissect_swils_lsack (tvbuff_t *tvb, proto_tree *lsa_tree, guint8 isreq _U_)
offset = 28;
for (i = 0; i < num_lsrechdr; i++) {
dissect_swils_fspf_lsrechdr (tvb, lsa_tree, offset);
subti = proto_tree_add_text (lsa_tree, tvb, offset, 24,
"Link State Record Header (Domain %d)",
tvb_get_guint8 (tvb, offset+15));
lsrechdr_tree = proto_item_add_subtree (subti,
ett_fcswils_lsrechdr);
dissect_swils_fspf_lsrechdr (tvb, lsrechdr_tree, offset);
offset += 24;
}
}
@ -754,6 +763,12 @@ dissect_swils_rscn (tvbuff_t *tvb, proto_tree *rscn_tree, guint8 isreq)
proto_tree_add_item (rscn_tree, hf_swils_rscn_detectfn, tvb,
offset+8, 4, 0);
numrec = tvb_get_ntohl (tvb, offset+12);
if (!tvb_bytes_exist (tvb, offset+16, FC_SWILS_RSCN_DEVENTRY_SIZE*numrec)) {
/* Some older devices do not include device entry information. */
return;
}
proto_tree_add_text (rscn_tree, tvb, offset+12, 4, "Num Entries: %d",
numrec);
@ -1240,6 +1255,7 @@ dissect_fcswils (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
fcswils_conv_key_t ckey, *req_key;
proto_tree *swils_tree = NULL;
guint8 isreq = FC_SWILS_REQ;
tvbuff_t *next_tvb;
/* Make entries in Protocol column and Info column on summary display */
if (check_col(pinfo->cinfo, COL_PROTOCOL))
@ -1396,7 +1412,8 @@ dissect_fcswils (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
dissect_swils_esc (tvb, swils_tree, isreq);
break;
default:
call_dissector (data_handle, tvb, pinfo, tree);
next_tvb = tvb_new_subset (tvb, offset+4, -1, -1);
call_dissector (data_handle, next_tvb, pinfo, tree);
}
}

View File

@ -2,7 +2,7 @@
* Routines for dissection of Cisco MDS Switch Internal Header
* Copyright 2001, Dinesh G Dutt <ddutt@andiamo.com>
*
* $Id: packet-mdshdr.c,v 1.3 2003/01/24 17:17:25 oabad Exp $
* $Id: packet-mdshdr.c,v 1.4 2003/03/05 07:41:23 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -288,7 +288,7 @@ proto_register_mdshdr(void)
{ &hf_mdshdr_eof,
{"EOF", "mdshdr.eof", FT_UINT8, BASE_DEC, VALS(eof_vals), 0x0, "", HFILL}},
{ &hf_mdshdr_span,
{"SPAN ID", "mdshdr.span", FT_UINT8, BASE_DEC, NULL, 0x0,
{"SPAN Frame", "mdshdr.span", FT_UINT8, BASE_DEC, NULL, 0x0,
"", HFILL}},
};
@ -319,6 +319,7 @@ proto_reg_handoff_mdshdr(void)
mdshdr_handle = create_dissector_handle (dissect_mdshdr, proto_mdshdr);
dissector_add ("ethertype", ETHERTYPE_UNK, mdshdr_handle);
dissector_add ("ethertype", ETHERTYPE_FCFT, mdshdr_handle);
data_handle = find_dissector ("data");
fc_dissector_handle = find_dissector ("fc");

View File

@ -2,7 +2,7 @@
* Routines for decoding SCSI CDBs and responses
* Author: Dinesh G Dutt (ddutt@cisco.com)
*
* $Id: packet-scsi.c,v 1.23 2003/01/31 03:17:46 guy Exp $
* $Id: packet-scsi.c,v 1.24 2003/03/05 07:41:24 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -1377,7 +1377,7 @@ dissect_scsi_evpd (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
{
proto_tree *evpd_tree;
proto_item *ti;
guint pcode, plen, i, idlen;
gint pcode, plen, i, idlen;
guint8 flags;
char str[256+1];
@ -1433,10 +1433,12 @@ dissect_scsi_evpd (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
idlen = tvb_get_guint8 (tvb, offset+3);
proto_tree_add_text (evpd_tree, tvb, offset+3, 1,
"Identifier Length: %u", idlen);
proto_tree_add_text (evpd_tree, tvb, offset+4, idlen,
if (tvb_bytes_exist (tvb, offset+4, idlen)) {
proto_tree_add_text (evpd_tree, tvb, offset+4, idlen,
"Identifier: %s",
tvb_bytes_to_str (tvb, offset+4,
idlen));
}
plen -= idlen;
offset += idlen;
}
@ -1486,7 +1488,7 @@ dissect_scsi_inquiry (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
guint offset, gboolean isreq, gboolean iscdb,
guint32 payload_len, scsi_task_data_t *cdata)
{
guint8 flags, i;
guint8 flags, i, devtype;
gchar str[32];
guint tot_len;
scsi_devtype_data_t *devdata = NULL;
@ -1510,10 +1512,21 @@ dissect_scsi_inquiry (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
COPY_ADDRESS (&(req_key->devid), &(pinfo->src));
devdata = g_mem_chunk_alloc (scsidev_req_vals);
devdata->devtype = tvb_get_guint8 (tvb, offset) & 0x3F;
devdata->devtype = tvb_get_guint8 (tvb, offset) & SCSI_DEV_BITS;
g_hash_table_insert (scsidev_req_hash, req_key, devdata);
}
else {
devtype = tvb_get_guint8 (tvb, offset);
if ((devtype & SCSI_DEV_BITS) != SCSI_DEV_NOLUN) {
/* Some initiators probe more than the available LUNs which
* results in Inquiry data being returned indicating that a LUN
* is not supported. We don't want to overwrite the device type
* with such responses.
*/
devdata->devtype = (devtype & SCSI_DEV_BITS);
}
}
}
if (!tree)
@ -2252,7 +2265,8 @@ dissect_scsi_modepage (tvbuff_t *tvb, packet_info *pinfo,
pcode = tvb_get_guint8 (tvb, offset);
plen = tvb_get_guint8 (tvb, offset+1);
if (match_strval (pcode & 0x3F, scsi_spc2_modepage_val) == NULL) {
if (match_strval (pcode & SCSI_MS_PCODE_BITS,
scsi_spc2_modepage_val) == NULL) {
/*
* This isn't a generic mode page that applies to all SCSI
* device types; try to interpret it based on what we deduced,
@ -2294,8 +2308,8 @@ dissect_scsi_modepage (tvbuff_t *tvb, packet_info *pinfo,
dissect_modepage = dissect_scsi_spc2_modepage;
}
ti = proto_tree_add_text (scsi_tree, tvb, offset, plen+2, "%s Mode Page",
val_to_str (pcode & 0x3F, modepage_val,
"Unknown (0x%08x)"));
val_to_str (pcode & SCSI_MS_PCODE_BITS,
modepage_val, "Unknown (0x%08x)"));
tree = proto_item_add_subtree (ti, ett_scsi_page);
proto_tree_add_text (tree, tvb, offset, 1, "PS: %u", (pcode & 0x80) >> 7);
@ -2308,7 +2322,8 @@ dissect_scsi_modepage (tvbuff_t *tvb, packet_info *pinfo,
return (plen + 2);
}
if (!(*dissect_modepage)(tvb, pinfo, tree, offset, pcode & 0x3F)) {
if (!(*dissect_modepage)(tvb, pinfo, tree, offset,
pcode & SCSI_MS_PCODE_BITS)) {
proto_tree_add_text (tree, tvb, offset+2, plen,
"Unknown Page");
}
@ -2499,7 +2514,8 @@ dissect_scsi_pagecode (tvbuff_t *tvb, packet_info *pinfo _U_,
int hf_pagecode;
pcode = tvb_get_guint8 (tvb, offset);
if ((valstr = match_strval (pcode & 0x3F, scsi_spc2_modepage_val)) == NULL) {
if ((valstr = match_strval (pcode & SCSI_MS_PCODE_BITS,
scsi_spc2_modepage_val)) == NULL) {
/*
* This isn't a generic mode page that applies to all SCSI
* device types; try to interpret it based on what we deduced,
@ -2867,7 +2883,7 @@ dissect_scsi_reportdeviceid (tvbuff_t *tvb _U_, packet_info *pinfo _U_,
static void
dissect_scsi_reportluns (tvbuff_t *tvb, packet_info *pinfo _U_,
proto_tree *tree, guint offset, gboolean isreq,
gboolean iscdb)
gboolean iscdb, guint payload_len)
{
guint8 flags;
guint numelem, i;
@ -2889,6 +2905,11 @@ dissect_scsi_reportluns (tvbuff_t *tvb, packet_info *pinfo _U_,
proto_tree_add_text (tree, tvb, offset, 4, "LUN List Length: %u",
numelem);
offset += 8;
if (payload_len != 0) {
numelem = (numelem < payload_len) ? numelem : payload_len;
}
numelem -= 8;
for (i = 0; i < numelem/8; i++) {
if (!tvb_get_guint8 (tvb, offset))
proto_tree_add_item (tree, hf_scsi_rluns_lun, tvb, offset+1, 1,
@ -4265,7 +4286,7 @@ dissect_scsi_cdb (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
case SCSI_SPC2_REPORTLUNS:
dissect_scsi_reportluns (tvb, pinfo, scsi_tree, offset+1, TRUE,
TRUE);
TRUE, 0);
break;
case SCSI_SPC2_REQSENSE:
@ -4605,7 +4626,7 @@ dissect_scsi_payload (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
case SCSI_SPC2_REPORTLUNS:
dissect_scsi_reportluns (tvb, pinfo, scsi_tree, offset, isreq,
FALSE);
FALSE, payload_len);
break;
case SCSI_SPC2_REQSENSE:
@ -4925,7 +4946,7 @@ proto_register_scsi (void)
HFILL}},
{ &hf_scsi_inq_devtype,
{"Device Type", "scsi.inquiry.devtype", FT_UINT8, BASE_HEX,
VALS (scsi_devtype_val), 0x0F, "", HFILL}},
VALS (scsi_devtype_val), 0x1F, "", HFILL}},
{ & hf_scsi_inq_version,
{"Version", "scsi.inquiry.version", FT_UINT8, BASE_HEX,
VALS (scsi_inquiry_vers_val), 0x0, "", HFILL}},

View File

@ -1,7 +1,7 @@
/* packet-scsi.h
* Author: Dinesh G Dutt (ddutt@cisco.com)
*
* $Id: packet-scsi.h,v 1.5 2002/08/28 21:00:30 jmayer Exp $
* $Id: packet-scsi.h,v 1.6 2003/03/05 07:41:24 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -53,6 +53,10 @@ extern const value_string scsi_status_val[];
#define SCSI_DEV_RBC 0xE
#define SCSI_DEV_OCRW 0xF
#define SCSI_DEV_OSD 0x11
#define SCSI_DEV_NOLUN 0x1F
#define SCSI_DEV_BITS 0x1F /* the lower 5 bits indicate device type */
#define SCSI_MS_PCODE_BITS 0x3F /* Page code bits in Mode Sense */
/* Function Decls; functions invoked by SAM-2 transport protocols such as
* FCP/iSCSI