aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-iscsi.c
diff options
context:
space:
mode:
authorsahlberg <sahlberg@f5534014-38df-0310-8fa8-9805f1628bb7>2006-09-29 11:12:18 +0000
committersahlberg <sahlberg@f5534014-38df-0310-8fa8-9805f1628bb7>2006-09-29 11:12:18 +0000
commit6ba81820effe857124003f7d1d6e930961e8c1ba (patch)
tree77edcfddf05da6909ebc93171432dccd33ecbf6d /epan/dissectors/packet-iscsi.c
parentc6d3376349be17c1c719218a95aa1d803f56bed2 (diff)
add a missing heuristic to acept a NOP_IN packet and correct a broken heuristic that would refuse all NOP_OUT pdus as non-iscsi
it is absolutely amazing that none of the iscsi implementors and users of wireshark had noticed this breakage and reported it. they apparently do not use wireshark. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@19362 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'epan/dissectors/packet-iscsi.c')
-rw-r--r--epan/dissectors/packet-iscsi.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/epan/dissectors/packet-iscsi.c b/epan/dissectors/packet-iscsi.c
index 3c0a538e65..642bdcec85 100644
--- a/epan/dissectors/packet-iscsi.c
+++ b/epan/dissectors/packet-iscsi.c
@@ -1602,6 +1602,20 @@ dissect_iscsi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean chec
* all reserved or undefined bits in iscsi must be set to zero.
*/
switch(opcode){
+ case ISCSI_OPCODE_NOP_IN:
+ /* top two bits of byte 0 must be 0 */
+ if(tvb_get_guint8(tvb, offset+0)&0xc0){
+ return FALSE;
+ }
+ /* byte 1 must be 0x80 */
+ if(tvb_get_guint8(tvb, offset+1)!=0x80){
+ return FALSE;
+ }
+ /* bytes 2 and 3 must be 0 */
+ if(tvb_get_guint8(tvb, offset+2)||tvb_get_guint8(tvb, offset+3)){
+ return FALSE;
+ }
+ break;
case ISCSI_OPCODE_NOP_OUT:
/* top bit of byte 0 must be 0 */
if(tvb_get_guint8(tvb, offset+0)&0x80){
@@ -1623,10 +1637,10 @@ dissect_iscsi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean chec
return FALSE;
}
/* all reserved bytes between 32 - 47 must be null */
- if(!tvb_get_letohl(tvb,offset+32)
- || !tvb_get_letohl(tvb,offset+36)
- || !tvb_get_letohl(tvb,offset+40)
- || !tvb_get_letohl(tvb,offset+44)){
+ if(tvb_get_letohl(tvb,offset+32)
+ || tvb_get_letohl(tvb,offset+36)
+ || tvb_get_letohl(tvb,offset+40)
+ || tvb_get_letohl(tvb,offset+44)){
return FALSE;
}
break;