Ethereal-dev: [Ethereal-dev] minor packet-iscsi.c updates
Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.
From: Mark Burton <markb@xxxxxxxxxx>
Date: Wed, 30 Jan 2002 22:49:48 GMT
Hi, I include minor updates to packet-iscsi.c: More draft 09 compatibility changes. Default number now 3260. Now prints extra info to COL_INFO for SCSI command and login responses. Cheers, Mark
Index: packet-iscsi.c =================================================================== RCS file: /cvsroot/ethereal/packet-iscsi.c,v retrieving revision 1.23 diff -u -3 -p -r1.23 packet-iscsi.c --- packet-iscsi.c 2002/01/21 22:23:38 1.23 +++ packet-iscsi.c 2002/01/30 22:46:13 @@ -27,12 +27,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#if 0 -#define ISCSI_CSG_DIGESTS_ACTIVE ISCSI_CSG_FULL_FEATURE_PHASE -#else -#define ISCSI_CSG_DIGESTS_ACTIVE ISCSI_CSG_OPERATIONAL_NEGOTIATION -#endif - #ifdef HAVE_CONFIG_H # include "config.h" #endif @@ -75,7 +69,7 @@ static int headerDigestIsCRC32 = TRUE; static int dataDigestSize = 4; static int headerDigestSize = 4; -static guint iscsi_port = 5003; +static guint iscsi_port = 3260; /* Initialize the protocol and registered fields */ static int proto_iscsi = -1; @@ -202,6 +196,8 @@ static guint32 iscsi_init_count = 25; #endif #define I_BIT 0x40 +#define OPCODE_MASK 0x3f + #define TARGET_OPCODE_BIT 0x20 #define ISCSI_OPCODE_NOP_OUT 0x00 @@ -226,6 +222,7 @@ static guint32 iscsi_init_count = 25; #define CSG_SHIFT 2 #define CSG_MASK (0x03 << CSG_SHIFT) +#define NSG_MASK 0x03 #define ISCSI_CSG_SECURITY_NEGOTIATION (0 << CSG_SHIFT) #define ISCSI_CSG_OPERATIONAL_NEGOTIATION (1 << CSG_SHIFT) @@ -782,12 +779,21 @@ dissect_iscsi_pdu(tvbuff_t *tvb, packet_ if (check_col(pinfo->cinfo, COL_INFO)) { if (opcode != ISCSI_OPCODE_SCSI_COMMAND) { + col_append_str(pinfo->cinfo, COL_INFO, (char *)opcode_str); - } - if (opcode == ISCSI_OPCODE_SCSI_RESPONSE) { - col_append_fstr (pinfo->cinfo, COL_INFO, " %s", - val_to_str (scsi_status, scsi_status_val, "0x%x")); - } + + if (opcode == ISCSI_OPCODE_SCSI_RESPONSE) { + col_append_fstr (pinfo->cinfo, COL_INFO, " (%s)", + val_to_str (scsi_status, scsi_status_val, "0x%x")); + } + else if (opcode == ISCSI_OPCODE_LOGIN_RESPONSE) { + if(end_offset > (offset + 38)) { + guint16 login_status = tvb_get_ntohs(tvb, offset+36); + col_append_fstr (pinfo->cinfo, COL_INFO, " (%s)", + val_to_str (login_status, iscsi_login_status, "0x%x")); + } + } + } } /* In the interest of speed, if "tree" is NULL, don't do any @@ -931,8 +937,8 @@ dissect_iscsi_pdu(tvbuff_t *tvb, packet_ int digestsActive = 0; { gint b = tvb_get_guint8(tvb, offset + 1); -#if ISCSI_CSG_DIGESTS_ACTIVE < ISCSI_CSG_FULL_FEATURE_PHASE - if((b & CSG_MASK) >= ISCSI_CSG_DIGESTS_ACTIVE) +#ifdef DRAFT08 + if((b & CSG_MASK) >= ISCSI_CSG_OPERATIONAL_NEGOTIATION) digestsActive = 1; #endif #if 0 @@ -980,8 +986,8 @@ dissect_iscsi_pdu(tvbuff_t *tvb, packet_ int digestsActive = 0; { gint b = tvb_get_guint8(tvb, offset + 1); -#if ISCSI_CSG_DIGESTS_ACTIVE < ISCSI_CSG_FULL_FEATURE_PHASE - if((b & CSG_MASK) >= ISCSI_CSG_DIGESTS_ACTIVE) +#ifdef DRAFT08 + if((b & CSG_MASK) >= ISCSI_CSG_OPERATIONAL_NEGOTIATION) digestsActive = 1; #endif #if 0 @@ -1249,13 +1255,8 @@ dissect_iscsi(tvbuff_t *tvb, packet_info guint8 secondPduByte = tvb_get_guint8(tvb, offset + 1); int badPdu = FALSE; -#ifdef DRAFT08 - /* mask out X and I bits */ - opcode &= ~(X_BIT | I_BIT); -#else - /* mask out I bit */ - opcode &= ~I_BIT; -#endif + /* mask out any extra bits in the opcode byte */ + opcode &= OPCODE_MASK; opcode_str = match_strval(opcode, iscsi_opcodes); if(opcode == ISCSI_OPCODE_TASK_MANAGEMENT_FUNCTION || @@ -1306,8 +1307,8 @@ dissect_iscsi(tvbuff_t *tvb, packet_info if(opcode == ISCSI_OPCODE_LOGIN_COMMAND || opcode == ISCSI_OPCODE_LOGIN_RESPONSE) { -#if ISCSI_CSG_DIGESTS_ACTIVE < ISCSI_CSG_FULL_FEATURE_PHASE - if((secondPduByte & CSG_MASK) < ISCSI_CSG_DIGESTS_ACTIVE) { +#ifdef DRAFT08 + if((secondPduByte & CSG_MASK) < ISCSI_CSG_OPERATIONAL_NEGOTIATION) { /* digests are not yet turned on */ digestsActive = 0; } @@ -1715,7 +1716,7 @@ proto_register_iscsi(void) }, { &hf_iscsi_Login_NSG, { "NSG", "iscsi.login.nsg", - FT_UINT8, BASE_HEX, VALS(iscsi_login_stage), 0x03, + FT_UINT8, BASE_HEX, VALS(iscsi_login_stage), NSG_MASK, "Next stage", HFILL } }, { &hf_iscsi_Login_Status,
This message has been 'sanitized'. This means that potentially dangerous content has been rewritten or removed. The following log describes which actions were taken. Sanitizer (start="1012430994"): Replaced MIME boundary: >>--Next_Part--<< with: >>MIMEStream=_0+215011_0254748783824_75966765732<< Writer (pos="1387"): Total modifications so far: 1 Part (pos="1433"): SanitizeFile (filename="unnamed.txt", mimetype="Text/Plain"): Match (rule="2"): Enforced policy: accept Part (pos="1762"): SanitizeFile (filename="foo.diff", mimetype="Text/Plain"): Match (rule="default"): Enforced policy: accept Anomy 0.0.0 : Sanitizer.pm $Id: Sanitizer.pm,v 1.32 2001/10/11 19:27:15 bre Exp $
- Follow-Ups:
- [Ethereal-dev] Re: Ethereal-dev digest, Vol 1 #762 - 10 msgs
- From: Mark Burton
- Re: [Ethereal-dev] minor packet-iscsi.c updates
- From: Guy Harris
- [Ethereal-dev] Re: Ethereal-dev digest, Vol 1 #762 - 10 msgs
- Prev by Date: Re: [Ethereal-dev] Problems building ethereal 0.9.0 with --enable-dftest
- Next by Date: [Ethereal-dev] Re: Ethereal-dev digest, Vol 1 #762 - 10 msgs
- Previous by thread: Re: [Ethereal-dev] Problems building ethereal 0.9.0 with --enable-dftest
- Next by thread: [Ethereal-dev] Re: Ethereal-dev digest, Vol 1 #762 - 10 msgs
- Index(es):