diff options
author | sahlberg <sahlberg@f5534014-38df-0310-8fa8-9805f1628bb7> | 2006-09-30 21:49:11 +0000 |
---|---|---|
committer | sahlberg <sahlberg@f5534014-38df-0310-8fa8-9805f1628bb7> | 2006-09-30 21:49:11 +0000 |
commit | 309b01cc05bae0777b00b45ae2d6ea07a9cd47a6 (patch) | |
tree | cd959774743b4556e99149d63283b77560641076 /epan/dissectors/packet-iscsi.c | |
parent | 81da0784f437420c03e8a443edd253f2f4f23792 (diff) |
fix for header digest detection being broken when AHS is used.
we simply forgot to account for the AHS when testing to calculate the crc
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@19389 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'epan/dissectors/packet-iscsi.c')
-rw-r--r-- | epan/dissectors/packet-iscsi.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/epan/dissectors/packet-iscsi.c b/epan/dissectors/packet-iscsi.c index fd191f56dd..081a184e46 100644 --- a/epan/dissectors/packet-iscsi.c +++ b/epan/dissectors/packet-iscsi.c @@ -2154,6 +2154,7 @@ dissect_iscsi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean chec guint32 pduLen = 48; guint8 secondPduByte = tvb_get_guint8(tvb, offset + 1); int badPdu = FALSE; + guint8 ahsLen=0; /* mask out any extra bits in the opcode byte */ opcode = tvb_get_guint8(tvb, offset + 0); @@ -2226,7 +2227,8 @@ dissect_iscsi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean chec if(opcode == ISCSI_OPCODE_SCSI_COMMAND) { /* ahsLen */ - pduLen += tvb_get_guint8(tvb, offset + 4) * 4; + ahsLen = tvb_get_guint8(tvb, offset + 4); + pduLen += ahsLen * 4; } pduLen += data_segment_len; @@ -2266,11 +2268,11 @@ dissect_iscsi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean chec conversation_set_dissector(conversation, iscsi_handle); } /* try to autodetect if header digest is used or not */ - if(digestsActive && (available_bytes>=52) && (iscsi_session->header_digest==ISCSI_HEADER_DIGEST_AUTO) ){ + if(digestsActive && (available_bytes>=(48+4+ahsLen*4)) && (iscsi_session->header_digest==ISCSI_HEADER_DIGEST_AUTO) ){ guint32 crc; /* we have enough data to test if HeaderDigest is enabled */ - crc= ~calculateCRC32(tvb_get_ptr(tvb, offset, 48), 48, CRC32C_PRELOAD); - if(crc==tvb_get_ntohl(tvb,48)){ + crc= ~calculateCRC32(tvb_get_ptr(tvb, offset, 48+ahsLen*4), 48+ahsLen*4, CRC32C_PRELOAD); + if(crc==tvb_get_ntohl(tvb,48+ahsLen*4)){ iscsi_session->header_digest=ISCSI_HEADER_DIGEST_CRC32; } else { iscsi_session->header_digest=ISCSI_HEADER_DIGEST_NONE; |