import iscsi-initiator-utils-6.2.0.878-4.gitd791ce0.el8

This commit is contained in:
CentOS Sources 2020-04-28 05:41:19 -04:00 committed by Andrew Lukoshko
parent a56167bc10
commit 2c8f73dafe
30 changed files with 1182 additions and 222 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
SOURCES/open-iscsi-f71581b.tar.gz
SOURCES/open-iscsi-d791ce0.tar.gz

View File

@ -1 +1 @@
3d3234035cc7884aa512161e06be6737ade52077 SOURCES/open-iscsi-f71581b.tar.gz
8724d0141bb4777e5728c3c16b2f89f123e0f8b0 SOURCES/open-iscsi-d791ce0.tar.gz

View File

@ -0,0 +1,25 @@
From 0c3953aebf69e23d7012a813ca2b35c5709acb02 Mon Sep 17 00:00:00 2001
From: Patrick McCarty <patrick.mccarty@intel.com>
Date: Wed, 8 Jan 2020 11:04:17 -0800
Subject: [PATCH] Fix bug with libopeniscsiusr.pc
The library name is libopeniscsiusr, so the -l linker option should be
`-lopeniscsiusr` instead of `-liscsiusr`.
---
libopeniscsiusr/libopeniscsiusr.pc.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libopeniscsiusr/libopeniscsiusr.pc.in b/libopeniscsiusr/libopeniscsiusr.pc.in
index f0fb583..6bbee47 100644
--- a/libopeniscsiusr/libopeniscsiusr.pc.in
+++ b/libopeniscsiusr/libopeniscsiusr.pc.in
@@ -5,5 +5,5 @@ Name: libopeniscsiusr
Version: __VERSION__
Description: iSCSI userspace library
Requires:
-Libs: -L${libdir} -liscsiusr
+Libs: -L${libdir} -lopeniscsiusr
Cflags: -I${includedir}
--
2.21.1

View File

@ -0,0 +1,29 @@
From e9c9117b7a84866366691110496984fc651e3e43 Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Fri, 17 Jan 2020 13:42:10 -0800
Subject: [PATCH 1/1] Revert "Out-of-bounds read: Overrunning array of 8 2-byte
elements"
It's been reported that this breaks IPv6 discovery with qedi controllers
This reverts commit af48f0d68db48cd492d0e27e046fc011be236fd3.
---
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 5710199..05efa73 100644
--- a/iscsiuio/src/uip/ipv6.c
+++ b/iscsiuio/src/uip/ipv6.c
@@ -521,7 +521,7 @@ static void ipv6_insert_protocol_chksum(struct ipv6_hdr *ipv6)
sum = 0;
ptr = (u16_t *)&ipv6->ipv6_src;
- for (i = 0; i < sizeof(struct ipv6_addr); i += 2) {
+ for (i = 0; i < sizeof(struct ipv6_addr); i++) {
sum += HOST_TO_NET16(*ptr);
ptr++;
}
--
2.21.1

View File

@ -0,0 +1,661 @@
From 9d36121534183195bd2892447ca07724013cef57 Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Sun, 24 Nov 2019 13:51:09 -0800
Subject: [PATCH 1/1] configuration support for CHAP algorithms
Introduces support for preference lists in configuration files, and uses
that for the 'node.session.auth.chap_algs' setting.
This is also re-used for discovery authentication, rather than have two
different configurations.
---
etc/iscsid.conf | 7 ++
libopeniscsiusr/default.c | 3 +
libopeniscsiusr/idbm.c | 95 +++++++++++++++++++++++++
libopeniscsiusr/idbm.h | 9 +++
libopeniscsiusr/idbm_fields.h | 1 +
usr/auth.c | 64 ++++++++++++-----
usr/auth.h | 3 +
usr/config.h | 1 +
usr/idbm.c | 126 ++++++++++++++++++++++++++++++----
usr/idbm.h | 2 +
usr/idbm_fields.h | 1 +
usr/initiator.h | 1 +
usr/initiator_common.c | 2 +
usr/login.c | 11 +++
14 files changed, 294 insertions(+), 32 deletions(-)
diff --git a/etc/iscsid.conf b/etc/iscsid.conf
index 2f3a28c..420145b 100644
--- a/etc/iscsid.conf
+++ b/etc/iscsid.conf
@@ -57,6 +57,13 @@ node.leading_login = No
# to CHAP. The default is None.
#node.session.auth.authmethod = CHAP
+# To configure which CHAP algorithms to enable set
+# node.session.auth.chap_algs to a comma seperated list.
+# The algorithms should be listen with most prefered first.
+# Valid values are MD5, SHA1, SHA256, and SHA3-256.
+# The default is MD5.
+#node.session.auth.chap_algs = SHA3-256,SHA256,SHA1,MD5
+
# To set a CHAP username and password for initiator
# authentication by the target(s), uncomment the following lines:
#node.session.auth.username = username
diff --git a/libopeniscsiusr/default.c b/libopeniscsiusr/default.c
index d01d892..d3b3da3 100644
--- a/libopeniscsiusr/default.c
+++ b/libopeniscsiusr/default.c
@@ -78,6 +78,9 @@ void _default_node(struct iscsi_node *node)
node->session.initial_login_retry_max = DEF_INITIAL_LOGIN_RETRIES_MAX;
node->session.reopen_max = DEF_SESSION_REOPEN_MAX;
node->session.auth.authmethod = 0;
+ /* TYPE_INT_LIST fields should be initialized to ~0 to indicate unset values */
+ memset(node->session.auth.chap_algs, ~0, sizeof(node->session.auth.chap_algs));
+ node->session.auth.chap_algs[0] = ISCSI_AUTH_CHAP_ALG_MD5;
node->session.auth.password_length = 0;
node->session.auth.password_in_length = 0;
node->session.err_tmo.abort_timeout = DEF_ABORT_TIMEO;
diff --git a/libopeniscsiusr/idbm.c b/libopeniscsiusr/idbm.c
index 342aab5..d1fc03d 100644
--- a/libopeniscsiusr/idbm.c
+++ b/libopeniscsiusr/idbm.c
@@ -73,6 +73,7 @@
#define TYPE_INT32 6
#define TYPE_INT64 7
#define TYPE_BOOL 8
+#define TYPE_INT_LIST 9
#define MAX_KEYS 256 /* number of keys total(including CNX_MAX) */
#define NAME_MAXVAL 128 /* the maximum length of key name */
#define VALUE_MAXVAL 256 /* the maximum length of 223 bytes in the RFC. */
@@ -248,6 +249,39 @@ do { \
_n++; \
} while(0)
+#define ARRAY_LEN(x) ( sizeof(x) / sizeof((x)[0]) )
+
+/* Options list type, rather than matching a single value this populates an
+ * array with a list of values in user specified order.
+ * Requires a table matching config strings to values.
+ **/
+#define _rec_int_list(_key, _recs, _org, _name, _show, _tbl, _n, _mod) \
+do {\
+ _recs[_n].type = TYPE_INT_LIST; \
+ _strncpy(_recs[_n].name, _key, NAME_MAXVAL); \
+ for (unsigned int _i = 0; _i < ARRAY_LEN(_org->_name); _i++) { \
+ if (_org->_name[_i] != ~0UL) { \
+ for (unsigned int _j = 0; _j < ARRAY_LEN(_tbl); _j++) { \
+ if (_tbl[_j].value == _org->_name[_i]) { \
+ strcat(_recs[_n].value, _tbl[_j].name); \
+ strcat(_recs[_n].value, ","); \
+ break; \
+ } \
+ } \
+ } \
+ } \
+ /* delete traling ',' */ \
+ if (strrchr(_recs[_n].value, ',')) \
+ *strrchr(_recs[_n].value, ',') = '\0'; \
+ _recs[_n].data = &_org->_name; \
+ _recs[_n].data_len = sizeof(_org->_name); \
+ _recs[_n].visible = _show; \
+ _recs[_n].opts[0] = (void *)&_tbl; \
+ _recs[_n].numopts = ARRAY_LEN(_tbl); \
+ _recs[_n].can_modify = _mod; \
+ _n++; \
+} while(0)
+
enum modify_mode {
_CANNOT_MODIFY,
_CAN_MODIFY,
@@ -557,6 +591,11 @@ void _idbm_node_print(struct iscsi_node *node, FILE *f, bool show_secret)
_idbm_recs_free(recs);
}
+struct int_list_tbl {
+ const char *name;
+ unsigned int value;
+};
+
static int _idbm_rec_update_param(struct iscsi_context *ctx,
struct idbm_rec *recs, char *name,
char *value, int line_number)
@@ -564,8 +603,14 @@ static int _idbm_rec_update_param(struct iscsi_context *ctx,
int rc = LIBISCSI_OK;
int i = 0;
int j = 0;
+ int k = 0;
int passwd_done = 0;
char passwd_len[8];
+ struct int_list_tbl *tbl = NULL;
+ char *tmp_value;
+ int *tmp_data;
+ bool *found;
+ char *token;
assert(ctx != NULL);
assert(recs != NULL);
@@ -642,6 +687,47 @@ setup_passwd_len:
else
goto unknown_value;
goto updated;
+ case TYPE_INT_LIST:
+ if (!recs[i].data)
+ continue;
+ tbl = (void *)recs[i].opts[0];
+ /* strsep is destructive, make a copy to work with */
+ tmp_value = strdup(value);
+ k = 0;
+ tmp_data = malloc(recs[i].data_len);
+ memset(tmp_data, ~0, recs[i].data_len);
+ found = calloc(recs[i].numopts, sizeof(bool));
+next_token: while ((token = strsep(&tmp_value, ", \n"))) {
+ if (!strlen(token))
+ continue;
+ if ((k * (int)sizeof(int)) >= (recs[i].data_len)) {
+ _warn(ctx, "Too many values set for '%s'"
+ ", continuing without processing them all",
+ recs[i].name);
+ break;
+ }
+ for (j = 0; j < recs[i].numopts; j++) {
+ if (!strcmp(token, tbl[j].name)) {
+ if ((found[j])) {
+ _warn(ctx, "Ignoring repeated value '%s'"
+ " for '%s'", token, recs[i].name);
+ goto next_token;
+ }
+ ((unsigned *)tmp_data)[k++] = tbl[j].value;
+ found[j] = true;
+ goto next_token;
+ }
+ }
+ _warn(ctx, "Ignoring unknown value '%s'"
+ " for '%s'", token, recs[i].name);
+ }
+ memcpy(recs[i].data, tmp_data, recs[i].data_len);
+ free(tmp_value);
+ free(tmp_data);
+ tmp_value = NULL;
+ tmp_data = NULL;
+ token = NULL;
+ goto updated;
default:
unknown_value:
_error(ctx, "Got unknown data type %d "
@@ -881,6 +967,13 @@ void _idbm_free(struct idbm *db)
free(db);
}
+static struct int_list_tbl chap_algs[] = {
+ { "MD5", ISCSI_AUTH_CHAP_ALG_MD5 },
+ { "SHA1", ISCSI_AUTH_CHAP_ALG_SHA1 },
+ { "SHA256", ISCSI_AUTH_CHAP_ALG_SHA256 },
+ { "SHA3-256", ISCSI_AUTH_CHAP_ALG_SHA3_256 },
+};
+
static void _idbm_node_rec_link(struct iscsi_node *node, struct idbm_rec *recs)
{
int num = 0;
@@ -943,6 +1036,8 @@ static void _idbm_node_rec_link(struct iscsi_node *node, struct idbm_rec *recs)
_rec_uint32(SESSION_PASSWORD_IN_LEN, recs, node,
session.auth.password_in_length, IDBM_HIDE, num,
_CAN_MODIFY);
+ _rec_int_list(SESSION_CHAP_ALGS, recs, node, session.auth.chap_algs,
+ IDBM_SHOW, chap_algs, num, _CAN_MODIFY);
_rec_int64(SESSION_REPLACEMENT_TMO, recs, node,
session.tmo.replacement_timeout, IDBM_SHOW, num,
_CAN_MODIFY);
diff --git a/libopeniscsiusr/idbm.h b/libopeniscsiusr/idbm.h
index c84d332..5a4d2fa 100644
--- a/libopeniscsiusr/idbm.h
+++ b/libopeniscsiusr/idbm.h
@@ -49,6 +49,14 @@ enum iscsi_auth_method {
ISCSI_AUTH_METHOD_CHAP,
};
+enum iscsi_chap_algs {
+ ISCSI_AUTH_CHAP_ALG_MD5 = 5,
+ ISCSI_AUTH_CHAP_ALG_SHA1 = 6,
+ ISCSI_AUTH_CHAP_ALG_SHA256 = 7,
+ ISCSI_AUTH_CHAP_ALG_SHA3_256 = 8,
+ AUTH_CHAP_ALG_MAX_COUNT = 5,
+};
+
enum iscsi_startup_type {
ISCSI_STARTUP_MANUAL,
ISCSI_STARTUP_AUTOMATIC,
@@ -93,6 +101,7 @@ struct iscsi_auth_config {
char username_in[AUTH_STR_MAX_LEN];
unsigned char password_in[AUTH_STR_MAX_LEN];
uint32_t password_in_length;
+ unsigned int chap_algs[AUTH_CHAP_ALG_MAX_COUNT];
};
/* all TCP options go in this structure.
diff --git a/libopeniscsiusr/idbm_fields.h b/libopeniscsiusr/idbm_fields.h
index 29a2090..8bf17b0 100644
--- a/libopeniscsiusr/idbm_fields.h
+++ b/libopeniscsiusr/idbm_fields.h
@@ -120,6 +120,7 @@
#define SESSION_USERNAME_IN "node.session.auth.username_in"
#define SESSION_PASSWORD_IN "node.session.auth.password_in"
#define SESSION_PASSWORD_IN_LEN "node.session.auth.password_in_length"
+#define SESSION_CHAP_ALGS "node.session.auth.chap_algs"
#define SESSION_REPLACEMENT_TMO "node.session.timeo.replacement_timeout"
#define SESSION_ABORT_TMO "node.session.err_timeo.abort_timeout"
#define SESSION_LU_RESET_TMO "node.session.err_timeo.lu_reset_timeout"
diff --git a/usr/auth.c b/usr/auth.c
index 5c819c2..a222c53 100644
--- a/usr/auth.c
+++ b/usr/auth.c
@@ -1806,7 +1806,7 @@ acl_chk_chap_alg_list(unsigned int option_count, const int *option_list)
return 0;
}
-static int
+int
acl_set_chap_alg_list(struct iscsi_acl *client, unsigned int option_count,
const int *option_list)
{
@@ -1819,22 +1819,54 @@ acl_set_chap_alg_list(struct iscsi_acl *client, unsigned int option_count,
}
int
-acl_init_chap_digests(int *value_list) {
+acl_init_chap_digests(int *value_list, unsigned *chap_algs, int conf_count) {
EVP_MD_CTX *context = EVP_MD_CTX_new();
int i = 0;
- if (EVP_DigestInit_ex(context, EVP_sha3_256(), NULL)) {
- value_list[i++] = AUTH_CHAP_ALG_SHA3_256;
- }
- if (EVP_DigestInit_ex(context, EVP_sha256(), NULL)) {
- value_list[i++] = AUTH_CHAP_ALG_SHA256;
- }
- if (EVP_DigestInit_ex(context, EVP_sha1(), NULL)) {
- value_list[i++] = AUTH_CHAP_ALG_SHA1;
- }
- if (EVP_DigestInit_ex(context, EVP_md5(), NULL)) {
- value_list[i++] = AUTH_CHAP_ALG_MD5;
+ for (int j = 0; j < conf_count; j++) {
+ switch (chap_algs[j]) {
+ case AUTH_CHAP_ALG_MD5:
+ if (EVP_DigestInit_ex(context, EVP_md5(), NULL)) {
+ value_list[i++] = AUTH_CHAP_ALG_MD5;
+ } else {
+ log_warning("Ignoring CHAP algorthm request for "
+ "MD5 due to crypto lib configuration");
+ }
+ break;
+ case AUTH_CHAP_ALG_SHA1:
+ if (EVP_DigestInit_ex(context, EVP_sha1(), NULL)) {
+ value_list[i++] = AUTH_CHAP_ALG_SHA1;
+ } else {
+ log_warning("Ignoring CHAP algorthm request for "
+ "SHA1 due to crypto lib configuration");
+ }
+ break;
+ case AUTH_CHAP_ALG_SHA256:
+ if (EVP_DigestInit_ex(context, EVP_sha256(), NULL)) {
+ value_list[i++] = AUTH_CHAP_ALG_SHA256;
+ } else {
+ log_warning("Ignoring CHAP algorthm request for "
+ "SHA256 due to crypto lib configuration");
+ }
+ break;
+ case AUTH_CHAP_ALG_SHA3_256:
+ if (EVP_DigestInit_ex(context, EVP_sha3_256(), NULL)) {
+ value_list[i++] = AUTH_CHAP_ALG_SHA3_256;
+ } else {
+ log_warning("Ignoring CHAP algorthm request for "
+ "SHA3-256 due to crypto lib configuration");
+ }
+ break;
+ case ~0:
+ /* unset value in array, just ignore */
+ break;
+ default:
+ log_warning("Ignoring unknown CHAP algorithm request "
+ "'%d'", chap_algs[j]);
+ break;
+ }
}
+
return i;
}
@@ -1926,12 +1958,6 @@ acl_init(int node_type, int buf_desc_count, struct auth_buffer_desc *buff_desc)
return AUTH_STATUS_ERROR;
}
- if (acl_set_chap_alg_list(client, acl_init_chap_digests(value_list),
- value_list) != AUTH_STATUS_NO_ERROR) {
- client->phase = AUTH_PHASE_ERROR;
- return AUTH_STATUS_ERROR;
- }
-
return AUTH_STATUS_NO_ERROR;
}
diff --git a/usr/auth.h b/usr/auth.h
index f6dbbe4..16cdb24 100644
--- a/usr/auth.h
+++ b/usr/auth.h
@@ -271,6 +271,9 @@ extern int acl_send_transit_bit(struct iscsi_acl *client, int *value);
extern int acl_set_user_name(struct iscsi_acl *client, const char *username);
extern int acl_set_passwd(struct iscsi_acl *client,
const unsigned char *pw_data, unsigned int pw_len);
+extern int acl_set_chap_alg_list(struct iscsi_acl *client, unsigned int option_count,
+ const int *option_list);
+extern int acl_init_chap_digests(int *value_list, unsigned int *chap_algs, int count);
extern int acl_set_auth_rmt(struct iscsi_acl *client, int auth_rmt);
extern int acl_set_ip_sec(struct iscsi_acl *client, int ip_sec);
extern int acl_get_dbg_status(struct iscsi_acl *client, int *value);
diff --git a/usr/config.h b/usr/config.h
index 250879d..79059ec 100644
--- a/usr/config.h
+++ b/usr/config.h
@@ -58,6 +58,7 @@ struct iscsi_auth_config {
char username_in[AUTH_STR_MAX_LEN];
unsigned char password_in[AUTH_STR_MAX_LEN];
unsigned int password_in_length;
+ unsigned int chap_algs[AUTH_CHAP_ALG_MAX_COUNT];
};
/* all per-connection timeouts go in this structure.
diff --git a/usr/idbm.c b/usr/idbm.c
index 0c6870c..749203a 100644
--- a/usr/idbm.c
+++ b/usr/idbm.c
@@ -51,6 +51,8 @@
static struct idbm *db;
+#define ARRAY_LEN(x) ( sizeof(x) / sizeof((x)[0]) )
+
#define __recinfo_str(_key, _info, _rec, _name, _show, _n, _mod) do { \
_info[_n].type = TYPE_STR; \
strlcpy(_info[_n].name, _key, NAME_MAXVAL); \
@@ -165,6 +167,42 @@ static struct idbm *db;
_n++; \
} while(0)
+#define __recinfo_int_list(_key,_info,_rec,_name,_show,_tbl,_n,_mod) do { \
+ _info[_n].type = TYPE_INT_LIST; \
+ strlcpy(_info[_n].name, _key, NAME_MAXVAL); \
+ for(int _i = 0; _i < ARRAY_LEN(_rec->_name); _i++) { \
+ if (_rec->_name[_i] != ~0) { \
+ for (int _j = 0; _j < ARRAY_LEN(_tbl); _j++) { \
+ if (_tbl[_j].value == _rec->_name[_i]) { \
+ strcat(_info[_n].value, _tbl[_j].name); \
+ strcat(_info[_n].value, ","); \
+ break; \
+ } \
+ } \
+ } \
+ } \
+ /* delete trailing ',' */ \
+ if (strrchr(_info[_n].value, ',')) \
+ *strrchr(_info[_n].value, ',') = '\0'; \
+ _info[_n].data = &_rec->_name; \
+ _info[_n].data_len = sizeof(_rec->_name); \
+ _info[_n].visible = _show; \
+ _info[_n].opts[0] = (void *)&_tbl; \
+ _info[_n].numopts = ARRAY_LEN(_tbl); \
+ _info[_n].can_modify = _mod; \
+ _n++; \
+} while (0)
+
+static struct int_list_tbl {
+ const char *name;
+ int value;
+} chap_algs [] = {
+ { "MD5", AUTH_CHAP_ALG_MD5 },
+ { "SHA1", AUTH_CHAP_ALG_SHA1 },
+ { "SHA256", AUTH_CHAP_ALG_SHA256 },
+ { "SHA3-256", AUTH_CHAP_ALG_SHA3_256 },
+};
+
static int idbm_remove_disc_to_node_link(node_rec_t *rec, char *portal);
static void
@@ -199,6 +237,10 @@ idbm_recinfo_discovery(discovery_rec_t *r, recinfo_t *ri)
__recinfo_int(DISC_ST_PASSWORD_IN_LEN, ri, r,
u.sendtargets.auth.password_in_length, IDBM_HIDE,
num, 1);
+ /* reusing SESSION_CHAP_ALGS */
+ __recinfo_int_list(SESSION_CHAP_ALGS, ri, r,
+ u.sendtargets.auth.chap_algs,
+ IDBM_SHOW, chap_algs, num, 1);
__recinfo_int(DISC_ST_LOGIN_TMO, ri, r,
u.sendtargets.conn_timeo.login_timeout,
IDBM_SHOW, num, 1);
@@ -431,6 +473,8 @@ idbm_recinfo_node(node_rec_t *r, recinfo_t *ri)
session.auth.password_in, IDBM_MASKED, num, 1);
__recinfo_int(SESSION_PASSWORD_IN_LEN, ri, r,
session.auth.password_in_length, IDBM_HIDE, num, 1);
+ __recinfo_int_list(SESSION_CHAP_ALGS, ri, r,
+ session.auth.chap_algs, IDBM_SHOW, chap_algs, num, 1);
__recinfo_int(SESSION_REPLACEMENT_TMO, ri, r,
session.timeo.replacement_timeout,
IDBM_SHOW, num, 1);
@@ -940,6 +984,9 @@ idbm_discovery_setup_defaults(discovery_rec_t *rec, discovery_type_e type)
rec->u.sendtargets.auth.authmethod = 0;
rec->u.sendtargets.auth.password_length = 0;
rec->u.sendtargets.auth.password_in_length = 0;
+ /* TYPE_INT_LIST fields should be initialized to ~0 to indicate unset values */
+ memset(rec->u.sendtargets.auth.chap_algs, ~0, sizeof(rec->u.sendtargets.auth.chap_algs));
+ rec->u.sendtargets.auth.chap_algs[0] = AUTH_CHAP_ALG_MD5;
rec->u.sendtargets.conn_timeo.login_timeout=15;
rec->u.sendtargets.conn_timeo.auth_timeout = 45;
rec->u.sendtargets.conn_timeo.active_timeout=30;
@@ -973,59 +1020,109 @@ int idbm_rec_update_param(recinfo_t *info, char *name, char *value,
int i;
int passwd_done = 0;
char passwd_len[8];
+ char *tmp_value, *token;
+ bool *found;
+ int *tmp_data;
setup_passwd_len:
for (i=0; i<MAX_KEYS; i++) {
if (!strcmp(name, info[i].name)) {
- int j;
+ int j,k;
+ struct int_list_tbl *tbl;
log_debug(7, "updated '%s', '%s' => '%s'", name,
info[i].value, value);
/* parse recinfo by type */
- if (info[i].type == TYPE_INT) {
+ switch (info[i].type) {
+ case TYPE_INT:
if (!info[i].data)
continue;
*(int*)info[i].data =
strtoul(value, NULL, 10);
goto updated;
- } else if (info[i].type == TYPE_UINT8) {
+ case TYPE_UINT8:
if (!info[i].data)
continue;
*(uint8_t *)info[i].data =
strtoul(value, NULL, 10);
goto updated;
- } else if (info[i].type == TYPE_UINT16) {
+ case TYPE_UINT16:
if (!info[i].data)
continue;
*(uint16_t *)info[i].data =
strtoul(value, NULL, 10);
goto updated;
- } else if (info[i].type == TYPE_UINT32) {
+ case TYPE_UINT32:
if (!info[i].data)
continue;
*(uint32_t *)info[i].data =
strtoul(value, NULL, 10);
goto updated;
- } else if (info[i].type == TYPE_STR) {
+ case TYPE_STR:
if (!info[i].data)
continue;
strlcpy((char*)info[i].data,
value, info[i].data_len);
goto updated;
- }
- for (j=0; j<info[i].numopts; j++) {
- if (!strcmp(value, info[i].opts[j])) {
- if (!info[i].data)
+ case TYPE_INT_O:
+ for (j=0; j<info[i].numopts; j++) {
+ if (!strcmp(value, info[i].opts[j])) {
+ if (!info[i].data)
+ continue;
+
+ *(int*)info[i].data = j;
+ goto updated;
+ }
+ }
+ case TYPE_INT_LIST:
+ if (!info[i].data)
+ continue;
+ tbl = (void *)info[i].opts[0];
+ /* strsep is destructive, make a copy to work with */
+ tmp_value = strdup(value);
+ k = 0;
+ tmp_data = malloc(info[i].data_len);
+ memset(tmp_data, ~0, info[i].data_len);
+ found = calloc(info[i].numopts, sizeof(bool));
+
+next_token: while ((token = strsep(&tmp_value, ", \n"))) {
+ if (!strlen(token))
continue;
-
- *(int*)info[i].data = j;
- goto updated;
+ if ((k * (int)sizeof(int)) >= (info[i].data_len)) {
+ log_warning("Too many values set for '%s'"
+ ", continuing without processing them all",
+ info[i].name);
+ break;
+ }
+ for (j = 0; j < info[i].numopts; j++) {
+ if (!strcmp(token, tbl[j].name)) {
+ if ((found[j])) {
+ log_warning("Ignoring repeated "
+ "value '%s' "
+ "for '%s'", token,
+ info[i].name);
+ goto next_token;
+ }
+ ((int*)tmp_data)[k++] = tbl[j].value;
+ found[j] = true;
+ goto next_token;
+ }
+ }
+ log_warning("Ignoring unknown value '%s'"
+ " for '%s'", token, info[i].name);
}
+ memcpy(info[i].data, tmp_data, info[i].data_len);
+ free(tmp_value);
+ free(tmp_data);
+ tmp_value = NULL;
+ tmp_data = NULL;
+ token = NULL;
+ goto updated;
}
if (line_number) {
log_warning("config file line %d contains "
@@ -3098,6 +3195,9 @@ void idbm_node_setup_defaults(node_rec_t *rec)
rec->session.initial_login_retry_max = DEF_INITIAL_LOGIN_RETRIES_MAX;
rec->session.reopen_max = DEF_SESSION_REOPEN_MAX;
rec->session.auth.authmethod = 0;
+ /* TYPE_INT_LIST fields should be initialized to ~0 to indicate unset values */
+ memset(rec->session.auth.chap_algs, ~0, sizeof(rec->session.auth.chap_algs));
+ rec->session.auth.chap_algs[0] = AUTH_CHAP_ALG_MD5;
rec->session.auth.password_length = 0;
rec->session.auth.password_in_length = 0;
rec->session.err_timeo.abort_timeout = DEF_ABORT_TIMEO;
diff --git a/usr/idbm.h b/usr/idbm.h
index c6982e4..d1a7f63 100644
--- a/usr/idbm.h
+++ b/usr/idbm.h
@@ -46,6 +46,8 @@
#define TYPE_UINT8 3
#define TYPE_UINT16 4
#define TYPE_UINT32 5
+#define TYPE_INT_LIST 6
+
#define MAX_KEYS 256 /* number of keys total(including CNX_MAX) */
#define NAME_MAXVAL 128 /* the maximum length of key name */
#define VALUE_MAXVAL 256 /* the maximum length of 223 bytes in the RFC. */
diff --git a/usr/idbm_fields.h b/usr/idbm_fields.h
index 142c7ae..4a967fc 100644
--- a/usr/idbm_fields.h
+++ b/usr/idbm_fields.h
@@ -30,6 +30,7 @@
#define SESSION_USERNAME_IN "node.session.auth.username_in"
#define SESSION_PASSWORD_IN "node.session.auth.password_in"
#define SESSION_PASSWORD_IN_LEN "node.session.auth.password_in_length"
+#define SESSION_CHAP_ALGS "node.session.auth.chap_algs"
#define SESSION_REPLACEMENT_TMO "node.session.timeo.replacement_timeout"
#define SESSION_ABORT_TMO "node.session.err_timeo.abort_timeout"
#define SESSION_LU_RESET_TMO "node.session.err_timeo.lu_reset_timeout"
diff --git a/usr/initiator.h b/usr/initiator.h
index eccafb9..6a49ea6 100644
--- a/usr/initiator.h
+++ b/usr/initiator.h
@@ -243,6 +243,7 @@ typedef struct iscsi_session {
char username_in[AUTH_STR_MAX_LEN];
uint8_t password_in[AUTH_STR_MAX_LEN];
int password_in_length;
+ unsigned int chap_algs[AUTH_CHAP_ALG_MAX_COUNT];
iscsi_conn_t conn[ISCSI_CONN_MAX];
uint64_t param_mask;
diff --git a/usr/initiator_common.c b/usr/initiator_common.c
index 790f13d..81da8fd 100644
--- a/usr/initiator_common.c
+++ b/usr/initiator_common.c
@@ -94,6 +94,8 @@ int iscsi_setup_authentication(struct iscsi_session *session,
memcpy(session->password_in, auth_cfg->password_in,
session->password_in_length);
+ memcpy(session->chap_algs, auth_cfg->chap_algs, sizeof(auth_cfg->chap_algs));
+
if (session->password_length || session->password_in_length) {
/* setup the auth buffers */
session->auth_buffers[0].address = &session->auth_client_block;
diff --git a/usr/login.c b/usr/login.c
index d7dad21..1251e61 100644
--- a/usr/login.c
+++ b/usr/login.c
@@ -1262,6 +1262,17 @@ check_for_authentication(iscsi_session_t *session,
goto end;
}
+ int value_list[AUTH_CHAP_ALG_MAX_COUNT];
+
+ if (acl_set_chap_alg_list(auth_client,
+ acl_init_chap_digests(value_list,
+ session->chap_algs,
+ AUTH_CHAP_ALG_MAX_COUNT),
+ value_list) != AUTH_STATUS_NO_ERROR) {
+ log_error("Couldn't set CHAP algorithm list");
+ goto end;
+ }
+
if (acl_set_ip_sec(auth_client, 1) != AUTH_STATUS_NO_ERROR) {
log_error("Couldn't set IPSec");
goto end;
--
2.21.1

View File

@ -0,0 +1,25 @@
From a89f547c29f5d3f61a10eb1847b992f9f7f9a65a Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Wed, 8 Jan 2020 14:00:35 -0800
Subject: [PATCH 1/1] enable all CHAP digest functions by default
---
etc/iscsid.conf | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/etc/iscsid.conf b/etc/iscsid.conf
index 420145b..c1960e5 100644
--- a/etc/iscsid.conf
+++ b/etc/iscsid.conf
@@ -62,7 +62,7 @@ node.leading_login = No
# The algorithms should be listen with most prefered first.
# Valid values are MD5, SHA1, SHA256, and SHA3-256.
# The default is MD5.
-#node.session.auth.chap_algs = SHA3-256,SHA256,SHA1,MD5
+node.session.auth.chap_algs = SHA3-256,SHA256,SHA1,MD5
# To set a CHAP username and password for initiator
# authentication by the target(s), uncomment the following lines:
--
2.21.1

View File

@ -1,49 +0,0 @@
From aeca36572c02a8bf314037d82c4a2625636b175a Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Mon, 3 Jun 2019 14:36:48 -0700
Subject: [PATCH] fix iscsiuio build with libsystemd
---
iscsiuio/configure.ac | 2 ++
iscsiuio/src/unix/Makefile.am | 6 ++++--
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/iscsiuio/configure.ac b/iscsiuio/configure.ac
index ae23078..6138e0e 100644
--- a/iscsiuio/configure.ac
+++ b/iscsiuio/configure.ac
@@ -73,6 +73,8 @@ AC_CONFIG_COMMANDS([default],[[
echo 'char *build_date;'> src/unix/build_date.h
]],[[]])
+PKG_CHECK_MODULES([LIBSYSTEMD], [libsystemd])
+
AC_PREFIX_DEFAULT()
AC_OUTPUT([Makefile
diff --git a/iscsiuio/src/unix/Makefile.am b/iscsiuio/src/unix/Makefile.am
index a989ef0..ea5f59e 100644
--- a/iscsiuio/src/unix/Makefile.am
+++ b/iscsiuio/src/unix/Makefile.am
@@ -25,7 +25,8 @@ iscsiuio_SOURCES = build_date.c \
iscsiuio_CFLAGS = $(AM_CFLAGS) \
$(LIBNL_CFLAGS) \
- -DBYTE_ORDER=@ENDIAN@
+ -DBYTE_ORDER=@ENDIAN@ \
+ $(LIBSYSTEMD_CFLAGS)
iscsiuio_LDFLAGS= $(AM_LDADD) \
-ldl \
@@ -36,6 +37,7 @@ iscsiuio_LDFLAGS= $(AM_LDADD) \
iscsiuio_LDADD = ${top_srcdir}/src/uip/lib_iscsi_uip.a \
${top_srcdir}/src/apps/dhcpc/lib_apps_dhcpc.a\
${top_srcdir}/src/apps/brcm-iscsi/lib_apps_brcm_iscsi.a \
- ${top_srcdir}/src/unix/libs/lib_iscsiuio_hw_cnic.a
+ ${top_srcdir}/src/unix/libs/lib_iscsiuio_hw_cnic.a \
+ $(LIBSYSTEMD_LIBS)
iscsiuio_YFLAGS = -d
--
2.21.0

View File

@ -1,4 +1,4 @@
From efba620a01a2c2fa57b672bced47e88f25078b00 Mon Sep 17 00:00:00 2001
From 2d84ee02e9ac69928261b38b5876bebb2349bd65 Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Tue, 4 Jun 2019 13:23:32 -0700
Subject: [PATCH] service file tweaks

View File

@ -1,7 +1,7 @@
From dbec0a5b7737142f8a1462cdf826c35a78e899b2 Mon Sep 17 00:00:00 2001
From 97071360caa6868c21a161047ed471790c405efb Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Tue, 13 Aug 2013 10:59:44 -0700
Subject: [PATCH 01/32] idmb_rec_write, check for tpgt first
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
@ -11,12 +11,12 @@ for splitting it up.
1 file changed, 5 insertions(+), 13 deletions(-)
diff --git a/usr/idbm.c b/usr/idbm.c
index 830189f571ea..ab3577878e86 100644
index be4d4e3..a7da540 100644
--- a/usr/idbm.c
+++ b/usr/idbm.c
@@ -2042,6 +2042,10 @@ static int idbm_rec_write(node_rec_t *rec)
if (rc)
goto free_portal;
@@ -2078,6 +2078,10 @@ static int idbm_rec_write(node_rec_t *rec, bool disable_lock)
goto free_portal;
}
+ if (rec->tpgt == PORTAL_GROUP_TAG_UNKNOWN)
+ /* drop down to old style portal as config */
@ -25,7 +25,7 @@ index 830189f571ea..ab3577878e86 100644
rc = stat(portal, &statb);
if (rc) {
rc = 0;
@@ -2050,22 +2054,10 @@ static int idbm_rec_write(node_rec_t *rec)
@@ -2086,22 +2090,10 @@ static int idbm_rec_write(node_rec_t *rec, bool disable_lock)
* set the tgpt. In new versions you must pass all the info in
* from the start
*/
@ -50,5 +50,5 @@ index 830189f571ea..ab3577878e86 100644
* Old style portal as a file, but with tpgt. Let's update it.
*/
--
2.14.4
2.21.0

View File

@ -1,31 +1,35 @@
From b9d89091daab823eb2dc72c6c568af7897f83137 Mon Sep 17 00:00:00 2001
From 4c6e7c0fcc6da66cf81c0714bf907762194eedf2 Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Tue, 13 Aug 2013 11:34:31 -0700
Subject: [PATCH 02/32] idbm_rec_write, seperate old and new style writes
Subject: [PATCH] idbm_rec_write, seperate old and new style writes
Duplicates a small bit of code, but easier to understand and extened.
---
usr/idbm.c | 116 +++++++++++++++++++++++++++++++++++++++++--------------------
1 file changed, 79 insertions(+), 37 deletions(-)
usr/idbm.c | 129 +++++++++++++++++++++++++++++++++++------------------
1 file changed, 86 insertions(+), 43 deletions(-)
diff --git a/usr/idbm.c b/usr/idbm.c
index ab3577878e86..21ff61ab2bd8 100644
index a7da540..2f5e309 100644
--- a/usr/idbm.c
+++ b/usr/idbm.c
@@ -2001,7 +2001,7 @@ mkdir_portal:
@@ -2030,12 +2030,7 @@ mkdir_portal:
return f;
}
-static int idbm_rec_write(node_rec_t *rec)
-/*
- * 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;
@@ -2013,38 +2013,8 @@ static int idbm_rec_write(node_rec_t *rec)
log_error("Could not alloc portal");
@@ -2048,39 +2043,8 @@ static int idbm_rec_write(node_rec_t *rec, bool disable_lock)
return ISCSI_ERR_NOMEM;
}
-
- snprintf(portal, PATH_MAX, "%s", NODE_CONFIG_DIR);
- if (access(portal, F_OK) != 0) {
- if (mkdir(portal, 0660) != 0) {
@ -50,9 +54,11 @@ index ab3577878e86..21ff61ab2bd8 100644
rec->name, rec->conn[0].address, rec->conn[0].port);
- log_debug(5, "Looking for config file %s", portal);
-
- rc = idbm_lock();
- if (rc)
- goto free_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 */
@ -60,7 +66,7 @@ index ab3577878e86..21ff61ab2bd8 100644
rc = stat(portal, &statb);
if (rc) {
@@ -2065,11 +2035,11 @@ static int idbm_rec_write(node_rec_t *rec)
@@ -2101,11 +2065,11 @@ static int idbm_rec_write(node_rec_t *rec, bool disable_lock)
log_error("Could not convert %s: %s", portal,
strerror(errno));
rc = ISCSI_ERR_IDBM;
@ -74,7 +80,7 @@ index ab3577878e86..21ff61ab2bd8 100644
}
mkdir_portal:
@@ -2080,24 +2050,96 @@ mkdir_portal:
@@ -2116,24 +2080,103 @@ mkdir_portal:
log_error("Could not make dir %s: %s",
portal, strerror(errno));
rc = ISCSI_ERR_IDBM;
@ -87,7 +93,7 @@ index ab3577878e86..21ff61ab2bd8 100644
rec->name, rec->conn[0].address, rec->conn[0].port, rec->tpgt,
rec->iface.name);
-open_conf:
+/* open_conf: */
+
f = fopen(portal, "w");
if (!f) {
log_error("Could not open %s: %s", portal, strerror(errno));
@ -131,7 +137,12 @@ index ab3577878e86..21ff61ab2bd8 100644
+ return rc;
+}
+
+static int idbm_rec_write(node_rec_t *rec)
+/*
+ * 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;
@ -162,9 +173,11 @@ index ab3577878e86..21ff61ab2bd8 100644
+ }
+ }
+
+ rc = idbm_lock();
+ if (rc)
+ 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 */
@ -172,9 +185,9 @@ index ab3577878e86..21ff61ab2bd8 100644
+ else
+ rc = idbm_rec_write_new(rec);
+
idbm_unlock();
if (!disable_lock)
idbm_unlock();
free_portal:
free(portal);
--
2.14.4
2.21.0

View File

@ -1,4 +1,4 @@
From bf6a05987a418e4d7eeb3a24f0912c5cfc9e533d Mon Sep 17 00:00:00 2001
From 6051b9ef3cdf206630969940aba980f4088e2e14 Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Tue, 13 Aug 2013 12:39:07 -0700
Subject: [PATCH] idbw_rec_write, pick tpgt from existing record
@ -12,7 +12,7 @@ updated new style record instead.
1 file changed, 40 insertions(+)
diff --git a/usr/idbm.c b/usr/idbm.c
index c29cbed..00955e4 100644
index 2f5e309..a2332cc 100644
--- a/usr/idbm.c
+++ b/usr/idbm.c
@@ -28,6 +28,7 @@
@ -32,7 +32,7 @@ index c29cbed..00955e4 100644
static void
idbm_recinfo_discovery(discovery_rec_t *r, recinfo_t *ri)
{
@@ -2080,12 +2083,49 @@ static int idbm_rec_write_old(node_rec_t *rec)
@@ -2107,12 +2110,49 @@ static int idbm_rec_write_old(node_rec_t *rec)
FILE *f;
char *portal;
int rc = 0;

View File

@ -1,7 +1,7 @@
From 2e6f564ebb3c85cb9a457d282b845374776a54ae Mon Sep 17 00:00:00 2001
From 6602f08bfcc2b2e75d1a58671cb160c96cf2d99b Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Mon, 19 Nov 2012 16:37:13 -0800
Subject: [PATCH 06/32] update initscripts and docs
Subject: [PATCH] update initscripts and docs
---
README | 10 ++++------
@ -10,7 +10,7 @@ Subject: [PATCH 06/32] update initscripts and docs
3 files changed, 18 insertions(+), 17 deletions(-)
diff --git a/README b/README
index 2499d9a7b638..c05814a2593b 100644
index 2499d9a..c05814a 100644
--- a/README
+++ b/README
@@ -77,11 +77,6 @@ the cache sync command will fail.
@ -45,7 +45,7 @@ index 2499d9a7b638..c05814a2593b 100644
--------
diff --git a/etc/iscsid.conf b/etc/iscsid.conf
index fee11482a09b..3539ac4cd578 100644
index 70985af..2f3a28c 100644
--- a/etc/iscsid.conf
+++ b/etc/iscsid.conf
@@ -19,7 +19,7 @@
@ -105,10 +105,10 @@ index fee11482a09b..3539ac4cd578 100644
# For multipath configurations, you may want more than one session to be
# created on each iface record. If node.session.nr_sessions is greater
diff --git a/usr/idbm.c b/usr/idbm.c
index cd705fa2b033..0aa3870a76fd 100644
index a2332cc..aed08f2 100644
--- a/usr/idbm.c
+++ b/usr/idbm.c
@@ -518,9 +518,13 @@ idbm_recinfo_node(node_rec_t *r, recinfo_t *ri)
@@ -521,9 +521,13 @@ idbm_recinfo_node(node_rec_t *r, recinfo_t *ri)
IDBM_SHOW, "None", "CRC32C", "CRC32C,None",
"None,CRC32C", num, 1);
sprintf(key, CONN_DATA_DIGEST, i);
@ -123,5 +123,5 @@ index cd705fa2b033..0aa3870a76fd 100644
__recinfo_int_o2(key, ri, r, conn[i].iscsi.IFMarker, IDBM_SHOW,
"No", "Yes", num, 1);
--
2.14.4
2.21.0

View File

@ -1,4 +1,4 @@
From 29769497994066772429d57937dc3a8c0f515304 Mon Sep 17 00:00:00 2001
From 9cae86dd15bf78ee9d221f722f723062eb6ad3d8 Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Mon, 19 Nov 2012 16:38:45 -0800
Subject: [PATCH] use var for config
@ -195,10 +195,10 @@ index 6f9218f..0da0551 100644
.SH "SEE ALSO"
diff --git a/usr/idbm.c b/usr/idbm.c
index f3c812e..8b96146 100644
index aed08f2..15802c3 100644
--- a/usr/idbm.c
+++ b/usr/idbm.c
@@ -2929,9 +2929,9 @@ free_info:
@@ -2968,9 +2968,9 @@ free_info:
int idbm_init(idbm_get_config_file_fn *fn)
{
/* make sure root db dir is there */
@ -212,10 +212,10 @@ index f3c812e..8b96146 100644
return errno;
}
diff --git a/usr/idbm.h b/usr/idbm.h
index b83c0bb..2b05d78 100644
index 18c5025..6bdfd60 100644
--- a/usr/idbm.h
+++ b/usr/idbm.h
@@ -29,12 +29,13 @@
@@ -30,12 +30,13 @@
#include "list.h"
#include "flashnode.h"

View File

@ -1,7 +1,7 @@
From ea35362504329e7fe86f4af17a88bed009c5069c Mon Sep 17 00:00:00 2001
From 1ddee25396962a6bd966b98311881ed6d4cba87c Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Mon, 19 Nov 2012 16:40:04 -0800
Subject: [PATCH 08/32] use red hat for name
Subject: [PATCH] use red hat for name
---
doc/iscsi-iname.8 | 2 +-
@ -9,31 +9,31 @@ Subject: [PATCH 08/32] use red hat for name
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/doc/iscsi-iname.8 b/doc/iscsi-iname.8
index a55d666d1af3..dd77ed9f3165 100644
index 6a413f6..dd77ed9 100644
--- a/doc/iscsi-iname.8
+++ b/doc/iscsi-iname.8
@@ -14,7 +14,7 @@ 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.1994-05.com.redhat"
.SH AUTHORS
Open-iSCSI project <http://www.open-iscsi.com/>
diff --git a/utils/iscsi-iname.c b/utils/iscsi-iname.c
index 6347edc46293..cb2f6c8b8651 100644
index da850dc..29aa4ad 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.1994-05.com.redhat";
}
/* try to feed some entropy from the pool to MD5 in order to get
--
2.14.4
2.21.0

View File

@ -1,4 +1,4 @@
From e2973cb7d4bca9056702b698511c020c93438e2a Mon Sep 17 00:00:00 2001
From af721a438031fa9f79db5de3b018c4b532ac2e0c Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Mon, 26 Jan 2015 12:57:11 -0800
Subject: [PATCH] libiscsi
@ -45,10 +45,10 @@ Subject: [PATCH] libiscsi
create mode 100644 libiscsi/tests/test_set_auth.c
diff --git a/Makefile b/Makefile
index 9a33774..bef6f1f 100644
index 7b445a5..4ab091f 100644
--- a/Makefile
+++ b/Makefile
@@ -58,6 +58,7 @@ user: iscsiuio/Makefile
@@ -65,6 +65,7 @@ user: iscsiuio/Makefile
$(MAKE) -C usr
$(MAKE) -C utils
$(MAKE) -C iscsiuio
@ -56,7 +56,7 @@ index 9a33774..bef6f1f 100644
@echo
@echo "Compilation complete Output file"
@echo "----------------------------------- ----------------"
@@ -78,6 +79,7 @@ iscsiuio/configure iscsiuio/Makefile.in: iscsiuio/configure.ac iscsiuio/Makefile
@@ -85,6 +86,7 @@ iscsiuio/configure iscsiuio/Makefile.in: iscsiuio/configure.ac iscsiuio/Makefile
force: ;
clean:
@ -3914,7 +3914,7 @@ index 0000000..a21f888
+ return rc;
+}
diff --git a/usr/Makefile b/usr/Makefile
index 0203127..e4752e6 100644
index 3bb0cb4..8ae6e07 100644
--- a/usr/Makefile
+++ b/usr/Makefile
@@ -37,7 +37,7 @@ PKG_CONFIG = /usr/bin/pkg-config
@ -3968,35 +3968,35 @@ index 199c160..d17a250 100644
int discovery_fw(void *data, struct iface_rec *iface,
struct list_head *rec_list)
diff --git a/usr/idbm.c b/usr/idbm.c
index 8b96146..19f7e84 100644
index 15802c3..3184c77 100644
--- a/usr/idbm.c
+++ b/usr/idbm.c
@@ -1712,9 +1712,9 @@ int idbm_print_all_discovery(int info_level)
@@ -1725,9 +1725,9 @@ int idbm_print_all_discovery(int info_level)
* fn should return -1 if it skipped the rec, an ISCSI_ERR error code if
* the operation failed or 0 if fn was run successfully.
*/
-static int idbm_for_each_iface(int *found, void *data,
- idbm_iface_op_fn *fn,
- char *targetname, int tpgt, char *ip, int port)
+int idbm_for_each_iface(int *found, void *data,
+ idbm_iface_op_fn *fn,
+ char *targetname, int tpgt, char *ip, int port)
-static int idbm_for_each_iface(int *found, void *data, idbm_iface_op_fn *fn,
- char *targetname, int tpgt, char *ip, int port,
- bool ruw_lock)
+int idbm_for_each_iface(int *found, void *data, idbm_iface_op_fn *fn,
+ char *targetname, int tpgt, char *ip, int port,
+ bool ruw_lock)
{
DIR *iface_dirfd;
struct dirent *iface_dent;
diff --git a/usr/idbm.h b/usr/idbm.h
index 2b05d78..b9b1810 100644
index 6bdfd60..c6982e4 100644
--- a/usr/idbm.h
+++ b/usr/idbm.h
@@ -102,6 +102,9 @@ struct rec_op_data {
@@ -103,6 +103,9 @@ struct rec_op_data {
node_rec_t *match_rec;
idbm_iface_op_fn *fn;
};
+extern int idbm_for_each_iface(int *found, void *data,
+ idbm_iface_op_fn *fn,
+ char *targetname, int tpgt, char *ip, int port);
extern int idbm_for_each_portal(int *found, void *data,
idbm_portal_op_fn *fn, char *targetname);
+extern int idbm_for_each_iface(int *found, void *data, idbm_iface_op_fn *fn,
+ char *targetname, int tpgt, char *ip, int port,
+ bool ruw_lock);
extern int idbm_for_each_portal(int *found, void *data, idbm_portal_op_fn *fn,
char *targetname, bool ruw_lock);
extern int idbm_for_each_node(int *found, void *data,
diff --git a/usr/iscsi_ipc.h b/usr/iscsi_ipc.h
index 47857dd..fb8e965 100644

View File

@ -1,7 +1,7 @@
From bd26fd7e7f91e5c4c6903c3d7e1a375a14261a48 Mon Sep 17 00:00:00 2001
From 3df19ccba0af40da8cdb15c41e1bcd08ce25fbd9 Mon Sep 17 00:00:00 2001
From: Jiri Konecny <jkonecny@redhat.com>
Date: Mon, 11 May 2015 13:16:26 +0200
Subject: [PATCH 18/32] Add macros to release GIL lock
Subject: [PATCH] Add macros to release GIL lock
Other threads are blocked when GIL is not released before the time consuming
functions.
@ -10,7 +10,7 @@ functions.
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/libiscsi/pylibiscsi.c b/libiscsi/pylibiscsi.c
index 88008538f04f..40b59553a28e 100644
index 8800853..40b5955 100644
--- a/libiscsi/pylibiscsi.c
+++ b/libiscsi/pylibiscsi.c
@@ -364,8 +364,13 @@ static PyObject *PyIscsiNode_str(PyObject *self)
@ -52,5 +52,5 @@ index 88008538f04f..40b59553a28e 100644
libiscsi_get_error_string(context));
return NULL;
--
2.14.4
2.21.0

View File

@ -1,17 +1,17 @@
From 7671cd56d36a76e954318cbdce3f08fc40aa3fe4 Mon Sep 17 00:00:00 2001
From bca0b3a085b7a169aa40d81ed7997c73fde8b4d3 Mon Sep 17 00:00:00 2001
From: Peter Hatina <phatina@redhat.com>
Date: Mon, 5 Oct 2015 16:50:36 -0700
Subject: [PATCH 19/32] libiscsi introduce sessions API
Subject: [PATCH] libiscsi introduce sessions API
---
libiscsi/libiscsi.c | 125 ++++++++++++++++++++++++++++++++++++++++++++++++++++
libiscsi/libiscsi.h | 56 +++++++++++++++++++++++
libiscsi/libiscsi.c | 125 ++++++++++++++++++++++++++++++++++++++++++++
libiscsi/libiscsi.h | 56 ++++++++++++++++++++
usr/iscsi_sysfs.c | 6 +++
usr/iscsi_sysfs.h | 2 +
4 files changed, 189 insertions(+)
diff --git a/libiscsi/libiscsi.c b/libiscsi/libiscsi.c
index 064e4b570d0b..755c18ca8e3b 100644
index 064e4b5..755c18c 100644
--- a/libiscsi/libiscsi.c
+++ b/libiscsi/libiscsi.c
@@ -3,6 +3,7 @@
@ -154,7 +154,7 @@ index 064e4b570d0b..755c18ca8e3b 100644
const struct libiscsi_node *node,
const char *parameter, const char *value)
diff --git a/libiscsi/libiscsi.h b/libiscsi/libiscsi.h
index 756590e14d8b..a9891f48b7d6 100644
index 756590e..a9891f4 100644
--- a/libiscsi/libiscsi.h
+++ b/libiscsi/libiscsi.h
@@ -3,6 +3,7 @@
@ -242,7 +242,7 @@ index 756590e14d8b..a9891f48b7d6 100644
*
* Set the given nodes iSCSI parameter named by \e parameter to value \e value.
diff --git a/usr/iscsi_sysfs.c b/usr/iscsi_sysfs.c
index fdc26c7bd9ba..80b7b0210fd1 100644
index 418f51b..6febba2 100644
--- a/usr/iscsi_sysfs.c
+++ b/usr/iscsi_sysfs.c
@@ -3,6 +3,7 @@
@ -253,7 +253,7 @@ index fdc26c7bd9ba..80b7b0210fd1 100644
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
@@ -1146,6 +1147,11 @@ free_info:
@@ -1151,6 +1152,11 @@ free_info:
return rc;
}
@ -266,7 +266,7 @@ index fdc26c7bd9ba..80b7b0210fd1 100644
int *nr_found,
iscsi_sysfs_iface_op_fn *fn)
diff --git a/usr/iscsi_sysfs.h b/usr/iscsi_sysfs.h
index cdcefa65f683..12ad87f96c8c 100644
index 1d0377f..909db34 100644
--- a/usr/iscsi_sysfs.h
+++ b/usr/iscsi_sysfs.h
@@ -3,6 +3,7 @@
@ -286,5 +286,5 @@ index cdcefa65f683..12ad87f96c8c 100644
int *nr_found,
iscsi_sysfs_iface_op_fn *fn);
--
2.14.4
2.21.0

View File

@ -1,14 +1,14 @@
From 1aa35262d566d829d711bc746f944dee5c2d9e7a Mon Sep 17 00:00:00 2001
From 2e660a78632545e98f7c9e2ffb8518512c0db5ff Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Tue, 28 Feb 2017 09:00:41 -0800
Subject: [PATCH 21/32] libiscsi: fix discovery request timeout regression
Subject: [PATCH] libiscsi: fix discovery request timeout regression
---
libiscsi/libiscsi.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/libiscsi/libiscsi.c b/libiscsi/libiscsi.c
index 755c18ca8e3b..bb17dfcafded 100644
index 755c18c..bb17dfc 100644
--- a/libiscsi/libiscsi.c
+++ b/libiscsi/libiscsi.c
@@ -136,6 +136,7 @@ int libiscsi_discover_sendtargets(struct libiscsi_context *context,
@ -28,5 +28,5 @@ index 755c18ca8e3b..bb17dfcafded 100644
rc = idbm_bind_ifaces_to_nodes(discovery_fw, &drec, &ifaces, &rec_list);
if (rc) {
--
2.14.4
2.21.0

View File

@ -1,14 +1,14 @@
From 1b2b6b683bd7ca3a7030889daf8c326dda797319 Mon Sep 17 00:00:00 2001
From 3040b7530eda1ab5625d76783dc7b8cf595a0ef0 Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Tue, 28 Feb 2017 10:06:42 -0800
Subject: [PATCH 22/32] libiscsi format-security build errors
Subject: [PATCH] libiscsi format-security build errors
---
libiscsi/libiscsi.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/libiscsi/libiscsi.c b/libiscsi/libiscsi.c
index bb17dfcafded..7003388e3346 100644
index bb17dfc..7003388 100644
--- a/libiscsi/libiscsi.c
+++ b/libiscsi/libiscsi.c
@@ -177,7 +177,8 @@ int libiscsi_discover_sendtargets(struct libiscsi_context *context,
@ -31,5 +31,5 @@ index bb17dfcafded..7003388e3346 100644
}
--
2.14.4
2.21.0

View File

@ -1,17 +1,17 @@
From b0d26441cebf6f1d78a2b4523ee9c348578b3d91 Mon Sep 17 00:00:00 2001
From 123fc55dd8ad98c9afd39bf0824b3d31d5e93214 Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Thu, 24 May 2018 15:17:05 -0700
Subject: [PATCH 23/32] libiscsi fix build to use libopeniscsiusr
Subject: [PATCH] libiscsi fix build to use libopeniscsiusr
---
libiscsi/Makefile | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/libiscsi/Makefile b/libiscsi/Makefile
index 317a7ec4db30..1196bb5c0cf4 100644
index 53f9746..f2cf248 100644
--- a/libiscsi/Makefile
+++ b/libiscsi/Makefile
@@ -4,7 +4,9 @@ OSNAME=$(shell uname -s)
@@ -8,7 +8,9 @@ OSNAME=$(shell uname -s)
OPTFLAGS ?= -O2 -g
WARNFLAGS ?= -Wall -Wstrict-prototypes
CFLAGS = $(OPTFLAGS) $(WARNFLAGS) -I../include -I../usr \
@ -22,7 +22,7 @@ index 317a7ec4db30..1196bb5c0cf4 100644
LIB = libiscsi.so.0
TESTS = tests/test_discovery_sendtargets tests/test_discovery_firmware
TESTS += tests/test_login tests/test_logout tests/test_params
@@ -19,7 +21,7 @@ FW_PARAM_SRCS = fw_entry.o prom_lex.o prom_parse.tab.o fwparam_ppc.o fwparam_sys
@@ -23,7 +25,7 @@ FW_PARAM_SRCS = fw_entry.o prom_lex.o prom_parse.tab.o fwparam_ppc.o fwparam_sys
# sources shared with the userspace utils, note we build these separately
# to get PIC versions.
COMMON_OBJS = $(patsubst %.o, common-objs/%.o, $(COMMON_SRCS))
@ -32,5 +32,5 @@ index 317a7ec4db30..1196bb5c0cf4 100644
# Flags for the tests
--
2.14.4
2.21.0

View File

@ -0,0 +1,66 @@
From 039700890e11dff3323241349d3858f258c09cc0 Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Thu, 7 Nov 2019 09:16:17 -0800
Subject: [PATCH] libiscsi: fix build against latest upstream, again
---
libiscsi/Makefile | 4 ++--
libiscsi/libiscsi.c | 6 +++---
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/libiscsi/Makefile b/libiscsi/Makefile
index f2cf248..462d666 100644
--- a/libiscsi/Makefile
+++ b/libiscsi/Makefile
@@ -10,7 +10,7 @@ WARNFLAGS ?= -Wall -Wstrict-prototypes
CFLAGS = $(OPTFLAGS) $(WARNFLAGS) -I../include -I../usr \
-D$(OSNAME) -fPIC -D_GNU_SOURCE -fvisibility=hidden \
-I../libopeniscsiusr
-LDFLAGS = -L../libopeniscsiusr -lopeniscsiusr
+LDFLAGS = -L../libopeniscsiusr -lopeniscsiusr -lkmod -lcrypto
LIB = libiscsi.so.0
TESTS = tests/test_discovery_sendtargets tests/test_discovery_firmware
TESTS += tests/test_login tests/test_logout tests/test_params
@@ -19,7 +19,7 @@ TESTS += tests/test_set_auth tests/test_get_auth
COMMON_SRCS = sysdeps.o
# sources shared between iscsid, iscsiadm and iscsistart
-ISCSI_LIB_SRCS = netlink.o transport.o cxgbi.o be2iscsi.o iscsi_timer.o initiator_common.o iscsi_err.o session_info.o iscsi_util.o io.o auth.o discovery.o login.o log.o md5.o sha1.o iface.o idbm.o sysfs.o iscsi_sysfs.o iscsi_net_util.o iscsid_req.o iser.o uip_mgmt_ipc.o
+ISCSI_LIB_SRCS = netlink.o transport.o cxgbi.o be2iscsi.o iscsi_timer.o initiator_common.o iscsi_err.o session_info.o iscsi_util.o io.o auth.o discovery.o login.o log.o iface.o idbm.o sysfs.o iscsi_sysfs.o iscsi_net_util.o iscsid_req.o iser.o uip_mgmt_ipc.o
FW_PARAM_SRCS = fw_entry.o prom_lex.o prom_parse.tab.o fwparam_ppc.o fwparam_sysfs.o
# sources shared with the userspace utils, note we build these separately
diff --git a/libiscsi/libiscsi.c b/libiscsi/libiscsi.c
index 7003388..c598aee 100644
--- a/libiscsi/libiscsi.c
+++ b/libiscsi/libiscsi.c
@@ -429,7 +429,7 @@ int libiscsi_node_login(struct libiscsi_context *context,
CHECK(idbm_for_each_iface(&nr_found, (void*)node->iface, login_helper,
(char *)node->name, node->tpgt,
- (char *)node->address, node->port))
+ (char *)node->address, node->port, false))
if (nr_found == 0) {
strcpy(context->error_str, "No such node");
rc = ENODEV;
@@ -615,7 +615,7 @@ int libiscsi_node_set_parameter(struct libiscsi_context *context,
CHECK(idbm_for_each_iface(&nr_found, &params, idbm_node_set_param,
(char *)node->name, node->tpgt,
- (char *)node->address, node->port))
+ (char *)node->address, node->port, false))
if (nr_found == 0) {
strcpy(context->error_str, "No such node");
rc = ENODEV;
@@ -677,7 +677,7 @@ int libiscsi_node_get_parameter(struct libiscsi_context *context,
as most settings should be the same independent of the iface. */
CHECK(idbm_for_each_iface(&nr_found, context, get_parameter_helper,
(char *)node->name, node->tpgt,
- (char *)node->address, node->port))
+ (char *)node->address, node->port, false))
if (nr_found == 0) {
strcpy(context->error_str, "No such node");
rc = ENODEV;
--
2.21.0

View File

@ -1,14 +1,14 @@
From 71b576b10a03651f67173d19883a929e91a3423a Mon Sep 17 00:00:00 2001
From d0689253c9e2eb78fc5296adb109aba4d35a13fd Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Mon, 19 Nov 2012 17:09:24 -0800
Subject: [PATCH 10/32] remove the offload boot supported ifdef
Subject: [PATCH] remove the offload boot supported ifdef
---
usr/iface.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/usr/iface.c b/usr/iface.c
index 137138f5af67..889fe8cd8202 100644
index 645b0b8..9cd07fd 100644
--- a/usr/iface.c
+++ b/usr/iface.c
@@ -993,6 +993,7 @@ int iface_setup_from_boot_context(struct iface_rec *iface,
@ -41,5 +41,5 @@ index 137138f5af67..889fe8cd8202 100644
return 0;
--
2.14.4
2.21.0

View File

@ -1,7 +1,7 @@
From 6629618e3581cbe632b7408a49437270bc04a8d4 Mon Sep 17 00:00:00 2001
From ccb9d70a0dad7c42f926f1680ae708a5ae3d3696 Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Mon, 24 Feb 2014 09:33:33 -0800
Subject: [PATCH 13/32] Revert "iscsiadm: return error when login fails"
Subject: [PATCH] Revert "iscsiadm: return error when login fails"
This reverts commit fc2a8e9a2911bc76f961fe3e4a159fab9b8b9691.
@ -11,7 +11,7 @@ Done to address RHBZ #1015563
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/usr/session_mgmt.c b/usr/session_mgmt.c
index 596085b1f640..07f587d2bafb 100644
index 0500f15..1e1f2bc 100644
--- a/usr/session_mgmt.c
+++ b/usr/session_mgmt.c
@@ -178,12 +178,12 @@ int iscsi_login_portal(void *data, struct list_head *list, struct node_rec *rec)
@ -30,5 +30,5 @@ index 596085b1f640..07f587d2bafb 100644
}
--
2.14.4
2.21.0

View File

@ -1,19 +1,19 @@
From 09485b397990aca06d5e98a855bab2444c9ec572 Mon Sep 17 00:00:00 2001
From f524e332835b2b59d3f3ff8a67814ef2d58a2857 Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Fri, 25 May 2018 09:39:07 -0700
Subject: [PATCH 24/32] dont install scripts
Subject: [PATCH] dont install scripts
---
Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 80afe86d6558..a35082daa9f9 100644
index 4ab091f..7e6b734 100644
--- a/Makefile
+++ b/Makefile
@@ -99,7 +99,7 @@ install_udev_rules:
$(INSTALL) -d $(DESTDIR)$(rulesdir)
$(INSTALL) -m 644 $(RULESFILES) $(DESTDIR)/$(rulesdir)
@@ -116,7 +116,7 @@ install_systemd:
$(INSTALL) -d $(DESTDIR)$(systemddir)
$(INSTALL) -m 644 $(SYSTEMDFILES) $(DESTDIR)/$(systemddir)
-install_programs: $(PROGRAMS) $(SCRIPTS)
+install_programs: $(PROGRAMS) # $(SCRIPTS)
@ -21,5 +21,5 @@ index 80afe86d6558..a35082daa9f9 100644
$(INSTALL) -m 755 $^ $(DESTDIR)$(sbindir)
--
2.14.4
2.21.0

View File

@ -1,7 +1,7 @@
From 089cd6910d9f0d1e459e1d8d00b754843437526d Mon Sep 17 00:00:00 2001
From e2b8215b80cc037ecbcb9eef50e432c31d5e56eb Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Wed, 30 May 2018 16:08:30 -0700
Subject: [PATCH 28/28] use /var/lib/iscsi in libopeniscsiusr
Subject: [PATCH] use /var/lib/iscsi in libopeniscsiusr
---
libopeniscsiusr/idbm.h | 3 ++-
@ -12,7 +12,7 @@ Subject: [PATCH 28/28] use /var/lib/iscsi in libopeniscsiusr
5 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/libopeniscsiusr/idbm.h b/libopeniscsiusr/idbm.h
index 3fd0864a797d..c84d332ff949 100644
index 3fd0864..c84d332 100644
--- a/libopeniscsiusr/idbm.h
+++ b/libopeniscsiusr/idbm.h
@@ -31,7 +31,8 @@
@ -26,10 +26,10 @@ index 3fd0864a797d..c84d332ff949 100644
#define BOOT_NAME_MAXLEN 256
#define IDBM_DUMP_SIZE 8192
diff --git a/libopeniscsiusr/iface.c b/libopeniscsiusr/iface.c
index e2355bc0fff0..cd9dd7326ae6 100644
index e7938a5..99ab7b5 100644
--- a/libopeniscsiusr/iface.c
+++ b/libopeniscsiusr/iface.c
@@ -383,7 +383,7 @@ int iscsi_default_iface_setup(struct iscsi_context *ctx)
@@ -381,7 +381,7 @@ int iscsi_default_iface_setup(struct iscsi_context *ctx)
_good(_iscsi_hids_get(ctx, &hids, &hid_count), rc, out);
for (i = 0; i < hid_count; ++i) {
@ -39,7 +39,7 @@ index e2355bc0fff0..cd9dd7326ae6 100644
_good(_iscsi_ifaces_get_from_sysfs(ctx, hids[i], &ifaces, &iface_count),
rc, out);
diff --git a/libopeniscsiusr/libopeniscsiusr/libopeniscsiusr.h b/libopeniscsiusr/libopeniscsiusr/libopeniscsiusr.h
index 439590249212..81582da9e1e6 100644
index 4395902..81582da 100644
--- a/libopeniscsiusr/libopeniscsiusr/libopeniscsiusr.h
+++ b/libopeniscsiusr/libopeniscsiusr/libopeniscsiusr.h
@@ -339,7 +339,7 @@ __DLL_EXPORT void iscsi_session_free(struct iscsi_session *se);
@ -79,7 +79,7 @@ index 439590249212..81582da9e1e6 100644
* by assert.
* @iface:
diff --git a/libopeniscsiusr/libopeniscsiusr/libopeniscsiusr_iface.h b/libopeniscsiusr/libopeniscsiusr/libopeniscsiusr_iface.h
index a1a255246d20..95b01602fb37 100644
index a1a2552..95b0160 100644
--- a/libopeniscsiusr/libopeniscsiusr/libopeniscsiusr_iface.h
+++ b/libopeniscsiusr/libopeniscsiusr/libopeniscsiusr_iface.h
@@ -182,7 +182,7 @@ __DLL_EXPORT const char *iscsi_iface_name_get(struct iscsi_iface *iface);
@ -92,7 +92,7 @@ index a1a255246d20..95b01602fb37 100644
* @iface:
* Pointer of 'struct iscsi_iface'.
diff --git a/libopeniscsiusr/node.h b/libopeniscsiusr/node.h
index 39e07b3befae..9eba7fa6077c 100644
index 39e07b3..9eba7fa 100644
--- a/libopeniscsiusr/node.h
+++ b/libopeniscsiusr/node.h
@@ -44,7 +44,7 @@ struct iscsi_node {
@ -105,5 +105,5 @@ index 39e07b3befae..9eba7fa6077c 100644
/* Might be public in the future */
__DLL_LOCAL void iscsi_node_free(struct iscsi_node *node);
--
2.14.4
2.21.0

View File

@ -1,4 +1,4 @@
From f8e7499e9f69465668fc6e5e7bcfb9ce09e8a457 Mon Sep 17 00:00:00 2001
From 44bb05de04c0f8819c1fdae8f567dd802a8444e8 Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Wed, 5 Jun 2019 09:08:39 -0700
Subject: [PATCH] Coverity scan fixes
@ -12,7 +12,7 @@ Subject: [PATCH] Coverity scan fixes
5 files changed, 21 insertions(+), 16 deletions(-)
diff --git a/iscsiuio/src/unix/libs/qedi.c b/iscsiuio/src/unix/libs/qedi.c
index b7595d5..47300b0 100644
index 3414cb5..a359700 100644
--- a/iscsiuio/src/unix/libs/qedi.c
+++ b/iscsiuio/src/unix/libs/qedi.c
@@ -1023,7 +1023,7 @@ static int qedi_read(nic_t *nic, packet_t *pkt)
@ -25,10 +25,10 @@ index b7595d5..47300b0 100644
if (bd_cons != bd_prod) {
diff --git a/iscsiuio/src/unix/main.c b/iscsiuio/src/unix/main.c
index 5168e4e..ed41931 100644
index 5e3f66c..4c50890 100644
--- a/iscsiuio/src/unix/main.c
+++ b/iscsiuio/src/unix/main.c
@@ -340,7 +340,10 @@ int main(int argc, char *argv[])
@@ -341,7 +341,10 @@ int main(int argc, char *argv[])
/* parent: wait for child msg then exit */
close(pipefds[1]);
@ -40,7 +40,7 @@ index 5168e4e..ed41931 100644
exit(0);
}
@@ -386,6 +389,9 @@ int main(int argc, char *argv[])
@@ -387,6 +390,9 @@ int main(int argc, char *argv[])
sigaddset(&set, SIGTERM);
sigaddset(&set, SIGUSR1);
rc = pthread_sigmask(SIG_SETMASK, &set, NULL);
@ -50,7 +50,7 @@ index 5168e4e..ed41931 100644
/* Spin off the signal handling thread */
pthread_attr_init(&attr);
@@ -415,7 +421,9 @@ int main(int argc, char *argv[])
@@ -416,7 +422,9 @@ int main(int argc, char *argv[])
if (!foreground) {
/* signal parent they can go away now */
close(pipefds[0]);
@ -84,10 +84,10 @@ index d020e6c..342aab5 100644
fd = open(LOCK_FILE, O_RDWR | O_CREAT, 0666);
diff --git a/usr/idbm.c b/usr/idbm.c
index 89a6c27..a3343fe 100644
index 3184c77..0c6870c 100644
--- a/usr/idbm.c
+++ b/usr/idbm.c
@@ -1332,12 +1332,10 @@ int idbm_lock(void)
@@ -1339,12 +1339,10 @@ int idbm_lock(void)
return 0;
}
@ -105,7 +105,7 @@ index 89a6c27..a3343fe 100644
fd = open(LOCK_FILE, O_RDWR | O_CREAT, 0666);
diff --git a/usr/iscsid.c b/usr/iscsid.c
index 37c13b3..1891784 100644
index 8f1c597..96a6452 100644
--- a/usr/iscsid.c
+++ b/usr/iscsid.c
@@ -489,8 +489,8 @@ int main(int argc, char *argv[])

View File

@ -0,0 +1,29 @@
From 4142125fa296d21a307fb2370b2d4d7e8487f22c Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Wed, 16 Oct 2019 23:17:20 -0700
Subject: [PATCH] fix upstream build breakage of iscsiuio LDFLAGS
---
iscsiuio/configure.ac | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/iscsiuio/configure.ac b/iscsiuio/configure.ac
index b41df0e..a856cc5 100644
--- a/iscsiuio/configure.ac
+++ b/iscsiuio/configure.ac
@@ -67,10 +67,10 @@ AM_CONDITIONAL([DEBUG], [test x$debug = xtrue])
AC_ARG_WITH([systemd],
AS_HELP_STRING([--without-systemd], [Build without systemd]),
[case "${withval}" in
- yes) LDFLAGS="`pkg-config --libs libsystemd`" ;;
+ yes) LDFLAGS="${LDFLAGS} `pkg-config --libs libsystemd`" ;;
no) CFLAGS="${CFLAGS} -DNO_SYSTEMD" ;;
*) AC_MSG_ERROR([bad value $withval for --with-systemd]) ;;
- esac],[LDFLAGS="`pkg-config --libs libsystemd`"])
+ esac],[LDFLAGS="${LDFLAGS} `pkg-config --libs libsystemd`"])
AC_CONFIG_COMMANDS([default],[[
if [ -n "$SOURCE_DATE_EPOCH" ] ; then
--
2.21.0

View File

@ -0,0 +1,130 @@
From 77150edd697669467ff9f8775b93bd9d7a34cadf Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Mon, 28 Oct 2019 10:20:56 -0700
Subject: [PATCH] improve systemd service files for boot session handling
---
etc/systemd/iscsi-mark-root-nodes | 6 +++++-
etc/systemd/iscsi-onboot.service | 15 +++++++++++++++
etc/systemd/iscsi-shutdown.service | 1 +
etc/systemd/iscsi.service | 11 ++++-------
etc/systemd/iscsid.service | 4 +---
etc/systemd/iscsiuio.service | 1 -
6 files changed, 26 insertions(+), 12 deletions(-)
create mode 100644 etc/systemd/iscsi-onboot.service
diff --git a/etc/systemd/iscsi-mark-root-nodes b/etc/systemd/iscsi-mark-root-nodes
index c693707..9d48805 100755
--- a/etc/systemd/iscsi-mark-root-nodes
+++ b/etc/systemd/iscsi-mark-root-nodes
@@ -9,7 +9,11 @@ while read t num p target flash; do
portal=${p%,*}
transport=${t%:}
- $ISCSIADM -m node -p $portal -T $target -o update -n node.startup -v onboot
+ # use session number to find the iface name in use
+ num=${num#[}; num=${num%]}
+ iface=$(iscsiadm -m session -r $num | grep iface.iscsi_ifacename | cut -d= -f2)
+
+ $ISCSIADM -m node -p $portal -T $target -I $iface -o update -n node.startup -v onboot
start_iscsid=1
diff --git a/etc/systemd/iscsi-onboot.service b/etc/systemd/iscsi-onboot.service
new file mode 100644
index 0000000..42ced68
--- /dev/null
+++ b/etc/systemd/iscsi-onboot.service
@@ -0,0 +1,15 @@
+[Unit]
+Description=Special handling of early boot iSCSI sessions
+Documentation=man:iscsiadm(8) man:iscsid(8)
+DefaultDependencies=no
+RefuseManualStart=true
+Before=iscsi.service
+After=systemd-remount-fs.service
+ConditionDirectoryNotEmpty=/sys/class/iscsi_session
+
+[Service]
+Type=oneshot
+ExecStart=-/usr/libexec/iscsi-mark-root-nodes
+
+[Install]
+WantedBy=sysinit.target
diff --git a/etc/systemd/iscsi-shutdown.service b/etc/systemd/iscsi-shutdown.service
index 69c1c77..caee933 100644
--- a/etc/systemd/iscsi-shutdown.service
+++ b/etc/systemd/iscsi-shutdown.service
@@ -11,4 +11,5 @@ RefuseManualStop=yes
[Service]
Type=oneshot
RemainAfterExit=true
+ExecStart=-/usr/bin/true
ExecStop=-/usr/sbin/iscsiadm -m node --logoutall=all
diff --git a/etc/systemd/iscsi.service b/etc/systemd/iscsi.service
index eadfcec..175cb2c 100644
--- a/etc/systemd/iscsi.service
+++ b/etc/systemd/iscsi.service
@@ -1,21 +1,18 @@
[Unit]
Description=Login and scanning of iSCSI devices
-Documentation=man:iscsid(8) man:iscsiadm(8)
+Documentation=man:iscsiadm(8) man:iscsid(8)
DefaultDependencies=no
-Conflicts=shutdown.target
-After=systemd-remount-fs.service network.target iscsid.service iscsiuio.service
Before=remote-fs-pre.target
+After=network.target network-online.target iscsid.service iscsiuio.service systemd-remount-fs.service
Wants=remote-fs-pre.target iscsi-shutdown.service
-ConditionDirectoryNotEmpty=|/var/lib/iscsi/nodes
-ConditionDirectoryNotEmpty=|/sys/class/iscsi_session
+ConditionDirectoryNotEmpty=/var/lib/iscsi/nodes
[Service]
Type=oneshot
RemainAfterExit=true
-ExecStart=-/usr/libexec/iscsi-mark-root-nodes
ExecStart=-/usr/sbin/iscsiadm -m node --loginall=automatic
ExecReload=-/usr/sbin/iscsiadm -m node --loginall=automatic
SuccessExitStatus=21
[Install]
-WantedBy=sysinit.target
+WantedBy=remote-fs.target
diff --git a/etc/systemd/iscsid.service b/etc/systemd/iscsid.service
index 8d50cf0..28402fb 100644
--- a/etc/systemd/iscsid.service
+++ b/etc/systemd/iscsid.service
@@ -1,8 +1,7 @@
[Unit]
Description=Open-iSCSI
-Documentation=man:iscsid(8) man:iscsiadm(8)
+Documentation=man:iscsid(8) man:iscsiuio(8) man:iscsiadm(8)
DefaultDependencies=no
-Conflicts=shutdown.target
After=network.target iscsiuio.service
Before=remote-fs-pre.target
@@ -10,7 +9,6 @@ Before=remote-fs-pre.target
Type=notify
NotifyAccess=main
ExecStart=/usr/sbin/iscsid -f
-ExecStop=/usr/sbin/iscsiadm -k 0 2
KillMode=mixed
Restart=on-failure
diff --git a/etc/systemd/iscsiuio.service b/etc/systemd/iscsiuio.service
index 8620cde..fc0be93 100644
--- a/etc/systemd/iscsiuio.service
+++ b/etc/systemd/iscsiuio.service
@@ -2,7 +2,6 @@
Description=iSCSI UserSpace I/O driver
Documentation=man:iscsiuio(8)
DefaultDependencies=no
-Conflicts=shutdown.target
Requires=iscsid.service
BindTo=iscsid.service
After=network.target
--
2.21.0

View File

@ -1,25 +1,25 @@
From 92aac85cf423d1c566d324255a86de0116d33015 Mon Sep 17 00:00:00 2001
From c589d94293f3bee77c34ca61371ddfbeef71f2af Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Mon, 21 Jan 2013 15:43:36 -0800
Subject: [PATCH 20/32] use Red Hat version string to match RPM package version
Subject: [PATCH] use Red Hat version string to match RPM package version
---
usr/version.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/usr/version.h b/usr/version.h
index 4dfef4ccfb77..1334d47c6bb3 100644
index 615f533..a1f6cc2 100644
--- a/usr/version.h
+++ b/usr/version.h
@@ -6,7 +6,7 @@
* This may not be the same value as the kernel versions because
* some other maintainer could merge a patch without going through us
*/
-#define ISCSI_VERSION_STR "2.0-877"
+#define ISCSI_VERSION_STR "6.2.0.877-0"
-#define ISCSI_VERSION_STR "2.0-878"
+#define ISCSI_VERSION_STR "6.2.0.878-2"
#define ISCSI_VERSION_FILE "/sys/module/scsi_transport_iscsi/version"
#endif
--
2.14.4
2.21.0

View File

@ -1,6 +1,6 @@
%global open_iscsi_version 2.0
%global open_iscsi_build 877
%global commit0 f71581bd641dc26d330cb8b97e5ec272dd08f811
%global open_iscsi_build 878
%global commit0 d791ce020673381cf3b559866d1f61e0411126a6
%global shortcommit0 %(c=%{commit0}; echo ${c:0:7})
%if 0%{?rhel} > 7
@ -13,7 +13,7 @@
Summary: iSCSI daemon and utility programs
Name: iscsi-initiator-utils
Version: 6.%{open_iscsi_version}.%{open_iscsi_build}
Release: 1.git%{shortcommit0}%{?dist}
Release: 4.git%{shortcommit0}%{?dist}
Group: System Environment/Daemons
License: GPLv2+
URL: http://www.open-iscsi.org
@ -22,25 +22,31 @@ Source4: 04-iscsi
Source5: iscsi-tmpfiles.conf
Patch0001: 0001-service-file-tweaks.patch
Patch0002: 0001-fix-iscsiuio-build-with-libsystemd.patch
Patch0003: 0001-idmb_rec_write-check-for-tpgt-first.patch
Patch0004: 0002-idbm_rec_write-seperate-old-and-new-style-writes.patch
Patch0005: 0003-idbw_rec_write-pick-tpgt-from-existing-record.patch
Patch0006: 0006-update-initscripts-and-docs.patch
Patch0007: 0007-use-var-for-config.patch
Patch0008: 0008-use-red-hat-for-name.patch
Patch0009: 0009-libiscsi.patch
Patch0010: 0010-remove-the-offload-boot-supported-ifdef.patch
Patch0011: 0013-Revert-iscsiadm-return-error-when-login-fails.patch
Patch0012: 0018-Add-macros-to-release-GIL-lock.patch
Patch0013: 0019-libiscsi-introduce-sessions-API.patch
Patch0014: 0020-use-Red-Hat-version-string-to-match-RPM-package-vers.patch
Patch0015: 0021-libiscsi-fix-discovery-request-timeout-regression.patch
Patch0016: 0022-libiscsi-format-security-build-errors.patch
Patch0017: 0023-libiscsi-fix-build-to-use-libopeniscsiusr.patch
Patch0018: 0024-dont-install-scripts.patch
Patch0019: 0028-use-var-lib-iscsi-in-libopeniscsiusr.patch
Patch0099: 0001-Coverity-scan-fixes.patch
Patch0002: 0002-idmb_rec_write-check-for-tpgt-first.patch
Patch0003: 0003-idbm_rec_write-seperate-old-and-new-style-writes.patch
Patch0004: 0004-idbw_rec_write-pick-tpgt-from-existing-record.patch
Patch0005: 0005-update-initscripts-and-docs.patch
Patch0006: 0006-use-var-for-config.patch
Patch0007: 0007-use-red-hat-for-name.patch
Patch0008: 0008-libiscsi.patch
Patch0009: 0009-Add-macros-to-release-GIL-lock.patch
Patch0010: 0010-libiscsi-introduce-sessions-API.patch
Patch0011: 0011-libiscsi-fix-discovery-request-timeout-regression.patch
Patch0012: 0012-libiscsi-format-security-build-errors.patch
Patch0013: 0013-libiscsi-fix-build-to-use-libopeniscsiusr.patch
Patch0014: 0014-libiscsi-fix-build-against-latest-upstream-again.patch
Patch0015: 0015-remove-the-offload-boot-supported-ifdef.patch
Patch0016: 0016-Revert-iscsiadm-return-error-when-login-fails.patch
Patch0017: 0017-dont-install-scripts.patch
Patch0018: 0018-use-var-lib-iscsi-in-libopeniscsiusr.patch
Patch0019: 0019-Coverity-scan-fixes.patch
Patch0020: 0020-fix-upstream-build-breakage-of-iscsiuio-LDFLAGS.patch
Patch0021: 0021-improve-systemd-service-files-for-boot-session-handl.patch
Patch0022: 0022-use-Red-Hat-version-string-to-match-RPM-package-vers.patch
Patch0023: 0001-configuration-support-for-CHAP-algorithms.patch
Patch0024: 0001-Fix-bug-with-libopeniscsiusr.pc.patch
Patch0025: 0001-enable-all-CHAP-digest-functions-by-default.patch
Patch0026: 0001-Revert-Out-of-bounds-read-Overrunning-array-of-8-2-b.patch
BuildRequires: flex bison doxygen kmod-devel systemd-units
BuildRequires: autoconf automake libtool libmount-devel openssl-devel
@ -106,7 +112,7 @@ developing applications that use %{name}.
%{?python_provide:%python_provide python2-%{name}}
Summary: Python %{python2_version} bindings to %{name}
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}
BuildRequires: python2-devel
BuildRequires: python2-setuptools
@ -119,7 +125,7 @@ libiscsi interface for interacting with %{name}
%{?python_provide:%python_provide python3-%{name}}
Summary: Python %{python3_version} bindings to %{name}
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}
BuildRequires: python3-devel
BuildRequires: python3-setuptools
@ -142,7 +148,7 @@ autoreconf --install
%{configure}
cd ..
%{__make} OPTFLAGS="%{optflags} %{?__global_ldflags} -DUSE_KMOD -lkmod"
%{__make} OPTFLAGS="%{optflags} %{?__global_ldflags}"
pushd libiscsi
%if %{with python2}
%py2_build
@ -179,6 +185,7 @@ touch $RPM_BUILD_ROOT/var/lock/iscsi/lock
%{__install} -d $RPM_BUILD_ROOT%{_unitdir}
%{__install} -pm 644 etc/systemd/iscsi.service $RPM_BUILD_ROOT%{_unitdir}
%{__install} -pm 644 etc/systemd/iscsi-onboot.service $RPM_BUILD_ROOT%{_unitdir}
%{__install} -pm 644 etc/systemd/iscsi-shutdown.service $RPM_BUILD_ROOT%{_unitdir}
%{__install} -pm 644 etc/systemd/iscsid.service $RPM_BUILD_ROOT%{_unitdir}
%{__install} -pm 644 etc/systemd/iscsid.socket $RPM_BUILD_ROOT%{_unitdir}
@ -215,7 +222,7 @@ popd
%post
/sbin/ldconfig
%systemd_post iscsi.service iscsi-shutdown.service iscsid.service iscsid.socket
%systemd_post iscsi.service iscsi-onboot.service iscsi-shutdown.service iscsid.service iscsid.socket
if [ $1 -eq 1 ]; then
if [ ! -f %{_sysconfdir}/iscsi/initiatorname.iscsi ]; then
@ -223,6 +230,7 @@ if [ $1 -eq 1 ]; then
fi
# enable socket activation and persistant session startup by default
/bin/systemctl enable iscsi.service >/dev/null 2>&1 || :
/bin/systemctl enable iscsi-onboot.service >/dev/null 2>&1 || :
/bin/systemctl enable iscsid.socket >/dev/null 2>&1 || :
fi
@ -234,17 +242,17 @@ if [ $1 -eq 1 ]; then
fi
%preun
%systemd_preun iscsi.service iscsi-shutdown.service iscsid.service iscsiuio.service iscsid.socket iscsiuio.socket
%systemd_preun iscsi.service iscsi-onboot.service iscsi-shutdown.service iscsid.service iscsiuio.service iscsid.socket iscsiuio.socket
%preun iscsiuio
%systemd_preun iscsiuio.service iscsiuio.socket
%postun
/sbin/ldconfig
%systemd_postun
%systemd_postun iscsi.service iscsi-onboot.service iscsi-shutdown.service iscsid.service iscsiuio.service iscsid.socket iscsiuio.socket
%postun iscsiuio
%systemd_postun
%systemd_postun iscsiuio.service iscsiuio.socket
%triggerun -- iscsi-initiator-utils < 6.2.0.873-25
# prior to 6.2.0.873-24 iscsi.service was missing a Wants=remote-fs-pre.target
@ -271,6 +279,11 @@ if [ $1 -gt 0 ]; then
systemctl start iscsi-shutdown.service >/dev/null 2>&1 || :
fi
%triggerpostun -- iscsi-initiator-utils < 6.2.0.878-4
# added in 6.2.0.878-0, needs to be enabled during an upgrade
if [ $1 -gt 0 ]; then
/bin/systemctl enable iscsi-onboot.service >/dev/null 2>&1 || :
fi
%files
%doc README
@ -284,6 +297,7 @@ fi
%ghost %{_var}/lock/iscsi
%ghost %{_var}/lock/iscsi/lock
%{_unitdir}/iscsi.service
%{_unitdir}/iscsi-onboot.service
%{_unitdir}/iscsi-shutdown.service
%{_unitdir}/iscsid.service
%{_unitdir}/iscsid.socket
@ -342,6 +356,23 @@ fi
%{python3_sitearch}/*
%changelog
* Tue Mar 24 2020 Chris Leech <cleech@redhat.com> - 6.2.0.878-3.gitd791ce0
- 1801577 new service file not enabled on upgrade, spec change to use triggers for that
* Mon Feb 17 2020 Chris Leech <cleech@redhat.com> - 6.2.0.878-3.gitd791ce0
- 1801577 missing spec file changes from 6.2.0.878-0 causing iSCSI boot regression
* Mon Jan 20 2020 Chris Leech <cleech@redhat.com> - 6.2.0.878-2.gitd791ce0
- 1786015 fix IPv6 discovery regression in iscsiuio
* Wed Jan 08 2020 Chris Leech <cleech@redhat.com> - 6.2.0.878-1.gitd791ce0
- 1788233 added node.session.auth.chap_algs configuration setting
* Thu Nov 07 2019 Chris Leech <cleech@redhat.com> - 6.2.0.878-0.gitd791ce0
- 1761940 iSCSI CHAP authentication not function with FIPS enabled
- Service file improvements forward ported from RHEL 7.8
- various static analysis fixes from upstream
* Wed Jun 05 2019 Chris Leech <cleech@redhat.com> - 6.2.0.877-1.gitf71581b
- fix Covscan reported issues from upstream patches