open-iscsi: update to 2.1.10

Use meson. Upstream prefers it.

Remove upstreamed patches.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
Rosen Penev
2025-01-01 19:27:46 -08:00
parent fbcfd96e1b
commit ee5f5d85e8
6 changed files with 11 additions and 470 deletions

View File

@@ -4,12 +4,13 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=open-iscsi
PKG_VERSION:=2.1.7
PKG_VERSION:=2.1.10
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:=d96761e47a69f8214c5fbd251d844f37961b14c3e437b63a15cc64f5b8cba2f0
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/open-iscsi/open-iscsi
PKG_SOURCE_VERSION:=$(PKG_VERSION)
PKG_MIRROR_HASH:=934cfe18caf5de9a85e394d10731ee9fd104b47cebc6da05b5fed8b117acb3db
PKG_MAINTAINER:=Lucian CRISTIAN <lucian.cristian@gmail.com>
PKG_LICENSE:=GPL-2.0-or-later
@@ -21,6 +22,7 @@ PKG_INSTALL:=1
PKG_BUILD_FLAGS:=lto
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/meson.mk
define Package/open-iscsi
SECTION:=net
@@ -44,37 +46,8 @@ define Build/Prepare
$(SED)'s,/run,/var/run,g' $(PKG_BUILD_DIR)/usr/initiator.h
endef
define Build/Configure
$(call Build/Configure/Default)
(cd $(PKG_BUILD_DIR)/iscsiuio/; \
autoreconf --install; \
./configure \
--target=$(GNU_TARGET_NAME) \
--host=$(GNU_TARGET_NAME) \
--build=$(GNU_HOST_NAME) \
--prefix=/usr \
LIB_DIR=/usr/lib \
CC="$(TARGET_CC)" \
CFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS)" \
)
endef
TARGET_CFLAGS += \
$(FPIC) \
-D_GNU_SOURCE -DNO_SYSTEMD
TARGET_LDFLAGS += -lkmod
MAKE_FLAGS += \
CC="$(TARGET_CC)" \
CFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS) \
-I$(PKG_BUILD_DIR)/include \
-I$(PKG_BUILD_DIR)/usr \
-I$(PKG_BUILD_DIR)/libopeniscsiusr" \
LDFLAGS="$(TARGET_LDFLAGS) $(EXTRA_LDFLAGS) \
-L$(PKG_BUILD_DIR)/libopeniscsiusr" \
PREFIX=/usr \
LIB_DIR=/usr/lib
MESON_ARGS += \
-Dno_systemd=true
define Package/open-iscsi/conffiles
/etc/iscsi/
@@ -88,12 +61,11 @@ endef
define Package/open-iscsi/install
$(INSTALL_DIR) \
$(1)/etc/init.d $(1)/etc/iscsi \
$(1)/usr/lib $(1)/sbin $(1)/usr/sbin
$(1)/usr/lib $(1)/usr/sbin
$(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} $(1)/sbin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/iscsiuio $(1)/usr/sbin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/iscsi{adm,d,-iname,uio} $(1)/usr/sbin/
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libopeniscsiusr.so* $(1)/usr/lib/
endef

View File

@@ -1,50 +0,0 @@
From 45878c9461298c9da68a626d990dc4ef99e01baa Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Tue, 13 Aug 2013 10:59:44 -0700
Subject: [PATCH] idmb_rec_write, check for tpgt first
Factor out the check for a tpgt to a single place, before going crazy on
the rec files. Makes flow of this function easier to follow, and preps
for splitting it up.
---
usr/idbm.c | 18 +++++-------------
1 file changed, 5 insertions(+), 13 deletions(-)
--- a/usr/idbm.c
+++ b/usr/idbm.c
@@ -2200,6 +2200,10 @@ static int idbm_rec_write(node_rec_t *re
goto free_portal;
}
+ if (rec->tpgt == PORTAL_GROUP_TAG_UNKNOWN)
+ /* drop down to old style portal as config */
+ goto open_conf;
+
rc = stat(portal, &statb);
if (rc) {
rc = 0;
@@ -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
*/
- if (rec->tpgt == PORTAL_GROUP_TAG_UNKNOWN)
- /* drop down to old style portal as config */
- goto open_conf;
- else
- goto mkdir_portal;
+ goto mkdir_portal;
}
if (!S_ISDIR(statb.st_mode)) {
/*
- * older iscsiadm versions had you create the config then set
- * set the tgpt. In new versions you must pass all the info in
- * from the start
- */
- if (rec->tpgt == PORTAL_GROUP_TAG_UNKNOWN)
- /* drop down to old style portal as config */
- goto open_conf;
- /*
* Old style portal as a file, but with tpgt. Let's update it.
*/
if (unlink(portal)) {

View File

@@ -1,188 +0,0 @@
From 0bb22b50dbaa7ac44e8eb244a73a66efbd98632c Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Tue, 13 Aug 2013 11:34:31 -0700
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.
---
usr/idbm.c | 129 +++++++++++++++++++++++++++++++++++------------------
1 file changed, 86 insertions(+), 43 deletions(-)
--- a/usr/idbm.c
+++ b/usr/idbm.c
@@ -2152,12 +2152,7 @@ mkdir_portal:
return f;
}
-/*
- * When the disable_lock param is true, the idbm_lock/idbm_unlock needs
- * to be holt by the caller, this will avoid overwriting each other in
- * case of updating(read-modify-write) the recs in parallel.
- */
-static int idbm_rec_write(node_rec_t *rec, bool disable_lock)
+static int idbm_rec_write_new(node_rec_t *rec)
{
struct stat statb;
FILE *f;
@@ -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, 0770) != 0) {
- log_error("Could not make %s: %s", portal,
- strerror(errno));
- rc = ISCSI_ERR_IDBM;
- goto free_portal;
- }
- }
-
- snprintf(portal, PATH_MAX, "%s/%s", NODE_CONFIG_DIR, rec->name);
- if (access(portal, F_OK) != 0) {
- if (mkdir(portal, 0770) != 0) {
- log_error("Could not make %s: %s", portal,
- strerror(errno));
- rc = ISCSI_ERR_IDBM;
- goto free_portal;
- }
- }
-
snprintf(portal, PATH_MAX, "%s/%s/%s,%d", NODE_CONFIG_DIR,
rec->name, rec->conn[0].address, rec->conn[0].port);
- log_debug(5, "Looking for config file %s", portal);
-
- if (!disable_lock) {
- rc = idbm_lock();
- if (rc)
- goto free_portal;
- }
-
- if (rec->tpgt == PORTAL_GROUP_TAG_UNKNOWN)
- /* drop down to old style portal as config */
- goto open_conf;
rc = stat(portal, &statb);
if (rc) {
@@ -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;
- goto unlock;
+ goto free_portal;
}
} else {
rc = ISCSI_ERR_INVAL;
- goto unlock;
+ goto free_portal;
}
mkdir_portal:
@@ -2238,24 +2202,103 @@ mkdir_portal:
log_error("Could not make dir %s: %s",
portal, strerror(errno));
rc = ISCSI_ERR_IDBM;
- goto unlock;
+ goto free_portal;
}
}
snprintf(portal, PATH_MAX, "%s/%s/%s,%d,%d/%s", NODE_CONFIG_DIR,
rec->name, rec->conn[0].address, rec->conn[0].port, rec->tpgt,
rec->iface.name);
-open_conf:
+
f = fopen(portal, "w");
if (!f) {
log_error("Could not open %s: %s", portal, strerror(errno));
rc = ISCSI_ERR_IDBM;
- goto unlock;
+ goto free_portal;
+ }
+
+ idbm_print(IDBM_PRINT_TYPE_NODE, rec, 1, f);
+ fclose(f);
+free_portal:
+ free(portal);
+ return rc;
+}
+
+static int idbm_rec_write_old(node_rec_t *rec)
+{
+ FILE *f;
+ char *portal;
+ int rc = 0;
+
+ portal = malloc(PATH_MAX);
+ if (!portal) {
+ log_error("Could not alloc portal");
+ return ISCSI_ERR_NOMEM;
}
+ snprintf(portal, PATH_MAX, "%s/%s/%s,%d", NODE_CONFIG_DIR,
+ rec->name, rec->conn[0].address, rec->conn[0].port);
+ f = fopen(portal, "w");
+ if (!f) {
+ log_error("Could not open %s: %sd", portal, strerror(errno));
+ rc = ISCSI_ERR_IDBM;
+ goto free_portal;
+ }
idbm_print(IDBM_PRINT_TYPE_NODE, rec, 1, f);
fclose(f);
-unlock:
+free_portal:
+ free(portal);
+ return rc;
+}
+
+/*
+ * When the disable_lock param is true, the idbm_lock/idbm_unlock needs
+ * to be holt by the caller, this will avoid overwriting each other in
+ * case of updating(read-modify-write) the recs in parallel.
+ */
+static int idbm_rec_write(node_rec_t *rec, bool disable_lock)
+{
+ char *portal;
+ int rc = 0;
+
+ portal = malloc(PATH_MAX);
+ if (!portal) {
+ log_error("Could not alloc portal");
+ return ISCSI_ERR_NOMEM;
+ }
+
+ snprintf(portal, PATH_MAX, "%s", NODE_CONFIG_DIR);
+ if (access(portal, F_OK) != 0) {
+ if (mkdir(portal, 0660) != 0) {
+ log_error("Could not make %s: %s", portal,
+ strerror(errno));
+ rc = ISCSI_ERR_IDBM;
+ goto free_portal;
+ }
+ }
+
+ snprintf(portal, PATH_MAX, "%s/%s", NODE_CONFIG_DIR, rec->name);
+ if (access(portal, F_OK) != 0) {
+ if (mkdir(portal, 0660) != 0) {
+ log_error("Could not make %s: %s", portal,
+ strerror(errno));
+ rc = ISCSI_ERR_IDBM;
+ goto free_portal;
+ }
+ }
+
+ if (!disable_lock) {
+ rc = idbm_lock();
+ if (rc)
+ goto free_portal;
+ }
+
+ if (rec->tpgt == PORTAL_GROUP_TAG_UNKNOWN)
+ /* old style portal as config */
+ rc = idbm_rec_write_old(rec);
+ else
+ rc = idbm_rec_write_new(rec);
+
if (!disable_lock)
idbm_unlock();
free_portal:

View File

@@ -1,40 +0,0 @@
From d410fe4b6eb2347f2160b8aaab24a639de99c23c Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Mon, 19 Nov 2012 17:09:24 -0800
Subject: [PATCH] remove the offload boot supported ifdef
---
usr/iface.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
--- a/usr/iface.c
+++ b/usr/iface.c
@@ -1031,6 +1031,7 @@ int iface_setup_from_boot_context(struct
{
struct iscsi_transport *t = NULL;
uint32_t hostno;
+ int rc;
if (strlen(context->initiatorname))
strlcpy(iface->iname, context->initiatorname,
@@ -1044,10 +1045,7 @@ int iface_setup_from_boot_context(struct
return 0;
}
} else if (strlen(context->iface)) {
-/* this ifdef is only temp until distros and firmwares are updated */
-#ifdef OFFLOAD_BOOT_SUPPORTED
char transport_name[ISCSI_TRANSPORT_NAME_MAXLEN];
- int rc;
memset(transport_name, 0, ISCSI_TRANSPORT_NAME_MAXLEN);
/* make sure offload driver is loaded */
@@ -1073,9 +1071,6 @@ int iface_setup_from_boot_context(struct
}
strlcpy(iface->netdev, context->iface, sizeof(iface->netdev));
-#else
- return 0;
-#endif
} else
return 0;

View File

@@ -1,87 +0,0 @@
From 6de09f82e86db0500a59017a473c944877a80516 Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Wed, 5 Jun 2019 09:08:39 -0700
Subject: [PATCH 1/1] Coverity scan fixes
---
iscsiuio/src/unix/libs/qedi.c | 2 +-
iscsiuio/src/unix/main.c | 3 +++
libopeniscsiusr/idbm.c | 11 +++++------
usr/idbm.c | 10 ++++------
usr/iscsid.c | 2 +-
5 files changed, 14 insertions(+), 14 deletions(-)
--- a/iscsiuio/src/unix/libs/qedi.c
+++ b/iscsiuio/src/unix/libs/qedi.c
@@ -1030,7 +1030,7 @@ static int qedi_read(nic_t *nic, packet_
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",
+ LOG_DEBUG(PFX "%s: sw_con %d bd_cons %d num BD %lu",
nic->log_name, sw_cons, bd_cons, QEDI_NUM_RX_BD);
if (bd_cons != bd_prod) {
--- a/iscsiuio/src/unix/main.c
+++ b/iscsiuio/src/unix/main.c
@@ -391,6 +391,9 @@ int main(int argc, char *argv[])
sigaddset(&set, SIGTERM);
sigaddset(&set, SIGUSR1);
rc = pthread_sigmask(SIG_SETMASK, &set, NULL);
+ if (rc != 0) {
+ LOG_ERR("Failed to set thread signal mask");
+ }
/* Spin off the signal handling thread */
pthread_attr_init(&attr);
--- a/libopeniscsiusr/idbm.c
+++ b/libopeniscsiusr/idbm.c
@@ -321,12 +321,11 @@ int _idbm_lock(struct iscsi_context *ctx
return 0;
}
- if (access(LOCK_DIR, F_OK) != 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, 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));
+ return LIBISCSI_ERR_IDBM;
}
fd = open(LOCK_FILE, O_RDWR | O_CREAT, 0666);
--- a/usr/idbm.c
+++ b/usr/idbm.c
@@ -1454,12 +1454,10 @@ int idbm_lock(void)
return 0;
}
- if (access(LOCK_DIR, F_OK) != 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, 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;
}
fd = open(LOCK_FILE, O_RDWR | O_CREAT, 0666);
--- a/usr/iscsid.c
+++ b/usr/iscsid.c
@@ -518,8 +518,8 @@ int main(int argc, char *argv[])
log_close(log_pid);
exit(ISCSI_ERR);
}
+ close(fd);
}
- close(fd);
if ((control_fd = ipc->ctldev_open()) < 0) {
log_close(log_pid);

View File

@@ -1,8 +1,8 @@
--- a/include/iscsi_if.h
+++ b/include/iscsi_if.h
@@ -36,6 +36,10 @@
* to be in sync.
*/
#endif
+#ifndef ISCSI_DB_ROOT
+#define ISCSI_DB_ROOT "/etc/iscsi"
@@ -11,69 +11,3 @@
#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 ?=