From 877c8eca09543a37dd9cd05093a88a8470490219 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Nov 03 2016 06:01:54 +0000 Subject: import libiscsi-1.9.0-7.el7 --- diff --git a/SOURCES/libiscsi-Discovery-return-multiple-portals-for-the-same-disco.patch b/SOURCES/libiscsi-Discovery-return-multiple-portals-for-the-same-disco.patch new file mode 100644 index 0000000..5e9e40b --- /dev/null +++ b/SOURCES/libiscsi-Discovery-return-multiple-portals-for-the-same-disco.patch @@ -0,0 +1,81 @@ +From 3f8029f837ef6680e280eb700d5930c1b38dbc27 Mon Sep 17 00:00:00 2001 +From: Paolo Bonzini +Date: Thu, 7 Apr 2016 13:33:14 +0200 +Subject: [PATCH 1/2] Discovery: return multiple portals for the same + discovered target + +RH-Author: Paolo Bonzini +Message-id: <1460035995-9887-2-git-send-email-pbonzini@redhat.com> +Patchwork-id: 69977 +O-Subject: [RHEL7.3 libiscsi PATCH 1/2] Discovery: return multiple portals for the same discovered target +Bugzilla: 1266523 +RH-Acked-by: Miroslav Rezanina +RH-Acked-by: Thomas Huth +RH-Acked-by: Laszlo Ersek + +Some targets return multiple TargetAddress for individual targets. +Upstream added a list of addresses for each target, here we do not +want to break the ABI and thus return the same target name multiple +times. Either way, failing the discovery is wrong. + +The patch is very different from upstream commit +354f00fd4f63abec86ed0b9b64db1933936283b0, but the effect on +the operation of iscsi-ls is the same. + +Signed-off-by: Paolo Bonzini +Signed-off-by: Miroslav Rezanina +--- + lib/discovery.c | 30 +++++++++++++++++++++++++++++- + 1 file changed, 29 insertions(+), 1 deletion(-) + +diff --git a/lib/discovery.c b/lib/discovery.c +index b5d918b..e504cf8 100644 +--- a/lib/discovery.c ++++ b/lib/discovery.c +@@ -162,7 +162,7 @@ iscsi_process_text_reply(struct iscsi_context *iscsi, struct iscsi_pdu *pdu, + target->next = targets; + targets = target; + } else if (!strncmp((char *)ptr, "TargetAddress=", 14)) { +- if (targets == NULL || targets->target_address != NULL) { ++ if (targets == NULL) { + iscsi_set_error(iscsi, "Invalid discovery " + "reply"); + pdu->callback(iscsi, SCSI_STATUS_ERROR, NULL, +@@ -170,6 +170,34 @@ iscsi_process_text_reply(struct iscsi_context *iscsi, struct iscsi_pdu *pdu, + iscsi_free_discovery_addresses(iscsi, targets); + return -1; + } ++ if (targets->target_address != NULL) { ++ struct iscsi_discovery_address *target; ++ ++ target = iscsi_zmalloc(iscsi, sizeof(struct iscsi_discovery_address)); ++ if (target == NULL) { ++ iscsi_set_error(iscsi, "Failed to allocate " ++ "data for new discovered " ++ "target"); ++ pdu->callback(iscsi, SCSI_STATUS_ERROR, NULL, ++ pdu->private_data); ++ iscsi_free_discovery_addresses(iscsi, targets); ++ return -1; ++ } ++ target->target_name = iscsi_strdup(iscsi, targets->target_name); ++ if (target->target_name == NULL) { ++ iscsi_set_error(iscsi, "Failed to allocate " ++ "data for new discovered " ++ "target name"); ++ pdu->callback(iscsi, SCSI_STATUS_ERROR, NULL, ++ pdu->private_data); ++ iscsi_free(iscsi, target); ++ target = NULL; ++ iscsi_free_discovery_addresses(iscsi, targets); ++ return -1; ++ } ++ target->next = targets; ++ targets = target; ++ } + targets->target_address = iscsi_strdup(iscsi, (char *)ptr+14); + if (targets->target_address == NULL) { + iscsi_set_error(iscsi, "Failed to allocate " +-- +1.8.3.1 + diff --git a/SOURCES/libiscsi-iscsi-ls-skip-link-local-IPv6-addresses.patch b/SOURCES/libiscsi-iscsi-ls-skip-link-local-IPv6-addresses.patch new file mode 100644 index 0000000..5a9db6d --- /dev/null +++ b/SOURCES/libiscsi-iscsi-ls-skip-link-local-IPv6-addresses.patch @@ -0,0 +1,45 @@ +From ef6a90973cae8b047bdcbc3fcf14206efc98955a Mon Sep 17 00:00:00 2001 +From: Paolo Bonzini +Date: Thu, 7 Apr 2016 13:33:15 +0200 +Subject: [PATCH 2/2] iscsi-ls: skip link-local IPv6 addresses + +RH-Author: Paolo Bonzini +Message-id: <1460035995-9887-3-git-send-email-pbonzini@redhat.com> +Patchwork-id: 69978 +O-Subject: [RHEL7.3 libiscsi PATCH 2/2] iscsi-ls: skip link-local IPv6 addresses +Bugzilla: 1266523 +RH-Acked-by: Miroslav Rezanina +RH-Acked-by: Thomas Huth +RH-Acked-by: Laszlo Ersek + +Some iSCSI targets provide a link-local IPv6 address as a portal, but that +is unusable without knowing the interface (aka scope-id) to use for the +connection. This causes iscsi-ls to report an EINVAL and exit. Just +skip the error. + +Signed-off-by: Paolo Bonzini +(cherry picked from commit d84ee65eaad902bb41fa6bae1f8127e03cb63506) +Signed-off-by: Miroslav Rezanina +--- + src/iscsi-ls.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/src/iscsi-ls.c b/src/iscsi-ls.c +index 10b0e8d..d11806c 100644 +--- a/src/iscsi-ls.c ++++ b/src/iscsi-ls.c +@@ -156,6 +156,11 @@ void list_luns(struct client_state *clnt, const char *target, const char *portal + int full_report_size; + int i; + ++ if (strncasecmp(portal, "[fe80:", 6) == 0) { ++ fprintf(stderr, "skipping link-local address\n"); ++ return; ++ } ++ + iscsi = iscsi_create_context(initiator); + if (iscsi == NULL) { + printf("Failed to create context\n"); +-- +1.8.3.1 + diff --git a/SPECS/libiscsi.spec b/SPECS/libiscsi.spec index da77cb2..32d08dd 100644 --- a/SPECS/libiscsi.spec +++ b/SPECS/libiscsi.spec @@ -1,7 +1,7 @@ Name: libiscsi Summary: iSCSI client library Version: 1.9.0 -Release: 6%{?dist} +Release: 7%{?dist} License: LGPLv2+ Group: System Environment/Libraries URL: https://github.com/sahlberg/%{name} @@ -37,6 +37,10 @@ Patch28: 0028-handle-bad-iscsi--fd-in-iscsi_service.patch Patch29: 0029-rework-login-and-discovery-code-to-avoid-strlen-beyond-end-of-data.patch Patch30: 0030-check-for-a-target-being-there-before-processing-TargetAddress.patch Patch31: 0031-fix-CHAP-authentication.patch +# For bz#1266523 - iscsi-ls doesn't work if target has more than one portal +Patch32: libiscsi-Discovery-return-multiple-portals-for-the-same-disco.patch +# For bz#1266523 - iscsi-ls doesn't work if target has more than one portal +Patch33: libiscsi-iscsi-ls-skip-link-local-IPv6-addresses.patch BuildRequires: autoconf BuildRequires: automake @@ -88,6 +92,8 @@ a network. %patch29 -p1 %patch30 -p1 %patch31 -p1 +%patch32 -p1 +%patch33 -p1 %build sh autogen.sh @@ -147,6 +153,12 @@ The libiscsi-devel package includes the header files for libiscsi. %{_libdir}/pkgconfig/libiscsi.pc %changelog +* Thu May 26 2016 Miroslav Rezanina - 1.9.0-7.el7 +- libiscsi-Discovery-return-multiple-portals-for-the-same-disco.patch [bz#1266523] +- libiscsi-iscsi-ls-skip-link-local-IPv6-addresses.patch [bz#1266523] +- Resolves: bz#1266523 + (iscsi-ls doesn't work if target has more than one portal) + * Fri Jan 24 2014 Daniel Mach - 1.9.0-6 - Mass rebuild 2014-01-24