!21 update open-iscsi version to 2.1.1-1

Merge pull request !21 from wguanghao/develop
This commit is contained in:
openeuler-ci-bot 2020-07-17 09:04:55 +08:00 committed by Gitee
commit 71438285b7
52 changed files with 497 additions and 1139 deletions

View File

@ -1,32 +0,0 @@
From c388d9adae20b835731ac98776082c884617467d Mon Sep 17 00:00:00 2001
From: Lee Duncan <lduncan@suse.com>
Date: Thu, 30 Aug 2018 15:58:10 -0700
Subject: [PATCH 45/91] Plugging a memory leak from discovery.
During discovery the function get_op_params_text_keys()
can allocate a target_alias, but this is never freed.
Discovered-by: zhangzujian.7@gmail.com
---
usr/discovery.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/usr/discovery.c b/usr/discovery.c
index 8001af6..2147deb 100644
--- a/usr/discovery.c
+++ b/usr/discovery.c
@@ -1055,6 +1055,11 @@ static void iscsi_destroy_session(struct iscsi_session *session)
log_error("Could not safely destroy session %d (err %d)",
session->id, rc);
done:
+ if (session->target_alias) {
+ free(session->target_alias);
+ session->target_alias = NULL;
+ }
+
if (conn->socket_fd >= 0) {
ipc->ctldev_close();
conn->socket_fd = -1;
--
1.8.3.1

View File

@ -1,28 +0,0 @@
From 8bf04a094e572c56d4f8bd30ff064c84c75a0247 Mon Sep 17 00:00:00 2001
From: Lee Duncan <lduncan@suse.com>
Date: Tue, 25 Sep 2018 09:53:55 -0700
Subject: [PATCH 54/91] Fix bug in error message when reading sysfs numbers.
The message printed when ENOENT was returned for
a number-type sysfs value was missing the attribute
name parameter.
---
libopeniscsiusr/sysfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libopeniscsiusr/sysfs.c b/libopeniscsiusr/sysfs.c
index c4f89a3..5e6532e 100644
--- a/libopeniscsiusr/sysfs.c
+++ b/libopeniscsiusr/sysfs.c
@@ -237,7 +237,7 @@ static int iscsi_sysfs_prop_get_ll(struct iscsi_context *ctx,
"Failed to read '%s': "
"File '%s' does not exists, using ",
"default value %lld",
- file_path, default_value);
+ prop_name, file_path, default_value);
*val = default_value;
goto out;
}
--
1.8.3.1

View File

@ -1,4 +1,4 @@
From 2fb5d2dbcfdc052881749e22268c06b1402257a7 Mon Sep 17 00:00:00 2001
From 50b9f68b960360eab065b63d6660b1f70f227c13 Mon Sep 17 00:00:00 2001
From: pengyeqing <pengyeqing@huawei.com>
Date: Sat, 26 Jan 2019 22:09:24 +0800
Subject: [PATCH] iscsi-initiator-utils: change iscsi iqn default value
@ -7,35 +7,38 @@ reason:change iscsi iqn default value
Signed-off-by: pengyeqing <pengyeqing@huawei.com>
---
doc/iscsi-iname.8 | 2 +-
doc/iscsi-iname.8 | 4 ++--
utils/iscsi-iname.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/doc/iscsi-iname.8 b/doc/iscsi-iname.8
index a55d666d1af3..dd77ed9f3165 100644
index 6a413f6..34c47b4 100644
--- a/doc/iscsi-iname.8
+++ b/doc/iscsi-iname.8
@@ -14,7 +14,7 @@ generates a unique iSCSI node name on every invocation.
@@ -14,8 +14,8 @@ generates a unique iSCSI node name on every invocation.
Display help
.TP
.BI [-p=]\fIprefix\fP
-Use the prefix passed in instead of the default "iqn.2005-03.org.open-iscsi"
-Use the prefix passed in instead of the default "iqn.2016-04.com.open-iscsi"
-
+Use the prefix passed in instead of the default "iqn.2012-01.com.openeuler"
+
.SH AUTHORS
Open-iSCSI project <http://www.open-iscsi.com/>
.br
diff --git a/utils/iscsi-iname.c b/utils/iscsi-iname.c
index cb2f6c8..926bf3a 100644
index da850dc..08161f4 100644
--- a/utils/iscsi-iname.c
+++ b/utils/iscsi-iname.c
@@ -73,7 +73,7 @@ main(int argc, char *argv[])
@@ -80,7 +80,7 @@ main(int argc, char *argv[])
exit(0);
}
} else {
- prefix = "iqn.2005-03.org.open-iscsi";
- prefix = "iqn.2016-04.com.open-iscsi";
+ prefix = "iqn.2012-01.com.openeuler";
}
/* try to feed some entropy from the pool to MD5 in order to get
--
1.8.3.1

View File

@ -1,37 +0,0 @@
From a37c4295a2e3f8712921a52db0d35d3506efb19b Mon Sep 17 00:00:00 2001
From: Lee Duncan <lduncan@suse.com>
Date: Thu, 4 Oct 2018 16:26:26 -0700
Subject: [PATCH 60/91] Do not allow multiple sessions when nr_sessions=1
If a request is made to login to a target, creating
a session, then another request is submitted so quickly
that the first one has not completed, both requests
can succeed, despite having nr_sessions=1 configured.
Only allow multiple login requests if nr_sessions is
greater than 1.
---
usr/session_mgmt.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/usr/session_mgmt.c b/usr/session_mgmt.c
index 596085b..0500f15 100644
--- a/usr/session_mgmt.c
+++ b/usr/session_mgmt.c
@@ -189,9 +189,11 @@ int iscsi_login_portal(void *data, struct list_head *list, struct node_rec *rec)
/*
* Ensure the record's 'multiple' flag is set so __iscsi_login_portal
- * will allow multiple logins.
+ * will allow multiple logins, but only if configured for more
+ * than one
*/
- rec->session.multiple = 1;
+ if (rec->session.nr_sessions > 1)
+ rec->session.multiple = 1;
for (i = session_count; i < rec->session.nr_sessions; ++i) {
log_debug(1, "%s: Creating session %d/%d", rec->iface.name,
i + 1, rec->session.nr_sessions);
--
1.8.3.1

View File

@ -1,28 +0,0 @@
From 4ee991b81194a7e3ebd7ff6ec4efc5509932389d Mon Sep 17 00:00:00 2001
From: Lee Duncan <lduncan@suse.com>
Date: Tue, 14 May 2019 14:12:25 -0700
Subject: [PATCH 91/91] Fix possible discovery hang when timing out
If session reopening failed during discovery, the CPU
could peg at 100% because the code that gives up when
tretires are exhausted was not setting an error
return value.
---
usr/discovery.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/usr/discovery.c b/usr/discovery.c
index 2147deb..199c160 100644
--- a/usr/discovery.c
+++ b/usr/discovery.c
@@ -1355,6 +1355,7 @@ reconnect:
if (--session->reopen_cnt < 0) {
log_error("connection login retries (reopen_max) %d exceeded",
config->reopen_max);
+ rc = ISCSI_ERR_PDU_TIMEOUT;
goto login_failed;
}
--
1.8.3.1

View File

@ -0,0 +1,44 @@
From 83126f4ab8c67704d779d9d15b2e1227d11209ff Mon Sep 17 00:00:00 2001
From: pengyeqing <pengyeqing@huawei.com>
Date: Sat, 26 Jan 2019 22:44:59 +0800
Subject: [PATCH] iscsi-initiator-utils: add sleep for service
add sleep for service
Signed-off-by: pengyeqing <pengyeqing@huawei.com>
Signed-off-by: wuguanghao <wuguanghao3@huawei.com>
---
etc/systemd/iscsid.service | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/etc/systemd/iscsid.service b/etc/systemd/iscsid.service
index 4fef168..f3f8c65 100644
--- a/etc/systemd/iscsid.service
+++ b/etc/systemd/iscsid.service
@@ -1,17 +1,14 @@
[Unit]
Description=Open-iSCSI
Documentation=man:iscsid(8) man:iscsiuio(8) man:iscsiadm(8)
-DefaultDependencies=no
-After=network.target iscsiuio.service
-Before=remote-fs-pre.target
+After=network.target NetworkManager-wait-online.service iscsiuio.service tgtd.service targetcli.service
[Service]
-Type=notify
-NotifyAccess=main
-ExecStart=/sbin/iscsid -f
-KillMode=mixed
-Restart=on-failure
+Type=forking
+PIDFile=/var/run/iscsid.pid
+ExecStart=/sbin/iscsid
+ExecStopPost=/usr/bin/sleep 1
+ExecStop=/sbin/iscsiadm -k 0 2
[Install]
WantedBy=multi-user.target
-Also=iscsid.socket
--
1.8.3.1

View File

@ -1,35 +0,0 @@
From e13d2fe2b39d6a69b7a7c82cdc3185996bceaca2 Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Wed, 30 Oct 2019 11:06:07 -0700
Subject: [PATCH 18/43] Resource leak: returning without freeing netdev
---
usr/iscsi_net_util.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/usr/iscsi_net_util.c b/usr/iscsi_net_util.c
index 6339082..a32b49c 100644
--- a/usr/iscsi_net_util.c
+++ b/usr/iscsi_net_util.c
@@ -271,7 +271,8 @@ int net_setup_netdev(char *netdev, char *local_ip, char *mask, char *gateway,
if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) == -1) {
log_error("Could not open socket to manage network "
"(err %d - %s)", errno, strerror(errno));
- return errno;
+ ret = errno;
+ goto done;
}
/* Bring up NIC with correct address - unless it
@@ -389,7 +390,8 @@ int net_setup_netdev(char *netdev, char *local_ip, char *mask, char *gateway,
ret = 0;
done:
- close(sock);
+ if (sock >= 0)
+ close(sock);
if (vlan_id)
free(netdev);
return ret;
--
2.21.0

View File

@ -1,4 +1,4 @@
From 1412b27dc88f5f2cdda5cb1cf0d2a9313313a390 Mon Sep 17 00:00:00 2001
From d99f5bb9a8fcd217262d765b096df30724c774e9 Mon Sep 17 00:00:00 2001
From: pengyeqing <pengyeqing@huawei.com>
Date: Mon, 20 Jan 2020 19:43:52 +0800
Subject: [PATCH] iscsi-initiator-utils: not send stop message if iscsid absent
@ -10,12 +10,12 @@ Signed-off-by: pengyeqing <pengyeqing@huawei.com>
2 files changed, 73 insertions(+)
diff --git a/etc/systemd/iscsid.service b/etc/systemd/iscsid.service
index 2566b49..44a0363 100644
index f3f8c65..2cce190 100644
--- a/etc/systemd/iscsid.service
+++ b/etc/systemd/iscsid.service
@@ -9,6 +9,8 @@ PIDFile=/var/run/iscsid.pid
ExecStart=/usr/sbin/iscsid
ExecStartPost=/usr/bin/sleep 1
ExecStart=/sbin/iscsid
ExecStopPost=/usr/bin/sleep 1
ExecStop=/sbin/iscsiadm -k 0 2
+Restart=always
+RestartSec=2s
@ -23,7 +23,7 @@ index 2566b49..44a0363 100644
[Install]
WantedBy=multi-user.target
diff --git a/usr/iscsiadm.c b/usr/iscsiadm.c
index 4796c2f..8b5d5fe 100644
index f2bd721..b386abe 100644
--- a/usr/iscsiadm.c
+++ b/usr/iscsiadm.c
@@ -69,6 +69,8 @@ static char program_name[] = "iscsiadm";

View File

@ -1,25 +0,0 @@
From 007d7832c631409e41bf5c473ca5dc7d114a67cb Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Wed, 30 Oct 2019 11:13:44 -0700
Subject: [PATCH 19/43] Out-of-bounds-write: Overrunning array link_target
---
usr/sysfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/usr/sysfs.c b/usr/sysfs.c
index 48f3825..b3102f0 100644
--- a/usr/sysfs.c
+++ b/usr/sysfs.c
@@ -134,7 +134,7 @@ int sysfs_resolve_link(char *devpath, size_t size)
strlcpy(link_path, sysfs_path, sizeof(link_path));
strlcat(link_path, devpath, sizeof(link_path));
- len = readlink(link_path, link_target, sizeof(link_target));
+ len = readlink(link_path, link_target, sizeof(link_target) - 1);
if (len <= 0)
return -1;
link_target[len] = '\0';
--
2.21.0

View File

@ -0,0 +1,296 @@
From 5a5e63101a9428567767efb50fe5cd60f8f39cea Mon Sep 17 00:00:00 2001
From: wangjufeng <wangjufeng@huawei.com>
Date: Sat, 20 Oct 2018 14:50:28 +0800
Subject: [PATCH] tt
---
usr/event_poll.c | 17 +++++++-
usr/iscsid.c | 2 +-
usr/log.c | 124 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
usr/log.h | 6 +++
4 files changed, 144 insertions(+), 5 deletions(-)
diff --git a/usr/event_poll.c b/usr/event_poll.c
index 4cf4ce2..7b70cb7 100644
--- a/usr/event_poll.c
+++ b/usr/event_poll.c
@@ -151,8 +151,11 @@ void event_loop_exit(queue_task_t *qtask)
void event_loop(struct iscsi_ipc *ipc, int control_fd, int mgmt_ipc_fd)
{
- struct pollfd poll_array[POLL_MAX];
+ struct pollfd poll_array[POLL_MAX + 1];
int res, has_shutdown_children = 0;
+ int log_timerfd = log_get_timerfd();
+ int pool_count = POLL_MAX;
+ int poll_timerfd_index = -1;
sigset_t sigset;
int sig_fd;
@@ -174,6 +177,13 @@ void event_loop(struct iscsi_ipc *ipc, int control_fd, int mgmt_ipc_fd)
poll_array[POLL_ALARM].fd = sig_fd;
poll_array[POLL_ALARM].events = POLLIN;
+ if (log_timerfd >= 0) {
+ poll_array[POLL_MAX].fd = log_timerfd;
+ poll_array[POLL_MAX].events = POLLIN;
+ poll_timerfd_index = POLL_MAX;
+ pool_count += 1;
+ }
+
event_loop_stop = 0;
while (1) {
if (event_loop_stop) {
@@ -188,7 +198,7 @@ void event_loop(struct iscsi_ipc *ipc, int control_fd, int mgmt_ipc_fd)
/* Runs actors and may set alarm for future actors */
actor_poll();
- res = poll(poll_array, POLL_MAX, reap_count ? REAP_WAKEUP : -1);
+ res = poll(poll_array, pool_count, reap_count ? REAP_WAKEUP : -1);
if (res > 0) {
log_debug(6, "poll result %d", res);
@@ -198,6 +208,9 @@ void event_loop(struct iscsi_ipc *ipc, int control_fd, int mgmt_ipc_fd)
if (poll_array[POLL_IPC].revents)
mgmt_ipc_handle(mgmt_ipc_fd);
+ if(log_timerfd >= 0 && poll_array[poll_timerfd_index].revents)
+ log_watchdog_handle();
+
if (poll_array[POLL_ALARM].revents) {
struct signalfd_siginfo si;
diff --git a/usr/iscsid.c b/usr/iscsid.c
index c9ab9eb..56689e5 100644
--- a/usr/iscsid.c
+++ b/usr/iscsid.c
@@ -62,7 +62,6 @@ struct iscsi_daemon_config daemon_config;
struct iscsi_daemon_config *dconfig = &daemon_config;
static char program_name[] = "iscsid";
-static pid_t log_pid;
static gid_t gid;
static int daemonize = 1;
static int mgmt_ipc_fd;
@@ -307,6 +306,7 @@ static void iscsid_shutdown(void)
log_debug(1, "daemon stopping");
log_close(log_pid);
}
+ log_close_watchdog_timer();
}
static void catch_signal(int signo)
diff --git a/usr/log.c b/usr/log.c
index 6e16e7c..c225bdc 100644
--- a/usr/log.c
+++ b/usr/log.c
@@ -18,6 +18,7 @@
#include <sys/types.h>
#include <sys/types.h>
#include <sys/wait.h>
+#include <sys/timerfd.h>
#include "iscsi_util.h"
#include "log.h"
@@ -35,6 +36,13 @@ char *log_name;
int log_level = 0;
struct logarea *la = NULL;
+pid_t log_pid = -1;
+static int default_watchdog_timeout = 4;
+static char program_name[] = "iscsid";
+static int watchdog_timerfd = -1;
+static int last_watchdog_count = 0;
+static int watchdog_noupdate_count = 0;
+
static int log_stop_daemon = 0;
static void (*log_func)(int prio, void *priv, const char *fmt, va_list ap);
static void *log_func_priv;
@@ -142,6 +150,7 @@ static int logarea_init (int size)
la->shmid_buff = shmid;
la->ops[0].sem_num = 0;
la->ops[0].sem_flg = 0;
+ la->watchdog_count = 0;
return 0;
@@ -421,6 +430,105 @@ static void __log_close(void)
}
}
+static int log_restart_daemon(void)
+{
+ log_close(log_pid);
+ log_pid = log_init(program_name, DEFAULT_AREA_SIZE, log_do_log_daemon, NULL);
+ if (log_pid < 0)
+ return -1;
+ return 0;
+}
+
+static int log_watchdog_setup(void)
+{
+ int r;
+ struct itimerspec new_value;
+ uint32_t period_inus = 1 * 1000000; /*1 second*/
+ uint32_t seconds;
+ uint32_t nanoseconds;
+ if (log_stop_daemon || watchdog_timerfd >= 0)
+ return 0;
+
+ watchdog_timerfd = timerfd_create(CLOCK_MONOTONIC, TFD_NONBLOCK | TFD_CLOEXEC);
+ if (watchdog_timerfd < 0) {
+ syslog(LOG_ERR, "Create watchdog timer failed. errno: %d", errno);
+ return -1;
+ }
+ seconds = period_inus / 1000000;
+ nanoseconds = (period_inus - (seconds * 1000000)) * 1000;
+ new_value.it_interval.tv_sec = seconds;
+ new_value.it_interval.tv_nsec = nanoseconds;
+ new_value.it_value.tv_sec = seconds;
+ new_value.it_value.tv_nsec = nanoseconds;
+
+ r = timerfd_settime(watchdog_timerfd, 0, &new_value, NULL);
+ if (r < 0) {
+ syslog(LOG_ERR, "Set watchdog timer failed. errno: %d", errno);
+ log_close_watchdog_timer();
+ return -1;
+ }
+ return 0;
+}
+
+static int log_read_comm_frpm_pid(pid_t pid, char *buffer, int len)
+{
+ char comm_file[256];
+ char comm_content[1024];
+ int r;
+ FILE *fd = NULL;
+ buffer[0] = '\0';
+ snprintf(comm_file, sizeof(comm_file), "/proc/%i/comm", pid);
+ fd = fopen(comm_file, "r");
+ if (!fd)
+ return -1;
+ if (!fgets(buffer, len, fd)) {
+ log_warning("Can not read file. File:%s.", comm_file);
+ fclose(fd);
+ fd = NULL;
+ return -1;
+ }
+ fclose(fd);
+ fd = NULL;
+ return 0;
+}
+
+int log_get_timerfd(void)
+{
+ return watchdog_timerfd;
+}
+
+void log_close_watchdog_timer(void)
+{
+ if(watchdog_timerfd >= 0) {
+ close(watchdog_timerfd);
+ watchdog_timerfd = -1;
+ }
+}
+
+void log_watchdog_handle(void)
+{
+ uint64_t expir = 0;
+ int len;
+ int new_watchdog_count;
+ len = read(watchdog_timerfd, &expir, sizeof(uint64_t));
+ if(len > 0 && expir > 0) {
+ if (la && !log_stop_daemon) {
+ new_watchdog_count = la->watchdog_count;
+ if (new_watchdog_count == last_watchdog_count) {
+ watchdog_noupdate_count++;
+ if (watchdog_noupdate_count >= default_watchdog_timeout) {
+ watchdog_noupdate_count = 0;
+ syslog(LOG_ERR, "log daemon is not alive, try to restart.");
+ log_restart_daemon();
+ }
+ } else {
+ watchdog_noupdate_count = 0;
+ last_watchdog_count = new_watchdog_count;
+ }
+ }
+ }
+}
+
int log_init(char *program_name, int size,
void (*func)(int prio, void *priv, const char *fmt, va_list ap),
void *priv)
@@ -443,6 +551,8 @@ int log_init(char *program_name, int size,
return -1;
}
+ log_watchdog_setup();
+
pid = fork();
if (pid < 0) {
syslog(LOG_ERR, "starting logger failed");
@@ -463,6 +573,8 @@ int log_init(char *program_name, int size,
sigaction(SIGTERM, &sa_new, &sa_old );
while(1) {
+ if (la)
+ la->watchdog_count++;
log_flush();
sleep(1);
@@ -487,7 +599,15 @@ void log_close(pid_t pid)
}
if (pid > 0) {
- kill(pid, SIGTERM);
- waitpid(pid, &status, 0);
+ char comm[1024];
+ int r;
+ r = log_read_comm_frpm_pid(pid, comm, sizeof(comm));
+ if (!r && strstr(comm, "iscsid")) {
+ syslog(LOG_WARNING, "Send SIGTERM to iSCSI logger, pid=%i.", pid);
+ kill(pid, SIGTERM);
+ waitpid(pid, &status, 0);
+ } else {
+ syslog(LOG_WARNING, "iSCSI logger with pid=%i already exited.", pid);
+ }
}
}
diff --git a/usr/log.h b/usr/log.h
index c548791..6affd3b 100644
--- a/usr/log.h
+++ b/usr/log.h
@@ -28,6 +28,7 @@
#include <stdarg.h>
#include <sys/types.h>
+#include <stdint.h>
#include "iscsid.h"
union semun {
@@ -42,6 +43,7 @@ union semun {
#define MAX_MSG_SIZE 256
extern int log_level;
+extern pid_t log_pid;
struct logmsg {
short int prio;
@@ -62,10 +64,14 @@ struct logarea {
struct sembuf ops[1];
int semid;
union semun semarg;
+ uint64_t watchdog_count;
};
extern struct logarea *la;
+extern int log_get_timerfd(void);
+extern void log_close_watchdog_time(void);
+extern void log_watchdog_handle(void);
extern int log_init(char *program_name, int size,
void (*func)(int prio, void *priv, const char *fmt, va_list ap),
void *priv);
--
1.8.3.1

View File

@ -1,34 +0,0 @@
From 0db12353efea69309a6a92f30f4e063b142359c4 Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Wed, 30 Oct 2019 11:27:07 -0700
Subject: [PATCH 20/43] Resource leak: Variable rec going out of scope leaks
the storage it points to
---
usr/iscsiadm.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/usr/iscsiadm.c b/usr/iscsiadm.c
index 8de7a41..2ce6ae7 100644
--- a/usr/iscsiadm.c
+++ b/usr/iscsiadm.c
@@ -1044,7 +1044,7 @@ static int add_static_rec(int *found, char *targetname, int tpgt,
if (rc) {
log_error("Could not read iface %s. Error %d",
iface->name, rc);
- return rc;
+ goto free_drec;
}
iface_copy(&rec->iface, iface);
@@ -1057,6 +1057,7 @@ static int add_static_rec(int *found, char *targetname, int tpgt,
rec->iface.transport_name, iface_str(&rec->iface),
ip, port, tpgt, targetname);
}
+free_drec:
free(drec);
free_rec:
free(rec);
--
2.19.1

View File

@ -1,4 +1,4 @@
From 10886ac1cf645b7eefb113a03eb31ef7a49f5910 Mon Sep 17 00:00:00 2001
From 88767cf8e6c62df3260e895664bfe7094e55d565 Mon Sep 17 00:00:00 2001
From: wangjufeng <wangjufeng@huawei.com>
Date: Sat, 20 Oct 2018 14:50:28 +0800
Subject: [PATCH] tt
@ -6,15 +6,15 @@ Subject: [PATCH] tt
---
usr/event_poll.c | 17 +++++++-
usr/iscsid.c | 2 +-
usr/log.c | 120 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
usr/log.c | 124 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
usr/log.h | 6 +++
4 files changed, 140 insertions(+), 5 deletions(-)
4 files changed, 144 insertions(+), 5 deletions(-)
diff --git a/usr/event_poll.c b/usr/event_poll.c
index ac25044..a3a3676 100644
index 4cf4ce2..7b70cb7 100644
--- a/usr/event_poll.c
+++ b/usr/event_poll.c
@@ -134,8 +134,11 @@ void event_loop_exit(queue_task_t *qtask)
@@ -151,8 +151,11 @@ void event_loop_exit(queue_task_t *qtask)
void event_loop(struct iscsi_ipc *ipc, int control_fd, int mgmt_ipc_fd)
{
@ -27,7 +27,7 @@ index ac25044..a3a3676 100644
sigset_t sigset;
int sig_fd;
@@ -157,6 +160,13 @@ void event_loop(struct iscsi_ipc *ipc, int control_fd, int mgmt_ipc_fd)
@@ -174,6 +177,13 @@ void event_loop(struct iscsi_ipc *ipc, int control_fd, int mgmt_ipc_fd)
poll_array[POLL_ALARM].fd = sig_fd;
poll_array[POLL_ALARM].events = POLLIN;
@ -41,7 +41,7 @@ index ac25044..a3a3676 100644
event_loop_stop = 0;
while (1) {
if (event_loop_stop) {
@@ -171,7 +181,7 @@ void event_loop(struct iscsi_ipc *ipc, int control_fd, int mgmt_ipc_fd)
@@ -188,7 +198,7 @@ void event_loop(struct iscsi_ipc *ipc, int control_fd, int mgmt_ipc_fd)
/* Runs actors and may set alarm for future actors */
actor_poll();
@ -50,7 +50,7 @@ index ac25044..a3a3676 100644
if (res > 0) {
log_debug(6, "poll result %d", res);
@@ -181,6 +191,9 @@ void event_loop(struct iscsi_ipc *ipc, int control_fd, int mgmt_ipc_fd)
@@ -198,6 +208,9 @@ void event_loop(struct iscsi_ipc *ipc, int control_fd, int mgmt_ipc_fd)
if (poll_array[POLL_IPC].revents)
mgmt_ipc_handle(mgmt_ipc_fd);
@ -61,10 +61,10 @@ index ac25044..a3a3676 100644
struct signalfd_siginfo si;
diff --git a/usr/iscsid.c b/usr/iscsid.c
index 8202bc9..6329644 100644
index c9ab9eb..56689e5 100644
--- a/usr/iscsid.c
+++ b/usr/iscsid.c
@@ -59,7 +59,6 @@ struct iscsi_daemon_config daemon_config;
@@ -62,7 +62,6 @@ struct iscsi_daemon_config daemon_config;
struct iscsi_daemon_config *dconfig = &daemon_config;
static char program_name[] = "iscsid";
@ -72,7 +72,7 @@ index 8202bc9..6329644 100644
static gid_t gid;
static int daemonize = 1;
static int mgmt_ipc_fd;
@@ -302,6 +301,7 @@ static void iscsid_shutdown(void)
@@ -307,6 +306,7 @@ static void iscsid_shutdown(void)
log_debug(1, "daemon stopping");
log_close(log_pid);
}
@ -81,7 +81,7 @@ index 8202bc9..6329644 100644
static void catch_signal(int signo)
diff --git a/usr/log.c b/usr/log.c
index b730642..35d5564 100644
index 6e16e7c..c225bdc 100644
--- a/usr/log.c
+++ b/usr/log.c
@@ -18,6 +18,7 @@
@ -92,21 +92,21 @@ index b730642..35d5564 100644
#include "iscsi_util.h"
#include "log.h"
@@ -33,6 +34,13 @@
char *log_name;
@@ -35,6 +36,13 @@ char *log_name;
int log_level = 0;
struct logarea *la = NULL;
+pid_t log_pid = -1;
+
+static int default_watchdog_timeout = 4;
+static char program_name[] = "iscsid";
+static int watchdog_timerfd = -1;
+static int last_watchdog_count = 0;
+static int watchdog_noupdate_count = 0;
+
static int log_stop_daemon = 0;
static void (*log_func)(int prio, void *priv, const char *fmt, va_list ap);
@@ -141,6 +149,7 @@ static int logarea_init (int size)
static void *log_func_priv;
@@ -142,6 +150,7 @@ static int logarea_init (int size)
la->shmid_buff = shmid;
la->ops[0].sem_num = 0;
la->ops[0].sem_flg = 0;
@ -114,7 +114,7 @@ index b730642..35d5564 100644
return 0;
@@ -414,6 +423,105 @@ static void __log_close(void)
@@ -421,6 +430,105 @@ static void __log_close(void)
}
}
@ -220,7 +220,7 @@ index b730642..35d5564 100644
int log_init(char *program_name, int size,
void (*func)(int prio, void *priv, const char *fmt, va_list ap),
void *priv)
@@ -436,6 +540,8 @@ int log_init(char *program_name, int size,
@@ -443,6 +551,8 @@ int log_init(char *program_name, int size,
return -1;
}
@ -229,7 +229,7 @@ index b730642..35d5564 100644
pid = fork();
if (pid < 0) {
syslog(LOG_ERR, "starting logger failed");
@@ -456,6 +562,8 @@ int log_init(char *program_name, int size,
@@ -463,6 +573,8 @@ int log_init(char *program_name, int size,
sigaction(SIGTERM, &sa_new, &sa_old );
while(1) {
@ -238,7 +238,7 @@ index b730642..35d5564 100644
log_flush();
sleep(1);
@@ -480,7 +588,15 @@ void log_close(pid_t pid)
@@ -487,7 +599,15 @@ void log_close(pid_t pid)
}
if (pid > 0) {
@ -257,7 +257,7 @@ index b730642..35d5564 100644
}
}
diff --git a/usr/log.h b/usr/log.h
index 486a08e..d4f8b80 100644
index c548791..f0c88c7 100644
--- a/usr/log.h
+++ b/usr/log.h
@@ -28,6 +28,7 @@
@ -283,7 +283,7 @@ index 486a08e..d4f8b80 100644
+ uint64_t watchdog_count;
};
struct logarea *la;
extern struct logarea *la;
+extern int log_get_timerfd(void);
+extern void log_close_watchdog_timer(void);

View File

@ -1,43 +0,0 @@
From c03fbc1a112d3f808512351a62f4c5f593694003 Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Wed, 30 Oct 2019 11:29:56 -0700
Subject: [PATCH 21/43] Out-of-bounds write: Overrunning array link_target
---
usr/sysfs.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/usr/sysfs.c b/usr/sysfs.c
index b3102f0..2488160 100644
--- a/usr/sysfs.c
+++ b/usr/sysfs.c
@@ -225,7 +225,7 @@ struct sysfs_device *sysfs_device_get(const char *devpath)
strlcpy(link_path, sysfs_path, sizeof(link_path));
strlcat(link_path, dev->devpath, sizeof(link_path));
strlcat(link_path, "/subsystem", sizeof(link_path));
- len = readlink(link_path, link_target, sizeof(link_target));
+ len = readlink(link_path, link_target, sizeof(link_target) - 1);
if (len > 0) {
/* get subsystem from "subsystem" link */
link_target[len] = '\0';
@@ -255,7 +255,7 @@ struct sysfs_device *sysfs_device_get(const char *devpath)
strlcpy(link_path, sysfs_path, sizeof(link_path));
strlcat(link_path, dev->devpath, sizeof(link_path));
strlcat(link_path, "/driver", sizeof(link_path));
- len = readlink(link_path, link_target, sizeof(link_target));
+ len = readlink(link_path, link_target, sizeof(link_target) - 1);
if (len > 0) {
link_target[len] = '\0';
dbg("driver link '%s' points to '%s'", link_path, link_target);
@@ -363,7 +363,7 @@ char *sysfs_attr_get_value(const char *devpath, const char *attr_name)
int len;
const char *pos;
- len = readlink(path_full, link_target, sizeof(link_target));
+ len = readlink(path_full, link_target, sizeof(link_target) - 1);
if (len > 0) {
link_target[len] = '\0';
pos = strrchr(link_target, '/');
--
2.19.1

View File

@ -1,27 +0,0 @@
From 26bfa31349c410cacd22f9e8ea2ef4a82b221f13 Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Wed, 30 Oct 2019 11:44:18 -0700
Subject: [PATCH 22/43] Buffer not null terminated: Calling strncpy with a
maximum size argument on destination array might leave the destination string
unterminated
---
usr/iscsi_sysfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/usr/iscsi_sysfs.c b/usr/iscsi_sysfs.c
index f79a1af..418f51b 100644
--- a/usr/iscsi_sysfs.c
+++ b/usr/iscsi_sysfs.c
@@ -464,7 +464,7 @@ int iscsi_sysfs_get_flashnode_info(struct flashnode_rec *fnode,
log_debug(7, "could not get transport name for host%d",
host_no);
else
- strncpy(fnode->transport_name, t->name,
+ strlcpy(fnode->transport_name, t->name,
ISCSI_TRANSPORT_NAME_MAXLEN);
snprintf(sess_id, sizeof(sess_id), ISCSI_FLASHNODE_SESS, host_no,
--
2.21.0

View File

@ -1,26 +0,0 @@
From 5799a5a711a0347e353cfb61b8ea33eb9d38541e Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Wed, 30 Oct 2019 12:03:59 -0700
Subject: [PATCH 24/43] Resource leak: Variable startup_cmd going out of scope
leaks the storage it point to.
---
usr/iscsid_req.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/usr/iscsid_req.c b/usr/iscsid_req.c
index b6940db..427e894 100644
--- a/usr/iscsid_req.c
+++ b/usr/iscsid_req.c
@@ -55,6 +55,8 @@ static void iscsid_startup(void)
if (system(startup_cmd) < 0)
log_error("Could not execute '%s' (err %d)",
startup_cmd, errno);
+
+ free(startup_cmd);
}
#define MAXSLEEP 128
--
2.21.0

View File

@ -1,17 +1,17 @@
From 9c5a21d14a2dff91b56574842218cc11e7457dfa Mon Sep 17 00:00:00 2001
From 64fe2b6749cb3d53444d9a5663d8e6c852d5aa17 Mon Sep 17 00:00:00 2001
From: openEuler Buildteam <buildteam@openeuler.org>
Date: Wed, 8 Jan 2020 04:13:29 -0500
Subject: [PATCH] iscsi-initiator-utils: fix default file corrupt
---
usr/idbm.c | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
usr/idbm.c | 25 ++++++++++++++++++++++++-
1 file changed, 24 insertions(+), 1 deletion(-)
diff --git a/usr/idbm.c b/usr/idbm.c
index 830189f..7ed0ce9 100644
index 6309be0..be5f8f9 100644
--- a/usr/idbm.c
+++ b/usr/idbm.c
@@ -2006,6 +2006,7 @@ static int idbm_rec_write(node_rec_t *rec)
@@ -2139,6 +2139,7 @@ static int idbm_rec_write(node_rec_t *rec, bool disable_lock)
struct stat statb;
FILE *f;
char *portal;
@ -19,7 +19,7 @@ index 830189f..7ed0ce9 100644
int rc = 0;
portal = malloc(PATH_MAX);
@@ -2092,7 +2093,7 @@ mkdir_portal:
@@ -2227,7 +2228,7 @@ mkdir_portal:
}
}
@ -28,7 +28,7 @@ index 830189f..7ed0ce9 100644
rec->name, rec->conn[0].address, rec->conn[0].port, rec->tpgt,
rec->iface.name);
open_conf:
@@ -2105,6 +2106,27 @@ open_conf:
@@ -2240,6 +2241,28 @@ open_conf:
idbm_print(IDBM_PRINT_TYPE_NODE, rec, 1, f);
fclose(f);
@ -53,8 +53,10 @@ index 830189f..7ed0ce9 100644
+
+free_portalDef:
+ free(portalDef);
+
unlock:
idbm_unlock();
free_portal:
if (!disable_lock)
idbm_unlock();
--
1.8.3.1

View File

@ -1,43 +0,0 @@
From aa0e934c3513ca8fac9de463e328b5a150d057f5 Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Wed, 30 Oct 2019 12:10:27 -0700
Subject: [PATCH 25/43] Buffer not null terminated: Calling strncpy with a
maximum size argument on destination array
---
usr/iscsi_net_util.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/usr/iscsi_net_util.c b/usr/iscsi_net_util.c
index a32b49c..56d2f69 100644
--- a/usr/iscsi_net_util.c
+++ b/usr/iscsi_net_util.c
@@ -193,7 +193,7 @@ static char *find_vlan_dev(char *netdev, int vlan_id) {
sockfd = socket(AF_INET, SOCK_DGRAM, 0);
- strncpy(if_hwaddr.ifr_name, netdev, IFNAMSIZ);
+ strlcpy(if_hwaddr.ifr_name, netdev, IFNAMSIZ);
ioctl(sockfd, SIOCGIFHWADDR, &if_hwaddr);
if (if_hwaddr.ifr_hwaddr.sa_family != ARPHRD_ETHER)
@@ -201,14 +201,14 @@ static char *find_vlan_dev(char *netdev, int vlan_id) {
ifni = if_nameindex();
for (i = 0; ifni[i].if_index && ifni[i].if_name; i++) {
- strncpy(vlan_hwaddr.ifr_name, ifni[i].if_name, IFNAMSIZ);
+ strlcpy(vlan_hwaddr.ifr_name, ifni[i].if_name, IFNAMSIZ);
ioctl(sockfd, SIOCGIFHWADDR, &vlan_hwaddr);
if (vlan_hwaddr.ifr_hwaddr.sa_family != ARPHRD_ETHER)
continue;
if (!memcmp(if_hwaddr.ifr_hwaddr.sa_data, vlan_hwaddr.ifr_hwaddr.sa_data, ETH_ALEN)) {
- strncpy(vlanrq.device1, ifni[i].if_name, IFNAMSIZ);
+ strlcpy(vlanrq.device1, ifni[i].if_name, IFNAMSIZ);
rc = ioctl(sockfd, SIOCGIFVLAN, &vlanrq);
if ((rc == 0) && (vlanrq.u.VID == vlan_id)) {
vlan = strdup(vlanrq.device1);
--
2.21.0

View File

@ -1,25 +0,0 @@
From 65c06d977a012541fd6144d4452f5191081fdd44 Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Wed, 30 Oct 2019 12:11:42 -0700
Subject: [PATCH 26/43] Uninitialized scalar variable
---
usr/host.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/usr/host.c b/usr/host.c
index 62bf111..356650c 100644
--- a/usr/host.c
+++ b/usr/host.c
@@ -217,7 +217,7 @@ static int print_host_iface(void *data, struct iface_rec *iface)
static void print_host_ifaces(struct host_info *hinfo, char *prefix)
{
- int nr_found;
+ int nr_found = 0;
iscsi_sysfs_for_each_iface_on_host(prefix, hinfo->host_no, &nr_found,
print_host_iface);
--
2.21.0

View File

@ -1,29 +0,0 @@
From 98738bc389c62cef05bff9e03d5172253ebc82af Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Wed, 30 Oct 2019 13:46:37 -0700
Subject: [PATCH 29/43] Resource leak: Handle variable sockfd going out of
scope leaks the handle.
---
usr/iscsi_net_util.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/usr/iscsi_net_util.c b/usr/iscsi_net_util.c
index 56d2f69..b5a910f 100644
--- a/usr/iscsi_net_util.c
+++ b/usr/iscsi_net_util.c
@@ -196,8 +196,10 @@ static char *find_vlan_dev(char *netdev, int vlan_id) {
strlcpy(if_hwaddr.ifr_name, netdev, IFNAMSIZ);
ioctl(sockfd, SIOCGIFHWADDR, &if_hwaddr);
- if (if_hwaddr.ifr_hwaddr.sa_family != ARPHRD_ETHER)
+ if (if_hwaddr.ifr_hwaddr.sa_family != ARPHRD_ETHER) {
+ close(sockfd);
return NULL;
+ }
ifni = if_nameindex();
for (i = 0; ifni[i].if_index && ifni[i].if_name; i++) {
--
2.21.0

View File

@ -1,17 +1,18 @@
From afc39d6f627f1e870883e8a6851f7a20f9700801 Mon Sep 17 00:00:00 2001
From 9bfec2b1c66ffe05c04ece6eded412cc2fd49f84 Mon Sep 17 00:00:00 2001
From: sangxu <sangxu@huawei.com>
Date: Wed, 30 May 2018 15:54:53 +0800
Subject: [PATCH]fix default file zero after power outage, fsync file immediately and use correct parameters info when removing old file.
Subject: [PATCH] fix default file zero after power outage, fsync file
immediately and use correct parameters info when removing old file.
---
usr/idbm.c | 23 ++++++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)
usr/idbm.c | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/usr/idbm.c b/usr/idbm.c
index 5437f45..c01c4fe 100644
index be5f8f9..d431b00 100644
--- a/usr/idbm.c
+++ b/usr/idbm.c
@@ -2074,6 +2074,23 @@ mkdir_portal:
@@ -2240,6 +2240,23 @@ open_conf:
}
idbm_print(IDBM_PRINT_TYPE_NODE, rec, 1, f);
@ -35,14 +36,14 @@ index 5437f45..c01c4fe 100644
fclose(f);
/* add for default_bak -> default */
@@ -2392,7 +2409,7 @@ int idbm_add_node(node_rec_t *newrec, discovery_rec_t *drec, int overwrite)
if (!overwrite)
return 0;
@@ -2455,7 +2472,7 @@ int idbm_add_node(node_rec_t *newrec, discovery_rec_t *drec, int overwrite)
goto unlock;
}
- rc = idbm_delete_node(&rec);
+ rc = idbm_delete_node(newrec);
if (rc)
return rc;
goto unlock;
log_debug(7, "overwriting existing record");
--
1.8.3.1

View File

@ -1,4 +1,4 @@
From 9cfd62d24ea564c69f09b9f129b39d4460504cec Mon Sep 17 00:00:00 2001
From 40454759ba37c69c59473d63635cfccc7bb5ec8d Mon Sep 17 00:00:00 2001
From: Lee Duncan <lduncan@suse.com>
Date: Tue, 12 May 2020 16:01:50 +0800
Subject: [PATCH] Fix issue where 'iscsi-iname -p' core dumps
@ -7,18 +7,17 @@ Fix issue where 'iscsi-iname -p' core dumps
Signed-off-by: Lee Duncan <lduncan@suse.com>
---
utils/iscsi-iname.c | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
utils/iscsi-iname.c | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/utils/iscsi-iname.c b/utils/iscsi-iname.c
index ad843a0..173e632 100644
index da850dc..d1c067b 100644
--- a/utils/iscsi-iname.c
+++ b/utils/iscsi-iname.c
@@ -40,6 +40,14 @@
* a seperator and 12 characters (6 random bytes in hex representation)
*/
#define PREFIX_MAX_LEN 210
+
@@ -40,6 +40,13 @@
* a seperator and 12 characters (6 random bytes in hex representation) */
#define PREFIX_MAX_LEN 210
+static void usage(void)
+{
+ fprintf(stderr, "Usage: iscsi-iname [-h | --help | -p <prefix>]\n");
@ -29,20 +28,20 @@ index ad843a0..173e632 100644
int
main(int argc, char *argv[])
{
@@ -68,14 +76,17 @@ main(int argc, char *argv[])
@@ -68,15 +75,17 @@ main(int argc, char *argv[])
"on every invocation.\n");
exit(0);
} else if ( strcmp(prefix, "-p") == 0 ) {
+ if (argc != 3) {
+ if (argc != 3){
+ usage();
+ exit(1);
+ }
prefix = argv[2];
if (strnlen(prefix, PREFIX_MAX_LEN + 1) > PREFIX_MAX_LEN) {
- printf("Error: Prexfix cannot exceed %d "
- "characters.\n", PREFIX_MAX_LEN);
- printf("Error: Prefix cannot exceed %d "
- "characters.\n", PREFIX_MAX_LEN);
+ usage();
+ exit(1);
exit(1);
}
} else {
- printf("\nUsage: iscsi-iname [-h | --help | "

View File

@ -1,26 +0,0 @@
From 020d46c3cb95d627bd1246e6212981cf22adf651 Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Wed, 30 Oct 2019 13:50:22 -0700
Subject: [PATCH 30/43] Resource leak: Variable chap_info going out of scope
leaks the storage it points to.
---
usr/iscsiadm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/usr/iscsiadm.c b/usr/iscsiadm.c
index 2ce6ae7..efc9f43 100644
--- a/usr/iscsiadm.c
+++ b/usr/iscsiadm.c
@@ -1734,7 +1734,7 @@ static int set_host_chap_info(uint32_t host_no, uint64_t chap_index,
rc = ISCSI_ERR;
}
- goto exit_set_chap;
+ goto free_iovec;
}
ipc->ctldev_close();
--
2.19.1

View File

@ -1,34 +0,0 @@
From 096fc3ca10492c0810f1aaf76266006a2a803109 Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Wed, 30 Oct 2019 13:54:27 -0700
Subject: [PATCH 31/43] Resource leak: Variable matched_ses going out of scope
leaks the storage it points to.
---
usr/host.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/usr/host.c b/usr/host.c
index 356650c..c94b6d1 100644
--- a/usr/host.c
+++ b/usr/host.c
@@ -262,14 +262,14 @@ static int host_info_print_tree(void *data, struct host_info *hinfo)
matched_ses[matched_se_count++] = ses[i];
if (!matched_se_count)
- return 0;
+ goto out;
printf("\t*********\n");
printf("\tSessions:\n");
printf("\t*********\n");
session_info_print_tree(matched_ses, matched_se_count, "\t",
session_info_flags, 0/* don't show password */);
-
+out:
free(matched_ses);
return 0;
}
--
2.21.0

View File

@ -1,29 +0,0 @@
From ca6eb221321c0e24b94f667ecc75a5fc17aa2018 Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Wed, 30 Oct 2019 13:59:31 -0700
Subject: [PATCH 32/43] Resource leak: Handle variable fd going out of scope
leaks the handle.
This is comming up in places where the error handling assumes that on a
failure there is no file descriptor to worry about. I don't think we
need to keep fd around when indicating a connection error.
---
usr/iscsid_req.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/usr/iscsid_req.c b/usr/iscsid_req.c
index 427e894..d872eb7 100644
--- a/usr/iscsid_req.c
+++ b/usr/iscsid_req.c
@@ -97,6 +97,8 @@ static int ipc_connect(int *fd, char *unix_sock_name, int start_iscsid)
if (nsec <= MAXSLEEP/2)
sleep(nsec);
}
+ close(*fd);
+ *fd = -1;
log_error("can not connect to iSCSI daemon (%d)!", errno);
return ISCSI_ERR_ISCSID_NOTCONN;
}
--
2.21.0

View File

@ -1,25 +0,0 @@
From 1a17ffcc07ff7021d66940f58f42bfaa78e763bf Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Wed, 30 Oct 2019 14:08:57 -0700
Subject: [PATCH 33/43] Resource leak: Handle variable fd going out of scope
leaks the handle.
---
usr/iscsi_util.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/usr/iscsi_util.c b/usr/iscsi_util.c
index 0570dd5..fd8fc0c 100644
--- a/usr/iscsi_util.c
+++ b/usr/iscsi_util.c
@@ -62,6 +62,7 @@ void daemon_init(void)
setsid();
if (chdir("/") < 0)
log_debug(1, "Could not chdir to /: %s", strerror(errno));
+ close(fd);
}
#define ISCSI_OOM_PATH_LEN 48
--
2.21.0

View File

@ -1,35 +0,0 @@
From de0680b4f46f767c34a4a503dadcb24135c21cb6 Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Wed, 30 Oct 2019 14:12:16 -0700
Subject: [PATCH 34/43] Out-of-bounds read: Overrunning array of 4 bytes at
byte offset 7 by dereferencing pointer
---
iscsiuio/src/unix/libs/qedi.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/iscsiuio/src/unix/libs/qedi.c b/iscsiuio/src/unix/libs/qedi.c
index b7595d5..3414cb5 100644
--- a/iscsiuio/src/unix/libs/qedi.c
+++ b/iscsiuio/src/unix/libs/qedi.c
@@ -442,7 +442,7 @@ static int qedi_open(nic_t *nic)
qedi_t *bp = NULL;
struct stat uio_stat;
int i, rc;
- int count;
+ size_t count;
uint32_t bus;
uint32_t slot;
uint32_t func;
@@ -666,7 +666,7 @@ static int qedi_open(nic_t *nic)
nic->mac_addr[0], nic->mac_addr[1], nic->mac_addr[2],
nic->mac_addr[3], nic->mac_addr[4], nic->mac_addr[5]);
- qedi_get_library_name(&nic->library_name, (size_t *)&count);
+ qedi_get_library_name(&nic->library_name, &count);
LOG_INFO("%s: qedi initialized", nic->log_name);
bp->flags |= QEDI_OPENED;
--
2.21.0

View File

@ -1,39 +0,0 @@
From f7d92a5f0a788179bf804dd898d2b5238da5d2d1 Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Thu, 31 Oct 2019 14:24:53 -0700
Subject: [PATCH 39/43] fwparam_pcc mulitple resource leaks
Resource Leak: Variable mac_file going out of scope leaks the storage it points to.
Resource Leak: Handle variable mac_fd going out of scope leaks the storage it points to.
---
utils/fwparam_ibft/fwparam_ppc.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/utils/fwparam_ibft/fwparam_ppc.c b/utils/fwparam_ibft/fwparam_ppc.c
index 52a5c50..429d45c 100644
--- a/utils/fwparam_ibft/fwparam_ppc.c
+++ b/utils/fwparam_ibft/fwparam_ppc.c
@@ -132,6 +132,7 @@ static int locate_mac(const char *devtree, struct ofw_dev *ofwdev)
error = errno;
fprintf(stderr, "%s: open %s, %s\n", __func__, mac_file,
strerror(errno));
+ free(mac_file);
goto lpm_bail;
}
@@ -140,12 +141,10 @@ static int locate_mac(const char *devtree, struct ofw_dev *ofwdev)
error = EIO;
fprintf(stderr, "%s: read %s, %s\n", __func__, mac_file,
strerror(errno));
- goto lpm_bail;
}
free(mac_file);
close(mac_fd);
-
lpm_bail:
return error;
}
--
2.21.0

View File

@ -0,0 +1,53 @@
From 982eb357f12b86152f85fb5a1dba47e965ebf9d5 Mon Sep 17 00:00:00 2001
From: wuguanghao <wuguanghao3@huawei.com>
Date: Thu, 9 Jul 2020 14:56:28 +0800
Subject: [PATCH] resolve compilation errors
---
usr/iscsiadm.c | 2 +-
usr/log.c | 2 --
usr/mgmt_ipc.c | 2 +-
3 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/usr/iscsiadm.c b/usr/iscsiadm.c
index b386abe..ae560bc 100644
--- a/usr/iscsiadm.c
+++ b/usr/iscsiadm.c
@@ -352,7 +352,7 @@ static void kill_iscsid(int priority, int tmo)
} else {
rc = kill(atol(iscsidpid), 0);
if (ESRCH == rc) {
- log_error("iscsid %d maybe in zombie.\n", atol(iscsidpid));
+ log_error("iscsid %ld maybe in zombie.\n", atol(iscsidpid));
return;
}
}
diff --git a/usr/log.c b/usr/log.c
index 3a52263..00a28f1 100644
--- a/usr/log.c
+++ b/usr/log.c
@@ -473,8 +473,6 @@ static int log_watchdog_setup(void)
static int log_read_comm_frpm_pid(pid_t pid, char *buffer, int len)
{
char comm_file[256];
- char comm_content[1024];
- int r;
FILE *fd = NULL;
buffer[0] = '\0';
snprintf(comm_file, sizeof(comm_file), "/proc/%i/comm", pid);
diff --git a/usr/mgmt_ipc.c b/usr/mgmt_ipc.c
index 3b01949..9e8a323 100644
--- a/usr/mgmt_ipc.c
+++ b/usr/mgmt_ipc.c
@@ -170,7 +170,7 @@ mgmt_ipc_cfg_initiatorname(queue_task_t *qtask)
{
if (dconfig->initiator_name) {
if (VALUE_MAXLEN <= strlen(dconfig->initiator_name)){
- log_error("iscsid: len[%d] of initiator name out of range, max len %d.", strlen(dconfig->initiator_name), VALUE_MAXLEN-1);
+ log_error("iscsid: len[%ld] of initiator name out of range, max len %d.", strlen(dconfig->initiator_name), VALUE_MAXLEN-1);
return ISCSI_ERR_INVAL;
}
--
1.8.3.1

View File

@ -1,25 +0,0 @@
From 504b990bc886d708ae673ac1fa0e09e7911c2823 Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Thu, 31 Oct 2019 15:08:40 -0700
Subject: [PATCH 40/43] Resource leak: Handle variable fd going out of scope
leaks the handle.
---
iscsiuio/src/unix/main.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/iscsiuio/src/unix/main.c b/iscsiuio/src/unix/main.c
index 5168e4e..5e3f66c 100644
--- a/iscsiuio/src/unix/main.c
+++ b/iscsiuio/src/unix/main.c
@@ -196,6 +196,7 @@ static void daemon_init()
dup2(fd, 2);
setsid();
chdir("/");
+ close(fd);
}
#define ISCSI_OOM_PATH_LEN 48
--
2.21.0

View File

@ -1,25 +0,0 @@
From 860187423092ba43112f4c2d303978dda7254c58 Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Thu, 31 Oct 2019 15:22:02 -0700
Subject: [PATCH 42/43] Resource leak: Variable raw going out of scope leaks
the storage it points to.
---
iscsiuio/src/unix/nic_utils.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/iscsiuio/src/unix/nic_utils.c b/iscsiuio/src/unix/nic_utils.c
index aad679e..84ffc5c 100644
--- a/iscsiuio/src/unix/nic_utils.c
+++ b/iscsiuio/src/unix/nic_utils.c
@@ -245,6 +245,7 @@ int nic_discover_iscsi_hosts()
"space for NIC %s "
"during scan", raw);
+ free(raw);
rc = -ENOMEM;
break;
}
--
2.21.0

View File

@ -1,29 +0,0 @@
From d8298fc54eb69d3989878be46e9c7d6ec2055650 Mon Sep 17 00:00:00 2001
From: Lee Duncan <lduncan@suse.com>
Date: Mon, 24 Sep 2018 16:22:18 -0700
Subject: [PATCH 05/87] Allow reading sysfs "port" to fail gracefully.
Do not consider it a fatal error if reading sysfs value
for "port" fails, since we allow failure for "address".
---
libopeniscsiusr/session.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libopeniscsiusr/session.c b/libopeniscsiusr/session.c
index a833939..f8c89c3 100644
--- a/libopeniscsiusr/session.c
+++ b/libopeniscsiusr/session.c
@@ -205,8 +205,8 @@ int iscsi_session_get(struct iscsi_context *ctx, uint32_t sid,
_sysfs_prop_get_str(ctx, sysfs_con_dir_path, "address", (*se)->address,
sizeof((*se)->address) / sizeof(char), "");
- _good(_sysfs_prop_get_i32(ctx, sysfs_con_dir_path, "port",
- &((*se)->port), -1, false), rc, out);
+ _sysfs_prop_get_i32(ctx, sysfs_con_dir_path, "port",
+ &((*se)->port), -1, true);
if ((strcmp((*se)->address, "") == 0) &&
(strcmp((*se)->persistent_address, "") != 0))
--
1.8.3.1

View File

@ -1,50 +0,0 @@
From 7df5edbb427c79337bdd651c2bcdda8eb05f077b Mon Sep 17 00:00:00 2001
From: Lee Duncan <lduncan@suse.com>
Date: Mon, 24 Sep 2018 16:30:34 -0700
Subject: [PATCH 06/87] Fix incorrect sysfs logic for port and ip address.
If "port" is available and "persistent_port" is not, then
correctly use the one that is present for both values.
Likewise for "address" and "persistent_address".
---
libopeniscsiusr/session.c | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)
diff --git a/libopeniscsiusr/session.c b/libopeniscsiusr/session.c
index f8c89c3..98601dc 100644
--- a/libopeniscsiusr/session.c
+++ b/libopeniscsiusr/session.c
@@ -208,22 +208,20 @@ int iscsi_session_get(struct iscsi_context *ctx, uint32_t sid,
_sysfs_prop_get_i32(ctx, sysfs_con_dir_path, "port",
&((*se)->port), -1, true);
- if ((strcmp((*se)->address, "") == 0) &&
- (strcmp((*se)->persistent_address, "") != 0))
- _strncpy((*se)->persistent_address, (*se)->address,
- sizeof((*se)->persistent_address) / sizeof(char));
-
if ((strcmp((*se)->address, "") != 0) &&
(strcmp((*se)->persistent_address, "") == 0))
+ _strncpy((*se)->persistent_address, (*se)->address,
+ sizeof((*se)->persistent_address) / sizeof(char));
+ else if ((strcmp((*se)->address, "") == 0) &&
+ (strcmp((*se)->persistent_address, "") != 0))
_strncpy((*se)->address, (*se)->persistent_address,
sizeof((*se)->address) / sizeof(char));
- if (((*se)->persistent_port != -1) &&
- ((*se)->port == -1))
+ if (((*se)->persistent_port == -1) &&
+ ((*se)->port != -1))
(*se)->persistent_port = (*se)->port;
-
- if (((*se)->persistent_port != -1) &&
- ((*se)->port == -1))
+ else if (((*se)->persistent_port != -1) &&
+ ((*se)->port == -1))
(*se)->port = (*se)->persistent_port;
_good(_iscsi_host_id_of_session(ctx, sid, &host_id), rc, out);
--
1.8.3.1

View File

@ -1,65 +0,0 @@
From ae0b2ceb620e2bf527c06d21c110791d1e0e8bf4 Mon Sep 17 00:00:00 2001
From: Lee Duncan <lduncan@suse.com>
Date: Tue, 25 Sep 2018 09:57:46 -0700
Subject: [PATCH 10/87] Handle ENOTCONN error separately when reading sysfs
values.
This error happens when the daemon is attempting to
reconnect a session when starting up, so should not
be considered an internal error.
---
libopeniscsiusr/sysfs.c | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/libopeniscsiusr/sysfs.c b/libopeniscsiusr/sysfs.c
index 5e6532e..2c3f077 100644
--- a/libopeniscsiusr/sysfs.c
+++ b/libopeniscsiusr/sysfs.c
@@ -184,6 +184,21 @@ int _sysfs_prop_get_str(struct iscsi_context *ctx, const char *dir_path,
_error(ctx, "Failed to read '%s': "
"permission deny when reading '%s'", prop_name,
file_path);
+ } else if (errno_save == ENOTCONN) {
+ if (default_value == NULL) {
+ rc = LIBISCSI_ERR_SYSFS_LOOKUP;
+ _error(ctx, "Failed to read '%s': "
+ "error when reading '%s': "
+ "Target unavailable",
+ prop_name, file_path);
+ } else {
+ _info(ctx, "Failed to read '%s': "
+ "error when reading '%s': "
+ "Target unavailable, using default value '%s'",
+ prop_name, file_path, default_value);
+ memcpy(buff, (void *) default_value,
+ strlen(default_value) + 1);
+ }
} else {
rc = LIBISCSI_ERR_BUG;
_error(ctx, "Failed to read '%s': "
@@ -246,6 +261,22 @@ static int iscsi_sysfs_prop_get_ll(struct iscsi_context *ctx,
_error(ctx, "Permission deny when reading '%s'",
file_path);
goto out;
+ } else if (errno_save == ENOTCONN) {
+ if (!ignore_error) {
+ rc = LIBISCSI_ERR_SYSFS_LOOKUP;
+ _error(ctx, "Failed to read '%s': "
+ "error when reading '%s': "
+ "Target unavailable",
+ prop_name, file_path);
+ goto out;
+ } else {
+ _info(ctx, "Failed to read '%s': "
+ "error when reading '%s': "
+ "Target unavailable, using default value %lld",
+ prop_name, file_path, default_value);
+ *val = default_value;
+ goto out;
+ }
} else {
rc = LIBISCSI_ERR_BUG;
_error(ctx, "Error when reading '%s': %d", file_path,
--
1.8.3.1

View File

@ -1,38 +0,0 @@
From 666694ed3654e333751af0897c8b71f8cc1829f8 Mon Sep 17 00:00:00 2001
From: Lee Duncan <lduncan@suse.com>
Date: Tue, 16 Oct 2018 13:53:09 -0700
Subject: [PATCH] Added service file for iscsi logins
This service file layers on top of iscsid.serivce
to manage logging into and out of known targets.
---
etc/systemd/iscsi.service | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
create mode 100644 etc/systemd/iscsi.service
diff --git a/etc/systemd/iscsi.service b/etc/systemd/iscsi.service
new file mode 100644
index 0000000..0edcf51
--- /dev/null
+++ b/etc/systemd/iscsi.service
@@ -0,0 +1,17 @@
+[Unit]
+Description=Login and scanning of iSCSI devices
+Documentation=man:iscsiadm(8) man:iscsid(8)
+Before=remote-fs.target
+After=network.target network-online.target iscsid.service
+ConditionPathExists=/etc/iscsi/initiatorname.iscsi
+
+[Service]
+Type=oneshot
+ExecStart=-/sbin/iscsiadm -m node --loginall=automatic
+ExecStop=/sbin/iscsiadm -m node --logoutall=automatic
+ExecStop=/sbin/iscsiadm -m node --logoutall=manual
+SuccessExitStatus=21
+RemainAfterExit=true
+
+[Install]
+WantedBy=remote-fs.target
--
1.8.3.1

View File

@ -1,27 +0,0 @@
From bbe55896a92a20db2ce79d100e3027cd4940ddce Mon Sep 17 00:00:00 2001
From: igo95862 <igo95862@yandex.ru>
Date: Mon, 11 Feb 2019 14:53:23 -0800
Subject: [PATCH] Fixed iscsi.service considering every signal and exit code as
successful. Now only code 21 (no objects found to execute on) and normal exit
conditions are valid.
---
etc/systemd/iscsi.service | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/etc/systemd/iscsi.service b/etc/systemd/iscsi.service
index 03876c5..e475888 100644
--- a/etc/systemd/iscsi.service
+++ b/etc/systemd/iscsi.service
@@ -8,7 +8,7 @@ ConditionPathExists=/etc/iscsi/initiatorname.iscsi
[Service]
Type=oneshot
-ExecStart=-/sbin/iscsiadm -m node --loginall=automatic
+ExecStart=/sbin/iscsiadm -m node --loginall=automatic
ExecStop=/sbin/iscsiadm -m node --logoutall=automatic
ExecStop=/sbin/iscsiadm -m node --logoutall=manual
SuccessExitStatus=21
--
1.8.3.1

View File

@ -1,27 +0,0 @@
From 42c30d191e3da86f543f665d49bc84a68ca25bf7 Mon Sep 17 00:00:00 2001
From: pengyeqing <pengyeqing@huawei.com>
Date: Sat, 26 Jan 2019 22:44:59 +0800
Subject: [PATCH] iscsi-initiator-utils: add sleep for service
add sleep for service
Signed-off-by: pengyeqing <pengyeqing@huawei.com>
---
etc/systemd/iscsid.service | 1 +
1 file changed, 1 insertion(+)
diff --git a/etc/systemd/iscsid.service b/etc/systemd/iscsid.service
index 653dd08..ecc5f65 100644
--- a/etc/systemd/iscsid.service
+++ b/etc/systemd/iscsid.service
@@ -10,6 +10,7 @@ Before=remote-fs-pre.target
Type=forking
PIDFile=/var/run/iscsid.pid
ExecStart=/usr/sbin/iscsid
+ExecStartPost=/usr/bin/sleep 1
ExecStop=/sbin/iscsiadm -k 0 2
[Install]
--
1.8.3.1

View File

@ -1,29 +0,0 @@
From 3de6ac0237bf10e6ba60e72faa4c06cfb469e070 Mon Sep 17 00:00:00 2001
From: pengyeqing <pengyeqing@huawei.com>
Date: Sat, 26 Jan 2019 23:53:37 +0800
Subject: [PATCH] iscsi-initiator-utils: fix timeout setting on session
commands
reason:fix timeout setting on session commands
Signed-off-by: pengyeqing <pengyeqing@huawei.com>
---
usr/iscsiadm.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/usr/iscsiadm.c b/usr/iscsiadm.c
index a6b9605..5d432cd 100644
--- a/usr/iscsiadm.c
+++ b/usr/iscsiadm.c
@@ -4018,6 +4018,8 @@ main(int argc, char **argv)
goto out;
}
+ info->iscsid_req_tmo = -1;
+
rc = iscsi_sysfs_get_sessioninfo_by_id(info, session);
if (rc) {
log_error("Could not get session info for sid "
--
1.8.3.1

View File

@ -1,43 +0,0 @@
From 8576421467835d5c5ff5d48c3ff82ca797274236 Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Tue, 12 May 2020 15:43:10 +0800
Subject: [PATCH] iscsi-iname: verify prefix length is at most 210
Don't know who might be trying to make reall long IQNs
Signed-off-by: Chris Leech <cleech@redhat.com>
---
utils/iscsi-iname.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/utils/iscsi-iname.c b/utils/iscsi-iname.c
index 6273d83..da8e68a 100644
--- a/utils/iscsi-iname.c
+++ b/utils/iscsi-iname.c
@@ -35,7 +35,11 @@
#include "md5.h"
#define RANDOM_NUM_GENERATOR "/dev/urandom"
-
+/*
+ * iSCSI names have a maxinum length of 223 characters, we reserve 13 to append
+ * a seperator and 12 characters (6 random bytes in hex representation)
+ */
+#define PREFIX_MAX_LEN 210
int
main(int argc, char *argv[])
{
@@ -67,6 +71,10 @@ main(int argc, char *argv[])
exit(0);
} else if ( strcmp(prefix, "-p") == 0 ) {
prefix = argv[2];
+ if (strnlen(prefix, PREFIX_MAX_LEN + 1) > PREFIX_MAX_LEN) {
+ printf("Error: Prexfix cannot exceed %d "
+ "characters.\n", PREFIX_MAX_LEN);
+ }
} else {
printf("\nUsage: iscsi-iname [-h | --help | "
"-p <prefix>]\n");
--
1.8.3.1

View File

@ -1,56 +0,0 @@
From ed9621a9330c542e73c4290de76644b48e4d5113 Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Tue, 12 May 2020 15:50:09 +0800
Subject: [PATCH] iscsi-iname remove unneeded temp buffer
iscsi-iname remove unneeded temp buffer
Signed-off-by: Chris Leech <cleech@redhat.com>
---
utils/iscsi-iname.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/utils/iscsi-iname.c b/utils/iscsi-iname.c
index da8e68a..086d9bb 100644
--- a/utils/iscsi-iname.c
+++ b/utils/iscsi-iname.c
@@ -43,7 +43,6 @@
int
main(int argc, char *argv[])
{
- char iname[256];
struct timeval time;
struct utsname system_info;
long hostid;
@@ -56,7 +55,6 @@ main(int argc, char *argv[])
char *prefix;
/* initialize */
- memset(iname, 0, sizeof (iname));
memset(digest, 0, sizeof (digest));
memset(&context, 0, sizeof (context));
MD5Init(&context);
@@ -71,7 +69,7 @@ main(int argc, char *argv[])
exit(0);
} else if ( strcmp(prefix, "-p") == 0 ) {
prefix = argv[2];
- if (strnlen(prefix, PREFIX_MAX_LEN + 1) > PREFIX_MAX_LEN) {
+ if (strnlen(prefix, PREFIX_MAX_LEN + 1) > PREFIX_MAX_LEN) {
printf("Error: Prexfix cannot exceed %d "
"characters.\n", PREFIX_MAX_LEN);
}
@@ -140,10 +138,8 @@ main(int argc, char *argv[])
}
/* print the prefix followed by 6 bytes of the MD5 hash */
- sprintf(iname, "%s:%x%x%x%x%x%x", prefix,
+ printf("%s:%x%x%x%x%x%x", prefix,
bytes[0], bytes[1], bytes[2], bytes[3], bytes[4], bytes[5]);
- iname[sizeof (iname) - 1] = '\0';
- printf("%s\n", iname);
return 0;
}
--
1.8.3.1

BIN
open-iscsi-2.1.1.tar.gz Normal file

Binary file not shown.

Binary file not shown.

View File

@ -3,62 +3,33 @@
%global socket_enable() /bin/systemctl enable %1.socket >/dev/null 2>&1 || :
Name: open-iscsi
Version: 2.0.876
Release: 22
Version: 2.1.1
Release: 1
Summary: ISCSI software initiator daemon and utility programs
License: GPLv2+ and BSD
URL: http://www.open-iscsi.org
Source0: https://github.com/open-iscsi/open-iscsi/archive/f3c8e90fc0894c088950a15ee6618b427f9e2457.tar.gz#/open-iscsi-f3c8e90.tar.gz
Source0: https://github.com/open-iscsi/open-iscsi/archive/2.1.1.tar.gz#/open-iscsi-2.1.1.tar.gz
Patch1: 0001-change-iscsi-iqn-default-value.patch
Patch2: 0002-iscsid-Check-nr_sessions-when-creating-a-copy-of-exi.patch
Patch3: 0003-add-sleep-for-service.patch
Patch4: 0004-not-send-stop-message-if-iscsid-absent.patch
Patch5: 0005-iscsid-SIGTERM-syncprocess-hang.patch
Patch6: 0006-restart-log-daemon-when-exited-abnormally.patch
Patch7: 0007-check-initiator-name-out-of-range.patch
Patch8: 0008-do-not-sync-session-when-a-session-is-already-created.patch
Patch9: 0009-fix-default-file-corrupt.patch
Patch10: 0010-iscsiadm-fix-infinite-loop-while-recv-returns-0.patch
Patch11: 0011-fix-iscsiadm-logout-timeout.patch
Patch12: 0012-default-file-zero-after-power-outage.patch
Patch13: 0013-Fix-issue-where-iscsi-iname-p-core-dumps.patch
Patch14: 0014-modify-iSCSI-shared-memory-permissions-for-logs.patch
Patch15: 0015-iscsi-Add-break-to-while-loop.patch
Patch16: 0016-iscsi-fix-fd-leak.patch
Patch17: 0017-Fix-devel-without-node-header-files.patch
Patch18: 0018-resolve-compilation-errors.patch
Patch0000: 0000-Plugging-a-memory-leak-from-discovery.patch
Patch0001: 0001-Fix-bug-in-error-message-when-reading-sysfs-numbers.patch
Patch0002: 0002-Do-not-allow-multiple-sessions-when-nr_sessions-1.patch
Patch0003: 0003-Fix-possible-discovery-hang-when-timing-out.patch
Patch0004: 0004-Resource-leak-returning-without-freeing-netdev.patch
Patch0005: 0005-Out-of-bounds-write-Overrunning-array-link_target.patch
Patch0006: 0006-Resource-leak-Variable-rec-going-out-of-scope-leaks.patch
Patch0007: 0007-Out-of-bounds-write-Overrunning-array-link_target.patch
Patch0008: 0008-Buffer-not-null-terminated-Calling-strncpy.patch
Patch0009: 0009-Resource-leak-Variable-startup_cmd-going-out-of-scop.patch
Patch0010: 0010-Buffer-not-null-terminated-Calling-strncpy.patch
Patch0011: 0011-Uninitialized-scalar-variable.patch
Patch0012: 0012-Resource-leak-Handle-variable-sockfd-going-out-of-scope.patch
Patch0013: 0013-Resource-leak-Variable-chap_info-going-out-of-scope.patch
Patch0014: 0014-Resource-leak-Variable-matched_ses-going-out-of-scope.patch
Patch0015: 0015-Resource-leak-Handle-variable-fd-going-out-of-scope.patch
Patch0016: 0016-Resource-leak-Handle-variable-fd-going-out-of-scope.patch
Patch0017: 0017-Out-of-bounds-read.patch
Patch0018: 0018-fwparam_pcc-mulitple-resource-leaks.patch
Patch0019: 0019-Resource-leak-Handl-variable-fd.patch
Patch0020: 0020-Resource-leak-Variable-raw.patch
Patch0021: 0021-Allow-reading-sysfs-port-to-fail-gracefully.patch
Patch0022: 0022-Fix-incorrect-sysfs-logic-for-port-and-ip-address.patch
Patch0023: 0023-Handle-ENOTCONN-error-separately-when-reading-sysfs.patch
Patch0024: 0024-Added-service-file-for-iscsi-logins.patch
Patch0025: 0025-Fixed-iscsi.service-considering-every-signal-and-exi.patch
Patch0026: 0026-change-iscsi-iqn-default-value.patch
Patch0027: 0027-iscsid-Check-nr_sessions-when-creating-a-copy-of-exi.patch
Patch0028: 0028-add-sleep-for-service.patch
Patch0029: 0029-not-send-stop-message-if-iscsid-absent.patch
Patch0030: 0030-iscsid-SIGTERM-syncprocess-hang.patch
Patch0031: 0031-fix-timeout-setting-on-session-commands.patch
Patch0032: 0032-restart-log-daemon-when-exited-abnormally.patch
Patch0033: 0033-check-initiator-name-out-of-range.patch
Patch0034: 0034-do-not-sync-session-when-a-session-is-already-created.patch
Patch0035: 0035-fix-default-file-corrupt.patch
Patch0036: 0036-iscsiadm-fix-infinite-loop-while-recv-returns-0.patch
Patch0037: 0037-fix-iscsiadm-logout-timeout.patch
Patch0038: 0038-default-file-zero-after-power-outage.patch
Patch0039: 0039-iscsi-iname-verify-prefix-length-is-at-most-210.patch
Patch0040: 0040-iscsi-iname-remove-unneeded-temp-buffer.patch
Patch0041: 0041-Fix-issue-where-iscsi-iname-p-core-dumps.patch
Patch0042: 0042-modify-iSCSI-shared-memory-permissions-for-logs.patch
Patch0043: 0043-iscsi-Add-break-to-while-loop.patch
Patch0044: 0044-iscsi-fix-fd-leak.patch
Patch0045: 0045-Fix-devel-without-node-header-files.patch
BuildRequires: flex bison doxygen kmod-devel systemd-units gcc git isns-utils-devel
BuildRequires: flex bison doxygen kmod-devel systemd-units gcc git isns-utils-devel systemd-devel
BuildRequires: autoconf automake libtool libmount-devel openssl-devel pkg-config gdb
Provides: iscsi-initiator-utils
@ -107,7 +78,7 @@ Requires: man
This contains man files for the using of %{name}.
%prep
%autosetup -n open-iscsi-f3c8e90fc0894c088950a15ee6618b427f9e2457 -p1
%autosetup -n open-iscsi-2.1.1 -p1
perl -i -pe 's|^exec_prefix = /$|exec_prefix = %{_exec_prefix}|' Makefile
%build
@ -189,8 +160,11 @@ fi
%{_mandir}/man8/*
%changelog
* Thu Jul 9 2020 wuguanghao <wuguanghao3@huawei.com> - 2.1.1-1
- update open-iscsi version to 2.1.1-1
* Sun Jul 5 2020 Zhiqiang Liu <lzhq28@mail.ustc.edu.cn> - 2.0.876-22
- remove useless readme files.
- remove useless readme files
* Mon Jun 15 2020 sunguoshuai <sunguoshuai@huawei.com> - 2.0.876-21
- fix devel without node header files