diff options
author | Ronnie Sahlberg <ronnie_sahlberg@ozemail.com.au> | 2006-09-29 11:12:18 +0000 |
---|---|---|
committer | Ronnie Sahlberg <ronnie_sahlberg@ozemail.com.au> | 2006-09-29 11:12:18 +0000 |
commit | 59d9a1b9c20057dc6893c0ec3c12e9fdcbd98a7d (patch) | |
tree | 77edcfddf05da6909ebc93171432dccd33ecbf6d /epan/dissectors/packet-iscsi.c | |
parent | 809d8a1113fc07e2277b0e5d0ed6cba25b8b32f8 (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.
svn path=/trunk/; revision=19362
Diffstat (limited to 'epan/dissectors/packet-iscsi.c')
-rw-r--r-- | epan/dissectors/packet-iscsi.c | 22 |
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; |