diff --git a/include/spdk_internal/log.h b/include/spdk_internal/log.h index 0c44a4f07..0993d1016 100644 --- a/include/spdk_internal/log.h +++ b/include/spdk_internal/log.h @@ -98,4 +98,11 @@ __attribute__((constructor)) static void register_flag_##flag(void) \ #define SPDK_LOGDUMP(...) do { } while (0) #endif +#define SPDK_ERRLOGDUMP(LABEL, BUF, LEN) \ + do { \ + if ((LEN)) { \ + spdk_log_dump(stderr, (LABEL), (BUF), (LEN)); \ + } \ + } while (0) + #endif /* SPDK_INTERNAL_LOG_H */ diff --git a/lib/iscsi/iscsi.c b/lib/iscsi/iscsi.c index 387b42fce..1f6207b56 100644 --- a/lib/iscsi/iscsi.c +++ b/lib/iscsi/iscsi.c @@ -4446,6 +4446,12 @@ init_login_reject_response(struct spdk_iscsi_pdu *pdu, struct spdk_iscsi_pdu *rs rsph->itt = pdu->bhs.itt; } +static void +iscsi_pdu_dump(struct spdk_iscsi_pdu *pdu) +{ + SPDK_ERRLOGDUMP("PDU", (uint8_t *)&pdu->bhs, ISCSI_BHS_LEN); +} + int spdk_iscsi_execute(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu) { @@ -4489,6 +4495,7 @@ spdk_iscsi_execute(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu) return SPDK_ISCSI_LOGIN_ERROR_RESPONSE; } else if (conn->state == ISCSI_CONN_STATE_INVALID) { SPDK_ERRLOG("before Full Feature\n"); + iscsi_pdu_dump(pdu); return SPDK_ISCSI_CONNECTION_FATAL; }