aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-iscsi.c
diff options
context:
space:
mode:
Diffstat (limited to 'epan/dissectors/packet-iscsi.c')
-rw-r--r--epan/dissectors/packet-iscsi.c58
1 files changed, 53 insertions, 5 deletions
diff --git a/epan/dissectors/packet-iscsi.c b/epan/dissectors/packet-iscsi.c
index 24b5ca6d57..9e7bc0dbde 100644
--- a/epan/dissectors/packet-iscsi.c
+++ b/epan/dissectors/packet-iscsi.c
@@ -67,6 +67,12 @@ static enum_val_t iscsi_protocol_versions[] = {
{ NULL, NULL, 0 }
};
+static const value_string ahs_type_vals[] = {
+ {1, "Extended CDB"},
+ {2, "Expected Bidirection Read Data Length"},
+ {0, NULL}
+};
+
static dissector_handle_t iscsi_handle=NULL;
static gint iscsi_protocol_version = ISCSI_PROTOCOL_DRAFT13;
@@ -93,6 +99,9 @@ static int hf_iscsi_data_in_frame = -1;
static int hf_iscsi_data_out_frame = -1;
static int hf_iscsi_response_frame = -1;
static int hf_iscsi_AHS = -1;
+static int hf_iscsi_AHS_length = -1;
+static int hf_iscsi_AHS_type = -1;
+static int hf_iscsi_AHS_specific = -1;
static int hf_iscsi_Padding = -1;
static int hf_iscsi_ping_data = -1;
static int hf_iscsi_immediate_data = -1;
@@ -744,6 +753,8 @@ dissect_iscsi_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint off
guint immediate_data_length=0;
guint immediate_data_offset=0;
itl_nexus_t *itl=NULL;
+ guint16 ahs_length=0;
+ guint8 ahs_type=0;
if(paddedDataSegmentLength & 3)
paddedDataSegmentLength += 4 - (paddedDataSegmentLength & 3);
@@ -966,8 +977,12 @@ dissect_iscsi_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint off
proto_tree_add_item(ti, hf_iscsi_ExpStatSN, tvb, offset + 28, 4, FALSE);
{
if(ahsLen > 0) {
- /* FIXME - disssect AHS? */
- proto_tree_add_item(ti, hf_iscsi_AHS, tvb, offset + 48, ahsLen, FALSE);
+ ahs_length=tvb_get_ntohs(tvb, offset+48);
+ proto_tree_add_item(ti, hf_iscsi_AHS_length, tvb, offset + 48, 2, FALSE);
+ ahs_type=tvb_get_guint8(tvb, offset+50);
+ proto_tree_add_item(ti, hf_iscsi_AHS_type, tvb, offset + 50, 1, FALSE);
+ proto_tree_add_item(ti, hf_iscsi_AHS_specific, tvb, offset + 51, 1, FALSE);
+ proto_tree_add_item(ti, hf_iscsi_AHS, tvb, offset + 52, ahsLen-4, FALSE);
}
offset = handleHeaderDigest(iscsi_session, ti, tvb, offset, 48 + ahsLen);
}
@@ -1496,16 +1511,34 @@ dissect_iscsi_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint off
tvb_len=tvb_length_remaining(tvb, cdb_offset);
tvb_rlen=tvb_reported_length_remaining(tvb, cdb_offset);
scsi_opcode=tvb_get_guint8(tvb, cdb_offset);
- /* cdb 0x7f is variable length so dont clamp the cdb tvb */
- if(scsi_opcode!=0x7f){
+ if(ahs_type==1 && ahs_length && ahs_length<1024){
+ char *cdb_buf;
+
+ /* We have a variable length CDB where bytes >16 is transported
+ * in the AHS.
+ */
+ cdb_buf=ep_alloc(16+ahs_length);
+ /* the 16 first bytes of the cdb */
+ tvb_memcpy(tvb, cdb_buf, cdb_offset, 16);
+ /* hte remainder of the cdb from the ahs */
+ tvb_memcpy(tvb, cdb_buf+16, cdb_offset+20, ahs_length);
+
+ cdb_tvb = tvb_new_real_data(cdb_buf,
+ ahs_length+16,
+ ahs_length+16);
+
+ tvb_set_child_real_data_tvbuff(tvb, cdb_tvb);
+
+ add_new_data_source(pinfo, cdb_tvb, "CDB+AHS");
+ } else {
if(tvb_len>16){
tvb_len=16;
}
if(tvb_rlen>16){
tvb_rlen=16;
}
+ cdb_tvb=tvb_new_subset(tvb, cdb_offset, tvb_len, tvb_rlen);
}
- cdb_tvb=tvb_new_subset(tvb, cdb_offset, tvb_len, tvb_rlen);
dissect_scsi_cdb(cdb_tvb, pinfo, tree, SCSI_DEV_UNKNOWN, &cdata->itlq, itl);
/* we dont want the immediata below to overwrite our CDB info */
if (check_col(pinfo->cinfo, COL_INFO)) {
@@ -2379,6 +2412,21 @@ proto_register_iscsi(void)
FT_BYTES, BASE_HEX, NULL, 0,
"Additional header segment", HFILL }
},
+ { &hf_iscsi_AHS_length,
+ { "AHS Length", "iscsi.ahs.length",
+ FT_UINT16, BASE_DEC, NULL, 0,
+ "Length of Additional header segment", HFILL }
+ },
+ { &hf_iscsi_AHS_type,
+ { "AHS Type", "iscsi.ahs.type",
+ FT_UINT8, BASE_DEC, VALS(ahs_type_vals), 0,
+ "Type of Additional header segment", HFILL }
+ },
+ { &hf_iscsi_AHS_specific,
+ { "AHS Specific", "iscsi.ahs",
+ FT_UINT8, BASE_HEX, NULL, 0,
+ "Specific qualifier of Additional header segment", HFILL }
+ },
{ &hf_iscsi_Padding,
{ "Padding", "iscsi.padding",
FT_BYTES, BASE_HEX, NULL, 0,