diff --git a/0001-iscsi-ls-Fix-iser-url-scheme-parsing.patch b/0001-iscsi-ls-Fix-iser-url-scheme-parsing.patch deleted file mode 100644 index 7af4182c8041203e200df5dceefb3b6324064a22..0000000000000000000000000000000000000000 --- a/0001-iscsi-ls-Fix-iser-url-scheme-parsing.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 6db782bb0ac088cee0f92a8684a2f0a4ab6f8298 Mon Sep 17 00:00:00 2001 -From: Han Han -Date: Tue, 11 Aug 2020 21:57:12 +0800 -Subject: [PATCH 09/22] iscsi-ls: Fix iser url scheme parsing - -Libiscsi supports to parse two iscsi url schemes: 'iscsi://' and 'iser://'. -Fix the missing iser parsing, introduced from 12222077. - -Signed-off-by: Han Han ---- - utils/iscsi-ls.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/utils/iscsi-ls.c b/utils/iscsi-ls.c -index 886624f..ba471ad 100644 ---- a/utils/iscsi-ls.c -+++ b/utils/iscsi-ls.c -@@ -376,7 +376,8 @@ int main(int argc, char *argv[]) - } else if (!strcmp(argv[i], "-U") || - !strcmp(argv[i], "--url")) { - useurls = 1; -- } else if (!strncmp("iscsi://", argv[i], 8)) { -+ } else if (!strncmp("iscsi://", argv[i], 8) || -+ !strncmp("iser://", argv[i], 7)) { - url = strdup(argv[i]); - } - } --- -1.8.3.1 - diff --git a/0002-test-tool-Compare-Write-skip-InvalidDataOutSize-unle.patch b/0002-test-tool-Compare-Write-skip-InvalidDataOutSize-unle.patch deleted file mode 100644 index a50fc5db833839e0f5ff8602a08b34419d932fde..0000000000000000000000000000000000000000 --- a/0002-test-tool-Compare-Write-skip-InvalidDataOutSize-unle.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 60a5856f00731be578a57bfbf68b2e9858680f07 Mon Sep 17 00:00:00 2001 -From: David Disseldorp -Date: Mon, 16 Sep 2019 14:33:50 +0200 -Subject: [PATCH 01/12] test-tool/Compare&Write: skip InvalidDataOutSize unless - iSCSI - -This test performs PDU manipulation so should only be run against iSCSI -devices. - -Signed-off-by: David Disseldorp ---- - test-tool/test_compareandwrite_invalid_dataout_size.c | 7 +++++++ - 1 file changed, 7 insertions(+) - -diff --git a/test-tool/test_compareandwrite_invalid_dataout_size.c b/test-tool/test_compareandwrite_invalid_dataout_size.c -index 4abd501..eb6a6dd 100644 ---- a/test-tool/test_compareandwrite_invalid_dataout_size.c -+++ b/test-tool/test_compareandwrite_invalid_dataout_size.c -@@ -53,6 +53,13 @@ test_compareandwrite_invalid_dataout_size(void) - CHECK_FOR_THIN_PROVISIONING; - CHECK_FOR_LBPPB_GT_1; - CHECK_FOR_SBC; -+ if (sd->iscsi_ctx == NULL) { -+ const char *err = "[SKIPPED] This test is " -+ "only supported for iSCSI backends"; -+ logging(LOG_NORMAL, "%s", err); -+ CU_PASS(err); -+ return; -+ } - - local_iscsi_queue_pdu = my_iscsi_queue_pdu; - --- -1.8.3.1 - diff --git a/0003-test-tool-Compare-Write-override-driver-queue_pdu-ca.patch b/0003-test-tool-Compare-Write-override-driver-queue_pdu-ca.patch deleted file mode 100644 index 9c0b720b9d9052317a6ad301e990e78bf557393c..0000000000000000000000000000000000000000 --- a/0003-test-tool-Compare-Write-override-driver-queue_pdu-ca.patch +++ /dev/null @@ -1,67 +0,0 @@ -From 310e9ace02bafb78d69bfe20e5c9befe7ed24a10 Mon Sep 17 00:00:00 2001 -From: David Disseldorp -Date: Mon, 16 Sep 2019 14:46:28 +0200 -Subject: [PATCH 02/12] test-tool/Compare&Write: override driver queue_pdu() - callback - -In preparation for removing the test-tool iscsi_queue_pdu() dlsym -overload hack, convert the Compare&Write InvalidDataOutSize test to use -the regular transport driver callback for this purpose. - -Signed-off-by: David Disseldorp ---- - test-tool/test_compareandwrite_invalid_dataout_size.c | 16 +++++++++++----- - 1 file changed, 11 insertions(+), 5 deletions(-) - -diff --git a/test-tool/test_compareandwrite_invalid_dataout_size.c b/test-tool/test_compareandwrite_invalid_dataout_size.c -index eb6a6dd..9fcd739 100644 ---- a/test-tool/test_compareandwrite_invalid_dataout_size.c -+++ b/test-tool/test_compareandwrite_invalid_dataout_size.c -@@ -27,11 +27,12 @@ - - - static int new_tl; -+static struct iscsi_transport iscsi_drv_orig; - --static int my_iscsi_queue_pdu(struct iscsi_context *iscsi _U_, struct iscsi_pdu *pdu _U_) -+static int my_iscsi_queue_pdu(struct iscsi_context *iscsi, struct iscsi_pdu *pdu) - { - if (pdu->outdata.data[0] != ISCSI_PDU_SCSI_REQUEST) { -- return 0; -+ goto out; - } - switch (new_tl) { - case 1: -@@ -43,7 +44,8 @@ static int my_iscsi_queue_pdu(struct iscsi_context *iscsi _U_, struct iscsi_pdu - pdu->outdata.data[32 + 13] = 3; - break; - } -- return 0; -+out: -+ return iscsi_drv_orig.queue_pdu(iscsi, pdu); - } - - void -@@ -61,8 +63,10 @@ test_compareandwrite_invalid_dataout_size(void) - return; - } - -- local_iscsi_queue_pdu = my_iscsi_queue_pdu; -- -+ /* override transport queue_pdu callback for PDU manipulation */ -+ iscsi_drv_orig = *sd->iscsi_ctx->drv; -+ sd->iscsi_ctx->drv->queue_pdu = my_iscsi_queue_pdu; -+ - logging(LOG_VERBOSE, LOG_BLANK_LINE); - logging(LOG_VERBOSE, "Test that COMPAREANDWRITE fails for invalid " - "(too small/too large) DataOut sizes."); -@@ -89,4 +93,6 @@ test_compareandwrite_invalid_dataout_size(void) - block_size, 0, 0, 0, 0, - EXPECT_STATUS_GENERIC_BAD); - -+ /* restore transport callbacks */ -+ *(sd->iscsi_ctx->drv) = iscsi_drv_orig; - } --- -1.8.3.1 - diff --git a/0004-test-tool-iSCSICmdSnTooLow-override-driver-queue_pdu.patch b/0004-test-tool-iSCSICmdSnTooLow-override-driver-queue_pdu.patch deleted file mode 100644 index b396a4e30867a0a4a9911ff7a603357500e28ce1..0000000000000000000000000000000000000000 --- a/0004-test-tool-iSCSICmdSnTooLow-override-driver-queue_pdu.patch +++ /dev/null @@ -1,64 +0,0 @@ -From c067eef9c10c17b8a9be83ee4f71d4c8d0d238e4 Mon Sep 17 00:00:00 2001 -From: David Disseldorp -Date: Mon, 16 Sep 2019 14:46:28 +0200 -Subject: [PATCH 03/12] test-tool/iSCSICmdSnTooLow: override driver queue_pdu() - callback - -In preparation for removing the test-tool iscsi_queue_pdu() dlsym -overload hack, convert this test to use the regular transport driver -callback for this purpose. - -Signed-off-by: David Disseldorp ---- - test-tool/test_iscsi_cmdsn_toolow.c | 12 ++++++++---- - 1 file changed, 8 insertions(+), 4 deletions(-) - -diff --git a/test-tool/test_iscsi_cmdsn_toolow.c b/test-tool/test_iscsi_cmdsn_toolow.c -index 0b980b3..23b93c3 100644 ---- a/test-tool/test_iscsi_cmdsn_toolow.c -+++ b/test-tool/test_iscsi_cmdsn_toolow.c -@@ -25,6 +25,7 @@ - #include "iscsi-test-cu.h" - - static int change_cmdsn; -+static struct iscsi_transport iscsi_drv_orig; - - static int my_iscsi_queue_pdu(struct iscsi_context *iscsi, struct iscsi_pdu *pdu) - { -@@ -40,7 +41,7 @@ static int my_iscsi_queue_pdu(struct iscsi_context *iscsi, struct iscsi_pdu *pdu - } - - change_cmdsn = 0; -- return 0; -+ return iscsi_drv_orig.queue_pdu(iscsi, pdu); - } - - void test_iscsi_cmdsn_toolow(void) -@@ -64,7 +65,9 @@ void test_iscsi_cmdsn_toolow(void) - - sd->iscsi_ctx->use_immediate_data = ISCSI_IMMEDIATE_DATA_NO; - sd->iscsi_ctx->target_max_recv_data_segment_length = block_size; -- local_iscsi_queue_pdu = my_iscsi_queue_pdu; -+ /* override transport queue_pdu callback for PDU manipulation */ -+ iscsi_drv_orig = *sd->iscsi_ctx->drv; -+ sd->iscsi_ctx->drv->queue_pdu = my_iscsi_queue_pdu; - change_cmdsn = 1; - /* we don't want autoreconnect since some targets will incorrectly - * drop the connection on this condition. -@@ -81,10 +84,11 @@ void test_iscsi_cmdsn_toolow(void) - logging(LOG_VERBOSE, "[FAILURE] We got a response from the target but SMDSN was outside of the window."); - } - -- -- - iscsi_set_noautoreconnect(sd->iscsi_ctx, 0); - logging(LOG_VERBOSE, "Send a TESTUNITREADY with CMDSN == EXPCMDSN. should work again"); - TESTUNITREADY(sd, - EXPECT_STATUS_GOOD); -+ -+ /* restore transport callbacks */ -+ *(sd->iscsi_ctx->drv) = iscsi_drv_orig; - } --- -1.8.3.1 - diff --git a/0005-test-tool-iSCSICmdSnTooHigh-override-driver-queue_pd.patch b/0005-test-tool-iSCSICmdSnTooHigh-override-driver-queue_pd.patch deleted file mode 100644 index c63551c43b52996224ac39fdc0f5ed81c8ee6bd5..0000000000000000000000000000000000000000 --- a/0005-test-tool-iSCSICmdSnTooHigh-override-driver-queue_pd.patch +++ /dev/null @@ -1,63 +0,0 @@ -From 575ba2244c5db240bc29fa493404eee39f693a2d Mon Sep 17 00:00:00 2001 -From: David Disseldorp -Date: Mon, 16 Sep 2019 14:46:28 +0200 -Subject: [PATCH 04/12] test-tool/iSCSICmdSnTooHigh: override driver - queue_pdu() callback - -In preparation for removing the test-tool iscsi_queue_pdu() dlsym -overload hack, convert this test to use the regular transport driver -callback for this purpose. - -Signed-off-by: David Disseldorp ---- - test-tool/test_iscsi_cmdsn_toohigh.c | 11 ++++++++--- - 1 file changed, 8 insertions(+), 3 deletions(-) - -diff --git a/test-tool/test_iscsi_cmdsn_toohigh.c b/test-tool/test_iscsi_cmdsn_toohigh.c -index 59ce0ab..19c8b91 100644 ---- a/test-tool/test_iscsi_cmdsn_toohigh.c -+++ b/test-tool/test_iscsi_cmdsn_toohigh.c -@@ -25,6 +25,7 @@ - #include "iscsi-test-cu.h" - - static int change_cmdsn; -+static struct iscsi_transport iscsi_drv_orig; - - static int my_iscsi_queue_pdu(struct iscsi_context *iscsi, struct iscsi_pdu *pdu) - { -@@ -40,7 +41,7 @@ static int my_iscsi_queue_pdu(struct iscsi_context *iscsi, struct iscsi_pdu *pdu - } - - change_cmdsn = 0; -- return 0; -+ return iscsi_drv_orig.queue_pdu(iscsi, pdu); - } - - void test_iscsi_cmdsn_toohigh(void) -@@ -64,7 +65,9 @@ void test_iscsi_cmdsn_toohigh(void) - - sd->iscsi_ctx->use_immediate_data = ISCSI_IMMEDIATE_DATA_NO; - sd->iscsi_ctx->target_max_recv_data_segment_length = block_size; -- local_iscsi_queue_pdu = my_iscsi_queue_pdu; -+ /* override transport queue_pdu callback for PDU manipulation */ -+ iscsi_drv_orig = *sd->iscsi_ctx->drv; -+ sd->iscsi_ctx->drv->queue_pdu = my_iscsi_queue_pdu; - change_cmdsn = 1; - /* we don't want autoreconnect since some targets will incorrectly - * drop the connection on this condition. -@@ -81,9 +84,11 @@ void test_iscsi_cmdsn_toohigh(void) - logging(LOG_VERBOSE, "[FAILURE] We got a response from the target but SMDSN was outside of the window."); - } - -- - iscsi_set_noautoreconnect(sd->iscsi_ctx, 0); - logging(LOG_VERBOSE, "Send a TESTUNITREADY with CMDSN == EXPCMDSN. should work again"); - TESTUNITREADY(sd, - EXPECT_STATUS_GOOD); -+ -+ /* restore transport callbacks */ -+ *(sd->iscsi_ctx->drv) = iscsi_drv_orig; - } --- -1.8.3.1 - diff --git a/0006-test-tool-iSCSIDataSnInvalid-override-driver-queue_p.patch b/0006-test-tool-iSCSIDataSnInvalid-override-driver-queue_p.patch deleted file mode 100644 index daf9f7d424ff8593285cbc9d2617b7c9cf279e8b..0000000000000000000000000000000000000000 --- a/0006-test-tool-iSCSIDataSnInvalid-override-driver-queue_p.patch +++ /dev/null @@ -1,161 +0,0 @@ -From 153ca193fa61be8c2c26d8736119e7dc873d1242 Mon Sep 17 00:00:00 2001 -From: David Disseldorp -Date: Mon, 16 Sep 2019 14:46:28 +0200 -Subject: [PATCH 05/12] test-tool/iSCSIDataSnInvalid: override driver - queue_pdu() callback - -In preparation for removing the test-tool iscsi_queue_pdu() dlsym -overload hack, convert this test to use the regular transport driver -callback for this purpose. -This commit also removes a number of unnecessary "WRITE10 is not -implemented" checks, which should all be caught by the first check. - -Signed-off-by: David Disseldorp ---- - test-tool/test_iscsi_datasn_invalid.c | 56 +++++++++++++---------------------- - 1 file changed, 21 insertions(+), 35 deletions(-) - -diff --git a/test-tool/test_iscsi_datasn_invalid.c b/test-tool/test_iscsi_datasn_invalid.c -index 14deb7a..c25631a 100644 ---- a/test-tool/test_iscsi_datasn_invalid.c -+++ b/test-tool/test_iscsi_datasn_invalid.c -@@ -25,13 +25,14 @@ - #include "iscsi-test-cu.h" - - static int change_datasn; -+static struct iscsi_transport iscsi_drv_orig; - --static int my_iscsi_queue_pdu(struct iscsi_context *iscsi _U_, struct iscsi_pdu *pdu _U_) -+static int my_iscsi_queue_pdu(struct iscsi_context *iscsi, struct iscsi_pdu *pdu) - { - uint32_t datasn; - - if (pdu->outdata.data[0] != ISCSI_PDU_DATA_OUT) { -- return 0; -+ goto out; - } - switch (change_datasn) { - case 1: -@@ -52,11 +53,12 @@ static int my_iscsi_queue_pdu(struct iscsi_context *iscsi _U_, struct iscsi_pdu - scsi_set_uint32(&pdu->outdata.data[36], 1 - datasn); - break; - } -- return 0; -+out: -+ return iscsi_drv_orig.queue_pdu(iscsi, pdu); - } - - void test_iscsi_datasn_invalid(void) --{ -+{ - int ret; - - CHECK_FOR_DATALOSS; -@@ -77,7 +79,9 @@ void test_iscsi_datasn_invalid(void) - - sd->iscsi_ctx->use_immediate_data = ISCSI_IMMEDIATE_DATA_NO; - sd->iscsi_ctx->target_max_recv_data_segment_length = block_size; -- local_iscsi_queue_pdu = my_iscsi_queue_pdu; -+ /* override transport queue_pdu callback for PDU manipulation */ -+ iscsi_drv_orig = *sd->iscsi_ctx->drv; -+ sd->iscsi_ctx->drv->queue_pdu = my_iscsi_queue_pdu; - iscsi_set_noautoreconnect(sd->iscsi_ctx, 1); - iscsi_set_timeout(sd->iscsi_ctx, 3); - -@@ -89,81 +93,63 @@ void test_iscsi_datasn_invalid(void) - if (ret == -2) { - logging(LOG_NORMAL, "[SKIPPED] WRITE10 is not implemented."); - CU_PASS("WRITE10 is not implemented."); -- local_iscsi_queue_pdu = NULL; -- return; -- } -+ goto out_ctx_restore; -+ } - CU_ASSERT_NOT_EQUAL(ret, 0); - -+ /* avoid changing DataSN during reconnect */ -+ *(sd->iscsi_ctx->drv) = iscsi_drv_orig; - iscsi_set_noautoreconnect(sd->iscsi_ctx, 0); - -- - logging(LOG_VERBOSE, "Send Data-Out PDU with DataSN==27. Should fail"); - change_datasn = 2; - - sd->iscsi_ctx->use_immediate_data = ISCSI_IMMEDIATE_DATA_NO; - sd->iscsi_ctx->target_max_recv_data_segment_length = block_size; -- local_iscsi_queue_pdu = my_iscsi_queue_pdu; -+ sd->iscsi_ctx->drv->queue_pdu = my_iscsi_queue_pdu; - iscsi_set_noautoreconnect(sd->iscsi_ctx, 1); - iscsi_set_timeout(sd->iscsi_ctx, 3); - - ret = write10(sd, 100, block_size, - block_size, 0, 0, 0, 0, 0, scratch, - EXPECT_STATUS_GOOD); -- if (ret == -2) { -- logging(LOG_NORMAL, "[SKIPPED] WRITE10 is not implemented."); -- CU_PASS("WRITE10 is not implemented."); -- local_iscsi_queue_pdu = NULL; -- return; -- } - CU_ASSERT_NOT_EQUAL(ret, 0); - -+ *(sd->iscsi_ctx->drv) = iscsi_drv_orig; - iscsi_set_noautoreconnect(sd->iscsi_ctx, 0); - -- - logging(LOG_VERBOSE, "Send Data-Out PDU with DataSN==-1. Should fail"); - change_datasn = 3; - - sd->iscsi_ctx->use_immediate_data = ISCSI_IMMEDIATE_DATA_NO; - sd->iscsi_ctx->target_max_recv_data_segment_length = block_size; -- local_iscsi_queue_pdu = my_iscsi_queue_pdu; -+ sd->iscsi_ctx->drv->queue_pdu = my_iscsi_queue_pdu; - iscsi_set_noautoreconnect(sd->iscsi_ctx, 1); - iscsi_set_timeout(sd->iscsi_ctx, 3); - - ret = write10(sd, 100, block_size, - block_size, 0, 0, 0, 0, 0, scratch, - EXPECT_STATUS_GOOD); -- if (ret == -2) { -- logging(LOG_NORMAL, "[SKIPPED] WRITE10 is not implemented."); -- CU_PASS("WRITE10 is not implemented."); -- local_iscsi_queue_pdu = NULL; -- return; -- } - CU_ASSERT_NOT_EQUAL(ret, 0); - -+ *(sd->iscsi_ctx->drv) = iscsi_drv_orig; - iscsi_set_noautoreconnect(sd->iscsi_ctx, 0); - -- -- - logging(LOG_VERBOSE, "Send Data-Out PDU's in reverse order (DataSN == 1,0). Should fail"); - change_datasn = 4; - - sd->iscsi_ctx->use_immediate_data = ISCSI_IMMEDIATE_DATA_NO; - sd->iscsi_ctx->target_max_recv_data_segment_length = block_size; -- local_iscsi_queue_pdu = my_iscsi_queue_pdu; -+ sd->iscsi_ctx->drv->queue_pdu = my_iscsi_queue_pdu; - iscsi_set_noautoreconnect(sd->iscsi_ctx, 1); - iscsi_set_timeout(sd->iscsi_ctx, 3); - - ret = write10(sd, 100, 2 * block_size, - block_size, 0, 0, 0, 0, 0, scratch, - EXPECT_STATUS_GOOD); -- if (ret == -2) { -- logging(LOG_NORMAL, "[SKIPPED] WRITE10 is not implemented."); -- CU_PASS("WRITE10 is not implemented."); -- local_iscsi_queue_pdu = NULL; -- return; -- } - CU_ASSERT_NOT_EQUAL(ret, 0); -- -- local_iscsi_queue_pdu = NULL; -+out_ctx_restore: -+ /* restore transport callbacks and autoreconnect */ -+ *(sd->iscsi_ctx->drv) = iscsi_drv_orig; - iscsi_set_noautoreconnect(sd->iscsi_ctx, 0); - } --- -1.8.3.1 - diff --git a/0007-test-tool-BlockEraseReserved-skip-unless-iSCSI.patch b/0007-test-tool-BlockEraseReserved-skip-unless-iSCSI.patch deleted file mode 100644 index 8b85e308c3fc0b0daf823f5e4a96dd5726c3780d..0000000000000000000000000000000000000000 --- a/0007-test-tool-BlockEraseReserved-skip-unless-iSCSI.patch +++ /dev/null @@ -1,34 +0,0 @@ -From fdc45fadfa06f2543a12abe8eefe7f87d5dab0c2 Mon Sep 17 00:00:00 2001 -From: David Disseldorp -Date: Mon, 16 Sep 2019 15:40:00 +0200 -Subject: [PATCH 06/12] test-tool/BlockEraseReserved: skip unless iSCSI - -This test performs PDU manipulation so should only be run against iSCSI -devices. - -Signed-off-by: David Disseldorp ---- - test-tool/test_sanitize_block_erase_reserved.c | 7 +++++++ - 1 file changed, 7 insertions(+) - -diff --git a/test-tool/test_sanitize_block_erase_reserved.c b/test-tool/test_sanitize_block_erase_reserved.c -index 55c85d9..fcb862e 100644 ---- a/test-tool/test_sanitize_block_erase_reserved.c -+++ b/test-tool/test_sanitize_block_erase_reserved.c -@@ -56,6 +56,13 @@ void test_sanitize_block_erase_reserved(void) - - CHECK_FOR_SANITIZE; - CHECK_FOR_DATALOSS; -+ if (sd->iscsi_ctx == NULL) { -+ const char *err = "[SKIPPED] This test is " -+ "only supported for iSCSI backends"; -+ logging(LOG_NORMAL, "%s", err); -+ CU_PASS(err); -+ return; -+ } - - local_iscsi_queue_pdu = my_iscsi_queue_pdu; - --- -1.8.3.1 - diff --git a/0008-test-tool-BlockEraseReserved-override-driver-queue_p.patch b/0008-test-tool-BlockEraseReserved-override-driver-queue_p.patch deleted file mode 100644 index 571cd66df20728c30fd2bc7515570e0427befb3b..0000000000000000000000000000000000000000 --- a/0008-test-tool-BlockEraseReserved-override-driver-queue_p.patch +++ /dev/null @@ -1,69 +0,0 @@ -From b705f9e5240583fb862f16d603e5cf2120e5d54c Mon Sep 17 00:00:00 2001 -From: David Disseldorp -Date: Mon, 16 Sep 2019 14:46:28 +0200 -Subject: [PATCH 07/12] test-tool/BlockEraseReserved: override driver - queue_pdu() callback - -In preparation for removing the test-tool iscsi_queue_pdu() dlsym -overload hack, convert this test to use the regular transport driver -callback for this purpose. - -Signed-off-by: David Disseldorp ---- - test-tool/test_sanitize_block_erase_reserved.c | 17 +++++++++++------ - 1 file changed, 11 insertions(+), 6 deletions(-) - -diff --git a/test-tool/test_sanitize_block_erase_reserved.c b/test-tool/test_sanitize_block_erase_reserved.c -index fcb862e..4a0d2cb 100644 ---- a/test-tool/test_sanitize_block_erase_reserved.c -+++ b/test-tool/test_sanitize_block_erase_reserved.c -@@ -25,8 +25,9 @@ - #include "iscsi-test-cu.h" - - static int change_num; -+static struct iscsi_transport iscsi_drv_orig; - --static int my_iscsi_queue_pdu(struct iscsi_context *iscsi _U_, struct iscsi_pdu *pdu) -+static int my_iscsi_queue_pdu(struct iscsi_context *iscsi, struct iscsi_pdu *pdu) - { - switch (change_num) { - case 1: -@@ -43,12 +44,12 @@ static int my_iscsi_queue_pdu(struct iscsi_context *iscsi _U_, struct iscsi_pdu - break; - } - -- change_num = 0; -- return 0; -+ change_num = 0; -+ return iscsi_drv_orig.queue_pdu(iscsi, pdu); - } - - void test_sanitize_block_erase_reserved(void) --{ -+{ - int i; - - logging(LOG_VERBOSE, LOG_BLANK_LINE); -@@ -64,8 +65,9 @@ void test_sanitize_block_erase_reserved(void) - return; - } - -- local_iscsi_queue_pdu = my_iscsi_queue_pdu; -- -+ /* override transport queue_pdu callback for PDU manipulation */ -+ iscsi_drv_orig = *sd->iscsi_ctx->drv; -+ sd->iscsi_ctx->drv->queue_pdu = my_iscsi_queue_pdu; - - logging(LOG_VERBOSE, "Send SANITIZE command with the reserved " - "bit in byte 1 set to 1"); -@@ -81,4 +83,7 @@ void test_sanitize_block_erase_reserved(void) - SANITIZE(sd, 0, 0, SCSI_SANITIZE_BLOCK_ERASE, 0, NULL, - EXPECT_INVALID_FIELD_IN_CDB); - } -+ -+ /* restore transport callbacks */ -+ *(sd->iscsi_ctx->drv) = iscsi_drv_orig; - } --- -1.8.3.1 - diff --git a/0009-test-tool-CryptoEraseReserved-skip-unless-iSCSI.patch b/0009-test-tool-CryptoEraseReserved-skip-unless-iSCSI.patch deleted file mode 100644 index 8e9099f93f0769460222c7a876f7761ee38befe1..0000000000000000000000000000000000000000 --- a/0009-test-tool-CryptoEraseReserved-skip-unless-iSCSI.patch +++ /dev/null @@ -1,34 +0,0 @@ -From c830a3b55e91fe8b1cb97e6899ef872691c8804e Mon Sep 17 00:00:00 2001 -From: David Disseldorp -Date: Mon, 16 Sep 2019 15:40:00 +0200 -Subject: [PATCH 08/12] test-tool/CryptoEraseReserved: skip unless iSCSI - -This test performs PDU manipulation so should only be run against iSCSI -devices. - -Signed-off-by: David Disseldorp ---- - test-tool/test_sanitize_crypto_erase_reserved.c | 7 +++++++ - 1 file changed, 7 insertions(+) - -diff --git a/test-tool/test_sanitize_crypto_erase_reserved.c b/test-tool/test_sanitize_crypto_erase_reserved.c -index c713ab5..00bbf34 100644 ---- a/test-tool/test_sanitize_crypto_erase_reserved.c -+++ b/test-tool/test_sanitize_crypto_erase_reserved.c -@@ -56,6 +56,13 @@ void test_sanitize_crypto_erase_reserved(void) - - CHECK_FOR_SANITIZE; - CHECK_FOR_DATALOSS; -+ if (sd->iscsi_ctx == NULL) { -+ const char *err = "[SKIPPED] This test is " -+ "only supported for iSCSI backends"; -+ logging(LOG_NORMAL, "%s", err); -+ CU_PASS(err); -+ return; -+ } - - local_iscsi_queue_pdu = my_iscsi_queue_pdu; - --- -1.8.3.1 - diff --git a/0010-test-tool-CryptoEraseReserved-override-driver-queue_.patch b/0010-test-tool-CryptoEraseReserved-override-driver-queue_.patch deleted file mode 100644 index f93876c8614e3a72e0ef47aff6ecd10f7ff8c6f2..0000000000000000000000000000000000000000 --- a/0010-test-tool-CryptoEraseReserved-override-driver-queue_.patch +++ /dev/null @@ -1,69 +0,0 @@ -From 77279dd44fd19167c22cfada2eec377058e1bde9 Mon Sep 17 00:00:00 2001 -From: David Disseldorp -Date: Mon, 16 Sep 2019 14:46:28 +0200 -Subject: [PATCH 09/12] test-tool/CryptoEraseReserved: override driver - queue_pdu() callback - -In preparation for removing the test-tool iscsi_queue_pdu() dlsym -overload hack, convert this test to use the regular transport driver -callback for this purpose. - -Signed-off-by: David Disseldorp ---- - test-tool/test_sanitize_crypto_erase_reserved.c | 17 +++++++++++------ - 1 file changed, 11 insertions(+), 6 deletions(-) - -diff --git a/test-tool/test_sanitize_crypto_erase_reserved.c b/test-tool/test_sanitize_crypto_erase_reserved.c -index 00bbf34..646cbea 100644 ---- a/test-tool/test_sanitize_crypto_erase_reserved.c -+++ b/test-tool/test_sanitize_crypto_erase_reserved.c -@@ -25,8 +25,9 @@ - #include "iscsi-test-cu.h" - - static int change_num; -+static struct iscsi_transport iscsi_drv_orig; - --static int my_iscsi_queue_pdu(struct iscsi_context *iscsi _U_, struct iscsi_pdu *pdu) -+static int my_iscsi_queue_pdu(struct iscsi_context *iscsi, struct iscsi_pdu *pdu) - { - switch (change_num) { - case 1: -@@ -43,12 +44,12 @@ static int my_iscsi_queue_pdu(struct iscsi_context *iscsi _U_, struct iscsi_pdu - break; - } - -- change_num = 0; -- return 0; -+ change_num = 0; -+ return iscsi_drv_orig.queue_pdu(iscsi, pdu); - } - - void test_sanitize_crypto_erase_reserved(void) --{ -+{ - int i; - - logging(LOG_VERBOSE, LOG_BLANK_LINE); -@@ -64,8 +65,9 @@ void test_sanitize_crypto_erase_reserved(void) - return; - } - -- local_iscsi_queue_pdu = my_iscsi_queue_pdu; -- -+ /* override transport queue_pdu callback for PDU manipulation */ -+ iscsi_drv_orig = *sd->iscsi_ctx->drv; -+ sd->iscsi_ctx->drv->queue_pdu = my_iscsi_queue_pdu; - - logging(LOG_VERBOSE, "Send SANITIZE command with the reserved " - "bit in byte 1 set to 1"); -@@ -81,4 +83,7 @@ void test_sanitize_crypto_erase_reserved(void) - SANITIZE(sd, 0, 0, SCSI_SANITIZE_CRYPTO_ERASE, 0, NULL, - EXPECT_INVALID_FIELD_IN_CDB); - } -+ -+ /* restore transport callbacks */ -+ *(sd->iscsi_ctx->drv) = iscsi_drv_orig; - } --- -1.8.3.1 - diff --git a/0011-test-tool-OverwriteReserved-skip-unless-iSCSI.patch b/0011-test-tool-OverwriteReserved-skip-unless-iSCSI.patch deleted file mode 100644 index b3338004fed9f9efb6fcf1cf1b4cda18c2475ae2..0000000000000000000000000000000000000000 --- a/0011-test-tool-OverwriteReserved-skip-unless-iSCSI.patch +++ /dev/null @@ -1,34 +0,0 @@ -From e5cc079e7c2678997b3aa157331ebf34c8b10932 Mon Sep 17 00:00:00 2001 -From: David Disseldorp -Date: Mon, 16 Sep 2019 15:40:00 +0200 -Subject: [PATCH 10/12] test-tool/OverwriteReserved: skip unless iSCSI - -This test performs PDU manipulation so should only be run against iSCSI -devices. - -Signed-off-by: David Disseldorp ---- - test-tool/test_sanitize_overwrite_reserved.c | 7 +++++++ - 1 file changed, 7 insertions(+) - -diff --git a/test-tool/test_sanitize_overwrite_reserved.c b/test-tool/test_sanitize_overwrite_reserved.c -index 20a0779..79f8a92 100644 ---- a/test-tool/test_sanitize_overwrite_reserved.c -+++ b/test-tool/test_sanitize_overwrite_reserved.c -@@ -67,6 +67,13 @@ void test_sanitize_overwrite_reserved(void) - - CHECK_FOR_SANITIZE; - CHECK_FOR_DATALOSS; -+ if (sd->iscsi_ctx == NULL) { -+ const char *err = "[SKIPPED] This test is " -+ "only supported for iSCSI backends"; -+ logging(LOG_NORMAL, "%s", err); -+ CU_PASS(err); -+ return; -+ } - - local_iscsi_queue_pdu = my_iscsi_queue_pdu; - --- -1.8.3.1 - diff --git a/0012-test-tool-OverwriteReserved-override-driver-queue_pd.patch b/0012-test-tool-OverwriteReserved-override-driver-queue_pd.patch deleted file mode 100644 index dc152ab64cfba38577ebcc35857ad63572c45f85..0000000000000000000000000000000000000000 --- a/0012-test-tool-OverwriteReserved-override-driver-queue_pd.patch +++ /dev/null @@ -1,68 +0,0 @@ -From 2ae45ac15d8c1d4a4f68a085dadb7f43e2f2e280 Mon Sep 17 00:00:00 2001 -From: David Disseldorp -Date: Mon, 16 Sep 2019 14:46:28 +0200 -Subject: [PATCH 11/12] test-tool/OverwriteReserved: override driver - queue_pdu() callback - -In preparation for removing the test-tool iscsi_queue_pdu() dlsym -overload hack, convert this test to use the regular transport driver -callback for this purpose. - -Signed-off-by: David Disseldorp ---- - test-tool/test_sanitize_overwrite_reserved.c | 16 +++++++++++----- - 1 file changed, 11 insertions(+), 5 deletions(-) - -diff --git a/test-tool/test_sanitize_overwrite_reserved.c b/test-tool/test_sanitize_overwrite_reserved.c -index 79f8a92..91090b4 100644 ---- a/test-tool/test_sanitize_overwrite_reserved.c -+++ b/test-tool/test_sanitize_overwrite_reserved.c -@@ -26,8 +26,9 @@ - #include "iscsi-test-cu.h" - - static int change_num; -+static struct iscsi_transport iscsi_drv_orig; - --static int my_iscsi_queue_pdu(struct iscsi_context *iscsi _U_, struct iscsi_pdu *pdu) -+static int my_iscsi_queue_pdu(struct iscsi_context *iscsi, struct iscsi_pdu *pdu) - { - switch (change_num) { - case 1: -@@ -44,12 +45,12 @@ static int my_iscsi_queue_pdu(struct iscsi_context *iscsi _U_, struct iscsi_pdu - break; - } - -- change_num = 0; -- return 0; -+ change_num = 0; -+ return iscsi_drv_orig.queue_pdu(iscsi, pdu); - } - - void test_sanitize_overwrite_reserved(void) --{ -+{ - int i; - struct iscsi_data data; - -@@ -75,7 +76,9 @@ void test_sanitize_overwrite_reserved(void) - return; - } - -- local_iscsi_queue_pdu = my_iscsi_queue_pdu; -+ /* override transport queue_pdu callback for PDU manipulation */ -+ iscsi_drv_orig = *sd->iscsi_ctx->drv; -+ sd->iscsi_ctx->drv->queue_pdu = my_iscsi_queue_pdu; - - logging(LOG_VERBOSE, "Send SANITIZE command with the reserved " - "bit in byte 1 set to 1"); -@@ -91,4 +94,7 @@ void test_sanitize_overwrite_reserved(void) - SANITIZE(sd, 0, 0, SCSI_SANITIZE_OVERWRITE, data.size, &data, - EXPECT_INVALID_FIELD_IN_CDB); - } -+ -+ /* restore transport callbacks */ -+ *(sd->iscsi_ctx->drv) = iscsi_drv_orig; - } --- -1.8.3.1 - diff --git a/0013-test-tool-remove-unused-iscsi_queue_pdu-symbol-overl.patch b/0013-test-tool-remove-unused-iscsi_queue_pdu-symbol-overl.patch deleted file mode 100644 index 42776ab82fe90eadfb6f5897d310e51c65bb2d54..0000000000000000000000000000000000000000 --- a/0013-test-tool-remove-unused-iscsi_queue_pdu-symbol-overl.patch +++ /dev/null @@ -1,100 +0,0 @@ -From dd17293bcc188dbefc420ee23b77bc9bb7c5e9a2 Mon Sep 17 00:00:00 2001 -From: David Disseldorp -Date: Mon, 16 Sep 2019 16:02:36 +0200 -Subject: [PATCH 12/12] test-tool: remove unused iscsi_queue_pdu() symbol - overload - -All users have now been changed to overload via the iscsi_ctx transport -callback, so the dlsym based overloading can now be dropped. - -Signed-off-by: David Disseldorp ---- - test-tool/iscsi-support.c | 11 ----------- - test-tool/iscsi-support.h | 1 - - test-tool/iscsi-test-cu.c | 15 --------------- - 3 files changed, 27 deletions(-) - -diff --git a/test-tool/iscsi-support.c b/test-tool/iscsi-support.c -index 4b49478..169d2b0 100644 ---- a/test-tool/iscsi-support.c -+++ b/test-tool/iscsi-support.c -@@ -119,8 +119,6 @@ int readonly; - int sbc3_support; - int maximum_transfer_length; - --int (*real_iscsi_queue_pdu)(struct iscsi_context *iscsi, struct iscsi_pdu *pdu); -- - static const unsigned char zeroBlock[4096]; - - /** -@@ -570,15 +568,6 @@ wait_until_test_finished(struct iscsi_context *iscsi, struct iscsi_async_state * - } - - int --iscsi_queue_pdu(struct iscsi_context *iscsi, struct iscsi_pdu *pdu) --{ -- if (local_iscsi_queue_pdu != NULL) { -- local_iscsi_queue_pdu(iscsi, pdu); -- } -- return real_iscsi_queue_pdu(iscsi, pdu); --} -- --int - orwrite(struct scsi_device *sdev, uint64_t lba, - uint32_t datalen, int blocksize, int wrprotect, - int dpo, int fua, int fua_nv, int group, -diff --git a/test-tool/iscsi-support.h b/test-tool/iscsi-support.h -index aee00ca..2b20a1f 100644 ---- a/test-tool/iscsi-support.h -+++ b/test-tool/iscsi-support.h -@@ -782,7 +782,6 @@ struct iscsi_async_state { - void wait_until_test_finished(struct iscsi_context *iscsi, struct iscsi_async_state *test_state); - - struct iscsi_pdu; --int (*local_iscsi_queue_pdu)(struct iscsi_context *iscsi, struct iscsi_pdu *pdu); - - struct scsi_command_descriptor *get_command_descriptor(int opcode, int sa); - -diff --git a/test-tool/iscsi-test-cu.c b/test-tool/iscsi-test-cu.c -index eafda39..26e1b05 100644 ---- a/test-tool/iscsi-test-cu.c -+++ b/test-tool/iscsi-test-cu.c -@@ -59,12 +59,6 @@ int loglevel = LOG_NORMAL; - struct scsi_device *sd = NULL; /* mp_sds[0] alias */ - static unsigned int maxsectors; - --/* -- * this allows us to redefine how PDU are queued, at times, for -- * testing purposes -- */ --int (*real_iscsi_queue_pdu)(struct iscsi_context *iscsi, struct iscsi_pdu *pdu); -- - /***************************************************************** - * - * list of tests and test suites -@@ -805,7 +799,6 @@ test_setup(void) - { - task = NULL; - read_write_buf = NULL; -- local_iscsi_queue_pdu = NULL; - } - - void -@@ -1214,14 +1207,6 @@ main(int argc, char *argv[]) - mp_num_sds++; - } - -- /* So that we can override iscsi_queue_pdu in tests -- * and replace or mutate the blob that we are about to write to the -- * wire. -- * This allows such tests to do their mutates and then call out -- * to the real queueing function once they have modified the data. -- */ -- real_iscsi_queue_pdu = dlsym(RTLD_NEXT, "iscsi_queue_pdu"); -- - if ((mp_num_sds == 0) || (mp_sds[0]->iscsi_url == NULL - && mp_sds[0]->sgio_dev == NULL)) { - #ifdef HAVE_SG_IO --- -1.8.3.1 - diff --git a/0014-iser-remove-__packed-from-struct-iser_cm_hdr-declaration.patch b/0014-iser-remove-__packed-from-struct-iser_cm_hdr-declaration.patch deleted file mode 100644 index b76a6e0f0ef5642ff5cade8ad042f2d4eca89329..0000000000000000000000000000000000000000 --- a/0014-iser-remove-__packed-from-struct-iser_cm_hdr-declaration.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 51391285d85955c6d33f2a4bfe86602eb5d230fb Mon Sep 17 00:00:00 2001 -From: wanghonghao -Date: Thu, 5 Dec 2019 18:59:18 +0800 -Subject: [PATCH] iser: remove `__packed` from struct iser_cm_hdr declaration - -`__packed` is not defined previously, and was treated as a varible -declaration. - -Signed-off-by: wanghonghao ---- - include/iser-private.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/include/iser-private.h b/include/iser-private.h -index b8b38db7..b943d34a 100644 ---- a/include/iser-private.h -+++ b/include/iser-private.h -@@ -158,7 +158,7 @@ struct iser_tx_desc { - struct iser_cm_hdr { - uint8_t flags; - uint8_t rsvd[3]; --} __packed; -+}; - - struct iser_pdu { - struct iscsi_pdu iscsi_pdu; --- diff --git a/0015-test-tools-use-extern-init-in-headers.patch b/0015-test-tools-use-extern-init-in-headers.patch deleted file mode 100644 index 3a60dc0caf9a192db503f221b4b674bb76d2e260..0000000000000000000000000000000000000000 --- a/0015-test-tools-use-extern-init-in-headers.patch +++ /dev/null @@ -1,51 +0,0 @@ -From ea89dcdbf167acd634300296172926c2e8d85804 Mon Sep 17 00:00:00 2001 -From: Cole Robinson -Date: Sat, 15 Feb 2020 18:03:11 -0500 -Subject: [PATCH] test-tool: Use 'extern int' in headers - -Without this, linking fails on Fedora rawhide. Example: - -... -/usr/bin/ld: test_async_lu_reset_simple.o:/root/libiscsi/libiscsi.git/test-tool/iscsi-support.h:59: multiple definition of `param_list_len_err_ascqs'; iscsi-test-cu.o:/root/libiscsi/libiscsi.git/test-tool/iscsi-support.h:59: first defined here -/usr/bin/ld: test_async_lu_reset_simple.o:/root/libiscsi/libiscsi.git/test-tool/iscsi-support.h:58: multiple definition of `invalid_cdb_ascqs'; iscsi-test-cu.o:/root/libiscsi/libiscsi.git/test-tool/iscsi-support.h:58: first defined here -... - -Signed-off-by: Cole Robinson ---- - test-tool/iscsi-support.h | 22 +++++++++++----------- - 1 file changed, 11 insertions(+), 11 deletions(-) - -diff --git a/test-tool/iscsi-support.h b/test-tool/iscsi-support.h -index 7aa9e45c..9c3a4612 100644 ---- a/test-tool/iscsi-support.h -+++ b/test-tool/iscsi-support.h -@@ -53,17 +53,17 @@ extern const char *initiatorname2; - #define EXPECT_RESERVATION_CONFLICT SCSI_STATUS_RESERVATION_CONFLICT, 0, NULL, 0 - #define EXPECT_COPY_ABORTED SCSI_STATUS_CHECK_CONDITION, SCSI_SENSE_COPY_ABORTED, copy_aborted_ascqs, 3 - --int no_medium_ascqs[3]; --int lba_oob_ascqs[1]; --int invalid_cdb_ascqs[2]; --int param_list_len_err_ascqs[1]; --int too_many_desc_ascqs[2]; --int unsupp_desc_code_ascqs[2]; --int write_protect_ascqs[3]; --int sanitize_ascqs[1]; --int removal_ascqs[1]; --int miscompare_ascqs[1]; --int copy_aborted_ascqs[3]; -+extern int no_medium_ascqs[3]; -+extern int lba_oob_ascqs[1]; -+extern int invalid_cdb_ascqs[2]; -+extern int param_list_len_err_ascqs[1]; -+extern int too_many_desc_ascqs[2]; -+extern int unsupp_desc_code_ascqs[2]; -+extern int write_protect_ascqs[3]; -+extern int sanitize_ascqs[1]; -+extern int removal_ascqs[1]; -+extern int miscompare_ascqs[1]; -+extern int copy_aborted_ascqs[3]; - - extern int loglevel; - #define LOG_SILENT 0 --- diff --git a/0016-iscsi-inq-handle-setting-of-debug_level-correctly.patch b/0016-iscsi-inq-handle-setting-of-debug_level-correctly.patch deleted file mode 100644 index baf9d23f2517022da3dfd13359a45255af238a2f..0000000000000000000000000000000000000000 --- a/0016-iscsi-inq-handle-setting-of-debug_level-correctly.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 5e638532306aad854200cee86b454c15a14a0139 Mon Sep 17 00:00:00 2001 -From: Wenchao Hao -Date: Wed, 6 Apr 2022 10:28:23 +0800 -Subject: [PATCH] iscsi-inq: handle setting of debug_level correctly - -According to the man page and help info, --debug=integer can specify the -debug_level, while it would report following error: - -iscsi-inq --debug=2 -iscsi-inq: option '--debug' doesn't allow an argument - -It's because the iscsi-inq code did not handle this parameters -correctly. So here we just correct it. - -Signed-off-by: Wenchao Hao ---- - utils/iscsi-inq.c | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/utils/iscsi-inq.c b/utils/iscsi-inq.c -index 24016fd..54d17ca 100644 ---- a/utils/iscsi-inq.c -+++ b/utils/iscsi-inq.c -@@ -241,7 +241,7 @@ int main(int argc, char *argv[]) - static struct option long_options[] = { - {"help", no_argument, NULL, 'h'}, - {"usage", no_argument, NULL, 'u'}, -- {"debug", no_argument, NULL, 'd'}, -+ {"debug", required_argument, NULL, 'd'}, - {"initiator-name", required_argument, NULL, 'i'}, - {"evpd", required_argument, NULL, 'e'}, - {"pagecode", required_argument, NULL, 'c'}, -@@ -249,7 +249,7 @@ int main(int argc, char *argv[]) - }; - int option_index; - -- while ((c = getopt_long(argc, argv, "h?udi:e:c:", long_options, -+ while ((c = getopt_long(argc, argv, "h?ud:i:e:c:", long_options, - &option_index)) != -1) { - switch (c) { - case 'h': -@@ -260,7 +260,7 @@ int main(int argc, char *argv[]) - show_usage = 1; - break; - case 'd': -- debug = 1; -+ debug = atoi(optarg); - break; - case 'i': - initiator = optarg; --- -2.27.0 - diff --git a/0017-Updata-iscsi-dd.c.patch b/0017-Updata-iscsi-dd.c.patch deleted file mode 100644 index 0ca5babbbe1c13da340c01d38c21e3c92b9b785f..0000000000000000000000000000000000000000 --- a/0017-Updata-iscsi-dd.c.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 8592dc58838872d0d49c3d773df950f0b3e1eb4b Mon Sep 17 00:00:00 2001 -From: sallyjunjun <72725839+sallyjunjun@users.noreply.github.com> -Date: Tue, 31 May 2022 14:20:43 +0800 -Subject: [PATCH 1/4] Update iscsi-dd.c - -add check after malloc to avoid referencing an illegal pointer ---- - examples/iscsi-dd.c | 10 ++++++++++ - 1 file changed, 10 insertions(+) - -diff --git a/examples/iscsi-dd.c b/examples/iscsi-dd.c -index b2d41ac..1f7ae9f 100644 ---- a/examples/iscsi-dd.c -+++ b/examples/iscsi-dd.c -@@ -131,6 +131,11 @@ void read_cb(struct iscsi_context *iscsi, int status, void *command_data, void * - } - - wt = malloc(sizeof(struct write_task)); -+ if (wt == NULL) { -+ fprintf(stderr, "failed to alloc write task\n"); -+ exit(10); -+ } -+ - wt->rt = task; - wt->client = client; - -@@ -430,6 +435,11 @@ void cscd_ident_inq(struct iscsi_context *iscsi, - _tgt_desig->designator_type = tgt_desig->designator_type; - _tgt_desig->designator_length = tgt_desig->designator_length; - _tgt_desig->designator = malloc(tgt_desig->designator_length); -+ if (_tgt_desig->designator == NULL) { -+ fprintf(stderr, "failed to alloc designator\n"); -+ exit(10); -+ } -+ - memcpy(_tgt_desig->designator, tgt_desig->designator, tgt_desig->designator_length); - - scsi_free_scsi_task(task); --- -1.8.3.1 - diff --git a/0018-iscsi-swp-handle-setting-of-debug_level-correctly.patch b/0018-iscsi-swp-handle-setting-of-debug_level-correctly.patch deleted file mode 100644 index 393b5ec26440167f261045fee39a0d8f90ec51e5..0000000000000000000000000000000000000000 --- a/0018-iscsi-swp-handle-setting-of-debug_level-correctly.patch +++ /dev/null @@ -1,47 +0,0 @@ -From b087a09a0b7754765d3d646c20b5a122eb2b3847 Mon Sep 17 00:00:00 2001 -From: sallyjunjun <72725839+sallyjunjun@users.noreply.github.com> -Date: Tue, 31 May 2022 17:21:09 +0800 -Subject: [PATCH 2/4] iscsi-swp: handle setting of debug_level correctly - -According to the man page and help info, --debug=integer can specify the -debug_level, while it would report following error: - -iscsi-swp --debug=1 -iscsi-swp: option '--debug' doesn't allow an argument ---- - utils/iscsi-swp.c | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/utils/iscsi-swp.c b/utils/iscsi-swp.c -index af07c81..8c2ca31 100644 ---- a/utils/iscsi-swp.c -+++ b/utils/iscsi-swp.c -@@ -75,14 +75,14 @@ int main(int argc, char *argv[]) - static struct option long_options[] = { - {"help", no_argument, NULL, 'h'}, - {"usage", no_argument, NULL, 'u'}, -- {"debug", no_argument, NULL, 'd'}, -+ {"debug", required_argument, NULL, 'd'}, - {"initiator-name", required_argument, NULL, 'i'}, - {"swp", required_argument, NULL, 's'}, - {0, 0, 0, 0} - }; - int option_index; - -- while ((c = getopt_long(argc, argv, "h?udi:s:", long_options, -+ while ((c = getopt_long(argc, argv, "h?ud:i:s:", long_options, - &option_index)) != -1) { - switch (c) { - case 'h': -@@ -93,7 +93,7 @@ int main(int argc, char *argv[]) - show_usage = 1; - break; - case 'd': -- debug = 1; -+ debug = atoi(optarg); - break; - case 'i': - initiator = optarg; --- -1.8.3.1 - diff --git a/0019-fix-iscsi-ls-parameter-parse.patch b/0019-fix-iscsi-ls-parameter-parse.patch deleted file mode 100644 index 7ec6013ec7889662ef7deac0dfbb9f77e96bb458..0000000000000000000000000000000000000000 --- a/0019-fix-iscsi-ls-parameter-parse.patch +++ /dev/null @@ -1,121 +0,0 @@ -From 045c2387e77f2c20359e956e3327b006e5814cc6 Mon Sep 17 00:00:00 2001 -From: sallyjunjun <72725839+sallyjunjun@users.noreply.github.com> -Date: Wed, 8 Jun 2022 10:02:04 +0800 -Subject: [PATCH 3/4] fix iscsi-ls parameter parse -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -If invalid option is input with iscsi-ls, such as "iscsi-ls -a iscsi://", the command just stuck here and do not print useful information for the user to correct. -Fix this problem with getopt_long. ---- - utils/iscsi-ls.c | 64 ++++++++++++++++++++++++++++++++++++-------------------- - 1 file changed, 41 insertions(+), 23 deletions(-) - -diff --git a/utils/iscsi-ls.c b/utils/iscsi-ls.c -index 2b1d5e2..107121d 100644 ---- a/utils/iscsi-ls.c -+++ b/utils/iscsi-ls.c -@@ -37,6 +37,7 @@ WSADATA wsaData; - #include - #include - #include -+#include - #include "iscsi.h" - #include "scsi-lowlevel.h" - -@@ -329,7 +330,7 @@ void print_help(void) - fprintf(stderr, " -i, --initiator-name=iqn-name Initiatorname to use\n"); - fprintf(stderr, " -d, --debug Print debug information\n"); - fprintf(stderr, " -s, --show-luns Show the luns for each target\n"); -- fprintf(stderr, " --url Output targets in URL format\n"); -+ fprintf(stderr, " -U, --url Output targets in URL format\n"); - fprintf(stderr, " (does not work with -s)\n"); - fprintf(stderr, "\n"); - fprintf(stderr, "Help options:\n"); -@@ -350,7 +351,8 @@ int main(int argc, char *argv[]) - struct iscsi_url *iscsi_url = NULL; - struct client_state state; - const char *url = NULL; -- int i; -+ int c; -+ int option_index; - static int show_help = 0, show_usage = 0, debug = 0; - - #ifdef _WIN32 -@@ -360,31 +362,44 @@ int main(int argc, char *argv[]) - } - #endif - -- for (i = 1; i < argc; i++) { -- if (!strcmp(argv[i], "-?") || -- !strcmp(argv[i], "-h") || -- !strcmp(argv[i], "--help")) { -- show_help = 1; -- } else if (!strcmp(argv[i], "-u") || -- !strcmp(argv[i], "-usage")) { -+ static struct option long_options[] = { -+ {"help", no_argument, NULL, 'h'}, -+ {"usage", no_argument, NULL, 'u'}, -+ {"debug", no_argument, NULL, 'd'}, -+ {"initiator-name", required_argument, NULL, 'i'}, -+ {"show-luns", no_argument, NULL, 's'}, -+ {"url", no_argument, NULL, 'U'}, -+ {0, 0, 0, 0} -+ }; -+ -+ while ((c = getopt_long(argc, argv, "h?udi:sU", long_options, -+ &option_index)) != -1) { -+ switch (c) { -+ case 'h': -+ case '?': -+ show_help = 1; -+ break; -+ case 'u': - show_usage = 1; -- } else if (!strcmp(argv[i], "-d") || -- !strcmp(argv[i], "--debug")) { -+ break; -+ case 'd': - debug = 1; -- } else if (!strcmp(argv[i], "-i") || -- !strcmp(argv[i], "--initiator-name")) { -- initiator = argv[++i]; -- } else if (!strcmp(argv[i], "-s") || -- !strcmp(argv[i], "--show-luns")) { -+ break; -+ case 'i': -+ initiator = optarg; -+ break; -+ case 's': - showluns = 1; -- } else if (!strcmp(argv[i], "-U") || -- !strcmp(argv[i], "--url")) { -+ break; -+ case 'U': - useurls = 1; -- } else if (!strncmp("iscsi://", argv[i], 8) || -- !strncmp("iser://", argv[i], 7)) { -- url = strdup(argv[i]); -- } -- } -+ break; -+ default: -+ fprintf(stderr, "Unrecognized option '%c'\n\n", c); -+ print_help(); -+ exit(0); -+ } -+ } - - if (show_help != 0) { - print_help(); -@@ -398,6 +413,9 @@ int main(int argc, char *argv[]) - - memset(&state, 0, sizeof(state)); - -+ if (argv[optind] != NULL) { -+ url = strdup(argv[optind]); -+ } - if (url == NULL) { - fprintf(stderr, "You must specify iscsi target portal.\n"); - print_usage(); diff --git a/0020-Check-return-value-of-scsi_malloc-in-order-to.patch b/0020-Check-return-value-of-scsi_malloc-in-order-to.patch deleted file mode 100644 index 768e36b1a487868416fa1d35fb1d0d2bdf949690..0000000000000000000000000000000000000000 --- a/0020-Check-return-value-of-scsi_malloc-in-order-to.patch +++ /dev/null @@ -1,98 +0,0 @@ -From acd147cb884f170ddac027881a9b4bb12a36ee2e Mon Sep 17 00:00:00 2001 -From: geruijun -Date: Wed, 16 Mar 2022 01:36:22 +0800 -Subject: [PATCH 4/4] Check return value of scsi_malloc in order to avoid - dereferencing NULL return value. - -Signed-off-by: geruijun ---- - lib/scsi-lowlevel.c | 30 ++++++++++++++++++++++++++++++ - 1 file changed, 30 insertions(+) - -diff --git a/lib/scsi-lowlevel.c b/lib/scsi-lowlevel.c -index 4039cea..0161852 100644 ---- a/lib/scsi-lowlevel.c -+++ b/lib/scsi-lowlevel.c -@@ -2912,9 +2912,15 @@ scsi_modesense_marshall_caching(struct scsi_task *task, - struct scsi_data *data; - - data = scsi_malloc(task, sizeof(struct scsi_data)); -+ if (data == NULL) { -+ return NULL; -+ } - - data->size = 20 + hdr_size; - data->data = scsi_malloc(task, data->size); -+ if (data->data == NULL) { -+ return NULL; -+ } - - if (mp->caching.ic) data->data[hdr_size + 2] |= 0x80; - if (mp->caching.abpf) data->data[hdr_size + 2] |= 0x40; -@@ -2953,9 +2959,15 @@ scsi_modesense_marshall_control(struct scsi_task *task, - struct scsi_data *data; - - data = scsi_malloc(task, sizeof(struct scsi_data)); -+ if (data == NULL) { -+ return NULL; -+ } - - data->size = 12 + hdr_size; - data->data = scsi_malloc(task, data->size); -+ if (data->data == NULL) { -+ return NULL; -+ } - - data->data[hdr_size + 2] |= (mp->control.tst << 5) & 0xe0; - if (mp->control.tmf_only) data->data[hdr_size + 2] |= 0x10; -@@ -2993,9 +3005,15 @@ scsi_modesense_marshall_power_condition(struct scsi_task *task, - struct scsi_data *data; - - data = scsi_malloc(task, sizeof(struct scsi_data)); -+ if (data == NULL) { -+ return NULL; -+ } - - data->size = 40 + hdr_size; - data->data = scsi_malloc(task, data->size); -+ if (data->data == NULL) { -+ return NULL; -+ } - - data->data[hdr_size + 2] |= - (mp->power_condition.pm_bg_precedence << 6) & 0xc0; -@@ -3035,9 +3053,15 @@ scsi_modesense_marshall_disconnect_reconnect(struct scsi_task *task, - struct scsi_data *data; - - data = scsi_malloc(task, sizeof(struct scsi_data)); -+ if (data == NULL) { -+ return NULL; -+ } - - data->size = 16 + hdr_size; - data->data = scsi_malloc(task, data->size); -+ if (data->data == NULL) { -+ return NULL; -+ } - - data->data[hdr_size + 2] = mp->disconnect_reconnect.buffer_full_ratio; - data->data[hdr_size + 3] = mp->disconnect_reconnect.buffer_empty_ratio; -@@ -3064,9 +3088,15 @@ scsi_modesense_marshall_informational_exceptions_control(struct scsi_task *task, - struct scsi_data *data; - - data = scsi_malloc(task, sizeof(struct scsi_data)); -+ if (data == NULL) { -+ return NULL; -+ } - - data->size = 12 + hdr_size; - data->data = scsi_malloc(task, data->size); -+ if (data->data == NULL) { -+ return NULL; -+ } - - if (mp->iec.perf) data->data[hdr_size + 2] |= 0x80; - if (mp->iec.ebf) data->data[hdr_size + 2] |= 0x20; --- -1.8.3.1 - diff --git a/0021-Fix-segmentation-fault-problem.patch b/0021-Fix-segmentation-fault-problem.patch deleted file mode 100644 index 29390c18002514ba669faee5d8bbbb2c5c8ad957..0000000000000000000000000000000000000000 --- a/0021-Fix-segmentation-fault-problem.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 00310fdc2ff77fac84d871a76af67750eacb8594 Mon Sep 17 00:00:00 2001 -From: geruijun -Date: Wed, 15 Jun 2022 10:06:40 +0800 -Subject: [PATCH] Fix segmentation fault problem. - -When execute iscsi_task_mgmt_lun_reset_async function, -pdus are already removed from waitpdu list. In iscsi_service -function, this will call iscsi_process_pdu and release -pdu from waitpdu again, which cause segmentation fault. - -Whether waitpud list is NULL should be checked here to avoid -the problem. - -Signed-off-by: geruijun ---- - lib/pdu.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/lib/pdu.c b/lib/pdu.c -index 6fe70db..f9c0bc5 100644 ---- a/lib/pdu.c -+++ b/lib/pdu.c -@@ -622,7 +622,7 @@ iscsi_process_pdu(struct iscsi_context *iscsi, struct iscsi_in_pdu *in) - return -1; - } - -- if (is_finished) { -+ if (is_finished && iscsi->waitpdu != NULL) { - ISCSI_LIST_REMOVE(&iscsi->waitpdu, pdu); - iscsi->drv->free_pdu(iscsi, pdu); - } --- -1.8.3.1 - diff --git a/0022-init-fix-memory-leak-in-iscsi_create_context.patch b/0022-init-fix-memory-leak-in-iscsi_create_context.patch deleted file mode 100644 index 1f7a588752f8063c98f05a6bb14172aeb86758d7..0000000000000000000000000000000000000000 --- a/0022-init-fix-memory-leak-in-iscsi_create_context.patch +++ /dev/null @@ -1,31 +0,0 @@ -From a391176a6dece09454672c6522778d6513e90fb4 Mon Sep 17 00:00:00 2001 -From: zhenwei pi -Date: Tue, 25 Feb 2020 22:35:54 +0800 -Subject: [PATCH] init: fix memory leak in iscsi_create_context - -iscsi instance is allocated in iscsi_create_context, after we return -NULL, nobody could handle it anymore. - -Currently we can't hit this logic, anyway we still fix this. - -Signed-off-by: zhenwei pi ---- - lib/init.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/lib/init.c b/lib/init.c -index 13098f0..f3e2e13 100644 ---- a/lib/init.c -+++ b/lib/init.c -@@ -218,7 +218,7 @@ iscsi_create_context(const char *initiator_name) - - /* initalize transport of context */ - if (iscsi_init_transport(iscsi, TCP_TRANSPORT)) { -- iscsi_set_error(iscsi, "Failed allocating transport"); -+ free(iscsi); - return NULL; - } - --- -2.35.3 - diff --git a/0023-iscsi-command-Fix-leak-in-iscsi_send_data_out.patch b/0023-iscsi-command-Fix-leak-in-iscsi_send_data_out.patch deleted file mode 100644 index 5f52145431d386bfc242cccc90cf33e329a07af9..0000000000000000000000000000000000000000 --- a/0023-iscsi-command-Fix-leak-in-iscsi_send_data_out.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 2674070fb80ad7527589a1fbd576ee074d26ed72 Mon Sep 17 00:00:00 2001 -From: Raphael Norwitz -Date: Tue, 1 Mar 2022 18:03:48 -0500 -Subject: [PATCH] iscsi-command: Fix leak in iscsi_send_data_out - -In iscsi_send_data_out() a PDU is allocated, but there is no error -handling logic to free it if the PDU cannot be queued. -iscsi_allocate_pdu() may allocate memory for the PDU. This memory may be -leaked if iscsi_queue_pdu() fails since there is no call to free it. - -Orignally there was a free() call but it was removed as a part of a -cleanup adding checks for NULL pdu callbacks. - -Fixes: 423b82efa4bd ("pdu: check callback for NULL everywhere") -Signed-off-by: Raphael Norwitz ---- - lib/iscsi-command.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/lib/iscsi-command.c b/lib/iscsi-command.c -index a4df637..9a240ab 100644 ---- a/lib/iscsi-command.c -+++ b/lib/iscsi-command.c -@@ -131,6 +131,7 @@ iscsi_send_data_out(struct iscsi_context *iscsi, struct iscsi_pdu *cmd_pdu, - if (iscsi_queue_pdu(iscsi, pdu) != 0) { - iscsi_set_error(iscsi, "Out-of-memory: failed to queue iscsi " - "scsi pdu."); -+ iscsi->drv->free_pdu(iscsi, pdu); - goto error; - } - --- -2.35.3 - diff --git a/0024-fix-segmentation-fault.patch b/0024-fix-segmentation-fault.patch deleted file mode 100644 index d23fe4c33bdfd9f543bbd266b140db52113fcde5..0000000000000000000000000000000000000000 --- a/0024-fix-segmentation-fault.patch +++ /dev/null @@ -1,27 +0,0 @@ -From abedc1848cf6305f2c1f20078710755c66415d2d Mon Sep 17 00:00:00 2001 -From: folkert van heusden -Date: Tue, 30 Jan 2024 15:33:20 +0100 -Subject: [PATCH] Fix for https://github.com/sahlberg/libiscsi/issues/409 - 'ms->pages' was not checked for being NULL. This can happen when a target - does not return any pages. - ---- - test-tool/iscsi-support.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/test-tool/iscsi-support.c b/test-tool/iscsi-support.c -index 169d2b0..ea9f711 100644 ---- a/test-tool/iscsi-support.c -+++ b/test-tool/iscsi-support.c -@@ -2740,7 +2740,7 @@ int set_swp(struct scsi_device *sdev) - logging(LOG_VERBOSE, "[SUCCESS] CONTROL page fetched."); - - ms = scsi_datain_unmarshall(sense_task); -- if (ms == NULL) { -+ if (ms == NULL || ms->pages == NULL) { - logging(LOG_NORMAL, "failed to unmarshall mode sense datain " - "blob"); - ret = -1; --- -2.27.0 - diff --git a/1.19.0.tar.gz b/1.19.0.tar.gz deleted file mode 100644 index d5f6238476068dd12044a94145e1979a1a2122ed..0000000000000000000000000000000000000000 Binary files a/1.19.0.tar.gz and /dev/null differ diff --git a/1.20.0.tar.gz b/1.20.0.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..fe827d09f9b22561fcc27490c984f494d9345eb5 Binary files /dev/null and b/1.20.0.tar.gz differ diff --git a/libiscsi.spec b/libiscsi.spec index 4bb568cce5da8ee0cb2a9417385fd6770138dd9b..4df7473bbe0aefd41b9cfa730f40de0ace81e1b1 100644 --- a/libiscsi.spec +++ b/libiscsi.spec @@ -1,36 +1,11 @@ Name: libiscsi -Version: 1.19.0 -Release: 11 +Version: 1.20.0 +Release: 1 Summary: Client-side library to implement the iSCSI protocol Recommends: %{name}-utils License: LGPLv2+ and GPLv2+ URL: https://github.com/sahlberg/%{name} -Patch1: 0001-iscsi-ls-Fix-iser-url-scheme-parsing.patch -Patch2: 0002-test-tool-Compare-Write-skip-InvalidDataOutSize-unle.patch -Patch3: 0003-test-tool-Compare-Write-override-driver-queue_pdu-ca.patch -Patch4: 0004-test-tool-iSCSICmdSnTooLow-override-driver-queue_pdu.patch -Patch5: 0005-test-tool-iSCSICmdSnTooHigh-override-driver-queue_pd.patch -Patch6: 0006-test-tool-iSCSIDataSnInvalid-override-driver-queue_p.patch -Patch7: 0007-test-tool-BlockEraseReserved-skip-unless-iSCSI.patch -Patch8: 0008-test-tool-BlockEraseReserved-override-driver-queue_p.patch -Patch9: 0009-test-tool-CryptoEraseReserved-skip-unless-iSCSI.patch -Patch10: 0010-test-tool-CryptoEraseReserved-override-driver-queue_.patch -Patch11: 0011-test-tool-OverwriteReserved-skip-unless-iSCSI.patch -Patch12: 0012-test-tool-OverwriteReserved-override-driver-queue_pd.patch -Patch13: 0013-test-tool-remove-unused-iscsi_queue_pdu-symbol-overl.patch -Patch14: 0014-iser-remove-__packed-from-struct-iser_cm_hdr-declaration.patch -Patch15: 0015-test-tools-use-extern-init-in-headers.patch -Patch16: 0016-iscsi-inq-handle-setting-of-debug_level-correctly.patch -Patch17: 0017-Updata-iscsi-dd.c.patch -Patch18: 0018-iscsi-swp-handle-setting-of-debug_level-correctly.patch -Patch19: 0019-fix-iscsi-ls-parameter-parse.patch -Patch20: 0020-Check-return-value-of-scsi_malloc-in-order-to.patch -Patch21: 0021-Fix-segmentation-fault-problem.patch -Patch22: 0022-init-fix-memory-leak-in-iscsi_create_context.patch -Patch23: 0023-iscsi-command-Fix-leak-in-iscsi_send_data_out.patch -Patch24: 0024-fix-segmentation-fault.patch - Source: https://github.com/sahlberg/%{name}/archive/%{version}.tar.gz BuildRequires: gcc @@ -40,7 +15,6 @@ BuildRequires: autoconf automake libtool popt-devel CUnit-devel libgcrypt-devel Libiscsi is a client-side library to implement the iSCSI protocol that can be used to access the resources of an iSCSI target. - ####################################################################### # Conflict with iscsi-initiator-utils. @@ -63,20 +37,6 @@ echo %{_libdir}/iscsi > $RPM_BUILD_ROOT/etc/ld.so.conf.d/%{name}-%{_arch}.conf rm $RPM_BUILD_ROOT/%{_libdir}/iscsi/libiscsi.a rm $RPM_BUILD_ROOT/%{_libdir}/iscsi/libiscsi.la -# Remove rpath -chrpath --delete $RPM_BUILD_ROOT%{_bindir}/iscsi-perf -chrpath --delete $RPM_BUILD_ROOT%{_bindir}/iscsi-test-cu -chrpath --delete $RPM_BUILD_ROOT%{_bindir}/iscsi-swp -chrpath --delete $RPM_BUILD_ROOT%{_bindir}/iscsi-ls -chrpath --delete $RPM_BUILD_ROOT%{_bindir}/iscsi-inq -chrpath --delete $RPM_BUILD_ROOT%{_bindir}/iscsi-readcapacity16 - -# Remove "*.old" files -find $RPM_BUILD_ROOT -name "*.old" -exec rm -f {} \; - -# Remove library put in /usr/bin -rm $RPM_BUILD_ROOT/%{_bindir}/ld_iscsi.so - %post -p /sbin/ldconfig %postun -p /sbin/ldconfig @@ -104,7 +64,7 @@ This package contains utilities of %{name} to connect to iSCSI targets %files %license COPYING LICENCE-GPL-2.txt LICENCE-LGPL-2.1.txt -%doc README TODO +%doc README.md TODO %dir %{_libdir}/iscsi %{_libdir}/iscsi/libiscsi.so.* %config /etc/ld.so.conf.d/* @@ -121,6 +81,7 @@ This package contains utilities of %{name} to connect to iSCSI targets %{_mandir}/man1/iscsi-inq.1.gz %{_mandir}/man1/iscsi-swp.1.gz %{_mandir}/man1/iscsi-test-cu.1.gz +%{_mandir}/man1/iscsi-md5sum.1.gz %files utils %{_bindir}/iscsi-ls @@ -129,8 +90,14 @@ This package contains utilities of %{name} to connect to iSCSI targets %{_bindir}/iscsi-swp %{_bindir}/iscsi-perf %{_bindir}/iscsi-test-cu +%{_bindir}/iscsi-pr +%{_bindir}/iscsi-discard +%{_bindir}/iscsi-md5sum %changelog +* Sun Sep 29 2024 wangmian - 1.20.0-1 +- DESC: update version to 1.20.0 + * Thu Aug 8 2024 yanshuai - 1.19.0-11 - DESC: fix segmentation fault