Ethereal-dev: [Ethereal-dev] More minor mods to packet-iscsi.c
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: Fri, 01 Feb 2002 12:29:07 GMT
Our policy is one of continual improvement.
Index: packet-iscsi.c =================================================================== RCS file: /cvsroot/ethereal/packet-iscsi.c,v retrieving revision 1.24 diff -u -3 -p -c -r1.24 packet-iscsi.c *** packet-iscsi.c 2002/01/31 00:44:36 1.24 --- packet-iscsi.c 2002/02/01 12:27:28 *************** static guint32 iscsi_init_count = 25; *** 228,233 **** --- 228,238 ---- #define ISCSI_CSG_OPERATIONAL_NEGOTIATION (1 << CSG_SHIFT) #define ISCSI_CSG_FULL_FEATURE_PHASE (3 << CSG_SHIFT) + #define ISCSI_SCSI_DATA_FLAG_S 0x01 + #define ISCSI_SCSI_DATA_FLAG_U 0x02 + #define ISCSI_SCSI_DATA_FLAG_O 0x04 + #define ISCSI_SCSI_DATA_FLAG_F 0x80 + static const value_string iscsi_opcodes[] = { { ISCSI_OPCODE_NOP_OUT, "NOP Out" }, { ISCSI_OPCODE_SCSI_COMMAND, "SCSI Command" }, *************** static const value_string iscsi_scsicomm *** 328,340 **** {0, NULL}, }; ! static const value_string iscsi_task_responses[] = { {0, "Function complete"}, {1, "Task not in task set"}, {2, "LUN does not exist"}, {3, "Task still allegiant"}, {4, "Task failover not supported"}, {5, "Task management function not supported"}, {255, "Function rejected"}, {0, NULL}, }; --- 333,346 ---- {0, NULL}, }; ! static const value_string iscsi_task_management_responses[] = { {0, "Function complete"}, {1, "Task not in task set"}, {2, "LUN does not exist"}, {3, "Task still allegiant"}, {4, "Task failover not supported"}, {5, "Task management function not supported"}, + {6, "Authorisation failed"}, {255, "Function rejected"}, {0, NULL}, }; *************** static guint32 crc32Table[256] = { *** 519,524 **** --- 525,538 ---- #define CRC32C_PRELOAD 0xffffffff + static guint32 + calculateCRC32(const void *buf, int len, guint32 crc) { + guint8 *p = (guint8 *)buf; + while(len-- > 0) + crc = crc32Table[(crc ^ *p++) & 0xff] ^ (crc >> 8); + return crc; + } + /* * Hash Functions */ *************** iscsi_init_protocol(void) *** 566,579 **** G_ALLOC_AND_FREE); } - static guint32 - calculateCRC32(const void *buf, int len, guint32 crc) { - guint8 *p = (guint8 *)buf; - while(len-- > 0) - crc = crc32Table[(crc ^ *p++) & 0xff] ^ (crc >> 8); - return crc; - } - static int iscsi_min(int a, int b) { return (a < b)? a : b; --- 580,585 ---- *************** dissect_iscsi_pdu(tvbuff_t *tvb, packet_ *** 708,714 **** if (check_col(pinfo->cinfo, COL_PROTOCOL)) col_set_str(pinfo->cinfo, COL_PROTOCOL, "iSCSI"); ! if (opcode == ISCSI_OPCODE_SCSI_RESPONSE) { scsi_status = tvb_get_guint8 (tvb, offset+3); } --- 714,721 ---- if (check_col(pinfo->cinfo, COL_PROTOCOL)) col_set_str(pinfo->cinfo, COL_PROTOCOL, "iSCSI"); ! if (opcode == ISCSI_OPCODE_SCSI_RESPONSE || ! opcode == ISCSI_OPCODE_SCSI_DATA_IN) { scsi_status = tvb_get_guint8 (tvb, offset+3); } *************** dissect_iscsi_pdu(tvbuff_t *tvb, packet_ *** 782,788 **** 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")); } --- 789,797 ---- col_append_str(pinfo->cinfo, COL_INFO, (char *)opcode_str); ! if (opcode == ISCSI_OPCODE_SCSI_RESPONSE || ! (opcode == ISCSI_OPCODE_SCSI_DATA_IN && ! (tvb_get_guint8(tvb, offset + 1) & ISCSI_SCSI_DATA_FLAG_S))) { col_append_fstr (pinfo->cinfo, COL_INFO, " (%s)", val_to_str (scsi_status, scsi_status_val, "0x%x")); } *************** dissect_iscsi_pdu(tvbuff_t *tvb, packet_ *** 793,798 **** --- 802,817 ---- val_to_str (login_status, iscsi_login_status, "0x%x")); } } + else if (opcode == ISCSI_OPCODE_TASK_MANAGEMENT_FUNCTION) { + guint8 tmf = tvb_get_guint8(tvb, offset + 1); + col_append_fstr (pinfo->cinfo, COL_INFO, " (%s)", + val_to_str (tmf, iscsi_task_management_functions, "0x%x")); + } + else if (opcode == ISCSI_OPCODE_TASK_MANAGEMENT_FUNCTION_RESPONSE) { + guint8 resp = tvb_get_guint8(tvb, offset + 2); + col_append_fstr (pinfo->cinfo, COL_INFO, " (%s)", + val_to_str (resp, iscsi_task_management_responses, "0x%x")); + } } } *************** proto_register_iscsi(void) *** 1596,1617 **** }, { &hf_iscsi_SCSIData_F, { "F", "iscsi.scsidata.F", ! FT_BOOLEAN, 8, TFS(&iscsi_meaning_F), 0x80, "Final PDU", HFILL } }, { &hf_iscsi_SCSIData_S, { "S", "iscsi.scsidata.S", ! FT_BOOLEAN, 8, TFS(&iscsi_meaning_S), 0x01, "PDU Contains SCSI command status", HFILL } }, { &hf_iscsi_SCSIData_U, { "U", "iscsi.scsidata.U", ! FT_BOOLEAN, 8, TFS(&iscsi_meaning_U), 0x02, "Residual underflow", HFILL } }, { &hf_iscsi_SCSIData_O, { "O", "iscsi.scsidata.O", ! FT_BOOLEAN, 8, TFS(&iscsi_meaning_O), 0x04, "Residual overflow", HFILL } }, { &hf_iscsi_TargetTransferTag, --- 1615,1636 ---- }, { &hf_iscsi_SCSIData_F, { "F", "iscsi.scsidata.F", ! FT_BOOLEAN, 8, TFS(&iscsi_meaning_F), ISCSI_SCSI_DATA_FLAG_F, "Final PDU", HFILL } }, { &hf_iscsi_SCSIData_S, { "S", "iscsi.scsidata.S", ! FT_BOOLEAN, 8, TFS(&iscsi_meaning_S), ISCSI_SCSI_DATA_FLAG_S, "PDU Contains SCSI command status", HFILL } }, { &hf_iscsi_SCSIData_U, { "U", "iscsi.scsidata.U", ! FT_BOOLEAN, 8, TFS(&iscsi_meaning_U), ISCSI_SCSI_DATA_FLAG_U, "Residual underflow", HFILL } }, { &hf_iscsi_SCSIData_O, { "O", "iscsi.scsidata.O", ! FT_BOOLEAN, 8, TFS(&iscsi_meaning_O), ISCSI_SCSI_DATA_FLAG_O, "Residual overflow", HFILL } }, { &hf_iscsi_TargetTransferTag, *************** proto_register_iscsi(void) *** 1746,1758 **** }, { &hf_iscsi_TaskManagementFunction_Response, { "Response", "iscsi.taskmanfun.response", ! FT_UINT8, BASE_HEX, VALS(iscsi_task_responses), 0, "Response", HFILL } }, { &hf_iscsi_TaskManagementFunction_ReferencedTaskTag, ! { "InitiatorTaskTag", "iscsi.taskmanfun.referencedtasktag", FT_UINT32, BASE_HEX, NULL, 0, ! "Task's initiator task tag", HFILL } }, { &hf_iscsi_RefCmdSN, { "RefCmdSN", "iscsi.refcmdsn", --- 1765,1777 ---- }, { &hf_iscsi_TaskManagementFunction_Response, { "Response", "iscsi.taskmanfun.response", ! FT_UINT8, BASE_HEX, VALS(iscsi_task_management_responses), 0, "Response", HFILL } }, { &hf_iscsi_TaskManagementFunction_ReferencedTaskTag, ! { "ReferencedTaskTag", "iscsi.taskmanfun.referencedtasktag", FT_UINT32, BASE_HEX, NULL, 0, ! "Referenced task tag", HFILL } }, { &hf_iscsi_RefCmdSN, { "RefCmdSN", "iscsi.refcmdsn",
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="1012566636"): Replaced MIME boundary: >>--Next_Part--<< with: >>MIMEStream=_0+185329_6916195688583_49103566725<< Writer (pos="1390"): Total modifications so far: 1 Part (pos="1436"): SanitizeFile (filename="unnamed.txt", mimetype="Text/Plain"): Match (rule="2"): Enforced policy: accept Part (pos="1605"): 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:
- Re: [Ethereal-dev] More minor mods to packet-iscsi.c
- From: Guy Harris
- Re: [Ethereal-dev] More minor mods to packet-iscsi.c
- Prev by Date: Re: [Ethereal-dev] another cosmetc patch
- Next by Date: [Ethereal-dev] New Ethereal Dissector for IAPP
- Previous by thread: Re: [Ethereal-dev] another cosmetc patch
- Next by thread: Re: [Ethereal-dev] More minor mods to packet-iscsi.c
- Index(es):