From 5ac7b5c62cc2366eb288379386463dbbc4169a95 Mon Sep 17 00:00:00 2001 From: Lucian Cristian Date: Wed, 1 Jun 2022 17:02:46 +0000 Subject: [PATCH] open-iscsi: update to 2.1.7 Signed-off-by: Lucian Cristian --- net/open-iscsi/Makefile | 7 +- ...-idmb_rec_write-check-for-tpgt-first.patch | 6 +- ...te-seperate-old-and-new-style-writes.patch | 16 ++-- ...write-pick-tpgt-from-existing-record.patch | 93 ------------------- ...ove-the-offload-boot-supported-ifdef.patch | 8 +- .../patches/0019-Coverity-scan-fixes.patch | 28 ++---- .../patches/0998-path_adjustments.patch | 79 ++++++++++++++++ 7 files changed, 106 insertions(+), 131 deletions(-) delete mode 100644 net/open-iscsi/patches/0004-idbw_rec_write-pick-tpgt-from-existing-record.patch create mode 100644 net/open-iscsi/patches/0998-path_adjustments.patch diff --git a/net/open-iscsi/Makefile b/net/open-iscsi/Makefile index dd212cd70c..b7b7891bff 100644 --- a/net/open-iscsi/Makefile +++ b/net/open-iscsi/Makefile @@ -4,12 +4,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=open-iscsi -PKG_VERSION:=2.1.3 +PKG_VERSION:=2.1.7 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://codeload.github.com/open-iscsi/open-iscsi/tar.gz/$(PKG_VERSION)? -PKG_HASH:=5410474b23552016220d04aa181903cb50ae988f29e99cb03f3e2de86a109be4 +PKG_HASH:=d96761e47a69f8214c5fbd251d844f37961b14c3e437b63a15cc64f5b8cba2f0 PKG_MAINTAINER:=Lucian CRISTIAN PKG_LICENSE:=GPL-2.0-or-later @@ -90,7 +90,8 @@ define Package/open-iscsi/install $(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/iscsi/iscsid.conf $(1)/etc/iscsi/ $(INSTALL_BIN) ./files/iscsi* $(1)/usr/sbin/ $(INSTALL_BIN) ./files/open-iscsi $(1)/etc/init.d/ - $(INSTALL_BIN) $(PKG_INSTALL_DIR)/sbin/iscsi{adm,d,-iname,uio} $(1)/sbin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/sbin/iscsi{adm,d,-iname} $(1)/sbin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/iscsiuio $(1)/usr/sbin/ $(CP) $(PKG_INSTALL_DIR)/usr/lib/libopeniscsiusr.so* $(1)/usr/lib/ endef diff --git a/net/open-iscsi/patches/0002-idmb_rec_write-check-for-tpgt-first.patch b/net/open-iscsi/patches/0002-idmb_rec_write-check-for-tpgt-first.patch index 7ed1b38b4d..b84692a92a 100644 --- a/net/open-iscsi/patches/0002-idmb_rec_write-check-for-tpgt-first.patch +++ b/net/open-iscsi/patches/0002-idmb_rec_write-check-for-tpgt-first.patch @@ -1,4 +1,4 @@ -From 97071360caa6868c21a161047ed471790c405efb Mon Sep 17 00:00:00 2001 +From 45878c9461298c9da68a626d990dc4ef99e01baa Mon Sep 17 00:00:00 2001 From: Chris Leech Date: Tue, 13 Aug 2013 10:59:44 -0700 Subject: [PATCH] idmb_rec_write, check for tpgt first @@ -12,7 +12,7 @@ for splitting it up. --- a/usr/idbm.c +++ b/usr/idbm.c -@@ -2178,6 +2178,10 @@ static int idbm_rec_write(node_rec_t *re +@@ -2200,6 +2200,10 @@ static int idbm_rec_write(node_rec_t *re goto free_portal; } @@ -23,7 +23,7 @@ for splitting it up. rc = stat(portal, &statb); if (rc) { rc = 0; -@@ -2186,23 +2190,11 @@ static int idbm_rec_write(node_rec_t *re +@@ -2208,23 +2212,11 @@ static int idbm_rec_write(node_rec_t *re * set the tgpt. In new versions you must pass all the info in * from the start */ diff --git a/net/open-iscsi/patches/0003-idbm_rec_write-seperate-old-and-new-style-writes.patch b/net/open-iscsi/patches/0003-idbm_rec_write-seperate-old-and-new-style-writes.patch index 6fb085b633..7a540c1486 100644 --- a/net/open-iscsi/patches/0003-idbm_rec_write-seperate-old-and-new-style-writes.patch +++ b/net/open-iscsi/patches/0003-idbm_rec_write-seperate-old-and-new-style-writes.patch @@ -1,7 +1,7 @@ -From 4c6e7c0fcc6da66cf81c0714bf907762194eedf2 Mon Sep 17 00:00:00 2001 +From 0bb22b50dbaa7ac44e8eb244a73a66efbd98632c Mon Sep 17 00:00:00 2001 From: Chris Leech Date: Tue, 13 Aug 2013 11:34:31 -0700 -Subject: [PATCH] idbm_rec_write, seperate old and new style writes +Subject: [PATCH 1/1] idbm_rec_write, seperate old and new style writes Duplicates a small bit of code, but easier to understand and extened. --- @@ -10,7 +10,7 @@ Duplicates a small bit of code, but easier to understand and extened. --- a/usr/idbm.c +++ b/usr/idbm.c -@@ -2130,12 +2130,7 @@ mkdir_portal: +@@ -2152,12 +2152,7 @@ mkdir_portal: return f; } @@ -24,13 +24,13 @@ Duplicates a small bit of code, but easier to understand and extened. { struct stat statb; FILE *f; -@@ -2148,39 +2143,8 @@ static int idbm_rec_write(node_rec_t *re +@@ -2170,39 +2165,8 @@ static int idbm_rec_write(node_rec_t *re return ISCSI_ERR_NOMEM; } - snprintf(portal, PATH_MAX, "%s", NODE_CONFIG_DIR); - if (access(portal, F_OK) != 0) { -- if (mkdir(portal, 0660) != 0) { +- if (mkdir(portal, 0770) != 0) { - log_error("Could not make %s: %s", portal, - strerror(errno)); - rc = ISCSI_ERR_IDBM; @@ -40,7 +40,7 @@ Duplicates a small bit of code, but easier to understand and extened. - - snprintf(portal, PATH_MAX, "%s/%s", NODE_CONFIG_DIR, rec->name); - if (access(portal, F_OK) != 0) { -- if (mkdir(portal, 0660) != 0) { +- if (mkdir(portal, 0770) != 0) { - log_error("Could not make %s: %s", portal, - strerror(errno)); - rc = ISCSI_ERR_IDBM; @@ -64,7 +64,7 @@ Duplicates a small bit of code, but easier to understand and extened. rc = stat(portal, &statb); if (rc) { -@@ -2201,11 +2165,11 @@ static int idbm_rec_write(node_rec_t *re +@@ -2223,11 +2187,11 @@ static int idbm_rec_write(node_rec_t *re log_error("Could not convert %s: %s", portal, strerror(errno)); rc = ISCSI_ERR_IDBM; @@ -78,7 +78,7 @@ Duplicates a small bit of code, but easier to understand and extened. } mkdir_portal: -@@ -2216,24 +2180,103 @@ mkdir_portal: +@@ -2238,24 +2202,103 @@ mkdir_portal: log_error("Could not make dir %s: %s", portal, strerror(errno)); rc = ISCSI_ERR_IDBM; diff --git a/net/open-iscsi/patches/0004-idbw_rec_write-pick-tpgt-from-existing-record.patch b/net/open-iscsi/patches/0004-idbw_rec_write-pick-tpgt-from-existing-record.patch deleted file mode 100644 index f9ae854b85..0000000000 --- a/net/open-iscsi/patches/0004-idbw_rec_write-pick-tpgt-from-existing-record.patch +++ /dev/null @@ -1,93 +0,0 @@ -From 351ee477f713730d1c53cf26b6fb87706d268a5f Mon Sep 17 00:00:00 2001 -From: Chris Leech -Date: Tue, 13 Aug 2013 12:39:07 -0700 -Subject: [PATCH 1/1] idbw_rec_write, pick tpgt from existing record - -On a static add (-m node -o new) without a user specified tpgt, looks -for existing new style records with tpgt before creating an old style -record without. If one exists, take the tpgt from it an write an -updated new style record instead. ---- - usr/idbm.c | 40 ++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 40 insertions(+) - ---- a/usr/idbm.c -+++ b/usr/idbm.c -@@ -28,6 +28,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -44,6 +45,10 @@ - #include "fw_context.h" - #include "iscsi_err.h" - -+#ifndef GLOB_ONLYDIR -+#define GLOB_ONLYDIR 0x100 -+#endif -+ - #define IDBM_HIDE 0 /* Hide parameter when print. */ - #define IDBM_SHOW 1 /* Show parameter when print. */ - #define IDBM_MASKED 2 /* Show "stars" instead of real value when print */ -@@ -203,6 +208,8 @@ static struct int_list_tbl { - { "SHA3-256", AUTH_CHAP_ALG_SHA3_256 }, - }; - -+static int idbm_remove_disc_to_node_link(node_rec_t *rec, char *portal); -+ - static void - idbm_recinfo_discovery(discovery_rec_t *r, recinfo_t *ri) - { -@@ -2207,12 +2214,49 @@ static int idbm_rec_write_old(node_rec_t - FILE *f; - char *portal; - int rc = 0; -+ glob_t globbuf; -+ size_t i; -+ int tpgt = PORTAL_GROUP_TAG_UNKNOWN; - - portal = malloc(PATH_MAX); - if (!portal) { - log_error("Could not alloc portal"); - return ISCSI_ERR_NOMEM; - } -+ -+ /* check for newer portal dir with tpgt */ -+ snprintf(portal, PATH_MAX, "%s/%s/%s,%d,*", NODE_CONFIG_DIR, -+ rec->name, rec->conn[0].address, rec->conn[0].port); -+ rc = glob(portal, GLOB_ONLYDIR, NULL, &globbuf); -+ if (!rc) { -+ if (globbuf.gl_pathc > 1) -+ log_warning("multiple tpg records for portal " -+ "%s/%s:%d found", rec->name, -+ rec->conn[0].address, rec->conn[0].port); -+ /* set pattern for sscanf matching of tpgt */ -+ snprintf(portal, PATH_MAX, "%s/%s/%s,%d,%%u", NODE_CONFIG_DIR, -+ rec->name, rec->conn[0].address, rec->conn[0].port); -+ for (i = 0; i < globbuf.gl_pathc; i++) { -+ rc = sscanf(globbuf.gl_pathv[i], portal, &tpgt); -+ if (rc == 1) -+ break; -+ } -+ if (tpgt == PORTAL_GROUP_TAG_UNKNOWN) -+ log_warning("glob match on existing records, " -+ "but no valid tpgt found"); -+ } -+ globfree(&globbuf); -+ rc = 0; -+ -+ /* if a tpgt was selected from an old record, write entry in new format */ -+ if (tpgt != PORTAL_GROUP_TAG_UNKNOWN) { -+ log_warning("using tpgt %u from existing record", tpgt); -+ rec->tpgt = tpgt; -+ rc = idbm_remove_disc_to_node_link(rec, portal); -+ free(portal); -+ return idbm_rec_write_new(rec); -+ } -+ - snprintf(portal, PATH_MAX, "%s/%s/%s,%d", NODE_CONFIG_DIR, - rec->name, rec->conn[0].address, rec->conn[0].port); - diff --git a/net/open-iscsi/patches/0015-remove-the-offload-boot-supported-ifdef.patch b/net/open-iscsi/patches/0015-remove-the-offload-boot-supported-ifdef.patch index e97890e172..ee2c33ea78 100644 --- a/net/open-iscsi/patches/0015-remove-the-offload-boot-supported-ifdef.patch +++ b/net/open-iscsi/patches/0015-remove-the-offload-boot-supported-ifdef.patch @@ -1,4 +1,4 @@ -From d0689253c9e2eb78fc5296adb109aba4d35a13fd Mon Sep 17 00:00:00 2001 +From d410fe4b6eb2347f2160b8aaab24a639de99c23c Mon Sep 17 00:00:00 2001 From: Chris Leech Date: Mon, 19 Nov 2012 17:09:24 -0800 Subject: [PATCH] remove the offload boot supported ifdef @@ -9,7 +9,7 @@ Subject: [PATCH] remove the offload boot supported ifdef --- a/usr/iface.c +++ b/usr/iface.c -@@ -998,6 +998,7 @@ int iface_setup_from_boot_context(struct +@@ -1031,6 +1031,7 @@ int iface_setup_from_boot_context(struct { struct iscsi_transport *t = NULL; uint32_t hostno; @@ -17,7 +17,7 @@ Subject: [PATCH] remove the offload boot supported ifdef if (strlen(context->initiatorname)) strlcpy(iface->iname, context->initiatorname, -@@ -1011,10 +1012,7 @@ int iface_setup_from_boot_context(struct +@@ -1044,10 +1045,7 @@ int iface_setup_from_boot_context(struct return 0; } } else if (strlen(context->iface)) { @@ -28,7 +28,7 @@ Subject: [PATCH] remove the offload boot supported ifdef memset(transport_name, 0, ISCSI_TRANSPORT_NAME_MAXLEN); /* make sure offload driver is loaded */ -@@ -1040,9 +1038,6 @@ int iface_setup_from_boot_context(struct +@@ -1073,9 +1071,6 @@ int iface_setup_from_boot_context(struct } strlcpy(iface->netdev, context->iface, sizeof(iface->netdev)); diff --git a/net/open-iscsi/patches/0019-Coverity-scan-fixes.patch b/net/open-iscsi/patches/0019-Coverity-scan-fixes.patch index d542c23d80..bace8c15d4 100644 --- a/net/open-iscsi/patches/0019-Coverity-scan-fixes.patch +++ b/net/open-iscsi/patches/0019-Coverity-scan-fixes.patch @@ -1,4 +1,4 @@ -From ad8c3353b8e482575ff2208182290cf35b624dde Mon Sep 17 00:00:00 2001 +From 6de09f82e86db0500a59017a473c944877a80516 Mon Sep 17 00:00:00 2001 From: Chris Leech Date: Wed, 5 Jun 2019 09:08:39 -0700 Subject: [PATCH 1/1] Coverity scan fixes @@ -8,9 +8,8 @@ Subject: [PATCH 1/1] Coverity scan fixes iscsiuio/src/unix/main.c | 3 +++ libopeniscsiusr/idbm.c | 11 +++++------ usr/idbm.c | 10 ++++------ - usr/initiator.c | 2 +- usr/iscsid.c | 2 +- - 6 files changed, 15 insertions(+), 15 deletions(-) + 5 files changed, 14 insertions(+), 14 deletions(-) --- a/iscsiuio/src/unix/libs/qedi.c +++ b/iscsiuio/src/unix/libs/qedi.c @@ -42,12 +41,12 @@ Subject: [PATCH 1/1] Coverity scan fixes } - if (access(LOCK_DIR, F_OK) != 0) { -- if (mkdir(LOCK_DIR, 0660) != 0) { +- if (mkdir(LOCK_DIR, 0770) != 0) { - _error(ctx, "Could not open %s: %d %s", LOCK_DIR, errno, - _strerror(errno, strerr_buff)); - return LIBISCSI_ERR_IDBM; - } -+ if (((mkdir(LOCK_DIR, 0660) != 0) && (errno != EEXIST)) || ++ if (((mkdir(LOCK_DIR, 0770) != 0) && (errno != EEXIST)) || + (access(LOCK_DIR, F_OK) != 0)) { + _error(ctx, "Could not open %s: %d %s", LOCK_DIR, errno, + _strerror(errno, strerr_buff)); @@ -57,17 +56,17 @@ Subject: [PATCH 1/1] Coverity scan fixes fd = open(LOCK_FILE, O_RDWR | O_CREAT, 0666); --- a/usr/idbm.c +++ b/usr/idbm.c -@@ -1439,12 +1439,10 @@ int idbm_lock(void) +@@ -1454,12 +1454,10 @@ int idbm_lock(void) return 0; } - if (access(LOCK_DIR, F_OK) != 0) { -- if (mkdir(LOCK_DIR, 0660) != 0) { +- if (mkdir(LOCK_DIR, 0770) != 0) { - log_error("Could not open %s: %s", LOCK_DIR, - strerror(errno)); - return ISCSI_ERR_IDBM; - } -+ if (((mkdir(LOCK_DIR, 0660) != 0) && (errno != EEXIST)) || ++ if (((mkdir(LOCK_DIR, 0770) != 0) && (errno != EEXIST)) || + (access(LOCK_DIR, F_OK) != 0)) { + log_error("Could not open %s: %s", LOCK_DIR, strerror(errno)); + return ISCSI_ERR_IDBM; @@ -76,7 +75,7 @@ Subject: [PATCH 1/1] Coverity scan fixes fd = open(LOCK_FILE, O_RDWR | O_CREAT, 0666); --- a/usr/iscsid.c +++ b/usr/iscsid.c -@@ -495,8 +495,8 @@ int main(int argc, char *argv[]) +@@ -518,8 +518,8 @@ int main(int argc, char *argv[]) log_close(log_pid); exit(ISCSI_ERR); } @@ -86,14 +85,3 @@ Subject: [PATCH 1/1] Coverity scan fixes if ((control_fd = ipc->ctldev_open()) < 0) { log_close(log_pid); ---- a/usr/initiator.c -+++ b/usr/initiator.c -@@ -580,7 +580,7 @@ __session_conn_reopen(iscsi_conn_t *conn - int redirected) - { - iscsi_session_t *session = conn->session; -- uint32_t delay; -+ uint32_t delay = 0; - - log_debug(1, "re-opening session %d (reopen_cnt %d)", session->id, - session->reopen_cnt); diff --git a/net/open-iscsi/patches/0998-path_adjustments.patch b/net/open-iscsi/patches/0998-path_adjustments.patch new file mode 100644 index 0000000000..ceda3be595 --- /dev/null +++ b/net/open-iscsi/patches/0998-path_adjustments.patch @@ -0,0 +1,79 @@ +--- a/include/iscsi_if.h ++++ b/include/iscsi_if.h +@@ -36,6 +36,10 @@ + * to be in sync. + */ + ++#ifndef ISCSI_DB_ROOT ++#define ISCSI_DB_ROOT "/etc/iscsi" ++#endif ++ + #define ISCSI_NL_GRP_ISCSID 1 + #define ISCSI_NL_GRP_UIP 2 + +--- a/etc/Makefile ++++ b/etc/Makefile +@@ -11,7 +11,7 @@ prefix = /usr + DESTDIR ?= + SBINDIR ?= /sbin + +-ISCSI_INAME ?= $(TOPDIR)/utils/iscsi-iname ++ISCSI_INAME ?= ../utils/iscsi-iname + + systemddir ?= $(prefix)/lib/systemd + etcdir = /etc +@@ -19,7 +19,7 @@ initddir ?= $(etcdir)/init.d + + HOMEDIR ?= $(etcdir)/iscsi + +-SED = /usr/bin/sed ++SED ?= $(STAGING_DIR_HOST)/bin/sed + INSTALL = install + + SYSTEMD_SOURCE_FILES = iscsid.socket iscsiuio.socket +--- a/usr/Makefile ++++ b/usr/Makefile +@@ -46,10 +46,10 @@ PKG_CONFIG ?= /usr/bin/pkg-config + CFLAGS ?= -O2 -g + WARNFLAGS ?= -Wall -Wextra -Werror -Wstrict-prototypes -fno-common + CFLAGS += $(WARNFLAGS) -I../include -I. -D_GNU_SOURCE \ +- -I$(TOPDIR)/libopeniscsiusr ++ -I../libopeniscsiusr + CFLAGS += $(shell $(PKG_CONFIG) --cflags libkmod) + CFLAGS += $(shell $(PKG_CONFIG) --cflags libsystemd) +-ISCSI_LIB = -L$(TOPDIR)/libopeniscsiusr -lopeniscsiusr ++ISCSI_LIB = -L../libopeniscsiusr -lopeniscsiusr + LDFLAGS += $(shell $(PKG_CONFIG) --libs libkmod) + ifeq ($(NO_SYSTEMD),) + LDFLAGS += $(shell $(PKG_CONFIG) --libs libsystemd) +@@ -67,7 +67,7 @@ ISCSIADM_OBJS = iscsiadm.o session_mgmt. + ISCSISTART_OBJS = iscsistart.o statics.o + + # libc compat files +-SYSDEPS_DIR = $(TOPDIR)/utils/sysdeps ++SYSDEPS_DIR = ../utils/sysdeps + SYSDEPS_OBJS = $(SYSDEPS_DIR)/sysdeps.o + # sources shared between iscsid, iscsiadm and iscsistart + ISCSI_LIB_OBJS = iscsi_util.o io.o auth.o iscsi_timer.o login.o log.o \ +--- a/utils/Makefile ++++ b/utils/Makefile +@@ -7,7 +7,7 @@ + # from the top-level make file. + # + +-SED = /usr/bin/sed ++SED ?= $(STAGING_DIR_HOST)/bin/sed + INSTALL = install + CHMOD = chmod + +--- a/doc/Makefile ++++ b/doc/Makefile +@@ -7,7 +7,7 @@ ifeq ($(TOPDIR),) + TOPDIR = .. + endif + +-SED = /usr/bin/sed ++SED = $(STAGING_DIR_HOST)/bin/sed + INSTALL = install + + DESTDIR ?= -- 2.30.2