From 47585c5f7029334f9490656e5229c36eaf5098a3 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Aug 06 2019 11:12:27 +0000 Subject: import iscsi-initiator-utils-6.2.0.874-11.el7 --- diff --git a/SOURCES/open-iscsi-2.0.874-35-iscsiuio-fix-long-options.patch b/SOURCES/open-iscsi-2.0.874-35-iscsiuio-fix-long-options.patch new file mode 100644 index 0000000..f6261b0 --- /dev/null +++ b/SOURCES/open-iscsi-2.0.874-35-iscsiuio-fix-long-options.patch @@ -0,0 +1,82 @@ +From 06851794fe0475410f516e874ee0c67db4a6784a Mon Sep 17 00:00:00 2001 +From: Andrew Patterson +Date: Wed, 31 May 2017 10:30:21 -0600 +Subject: [PATCH] iscsiuio: fix long options + +Fix broken long command-line options in iscsiuio. +--- + iscsiuio/docs/iscsiuio.8 | 10 +++++----- + iscsiuio/src/unix/main.c | 12 +++++++----- + 2 files changed, 12 insertions(+), 10 deletions(-) + +diff --git a/iscsiuio/docs/iscsiuio.8 b/iscsiuio/docs/iscsiuio.8 +index 8b0577a53842..eda20c76637f 100644 +--- a/iscsiuio/docs/iscsiuio.8 ++++ b/iscsiuio/docs/iscsiuio.8 +@@ -45,7 +45,7 @@ on how to configure network protocol and address. + .SH PARAMETERS + There are very few parameters when running this application. + .TP +-.BI -d ++.BI -d|--debug + This is to enable debug mode where debug messages will be sent to stdout + The following debug modes are supported + .P +@@ -61,20 +61,20 @@ ERROR 1 - Only print critical errors + .PP + .TP + .TP +-.BI -f ++.BI -f|--foreground + This is to enable foreground mode so that this application doesn't get sent + into the background. + .PP + .TP +-.BI -v ++.BI -v|--version + This is to print the version. + .PP + .TP +-.BI -p ++.BI -p|--pid + Use pidfile (default /var/run/iscsiuio.pid ) + .PP + .TP +-.BI -h ++.BI -h|--help + Display this help and exit. + + +diff --git a/iscsiuio/src/unix/main.c b/iscsiuio/src/unix/main.c +index c1a72d800741..5cccc76ed220 100644 +--- a/iscsiuio/src/unix/main.c ++++ b/iscsiuio/src/unix/main.c +@@ -82,10 +82,12 @@ static const char default_pid_filepath[] = "/var/run/iscsiuio.pid"; + * Global Variables + ******************************************************************************/ + static const struct option long_options[] = { +- {"debug", 0, 0, 0}, +- {"version", 0, 0, 0}, +- {"help", 0, 0, 0}, +- {0, 0, 0, 0} ++ {"foreground", no_argument, NULL, 'f'}, ++ {"debug", required_argument, NULL, 'd'}, ++ {"pid", required_argument, NULL, 'p'}, ++ {"version", no_argument, NULL, 'v'}, ++ {"help", no_argument, NULL, 'h'}, ++ {NULL, no_argument, NULL, 0} + }; + + struct options opt = { +@@ -172,7 +174,7 @@ static void main_usage() + printf("iscsiuio daemon.\n" + "-f, --foreground make the program run in the foreground\n" + "-d, --debug debuglevel print debugging information\n" +- "-p, --pid=pidfile use pid file (default %s).\n" ++ "-p, --pid pidfile use pid file (default %s).\n" + "-h, --help display this help and exit\n" + "-v, --version display version and exit\n", + default_pid_filepath); +-- +2.17.2 + diff --git a/SOURCES/open-iscsi-2.0.874-38-Update-bnx2.c.patch b/SOURCES/open-iscsi-2.0.874-38-Update-bnx2.c.patch new file mode 100644 index 0000000..e1f33c7 --- /dev/null +++ b/SOURCES/open-iscsi-2.0.874-38-Update-bnx2.c.patch @@ -0,0 +1,38 @@ +From 5cecffad475735d672305fcf0163fd79d3b93ff9 Mon Sep 17 00:00:00 2001 +From: Edward Kigwana +Date: Fri, 11 Aug 2017 21:50:40 +0000 +Subject: [PATCH] Update bnx2.c +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Release notes for glibc-2.25 state: + +The inclusion of by is deprecated. +This means that in a future release, the macros “major”, “minor”, and +“makedev” will only be available from . + +These macros are not part of POSIX nor XSI, and their names frequently +collide with user code; see for instance glibc bug 19239 and Red Hat +bug 130601. includes under _GNU_SOURCE, and +C++ code presently cannot avoid being compiled under _GNU_SOURCE, +exacerbating the problem. +--- + iscsiuio/src/unix/libs/bnx2.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/iscsiuio/src/unix/libs/bnx2.c b/iscsiuio/src/unix/libs/bnx2.c +index 457bdba283e8..c68131c0ca24 100644 +--- a/iscsiuio/src/unix/libs/bnx2.c ++++ b/iscsiuio/src/unix/libs/bnx2.c +@@ -41,6 +41,7 @@ + #include + #include + #include ++#include + #include + #include + #include +-- +2.17.2 + diff --git a/SOURCES/open-iscsi-2.0.874-39-Update-bnx2x.c.patch b/SOURCES/open-iscsi-2.0.874-39-Update-bnx2x.c.patch new file mode 100644 index 0000000..96d3630 --- /dev/null +++ b/SOURCES/open-iscsi-2.0.874-39-Update-bnx2x.c.patch @@ -0,0 +1,38 @@ +From fea8d2e506a40f80f9062aa9c98f403518782f27 Mon Sep 17 00:00:00 2001 +From: Edward Kigwana +Date: Fri, 11 Aug 2017 21:51:52 +0000 +Subject: [PATCH] Update bnx2x.c +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Release notes for glibc-2.25 state: + +The inclusion of by is deprecated. +This means that in a future release, the macros “major”, “minor”, and +“makedev” will only be available from . + +These macros are not part of POSIX nor XSI, and their names frequently +collide with user code; see for instance glibc bug 19239 and Red Hat +bug 130601. includes under _GNU_SOURCE, and +C++ code presently cannot avoid being compiled under _GNU_SOURCE, +exacerbating the problem. +--- + iscsiuio/src/unix/libs/bnx2x.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/iscsiuio/src/unix/libs/bnx2x.c b/iscsiuio/src/unix/libs/bnx2x.c +index 1e8f532edcdf..3df6d5fdbfa2 100644 +--- a/iscsiuio/src/unix/libs/bnx2x.c ++++ b/iscsiuio/src/unix/libs/bnx2x.c +@@ -45,6 +45,7 @@ + #include + #include + #include ++#include + #include + #include + #include +-- +2.17.2 + diff --git a/SOURCES/open-iscsi-2.0.875-10-Include-sys-sysmacros.h-to-properly-define-minor.patch b/SOURCES/open-iscsi-2.0.875-10-Include-sys-sysmacros.h-to-properly-define-minor.patch new file mode 100644 index 0000000..bc4ef65 --- /dev/null +++ b/SOURCES/open-iscsi-2.0.875-10-Include-sys-sysmacros.h-to-properly-define-minor.patch @@ -0,0 +1,24 @@ +From 6d68ef5871c94c6ebbbe6e6b1fe0bc2dce711052 Mon Sep 17 00:00:00 2001 +From: Lee Duncan +Date: Sat, 2 Dec 2017 14:19:26 -0800 +Subject: [PATCH] Include to properly define minor() + +--- + iscsiuio/src/unix/libs/qedi.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/iscsiuio/src/unix/libs/qedi.c b/iscsiuio/src/unix/libs/qedi.c +index c6ff6e7724a3..b81fecdfe78f 100644 +--- a/iscsiuio/src/unix/libs/qedi.c ++++ b/iscsiuio/src/unix/libs/qedi.c +@@ -58,6 +58,7 @@ + #include + #include + #include ++#include + + #include "config.h" + +-- +2.17.2 + diff --git a/SOURCES/open-iscsi-2.0.875-11-Declare-inline-best_match_bufcmp-as-static.patch b/SOURCES/open-iscsi-2.0.875-11-Declare-inline-best_match_bufcmp-as-static.patch new file mode 100644 index 0000000..d123637 --- /dev/null +++ b/SOURCES/open-iscsi-2.0.875-11-Declare-inline-best_match_bufcmp-as-static.patch @@ -0,0 +1,27 @@ +From ec9865c5b2a05908dff774eda352d84d6a001e1a Mon Sep 17 00:00:00 2001 +From: Lee Duncan +Date: Sat, 2 Dec 2017 14:24:52 -0800 +Subject: [PATCH] Declare inline best_match_bufcmp() as static. + +The 7.2.1 version of gcc seems to be more strict +about this. See https://gcc.gnu.org/onlinedocs/gcc/Inline.html +--- + iscsiuio/src/uip/ipv6.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/iscsiuio/src/uip/ipv6.c b/iscsiuio/src/uip/ipv6.c +index ced98a678899..05efa73fcfdd 100644 +--- a/iscsiuio/src/uip/ipv6.c ++++ b/iscsiuio/src/uip/ipv6.c +@@ -49,7 +49,7 @@ + #include "dhcpv6.h" + #include "ping.h" + +-inline int best_match_bufcmp(u8_t *a, u8_t *b, int len) ++static inline int best_match_bufcmp(u8_t *a, u8_t *b, int len) + { + int i; + +-- +2.17.2 + diff --git a/SOURCES/open-iscsi-2.0.875-14-Check-for-root-peer-user-for-iscsiuio-IPC.patch b/SOURCES/open-iscsi-2.0.875-14-Check-for-root-peer-user-for-iscsiuio-IPC.patch new file mode 100644 index 0000000..951e157 --- /dev/null +++ b/SOURCES/open-iscsi-2.0.875-14-Check-for-root-peer-user-for-iscsiuio-IPC.patch @@ -0,0 +1,129 @@ +From e313bd648a4c8a9526421e270eb597a5de1e0c7f Mon Sep 17 00:00:00 2001 +From: Lee Duncan +Date: Fri, 15 Dec 2017 10:36:11 -0800 +Subject: [PATCH] Check for root peer user for iscsiuio IPC + +This fixes a possible vulnerability where a non-root +process could connect with iscsiuio. Fouund by Qualsys. +--- + iscsiuio/src/unix/Makefile.am | 3 ++- + iscsiuio/src/unix/iscsid_ipc.c | 47 ++++++++++++++++++++++++++++++++++ + 2 files changed, 49 insertions(+), 1 deletion(-) + +diff --git a/iscsiuio/src/unix/Makefile.am b/iscsiuio/src/unix/Makefile.am +index 71d54633a764..a989ef029b59 100644 +--- a/iscsiuio/src/unix/Makefile.am ++++ b/iscsiuio/src/unix/Makefile.am +@@ -20,7 +20,8 @@ iscsiuio_SOURCES = build_date.c \ + nic_utils.c \ + packet.c \ + iscsid_ipc.c \ +- ping.c ++ ping.c \ ++ ${top_srcdir}/../utils/sysdeps/sysdeps.c + + iscsiuio_CFLAGS = $(AM_CFLAGS) \ + $(LIBNL_CFLAGS) \ +diff --git a/iscsiuio/src/unix/iscsid_ipc.c b/iscsiuio/src/unix/iscsid_ipc.c +index 658362899234..64762654c523 100644 +--- a/iscsiuio/src/unix/iscsid_ipc.c ++++ b/iscsiuio/src/unix/iscsid_ipc.c +@@ -37,6 +37,8 @@ + * + */ + ++#define _GNU_SOURCE ++ + #include + #include + #include +@@ -47,6 +49,8 @@ + #include + #include + #include ++#include ++#include + + #define PFX "iscsi_ipc " + +@@ -61,6 +65,7 @@ + #include "iscsid_ipc.h" + #include "uip.h" + #include "uip_mgmt_ipc.h" ++#include "sysdeps.h" + + #include "logger.h" + #include "uip.h" +@@ -102,6 +107,7 @@ struct iface_rec_decode { + uint16_t mtu; + }; + ++#define PEERUSER_MAX 64 + + /****************************************************************************** + * Globals +@@ -1024,6 +1030,40 @@ static void iscsid_loop_close(void *arg) + LOG_INFO(PFX "iSCSI daemon socket closed"); + } + ++/* ++ * check that the peer user is privilidged ++ * ++ * return 1 if peer is ok else 0 ++ * ++ * XXX: this function is copied from iscsid_ipc.c and should be ++ * moved into a common library ++ */ ++static int ++mgmt_peeruser(int sock, char *user) ++{ ++ struct ucred peercred; ++ socklen_t so_len = sizeof(peercred); ++ struct passwd *pass; ++ ++ errno = 0; ++ if (getsockopt(sock, SOL_SOCKET, SO_PEERCRED, &peercred, ++ &so_len) != 0 || so_len != sizeof(peercred)) { ++ /* We didn't get a valid credentials struct. */ ++ LOG_ERR(PFX "peeruser_unux: error receiving credentials: %m"); ++ return 0; ++ } ++ ++ pass = getpwuid(peercred.uid); ++ if (pass == NULL) { ++ LOG_ERR(PFX "peeruser_unix: unknown local user with uid %d", ++ (int) peercred.uid); ++ return 0; ++ } ++ ++ strlcpy(user, pass->pw_name, PEERUSER_MAX); ++ return 1; ++} ++ + /** + * iscsid_loop() - This is the function which will process the broadcast + * messages from iscsid +@@ -1033,6 +1073,7 @@ static void *iscsid_loop(void *arg) + { + int rc; + sigset_t set; ++ char user[PEERUSER_MAX]; + + pthread_cleanup_push(iscsid_loop_close, arg); + +@@ -1072,6 +1113,12 @@ static void *iscsid_loop(void *arg) + continue; + } + ++ if (!mgmt_peeruser(iscsid_opts.fd, user) || strncmp(user, "root", PEERUSER_MAX)) { ++ close(s2); ++ LOG_ERR(PFX "Access error: non-administrative connection rejected"); ++ break; ++ } ++ + process_iscsid_broadcast(s2); + close(s2); + } +-- +2.17.2 + diff --git a/SOURCES/open-iscsi-2.0.875-15-iscsiuio-should-ignore-bogus-iscsid-broadcast-packets.patch b/SOURCES/open-iscsi-2.0.875-15-iscsiuio-should-ignore-bogus-iscsid-broadcast-packets.patch new file mode 100644 index 0000000..c958506 --- /dev/null +++ b/SOURCES/open-iscsi-2.0.875-15-iscsiuio-should-ignore-bogus-iscsid-broadcast-packets.patch @@ -0,0 +1,33 @@ +From b9c33683bdc0aed28ffe31c3f3d50bf5cdf519ea Mon Sep 17 00:00:00 2001 +From: Lee Duncan +Date: Fri, 15 Dec 2017 10:37:56 -0800 +Subject: [PATCH] iscsiuio should ignore bogus iscsid broadcast packets + +When iscsiuio is receiving broadcast packets from iscsid, +if the 'payload_len', carried in the packet, is too +large then ignore the packet and print a message. +Found by Qualsys. +--- + iscsiuio/src/unix/iscsid_ipc.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/iscsiuio/src/unix/iscsid_ipc.c b/iscsiuio/src/unix/iscsid_ipc.c +index 64762654c523..b5d7051b0558 100644 +--- a/iscsiuio/src/unix/iscsid_ipc.c ++++ b/iscsiuio/src/unix/iscsid_ipc.c +@@ -945,6 +945,12 @@ int process_iscsid_broadcast(int s2) + + cmd = data->header.command; + payload_len = data->header.payload_len; ++ if (payload_len > sizeof(data->u)) { ++ LOG_ERR(PFX "Data payload length too large (%d). Corrupt payload?", ++ payload_len); ++ rc = -EINVAL; ++ goto error; ++ } + + LOG_DEBUG(PFX "recv iscsid request: cmd: %d, payload_len: %d", + cmd, payload_len); +-- +2.17.2 + diff --git a/SOURCES/open-iscsi-2.0.875-16-Ensure-all-fields-in-iscsiuio-IPC-response-are-set.patch b/SOURCES/open-iscsi-2.0.875-16-Ensure-all-fields-in-iscsiuio-IPC-response-are-set.patch new file mode 100644 index 0000000..971e2bb --- /dev/null +++ b/SOURCES/open-iscsi-2.0.875-16-Ensure-all-fields-in-iscsiuio-IPC-response-are-set.patch @@ -0,0 +1,28 @@ +From be58eed849f5457bb49b79e94aa6a26971ba6deb Mon Sep 17 00:00:00 2001 +From: Lee Duncan +Date: Fri, 15 Dec 2017 11:11:17 -0800 +Subject: [PATCH] Ensure all fields in iscsiuio IPC response are set + +Make sure all fields in the response strcuture are set, +or info from the stack can be leaked to our caller. +Found by Qualsys. +--- + iscsiuio/src/unix/iscsid_ipc.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/iscsiuio/src/unix/iscsid_ipc.c b/iscsiuio/src/unix/iscsid_ipc.c +index b5d7051b0558..c3b10e03774a 100644 +--- a/iscsiuio/src/unix/iscsid_ipc.c ++++ b/iscsiuio/src/unix/iscsid_ipc.c +@@ -955,6 +955,8 @@ int process_iscsid_broadcast(int s2) + LOG_DEBUG(PFX "recv iscsid request: cmd: %d, payload_len: %d", + cmd, payload_len); + ++ memset(&rsp, 0, sizeof(rsp)); ++ + switch (cmd) { + case ISCSID_UIP_IPC_GET_IFACE: + size = fread(&data->u.iface_rec, payload_len, 1, fd); +-- +2.17.2 + diff --git a/SOURCES/open-iscsi-2.0.875-17-Do-not-double-close-IPC-file-stream-to-iscsid.patch b/SOURCES/open-iscsi-2.0.875-17-Do-not-double-close-IPC-file-stream-to-iscsid.patch new file mode 100644 index 0000000..43dbfb0 --- /dev/null +++ b/SOURCES/open-iscsi-2.0.875-17-Do-not-double-close-IPC-file-stream-to-iscsid.patch @@ -0,0 +1,56 @@ +From 5504053cc08df38d8d85032fa1691e363dfcfb92 Mon Sep 17 00:00:00 2001 +From: Lee Duncan +Date: Fri, 15 Dec 2017 11:13:29 -0800 +Subject: [PATCH] Do not double-close IPC file stream to iscsid + +A double-close of a file descriptor and its associated FILE stream +can be an issue in multi-threaded cases. Found by Qualsys. +--- + iscsiuio/src/unix/iscsid_ipc.c | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +diff --git a/iscsiuio/src/unix/iscsid_ipc.c b/iscsiuio/src/unix/iscsid_ipc.c +index c3b10e03774a..4a6687b32a17 100644 +--- a/iscsiuio/src/unix/iscsid_ipc.c ++++ b/iscsiuio/src/unix/iscsid_ipc.c +@@ -908,6 +908,9 @@ early_exit: + /** + * process_iscsid_broadcast() - This function is used to process the + * broadcast messages from iscsid ++ * ++ * s2 is an open file descriptor, which ++ * must not be left open upon return + */ + int process_iscsid_broadcast(int s2) + { +@@ -923,6 +926,7 @@ int process_iscsid_broadcast(int s2) + if (fd == NULL) { + LOG_ERR(PFX "Couldn't open file descriptor: %d(%s)", + errno, strerror(errno)); ++ close(s2); + return -EIO; + } + +@@ -1025,7 +1029,8 @@ int process_iscsid_broadcast(int s2) + } + + error: +- free(data); ++ if (data) ++ free(data); + fclose(fd); + + return rc; +@@ -1127,8 +1132,8 @@ static void *iscsid_loop(void *arg) + break; + } + ++ /* this closes the file descriptor s2 */ + process_iscsid_broadcast(s2); +- close(s2); + } + + pthread_cleanup_pop(0); +-- +2.17.2 + diff --git a/SOURCES/open-iscsi-2.0.875-18-Ensure-strings-from-peer-are-copied-correctly.patch b/SOURCES/open-iscsi-2.0.875-18-Ensure-strings-from-peer-are-copied-correctly.patch new file mode 100644 index 0000000..a2ac39b --- /dev/null +++ b/SOURCES/open-iscsi-2.0.875-18-Ensure-strings-from-peer-are-copied-correctly.patch @@ -0,0 +1,72 @@ +From 85f647c4300a888bb6cbc27f33138549cab617e3 Mon Sep 17 00:00:00 2001 +From: Lee Duncan +Date: Fri, 15 Dec 2017 11:15:26 -0800 +Subject: [PATCH] Ensure strings from peer are copied correctly. + +The method of using strlen() and strcpy()/strncpy() has +a couple of holes. Do not try to measure the length of +strings supplied from peer, and ensure copied strings are +NULL-terminated. Use the new strlcpy() instead. +Found by Qualsys. +--- + iscsiuio/src/unix/iscsid_ipc.c | 24 ++++++------------------ + 1 file changed, 6 insertions(+), 18 deletions(-) + +diff --git a/iscsiuio/src/unix/iscsid_ipc.c b/iscsiuio/src/unix/iscsid_ipc.c +index 4a6687b32a17..8478f9a411a3 100644 +--- a/iscsiuio/src/unix/iscsid_ipc.c ++++ b/iscsiuio/src/unix/iscsid_ipc.c +@@ -147,10 +147,7 @@ static int decode_cidr(char *in_ipaddr_str, struct iface_rec_decode *ird) + struct in_addr ia; + struct in6_addr ia6; + +- if (strlen(in_ipaddr_str) > NI_MAXHOST) +- strncpy(ipaddr_str, in_ipaddr_str, NI_MAXHOST); +- else +- strcpy(ipaddr_str, in_ipaddr_str); ++ strlcpy(ipaddr_str, in_ipaddr_str, NI_MAXHOST); + + /* Find the CIDR if any */ + tmp = strchr(ipaddr_str, '/'); +@@ -282,22 +279,16 @@ static int decode_iface(struct iface_rec_decode *ird, struct iface_rec *rec) + + /* For LL on, ignore the IPv6 addr in the iface */ + if (ird->linklocal_autocfg == IPV6_LL_AUTOCFG_OFF) { +- if (strlen(rec->ipv6_linklocal) > NI_MAXHOST) +- strncpy(ipaddr_str, rec->ipv6_linklocal, +- NI_MAXHOST); +- else +- strcpy(ipaddr_str, rec->ipv6_linklocal); ++ strlcpy(ipaddr_str, rec->ipv6_linklocal, ++ NI_MAXHOST); + inet_pton(AF_INET6, ipaddr_str, + &ird->ipv6_linklocal); + } + + /* For RTR on, ignore the IPv6 addr in the iface */ + if (ird->router_autocfg == IPV6_RTR_AUTOCFG_OFF) { +- if (strlen(rec->ipv6_router) > NI_MAXHOST) +- strncpy(ipaddr_str, rec->ipv6_router, +- NI_MAXHOST); +- else +- strcpy(ipaddr_str, rec->ipv6_router); ++ strlcpy(ipaddr_str, rec->ipv6_router, ++ NI_MAXHOST); + inet_pton(AF_INET6, ipaddr_str, + &ird->ipv6_router); + } +@@ -311,10 +302,7 @@ static int decode_iface(struct iface_rec_decode *ird, struct iface_rec *rec) + calculate_default_netmask( + ird->ipv4_addr.s_addr); + +- if (strlen(rec->gateway) > NI_MAXHOST) +- strncpy(ipaddr_str, rec->gateway, NI_MAXHOST); +- else +- strcpy(ipaddr_str, rec->gateway); ++ strlcpy(ipaddr_str, rec->gateway, NI_MAXHOST); + inet_pton(AF_INET, ipaddr_str, &ird->ipv4_gateway); + } + } else { +-- +2.17.2 + diff --git a/SOURCES/open-iscsi-2.0.875-19-Skip-useless-strcopy-and-validate-CIDR-length.patch b/SOURCES/open-iscsi-2.0.875-19-Skip-useless-strcopy-and-validate-CIDR-length.patch new file mode 100644 index 0000000..40e37c6 --- /dev/null +++ b/SOURCES/open-iscsi-2.0.875-19-Skip-useless-strcopy-and-validate-CIDR-length.patch @@ -0,0 +1,38 @@ +From a7a96131bd2ea342f6def0e46be514baf8037ae8 Mon Sep 17 00:00:00 2001 +From: Lee Duncan +Date: Fri, 15 Dec 2017 11:18:35 -0800 +Subject: [PATCH] Skip useless strcopy, and validate CIDR length + +Remove a useless strcpy() that copies a string onto itself, +and ensure the CIDR length "keepbits" is not negative. +Found by Qualsys. +--- + iscsiuio/src/unix/iscsid_ipc.c | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +diff --git a/iscsiuio/src/unix/iscsid_ipc.c b/iscsiuio/src/unix/iscsid_ipc.c +index 8478f9a411a3..4e3d065667c9 100644 +--- a/iscsiuio/src/unix/iscsid_ipc.c ++++ b/iscsiuio/src/unix/iscsid_ipc.c +@@ -143,7 +143,7 @@ static int decode_cidr(char *in_ipaddr_str, struct iface_rec_decode *ird) + char *tmp, *tok; + char ipaddr_str[NI_MAXHOST]; + char str[INET6_ADDRSTRLEN]; +- int keepbits = 0; ++ unsigned long keepbits = 0; + struct in_addr ia; + struct in6_addr ia6; + +@@ -156,8 +156,7 @@ static int decode_cidr(char *in_ipaddr_str, struct iface_rec_decode *ird) + tmp = ipaddr_str; + tok = strsep(&tmp, "/"); + LOG_INFO(PFX "in cidr: bitmask '%s' ip '%s'", tmp, tok); +- keepbits = atoi(tmp); +- strcpy(ipaddr_str, tok); ++ keepbits = strtoull(tmp, NULL, 10); + } + + /* Determine if the IP address passed from the iface file is +-- +2.17.2 + diff --git a/SOURCES/open-iscsi-2.0.875-20-Check-iscsiuio-ping-data-length-for-validity.patch b/SOURCES/open-iscsi-2.0.875-20-Check-iscsiuio-ping-data-length-for-validity.patch new file mode 100644 index 0000000..b07fd86 --- /dev/null +++ b/SOURCES/open-iscsi-2.0.875-20-Check-iscsiuio-ping-data-length-for-validity.patch @@ -0,0 +1,58 @@ +From 59ede2cf4eee8729a4221000a5d1ecdd312a31ac Mon Sep 17 00:00:00 2001 +From: Lee Duncan +Date: Fri, 15 Dec 2017 11:21:15 -0800 +Subject: [PATCH] Check iscsiuio ping data length for validity + +We do not trust that the received ping packet data length +is correct, so sanity check it. Found by Qualsys. +--- + iscsiuio/src/unix/iscsid_ipc.c | 5 +++++ + iscsiuio/src/unix/packet.c | 2 +- + iscsiuio/src/unix/packet.h | 2 ++ + 3 files changed, 8 insertions(+), 1 deletion(-) + +diff --git a/iscsiuio/src/unix/iscsid_ipc.c b/iscsiuio/src/unix/iscsid_ipc.c +index 4e3d065667c9..d4322350fcf6 100644 +--- a/iscsiuio/src/unix/iscsid_ipc.c ++++ b/iscsiuio/src/unix/iscsid_ipc.c +@@ -328,6 +328,11 @@ static void *perform_ping(void *arg) + + data = (iscsid_uip_broadcast_t *)png_c->data; + datalen = data->u.ping_rec.datalen; ++ if ((datalen > STD_MTU_SIZE) || (datalen < 0)) { ++ LOG_ERR(PFX "Ping datalen invalid: %d", datalen); ++ rc = -EINVAL; ++ goto ping_done; ++ } + + memset(dst_addr, 0, sizeof(uip_ip6addr_t)); + if (nic_iface->protocol == AF_INET) { +diff --git a/iscsiuio/src/unix/packet.c b/iscsiuio/src/unix/packet.c +index ecea09bedc22..3ce2c6b623e0 100644 +--- a/iscsiuio/src/unix/packet.c ++++ b/iscsiuio/src/unix/packet.c +@@ -112,7 +112,7 @@ int alloc_free_queue(nic_t *nic, size_t num_of_packets) + for (i = 0; i < num_of_packets; i++) { + packet_t *pkt; + +- pkt = alloc_packet(1500, 1500); ++ pkt = alloc_packet(STD_MTU_SIZE, STD_MTU_SIZE); + if (pkt == NULL) { + goto done; + } +diff --git a/iscsiuio/src/unix/packet.h b/iscsiuio/src/unix/packet.h +index b63d68851bb4..19d1db912d18 100644 +--- a/iscsiuio/src/unix/packet.h ++++ b/iscsiuio/src/unix/packet.h +@@ -43,6 +43,8 @@ + + #include "nic.h" + ++#define STD_MTU_SIZE 1500 ++ + struct nic; + struct nic_interface; + +-- +2.17.2 + diff --git a/SOURCES/open-iscsi-2.0.875-21-tell-git-to-ignore-the-iscsiuio-binary.patch b/SOURCES/open-iscsi-2.0.875-21-tell-git-to-ignore-the-iscsiuio-binary.patch new file mode 100644 index 0000000..843e15c --- /dev/null +++ b/SOURCES/open-iscsi-2.0.875-21-tell-git-to-ignore-the-iscsiuio-binary.patch @@ -0,0 +1,20 @@ +From 8513665ee05388ec379ac55ed2e17cd634d04474 Mon Sep 17 00:00:00 2001 +From: Lee Duncan +Date: Fri, 15 Dec 2017 11:23:38 -0800 +Subject: [PATCH] tell git to ignore the iscsiuio binary + +--- + iscsiuio/src/unix/.gitignore | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/iscsiuio/src/unix/.gitignore b/iscsiuio/src/unix/.gitignore +index a2dca2d5700b..b3b37db48049 100644 +--- a/iscsiuio/src/unix/.gitignore ++++ b/iscsiuio/src/unix/.gitignore +@@ -1,2 +1,3 @@ + build_date.c + build_date.h ++iscsiuio +-- +2.17.2 + diff --git a/SOURCES/open-iscsi-2.0.875-30-Cleanup-iscsiuio-master-Makefile-template.patch b/SOURCES/open-iscsi-2.0.875-30-Cleanup-iscsiuio-master-Makefile-template.patch new file mode 100644 index 0000000..0ad160b --- /dev/null +++ b/SOURCES/open-iscsi-2.0.875-30-Cleanup-iscsiuio-master-Makefile-template.patch @@ -0,0 +1,39 @@ +From 16057538f6ff0209a0dfe40067d6fc7a8cadeaab Mon Sep 17 00:00:00 2001 +From: Lee Duncan +Date: Wed, 17 Jan 2018 14:17:13 -0800 +Subject: [PATCH] Cleanup iscsiuio master Makefile template. + +Make sure needed directories exist, and make +sure install/symbolic linking of target +works, even when not in root=/. +--- + iscsiuio/Makefile.am | 12 ++++++++---- + 1 file changed, 8 insertions(+), 4 deletions(-) + +diff --git a/iscsiuio/Makefile.am b/iscsiuio/Makefile.am +index c70103027be5..97f478fa2fe6 100644 +--- a/iscsiuio/Makefile.am ++++ b/iscsiuio/Makefile.am +@@ -19,11 +19,15 @@ install-am: all-am + + install-man: + cat docs/iscsiuio.8 | GZIP=$(GZIP_ENV) gzip -c > iscsiuio.8.gz +- $(INSTALL_PROGRAM) iscsiuio.8.gz $(mandir)/man8 ++ $(INSTALL) -d $(DESTDIR)$(mandir)/man8/ ++ $(INSTALL_DATA) iscsiuio.8.gz $(DESTDIR)$(mandir)/man8/ + + install-log: +- $(INSTALL_PROGRAM) iscsiuiolog $(logdir) ++ $(INSTALL) -d $(DESTDIR)$(logdir)/ ++ $(INSTALL_DATA) iscsiuiolog $(DESTDIR)$(logdir)/ + + install-brcm: +- -rm -f $(sbindir)/brcm_iscsiuio +- -ln -s $(sbindir)/iscsiuio $(sbindir)/brcm_iscsiuio ++ $(RM) $(DESTDIR)$(sbindir)/brcm_iscsiuio ++ (cd $(DESTDIR)/$(sbindir); \ ++ $(RM) brcm_iscsiuio; \ ++ $(LN_S) iscsiuio brcm_iscsiuio) +-- +2.17.2 + diff --git a/SOURCES/open-iscsi-2.0.875-7-Ignore-library-file-for-iscsiuio-src.patch b/SOURCES/open-iscsi-2.0.875-7-Ignore-library-file-for-iscsiuio-src.patch new file mode 100644 index 0000000..0d5ccf8 --- /dev/null +++ b/SOURCES/open-iscsi-2.0.875-7-Ignore-library-file-for-iscsiuio-src.patch @@ -0,0 +1,20 @@ +From 204f588d8be50354ab4a3f3ace671d27d11f347d Mon Sep 17 00:00:00 2001 +From: Lee Duncan +Date: Sat, 2 Dec 2017 14:01:34 -0800 +Subject: [PATCH] Ignore library file for iscsiuio/src + +--- + iscsiuio/src/.gitignore | 1 + + 1 file changed, 1 insertion(+) + create mode 100644 iscsiuio/src/.gitignore + +diff --git a/iscsiuio/src/.gitignore b/iscsiuio/src/.gitignore +new file mode 100644 +index 000000000000..10301e28bf0f +--- /dev/null ++++ b/iscsiuio/src/.gitignore +@@ -0,0 +1 @@ ++*.a +-- +2.17.2 + diff --git a/SOURCES/open-iscsi-2.0.875-9-Remove-unused-variables.-No-functional-change.patch b/SOURCES/open-iscsi-2.0.875-9-Remove-unused-variables.-No-functional-change.patch new file mode 100644 index 0000000..da6510b --- /dev/null +++ b/SOURCES/open-iscsi-2.0.875-9-Remove-unused-variables.-No-functional-change.patch @@ -0,0 +1,93 @@ +From de7f6ca8a583136d61cfb213f4c9873f91840e3b Mon Sep 17 00:00:00 2001 +From: Lee Duncan +Date: Sat, 2 Dec 2017 14:17:15 -0800 +Subject: [PATCH] Remove unused variables. No functional change. + +This makes the compiler much happier, and +debugging easier. +--- + iscsiuio/src/uip/uip.c | 3 --- + iscsiuio/src/unix/iscsid_ipc.c | 5 ----- + iscsiuio/src/unix/libs/bnx2.c | 1 - + iscsiuio/src/unix/libs/cnic.c | 3 --- + iscsiuio/src/unix/nic_utils.c | 2 -- + 5 files changed, 14 deletions(-) + +diff --git a/iscsiuio/src/uip/uip.c b/iscsiuio/src/uip/uip.c +index 9e6dcc3b87b9..e2ce2cc5d85c 100644 +--- a/iscsiuio/src/uip/uip.c ++++ b/iscsiuio/src/uip/uip.c +@@ -102,9 +102,6 @@ + ******************************************************************************/ + #define PFX "uip " + +-static const uip_ip6addr_t all_ones_addr6 = { +- 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff +-}; + static const uip_ip4addr_t all_ones_addr4 = { 0xffff, 0xffff }; + + const uip_ip6addr_t all_zeroes_addr6 = { +diff --git a/iscsiuio/src/unix/iscsid_ipc.c b/iscsiuio/src/unix/iscsid_ipc.c +index a2a59a8a1821..658362899234 100644 +--- a/iscsiuio/src/unix/iscsid_ipc.c ++++ b/iscsiuio/src/unix/iscsid_ipc.c +@@ -103,11 +103,6 @@ struct iface_rec_decode { + }; + + +-/****************************************************************************** +- * iscsid_ipc Constants +- *****************************************************************************/ +-static const char uio_udev_path_template[] = "/dev/uio%d"; +- + /****************************************************************************** + * Globals + *****************************************************************************/ +diff --git a/iscsiuio/src/unix/libs/bnx2.c b/iscsiuio/src/unix/libs/bnx2.c +index c68131c0ca24..1181cf4ddd31 100644 +--- a/iscsiuio/src/unix/libs/bnx2.c ++++ b/iscsiuio/src/unix/libs/bnx2.c +@@ -77,7 +77,6 @@ static const char cnic_uio_sysfs_name[] = "bnx2_cnic"; + /******************************************************************************* + * String constants used to display human readable adapter name + ******************************************************************************/ +-static const char brcm_5706C[] = "QLogic NetXtreme II BCM5706 1000Base-T"; + static const char hp_NC370T[] = + "HP NC370T Multifunction Gigabit Server Adapter"; + static const char hp_NC370I[] = +diff --git a/iscsiuio/src/unix/libs/cnic.c b/iscsiuio/src/unix/libs/cnic.c +index a009f25f0814..9662f024041b 100644 +--- a/iscsiuio/src/unix/libs/cnic.c ++++ b/iscsiuio/src/unix/libs/cnic.c +@@ -73,9 +73,6 @@ + ******************************************************************************/ + #define PFX "CNIC " + +-static const uip_ip6addr_t all_ones_addr6 = { +- 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff }; +- + /******************************************************************************* + * Constants shared between the bnx2 and bnx2x modules + ******************************************************************************/ +diff --git a/iscsiuio/src/unix/nic_utils.c b/iscsiuio/src/unix/nic_utils.c +index 6e580f862eea..e2f294389840 100644 +--- a/iscsiuio/src/unix/nic_utils.c ++++ b/iscsiuio/src/unix/nic_utils.c +@@ -76,14 +76,12 @@ static const char uio_uevent_path_template[] = "/sys/class/uio/uio%d/uevent"; + + static const char base_iscsi_host_name[] = "/sys/class/iscsi_host/"; + static const char host_template[] = "host%d"; +-static const char iscsi_host_path_template[] = "/sys/class/iscsi_host/host%d"; + static const char iscsi_host_path_netdev_template[] = + "/sys/class/iscsi_host/host%d/netdev"; + static const char cnic_uio_sysfs_resc_template[] = + "/sys/class/uio/uio%i/device/resource%i"; + static const char iscsi_transport_handle_template[] = + "/sys/class/iscsi_transport/%s/handle"; +-static const char eth_pfx[] = "eth"; + static const char host_pfx[] = "host"; + + /** +-- +2.17.2 + diff --git a/SOURCES/open-iscsi-2.0.876-5-bnx2x.c-Reorder-the-includes-to-avoid-duplicate-defines-with-musl.patch b/SOURCES/open-iscsi-2.0.876-5-bnx2x.c-Reorder-the-includes-to-avoid-duplicate-defines-with-musl.patch new file mode 100644 index 0000000..faf5a3f --- /dev/null +++ b/SOURCES/open-iscsi-2.0.876-5-bnx2x.c-Reorder-the-includes-to-avoid-duplicate-defines-with-musl.patch @@ -0,0 +1,53 @@ +From 96a2c0c1629f05d452af32c809f30bc4d0c3220e Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Fri, 2 Feb 2018 23:28:33 -0800 +Subject: [PATCH] bnx2x.c: Reorder the includes to avoid duplicate defines with + musl + +including nic.h before linux/ethtool.h avoids redefinitions of +eth structs + +/mnt/a/oe/build/tmp/work/cortexa7t2hf-neon-vfpv4-bec-linux-musleabi/iscsi-initiator-utils/2.0.876-r0/recipe-sysroot/ +usr/include/netinet/if_ether.h:104:8: error: redefinition of 'struct ethhdr' + struct ethhdr { + ^~~~~~ +In file included from /mnt/a/oe/build/tmp/work/cortexa7t2hf-neon-vfpv4-bec-linux-musleabi/iscsi-initiator-utils/2.0. +876-r0/recipe-sysroot/usr/include/linux/ethtool.h:19:0, + from qedi.c:52: +/mnt/a/oe/build/tmp/work/cortexa7t2hf-neon-vfpv4-bec-linux-musleabi/iscsi-initiator-utils/2.0.876-r0/recipe-sysroot/ +usr/include/linux/if_ether.h:154:8: note: originally defined here + struct ethhdr { + ^~~~~~ + +Signed-off-by: Khem Raj +--- + iscsiuio/src/unix/libs/bnx2x.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/iscsiuio/src/unix/libs/bnx2x.c b/iscsiuio/src/unix/libs/bnx2x.c +index 3df6d5fdbfa2..c5e7b7191811 100644 +--- a/iscsiuio/src/unix/libs/bnx2x.c ++++ b/iscsiuio/src/unix/libs/bnx2x.c +@@ -36,6 +36,11 @@ + * bnx2x.c - bnx2x user space driver + * + */ ++ ++/* include nic.h before linux/ethtool.h to avoid redefinitions of ++ * eth structs ++*/ ++#include "nic.h" + #include + #include + #include +@@ -58,7 +63,6 @@ + #include "bnx2x.h" + #include "cnic.h" + #include "logger.h" +-#include "nic.h" + #include "nic_id.h" + #include "nic_utils.h" + #include "options.h" +-- +2.17.2 + diff --git a/SOURCES/open-iscsi-2.0.876-56-iscsiuio-Release-xmit_mutex-in-error-code-path.patch b/SOURCES/open-iscsi-2.0.876-56-iscsiuio-Release-xmit_mutex-in-error-code-path.patch new file mode 100644 index 0000000..d46b3e7 --- /dev/null +++ b/SOURCES/open-iscsi-2.0.876-56-iscsiuio-Release-xmit_mutex-in-error-code-path.patch @@ -0,0 +1,28 @@ +From cda251fc8bcf57454a2573d5cd097666a88efe72 Mon Sep 17 00:00:00 2001 +From: Manish Rangankar +Date: Tue, 14 Aug 2018 02:15:20 -0400 +Subject: [PATCH] iscsiuio: Release xmit_mutex in error code path. + +This prevents iscsiuio seg fault in case get_tx_pkt fails +while sending ARP. + +Signed-off-by: Manish Rangankar +--- + iscsiuio/src/unix/libs/cnic.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/iscsiuio/src/unix/libs/cnic.c b/iscsiuio/src/unix/libs/cnic.c +index 4ff61e7ad596..9cdf933f1f23 100644 +--- a/iscsiuio/src/unix/libs/cnic.c ++++ b/iscsiuio/src/unix/libs/cnic.c +@@ -114,6 +114,7 @@ static int cnic_arp_send(nic_t *nic, nic_interface_t *nic_iface, int fd, + eth = (*nic->ops->get_tx_pkt) (nic); + if (eth == NULL) { + LOG_WARN(PFX "%s: couldn't get tx packet", nic->log_name); ++ pthread_mutex_unlock(&nic->xmit_mutex); + return -EAGAIN; + } + +-- +2.17.2 + diff --git a/SOURCES/open-iscsi-2.0.876-57-iscsiuio-limit-retries-of-performing-dhcpv6-before-declaring-dhcp-failure.patch b/SOURCES/open-iscsi-2.0.876-57-iscsiuio-limit-retries-of-performing-dhcpv6-before-declaring-dhcp-failure.patch new file mode 100644 index 0000000..374c2d1 --- /dev/null +++ b/SOURCES/open-iscsi-2.0.876-57-iscsiuio-limit-retries-of-performing-dhcpv6-before-declaring-dhcp-failure.patch @@ -0,0 +1,47 @@ +From 65bcce29d5d7ad3831513fe14c76791287847597 Mon Sep 17 00:00:00 2001 +From: Nilesh Javali +Date: Fri, 24 Aug 2018 06:38:45 -0400 +Subject: [PATCH] iscsiuio: limit retries of performing dhcpv6 before declaring + dhcp failure + +After successful stateless router adv., the restart of handle_ndp thread +infinitely checks dhcpv6 causing IPv6 DHCP sequence failure. +Limit the retries of dhcpv6 validation. + +Signed-off-by: Nilesh Javali +--- + iscsiuio/src/uip/ipv6_ndpc.c | 11 ++++++++--- + 1 file changed, 8 insertions(+), 3 deletions(-) + +diff --git a/iscsiuio/src/uip/ipv6_ndpc.c b/iscsiuio/src/uip/ipv6_ndpc.c +index a396cb784bd3..bb07c1dd64ff 100644 +--- a/iscsiuio/src/uip/ipv6_ndpc.c ++++ b/iscsiuio/src/uip/ipv6_ndpc.c +@@ -134,6 +134,7 @@ wait_rtr: + } while (!(ipv6c->flags & IPV6_FLAGS_ROUTER_ADV_RECEIVED)); + + LOG_DEBUG("%s: ndpc_handle got rtr adv", s->nic->log_name); ++ s->retry_count = 0; + + no_rtr_adv: + s->state = NDPC_STATE_RTR_ADV; +@@ -200,9 +201,13 @@ wait_dhcp: + } else { + /* Static IPv6 */ + if (ustack->ip_config == IPV6_CONFIG_DHCP) { +- LOG_DEBUG("%s: ndpc_handle DHCP failed", +- s->nic->log_name); +- PT_RESTART(&s->pt); ++ s->retry_count++; ++ if (s->retry_count > DHCPV6_NUM_OF_RETRY) { ++ LOG_DEBUG("%s: ndpc_handle DHCP failed", ++ s->nic->log_name); ++ } else { ++ PT_RESTART(&s->pt); ++ } + } + staticv6: + ipv6_disable_dhcpv6(ipv6c); +-- +2.17.2 + diff --git a/SOURCES/open-iscsi-2.0.876-58-iscsiuio-Do-not-flush-tx-queue-on-each-uio-interrupt.patch b/SOURCES/open-iscsi-2.0.876-58-iscsiuio-Do-not-flush-tx-queue-on-each-uio-interrupt.patch new file mode 100644 index 0000000..f7e90c8 --- /dev/null +++ b/SOURCES/open-iscsi-2.0.876-58-iscsiuio-Do-not-flush-tx-queue-on-each-uio-interrupt.patch @@ -0,0 +1,37 @@ +From caae91b5ef27124caf9adc1b46b40a3491f49bee Mon Sep 17 00:00:00 2001 +From: Manish Rangankar +Date: Wed, 24 Oct 2018 07:22:05 -0400 +Subject: [PATCH] iscsiuio: Do not flush tx queue on each uio interrupt. + +Unlike bnx2x, qedi start_xmit netlink provide us guarantee +of transmitting LL2 packet, so there is no need to call clear_tx_intr for +each LL2 packet. This help us in reducing iscsiuio lock contention. + +Signed-off-by: Manish Rangankar +--- + iscsiuio/src/unix/nic.c | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +diff --git a/iscsiuio/src/unix/nic.c b/iscsiuio/src/unix/nic.c +index dfc2ad0a7a7b..29c4332a3162 100644 +--- a/iscsiuio/src/unix/nic.c ++++ b/iscsiuio/src/unix/nic.c +@@ -799,9 +799,12 @@ int nic_process_intr(nic_t *nic, int discard_check) + + nic->intr_count = count; + +- LOG_DEBUG(PFX "%s: host:%d - calling clear_tx_intr from process_intr", +- nic->log_name, nic->host_no); +- (*nic->ops->clear_tx_intr) (nic); ++ if (strcmp(nic->ops->description, "qedi")) { ++ LOG_DEBUG(PFX "%s: host:%d - calling clear_tx_intr from process_intr", ++ nic->log_name, nic->host_no); ++ (*nic->ops->clear_tx_intr) (nic); ++ } ++ + ret = 1; + } + pthread_mutex_unlock(&nic->nic_mutex); +-- +2.17.2 + diff --git a/SOURCES/open-iscsi-2.0.876-59-qedi-Set-buf_size-in-case-of-ICMP-and-ARP-packet.patch b/SOURCES/open-iscsi-2.0.876-59-qedi-Set-buf_size-in-case-of-ICMP-and-ARP-packet.patch new file mode 100644 index 0000000..e858e86 --- /dev/null +++ b/SOURCES/open-iscsi-2.0.876-59-qedi-Set-buf_size-in-case-of-ICMP-and-ARP-packet.patch @@ -0,0 +1,35 @@ +From 243332dfaa6ba856f81c8264a3d861fe7a05eb66 Mon Sep 17 00:00:00 2001 +From: Manish Rangankar +Date: Tue, 20 Nov 2018 00:11:16 -0500 +Subject: [PATCH] qedi: Set buf_size in case of ICMP and ARP packet. + +Invalid ether len was resulting into showing CRC error on wire. + +Signed-off-by: Manish Rangankar +--- + iscsiuio/src/unix/nic.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/iscsiuio/src/unix/nic.c b/iscsiuio/src/unix/nic.c +index 29c4332a3162..bd415c2446bc 100644 +--- a/iscsiuio/src/unix/nic.c ++++ b/iscsiuio/src/unix/nic.c +@@ -1122,6 +1122,7 @@ nic_iface_present: + * network, the global variable uip_len is + * set to a value > 0. */ + if (ustack->uip_len > 0) { ++ pkt->buf_size = ustack->uip_len; + prepare_ipv4_packet(nic, nic_iface, + ustack, pkt); + +@@ -1139,6 +1140,7 @@ nic_iface_present: + * network, the global variable uip_len + * is set to a value > 0. */ + if (pkt->buf_size > 0) { ++ pkt->buf_size = ustack->uip_len; + LOG_DEBUG(PFX "%s: write called after arp_arpin, bufsize=%d", + nic->log_name, pkt->buf_size); + (*nic->ops->write) (nic, nic_iface, pkt); +-- +2.17.2 + diff --git a/SOURCES/open-iscsi-2.0.876-6-Use-correct-size-when-copying-nic-name.patch b/SOURCES/open-iscsi-2.0.876-6-Use-correct-size-when-copying-nic-name.patch new file mode 100644 index 0000000..0b52463 --- /dev/null +++ b/SOURCES/open-iscsi-2.0.876-6-Use-correct-size-when-copying-nic-name.patch @@ -0,0 +1,35 @@ +From 7fd4eb9313154f3b3458ea07d6a12f0be26d2a4e Mon Sep 17 00:00:00 2001 +From: Lee Duncan +Date: Wed, 21 Mar 2018 16:43:33 -0700 +Subject: [PATCH] Use correct size when copying nic name. + +The incorrect length was being used to copy +the NIC name. + +Found by gcc-8, which gave this error: +> [ 19s] nic_utils.c: In function 'nic_util_enable_disable_multicast': +> [ 19s] nic_utils.c:308:9: warning: argument to 'sizeof' in 'strncpy' +> call is the same expression as the source; did you mean to +> use the size of the destination? [-Wsizeof-pointer-memaccess] +> [ 19s] sizeof(nic->eth_device_name)); +> [ 19s] ^ +--- + iscsiuio/src/unix/nic_utils.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/iscsiuio/src/unix/nic_utils.c b/iscsiuio/src/unix/nic_utils.c +index e2f294389840..786f2a4d5b5d 100644 +--- a/iscsiuio/src/unix/nic_utils.c ++++ b/iscsiuio/src/unix/nic_utils.c +@@ -305,7 +305,7 @@ static int nic_util_enable_disable_multicast(nic_t *nic, uint32_t cmd) + /* Prepare the request */ + memset(&ifr, 0, sizeof(ifr)); + strncpy(ifr.ifr_name, nic->eth_device_name, +- sizeof(nic->eth_device_name)); ++ sizeof(ifr.ifr_name)); + memcpy(ifr.ifr_hwaddr.sa_data, multicast_addr.addr, ETH_ALEN); + + fd = socket(AF_INET, SOCK_DGRAM, 0); +-- +2.17.2 + diff --git a/SOURCES/open-iscsi-2.0.876-60-qedi-Use-uio-BD-index-instead-on-buffer-index.patch b/SOURCES/open-iscsi-2.0.876-60-qedi-Use-uio-BD-index-instead-on-buffer-index.patch new file mode 100644 index 0000000..7cf2154 --- /dev/null +++ b/SOURCES/open-iscsi-2.0.876-60-qedi-Use-uio-BD-index-instead-on-buffer-index.patch @@ -0,0 +1,57 @@ +From e34658ca383a0d1d2e455a4c5bb55ce06790ba97 Mon Sep 17 00:00:00 2001 +From: Manish Rangankar +Date: Tue, 20 Nov 2018 00:15:01 -0500 +Subject: [PATCH] qedi: Use uio BD index instead on buffer index. + +1. Use HW BD prod index to read packet buffer descriptor. +2. Use BD producer and consumer index to check for new data instead + of UIO ring buffer index. + +NOTE - This patch has dependency on upstream qedi driver v8.33.0.21, +commit "qedi: Move LL2 producer index processing in BH.", +(https://marc.info/?l=linux-scsi&m=154271028608808) + +Signed-off-by: Manish Rangankar +--- + iscsiuio/src/unix/libs/qedi.c | 12 +++++++++--- + 1 file changed, 9 insertions(+), 3 deletions(-) + +diff --git a/iscsiuio/src/unix/libs/qedi.c b/iscsiuio/src/unix/libs/qedi.c +index 3aa2de7155e8..b7595d5223eb 100644 +--- a/iscsiuio/src/unix/libs/qedi.c ++++ b/iscsiuio/src/unix/libs/qedi.c +@@ -994,7 +994,7 @@ static int qedi_read(nic_t *nic, packet_t *pkt) + void *rx_pkt; + int rc = 0; + uint32_t sw_cons, bd_cons; +- uint32_t hw_prod; ++ uint32_t hw_prod, bd_prod; + uint32_t rx_pkt_idx; + int len; + struct qedi_rx_bd *rx_bd; +@@ -1013,14 +1013,20 @@ static int qedi_read(nic_t *nic, packet_t *pkt) + msync(bp->rx_comp_ring, nic->page_size, MS_SYNC); + uctrl = (struct qedi_uio_ctrl *)bp->uctrl_map; + hw_prod = uctrl->hw_rx_prod; ++ bd_prod = uctrl->hw_rx_bd_prod; + sw_cons = uctrl->host_rx_cons; + bd_cons = uctrl->host_rx_bd_cons; +- rx_bd = bp->rx_comp_ring + (bd_cons * sizeof(*rx_bd)); ++ rx_bd = bp->rx_comp_ring + (bd_prod * sizeof(*rx_bd)); + len = rx_bd->rx_pkt_len; + rx_pkt_idx = rx_bd->rx_pkt_index; + vlan_id = rx_bd->vlan_id; + +- if (sw_cons != hw_prod) { ++ LOG_DEBUG(PFX "%s:hw_prod %d bd_prod %d, rx_pkt_idx %d, rxlen %d", ++ nic->log_name, hw_prod, bd_prod, rx_bd->rx_pkt_index, len); ++ LOG_DEBUG(PFX "%s: sw_con %d bd_cons %d num BD %d", ++ nic->log_name, sw_cons, bd_cons, QEDI_NUM_RX_BD); ++ ++ if (bd_cons != bd_prod) { + LOG_DEBUG(PFX "%s: clearing rx interrupt: %d %d", + nic->log_name, sw_cons, hw_prod); + rc = 1; +-- +2.17.2 + diff --git a/SOURCES/open-iscsi-2.0.876-61-iscsiuio-v0.7.8.5.patch b/SOURCES/open-iscsi-2.0.876-61-iscsiuio-v0.7.8.5.patch new file mode 100644 index 0000000..bb17e70 --- /dev/null +++ b/SOURCES/open-iscsi-2.0.876-61-iscsiuio-v0.7.8.5.patch @@ -0,0 +1,88 @@ +From de6e8918c6c195360d87a96c196cccef2c082527 Mon Sep 17 00:00:00 2001 +From: Nilesh Javali +Date: Tue, 20 Nov 2018 01:10:57 -0500 +Subject: [PATCH] iscsiuio: v0.7.8.5 + +Signed-off-by: Nilesh Javali +--- + iscsiuio/README | 4 ++-- + iscsiuio/RELEASE.TXT | 26 ++++++++++++++++++++++++-- + iscsiuio/configure.ac | 4 ++-- + 3 files changed, 28 insertions(+), 6 deletions(-) + +diff --git a/iscsiuio/README b/iscsiuio/README +index 9cbf7ce6717a..19150055a3fb 100644 +--- a/iscsiuio/README ++++ b/iscsiuio/README +@@ -1,6 +1,6 @@ + Iscsiuio Userspace Tool +-Version 0.7.8.4 +-Feb 22, 2018 ++Version 0.7.8.5 ++Nov 20, 2018 + ------------------------------------------------------ + + This tool is to be used in conjunction with the QLogic NetXtreme II Linux +diff --git a/iscsiuio/RELEASE.TXT b/iscsiuio/RELEASE.TXT +index ca51b26338a1..0ebf27f9539c 100644 +--- a/iscsiuio/RELEASE.TXT ++++ b/iscsiuio/RELEASE.TXT +@@ -1,7 +1,7 @@ + Release Notes + QLogic uIP Linux Driver +- Version 0.7.8.4 +- 2/22/2018 ++ Version 0.7.8.5 ++ 11/20/2018 + + QLogic Corporation + 26650 Aliso Viejo Pkwy, +@@ -11,7 +11,29 @@ + Copyright (c) 2014, QLogic Corporation + All rights reserved + ++uIP v0.7.8.5 (Nov 20, 2018) ++======================================================= ++ Fixes: ++ ------- ++ 1. Problem: CQ102578: observing ISCSI initiator IP ping drop ++ Change: 1. Do not flush tx queue on each uio interrupt ++ 2. Use UIO BD index instead on buffer index. ++ 3. Set buf_size in case of ICMP and ARP packet ++ Impact: QL41xxx adapters + ++ 2. Problem: CQ103034 - Unable to boot iSCSI BFS in IPv6 DHCP config ++ Change: Limit retries of performing dhcpv6 before declaring dhcp failure ++ Impact: All ++ ++ 3. Problem: CQ102438: I/O fails to resume on multipath LUN during port toggle. ++ Change: lib/cnic, lib/qedi, Release xmit_mutex in error code path and ++ during clear tx queue. ++ Impact: QL84xx adapters ++ ++ 4. Problem: Netlink buffer corruption when more than one host ++ try to xmit packet at the same time ++ Change: Add inter-host mutex while doing xmit ++ Impact: All + + uIP v0.7.8.4 (Feb 22, 2018) + ======================================================= +diff --git a/iscsiuio/configure.ac b/iscsiuio/configure.ac +index fa67ea74c47a..ae23078aa0a3 100644 +--- a/iscsiuio/configure.ac ++++ b/iscsiuio/configure.ac +@@ -12,9 +12,9 @@ dnl Benjamin Li (benli@broadcom.com) + dnl + + PACKAGE=iscsiuio +-VERSION=0.7.8.4 ++VERSION=0.7.8.5 + +-AC_INIT([iscsiuio], [0.7.8.4], [QLogic-Storage-Upstream@cavium.com]) ++AC_INIT([iscsiuio], [0.7.8.5], [QLogic-Storage-Upstream@cavium.com]) + + AM_INIT_AUTOMAKE + AC_CONFIG_HEADER(config.h) +-- +2.17.2 + diff --git a/SOURCES/open-iscsi-2.0.876-66-Close-file-handles-when-writing-pid-files.patch b/SOURCES/open-iscsi-2.0.876-66-Close-file-handles-when-writing-pid-files.patch new file mode 100644 index 0000000..8750872 --- /dev/null +++ b/SOURCES/open-iscsi-2.0.876-66-Close-file-handles-when-writing-pid-files.patch @@ -0,0 +1,44 @@ +From 38952aa277df116da0b7ef389440de34a3e61cd0 Mon Sep 17 00:00:00 2001 +From: Scott Moser +Date: Wed, 19 Sep 2018 17:21:48 -0400 +Subject: [PATCH] Close file handles when writing pid files. + +The file descriptors used for writing to the pid file were +not being closed. Just be more clean and close them. + +Also fix a debug message that said 'lock file' rather than 'pid file'. +--- + iscsiuio/src/unix/main.c | 3 ++- + usr/iscsid.c | 1 + + 2 files changed, 3 insertions(+), 1 deletion(-) + +diff --git a/iscsiuio/src/unix/main.c b/iscsiuio/src/unix/main.c +index 5cccc76ed220..457ebe340b7d 100644 +--- a/iscsiuio/src/unix/main.c ++++ b/iscsiuio/src/unix/main.c +@@ -346,8 +346,9 @@ int main(int argc, char *argv[]) + sprintf(buf, "%d\n", getpid()); + written_bytes = write(fd, buf, strlen(buf)); + if (written_bytes == -1) +- printf("Could not write lock file [%s]", ++ printf("Could not write pid file [%s]", + strerror(errno)); ++ close(fd); + + daemon_init(); + } +diff --git a/usr/iscsid.c b/usr/iscsid.c +index b95917df3bc5..7d6032252d00 100644 +--- a/usr/iscsid.c ++++ b/usr/iscsid.c +@@ -467,6 +467,7 @@ int main(int argc, char *argv[]) + exit(ISCSI_ERR); + } + } ++ close(fd); + + daemon_init(); + } else { +-- +2.17.2 + diff --git a/SOURCES/open-iscsi-2.0.876-66-iscsiuio-avoid-loosing-bad-rc-in-nic_nl_open.patch b/SOURCES/open-iscsi-2.0.876-66-iscsiuio-avoid-loosing-bad-rc-in-nic_nl_open.patch new file mode 100644 index 0000000..702e506 --- /dev/null +++ b/SOURCES/open-iscsi-2.0.876-66-iscsiuio-avoid-loosing-bad-rc-in-nic_nl_open.patch @@ -0,0 +1,41 @@ +From 67d24cb06da6f9bc14dc5d9b833fad0e9ca1982f Mon Sep 17 00:00:00 2001 +From: Christian Ehrhardt +Date: Thu, 20 Sep 2018 07:34:30 +0200 +Subject: [PATCH] iscsiuio: avoid loosing bad rc in nic_nl_open + +nic_nl_open might have collected a non-zero rc and jumped to the error +label but still returned zero which would indicate success. + +The function should return whatever it has collected in rc and while +working without, also explicitly initialize it to zero. + +Fixes #125 + +Signed-off-by: Christian Ehrhardt +--- + iscsiuio/src/unix/nic_nl.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/iscsiuio/src/unix/nic_nl.c b/iscsiuio/src/unix/nic_nl.c +index 1a920c7b63fe..658843236da8 100644 +--- a/iscsiuio/src/unix/nic_nl.c ++++ b/iscsiuio/src/unix/nic_nl.c +@@ -534,7 +534,7 @@ static void flush_nic_nl_process_ring(nic_t *nic) + */ + int nic_nl_open() + { +- int rc; ++ int rc = 0; + char *msg_type_str; + + /* Prepare the thread to issue the ARP's */ +@@ -676,5 +676,5 @@ int nic_nl_open() + rc = 0; + + error: +- return 0; ++ return rc; + } +-- +2.17.2 + diff --git a/SOURCES/open-iscsi-2.0.876-67-iscsiuio-fail-on-nic_nl_open-failing.patch b/SOURCES/open-iscsi-2.0.876-67-iscsiuio-fail-on-nic_nl_open-failing.patch new file mode 100644 index 0000000..39f9f4a --- /dev/null +++ b/SOURCES/open-iscsi-2.0.876-67-iscsiuio-fail-on-nic_nl_open-failing.patch @@ -0,0 +1,34 @@ +From 40c4319fd3100dcbf97880508c869978dff8f818 Mon Sep 17 00:00:00 2001 +From: Christian Ehrhardt +Date: Thu, 20 Sep 2018 07:37:01 +0200 +Subject: [PATCH] iscsiuio: fail on nic_nl_open failing + +The return value of nic_nl_open was ignored and while working by chance +being the latest call before the error label any later insertion of code +after this might break it. + +Avoid that by checking for the retval and explicitly jumping to the +error label in case it is non zero. + +Signed-off-by: Christian Ehrhardt +--- + iscsiuio/src/unix/main.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/iscsiuio/src/unix/main.c b/iscsiuio/src/unix/main.c +index 5cccc76ed220..552c96a36e86 100644 +--- a/iscsiuio/src/unix/main.c ++++ b/iscsiuio/src/unix/main.c +@@ -393,7 +393,8 @@ int main(int argc, char *argv[]) + goto error; + + /* NetLink connection to listen to NETLINK_ISCSI private messages */ +- nic_nl_open(); ++ if (nic_nl_open() != 0) ++ goto error; + + error: + cleanup(); +-- +2.17.2 + diff --git a/SPECS/iscsi-initiator-utils.spec b/SPECS/iscsi-initiator-utils.spec index 7899527..a14f622 100644 --- a/SPECS/iscsi-initiator-utils.spec +++ b/SPECS/iscsi-initiator-utils.spec @@ -4,7 +4,7 @@ Summary: iSCSI daemon and utility programs Name: iscsi-initiator-utils Version: 6.%{open_iscsi_version}.%{open_iscsi_build} -Release: 10%{?dist} +Release: 11%{?dist} Group: System Environment/Daemons License: GPLv2+ URL: http://www.open-iscsi.org @@ -50,6 +50,7 @@ Patch170: 0170-fix-systemd-unit-wants.patch Patch172: 0172-move-cleanup-to-seperate-service.patch Patch175: open-iscsi-2.0.876-41-vlan-setting-sync-across-ipv4-ipv6-for-be2iscsi.patch Patch176: 0001-enable-MaxOutstandingR2T-negotiation.patch + Patch177: open-iscsi-2.0.874-30-iscsiuio-fix-dhcpv6-transaction-id-mismatch-error.patch Patch178: open-iscsi-2.0.874-31-iscsiuio-serialize-xmit_mutex-lock-to-prevent-iscsiuio-seg-fault.patch Patch179: open-iscsi-2.0.874-32-iscsiuio-allow-ARP-for-non-matching-src-and-dst-addresses.patch @@ -59,11 +60,39 @@ Patch182: open-iscsi-2.0.876-31-Fix-iscsiuio-segfault-when-shutting-down.patch Patch183: open-iscsi-2.0.876-54-iscsiuio-Add-inter-host-mutex-while-doing-xmit.patch Patch184: 0184-set-iscsid.safe_logout-to-Yes-by-default.patch +Patch195: open-iscsi-2.0.874-35-iscsiuio-fix-long-options.patch +Patch196: open-iscsi-2.0.874-38-Update-bnx2.c.patch +Patch197: open-iscsi-2.0.874-39-Update-bnx2x.c.patch +Patch198: open-iscsi-2.0.875-7-Ignore-library-file-for-iscsiuio-src.patch +Patch199: open-iscsi-2.0.875-9-Remove-unused-variables.-No-functional-change.patch +Patch200: open-iscsi-2.0.875-10-Include-sys-sysmacros.h-to-properly-define-minor.patch +Patch201: open-iscsi-2.0.875-11-Declare-inline-best_match_bufcmp-as-static.patch +Patch202: open-iscsi-2.0.875-14-Check-for-root-peer-user-for-iscsiuio-IPC.patch +Patch203: open-iscsi-2.0.875-15-iscsiuio-should-ignore-bogus-iscsid-broadcast-packets.patch +Patch204: open-iscsi-2.0.875-16-Ensure-all-fields-in-iscsiuio-IPC-response-are-set.patch +Patch205: open-iscsi-2.0.875-17-Do-not-double-close-IPC-file-stream-to-iscsid.patch +Patch206: open-iscsi-2.0.875-18-Ensure-strings-from-peer-are-copied-correctly.patch +Patch207: open-iscsi-2.0.875-19-Skip-useless-strcopy-and-validate-CIDR-length.patch +Patch208: open-iscsi-2.0.875-20-Check-iscsiuio-ping-data-length-for-validity.patch +Patch209: open-iscsi-2.0.875-21-tell-git-to-ignore-the-iscsiuio-binary.patch +Patch210: open-iscsi-2.0.875-30-Cleanup-iscsiuio-master-Makefile-template.patch +Patch211: open-iscsi-2.0.876-5-bnx2x.c-Reorder-the-includes-to-avoid-duplicate-defines-with-musl.patch +Patch212: open-iscsi-2.0.876-6-Use-correct-size-when-copying-nic-name.patch +Patch213: open-iscsi-2.0.876-56-iscsiuio-Release-xmit_mutex-in-error-code-path.patch +Patch214: open-iscsi-2.0.876-57-iscsiuio-limit-retries-of-performing-dhcpv6-before-declaring-dhcp-failure.patch +Patch215: open-iscsi-2.0.876-58-iscsiuio-Do-not-flush-tx-queue-on-each-uio-interrupt.patch +Patch216: open-iscsi-2.0.876-59-qedi-Set-buf_size-in-case-of-ICMP-and-ARP-packet.patch +Patch217: open-iscsi-2.0.876-60-qedi-Use-uio-BD-index-instead-on-buffer-index.patch +Patch218: open-iscsi-2.0.876-61-iscsiuio-v0.7.8.5.patch +Patch219: open-iscsi-2.0.876-66-Close-file-handles-when-writing-pid-files.patch +Patch220: open-iscsi-2.0.876-66-iscsiuio-avoid-loosing-bad-rc-in-nic_nl_open.patch +Patch221: open-iscsi-2.0.876-67-iscsiuio-fail-on-nic_nl_open-failing.patch + # upstream removed internal open-isns, but not taking that here just yet # it requires repackaging isns-utils to provide a debug package -Patch198: keep-open-isns.patch +Patch300: keep-open-isns.patch # version string, needs to be updated with each build -Patch199: 0199-use-Red-Hat-version-string-to-match-RPM-package-vers.patch +Patch400: 0199-use-Red-Hat-version-string-to-match-RPM-package-vers.patch BuildRequires: flex bison python-devel doxygen kmod-devel systemd-devel libmount-devel autoconf automake libtool # For dir ownership @@ -284,6 +313,9 @@ fi %{_includedir}/libiscsi.h %changelog +* Wed Mar 06 2019 Chris Leech - 6.2.0.874-12 +- 1649401, 1649413 iscsiuio updates + * Wed Aug 29 2018 Chris Leech - 6.2.0.874-10 - 1185734 set iscsid.safe_logout to Yes by default