From 765d492aa01ccf1fb8a2c622636549f893e7ecdf Mon Sep 17 00:00:00 2001 From: Peter Lieven Date: Thu, 7 Jul 2016 11:38:21 +0200 Subject: [PATCH] pdu: dump PDU header on ILLEGAL REQUEST sense Signed-off-by: Peter Lieven --- include/iscsi-private.h | 2 ++ lib/iscsi-command.c | 3 +++ 2 files changed, 5 insertions(+) diff --git a/include/iscsi-private.h b/include/iscsi-private.h index c836b0e..aa22a6f 100644 --- a/include/iscsi-private.h +++ b/include/iscsi-private.h @@ -391,6 +391,8 @@ void iscsi_tcp_free_pdu(struct iscsi_context *iscsi, struct iscsi_pdu *pdu); int iscsi_service_reconnect_if_loggedin(struct iscsi_context *iscsi); +void iscsi_dump_pdu_header(struct iscsi_context *iscsi, unsigned char *data); + struct iscsi_transport { int (*connect)(struct iscsi_context *iscsi, union socket_address *sa, int ai_family); int (*queue_pdu)(struct iscsi_context *iscsi, struct iscsi_pdu *pdu); diff --git a/lib/iscsi-command.c b/lib/iscsi-command.c index 2b33fe7..f5930b7 100644 --- a/lib/iscsi-command.c +++ b/lib/iscsi-command.c @@ -450,6 +450,9 @@ iscsi_process_scsi_reply(struct iscsi_context *iscsi, struct iscsi_pdu *pdu, task->sense.key, scsi_sense_ascq_str(task->sense.ascq), task->sense.ascq); + if (task->sense.key == SCSI_SENSE_ILLEGAL_REQUEST) { + iscsi_dump_pdu_header(iscsi, pdu->outdata.data); + } if (pdu->callback) { pdu->callback(iscsi, SCSI_STATUS_CHECK_CONDITION, task, pdu->private_data);