Update iscsi tools:

Update iscsi tools.
This commit is contained in:
Mike Christie 2011-10-23 03:29:01 -05:00
parent f149ee29a9
commit 3949e157de
24 changed files with 92954 additions and 817 deletions

View File

@ -1,97 +1,7 @@
diff --git a/Makefile b/Makefile diff -Naurp open-iscsi-2.0-872-rc4-bnx2i.base/libiscsi/libiscsi.c open-iscsi-2.0-872-rc4-bnx2i.build/libiscsi/libiscsi.c
index db460eb..a4d4ce0 100644 --- open-iscsi-2.0-872-rc4-bnx2i.base/libiscsi/libiscsi.c 1969-12-31 18:00:00.000000000 -0600
--- a/Makefile +++ open-iscsi-2.0-872-rc4-bnx2i.build/libiscsi/libiscsi.c 2011-08-14 16:53:58.000000000 -0500
+++ b/Makefile @@ -0,0 +1,612 @@
@@ -32,6 +32,7 @@ user: ;
$(MAKE) -C utils/fwparam_ibft
$(MAKE) -C usr
$(MAKE) -C utils
+ $(MAKE) -C libiscsi
@echo
@echo "Compilation complete Output file"
@echo "----------------------------------- ----------------"
@@ -53,6 +54,7 @@ kernel: force
force: ;
clean:
+ $(MAKE) -C libiscsi clean
$(MAKE) -C utils/sysdeps clean
$(MAKE) -C utils/fwparam_ibft clean
$(MAKE) -C utils clean
diff --git a/libiscsi/Makefile b/libiscsi/Makefile
new file mode 100644
index 0000000..4aeb44f
--- /dev/null
+++ b/libiscsi/Makefile
@@ -0,0 +1,62 @@
+# This Makefile will work only with GNU make.
+
+OSNAME=$(shell uname -s)
+OPTFLAGS ?= -O2 -g
+WARNFLAGS ?= -Wall -Wstrict-prototypes
+CFLAGS = $(OPTFLAGS) $(WARNFLAGS) -I../include -I../usr -I../utils/open-isns \
+ -D$(OSNAME) -fPIC -D_GNU_SOURCE -fvisibility=hidden
+LIB = libiscsi.so.0
+TESTS = tests/test_discovery_sendtargets tests/test_discovery_firmware
+TESTS += tests/test_login tests/test_logout tests/test_params
+TESTS += tests/test_get_network_config tests/test_get_initiator_name
+TESTS += tests/test_set_auth tests/test_get_auth
+
+COMMON_SRCS = sysdeps.o
+# sources shared between iscsid, iscsiadm and iscsistart
+ISCSI_LIB_SRCS = 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
+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
+# to get PIC versions.
+COMMON_OBJS = $(patsubst %.o, common-objs/%.o, $(COMMON_SRCS))
+USR_OBJS = $(patsubst %.o, usr-objs/%.o, $(ISCSI_LIB_SRCS) strings.o)
+FW_OBJS = $(patsubst %.o, fw-objs/%.o, $(FW_PARAM_SRCS))
+
+# Flags for the tests
+tests/% : CFLAGS = $(OPTFLAGS) $(WARNFLAGS) -I.
+
+all: lib tests html
+
+lib: $(LIB)
+tests: $(TESTS)
+
+common-objs/%.o: ../utils/sysdeps/%.c
+ mkdir -p common-objs
+ $(CC) $(CFLAGS) -c $< -o $@
+
+usr-objs/%.o: ../usr/%.c
+ mkdir -p usr-objs
+ $(CC) $(CFLAGS) -c $< -o $@
+
+fw-objs/%.o: ../utils/fwparam_ibft/%.c
+ mkdir -p fw-objs
+ $(CC) $(CFLAGS) -c $< -o $@
+
+$(LIB): $(COMMON_OBJS) $(FW_OBJS) $(USR_OBJS) libiscsi.o
+ $(CC) $(CFLAGS) -L../utils/open-isns -lisns -shared -Wl,-soname,$(LIB) $^ -o $@
+ ln -s -f $(LIB) libiscsi.so
+
+$(TESTS): $(FW_OBJS) $(COMMON_OBJS) $(USR_OBJS) $(LIB)
+ $(CC) $(CFLAGS) -L../utils/open-isns -lisns -c $< -o $@
+
+html: libiscsi.h libiscsi.doxy
+ doxygen libiscsi.doxy
+
+clean:
+ rm -rf *.o common-objs usr-objs fw-objs libuip-objs libiscsi.so* \
+ .depend *~ html $(TESTS) tests/*~
+
+depend:
+ gcc $(CFLAGS) -M `ls *.c` > .depend
+
+-include .depend ../usr/.depend
diff --git a/libiscsi/libiscsi.c b/libiscsi/libiscsi.c
new file mode 100644
index 0000000..a9eb0a6
--- /dev/null
+++ b/libiscsi/libiscsi.c
@@ -0,0 +1,563 @@
+/* +/*
+ * iSCSI Administration library + * iSCSI Administration library
+ * + *
@ -131,9 +41,13 @@ index 0000000..a9eb0a6
+#include "iscsi_proto.h" +#include "iscsi_proto.h"
+#include "fw_context.h" +#include "fw_context.h"
+#include "iscsid_req.h" +#include "iscsid_req.h"
+#include "iscsi_err.h"
+ +
+#define CHECK(a) { context->error_str[0] = 0; rc = a; if (rc) goto leave; } +#define CHECK(a) { context->error_str[0] = 0; rc = a; if (rc) goto leave; }
+ +
+/* UGLY, not thread safe :( */
+static int sysfs_initialized = 0;
+
+struct libiscsi_context { +struct libiscsi_context {
+ char error_str[256]; + char error_str[256];
+ /* For get_parameter_helper() */ + /* For get_parameter_helper() */
@ -160,7 +74,10 @@ index 0000000..a9eb0a6
+ return NULL; + return NULL;
+ +
+ log_init("libiscsi", 1024, libiscsi_log, context); + log_init("libiscsi", 1024, libiscsi_log, context);
+ sysfs_init(); + if (!sysfs_initialized) {
+ sysfs_init();
+ sysfs_initialized = 1;
+ }
+ increase_max_files(); + increase_max_files();
+ if (idbm_init(NULL)) { + if (idbm_init(NULL)) {
+ sysfs_cleanup(); + sysfs_cleanup();
@ -181,6 +98,16 @@ index 0000000..a9eb0a6
+ free(context); + free(context);
+} +}
+ +
+static void free_iface_list(struct list_head *ifaces)
+{
+ struct iface_rec *iface, *tmp_iface;
+
+ list_for_each_entry_safe(iface, tmp_iface, ifaces, list) {
+ list_del(&iface->list);
+ free(iface);
+ }
+}
+
+static void free_rec_list(struct list_head *rec_list) +static void free_rec_list(struct list_head *rec_list)
+{ +{
+ struct node_rec *rec, *tmp; + struct node_rec *rec, *tmp;
@ -264,6 +191,8 @@ index 0000000..a9eb0a6
+ strlcpy((*found_nodes)[found].address, + strlcpy((*found_nodes)[found].address,
+ rec->conn[0].address, NI_MAXHOST); + rec->conn[0].address, NI_MAXHOST);
+ (*found_nodes)[found].port = rec->conn[0].port; + (*found_nodes)[found].port = rec->conn[0].port;
+ strlcpy((*found_nodes)[found].iface,
+ rec->iface.name, LIBISCSI_VALUE_MAXLEN);
+ found++; + found++;
+ } + }
+ } + }
@ -276,69 +205,84 @@ index 0000000..a9eb0a6
+int libiscsi_discover_firmware(struct libiscsi_context *context, +int libiscsi_discover_firmware(struct libiscsi_context *context,
+ int *nr_found, struct libiscsi_node **found_nodes) + int *nr_found, struct libiscsi_node **found_nodes)
+{ +{
+ struct boot_context fw_entry; + struct list_head targets, ifaces, rec_list;
+ struct node_rec rec; + discovery_rec_t drec;
+ int rc = 0; + int rc = 0;
+ +
+ if (nr_found) + INIT_LIST_HEAD(&targets);
+ *nr_found = 0; + INIT_LIST_HEAD(&ifaces);
+ if (found_nodes) + INIT_LIST_HEAD(&rec_list);
+ *found_nodes = NULL;
+ +
+ memset(&fw_entry, 0, sizeof fw_entry); + if (nr_found) {
+ rc = fw_get_entry(&fw_entry); + *nr_found = 0;
+ }
+
+ if (found_nodes) {
+ *found_nodes = NULL;
+ }
+
+ rc = fw_get_targets(&targets);
+ if (rc) { + if (rc) {
+ strcpy(context->error_str, "Could not read fw values."); + log_error("%s: Could not get list of targets from firmware "
+ "(err %d).\n", __func__, rc);
+ return rc; + return rc;
+ } + }
+ +
+ memset(&rec, 0, sizeof rec); + CHECK(iface_create_ifaces_from_boot_contexts(&ifaces, &targets));
+ idbm_node_setup_defaults(&rec);
+ +
+ strlcpy(rec.name, fw_entry.targetname, TARGET_NAME_MAXLEN); + memset(&drec, 0, sizeof(drec));
+ rec.tpgt = 1; + drec.type = DISCOVERY_TYPE_FW;
+ strlcpy(rec.conn[0].address, fw_entry.target_ipaddr, NI_MAXHOST); + rc = idbm_bind_ifaces_to_nodes(discovery_fw, &drec, &ifaces, &rec_list);
+ rec.conn[0].port = fw_entry.target_port; + if (rc) {
+ log_error("%s: Could not determine target nodes from firmware "
+ "(err %d).\n", __func__, rc);
+ goto leave;
+ }
+ +
+ iface_setup_defaults(&rec.iface); + int node_count = 0;
+ strncpy(rec.iface.iname, fw_entry.initiatorname, + struct list_head *pos;
+ sizeof(fw_entry.initiatorname)); + list_for_each(pos, &rec_list) {
+ strncpy(rec.session.auth.username, fw_entry.chap_name, + ++node_count;
+ sizeof(fw_entry.chap_name)); + }
+ strncpy((char *)rec.session.auth.password, fw_entry.chap_password,
+ sizeof(fw_entry.chap_password));
+ strncpy(rec.session.auth.username_in, fw_entry.chap_name_in,
+ sizeof(fw_entry.chap_name_in));
+ strncpy((char *)rec.session.auth.password_in,
+ fw_entry.chap_password_in,
+ sizeof(fw_entry.chap_password_in));
+ rec.session.auth.password_length =
+ strlen((char *)fw_entry.chap_password);
+ rec.session.auth.password_in_length =
+ strlen((char *)fw_entry.chap_password_in);
+ +
+ CHECK(idbm_add_node(&rec, NULL, 1 /* overwrite */)) + struct libiscsi_node* new_nodes;
+ /* allocate enough space for all the nodes */
+ new_nodes = calloc(node_count, sizeof *new_nodes);
+ if (new_nodes == NULL) {
+ rc = ENOMEM;
+ log_error("%s: %s.\n", __func__, strerror(ENOMEM));
+ goto leave;
+ }
+ +
+ if (nr_found) + struct node_rec *rec;
+ *nr_found = 1; + struct libiscsi_node *new_node = new_nodes;
+ /* in one loop, add nodes to idbm and create libiscsi_node entries */
+ list_for_each_entry(rec, &rec_list, list) {
+ CHECK(idbm_add_node(rec, NULL, 1 /* overwrite */));
+ +
+ strlcpy(new_node->name, rec->name, LIBISCSI_VALUE_MAXLEN);
+ new_node->tpgt = rec->tpgt;
+ strlcpy(new_node->address, rec->conn[0].address, NI_MAXHOST);
+ new_node->port = rec->conn[0].port;
+ strlcpy(new_node->iface, rec->iface.name, LIBISCSI_VALUE_MAXLEN);
+
+ ++new_node;
+ }
+
+ /* update output parameters */
+ if (nr_found) {
+ *nr_found = node_count;
+ }
+ if (found_nodes) { + if (found_nodes) {
+ *found_nodes = calloc(1, sizeof **found_nodes); + *found_nodes = new_nodes;
+ if (*found_nodes == NULL) {
+ snprintf(context->error_str,
+ sizeof(context->error_str), strerror(ENOMEM));
+ rc = ENOMEM;
+ goto leave;
+ }
+ strlcpy((*found_nodes)[0].name, rec.name,
+ LIBISCSI_VALUE_MAXLEN);
+ (*found_nodes)[0].tpgt = rec.tpgt;
+ strlcpy((*found_nodes)[0].address,
+ rec.conn[0].address, NI_MAXHOST);
+ (*found_nodes)[0].port = rec.conn[0].port;
+ } + }
+ +
+leave: +leave:
+ fw_free_targets(&targets);
+
+ free_iface_list(&ifaces);
+ free_rec_list(&rec_list);
+
+ return rc; + return rc;
+} +}
+ +
@ -465,9 +409,14 @@ index 0000000..a9eb0a6
+ +
+int login_helper(void *data, node_rec_t *rec) +int login_helper(void *data, node_rec_t *rec)
+{ +{
+ char *iface = (char*)data;
+ if (strcmp(iface, rec->iface.name))
+ /* different iface, skip it */
+ return -1;
+
+ int rc = iscsid_req_by_rec(MGMT_IPC_SESSION_LOGIN, rec); + int rc = iscsid_req_by_rec(MGMT_IPC_SESSION_LOGIN, rec);
+ if (rc) { + if (rc) {
+ iscsid_handle_error(rc); + iscsi_err_print_msg(rc);
+ rc = ENOTCONN; + rc = ENOTCONN;
+ } + }
+ return rc; + return rc;
@ -478,7 +427,7 @@ index 0000000..a9eb0a6
+{ +{
+ int nr_found = 0, rc; + int nr_found = 0, rc;
+ +
+ CHECK(idbm_for_each_iface(&nr_found, NULL, login_helper, + CHECK(idbm_for_each_iface(&nr_found, (void*)node->iface, login_helper,
+ (char *)node->name, node->tpgt, + (char *)node->name, node->tpgt,
+ (char *)node->address, node->port)) + (char *)node->address, node->port))
+ if (nr_found == 0) { + if (nr_found == 0) {
@ -501,7 +450,7 @@ index 0000000..a9eb0a6
+ +
+ rc = iscsid_req_by_sid(MGMT_IPC_SESSION_LOGOUT, info->sid); + rc = iscsid_req_by_sid(MGMT_IPC_SESSION_LOGOUT, info->sid);
+ if (rc) { + if (rc) {
+ iscsid_handle_error(rc); + iscsi_err_print_msg(rc);
+ rc = EIO; + rc = EIO;
+ } + }
+ +
@ -623,6 +572,11 @@ index 0000000..a9eb0a6
+{ +{
+ struct boot_context fw_entry; + struct boot_context fw_entry;
+ +
+ if (!sysfs_initialized) {
+ sysfs_init();
+ sysfs_initialized = 1;
+ }
+
+ memset(config, 0, sizeof *config); + memset(config, 0, sizeof *config);
+ memset(&fw_entry, 0, sizeof fw_entry); + memset(&fw_entry, 0, sizeof fw_entry);
+ if (fw_get_entry(&fw_entry)) + if (fw_get_entry(&fw_entry))
@ -645,6 +599,11 @@ index 0000000..a9eb0a6
+{ +{
+ struct boot_context fw_entry; + struct boot_context fw_entry;
+ +
+ if (!sysfs_initialized) {
+ sysfs_init();
+ sysfs_initialized = 1;
+ }
+
+ memset(initiatorname, 0, LIBISCSI_VALUE_MAXLEN); + memset(initiatorname, 0, LIBISCSI_VALUE_MAXLEN);
+ memset(&fw_entry, 0, sizeof fw_entry); + memset(&fw_entry, 0, sizeof fw_entry);
+ if (fw_get_entry(&fw_entry)) + if (fw_get_entry(&fw_entry))
@ -655,11 +614,9 @@ index 0000000..a9eb0a6
+ +
+ return 0; + return 0;
+} +}
diff --git a/libiscsi/libiscsi.doxy b/libiscsi/libiscsi.doxy diff -Naurp open-iscsi-2.0-872-rc4-bnx2i.base/libiscsi/libiscsi.doxy open-iscsi-2.0-872-rc4-bnx2i.build/libiscsi/libiscsi.doxy
new file mode 100644 --- open-iscsi-2.0-872-rc4-bnx2i.base/libiscsi/libiscsi.doxy 1969-12-31 18:00:00.000000000 -0600
index 0000000..663770f +++ open-iscsi-2.0-872-rc4-bnx2i.build/libiscsi/libiscsi.doxy 2011-08-14 16:46:24.000000000 -0500
--- /dev/null
+++ b/libiscsi/libiscsi.doxy
@@ -0,0 +1,1473 @@ @@ -0,0 +1,1473 @@
+# Doxyfile 1.5.7.1 +# Doxyfile 1.5.7.1
+ +
@ -2134,12 +2091,10 @@ index 0000000..663770f
+# used. If set to NO the values of all tags below this one will be ignored. +# used. If set to NO the values of all tags below this one will be ignored.
+ +
+SEARCHENGINE = NO +SEARCHENGINE = NO
diff --git a/libiscsi/libiscsi.h b/libiscsi/libiscsi.h diff -Naurp open-iscsi-2.0-872-rc4-bnx2i.base/libiscsi/libiscsi.h open-iscsi-2.0-872-rc4-bnx2i.build/libiscsi/libiscsi.h
new file mode 100644 --- open-iscsi-2.0-872-rc4-bnx2i.base/libiscsi/libiscsi.h 1969-12-31 18:00:00.000000000 -0600
index 0000000..a7d05a5 +++ open-iscsi-2.0-872-rc4-bnx2i.build/libiscsi/libiscsi.h 2011-08-14 16:53:58.000000000 -0500
--- /dev/null @@ -0,0 +1,344 @@
+++ b/libiscsi/libiscsi.h
@@ -0,0 +1,343 @@
+/* +/*
+ * iSCSI Administration library + * iSCSI Administration library
+ * + *
@ -2210,6 +2165,7 @@ index 0000000..a7d05a5
+ get used anywhere, so we keep things simple and assume one connection */ + get used anywhere, so we keep things simple and assume one connection */
+ char address[NI_MAXHOST] /** Portal hostname or IP-address. */; + char address[NI_MAXHOST] /** Portal hostname or IP-address. */;
+ int port /** Portal port number. */; + int port /** Portal port number. */;
+ char iface[LIBISCSI_VALUE_MAXLEN] /** Interface to connect through. */;
+}; +};
+ +
+/** \brief libiscsi CHAP authentication information struct +/** \brief libiscsi CHAP authentication information struct
@ -2483,12 +2439,75 @@ index 0000000..a7d05a5
+#endif /* __cplusplus */ +#endif /* __cplusplus */
+ +
+#endif +#endif
diff --git a/libiscsi/pylibiscsi.c b/libiscsi/pylibiscsi.c diff -Naurp open-iscsi-2.0-872-rc4-bnx2i.base/libiscsi/Makefile open-iscsi-2.0-872-rc4-bnx2i.build/libiscsi/Makefile
new file mode 100644 --- open-iscsi-2.0-872-rc4-bnx2i.base/libiscsi/Makefile 1969-12-31 18:00:00.000000000 -0600
index 0000000..454a26a +++ open-iscsi-2.0-872-rc4-bnx2i.build/libiscsi/Makefile 2011-08-14 16:46:24.000000000 -0500
--- /dev/null @@ -0,0 +1,61 @@
+++ b/libiscsi/pylibiscsi.c +# This Makefile will work only with GNU make.
@@ -0,0 +1,624 @@ +
+OSNAME=$(shell uname -s)
+OPTFLAGS ?= -O2 -g
+WARNFLAGS ?= -Wall -Wstrict-prototypes
+CFLAGS = $(OPTFLAGS) $(WARNFLAGS) -I../include -I../usr \
+ -D$(OSNAME) -fPIC -D_GNU_SOURCE -fvisibility=hidden
+LIB = libiscsi.so.0
+TESTS = tests/test_discovery_sendtargets tests/test_discovery_firmware
+TESTS += tests/test_login tests/test_logout tests/test_params
+TESTS += tests/test_get_network_config tests/test_get_initiator_name
+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 dcb_app.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
+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
+# to get PIC versions.
+COMMON_OBJS = $(patsubst %.o, common-objs/%.o, $(COMMON_SRCS))
+USR_OBJS = $(patsubst %.o, usr-objs/%.o, $(ISCSI_LIB_SRCS) strings.o)
+FW_OBJS = $(patsubst %.o, fw-objs/%.o, $(FW_PARAM_SRCS))
+
+# Flags for the tests
+tests/% : CFLAGS = $(OPTFLAGS) $(WARNFLAGS) -I.
+
+all: lib tests html
+
+lib: $(LIB)
+tests: $(TESTS)
+
+common-objs/%.o: ../utils/sysdeps/%.c
+ mkdir -p common-objs
+ $(CC) $(CFLAGS) -c $< -o $@
+
+usr-objs/%.o: ../usr/%.c
+ mkdir -p usr-objs
+ $(CC) $(CFLAGS) -c $< -o $@
+
+fw-objs/%.o: ../utils/fwparam_ibft/%.c
+ mkdir -p fw-objs
+ $(CC) $(CFLAGS) -c $< -o $@
+
+$(LIB): $(COMMON_OBJS) $(FW_OBJS) $(USR_OBJS) libiscsi.o
+ $(CC) $(CFLAGS) -shared -Wl,-soname,$(LIB) $^ -o $@
+ ln -s -f $(LIB) libiscsi.so
+
+$(TESTS): $(FW_OBJS) $(COMMON_OBJS) $(USR_OBJS) $(LIB)
+
+html: libiscsi.h libiscsi.doxy
+ doxygen libiscsi.doxy
+
+clean:
+ rm -rf *.o common-objs usr-objs fw-objs libuip-objs libiscsi.so* \
+ .depend *~ html $(TESTS) tests/*~
+
+depend:
+ gcc $(CFLAGS) -M `ls *.c` > .depend
+
+-include .depend ../usr/.depend
diff -Naurp open-iscsi-2.0-872-rc4-bnx2i.base/libiscsi/pylibiscsi.c open-iscsi-2.0-872-rc4-bnx2i.build/libiscsi/pylibiscsi.c
--- open-iscsi-2.0-872-rc4-bnx2i.base/libiscsi/pylibiscsi.c 1969-12-31 18:00:00.000000000 -0600
+++ open-iscsi-2.0-872-rc4-bnx2i.build/libiscsi/pylibiscsi.c 2011-08-14 16:53:58.000000000 -0500
@@ -0,0 +1,638 @@
+/* +/*
+ * iSCSI Administration library + * iSCSI Administration library
+ * + *
@ -2689,24 +2708,26 @@ index 0000000..454a26a
+static int PyIscsiNode_init(PyObject *self, PyObject *args, PyObject *kwds) +static int PyIscsiNode_init(PyObject *self, PyObject *args, PyObject *kwds)
+{ +{
+ PyIscsiNode *node = (PyIscsiNode *)self; + PyIscsiNode *node = (PyIscsiNode *)self;
+ char *kwlist[] = {"name", "tpgt", "address", "port", NULL}; + char *kwlist[] = {"name", "tpgt", "address", "port", "iface", NULL};
+ const char *name = NULL, *address = NULL; + const char *name = NULL, *address = NULL, *iface = NULL;
+ int tpgt = -1, port = 3260; + int tpgt = -1, port = 3260;
+ +
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "s|isi:node.__init__", + if (!PyArg_ParseTupleAndKeywords(args, kwds, "s|isis:node.__init__",
+ kwlist, &name, &tpgt, &address, &port)) + kwlist, &name, &tpgt, &address,
+ &port, &iface))
+ return -1; + return -1;
+ if (address == NULL) { + if (address == NULL) {
+ PyErr_SetString(PyExc_ValueError, "address not set"); + PyErr_SetString(PyExc_ValueError, "address not set");
+ return -1; + return -1;
+ } + }
+ if (check_string(name) || check_string(address)) + if (check_string(name) || check_string(address) || check_string(iface))
+ return -1; + return -1;
+ +
+ strcpy(node->node.name, name); + strcpy(node->node.name, name);
+ node->node.tpgt = tpgt; + node->node.tpgt = tpgt;
+ strcpy(node->node.address, address); + strcpy(node->node.address, address);
+ node->node.port = port; + node->node.port = port;
+ strcpy(node->node.iface, iface);
+ +
+ return 0; + return 0;
+} +}
@ -2724,6 +2745,8 @@ index 0000000..454a26a
+ return PyString_FromString(node->node.address); + return PyString_FromString(node->node.address);
+ } else if (!strcmp(attr, "port")) { + } else if (!strcmp(attr, "port")) {
+ return PyInt_FromLong(node->node.port); + return PyInt_FromLong(node->node.port);
+ } else if (!strcmp(attr, "iface")) {
+ return PyString_FromString(node->node.iface);
+ } + }
+ return NULL; + return NULL;
+} +}
@ -2751,6 +2774,10 @@ index 0000000..454a26a
+ if (!PyArg_Parse(value, "i", &i)) + if (!PyArg_Parse(value, "i", &i))
+ return -1; + return -1;
+ node->node.port = i; + node->node.port = i;
+ } else if (!strcmp(attr, "iface")) {
+ if (!PyArg_Parse(value, "s", &str) || check_string(str))
+ return -1;
+ strcpy(node->node.iface, str);
+ } + }
+ +
+ return 0; + return 0;
@ -2778,6 +2805,10 @@ index 0000000..454a26a
+ if (self->node.port > other->node.port) + if (self->node.port > other->node.port)
+ return -1; + return -1;
+ +
+ res = strcmp(self->node.iface, other->node.iface);
+ if (res)
+ return res;
+
+ return 0; + return 0;
+} +}
+ +
@ -2931,6 +2962,8 @@ index 0000000..454a26a
+ "address", "address"}, + "address", "address"},
+ {"port", (getter)PyIscsiNode_get, (setter)PyIscsiNode_set, + {"port", (getter)PyIscsiNode_get, (setter)PyIscsiNode_set,
+ "port", "port"}, + "port", "port"},
+ {"iface", (getter)PyIscsiNode_get, (setter)PyIscsiNode_set,
+ "iface", "iface"},
+ {NULL} + {NULL}
+}; +};
+ +
@ -3113,11 +3146,9 @@ index 0000000..454a26a
+ Py_INCREF(&PyIscsiNode_Type); + Py_INCREF(&PyIscsiNode_Type);
+ PyModule_AddObject(m, "node", (PyObject *) &PyIscsiNode_Type); + PyModule_AddObject(m, "node", (PyObject *) &PyIscsiNode_Type);
+} +}
diff --git a/libiscsi/setup.py b/libiscsi/setup.py diff -Naurp open-iscsi-2.0-872-rc4-bnx2i.base/libiscsi/setup.py open-iscsi-2.0-872-rc4-bnx2i.build/libiscsi/setup.py
new file mode 100644 --- open-iscsi-2.0-872-rc4-bnx2i.base/libiscsi/setup.py 1969-12-31 18:00:00.000000000 -0600
index 0000000..bb4329b +++ open-iscsi-2.0-872-rc4-bnx2i.build/libiscsi/setup.py 2011-08-14 16:46:24.000000000 -0500
--- /dev/null
+++ b/libiscsi/setup.py
@@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
+from distutils.core import setup, Extension +from distutils.core import setup, Extension
+ +
@ -3128,11 +3159,9 @@ index 0000000..bb4329b
+ +
+setup (name = 'PyIscsi',version = '1.0', +setup (name = 'PyIscsi',version = '1.0',
+ description = 'libiscsi python bindings', ext_modules = [module1]) + description = 'libiscsi python bindings', ext_modules = [module1])
diff --git a/libiscsi/tests/test_discovery_firmware.c b/libiscsi/tests/test_discovery_firmware.c diff -Naurp open-iscsi-2.0-872-rc4-bnx2i.base/libiscsi/tests/test_discovery_firmware.c open-iscsi-2.0-872-rc4-bnx2i.build/libiscsi/tests/test_discovery_firmware.c
new file mode 100644 --- open-iscsi-2.0-872-rc4-bnx2i.base/libiscsi/tests/test_discovery_firmware.c 1969-12-31 18:00:00.000000000 -0600
index 0000000..76e852a +++ open-iscsi-2.0-872-rc4-bnx2i.build/libiscsi/tests/test_discovery_firmware.c 2011-08-14 16:46:24.000000000 -0500
--- /dev/null
+++ b/libiscsi/tests/test_discovery_firmware.c
@@ -0,0 +1,53 @@ @@ -0,0 +1,53 @@
+/* +/*
+ * iSCSI Administration library + * iSCSI Administration library
@ -3187,11 +3216,9 @@ index 0000000..76e852a
+ +
+ return rc; + return rc;
+} +}
diff --git a/libiscsi/tests/test_discovery_sendtargets.c b/libiscsi/tests/test_discovery_sendtargets.c diff -Naurp open-iscsi-2.0-872-rc4-bnx2i.base/libiscsi/tests/test_discovery_sendtargets.c open-iscsi-2.0-872-rc4-bnx2i.build/libiscsi/tests/test_discovery_sendtargets.c
new file mode 100644 --- open-iscsi-2.0-872-rc4-bnx2i.base/libiscsi/tests/test_discovery_sendtargets.c 1969-12-31 18:00:00.000000000 -0600
index 0000000..1a3c12e +++ open-iscsi-2.0-872-rc4-bnx2i.build/libiscsi/tests/test_discovery_sendtargets.c 2011-08-14 16:46:24.000000000 -0500
--- /dev/null
+++ b/libiscsi/tests/test_discovery_sendtargets.c
@@ -0,0 +1,60 @@ @@ -0,0 +1,60 @@
+/* +/*
+ * iSCSI Administration library + * iSCSI Administration library
@ -3253,11 +3280,9 @@ index 0000000..1a3c12e
+ +
+ return rc; + return rc;
+} +}
diff --git a/libiscsi/tests/test_get_auth.c b/libiscsi/tests/test_get_auth.c diff -Naurp open-iscsi-2.0-872-rc4-bnx2i.base/libiscsi/tests/test_get_auth.c open-iscsi-2.0-872-rc4-bnx2i.build/libiscsi/tests/test_get_auth.c
new file mode 100644 --- open-iscsi-2.0-872-rc4-bnx2i.base/libiscsi/tests/test_get_auth.c 1969-12-31 18:00:00.000000000 -0600
index 0000000..5e234da +++ open-iscsi-2.0-872-rc4-bnx2i.build/libiscsi/tests/test_get_auth.c 2011-08-14 16:46:24.000000000 -0500
--- /dev/null
+++ b/libiscsi/tests/test_get_auth.c
@@ -0,0 +1,70 @@ @@ -0,0 +1,70 @@
+/* +/*
+ * iSCSI Administration library + * iSCSI Administration library
@ -3329,11 +3354,9 @@ index 0000000..5e234da
+ +
+ return rc; + return rc;
+} +}
diff --git a/libiscsi/tests/test_get_initiator_name.c b/libiscsi/tests/test_get_initiator_name.c diff -Naurp open-iscsi-2.0-872-rc4-bnx2i.base/libiscsi/tests/test_get_initiator_name.c open-iscsi-2.0-872-rc4-bnx2i.build/libiscsi/tests/test_get_initiator_name.c
new file mode 100644 --- open-iscsi-2.0-872-rc4-bnx2i.base/libiscsi/tests/test_get_initiator_name.c 1969-12-31 18:00:00.000000000 -0600
index 0000000..997c053 +++ open-iscsi-2.0-872-rc4-bnx2i.build/libiscsi/tests/test_get_initiator_name.c 2011-08-14 16:46:24.000000000 -0500
--- /dev/null
+++ b/libiscsi/tests/test_get_initiator_name.c
@@ -0,0 +1,38 @@ @@ -0,0 +1,38 @@
+/* +/*
+ * iSCSI Administration library + * iSCSI Administration library
@ -3373,11 +3396,9 @@ index 0000000..997c053
+ +
+ return 0; + return 0;
+} +}
diff --git a/libiscsi/tests/test_get_network_config.c b/libiscsi/tests/test_get_network_config.c diff -Naurp open-iscsi-2.0-872-rc4-bnx2i.base/libiscsi/tests/test_get_network_config.c open-iscsi-2.0-872-rc4-bnx2i.build/libiscsi/tests/test_get_network_config.c
new file mode 100644 --- open-iscsi-2.0-872-rc4-bnx2i.base/libiscsi/tests/test_get_network_config.c 1969-12-31 18:00:00.000000000 -0600
index 0000000..2dedd61 +++ open-iscsi-2.0-872-rc4-bnx2i.build/libiscsi/tests/test_get_network_config.c 2011-08-14 16:46:24.000000000 -0500
--- /dev/null
+++ b/libiscsi/tests/test_get_network_config.c
@@ -0,0 +1,45 @@ @@ -0,0 +1,45 @@
+/* +/*
+ * iSCSI Administration library + * iSCSI Administration library
@ -3424,11 +3445,9 @@ index 0000000..2dedd61
+ +
+ return 0; + return 0;
+} +}
diff --git a/libiscsi/tests/test_login.c b/libiscsi/tests/test_login.c diff -Naurp open-iscsi-2.0-872-rc4-bnx2i.base/libiscsi/tests/test_login.c open-iscsi-2.0-872-rc4-bnx2i.build/libiscsi/tests/test_login.c
new file mode 100644 --- open-iscsi-2.0-872-rc4-bnx2i.base/libiscsi/tests/test_login.c 1969-12-31 18:00:00.000000000 -0600
index 0000000..3eb70d6 +++ open-iscsi-2.0-872-rc4-bnx2i.build/libiscsi/tests/test_login.c 2011-08-14 16:46:24.000000000 -0500
--- /dev/null
+++ b/libiscsi/tests/test_login.c
@@ -0,0 +1,52 @@ @@ -0,0 +1,52 @@
+/* +/*
+ * iSCSI Administration library + * iSCSI Administration library
@ -3482,11 +3501,9 @@ index 0000000..3eb70d6
+ +
+ return rc; + return rc;
+} +}
diff --git a/libiscsi/tests/test_logout.c b/libiscsi/tests/test_logout.c diff -Naurp open-iscsi-2.0-872-rc4-bnx2i.base/libiscsi/tests/test_logout.c open-iscsi-2.0-872-rc4-bnx2i.build/libiscsi/tests/test_logout.c
new file mode 100644 --- open-iscsi-2.0-872-rc4-bnx2i.base/libiscsi/tests/test_logout.c 1969-12-31 18:00:00.000000000 -0600
index 0000000..b734dca +++ open-iscsi-2.0-872-rc4-bnx2i.build/libiscsi/tests/test_logout.c 2011-08-14 16:46:24.000000000 -0500
--- /dev/null
+++ b/libiscsi/tests/test_logout.c
@@ -0,0 +1,51 @@ @@ -0,0 +1,51 @@
+/* +/*
+ * iSCSI Administration library + * iSCSI Administration library
@ -3539,11 +3556,9 @@ index 0000000..b734dca
+ +
+ return rc; + return rc;
+} +}
diff --git a/libiscsi/tests/test_params.c b/libiscsi/tests/test_params.c diff -Naurp open-iscsi-2.0-872-rc4-bnx2i.base/libiscsi/tests/test_params.c open-iscsi-2.0-872-rc4-bnx2i.build/libiscsi/tests/test_params.c
new file mode 100644 --- open-iscsi-2.0-872-rc4-bnx2i.base/libiscsi/tests/test_params.c 1969-12-31 18:00:00.000000000 -0600
index 0000000..d3223be +++ open-iscsi-2.0-872-rc4-bnx2i.build/libiscsi/tests/test_params.c 2011-08-14 16:46:24.000000000 -0500
--- /dev/null
+++ b/libiscsi/tests/test_params.c
@@ -0,0 +1,103 @@ @@ -0,0 +1,103 @@
+/* +/*
+ * iSCSI Administration library + * iSCSI Administration library
@ -3648,11 +3663,9 @@ index 0000000..d3223be
+ +
+ return rc; + return rc;
+} +}
diff --git a/libiscsi/tests/test_set_auth.c b/libiscsi/tests/test_set_auth.c diff -Naurp open-iscsi-2.0-872-rc4-bnx2i.base/libiscsi/tests/test_set_auth.c open-iscsi-2.0-872-rc4-bnx2i.build/libiscsi/tests/test_set_auth.c
new file mode 100644 --- open-iscsi-2.0-872-rc4-bnx2i.base/libiscsi/tests/test_set_auth.c 1969-12-31 18:00:00.000000000 -0600
index 0000000..a21f888 +++ open-iscsi-2.0-872-rc4-bnx2i.build/libiscsi/tests/test_set_auth.c 2011-08-14 16:46:24.000000000 -0500
--- /dev/null
+++ b/libiscsi/tests/test_set_auth.c
@@ -0,0 +1,58 @@ @@ -0,0 +1,58 @@
+/* +/*
+ * iSCSI Administration library + * iSCSI Administration library
@ -3712,10 +3725,28 @@ index 0000000..a21f888
+ +
+ return rc; + return rc;
+} +}
diff --git a/usr/discovery.c b/usr/discovery.c diff -Naurp open-iscsi-2.0-872-rc4-bnx2i.base/Makefile open-iscsi-2.0-872-rc4-bnx2i.build/Makefile
index 381f825..2233de7 100644 --- open-iscsi-2.0-872-rc4-bnx2i.base/Makefile 2011-08-14 16:53:01.000000000 -0500
--- a/usr/discovery.c +++ open-iscsi-2.0-872-rc4-bnx2i.build/Makefile 2011-08-14 16:46:24.000000000 -0500
+++ b/usr/discovery.c @@ -32,6 +32,7 @@ user: ;
$(MAKE) -C utils/fwparam_ibft
$(MAKE) -C usr
$(MAKE) -C utils
+ $(MAKE) -C libiscsi
@echo
@echo "Compilation complete Output file"
@echo "----------------------------------- ----------------"
@@ -53,6 +54,7 @@ kernel: force
force: ;
clean:
+ $(MAKE) -C libiscsi clean
$(MAKE) -C utils/sysdeps clean
$(MAKE) -C utils/fwparam_ibft clean
$(MAKE) -C utils clean
diff -Naurp open-iscsi-2.0-872-rc4-bnx2i.base/usr/discovery.c open-iscsi-2.0-872-rc4-bnx2i.build/usr/discovery.c
--- open-iscsi-2.0-872-rc4-bnx2i.base/usr/discovery.c 2011-08-14 16:53:01.000000000 -0500
+++ open-iscsi-2.0-872-rc4-bnx2i.build/usr/discovery.c 2011-08-14 16:46:24.000000000 -0500
@@ -36,6 +36,7 @@ @@ -36,6 +36,7 @@
#include "types.h" #include "types.h"
#include "iscsi_proto.h" #include "iscsi_proto.h"
@ -3724,14 +3755,82 @@ index 381f825..2233de7 100644
#include "log.h" #include "log.h"
#include "idbm.h" #include "idbm.h"
#include "iscsi_settings.h" #include "iscsi_settings.h"
diff --git a/usr/iscsi_ipc.h b/usr/iscsi_ipc.h @@ -50,9 +51,11 @@
index 74ef948..713914f 100644 #include "iscsi_timer.h"
--- a/usr/iscsi_ipc.h #include "iscsi_err.h"
+++ b/usr/iscsi_ipc.h /* libisns includes */
@@ -111,4 +111,6 @@ struct iscsi_ipc { +#ifdef ISNS_ENABLE
int (*recv_pdu_end) (struct iscsi_conn *conn); #include "isns.h"
#include "paths.h"
#include "message.h"
+#endif
#ifdef SLP_ENABLE
#include "iscsi-slp-discovery.h"
@@ -98,6 +101,7 @@ static int request_initiator_name(void)
return 0;
}
+#ifdef ISNS_ENABLE
void discovery_isns_free_servername(void)
{
if (isns_config.ic_server_name)
@@ -377,6 +381,7 @@ retry:
discovery_isns_free_servername();
return rc;
}
+#endif
int discovery_fw(void *data, struct iface_rec *iface,
struct list_head *rec_list)
diff -Naurp open-iscsi-2.0-872-rc4-bnx2i.base/usr/idbm.c open-iscsi-2.0-872-rc4-bnx2i.build/usr/idbm.c
--- open-iscsi-2.0-872-rc4-bnx2i.base/usr/idbm.c 2011-08-14 16:53:01.000000000 -0500
+++ open-iscsi-2.0-872-rc4-bnx2i.build/usr/idbm.c 2011-08-14 16:46:24.000000000 -0500
@@ -1274,9 +1274,9 @@ int idbm_print_all_discovery(int info_le
* fn should return -1 if it skipped the rec, a 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)
{
DIR *iface_dirfd;
struct dirent *iface_dent;
diff -Naurp open-iscsi-2.0-872-rc4-bnx2i.base/usr/idbm.h open-iscsi-2.0-872-rc4-bnx2i.build/usr/idbm.h
--- open-iscsi-2.0-872-rc4-bnx2i.base/usr/idbm.h 2011-08-14 16:53:01.000000000 -0500
+++ open-iscsi-2.0-872-rc4-bnx2i.build/usr/idbm.h 2011-08-14 16:46:24.000000000 -0500
@@ -98,6 +98,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_node(int *found, void *data,
diff -Naurp open-iscsi-2.0-872-rc4-bnx2i.base/usr/iscsi_ipc.h open-iscsi-2.0-872-rc4-bnx2i.build/usr/iscsi_ipc.h
--- open-iscsi-2.0-872-rc4-bnx2i.base/usr/iscsi_ipc.h 2011-08-14 16:53:01.000000000 -0500
+++ open-iscsi-2.0-872-rc4-bnx2i.build/usr/iscsi_ipc.h 2011-08-14 16:46:24.000000000 -0500
@@ -136,4 +136,6 @@ struct iscsi_ipc {
int (*recv_conn_state) (struct iscsi_conn *conn, uint32_t *state);
}; };
+struct iscsi_ipc *ipc; +struct iscsi_ipc *ipc;
+ +
#endif /* ISCSI_IPC_H */ #endif /* ISCSI_IPC_H */
diff -Naurp open-iscsi-2.0-872-rc4-bnx2i.base/usr/Makefile open-iscsi-2.0-872-rc4-bnx2i.build/usr/Makefile
--- open-iscsi-2.0-872-rc4-bnx2i.base/usr/Makefile 2011-08-14 16:53:01.000000000 -0500
+++ open-iscsi-2.0-872-rc4-bnx2i.build/usr/Makefile 2011-08-14 16:46:24.000000000 -0500
@@ -33,7 +33,7 @@ endif
OPTFLAGS ?= -O2 -g
WARNFLAGS ?= -Wall -Wstrict-prototypes
CFLAGS += $(OPTFLAGS) $(WARNFLAGS) -I../include -I. -I../utils/open-isns \
- -D$(OSNAME) $(IPC_CFLAGS)
+ -D$(OSNAME) $(IPC_CFLAGS) -DISNS_ENABLE
PROGRAMS = iscsid iscsiadm iscsistart
# libc compat files

View File

@ -0,0 +1,11 @@
--- open-iscsi-2.0-872-rc4-bnx2i/usr/version.h 2011-09-01 20:54:51.000000000 -0500
+++ open-iscsi-2.0-872-rc4-bnx2i.build/usr/version.h 2011-09-01 20:59:20.000000000 -0500
@@ -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-872"
+#define ISCSI_VERSION_STR "2.0-872.28.el6"
#define ISCSI_VERSION_FILE "/sys/module/scsi_transport_iscsi/version"
#endif

View File

@ -0,0 +1,19 @@
diff -aurp open-iscsi-2.0-872-rc4-bnx2i/iscsi_uio/docs/iscsiuio.8 open-iscsi-2.0-872-rc4-bnx2i.work/iscsiuio/docs/iscsiuio.8
--- open-iscsi-2.0-872-rc4-bnx2i/iscsiuio/docs/iscsiuio.8 2011-01-31 19:38:19.000000000 -0600
+++ open-iscsi-2.0-872-rc4-bnx2i.work/iscsiuio/docs/iscsiuio.8 2011-01-31 19:38:44.000000000 -0600
@@ -67,6 +67,15 @@ into the background.
.TP
.BI -v
This is to print the version.
+.PP
+.TP
+.BI -p <pidfile>
+Use pidfile (default /var/run/iscsiuio.pid )
+.PP
+.TP
+.BI -h
+Display this help and exit.
+
.\"
.\" AUTHOR part

View File

@ -1,74 +0,0 @@
diff --git a/libiscsi/Makefile b/libiscsi/Makefile
index 4aeb44f..a91d6b8 100644
--- a/libiscsi/Makefile
+++ b/libiscsi/Makefile
@@ -3,7 +3,7 @@
OSNAME=$(shell uname -s)
OPTFLAGS ?= -O2 -g
WARNFLAGS ?= -Wall -Wstrict-prototypes
-CFLAGS = $(OPTFLAGS) $(WARNFLAGS) -I../include -I../usr -I../utils/open-isns \
+CFLAGS = $(OPTFLAGS) $(WARNFLAGS) -I../include -I../usr \
-D$(OSNAME) -fPIC -D_GNU_SOURCE -fvisibility=hidden
LIB = libiscsi.so.0
TESTS = tests/test_discovery_sendtargets tests/test_discovery_firmware
@@ -43,11 +43,10 @@ fw-objs/%.o: ../utils/fwparam_ibft/%.c
$(CC) $(CFLAGS) -c $< -o $@
$(LIB): $(COMMON_OBJS) $(FW_OBJS) $(USR_OBJS) libiscsi.o
- $(CC) $(CFLAGS) -L../utils/open-isns -lisns -shared -Wl,-soname,$(LIB) $^ -o $@
+ $(CC) $(CFLAGS) -shared -Wl,-soname,$(LIB) $^ -o $@
ln -s -f $(LIB) libiscsi.so
$(TESTS): $(FW_OBJS) $(COMMON_OBJS) $(USR_OBJS) $(LIB)
- $(CC) $(CFLAGS) -L../utils/open-isns -lisns -c $< -o $@
html: libiscsi.h libiscsi.doxy
doxygen libiscsi.doxy
diff --git a/usr/Makefile b/usr/Makefile
index 8e505bf..13a60f9 100644
--- a/usr/Makefile
+++ b/usr/Makefile
@@ -31,7 +31,7 @@ endif
OPTFLAGS ?= -O2 -g
WARNFLAGS ?= -Wall -Wstrict-prototypes
CFLAGS += $(OPTFLAGS) $(WARNFLAGS) -I../include -I. -I../utils/open-isns \
- -D$(OSNAME) $(IPC_CFLAGS)
+ -D$(OSNAME) $(IPC_CFLAGS) -DISNS_ENABLE
PROGRAMS = iscsid iscsiadm iscsistart
# libc compat files
diff --git a/usr/discovery.c b/usr/discovery.c
index 2233de7..02c6f25 100644
--- a/usr/discovery.c
+++ b/usr/discovery.c
@@ -45,9 +45,11 @@
#include "iscsid_req.h"
#include "iscsi_util.h"
/* libisns includes */
+#ifdef ISNS_ENABLE
#include "isns.h"
#include "paths.h"
#include "message.h"
+#endif
#ifdef SLP_ENABLE
#include "iscsi-slp-discovery.h"
@@ -94,6 +96,7 @@ static int request_initiator_name(void)
return 0;
}
+#ifdef ISNS_ENABLE
void discovery_isns_free_servername(void)
{
if (isns_config.ic_server_name)
@@ -367,6 +370,7 @@ retry:
discovery_isns_free_servername();
return rc;
}
+#endif
int discovery_fw(void *data, struct iface_rec *iface,
struct list_head *rec_list)
--
1.6.6.1

View File

@ -0,0 +1,47 @@
diff -aurp open-iscsi-2.0-872-rc4-bnx2i/utils/open-isns/db-policy.c open-iscsi-2.0-872-rc4-bnx2i.build/utils/open-isns/db-policy.c
--- open-iscsi-2.0-872-rc4-bnx2i/utils/open-isns/db-policy.c 2011-09-01 20:28:53.000000000 -0500
+++ open-iscsi-2.0-872-rc4-bnx2i.build/utils/open-isns/db-policy.c 2011-09-01 20:31:39.000000000 -0500
@@ -7,8 +7,10 @@
#include <sys/stat.h>
#include <string.h>
#include <unistd.h>
+#ifdef WITH_SECURITY
#include <openssl/pem.h>
#include <openssl/err.h>
+#endif
#include "isns.h"
#include "security.h"
#include "objects.h"
diff -aurp open-iscsi-2.0-872-rc4-bnx2i/utils/open-isns/security.h open-iscsi-2.0-872-rc4-bnx2i.build/utils/open-isns/security.h
--- open-iscsi-2.0-872-rc4-bnx2i/utils/open-isns/security.h 2011-09-01 20:28:53.000000000 -0500
+++ open-iscsi-2.0-872-rc4-bnx2i.build/utils/open-isns/security.h 2011-09-01 20:31:39.000000000 -0500
@@ -6,11 +6,16 @@
#ifndef ISNS_SECURITY_H
#define ISNS_SECURITY_H
-
-#include <openssl/evp.h>
#include "buffer.h"
#include "util.h"
+
+#ifdef WITH_SECURITY
+#include <openssl/evp.h>
+#else
+#define EVP_PKEY void
+#endif
+
/*
* Security context
*/
diff -aurp open-iscsi-2.0-872-rc4-bnx2i/utils/open-isns/util.h open-iscsi-2.0-872-rc4-bnx2i.build/utils/open-isns/util.h
--- open-iscsi-2.0-872-rc4-bnx2i/utils/open-isns/util.h 2011-09-01 20:28:53.000000000 -0500
+++ open-iscsi-2.0-872-rc4-bnx2i.build/utils/open-isns/util.h 2011-09-01 20:31:39.000000000 -0500
@@ -9,6 +9,7 @@
#include <sys/types.h>
#include <stdint.h>
+#include <stdlib.h>
#include <stdio.h>
#include <stddef.h>
#include <string.h> // for strdup

View File

@ -1,9 +1,9 @@
diff -aup open-iscsi-2.0-872-rc1-bnx2i/usr/Makefile open-iscsi-2.0-872-rc1-bnx2i.work/usr/Makefile diff -aurp open-iscsi-2.0-872-rc4-bnx2i/usr/Makefile open-iscsi-2.0-872-rc4-bnx2i.work/usr/Makefile
--- open-iscsi-2.0-872-rc1-bnx2i/usr/Makefile 2010-06-18 18:04:51.000000000 -0500 --- open-iscsi-2.0-872-rc4-bnx2i/usr/Makefile 2011-01-31 06:23:53.000000000 -0600
+++ open-iscsi-2.0-872-rc1-bnx2i.work/usr/Makefile 2010-06-18 18:13:33.000000000 -0500 +++ open-iscsi-2.0-872-rc4-bnx2i.work/usr/Makefile 2011-01-31 06:23:14.000000000 -0600
@@ -60,7 +60,7 @@ iscsiadm: $(ISCSI_LIB_SRCS) $(DISCOVERY_ @@ -61,7 +61,7 @@ iscsiadm: $(ISCSI_LIB_SRCS) $(DISCOVERY_
iscsistart: $(IPC_OBJ) $(ISCSI_LIB_SRCS) $(INITIATOR_SRCS) $(FW_BOOT_SRCS) \ iscsistart: $(ISCSI_LIB_SRCS) $(INITIATOR_SRCS) $(FW_BOOT_SRCS) \
iscsistart.o statics.o iscsistart.o statics.o
- $(CC) $(CFLAGS) -static $^ -o $@ - $(CC) $(CFLAGS) -static $^ -o $@
+ $(CC) $(CFLAGS) $^ -o $@ + $(CC) $(CFLAGS) $^ -o $@

View File

@ -0,0 +1,172 @@
commit ac38eee2083821eb29d098227ad044c950d115e4
Author: Mike Christie <michaelc@cs.wisc.edu>
Date: Sun Aug 14 22:14:04 2011 -0500
iscsi tools: fix default iface binding setup
If a driver supports multiple ifaces only one is getting
auto created. This modifies the default iface setup code
so that it creates a iface per kernel iface or a iface per
host if kernel ifaces are not supported.
diff --git a/usr/iface.c b/usr/iface.c
index 5d5f7bf..9c70d09 100644
--- a/usr/iface.c
+++ b/usr/iface.c
@@ -424,12 +424,61 @@ int iface_get_by_net_binding(struct iface_rec *pattern,
return ISCSI_ERR_NO_OBJS_FOUND;
}
+static int iface_get_iptype(struct iface_rec *iface)
+{
+ if (strcmp(iface->bootproto, "dhcp") && !strstr(iface->ipaddress, "."))
+ return ISCSI_IFACE_TYPE_IPV6;
+ else
+ return ISCSI_IFACE_TYPE_IPV4;
+}
+
+static int iface_setup_binding_from_kern_iface(void *data,
+ struct iface_rec *kern_iface)
+{
+ struct host_info *hinfo = data;
+ struct iface_rec iface;
+
+ if (!strlen(hinfo->iface.hwaddress)) {
+ log_error("Invalid offload iSCSI host %u. Missing "
+ "hwaddress. Try upgrading %s driver.\n",
+ hinfo->host_no, hinfo->iface.transport_name);
+ return 0;
+ }
+
+ memset(&iface, 0, sizeof(struct iface_rec));
+ strcpy(iface.hwaddress, hinfo->iface.hwaddress);
+ strcpy(iface.transport_name, hinfo->iface.transport_name);
+
+ if (kern_iface) {
+ iface.iface_num = kern_iface->iface_num;
+
+ snprintf(iface.name, sizeof(iface.name), "%s.%s.%s.%u",
+ kern_iface->transport_name,
+ kern_iface->hwaddress,
+ iface_get_iptype(kern_iface) == ISCSI_IFACE_TYPE_IPV4 ?
+ "ipv4" : "ipv6", kern_iface->iface_num);
+ } else {
+ snprintf(iface.name, sizeof(iface.name), "%s.%s",
+ hinfo->iface.transport_name, hinfo->iface.hwaddress);
+ }
+
+ if (iface_conf_read(&iface)) {
+ /* not found so create it */
+ if (iface_conf_write(&iface)) {
+ log_error("Could not create default iface conf %s.",
+ iface.name);
+ /* fall through - will not be persistent */
+ }
+ }
+
+ return 0;
+}
+
static int __iface_setup_host_bindings(void *data, struct host_info *hinfo)
{
struct iface_rec *def_iface;
- struct iface_rec iface;
struct iscsi_transport *t;
- int i = 0;
+ int i = 0, nr_found;
t = iscsi_sysfs_get_transport_by_hba(hinfo->host_no);
if (!t)
@@ -441,26 +490,12 @@ static int __iface_setup_host_bindings(void *data, struct host_info *hinfo)
return 0;
}
- if (iface_get_by_net_binding(&hinfo->iface, &iface) ==
- ISCSI_ERR_NO_OBJS_FOUND) {
- /* Must be a new port */
- if (!strlen(hinfo->iface.hwaddress)) {
- log_error("Invalid offload iSCSI host %u. Missing "
- "hwaddress. Try upgrading %s driver.\n",
- hinfo->host_no, t->name);
- return 0;
- }
-
- memset(&iface, 0, sizeof(struct iface_rec));
- strcpy(iface.hwaddress, hinfo->iface.hwaddress);
- strcpy(iface.transport_name, hinfo->iface.transport_name);
- snprintf(iface.name, sizeof(iface.name), "%s.%s",
- t->name, hinfo->iface.hwaddress);
- if (iface_conf_write(&iface))
- log_error("Could not create default iface conf %s.",
- iface.name);
- /* fall through - will not be persistent */
- }
+ nr_found = 0;
+ iscsi_sysfs_for_each_iface_on_host(hinfo, hinfo->host_no,
+ &nr_found,
+ iface_setup_binding_from_kern_iface);
+ if (!nr_found)
+ iface_setup_binding_from_kern_iface(hinfo, NULL);
return 0;
}
@@ -843,7 +878,6 @@ int iface_setup_from_boot_context(struct iface_rec *iface,
memset(iface->name, 0, sizeof(iface->name));
snprintf(iface->name, sizeof(iface->name), "%s.%s",
iface->transport_name, context->mac);
-
strlcpy(iface->hwaddress, context->mac,
sizeof(iface->hwaddress));
strlcpy(iface->ipaddress, context->ipaddr,
@@ -921,9 +955,7 @@ static int __iface_get_param_count(void *data, struct iface_rec *iface)
if (strcmp(iface_params->primary->hwaddress, iface->hwaddress))
return 0;
- if (strcmp(iface->bootproto, "dhcp") && !strstr(iface->ipaddress, "."))
- iptype = ISCSI_IFACE_TYPE_IPV6;
-
+ iptype = iface_get_iptype(iface);
if (iptype == ISCSI_IFACE_TYPE_IPV4) {
if (strcmp(iface->state, "disable")) {
@@ -1466,12 +1498,10 @@ static int __iface_build_net_config(void *data, struct iface_rec *iface)
if (strcmp(net_config->primary->hwaddress, iface->hwaddress))
return 0;
- if (strcmp(iface->bootproto, "dhcp") && !strstr(iface->ipaddress, "."))
- iptype = ISCSI_IFACE_TYPE_IPV6;
-
/* start at 2, because 0 is for nlmsghdr and 1 for event */
iov = net_config->iovs + 2;
+ iptype = iface_get_iptype(iface);
if (iptype == ISCSI_IFACE_TYPE_IPV4) {
if (!strcmp(iface->state, "disable")) {
if (!iface_fill_net_state(&iov[net_config->count],
diff --git a/usr/iscsi_sysfs.c b/usr/iscsi_sysfs.c
index 995549e..961cefd 100644
--- a/usr/iscsi_sysfs.c
+++ b/usr/iscsi_sysfs.c
@@ -425,9 +425,10 @@ uint32_t iscsi_sysfs_get_host_no_from_hwinfo(struct iface_rec *iface, int *rc)
static int iscsi_sysfs_read_iface(struct iface_rec *iface, int host_no,
char *session, char *iface_kern_id)
{
+ uint32_t tmp_host_no, iface_num;
char host_id[NAME_SIZE];
struct iscsi_transport *t;
- int ret;
+ int ret, iface_type;
t = iscsi_sysfs_get_transport_by_hba(host_no);
if (!t)
@@ -582,6 +583,10 @@ static int iscsi_sysfs_read_iface(struct iface_rec *iface, int host_no,
&iface->vlan_id);
sysfs_get_uint8(iface_kern_id, ISCSI_IFACE_SUBSYS, "vlan_priority",
&iface->vlan_priority);
+
+ if (sscanf(iface_kern_id, "ipv%d-iface-%u-%u", &iface_type,
+ &tmp_host_no, &iface_num) == 3)
+ iface->iface_num = iface_num;
done:
if (ret)
return ISCSI_ERR_SYSFS_LOOKUP;

View File

@ -0,0 +1,33 @@
diff -aurp open-iscsi-2.0-872-rc4-bnx2i/include/fw_context.h open-iscsi-2.0-872-rc4-bnx2i.work/include/fw_context.h
--- open-iscsi-2.0-872-rc4-bnx2i/include/fw_context.h 2011-10-10 13:57:38.000000000 -0500
+++ open-iscsi-2.0-872-rc4-bnx2i.work/include/fw_context.h 2011-10-12 01:03:30.000000000 -0500
@@ -33,7 +34,7 @@ struct boot_context {
/* target settings */
int target_port;
char targetname[TARGET_NAME_MAXLEN + 1];
- char target_ipaddr[32];
+ char target_ipaddr[256];
char chap_name[AUTH_STR_MAX_LEN];
char chap_password[AUTH_STR_MAX_LEN];
char chap_name_in[AUTH_STR_MAX_LEN];
@@ -44,14 +45,14 @@ struct boot_context {
char initiatorname[TARGET_NAME_MAXLEN + 1];
/* network settings */
- char dhcp[18];
+ char dhcp[256];
char iface[IF_NAMESIZE];
char mac[18];
- char ipaddr[18];
- char gateway[18];
- char primary_dns[18];
- char secondary_dns[18];
- char mask[18];
+ char ipaddr[256];
+ char gateway[256];
+ char primary_dns[256];
+ char secondary_dns[256];
+ char mask[256];
char lun[17];
char vlan[15];

View File

@ -0,0 +1,13 @@
diff -aurp open-iscsi-2.0-872-rc4-bnx2i/usr/initiator.c open-iscsi-2.0-872-rc4-bnx2i.build/usr/initiator.c
--- open-iscsi-2.0-872-rc4-bnx2i/usr/initiator.c 2011-09-01 20:28:53.000000000 -0500
+++ open-iscsi-2.0-872-rc4-bnx2i.build/usr/initiator.c 2011-09-01 20:29:49.000000000 -0500
@@ -484,8 +484,7 @@ cleanup:
if (session->id != -1) {
log_debug(2, "kdestroy session %u", session->id);
session->r_stage = R_STAGE_SESSION_DESTOYED;
- err = ipc->destroy_session(session->t->handle, session->id);
- if (err) {
+ if (ipc->destroy_session(session->t->handle, session->id)) {
log_error("can not safely destroy session %d",
session->id);
return ISCSI_ERR_INTERNAL;

View File

@ -1,49 +0,0 @@
diff -aurp open-iscsi-2.0-872-rc1-bnx2i/libiscsi/libiscsi.c open-iscsi-2.0-872-rc1-bnx2i.work/libiscsi/libiscsi.c
--- open-iscsi-2.0-872-rc1-bnx2i/libiscsi/libiscsi.c 2010-05-18 17:57:59.000000000 -0500
+++ open-iscsi-2.0-872-rc1-bnx2i.work/libiscsi/libiscsi.c 2010-05-18 17:58:43.000000000 -0500
@@ -40,6 +40,9 @@
#define CHECK(a) { context->error_str[0] = 0; rc = a; if (rc) goto leave; }
+/* UGLY, not thread safe :( */
+static int sysfs_initialized = 0;
+
struct libiscsi_context {
char error_str[256];
/* For get_parameter_helper() */
@@ -66,7 +69,10 @@ struct libiscsi_context *libiscsi_init(v
return NULL;
log_init("libiscsi", 1024, libiscsi_log, context);
- sysfs_init();
+ if (!sysfs_initialized) {
+ sysfs_init();
+ sysfs_initialized = 1;
+ }
increase_max_files();
if (idbm_init(NULL)) {
sysfs_cleanup();
@@ -529,6 +535,11 @@ int libiscsi_get_firmware_network_config
{
struct boot_context fw_entry;
+ if (!sysfs_initialized) {
+ sysfs_init();
+ sysfs_initialized = 1;
+ }
+
memset(config, 0, sizeof *config);
memset(&fw_entry, 0, sizeof fw_entry);
if (fw_get_entry(&fw_entry))
@@ -551,6 +562,11 @@ int libiscsi_get_firmware_initiator_name
{
struct boot_context fw_entry;
+ if (!sysfs_initialized) {
+ sysfs_init();
+ sysfs_initialized = 1;
+ }
+
memset(initiatorname, 0, LIBISCSI_VALUE_MAXLEN);
memset(&fw_entry, 0, sizeof fw_entry);
if (fw_get_entry(&fw_entry))

View File

@ -0,0 +1,12 @@
diff -aurp open-iscsi-2.0-872-rc4-bnx2i/usr/netlink.c open-iscsi-2.0-872-rc4-bnx2i.test/usr/netlink.c
--- open-iscsi-2.0-872-rc4-bnx2i/usr/netlink.c 2011-09-20 18:01:34.000000000 -0500
+++ open-iscsi-2.0-872-rc4-bnx2i.test/usr/netlink.c 2011-09-20 18:01:54.000000000 -0500
@@ -185,7 +185,7 @@ kwritev(enum iscsi_uevent_e type, struct
for (i = 1; i < count; i++)
datalen += iovp[i].iov_len;
- nlh->nlmsg_len = NLMSG_ALIGN(datalen);
+ nlh->nlmsg_len = datalen + sizeof(*nlh);
nlh->nlmsg_pid = getpid();
nlh->nlmsg_flags = 0;
nlh->nlmsg_type = type;

View File

@ -1,236 +0,0 @@
diff -aurp open-iscsi-2.0-872-rc1-bnx2i/usr/initiator.c open-iscsi-2.0-872-rc1-bnx2i.work/usr/initiator.c
--- open-iscsi-2.0-872-rc1-bnx2i/usr/initiator.c 2010-05-18 17:58:00.000000000 -0500
+++ open-iscsi-2.0-872-rc1-bnx2i.work/usr/initiator.c 2010-05-18 21:40:44.000000000 -0500
@@ -1096,6 +1096,18 @@ static void iscsi_login_timedout(void *d
}
}
+static void iscsi_uio_poll_login_timedout(void *data)
+{
+ struct queue_task *qtask = data;
+ struct iscsi_conn *conn = qtask->conn;
+ iscsi_session_t *session = conn->session;
+
+ log_debug(3, "timeout waiting for UIO ...\n");
+ mgmt_ipc_write_rsp(qtask, MGMT_IPC_ERR_TRANS_TIMEOUT);
+ conn_delete_timers(conn);
+ __session_destroy(session);
+}
+
static void iscsi_login_redirect(iscsi_conn_t *conn)
{
iscsi_session_t *session = conn->session;
@@ -2049,6 +2061,52 @@ cleanup:
session_conn_shutdown(conn, qtask, err);
}
+static void session_conn_uio_poll(void *data)
+{
+ struct iscsi_conn_context *conn_context = data;
+ iscsi_conn_t *conn = conn_context->conn;
+ struct iscsi_session *session = conn->session;
+ queue_task_t *qtask = conn_context->data;
+ int rc;
+
+ log_debug(4, "retrying uio poll");
+ rc = __set_net_config(session->t, session, &conn->session->nrec.iface);
+ if (rc != 0) {
+ if (rc == -EAGAIN) {
+ conn_context->data = qtask;
+ iscsi_sched_conn_context(conn_context, conn, 2,
+ EV_UIO_POLL);
+ return;
+ } else {
+ log_error("session_conn_uio_poll() "
+ "connection failure [0x%x]", rc);
+ actor_delete(&conn->login_timer);
+ iscsi_login_eh(conn, qtask, MGMT_IPC_ERR_INTERNAL);
+ iscsi_conn_context_put(conn_context);
+ return;
+ }
+ }
+ iscsi_conn_context_put(conn_context);
+
+ actor_delete(&conn->login_timer);
+ log_debug(4, "UIO ready trying connect");
+
+ /* uIP is ready try to connect */
+ if (gettimeofday(&conn->initial_connect_time, NULL))
+ log_error("Could not get initial connect time. If "
+ "login errors iscsid may give up the initial "
+ "login early. You should manually login.");
+
+ conn->state = STATE_XPT_WAIT;
+ if (iscsi_conn_connect(conn, qtask)) {
+ int delay = ISCSI_CONN_ERR_REOPEN_DELAY;
+ log_debug(4, "Waiting %u seconds before trying to reconnect.\n",
+ delay);
+ queue_delayed_reopen(qtask, delay);
+ }
+}
+
+
void iscsi_sched_conn_context(struct iscsi_conn_context *conn_context,
struct iscsi_conn *conn, unsigned long tmo,
int event)
@@ -2085,6 +2143,11 @@ void iscsi_sched_conn_context(struct isc
conn_context);
actor_schedule(&conn_context->actor);
break;
+ case EV_UIO_POLL:
+ actor_new(&conn_context->actor, session_conn_uio_poll,
+ conn_context);
+ actor_schedule(&conn_context->actor);
+ break;
case EV_CONN_LOGOUT_TIMER:
actor_timer(&conn_context->actor, tmo * 1000,
iscsi_logout_timedout, conn_context);
@@ -2150,8 +2213,10 @@ static int session_is_running(node_rec_t
}
static int iface_set_param(struct iscsi_transport *t, struct iface_rec *iface,
- struct iscsi_session *session)
+ queue_task_t *qtask)
{
+ struct iscsi_conn *conn = qtask->conn;
+ struct iscsi_session *session = conn->session;
int rc = 0;
log_debug(3, "setting iface %s, dev %s, set ip %s, hw %s, "
@@ -2170,6 +2235,29 @@ static int iface_set_param(struct iscsi_
}
rc = __set_net_config(t, session, iface);
+ if (rc == -EAGAIN && t->template->set_net_config) {
+ struct iscsi_conn_context *conn_context;
+
+ conn_context = iscsi_conn_context_get(conn, 0);
+ if (!conn_context) {
+ /* while reopening the recv pool should be full */
+ log_error("BUG: __session_conn_reopen could "
+ "not get conn context for recv.");
+ return ENOMEM;
+ }
+ conn_context->data = qtask;
+ conn->state = STATE_XPT_WAIT;
+
+ iscsi_sched_conn_context(conn_context, conn, 0, EV_UIO_POLL);
+
+ log_debug(3, "Setting login UIO poll timer "
+ "%p timeout %d", &conn->login_timer,
+ conn->login_timeout);
+ actor_timer(&conn->login_timer, conn->login_timeout * 1000,
+ iscsi_uio_poll_login_timedout, qtask);
+
+ return EAGAIN;
+ }
if (rc != 0)
return rc;
@@ -2203,6 +2291,7 @@ session_login_task(node_rec_t *rec, queu
iscsi_session_t *session;
iscsi_conn_t *conn;
struct iscsi_transport *t;
+ int rc;
if (session_is_running(rec))
return MGMT_IPC_ERR_EXISTS;
@@ -2276,7 +2365,16 @@ session_login_task(node_rec_t *rec, queu
conn = &session->conn[0];
qtask->conn = conn;
- if (iface_set_param(t, &rec->iface, session)) {
+ rc = iface_set_param(t, &rec->iface, qtask);
+ if (rc == EAGAIN) {
+ /*
+ * Cannot block iscsid, so caller is going to internally
+ * retry the operation.
+ */
+ qtask->rsp.command = MGMT_IPC_SESSION_LOGIN;
+ qtask->rsp.err = MGMT_IPC_OK;
+ return MGMT_IPC_OK;
+ } else if (rc) {
__session_destroy(session);
return MGMT_IPC_ERR_LOGIN_FAILURE;
}
Only in open-iscsi-2.0-872-rc1-bnx2i.work/usr/: initiator.c.orig
diff -aurp open-iscsi-2.0-872-rc1-bnx2i/usr/initiator.h open-iscsi-2.0-872-rc1-bnx2i.work/usr/initiator.h
--- open-iscsi-2.0-872-rc1-bnx2i/usr/initiator.h 2010-05-18 17:58:00.000000000 -0500
+++ open-iscsi-2.0-872-rc1-bnx2i.work/usr/initiator.h 2010-05-18 18:13:12.000000000 -0500
@@ -88,6 +88,7 @@ typedef enum iscsi_event_e {
EV_CONN_ERROR,
EV_CONN_LOGOUT_TIMER,
EV_CONN_STOP,
+ EV_UIO_POLL,
} iscsi_event_e;
struct queue_task;
diff -aurp open-iscsi-2.0-872-rc1-bnx2i/usr/iscsid_req.c open-iscsi-2.0-872-rc1-bnx2i.work/usr/iscsid_req.c
--- open-iscsi-2.0-872-rc1-bnx2i/usr/iscsid_req.c 2010-05-18 17:58:00.000000000 -0500
+++ open-iscsi-2.0-872-rc1-bnx2i.work/usr/iscsid_req.c 2010-05-18 21:16:21.000000000 -0500
@@ -217,6 +217,8 @@ int uip_broadcast(void *buf, size_t buf_
return err;
}
+ log_debug(3, "connected to uIP daemon");
+
/* Send the data to uIP */
if ((err = write(fd, buf, buf_len)) != buf_len) {
log_error("got write error (%d/%d), daemon died?",
@@ -225,6 +227,8 @@ int uip_broadcast(void *buf, size_t buf_
return -EIO;
}
+ log_debug(3, "send iface config to uIP daemon");
+
/* Set the socket to a non-blocking read, this way if there are
* problems waiting for uIP, iscsid can bailout early */
flags = fcntl(fd, F_GETFL, 0);
@@ -243,8 +247,10 @@ int uip_broadcast(void *buf, size_t buf_
/* Wait for the response */
err = read(fd, &rsp, sizeof(rsp));
if (err == sizeof(rsp)) {
- log_debug(3, "Broadcasted to uIP with length: %ld\n",
- buf_len);
+ log_debug(3, "Broadcasted to uIP with length: %ld "
+ "cmd: 0x%x rsp: 0x%x\n", buf_len,
+ rsp.command, rsp.err);
+ err = 0;
break;
} else if((err == -1) && (errno == EAGAIN)) {
usleep(250000);
@@ -256,12 +262,17 @@ int uip_broadcast(void *buf, size_t buf_
}
}
- if(count == MAX_UIP_BROADCAST_READ_TRIES)
- log_error("Could not broadcast to uIP");
+ if (count == MAX_UIP_BROADCAST_READ_TRIES) {
+ log_error("Could not broadcast to uIP after %d tries",
+ count);
+ err = -EAGAIN;
+ } else if (rsp.err != ISCISD_UIP_MGMT_IPC_DEVICE_UP) {
+ log_debug(3, "Device is not ready\n");
+ err = -EAGAIN;
+ }
close(fd);
-
- return 0;
+ return err;
}
void iscsid_handle_error(mgmt_ipc_err_e err)
Only in open-iscsi-2.0-872-rc1-bnx2i.work/usr/: iscsid_req.c.orig
diff -aurp open-iscsi-2.0-872-rc1-bnx2i/usr/uip_mgmt_ipc.h open-iscsi-2.0-872-rc1-bnx2i.work/usr/uip_mgmt_ipc.h
--- open-iscsi-2.0-872-rc1-bnx2i/usr/uip_mgmt_ipc.h 2010-05-18 17:58:00.000000000 -0500
+++ open-iscsi-2.0-872-rc1-bnx2i.work/usr/uip_mgmt_ipc.h 2010-05-18 18:13:12.000000000 -0500
@@ -55,6 +55,8 @@ typedef enum iscsid_uip_mgmt_ipc_err {
ISCISD_UIP_MGMT_IPC_ERR = 1,
ISCISD_UIP_MGMT_IPC_ERR_NOT_FOUND = 2,
ISCISD_UIP_MGMT_IPC_ERR_NOMEM = 3,
+ ISCISD_UIP_MGMT_IPC_DEVICE_UP = 4,
+ ISCISD_UIP_MGMT_IPC_DEVICE_INITIALIZING = 5,
} iscsid_uip_mgmt_ipc_err_e;
/* IPC Response */

View File

@ -0,0 +1,471 @@
diff -Naurp open-iscsi-2.0-872-rc4-bnx2i/include/iscsi_if.h open-iscsi-2.0-872-rc4-bnx2i.work/include/iscsi_if.h
--- open-iscsi-2.0-872-rc4-bnx2i/include/iscsi_if.h 2011-10-10 13:57:38.000000000 -0500
+++ open-iscsi-2.0-872-rc4-bnx2i.work/include/iscsi_if.h 2011-10-11 00:40:49.000000000 -0500
@@ -320,10 +320,11 @@ enum iscsi_net_param {
ISCSI_NET_PARAM_VLAN_ID = 13,
ISCSI_NET_PARAM_VLAN_PRIORITY = 14,
ISCSI_NET_PARAM_VLAN_ENABLED = 15,
- ISCSI_NET_PARAM_IFACE_TYPE = 16,
- ISCSI_NET_PARAM_IFACE_NAME = 17,
- ISCSI_NET_PARAM_MTU = 18,
- ISCSI_NET_PARAM_PORT = 19,
+ ISCSI_NET_PARAM_VLAN_TAG = 16,
+ ISCSI_NET_PARAM_IFACE_TYPE = 17,
+ ISCSI_NET_PARAM_IFACE_NAME = 18,
+ ISCSI_NET_PARAM_MTU = 19,
+ ISCSI_NET_PARAM_PORT = 20,
};
enum iscsi_conn_state {
diff -Naurp open-iscsi-2.0-872-rc4-bnx2i/usr/host.c open-iscsi-2.0-872-rc4-bnx2i.work/usr/host.c
--- open-iscsi-2.0-872-rc4-bnx2i/usr/host.c 2011-10-10 13:57:38.000000000 -0500
+++ open-iscsi-2.0-872-rc4-bnx2i.work/usr/host.c 2011-10-11 00:41:01.000000000 -0500
@@ -132,22 +132,67 @@ static int print_host_iface(void *data,
printf("%sIPaddress: %s\n", prefix, UNKNOWN_VALUE);
else if (strchr(iface->ipaddress, '.')) {
printf("%sIPaddress: %s\n", prefix, iface->ipaddress);
- printf("%sGateway: %s\n", prefix, iface->gateway);
- printf("%sSubnet: %s\n", prefix, iface->subnet_mask);
- printf("%sBootProto: %s\n", prefix, iface->bootproto);
+
+ if (!strlen(iface->gateway))
+ printf("%sGateway: %s\n", prefix, UNKNOWN_VALUE);
+ else
+ printf("%sGateway: %s\n", prefix, iface->gateway);
+ if (!strlen(iface->subnet_mask))
+ printf("%sSubnet: %s\n", prefix, UNKNOWN_VALUE);
+ else
+ printf("%sSubnet: %s\n", prefix, iface->subnet_mask);
+ if (!strlen(iface->bootproto))
+ printf("%sBootProto: %s\n", prefix, UNKNOWN_VALUE);
+ else
+ printf("%sBootProto: %s\n", prefix, iface->bootproto);
} else {
printf("%sIPaddress: [%s]\n", prefix, iface->ipaddress);
- printf("%sIPaddress Autocfg: %s\n", prefix, iface->ipv6_autocfg);
- printf("%sLink Local Address: [%s]\n", prefix,
- iface->ipv6_linklocal);
- printf("%sLink Local Autocfg: %s\n", prefix,
- iface->linklocal_autocfg);
- printf("%sRouter Address: [%s]\n", prefix, iface->ipv6_router);
+
+ if (!strlen(iface->ipv6_autocfg))
+ printf("%sIPaddress Autocfg: %s\n", prefix,
+ UNKNOWN_VALUE);
+ else
+ printf("%sIPaddress Autocfg: %s\n", prefix,
+ iface->ipv6_autocfg);
+ if (!strlen(iface->ipv6_linklocal))
+ printf("%sLink Local Address: %s\n", prefix,
+ UNKNOWN_VALUE);
+ else
+ printf("%sLink Local Address: [%s]\n", prefix,
+ iface->ipv6_linklocal);
+ if (!strlen(iface->linklocal_autocfg))
+ printf("%sLink Local Autocfg: %s\n", prefix,
+ UNKNOWN_VALUE);
+ else
+ printf("%sLink Local Autocfg: %s\n", prefix,
+ iface->linklocal_autocfg);
+ if (!strlen(iface->ipv6_router))
+ printf("%sRouter Address: %s\n", prefix,
+ UNKNOWN_VALUE);
+ else
+ printf("%sRouter Address: [%s]\n", prefix,
+ iface->ipv6_router);
}
- printf("%sMTU: %u\n", prefix, iface->mtu);
- printf("%svlan ID: %u\n", prefix, iface->vlan_id);
- printf("%svlan priority: %u\n", prefix, iface->vlan_priority);
+ if (!iface->port)
+ printf("%sPort: %s\n", prefix, UNKNOWN_VALUE);
+ else
+ printf("%sPort: %u\n", prefix, iface->port);
+
+ if (!iface->mtu)
+ printf("%sMTU: %s\n", prefix, UNKNOWN_VALUE);
+ else
+ printf("%sMTU: %u\n", prefix, iface->mtu);
+
+ if (iface->vlan_id == UINT16_MAX)
+ printf("%sVLAN ID: %s\n", prefix, UNKNOWN_VALUE);
+ else
+ printf("%sVLAN ID: %u\n", prefix, iface->vlan_id);
+
+ if (iface->vlan_priority == UINT8_MAX)
+ printf("%sVLAN priority: %s\n", prefix, UNKNOWN_VALUE);
+ else
+ printf("%sVLAN priority: %u\n", prefix, iface->vlan_priority);
return 0;
}
diff -Naurp open-iscsi-2.0-872-rc4-bnx2i/usr/iface.c open-iscsi-2.0-872-rc4-bnx2i.work/usr/iface.c
--- open-iscsi-2.0-872-rc4-bnx2i/usr/iface.c 2011-10-10 13:57:38.000000000 -0500
+++ open-iscsi-2.0-872-rc4-bnx2i.work/usr/iface.c 2011-10-11 00:40:49.000000000 -0500
@@ -41,6 +41,7 @@
#include "fw_context.h"
#include "sysdeps.h"
#include "iscsi_err.h"
+#include "iscsi_netlink.h"
/*
* Default ifaces for use with transports that do not bind to hardware
@@ -1141,14 +1142,16 @@ static int iface_fill_port(struct iovec
int len;
struct iscsi_iface_param_info *net_param;
uint16_t port = 3260;
+ struct nlattr *attr;
- len = sizeof(struct iscsi_iface_param_info) + 2;
- iov->iov_base = calloc(len, sizeof(char));
- if (!(iov->iov_base))
+ len = sizeof(struct iscsi_iface_param_info) + sizeof(port);
+ iov->iov_base = iscsi_nla_alloc(ISCSI_NET_PARAM_PORT, len);
+ if (!iov->iov_base)
return 1;
+ attr = iov->iov_base;
+ iov->iov_len = NLA_ALIGN(attr->nla_len);
- iov->iov_len = len;
- net_param = (struct iscsi_iface_param_info *)(iov->iov_base);
+ net_param = (struct iscsi_iface_param_info *)ISCSI_NLA_DATA(attr);
net_param->param = ISCSI_NET_PARAM_PORT;
net_param->iface_type = iface_type;
net_param->iface_num = iface->iface_num;
@@ -1166,14 +1169,16 @@ static int iface_fill_mtu(struct iovec *
int len;
struct iscsi_iface_param_info *net_param;
uint16_t mtu = 0;
+ struct nlattr *attr;
len = sizeof(struct iscsi_iface_param_info) + 2;
- iov->iov_base = calloc(len, sizeof(char));
+ iov->iov_base = iscsi_nla_alloc(ISCSI_NET_PARAM_MTU, len);
if (!(iov->iov_base))
return 1;
+ attr = iov->iov_base;
+ iov->iov_len = NLA_ALIGN(attr->nla_len);
- iov->iov_len = len;
- net_param = (struct iscsi_iface_param_info *)(iov->iov_base);
+ net_param = (struct iscsi_iface_param_info *)ISCSI_NLA_DATA(attr);
net_param->param = ISCSI_NET_PARAM_MTU;
net_param->iface_type = iface_type;
net_param->iface_num = iface->iface_num;
@@ -1191,15 +1196,17 @@ static int iface_fill_vlan_id(struct iov
int len;
struct iscsi_iface_param_info *net_param;
uint16_t vlan = 0;
+ struct nlattr *attr;
len = sizeof(struct iscsi_iface_param_info) + 2;
- iov->iov_base = calloc(len, sizeof(char));
+ iov->iov_base = iscsi_nla_alloc(ISCSI_NET_PARAM_VLAN_TAG, len);
if (!(iov->iov_base))
return 1;
- iov->iov_len = len;
- net_param = (struct iscsi_iface_param_info *)(iov->iov_base);
- net_param->param = ISCSI_NET_PARAM_VLAN_ID;
+ attr = iov->iov_base;
+ iov->iov_len = NLA_ALIGN(attr->nla_len);
+ net_param = (struct iscsi_iface_param_info *)ISCSI_NLA_DATA(attr);
+ net_param->param = ISCSI_NET_PARAM_VLAN_TAG;
net_param->iface_type = iface_type;
net_param->iface_num = iface->iface_num;
net_param->param_type = ISCSI_NET_PARAM;
@@ -1222,14 +1229,16 @@ static int iface_fill_vlan_state(struct
{
int len;
struct iscsi_iface_param_info *net_param;
+ struct nlattr *attr;
len = sizeof(struct iscsi_iface_param_info) + 1;
- iov->iov_base = calloc(len, sizeof(char));
+ iov->iov_base = iscsi_nla_alloc(ISCSI_NET_PARAM_VLAN_ENABLED, len);
if (!(iov->iov_base))
return 1;
- iov->iov_len = len;
- net_param = (struct iscsi_iface_param_info *)(iov->iov_base);
+ attr = iov->iov_base;
+ iov->iov_len = NLA_ALIGN(attr->nla_len);
+ net_param = (struct iscsi_iface_param_info *)ISCSI_NLA_DATA(attr);
net_param->param = ISCSI_NET_PARAM_VLAN_ENABLED;
net_param->iface_type = iface_type;
net_param->iface_num = iface->iface_num;
@@ -1248,14 +1257,16 @@ static int iface_fill_net_state(struct i
{
int len;
struct iscsi_iface_param_info *net_param;
+ struct nlattr *attr;
len = sizeof(struct iscsi_iface_param_info) + 1;
- iov->iov_base = calloc(len, sizeof(char));
+ iov->iov_base = iscsi_nla_alloc(ISCSI_NET_PARAM_IFACE_ENABLE, len);
if (!(iov->iov_base))
return 1;
- iov->iov_len = len;
- net_param = (struct iscsi_iface_param_info *)(iov->iov_base);
+ attr = iov->iov_base;
+ iov->iov_len = NLA_ALIGN(attr->nla_len);
+ net_param = (struct iscsi_iface_param_info *)ISCSI_NLA_DATA(attr);
net_param->param = ISCSI_NET_PARAM_IFACE_ENABLE;
net_param->iface_type = iface_type;
net_param->iface_num = iface->iface_num;
@@ -1273,14 +1284,16 @@ static int iface_fill_net_bootproto(stru
{
int len;
struct iscsi_iface_param_info *net_param;
+ struct nlattr *attr;
len = sizeof(struct iscsi_iface_param_info) + 1;
- iov->iov_base = calloc(len, sizeof(char));
+ iov->iov_base = iscsi_nla_alloc(ISCSI_NET_PARAM_IPV4_BOOTPROTO, len);
if (!(iov->iov_base))
return 1;
- iov->iov_len = len;
- net_param = (struct iscsi_iface_param_info *)(iov->iov_base);
+ attr = iov->iov_base;
+ iov->iov_len = NLA_ALIGN(attr->nla_len);
+ net_param = (struct iscsi_iface_param_info *)ISCSI_NLA_DATA(attr);
net_param->param = ISCSI_NET_PARAM_IPV4_BOOTPROTO;
net_param->iface_type = ISCSI_IFACE_TYPE_IPV4;
net_param->iface_num = iface->iface_num;
@@ -1298,14 +1311,16 @@ static int iface_fill_net_autocfg(struct
{
int len;
struct iscsi_iface_param_info *net_param;
+ struct nlattr *attr;
len = sizeof(struct iscsi_iface_param_info) + 1;
- iov->iov_base = calloc(len, sizeof(char));
+ iov->iov_base = iscsi_nla_alloc(ISCSI_NET_PARAM_IPV6_ADDR_AUTOCFG, len);
if (!(iov->iov_base))
return 1;
- iov->iov_len = len;
- net_param = (struct iscsi_iface_param_info *)(iov->iov_base);
+ attr = iov->iov_base;
+ iov->iov_len = NLA_ALIGN(attr->nla_len);
+ net_param = (struct iscsi_iface_param_info *)ISCSI_NLA_DATA(attr);
net_param->param = ISCSI_NET_PARAM_IPV6_ADDR_AUTOCFG;
net_param->iface_type = ISCSI_IFACE_TYPE_IPV6;
net_param->param_type = ISCSI_NET_PARAM;
@@ -1327,14 +1342,17 @@ static int iface_fill_linklocal_autocfg(
{
int len;
struct iscsi_iface_param_info *net_param;
+ struct nlattr *attr;
len = sizeof(struct iscsi_iface_param_info) + 1;
- iov->iov_base = calloc(len, sizeof(char));
+ iov->iov_base = iscsi_nla_alloc(ISCSI_NET_PARAM_IPV6_LINKLOCAL_AUTOCFG,
+ len);
if (!(iov->iov_base))
return 1;
- iov->iov_len = len;
- net_param = (struct iscsi_iface_param_info *)(iov->iov_base);
+ attr = iov->iov_base;
+ iov->iov_len = NLA_ALIGN(attr->nla_len);
+ net_param = (struct iscsi_iface_param_info *)ISCSI_NLA_DATA(attr);
net_param->param = ISCSI_NET_PARAM_IPV6_LINKLOCAL_AUTOCFG;
net_param->iface_type = ISCSI_IFACE_TYPE_IPV6;
net_param->param_type = ISCSI_NET_PARAM;
@@ -1353,14 +1371,17 @@ static int iface_fill_router_autocfg(str
{
int len;
struct iscsi_iface_param_info *net_param;
+ struct nlattr *attr;
len = sizeof(struct iscsi_iface_param_info) + 1;
- iov->iov_base = calloc(len, sizeof(char));
+ iov->iov_base = iscsi_nla_alloc(ISCSI_NET_PARAM_IPV6_ROUTER_AUTOCFG,
+ len);
if (!(iov->iov_base))
return 1;
- iov->iov_len = len;
- net_param = (struct iscsi_iface_param_info *)(iov->iov_base);
+ attr = iov->iov_base;
+ iov->iov_len = NLA_ALIGN(attr->nla_len);
+ net_param = (struct iscsi_iface_param_info *)ISCSI_NLA_DATA(attr);
net_param->param = ISCSI_NET_PARAM_IPV6_ROUTER_AUTOCFG;
net_param->iface_type = ISCSI_IFACE_TYPE_IPV6;
net_param->param_type = ISCSI_NET_PARAM;
@@ -1381,14 +1402,16 @@ static int iface_fill_net_ipv4_addr(stru
int rc = 1;
int len;
struct iscsi_iface_param_info *net_param;
+ struct nlattr *attr;
len = sizeof(struct iscsi_iface_param_info) + 4;
- iov->iov_base = calloc(len, sizeof(char));
+ iov->iov_base = iscsi_nla_alloc(param, len);
if (!(iov->iov_base))
return 1;
- iov->iov_len = len;
- net_param = (struct iscsi_iface_param_info *)(iov->iov_base);
+ attr = iov->iov_base;
+ iov->iov_len = NLA_ALIGN(attr->nla_len);
+ net_param = (struct iscsi_iface_param_info *)ISCSI_NLA_DATA(attr);
net_param->param = param;
net_param->iface_type = ISCSI_IFACE_TYPE_IPV4;
net_param->iface_num = iface->iface_num;
@@ -1435,14 +1458,16 @@ static int iface_fill_net_ipv6_addr(stru
int rc;
int len;
struct iscsi_iface_param_info *net_param;
+ struct nlattr *attr;
len = sizeof(struct iscsi_iface_param_info) + 16;
- iov->iov_base = calloc(len, sizeof(char));
+ iov->iov_base = iscsi_nla_alloc(param, len);
if (!(iov->iov_base))
return 1;
- iov->iov_len = len;
- net_param = (struct iscsi_iface_param_info *)(iov->iov_base);
+ attr = iov->iov_base;
+ iov->iov_len = NLA_ALIGN(attr->nla_len);
+ net_param = (struct iscsi_iface_param_info *)ISCSI_NLA_DATA(attr);
net_param->param = param;
net_param->iface_type = ISCSI_IFACE_TYPE_IPV6;
net_param->iface_num = iface->iface_num;
diff -Naurp open-iscsi-2.0-872-rc4-bnx2i/usr/initiator.c open-iscsi-2.0-872-rc4-bnx2i.work/usr/initiator.c
--- open-iscsi-2.0-872-rc4-bnx2i/usr/initiator.c 2011-10-10 13:57:38.000000000 -0500
+++ open-iscsi-2.0-872-rc4-bnx2i.work/usr/initiator.c 2011-10-11 00:39:57.000000000 -0500
@@ -1682,9 +1682,10 @@ static void session_conn_process_login(v
session->nrec.conn[conn->id].address,
session->nrec.conn[conn->id].port,
session->nrec.iface.name);
- } else
+ } else {
session->notify_qtask = NULL;
-
+ mgmt_ipc_write_rsp(c->qtask, ISCSI_SUCCESS);
+ }
/*
* reset ERL=0 reopen counter
diff -Naurp open-iscsi-2.0-872-rc4-bnx2i/usr/iscsi_netlink.h open-iscsi-2.0-872-rc4-bnx2i.work/usr/iscsi_netlink.h
--- open-iscsi-2.0-872-rc4-bnx2i/usr/iscsi_netlink.h 1969-12-31 18:00:00.000000000 -0600
+++ open-iscsi-2.0-872-rc4-bnx2i.work/usr/iscsi_netlink.h 2011-10-11 00:40:34.000000000 -0500
@@ -0,0 +1,33 @@
+/*
+ * iSCSI Netlink attr helpers
+ *
+ * Copyright (C) 2011 Red Hat, Inc. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * See the file COPYING included with this distribution for more details.
+ */
+
+#ifndef ISCSI_NLA_H
+#define ISCSI_NLA_H
+
+#include <linux/netlink.h>
+
+struct iovec;
+
+#define ISCSI_NLA_HDRLEN ((int) NLA_ALIGN(sizeof(struct nlattr)))
+#define ISCSI_NLA_DATA(nla) ((void *)((char*)(nla) + ISCSI_NLA_HDRLEN))
+#define ISCSI_NLA_LEN(len) ((len) + NLA_ALIGN(ISCSI_NLA_HDRLEN))
+#define ISCSI_NLA_TOTAL_LEN(len) (NLA_ALIGN(ISCSI_NLA_LEN(len)))
+
+extern struct nlattr *iscsi_nla_alloc(uint16_t type, uint16_t len);
+
+#endif
diff -Naurp open-iscsi-2.0-872-rc4-bnx2i/usr/iscsi_sysfs.c open-iscsi-2.0-872-rc4-bnx2i.work/usr/iscsi_sysfs.c
--- open-iscsi-2.0-872-rc4-bnx2i/usr/iscsi_sysfs.c 2011-10-10 13:57:38.000000000 -0500
+++ open-iscsi-2.0-872-rc4-bnx2i.work/usr/iscsi_sysfs.c 2011-10-11 00:41:01.000000000 -0500
@@ -561,28 +561,28 @@ static int iscsi_sysfs_read_iface(struct
"link_local_addr", iface->ipv6_linklocal,
sizeof(iface->ipv6_linklocal));
- if (sysfs_get_str(iface_kern_id, ISCSI_IFACE_SUBSYS,
- "linklocal_autocfg",
- iface->linklocal_autocfg,
- sizeof(iface->linklocal_autocfg))) {
- /* misspelled in some test kernels */
- sysfs_get_str(iface_kern_id, ISCSI_IFACE_SUBSYS,
- "link_local_autocfg",
- iface->linklocal_autocfg,
- sizeof(iface->linklocal_autocfg));
- }
+ sysfs_get_str(iface_kern_id, ISCSI_IFACE_SUBSYS,
+ "link_local_autocfg", iface->linklocal_autocfg,
+ sizeof(iface->linklocal_autocfg));
sysfs_get_str(iface_kern_id, ISCSI_IFACE_SUBSYS, "router_addr",
iface->ipv6_router,
sizeof(iface->ipv6_router));
}
- sysfs_get_uint16(iface_kern_id, ISCSI_IFACE_SUBSYS, "mtu",
- &iface->mtu);
- sysfs_get_uint16(iface_kern_id, ISCSI_IFACE_SUBSYS, "vlan",
- &iface->vlan_id);
- sysfs_get_uint8(iface_kern_id, ISCSI_IFACE_SUBSYS, "vlan_priority",
- &iface->vlan_priority);
+ if (sysfs_get_uint16(iface_kern_id, ISCSI_IFACE_SUBSYS, "port",
+ &iface->port))
+ iface->port = 0;
+ if (sysfs_get_uint16(iface_kern_id, ISCSI_IFACE_SUBSYS, "mtu",
+ &iface->mtu))
+ iface->mtu = 0;
+ if (sysfs_get_uint16(iface_kern_id, ISCSI_IFACE_SUBSYS, "vlan_id",
+ &iface->vlan_id))
+ iface->vlan_id = UINT16_MAX;
+
+ if (sysfs_get_uint8(iface_kern_id, ISCSI_IFACE_SUBSYS, "vlan_priority",
+ &iface->vlan_priority))
+ iface->vlan_priority = UINT8_MAX;
if (sscanf(iface_kern_id, "ipv%d-iface-%u-%u", &iface_type,
&tmp_host_no, &iface_num) == 3)
diff -Naurp open-iscsi-2.0-872-rc4-bnx2i/usr/netlink.c open-iscsi-2.0-872-rc4-bnx2i.work/usr/netlink.c
--- open-iscsi-2.0-872-rc4-bnx2i/usr/netlink.c 2011-10-10 13:57:38.000000000 -0500
+++ open-iscsi-2.0-872-rc4-bnx2i.work/usr/netlink.c 2011-10-11 00:40:34.000000000 -0500
@@ -38,6 +38,7 @@
#include "initiator.h"
#include "iscsi_sysfs.h"
#include "transport.h"
+#include "iscsi_netlink.h"
static int ctrl_fd;
static struct sockaddr_nl src_addr, dest_addr;
@@ -63,6 +64,19 @@ static int ctldev_handle(void);
#define NLM_SETPARAM_DEFAULT_MAX (NI_MAXHOST + 1 + sizeof(struct iscsi_uevent))
+struct nlattr *iscsi_nla_alloc(uint16_t type, uint16_t len)
+{
+ struct nlattr *attr;
+
+ attr = calloc(1, ISCSI_NLA_TOTAL_LEN(len));
+ if (!attr)
+ return NULL;
+
+ attr->nla_len = ISCSI_NLA_LEN(len);
+ attr->nla_type = type;
+ return attr;
+}
+
static int
kread(char *data, int count)
{

View File

@ -0,0 +1,46 @@
diff -aurp open-iscsi-2.0-872-rc4-bnx2i/usr/iface.c open-iscsi-2.0-872-rc4-bnx2i.test/usr/iface.c
--- open-iscsi-2.0-872-rc4-bnx2i/usr/iface.c 2011-09-08 15:26:45.000000000 -0500
+++ open-iscsi-2.0-872-rc4-bnx2i.test/usr/iface.c 2011-09-08 15:31:32.000000000 -0500
@@ -829,6 +829,7 @@ int iface_setup_from_boot_context(struct
{
struct iscsi_transport *t;
uint32_t hostno;
+ int rc;
if (strlen(context->initiatorname))
strlcpy(iface->iname, context->initiatorname,
@@ -841,8 +842,6 @@ int iface_setup_from_boot_context(struct
return 0;
}
} else if (strlen(context->iface)) {
-/* this ifdef is only temp until distros and firmwares are updated */
-#ifdef OFFLOAD_BOOT_SUPPORTED
hostno = iscsi_sysfs_get_host_no_from_hwaddress(context->mac,
&rc);
if (rc) {
@@ -857,9 +856,6 @@ int iface_setup_from_boot_context(struct
}
strlcpy(iface->netdev, context->iface, sizeof(iface->netdev));
-#else
- return 0;
-#endif
} else
return 0;
diff -aurp open-iscsi-2.0-872-rc4-bnx2i/usr/iscsi_net_util.c open-iscsi-2.0-872-rc4-bnx2i.test/usr/iscsi_net_util.c
--- open-iscsi-2.0-872-rc4-bnx2i/usr/iscsi_net_util.c 2011-09-08 15:27:24.000000000 -0500
+++ open-iscsi-2.0-872-rc4-bnx2i.test/usr/iscsi_net_util.c 2011-09-08 15:26:50.000000000 -0500
@@ -39,12 +39,10 @@ struct iscsi_net_driver {
};
static struct iscsi_net_driver net_drivers[] = {
-#ifdef OFFLOAD_BOOT_SUPPORTED
{"cxgb3", "cxgb3i" },
{"cxgb4", "cxgb4i" },
{"bnx2", "bnx2i" },
{"bnx2x", "bnx2i"},
-#endif
{NULL, NULL}
};

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,371 @@
diff -aurp open-iscsi-2.0-872-rc4-bnx2i/iscsiuio/configure open-iscsi-2.0-872-rc4-bnx2i.build/iscsiuio/configure
--- open-iscsi-2.0-872-rc4-bnx2i/iscsiuio/configure 2011-09-01 20:28:53.000000000 -0500
+++ open-iscsi-2.0-872-rc4-bnx2i.build/iscsiuio/configure 2011-09-01 20:33:58.000000000 -0500
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.59 for iscsiuio 0.7.0.12.
+# Generated by GNU Autoconf 2.59 for iscsiuio 0.7.0.14.
#
# Report bugs to <eddie.wai@broadcom.com>.
#
@@ -423,8 +423,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='iscsiuio'
PACKAGE_TARNAME='iscsiuio'
-PACKAGE_VERSION='0.7.0.12'
-PACKAGE_STRING='iscsiuio 0.7.0.12'
+PACKAGE_VERSION='0.7.0.14'
+PACKAGE_STRING='iscsiuio 0.7.0.14'
PACKAGE_BUGREPORT='eddie.wai@broadcom.com'
# Factoring default headers for most tests.
@@ -954,7 +954,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures iscsiuio 0.7.0.12 to adapt to many kinds of systems.
+\`configure' configures iscsiuio 0.7.0.14 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1020,7 +1020,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of iscsiuio 0.7.0.12:";;
+ short | recursive ) echo "Configuration of iscsiuio 0.7.0.14:";;
esac
cat <<\_ACEOF
@@ -1161,7 +1161,7 @@ fi
test -n "$ac_init_help" && exit 0
if $ac_init_version; then
cat <<\_ACEOF
-iscsiuio configure 0.7.0.12
+iscsiuio configure 0.7.0.14
generated by GNU Autoconf 2.59
Copyright (C) 2003 Free Software Foundation, Inc.
@@ -1175,7 +1175,7 @@ cat >&5 <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by iscsiuio $as_me 0.7.0.12, which was
+It was created by iscsiuio $as_me 0.7.0.14, which was
generated by GNU Autoconf 2.59. Invocation command line was
$ $0 $@
@@ -21726,7 +21726,7 @@ _ASBOX
} >&5
cat >&5 <<_CSEOF
-This file was extended by iscsiuio $as_me 0.7.0.12, which was
+This file was extended by iscsiuio $as_me 0.7.0.14, which was
generated by GNU Autoconf 2.59. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -21789,7 +21789,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
-iscsiuio config.status 0.7.0.12
+iscsiuio config.status 0.7.0.14
configured by $0, generated by GNU Autoconf 2.59,
with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
diff -aurp open-iscsi-2.0-872-rc4-bnx2i/iscsiuio/configure.ac open-iscsi-2.0-872-rc4-bnx2i.build/iscsiuio/configure.ac
--- open-iscsi-2.0-872-rc4-bnx2i/iscsiuio/configure.ac 2011-09-01 20:28:53.000000000 -0500
+++ open-iscsi-2.0-872-rc4-bnx2i.build/iscsiuio/configure.ac 2011-09-01 20:33:58.000000000 -0500
@@ -11,9 +11,9 @@ dnl Maintained by: Eddie Wai (eddie.wai@
dnl
PACKAGE=iscsiuio
-VERSION=0.7.0.12
+VERSION=0.7.0.14
-AC_INIT(iscsiuio, 0.7.0.12, eddie.wai@broadcom.com)
+AC_INIT(iscsiuio, 0.7.0.14, eddie.wai@broadcom.com)
AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
AC_CONFIG_HEADER(config.h)
diff -aurp open-iscsi-2.0-872-rc4-bnx2i/iscsiuio/docs/iscsiuio.8 open-iscsi-2.0-872-rc4-bnx2i.build/iscsiuio/docs/iscsiuio.8
--- open-iscsi-2.0-872-rc4-bnx2i/iscsiuio/docs/iscsiuio.8 2011-09-01 20:28:53.000000000 -0500
+++ open-iscsi-2.0-872-rc4-bnx2i.build/iscsiuio/docs/iscsiuio.8 2011-09-01 20:33:58.000000000 -0500
@@ -3,9 +3,9 @@
.\" modify it under the terms of the GNU General Public License as
.\" published by the Free Software Foundation.
.\"
-.\" bnx2.4,v 0.7.0.12
+.\" bnx2.4,v 0.7.0.14
.\"
-.TH iscsiuio 8 "08/04/2011" "Broadcom Corporation"
+.TH iscsiuio 8 "08/23/2011" "Broadcom Corporation"
.\"
.\" NAME part
.\"
diff -aurp open-iscsi-2.0-872-rc4-bnx2i/iscsiuio/include/uip_mgmt_ipc.h open-iscsi-2.0-872-rc4-bnx2i.build/iscsiuio/include/uip_mgmt_ipc.h
--- open-iscsi-2.0-872-rc4-bnx2i/iscsiuio/include/uip_mgmt_ipc.h 2011-09-01 20:28:53.000000000 -0500
+++ open-iscsi-2.0-872-rc4-bnx2i.build/iscsiuio/include/uip_mgmt_ipc.h 2011-09-01 20:33:47.000000000 -0500
@@ -50,11 +50,11 @@ typedef struct iscsid_uip_broadcast {
typedef enum iscsid_uip_mgmt_ipc_err {
ISCSID_UIP_MGMT_IPC_OK = 0,
- ISCISD_UIP_MGMT_IPC_ERR = 1,
- ISCISD_UIP_MGMT_IPC_ERR_NOT_FOUND = 2,
- ISCISD_UIP_MGMT_IPC_ERR_NOMEM = 3,
- ISCISD_UIP_MGMT_IPC_DEVICE_UP = 4,
- ISCISD_UIP_MGMT_IPC_DEVICE_INITIALIZING = 5,
+ ISCSID_UIP_MGMT_IPC_ERR = 1,
+ ISCSID_UIP_MGMT_IPC_ERR_NOT_FOUND = 2,
+ ISCSID_UIP_MGMT_IPC_ERR_NOMEM = 3,
+ ISCSID_UIP_MGMT_IPC_DEVICE_UP = 4,
+ ISCSID_UIP_MGMT_IPC_DEVICE_INITIALIZING = 5,
} iscsid_uip_mgmt_ipc_err_e;
/* IPC Response */
diff -aurp open-iscsi-2.0-872-rc4-bnx2i/iscsiuio/README open-iscsi-2.0-872-rc4-bnx2i.build/iscsiuio/README
--- open-iscsi-2.0-872-rc4-bnx2i/iscsiuio/README 2011-09-01 20:28:53.000000000 -0500
+++ open-iscsi-2.0-872-rc4-bnx2i.build/iscsiuio/README 2011-09-01 20:33:58.000000000 -0500
@@ -1,6 +1,6 @@
-Broadcom iSCSI Userspace Tools
-Version 0.7.0.12
-Aug 04, 2011
+iscsiuio Userspace Tools
+Version 0.7.0.14
+Aug 23, 2011
------------------------------------------------------
This tools is to be used in conjunction with the Broadcom NetXtreme II Linux
diff -aurp open-iscsi-2.0-872-rc4-bnx2i/iscsiuio/RELEASE.TXT open-iscsi-2.0-872-rc4-bnx2i.build/iscsiuio/RELEASE.TXT
--- open-iscsi-2.0-872-rc4-bnx2i/iscsiuio/RELEASE.TXT 2011-09-01 20:28:53.000000000 -0500
+++ open-iscsi-2.0-872-rc4-bnx2i.build/iscsiuio/RELEASE.TXT 2011-09-01 20:33:58.000000000 -0500
@@ -1,7 +1,7 @@
Release Notes
Broadcom uIP Linux Driver
- Version 0.7.0.12
- 08/04/2011
+ Version 0.7.0.14
+ 08/23/2011
Broadcom Corporation
5300 California Avenue,
@@ -10,6 +10,36 @@
Copyright (c) 2004 - 2011 Broadcom Corporation
All rights reserved
+uIP v0.7.0.14 (Aug 23, 2011)
+=======================================================
+ Fixes
+ -----
+ 1. Problem: Cont00057840 - RHEL6.2 inbox: Unable to connect to
+ targets with 5709
+ Cause: For cases when the bnx2/bnx2x driver gets removed, the
+ uio database that was built by cnic would have the device
+ ->net reference removed. This has caused an unnecessary
+ timeout of 5s for each stale uio entry in the database.
+ Change: Adjusted the routine which seeks the device->net entry
+ to include more logic instead of hard waiting for 5s.
+
+ Enhancements
+ ------------
+ 1. Change: Added support for RHEL6.2 for out-of-box release
+ 2. Change: Updated the man page with -h and -p info
+ 3. Change: Updated the -h info
+
+
+uIP v0.7.0.13 (Aug 10, 2011)
+=======================================================
+ Fixes
+ -----
+ 1. Problem: Cont00057768 - iscsiuio logrotate causes daemon failure
+ Cause: The logrotate script will send a SIGUSR1 signal to notify
+ the iscsiuio daemon of such action. However, the daemon
+ wasn't programmed to catch this signal.
+ Change: Restored the catching of this signal
+
uIP v0.7.0.12 (Aug 04, 2011)
=======================================================
diff -aurp open-iscsi-2.0-872-rc4-bnx2i/iscsiuio/src/unix/iscsid_ipc.c open-iscsi-2.0-872-rc4-bnx2i.build/iscsiuio/src/unix/iscsid_ipc.c
--- open-iscsi-2.0-872-rc4-bnx2i/iscsiuio/src/unix/iscsid_ipc.c 2011-09-01 20:28:53.000000000 -0500
+++ open-iscsi-2.0-872-rc4-bnx2i.build/iscsiuio/src/unix/iscsid_ipc.c 2011-09-01 20:33:53.000000000 -0500
@@ -217,18 +217,23 @@ static int parse_iface(void *arg)
struct in_addr netmask;
int i, prefix_len = 64;
struct ip_addr_mask ipam;
+ struct iface_rec *rec;
data = (iscsid_uip_broadcast_t *) arg;
+ rec = &data->u.iface_rec.rec;
LOG_INFO(PFX "Received request for '%s' to set IP address: '%s' "
- "VLAN: '%d'",
- data->u.iface_rec.rec.netdev,
- data->u.iface_rec.rec.ipaddress, data->u.iface_rec.rec.vlan_id);
+ "VLAN: '%d'", rec->netdev, rec->ipaddress, rec->vlan_id);
- vlan = data->u.iface_rec.rec.vlan_id;
+ vlan = rec->vlan_id;
+ if (vlan && valid_vlan(vlan) == 0) {
+ LOG_ERR(PFX "Invalid VLAN tag: %d", rec->vlan_id);
+ rc = -EIO;
+ goto early_exit;
+ }
/* Detect for CIDR notation and strip off the netmask if present */
- rc = decode_cidr(data->u.iface_rec.rec.ipaddress, &ipam, &prefix_len);
+ rc = decode_cidr(rec->ipaddress, &ipam, &prefix_len);
if (rc && !ipam.ip_type) {
LOG_ERR(PFX "decode_cidr: rc=%d, ipam.ip_type=%d",
rc, ipam.ip_type)
@@ -251,30 +256,29 @@ static int parse_iface(void *arg)
if (i >= 10) {
LOG_WARN(PFX "Could not aquire nic_list_mutex lock");
-
rc = -EIO;
goto early_exit;
}
/* Check if we can find the NIC device using the netdev
* name */
- rc = from_netdev_name_find_nic(data->u.iface_rec.rec.netdev, &nic);
+ rc = from_netdev_name_find_nic(rec->netdev, &nic);
if (rc != 0) {
LOG_WARN(PFX "Couldn't find NIC: %s, creating an instance",
- data->u.iface_rec.rec.netdev);
+ rec->netdev);
nic = nic_init();
if (nic == NULL) {
LOG_ERR(PFX "Couldn't allocate space for NIC %s",
- data->u.iface_rec.rec.netdev);
+ rec->netdev);
rc = -ENOMEM;
goto done;
}
strncpy(nic->eth_device_name,
- data->u.iface_rec.rec.netdev,
+ rec->netdev,
sizeof(nic->eth_device_name));
nic->config_device_name = nic->eth_device_name;
nic->log_name = nic->eth_device_name;
@@ -288,7 +292,7 @@ static int parse_iface(void *arg)
nic_add(nic);
} else {
LOG_INFO(PFX " %s, using existing NIC",
- data->u.iface_rec.rec.netdev);
+ rec->netdev);
}
if (nic->flags & NIC_GOING_DOWN) {
@@ -335,12 +339,12 @@ static int parse_iface(void *arg)
&transport_name_size);
if (strncmp(transport_name,
- data->u.iface_rec.rec.transport_name,
+ rec->transport_name,
transport_name_size) != 0) {
LOG_ERR(PFX "%s Transport name is not equal "
"expected: %s got: %s",
nic->log_name,
- data->u.iface_rec.rec.transport_name,
+ rec->transport_name,
transport_name);
}
} else {
@@ -548,11 +552,10 @@ enable_nic:
LOG_INFO(PFX "ISCSID_UIP_IPC_GET_IFACE: command: %x "
"name: %s, netdev: %s ipaddr: %s vlan: %d transport_name:%s",
- data->header.command, data->u.iface_rec.rec.name,
- data->u.iface_rec.rec.netdev,
- (ipam.ip_type ==
- AF_INET) ? inet_ntoa(ipam.addr4) : ipv6_buf_str, vlan,
- data->u.iface_rec.rec.transport_name);
+ data->header.command, rec->name, rec->netdev,
+ (ipam.ip_type == AF_INET) ? inet_ntoa(ipam.addr4) :
+ ipv6_buf_str,
+ vlan, rec->transport_name);
done:
pthread_mutex_unlock(&nic_list_mutex);
@@ -617,15 +620,15 @@ int process_iscsid_broadcast(int s2)
switch (rc) {
case 0:
rsp.command = cmd;
- rsp.err = ISCISD_UIP_MGMT_IPC_DEVICE_UP;
+ rsp.err = ISCSID_UIP_MGMT_IPC_DEVICE_UP;
break;
case -EAGAIN:
rsp.command = cmd;
- rsp.err = ISCISD_UIP_MGMT_IPC_DEVICE_INITIALIZING;
+ rsp.err = ISCSID_UIP_MGMT_IPC_DEVICE_INITIALIZING;
break;
default:
rsp.command = cmd;
- rsp.err = ISCISD_UIP_MGMT_IPC_ERR;
+ rsp.err = ISCSID_UIP_MGMT_IPC_ERR;
}
break;
diff -aurp open-iscsi-2.0-872-rc4-bnx2i/iscsiuio/src/unix/main.c open-iscsi-2.0-872-rc4-bnx2i.build/iscsiuio/src/unix/main.c
--- open-iscsi-2.0-872-rc4-bnx2i/iscsiuio/src/unix/main.c 2011-09-01 20:28:53.000000000 -0500
+++ open-iscsi-2.0-872-rc4-bnx2i.build/iscsiuio/src/unix/main.c 2011-09-01 20:33:42.000000000 -0500
@@ -172,10 +172,10 @@ static void main_usage()
printf("\nUsage: %s [OPTION]\n", APP_NAME);
printf("\
-Broadcom uIP daemon.\n\
+iscsiuio daemon.\n\
-f, --foreground make the program run in the foreground\n\
-d, --debug debuglevel print debugging information\n\
- -p, --pid=pidfile use pid file (default %s ).\n\
+ -p, --pid=pidfile use pid file (default %s).\n\
-h, --help display this help and exit\n\
-v, --version display version and exit\n\
", default_pid_filepath);
@@ -336,6 +336,7 @@ int main(int argc, char *argv[])
sigaddset(&set, SIGINT);
sigaddset(&set, SIGQUIT);
sigaddset(&set, SIGTERM);
+ sigaddset(&set, SIGUSR1);
rc = pthread_sigmask(SIG_SETMASK, &set, NULL);
/* Spin off the signal handling thread */
diff -aurp open-iscsi-2.0-872-rc4-bnx2i/iscsiuio/src/unix/nic_utils.c open-iscsi-2.0-872-rc4-bnx2i.build/iscsiuio/src/unix/nic_utils.c
--- open-iscsi-2.0-872-rc4-bnx2i/iscsiuio/src/unix/nic_utils.c 2011-09-01 20:28:53.000000000 -0500
+++ open-iscsi-2.0-872-rc4-bnx2i.build/iscsiuio/src/unix/nic_utils.c 2011-09-01 20:33:37.000000000 -0500
@@ -473,6 +473,7 @@ static int from_uio_find_associated_eth_
char *search_paths[] = { "/sys/class/uio/uio%i/device/",
"/sys/class/uio/uio%i/device/net"
};
+ int path_to[] = { 5, 1 };
int (*search_filters[]) (const struct dirent *) = {
filter_net_name, filter_dot_out,};
char *(*extract_name[]) (struct dirent ** files) = {
@@ -492,7 +493,7 @@ static int from_uio_find_associated_eth_
/* Build the path to determine uio name */
rc = sprintf(path, search_paths[path_iterator], uio_minor);
- wait_for_file_node_timed(nic, path, 5);
+ wait_for_file_node_timed(nic, path, path_to[path_iterator]);
count = scandir(path, &files,
search_filters[path_iterator], alphasort);
diff -aurp open-iscsi-2.0-872-rc4-bnx2i/iscsiuio/src/unix/options.h open-iscsi-2.0-872-rc4-bnx2i.build/iscsiuio/src/unix/options.h
--- open-iscsi-2.0-872-rc4-bnx2i/iscsiuio/src/unix/options.h 2011-09-01 20:28:53.000000000 -0500
+++ open-iscsi-2.0-872-rc4-bnx2i.build/iscsiuio/src/unix/options.h 2011-09-01 20:33:42.000000000 -0500
@@ -78,7 +78,7 @@
#define ETHERTYPE_VLAN 0x8100 /* IEEE 802.1Q VLAN tagging */
#endif /* ETHERTYPE_VLAN */
-#define APP_NAME "uIP"
+#define APP_NAME "iscsiuio"
/* BUILD_DATE is automatically generated from the Makefile */
#define DEBUG_OFF 0x1

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,137 @@
diff -Naurp open-iscsi-2.0-872-rc4-bnx2i.base/iscsiuio/include/config.h open-iscsi-2.0-872-rc4-bnx2i.build2/iscsiuio/include/config.h
--- open-iscsi-2.0-872-rc4-bnx2i.base/iscsiuio/include/config.h 2011-08-14 22:58:02.000000000 -0500
+++ open-iscsi-2.0-872-rc4-bnx2i.build2/iscsiuio/include/config.h 2011-08-15 00:05:23.000000000 -0500
@@ -22,6 +22,7 @@
#include <netdb.h>
#include "list.h"
+#include "iscsi_net_util.h"
/* ISIDs now have a typed naming authority in them. We use an OUI */
#define DRIVER_ISID_0 0x00
@@ -31,18 +32,33 @@
/* max len of interface */
#define ISCSI_MAX_IFACE_LEN 65
-#if (ISCSID_VERSION == 872) /* 2.0-872 (RHEL 6.0) */
-
#define ISCSI_HWADDRESS_BUF_SIZE 18
#define ISCSI_TRANSPORT_NAME_MAXLEN 16
+#define ISCSI_MAX_STR_LEN 80
typedef struct iface_rec {
struct list_head list;
/* iscsi iface record name */
char name[ISCSI_MAX_IFACE_LEN];
+ uint32_t iface_num;
/* network layer iface name (eth0) */
char netdev[IFNAMSIZ];
char ipaddress[NI_MAXHOST];
+ char subnet_mask[NI_MAXHOST];
+ char gateway[NI_MAXHOST];
+ char bootproto[ISCSI_MAX_STR_LEN];
+ char ipv6_linklocal[NI_MAXHOST];
+ char ipv6_router[NI_MAXHOST];
+ char ipv6_autocfg[NI_MAXHOST];
+ char linklocal_autocfg[NI_MAXHOST];
+ char router_autocfg[NI_MAXHOST];
+ uint16_t vlan_id;
+ uint8_t vlan_priority;
+ char vlan_state[ISCSI_MAX_STR_LEN];
+ char state[ISCSI_MAX_STR_LEN]; /* 0 = disable,
+ * 1 = enable */
+ uint16_t mtu;
+ uint16_t port;
/*
* TODO: we may have to make this bigger and interconnect
* specific for infinniband
@@ -55,40 +71,6 @@ typedef struct iface_rec {
*/
char alias[TARGET_NAME_MAXLEN + 1];
char iname[TARGET_NAME_MAXLEN + 1];
-
- char vlan[ISCSI_MAX_IFACE_LEN];
-} iface_rec_t;
-
-#else /* 2.0-871 (RHEL 5.5) */
-/* number of possible connections per session */
-#define ISCSI_CONN_MAX 1
-
-#define ISCSI_TRANSPORT_NAME_MAXLEN 16
-
-typedef struct iface_rec {
- struct list_head list;
- /* iscsi iface record name */
- char name[ISCSI_MAX_IFACE_LEN];
- /* network layer iface name (eth0) */
- char netdev[IFNAMSIZ];
- char ipaddress[NI_MAXHOST];
-
- /*
- * TODO: we may have to make this bigger and interconnect
- * specific for infinniband
- */
- char hwaddress[ISCSI_MAX_IFACE_LEN];
- char transport_name[ISCSI_TRANSPORT_NAME_MAXLEN];
- /*
- * This is only used for boot now, but the iser guys
- * can use this for their virtualization idea.
- */
- char alias[TARGET_NAME_MAXLEN + 1];
- char iname[TARGET_NAME_MAXLEN + 1];
-
- char vlan[ISCSI_MAX_IFACE_LEN];
} iface_rec_t;
-#endif /* ISCSID_VERSION */
-
#endif /* CONFIG_H */
diff -Naurp open-iscsi-2.0-872-rc4-bnx2i.base/iscsiuio/include/iscsi_net_util.h open-iscsi-2.0-872-rc4-bnx2i.build2/iscsiuio/include/iscsi_net_util.h
--- open-iscsi-2.0-872-rc4-bnx2i.base/iscsiuio/include/iscsi_net_util.h 1969-12-31 18:00:00.000000000 -0600
+++ open-iscsi-2.0-872-rc4-bnx2i.build2/iscsiuio/include/iscsi_net_util.h 2011-08-14 23:20:09.000000000 -0500
@@ -0,0 +1,11 @@
+#ifndef __ISCSI_NET_UTIL_h__
+#define __ISCSI_NET_UTIL_h__
+
+#define ISCSI_HWADDRESS_BUF_SIZE 18
+
+extern int net_get_transport_name_from_netdev(char *netdev, char *transport);
+extern int net_get_netdev_from_hwaddress(char *hwaddress, char *netdev);
+extern int net_setup_netdev(char *netdev, char *local_ip, char *mask,
+ char *gateway, char *remote_ip, int needs_bringup);
+
+#endif
diff -Naurp open-iscsi-2.0-872-rc4-bnx2i.base/iscsiuio/src/unix/iscsid_ipc.c open-iscsi-2.0-872-rc4-bnx2i.build2/iscsiuio/src/unix/iscsid_ipc.c
--- open-iscsi-2.0-872-rc4-bnx2i.base/iscsiuio/src/unix/iscsid_ipc.c 2011-08-14 22:58:02.000000000 -0500
+++ open-iscsi-2.0-872-rc4-bnx2i.build2/iscsiuio/src/unix/iscsid_ipc.c 2011-08-14 23:37:00.000000000 -0500
@@ -221,18 +221,11 @@ static int parse_iface(void *arg)
data = (iscsid_uip_broadcast_t *) arg;
LOG_INFO(PFX "Received request for '%s' to set IP address: '%s' "
- "VLAN: '%s'",
+ "VLAN: '%d'",
data->u.iface_rec.rec.netdev,
- data->u.iface_rec.rec.ipaddress, data->u.iface_rec.rec.vlan);
+ data->u.iface_rec.rec.ipaddress, data->u.iface_rec.rec.vlan_id);
- vlan = atoi(data->u.iface_rec.rec.vlan);
- if ((valid_vlan(vlan) == 0) &&
- (strcmp(data->u.iface_rec.rec.vlan, "") != 0)) {
- LOG_ERR(PFX "Invalid VLAN tag: '%s'",
- data->u.iface_rec.rec.vlan)
- rc = -EIO;
- goto early_exit;
- }
+ vlan = data->u.iface_rec.rec.vlan_id;
/* Detect for CIDR notation and strip off the netmask if present */
rc = decode_cidr(data->u.iface_rec.rec.ipaddress, &ipam, &prefix_len);
@@ -590,7 +583,7 @@ int process_iscsid_broadcast(int s2)
}
/* This will be freed by parse_iface_thread() */
- data = (iscsid_uip_broadcast_t *) malloc(sizeof(*data));
+ data = (iscsid_uip_broadcast_t *) calloc(1, sizeof(*data));
if (data == NULL) {
LOG_ERR(PFX "Couldn't allocate memory for iface data");
return -ENOMEM;

View File

@ -1,35 +1,201 @@
diff --git a/usr/Makefile b/usr/Makefile diff -Naurp open-iscsi-2.0-872-rc4-bnx2i.base/include/iscsi_err.h open-iscsi-2.0-872-rc4-bnx2i.build/include/iscsi_err.h
index e9d6bd1..8e505bf 100644 --- open-iscsi-2.0-872-rc4-bnx2i.base/include/iscsi_err.h 2011-08-14 16:49:44.000000000 -0500
--- a/usr/Makefile +++ open-iscsi-2.0-872-rc4-bnx2i.build/include/iscsi_err.h 2011-08-14 16:56:54.000000000 -0500
+++ b/usr/Makefile @@ -58,6 +58,8 @@ enum {
@@ -42,7 +42,7 @@ ISCSI_LIB_SRCS = iscsi_util.o io.o auth.o login.o log.o md5.o sha1.o iface.o \ ISCSI_ERR_ISNS_QUERY = 25,
iscsid_req.o $(SYSDEPS_SRCS) /* iSNS registration/deregistration failed */
# core initiator files ISCSI_ERR_ISNS_REG_FAILED = 26,
INITIATOR_SRCS = initiator.o scsi.o actor.o event_poll.o mgmt_ipc.o \ + /* Operation failed, but retrying layer may succeed */
- transport.o cxgb3i.o be2iscsi.o + ISCSI_ERR_AGAIN = 27,
+ transport.o cxgb3i.o be2iscsi.o uip_mgmt_ipc.o
# fw boot files
FW_BOOT_SRCS = $(wildcard ../utils/fwparam_ibft/*.o)
diff --git a/usr/initiator.c b/usr/initiator.c /* Always last. Indicates end of error code space */
index 1c9d8b6..8f7a383 100644 ISCSI_MAX_ERR_VAL,
--- a/usr/initiator.c diff -Naurp open-iscsi-2.0-872-rc4-bnx2i.base/libiscsi/Makefile open-iscsi-2.0-872-rc4-bnx2i.build/libiscsi/Makefile
+++ b/usr/initiator.c --- open-iscsi-2.0-872-rc4-bnx2i.base/libiscsi/Makefile 2011-08-14 16:55:23.000000000 -0500
+++ open-iscsi-2.0-872-rc4-bnx2i.build/libiscsi/Makefile 2011-08-14 16:56:54.000000000 -0500
@@ -13,7 +13,7 @@ TESTS += tests/test_set_auth tests/test_
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 dcb_app.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
+ISCSI_LIB_SRCS = netlink.o uip_mgmt_ipc.o transport.o cxgbi.o be2iscsi.o iscsi_timer.o initiator_common.o iscsi_err.o session_info.o iscsi_util.o dcb_app.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
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 -Naurp open-iscsi-2.0-872-rc4-bnx2i.base/usr/initiator.c open-iscsi-2.0-872-rc4-bnx2i.build/usr/initiator.c
--- open-iscsi-2.0-872-rc4-bnx2i.base/usr/initiator.c 2011-08-14 16:49:44.000000000 -0500
+++ open-iscsi-2.0-872-rc4-bnx2i.build/usr/initiator.c 2011-08-14 16:56:54.000000000 -0500
@@ -45,6 +45,7 @@ @@ -45,6 +45,7 @@
#include "iscsi_sysfs.h" #include "iscsi_sysfs.h"
#include "iscsi_settings.h" #include "iscsi_settings.h"
#include "iface.h" #include "iface.h"
+#include "host.h" +#include "host.h"
#include "sysdeps.h" #include "sysdeps.h"
#include "iscsi_err.h"
#define ISCSI_CONN_ERR_REOPEN_DELAY 3 @@ -557,6 +558,48 @@ static int iscsi_conn_connect(struct isc
@@ -743,6 +744,38 @@ static int iscsi_conn_connect(struct iscsi_conn *conn, queue_task_t *qtask)
return 0; return 0;
} }
+static int __set_net_config(struct iscsi_transport *t, +static void iscsi_uio_poll_login_timedout(void *data)
+ iscsi_session_t *session, +{
+ struct iface_rec *iface) + struct queue_task *qtask = data;
+ struct iscsi_conn *conn = qtask->conn;
+ iscsi_session_t *session = conn->session;
+
+ log_debug(3, "timeout waiting for UIO ...\n");
+ mgmt_ipc_write_rsp(qtask, ISCSI_ERR_TRANS_TIMEOUT);
+ conn_delete_timers(conn);
+ __session_destroy(session);
+}
+
+static int iscsi_sched_uio_poll(queue_task_t *qtask)
+{
+ struct iscsi_conn *conn = qtask->conn;
+ struct iscsi_session *session = conn->session;
+ struct iscsi_transport *t = session->t;
+ struct iscsi_ev_context *ev_context;
+
+ if (!t->template->set_net_config)
+ return 0;
+
+ ev_context = iscsi_ev_context_get(conn, 0);
+ if (!ev_context) {
+ /* while reopening the recv pool should be full */
+ log_error("BUG: __session_conn_reopen could "
+ "not get conn context for recv.");
+ return ENOMEM;
+ }
+
+ ev_context->data = qtask;
+ conn->state = ISCSI_CONN_STATE_XPT_WAIT;
+
+ iscsi_sched_ev_context(ev_context, conn, 0, EV_UIO_POLL);
+
+ log_debug(3, "Setting login UIO poll timer %p timeout %d",
+ &conn->login_timer, conn->login_timeout);
+ actor_timer(&conn->login_timer, conn->login_timeout * 1000,
+ iscsi_uio_poll_login_timedout, qtask);
+ return EAGAIN;
+}
+
static void
__session_conn_reopen(iscsi_conn_t *conn, queue_task_t *qtask, int do_stop,
int redirected)
@@ -598,6 +641,11 @@ __session_conn_reopen(iscsi_conn_t *conn
if (!redirected)
session->reopen_cnt++;
+ /* uIP will needs to be re-triggered on the connection re-open */
+ if (iscsi_set_net_config(conn->session->t, conn->session,
+ &conn->session->nrec.iface) != 0)
+ goto queue_reopen;
+
if (iscsi_conn_connect(conn, qtask)) {
delay = ISCSI_CONN_ERR_REOPEN_DELAY;
goto queue_reopen;
@@ -1659,6 +1707,53 @@ failed_login:
}
+static void session_conn_uio_poll(void *data)
+{
+ struct iscsi_ev_context *ev_context = data;
+ iscsi_conn_t *conn = ev_context->conn;
+ struct iscsi_session *session = conn->session;
+ queue_task_t *qtask = ev_context->data;
+ int rc;
+
+ log_debug(4, "retrying uio poll");
+ rc = iscsi_set_net_config(session->t, session,
+ &conn->session->nrec.iface);
+ if (rc != 0) {
+ if (rc == ISCSI_ERR_AGAIN) {
+ ev_context->data = qtask;
+ iscsi_sched_ev_context(ev_context, conn, 2,
+ EV_UIO_POLL);
+ return;
+ } else {
+ log_error("session_conn_uio_poll() "
+ "connection failure [0x%x]", rc);
+ actor_delete(&conn->login_timer);
+ iscsi_login_eh(conn, qtask, ISCSI_ERR_INTERNAL);
+ iscsi_ev_context_put(ev_context);
+ return;
+ }
+ }
+
+ iscsi_ev_context_put(ev_context);
+ actor_delete(&conn->login_timer);
+ log_debug(4, "UIO ready trying connect");
+
+ /* uIP is ready try to connect */
+ if (gettimeofday(&conn->initial_connect_time, NULL))
+ log_error("Could not get initial connect time. If "
+ "login errors iscsid may give up the initial "
+ "login early. You should manually login.");
+
+ conn->state = ISCSI_CONN_STATE_XPT_WAIT;
+ if (iscsi_conn_connect(conn, qtask)) {
+ int delay = ISCSI_CONN_ERR_REOPEN_DELAY;
+
+ log_debug(4, "Waiting %u seconds before trying to reconnect.\n",
+ delay);
+ queue_delayed_reopen(qtask, delay);
+ }
+}
+
static int iscsi_sched_ev_context(struct iscsi_ev_context *ev_context,
struct iscsi_conn *conn, unsigned long tmo,
int event)
@@ -1700,6 +1795,11 @@ static int iscsi_sched_ev_context(struct
ev_context);
actor_schedule(&ev_context->actor);
break;
+ case EV_UIO_POLL:
+ actor_new(&ev_context->actor, session_conn_uio_poll,
+ ev_context);
+ actor_schedule(&ev_context->actor);
+ break;
case EV_CONN_LOGOUT_TIMER:
actor_timer(&ev_context->actor, tmo * 1000,
iscsi_logout_timedout, ev_context);
@@ -1833,7 +1933,17 @@ session_login_task(node_rec_t *rec, queu
conn = &session->conn[0];
qtask->conn = conn;
- if (iscsi_host_set_net_params(&rec->iface, session)) {
+ rc = iscsi_host_set_net_params(&rec->iface, session);
+ if (rc == ISCSI_ERR_AGAIN) {
+ iscsi_sched_uio_poll(qtask);
+ /*
+ * Cannot block iscsid, so caller is going to internally
+ * retry the operation.
+ */
+ qtask->rsp.command = MGMT_IPC_SESSION_LOGIN;
+ qtask->rsp.err = ISCSI_SUCCESS;
+ return ISCSI_SUCCESS;
+ } else if (rc) {
__session_destroy(session);
return ISCSI_ERR_LOGIN;
}
@@ -1990,6 +2100,7 @@ iscsi_host_send_targets(queue_task_t *qt
struct sockaddr_storage *ss)
{
struct iscsi_transport *t;
+ int rc;
t = iscsi_sysfs_get_transport_by_hba(host_no);
if (!t) {
diff -Naurp open-iscsi-2.0-872-rc4-bnx2i.base/usr/initiator_common.c open-iscsi-2.0-872-rc4-bnx2i.build/usr/initiator_common.c
--- open-iscsi-2.0-872-rc4-bnx2i.base/usr/initiator_common.c 2011-08-14 16:49:44.000000000 -0500
+++ open-iscsi-2.0-872-rc4-bnx2i.build/usr/initiator_common.c 2011-08-14 16:56:54.000000000 -0500
@@ -561,6 +561,36 @@ TODO handle this
return 0;
}
+int iscsi_set_net_config(struct iscsi_transport *t, iscsi_session_t *session,
+ struct iface_rec *iface)
+{ +{
+ if (t->template->set_net_config) { + if (t->template->set_net_config) {
+ /* uip needs the netdev name */ + /* uip needs the netdev name */
@ -58,37 +224,43 @@ index 1c9d8b6..8f7a383 100644
+ return 0; + return 0;
+} +}
+ +
+ int iscsi_host_set_net_params(struct iface_rec *iface,
static void struct iscsi_session *session)
__session_conn_reopen(iscsi_conn_t *conn, queue_task_t *qtask, int do_stop, {
int redirected) @@ -582,6 +612,10 @@ int iscsi_host_set_net_params(struct ifa
@@ -784,6 +817,11 @@ __session_conn_reopen(iscsi_conn_t *conn, queue_task_t *qtask, int do_stop,
if (!redirected)
session->reopen_cnt++;
+ /* uIP will needs to be re-triggered on the connection re-open */
+ if (__set_net_config(conn->session->t, conn->session,
+ &conn->session->nrec.iface) != 0)
+ goto queue_reopen;
+
if (iscsi_conn_connect(conn, qtask)) {
delay = ISCSI_CONN_ERR_REOPEN_DELAY;
goto queue_reopen;
@@ -2130,6 +2168,10 @@ static int iface_set_param(struct iscsi_transport *t, struct iface_rec *iface,
return EINVAL; return EINVAL;
} }
+ rc = __set_net_config(t, session, iface); + rc = iscsi_set_net_config(t, session, iface);
+ if (rc != 0) + if (rc != 0)
+ return rc; + return rc;
+ +
rc = __iscsi_host_set_param(t, session->hostno, rc = host_set_param(t, session->hostno,
ISCSI_HOST_PARAM_IPADDRESS, ISCSI_HOST_PARAM_IPADDRESS,
iface->ipaddress, ISCSI_STRING); iface->ipaddress, ISCSI_STRING);
diff --git a/usr/iscsid_req.c b/usr/iscsid_req.c diff -Naurp open-iscsi-2.0-872-rc4-bnx2i.base/usr/initiator.h open-iscsi-2.0-872-rc4-bnx2i.build/usr/initiator.h
index 5280a0a..6eb8b1d 100644 --- open-iscsi-2.0-872-rc4-bnx2i.base/usr/initiator.h 2011-08-14 16:49:44.000000000 -0500
--- a/usr/iscsid_req.c +++ open-iscsi-2.0-872-rc4-bnx2i.build/usr/initiator.h 2011-08-14 16:58:14.000000000 -0500
+++ b/usr/iscsid_req.c @@ -83,6 +83,7 @@ typedef enum iscsi_event_e {
EV_CONN_LOGOUT_TIMER,
EV_CONN_STOP,
EV_CONN_LOGIN,
+ EV_UIO_POLL,
} iscsi_event_e;
struct queue_task;
@@ -353,5 +354,8 @@ extern void iscsi_copy_operational_param
extern int iscsi_setup_authentication(struct iscsi_session *session,
struct iscsi_auth_config *auth_cfg);
extern int iscsi_setup_portal(struct iscsi_conn *conn, char *address, int port);
+extern int iscsi_set_net_config(struct iscsi_transport *t,
+ iscsi_session_t *session,
+ struct iface_rec *iface);
#endif /* INITIATOR_H */
diff -Naurp open-iscsi-2.0-872-rc4-bnx2i.base/usr/iscsid_req.c open-iscsi-2.0-872-rc4-bnx2i.build/usr/iscsid_req.c
--- open-iscsi-2.0-872-rc4-bnx2i.base/usr/iscsid_req.c 2011-08-14 16:49:44.000000000 -0500
+++ open-iscsi-2.0-872-rc4-bnx2i.build/usr/iscsid_req.c 2011-08-14 16:56:54.000000000 -0500
@@ -22,6 +22,7 @@ @@ -22,6 +22,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -97,25 +269,24 @@ index 5280a0a..6eb8b1d 100644
#include <sys/un.h> #include <sys/un.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
@@ -31,6 +32,7 @@ @@ -32,6 +33,7 @@
#include "mgmt_ipc.h"
#include "iscsi_util.h" #include "iscsi_util.h"
#include "config.h" #include "config.h"
#include "iscsi_err.h"
+#include "uip_mgmt_ipc.h" +#include "uip_mgmt_ipc.h"
static void iscsid_startup(void) static void iscsid_startup(void)
{ {
@@ -51,7 +53,8 @@ static void iscsid_startup(void) @@ -54,7 +56,7 @@ static void iscsid_startup(void)
#define MAXSLEEP 128 #define MAXSLEEP 128
-static mgmt_ipc_err_e iscsid_connect(int *fd, int start_iscsid) -static int iscsid_connect(int *fd, int start_iscsid)
+static mgmt_ipc_err_e ipc_connect(int *fd, char *unix_sock_name, +static int ipc_connect(int *fd, char *unix_sock_name, int start_iscsid)
+ int start_iscsid)
{ {
int nsec; int nsec;
struct sockaddr_un addr; struct sockaddr_un addr;
@@ -64,8 +67,8 @@ static mgmt_ipc_err_e iscsid_connect(int *fd, int start_iscsid) @@ -67,8 +69,8 @@ static int iscsid_connect(int *fd, int s
memset(&addr, 0, sizeof(addr)); memset(&addr, 0, sizeof(addr));
addr.sun_family = AF_LOCAL; addr.sun_family = AF_LOCAL;
@ -126,23 +297,24 @@ index 5280a0a..6eb8b1d 100644
/* /*
* Trying to connect with exponential backoff * Trying to connect with exponential backoff
*/ */
@@ -93,6 +96,11 @@ static mgmt_ipc_err_e iscsid_connect(int *fd, int start_iscsid) @@ -96,6 +98,11 @@ static int iscsid_connect(int *fd, int s
return MGMT_IPC_ERR_ISCSID_NOTCONN; return ISCSI_ERR_ISCSID_NOTCONN;
} }
+static mgmt_ipc_err_e iscsid_connect(int *fd, int start_iscsid) +static int iscsid_connect(int *fd, int start_iscsid)
+{ +{
+ return ipc_connect(fd, ISCSIADM_NAMESPACE, start_iscsid); + return ipc_connect(fd, ISCSIADM_NAMESPACE, start_iscsid);
+} +}
+ +
mgmt_ipc_err_e iscsid_request(int *fd, iscsiadm_req_t *req, int start_iscsid) int iscsid_request(int *fd, iscsiadm_req_t *req, int start_iscsid)
{ {
int err; int err;
@@ -190,6 +198,72 @@ int iscsid_req_by_sid(iscsiadm_cmd_e cmd, int sid) @@ -192,3 +199,81 @@ int iscsid_req_by_sid(iscsiadm_cmd_e cmd
return err;
return iscsid_req_wait(cmd, fd); return iscsid_req_wait(cmd, fd);
} }
+
+static mgmt_ipc_err_e uip_connect(int *fd) +static int uip_connect(int *fd)
+{ +{
+ return ipc_connect(fd, ISCSID_UIP_NAMESPACE, 0); + return ipc_connect(fd, ISCSID_UIP_NAMESPACE, 0);
+} +}
@ -161,25 +333,29 @@ index 5280a0a..6eb8b1d 100644
+ return err; + return err;
+ } + }
+ +
+ log_debug(3, "connected to uIP daemon");
+
+ /* Send the data to uIP */ + /* Send the data to uIP */
+ if ((err = write(fd, buf, buf_len)) != buf_len) { + if ((err = write(fd, buf, buf_len)) != buf_len) {
+ log_error("got write error (%d/%d), daemon died?", + log_error("got write error (%d/%d), daemon died?",
+ err, errno); + err, errno);
+ close(fd); + close(fd);
+ return -EIO; + return ISCSI_ERR_ISCSID_COMM_ERR;
+ } + }
+ +
+ log_debug(3, "send iface config to uIP daemon");
+
+ /* Set the socket to a non-blocking read, this way if there are + /* Set the socket to a non-blocking read, this way if there are
+ * problems waiting for uIP, iscsid can bailout early */ + * problems waiting for uIP, iscsid can bailout early */
+ flags = fcntl(fd, F_GETFL, 0); + flags = fcntl(fd, F_GETFL, 0);
+ if (flags == -1) + if (flags == -1)
+ flags = 0; + flags = 0;
+ err = fcntl(fd, F_SETFL, flags | O_NONBLOCK); + err = fcntl(fd, F_SETFL, flags | O_NONBLOCK);
+ if(err != 0) { + if(err != 0) {
+ log_error("could not set uip broadcast to non-blocking: %d", + log_error("could not set uip broadcast to non-blocking: %d",
+ errno); + errno);
+ close(fd); + close(fd);
+ return -EIO; + return ISCSI_ERR;
+ } + }
+ +
+#define MAX_UIP_BROADCAST_READ_TRIES 3 +#define MAX_UIP_BROADCAST_READ_TRIES 3
@ -187,8 +363,10 @@ index 5280a0a..6eb8b1d 100644
+ /* Wait for the response */ + /* Wait for the response */
+ err = read(fd, &rsp, sizeof(rsp)); + err = read(fd, &rsp, sizeof(rsp));
+ if (err == sizeof(rsp)) { + if (err == sizeof(rsp)) {
+ log_debug(3, "Broadcasted to uIP with length: %ld\n", + log_debug(3, "Broadcasted to uIP with length: %ld "
+ buf_len); + "cmd: 0x%x rsp: 0x%x\n", buf_len,
+ rsp.command, rsp.err);
+ err = 0;
+ break; + break;
+ } else if((err == -1) && (errno == EAGAIN)) { + } else if((err == -1) && (errno == EAGAIN)) {
+ usleep(250000); + usleep(250000);
@ -196,45 +374,69 @@ index 5280a0a..6eb8b1d 100644
+ } else { + } else {
+ log_error("Could not read response (%d/%d), daemon died?", + log_error("Could not read response (%d/%d), daemon died?",
+ err, errno); + err, errno);
+ err = ISCSI_ERR;
+ break; + break;
+ } + }
+ } + }
+ +
+ if(count == MAX_UIP_BROADCAST_READ_TRIES) + if (count == MAX_UIP_BROADCAST_READ_TRIES) {
+ log_error("Could not broadcast to uIP"); + log_error("Could not broadcast to uIP after %d tries",
+ count);
+ err = ISCSI_ERR_AGAIN;
+ } else if (rsp.err != ISCISD_UIP_MGMT_IPC_DEVICE_UP) {
+ log_debug(3, "Device is not ready\n");
+ err = ISCSI_ERR_AGAIN;
+ }
+ +
+ close(fd); + close(fd);
+ + return err;
+ return 0;
+} +}
+ diff -Naurp open-iscsi-2.0-872-rc4-bnx2i.base/usr/iscsid_req.h open-iscsi-2.0-872-rc4-bnx2i.build/usr/iscsid_req.h
void iscsid_handle_error(mgmt_ipc_err_e err) --- open-iscsi-2.0-872-rc4-bnx2i.base/usr/iscsid_req.h 2011-08-14 16:49:44.000000000 -0500
{ +++ open-iscsi-2.0-872-rc4-bnx2i.build/usr/iscsid_req.h 2011-08-14 16:56:54.000000000 -0500
static char *err_msgs[] = { @@ -33,4 +33,6 @@ extern int iscsid_req_by_rec(int cmd, st
diff --git a/usr/iscsid_req.h b/usr/iscsid_req.h
index 3bba2f4..e2cf1c3 100644
--- a/usr/iscsid_req.h
+++ b/usr/iscsid_req.h
@@ -34,4 +34,6 @@ extern int iscsid_req_by_rec(int cmd, struct node_rec *rec);
extern int iscsid_req_by_sid_async(int cmd, int sid, int *fd); extern int iscsid_req_by_sid_async(int cmd, int sid, int *fd);
extern int iscsid_req_by_sid(int cmd, int sid); extern int iscsid_req_by_sid(int cmd, int sid);
+extern int uip_broadcast(void *buf, size_t buf_len); +extern int uip_broadcast(void *buf, size_t buf_len);
+ +
#endif #endif
diff --git a/usr/transport.c b/usr/transport.c diff -Naurp open-iscsi-2.0-872-rc4-bnx2i.base/usr/iscsi_err.c open-iscsi-2.0-872-rc4-bnx2i.build/usr/iscsi_err.c
index c0789bb..aa0395c 100644 --- open-iscsi-2.0-872-rc4-bnx2i.base/usr/iscsi_err.c 2011-08-14 16:49:44.000000000 -0500
--- a/usr/transport.c +++ open-iscsi-2.0-872-rc4-bnx2i.build/usr/iscsi_err.c 2011-08-14 16:56:54.000000000 -0500
+++ b/usr/transport.c @@ -49,6 +49,7 @@ static char *iscsi_err_msgs[] = {
/* 24 */ "iSCSI login failed due to authorization failure",
/* 25 */ "iSNS query failed",
/* 26 */ "iSNS registration failed",
+ /* 27 */ "Retryable failure",
};
char *iscsi_err_to_str(int err)
diff -Naurp open-iscsi-2.0-872-rc4-bnx2i.base/usr/Makefile open-iscsi-2.0-872-rc4-bnx2i.build/usr/Makefile
--- open-iscsi-2.0-872-rc4-bnx2i.base/usr/Makefile 2011-08-14 16:55:23.000000000 -0500
+++ open-iscsi-2.0-872-rc4-bnx2i.build/usr/Makefile 2011-08-14 16:58:57.000000000 -0500
@@ -42,7 +42,8 @@ SYSDEPS_SRCS = $(wildcard ../utils/sysde
ISCSI_LIB_SRCS = iscsi_util.o io.o auth.o iscsi_timer.o login.o log.o md5.o \
sha1.o iface.o idbm.o sysfs.o host.o session_info.o iscsi_sysfs.o \
iscsi_net_util.o iscsid_req.o transport.o cxgbi.o be2iscsi.o \
- initiator_common.o iscsi_err.o $(IPC_OBJ) $(SYSDEPS_SRCS) $(DCB_OBJ)
+ initiator_common.o iscsi_err.o uip_mgmt_ipc.o \
+ $(IPC_OBJ) $(SYSDEPS_SRCS) $(DCB_OBJ)
# core initiator files
INITIATOR_SRCS = initiator.o scsi.o actor.o event_poll.o mgmt_ipc.o
diff -Naurp open-iscsi-2.0-872-rc4-bnx2i.base/usr/transport.c open-iscsi-2.0-872-rc4-bnx2i.build/usr/transport.c
--- open-iscsi-2.0-872-rc4-bnx2i.base/usr/transport.c 2011-08-14 16:49:44.000000000 -0500
+++ open-iscsi-2.0-872-rc4-bnx2i.build/usr/transport.c 2011-08-14 16:56:54.000000000 -0500
@@ -25,6 +25,7 @@ @@ -25,6 +25,7 @@
#include "log.h" #include "log.h"
#include "iscsi_util.h" #include "iscsi_util.h"
#include "iscsi_sysfs.h" #include "iscsi_sysfs.h"
+#include "uip_mgmt_ipc.h" +#include "uip_mgmt_ipc.h"
#include "cxgb3i.h" #include "cxgbi.h"
#include "be2iscsi.h" #include "be2iscsi.h"
@@ -58,6 +59,7 @@ struct iscsi_transport_template bnx2i = { @@ -67,6 +68,7 @@ struct iscsi_transport_template bnx2i =
.ep_connect = ktransport_ep_connect, .ep_connect = ktransport_ep_connect,
.ep_poll = ktransport_ep_poll, .ep_poll = ktransport_ep_poll,
.ep_disconnect = ktransport_ep_disconnect, .ep_disconnect = ktransport_ep_disconnect,
@ -242,10 +444,9 @@ index c0789bb..aa0395c 100644
}; };
struct iscsi_transport_template be2iscsi = { struct iscsi_transport_template be2iscsi = {
diff --git a/usr/transport.h b/usr/transport.h diff -Naurp open-iscsi-2.0-872-rc4-bnx2i.base/usr/transport.h open-iscsi-2.0-872-rc4-bnx2i.build/usr/transport.h
index 5ceedb3..2ec903c 100644 --- open-iscsi-2.0-872-rc4-bnx2i.base/usr/transport.h 2011-08-14 16:49:34.000000000 -0500
--- a/usr/transport.h +++ open-iscsi-2.0-872-rc4-bnx2i.build/usr/transport.h 2011-08-14 16:56:54.000000000 -0500
+++ b/usr/transport.h
@@ -35,6 +35,9 @@ struct iscsi_transport_template { @@ -35,6 +35,9 @@ struct iscsi_transport_template {
int (*ep_poll) (struct iscsi_conn *conn, int timeout_ms); int (*ep_poll) (struct iscsi_conn *conn, int timeout_ms);
void (*ep_disconnect) (struct iscsi_conn *conn); void (*ep_disconnect) (struct iscsi_conn *conn);
@ -256,11 +457,9 @@ index 5ceedb3..2ec903c 100644
}; };
/* represents data path provider */ /* represents data path provider */
diff --git a/usr/uip_mgmt_ipc.c b/usr/uip_mgmt_ipc.c diff -Naurp open-iscsi-2.0-872-rc4-bnx2i.base/usr/uip_mgmt_ipc.c open-iscsi-2.0-872-rc4-bnx2i.build/usr/uip_mgmt_ipc.c
new file mode 100644 --- open-iscsi-2.0-872-rc4-bnx2i.base/usr/uip_mgmt_ipc.c 1969-12-31 18:00:00.000000000 -0600
index 0000000..73b1632 +++ open-iscsi-2.0-872-rc4-bnx2i.build/usr/uip_mgmt_ipc.c 2011-08-14 16:56:54.000000000 -0500
--- /dev/null
+++ b/usr/uip_mgmt_ipc.c
@@ -0,0 +1,41 @@ @@ -0,0 +1,41 @@
+/* +/*
+ * uIP iSCSI Daemon/Admin Management IPC + * uIP iSCSI Daemon/Admin Management IPC
@ -303,12 +502,10 @@ index 0000000..73b1632
+ sizeof(iscsid_uip_broadcast_header_t) + + sizeof(iscsid_uip_broadcast_header_t) +
+ sizeof(*iface)); + sizeof(*iface));
+} +}
diff --git a/usr/uip_mgmt_ipc.h b/usr/uip_mgmt_ipc.h diff -Naurp open-iscsi-2.0-872-rc4-bnx2i.base/usr/uip_mgmt_ipc.h open-iscsi-2.0-872-rc4-bnx2i.build/usr/uip_mgmt_ipc.h
new file mode 100644 --- open-iscsi-2.0-872-rc4-bnx2i.base/usr/uip_mgmt_ipc.h 1969-12-31 18:00:00.000000000 -0600
index 0000000..dd49c0b +++ open-iscsi-2.0-872-rc4-bnx2i.build/usr/uip_mgmt_ipc.h 2011-08-14 16:56:54.000000000 -0500
--- /dev/null @@ -0,0 +1,73 @@
+++ b/usr/uip_mgmt_ipc.h
@@ -0,0 +1,71 @@
+/* +/*
+ * uIP iSCSI Daemon/Admin Management IPC + * uIP iSCSI Daemon/Admin Management IPC
+ * + *
@ -366,6 +563,8 @@ index 0000000..dd49c0b
+ ISCISD_UIP_MGMT_IPC_ERR = 1, + ISCISD_UIP_MGMT_IPC_ERR = 1,
+ ISCISD_UIP_MGMT_IPC_ERR_NOT_FOUND = 2, + ISCISD_UIP_MGMT_IPC_ERR_NOT_FOUND = 2,
+ ISCISD_UIP_MGMT_IPC_ERR_NOMEM = 3, + ISCISD_UIP_MGMT_IPC_ERR_NOMEM = 3,
+ ISCISD_UIP_MGMT_IPC_DEVICE_UP = 4,
+ ISCISD_UIP_MGMT_IPC_DEVICE_INITIALIZING = 5,
+} iscsid_uip_mgmt_ipc_err_e; +} iscsid_uip_mgmt_ipc_err_e;
+ +
+/* IPC Response */ +/* IPC Response */
@ -380,6 +579,3 @@ index 0000000..dd49c0b
+ +
+ +
+#endif /* UIP_MGMT_IPC_H */ +#endif /* UIP_MGMT_IPC_H */
--
1.6.6.1

View File

@ -1,6 +1,6 @@
diff -aurp open-iscsi-2.0-872-rc3-bnx2i/etc/iscsid.conf open-iscsi-2.0-872-rc3-bnx2i.diff/etc/iscsid.conf diff -aurp open-iscsi-2.0-872-rc4-bnx2i.base/etc/iscsid.conf open-iscsi-2.0-872-rc4-bnx2i.build/etc/iscsid.conf
--- open-iscsi-2.0-872-rc3-bnx2i/etc/iscsid.conf 2010-07-11 03:45:50.000000000 -0500 --- open-iscsi-2.0-872-rc4-bnx2i.base/etc/iscsid.conf 2011-08-14 16:33:53.000000000 -0500
+++ open-iscsi-2.0-872-rc3-bnx2i.diff/etc/iscsid.conf 2010-07-11 03:57:57.000000000 -0500 +++ open-iscsi-2.0-872-rc4-bnx2i.build/etc/iscsid.conf 2011-08-14 16:37:47.000000000 -0500
@@ -17,10 +17,10 @@ @@ -17,10 +17,10 @@
# maintainers. # maintainers.
# #
@ -23,9 +23,9 @@ diff -aurp open-iscsi-2.0-872-rc3-bnx2i/etc/iscsid.conf open-iscsi-2.0-872-rc3-b
+# To manually startup the session set to "manual". The default is automatic. +# To manually startup the session set to "manual". The default is automatic.
+node.startup = automatic +node.startup = automatic
# For "automatic" startup nodes, setting this to "Yes" will try logins on each
# ************* # available iface until one succeeds, and then stop. The default "No" will try
@@ -255,29 +255,26 @@ node.conn[0].iscsi.MaxXmitDataSegmentLen @@ -259,28 +259,27 @@ node.conn[0].iscsi.MaxXmitDataSegmentLen
discovery.sendtargets.iscsi.MaxRecvDataSegmentLength = 32768 discovery.sendtargets.iscsi.MaxRecvDataSegmentLength = 32768
# To allow the targets to control the setting of the digest checking, # To allow the targets to control the setting of the digest checking,
@ -34,36 +34,36 @@ diff -aurp open-iscsi-2.0-872-rc3-bnx2i/etc/iscsid.conf open-iscsi-2.0-872-rc3-b
+# the following lines (Data digests are not supported.): +# the following lines (Data digests are not supported.):
#node.conn[0].iscsi.HeaderDigest = CRC32C,None #node.conn[0].iscsi.HeaderDigest = CRC32C,None
-#node.conn[0].iscsi.DataDigest = CRC32C,None -#node.conn[0].iscsi.DataDigest = CRC32C,None
+
# #
# To allow the targets to control the setting of the digest checking, # To allow the targets to control the setting of the digest checking,
# with the initiator requesting a preference of disabling the checking, # with the initiator requesting a preference of disabling the checking,
-# uncomment one or both of the following lines: -# uncomment one or both of the following lines:
+# uncomment the following lines: +# uncomment the following line:
#node.conn[0].iscsi.HeaderDigest = None,CRC32C #node.conn[0].iscsi.HeaderDigest = None,CRC32C
-#node.conn[0].iscsi.DataDigest = None,CRC32C -#node.conn[0].iscsi.DataDigest = None,CRC32C
# #
# To enable CRC32C digest checking for the header and/or data part of # To enable CRC32C digest checking for the header and/or data part of
-# iSCSI PDUs, uncomment one or both of the following lines: -# iSCSI PDUs, uncomment one or both of the following lines:
+# iSCSI PDUs, uncomment the following lines: +# iSCSI PDUs, uncomment the following line:
#node.conn[0].iscsi.HeaderDigest = CRC32C #node.conn[0].iscsi.HeaderDigest = CRC32C
-#node.conn[0].iscsi.DataDigest = CRC32C -#node.conn[0].iscsi.DataDigest = CRC32C
# #
# To disable digest checking for the header and/or data part of # To disable digest checking for the header and/or data part of
-# iSCSI PDUs, uncomment one or both of the following lines: -# iSCSI PDUs, uncomment one or both of the following lines:
+# iSCSI PDUs, uncomment the following lines: +# iSCSI PDUs, uncomment the following line:
#node.conn[0].iscsi.HeaderDigest = None #node.conn[0].iscsi.HeaderDigest = None
-#node.conn[0].iscsi.DataDigest = None -#node.conn[0].iscsi.DataDigest = None
# #
# The default is to never use DataDigests or HeaderDigests. # The default is to never use DataDigests or HeaderDigests.
# #
-
+node.conn[0].iscsi.HeaderDigest = None +node.conn[0].iscsi.HeaderDigest = None
#************ # For multipath configurations, you may want more than one session to be
# Workarounds # created on each iface record. If node.session.nr_sessions is greater
diff -aurp open-iscsi-2.0-872-rc3-bnx2i/README open-iscsi-2.0-872-rc3-bnx2i.diff/README diff -aurp open-iscsi-2.0-872-rc4-bnx2i.base/README open-iscsi-2.0-872-rc4-bnx2i.build/README
--- open-iscsi-2.0-872-rc3-bnx2i/README 2010-07-11 03:45:50.000000000 -0500 --- open-iscsi-2.0-872-rc4-bnx2i.base/README 2011-08-14 16:33:53.000000000 -0500
+++ open-iscsi-2.0-872-rc3-bnx2i.diff/README 2010-07-11 03:57:57.000000000 -0500 +++ open-iscsi-2.0-872-rc4-bnx2i.build/README 2011-08-14 16:34:12.000000000 -0500
@@ -74,11 +74,6 @@ the cache sync command will fail. @@ -74,11 +74,6 @@ the cache sync command will fail.
- iscsiadm's -P 3 option will not print out scsi devices. - iscsiadm's -P 3 option will not print out scsi devices.
- iscsid will not automatically online devices. - iscsid will not automatically online devices.
@ -76,7 +76,7 @@ diff -aurp open-iscsi-2.0-872-rc3-bnx2i/README open-iscsi-2.0-872-rc3-bnx2i.diff
By default the kernel source found at By default the kernel source found at
/lib/modules/`uname -a`/build /lib/modules/`uname -a`/build
will be used to compile the open-iscsi modules. To specify a different will be used to compile the open-iscsi modules. To specify a different
@@ -907,7 +902,7 @@ Red Hat or Fedora: @@ -975,7 +970,7 @@ Red Hat or Fedora:
----------------- -----------------
To start open-iscsi in Red Hat/Fedora you can do: To start open-iscsi in Red Hat/Fedora you can do:
@ -85,7 +85,7 @@ diff -aurp open-iscsi-2.0-872-rc3-bnx2i/README open-iscsi-2.0-872-rc3-bnx2i.diff
To get open-iscsi to automatically start at run time you may have to To get open-iscsi to automatically start at run time you may have to
run: run:
@@ -1115,6 +1110,8 @@ iscsid will only perform rediscovery whe @@ -1183,6 +1178,8 @@ iscsid will only perform rediscovery whe
# linux-isns (SLES's iSNS server) where it sometimes does not send SCN # linux-isns (SLES's iSNS server) where it sometimes does not send SCN
# events in the proper format, so they may not get handled. # events in the proper format, so they may not get handled.
@ -94,11 +94,10 @@ diff -aurp open-iscsi-2.0-872-rc3-bnx2i/README open-iscsi-2.0-872-rc3-bnx2i.diff
Example: Example:
-------- --------
Only in open-iscsi-2.0-872-rc3-bnx2i.diff/: README.orig diff -aurp open-iscsi-2.0-872-rc4-bnx2i.base/usr/idbm.c open-iscsi-2.0-872-rc4-bnx2i.build/usr/idbm.c
diff -aurp open-iscsi-2.0-872-rc3-bnx2i/usr/idbm.c open-iscsi-2.0-872-rc3-bnx2i.diff/usr/idbm.c --- open-iscsi-2.0-872-rc4-bnx2i.base/usr/idbm.c 2011-08-14 16:33:53.000000000 -0500
--- open-iscsi-2.0-872-rc3-bnx2i/usr/idbm.c 2010-07-11 03:45:50.000000000 -0500 +++ open-iscsi-2.0-872-rc4-bnx2i.build/usr/idbm.c 2011-08-14 16:34:12.000000000 -0500
+++ open-iscsi-2.0-872-rc3-bnx2i.diff/usr/idbm.c 2010-07-11 03:57:57.000000000 -0500 @@ -373,9 +373,13 @@ idbm_recinfo_node(node_rec_t *r, recinfo
@@ -346,9 +346,13 @@ idbm_recinfo_node(node_rec_t *r, recinfo
IDBM_SHOW, "None", "CRC32C", "CRC32C,None", IDBM_SHOW, "None", "CRC32C", "CRC32C,None",
"None,CRC32C", num, 1); "None,CRC32C", num, 1);
sprintf(key, CONN_DATA_DIGEST, i); sprintf(key, CONN_DATA_DIGEST, i);

View File

@ -1,16 +1,16 @@
diff -aurp open-iscsi-2.0-872-rc3-bnx2i/doc/iscsiadm.8 open-iscsi-2.0-872-rc3-bnx2i.diff/doc/iscsiadm.8 diff -aurp open-iscsi-2.0-872-rc4-bnx2i.base/doc/iscsiadm.8 open-iscsi-2.0-872-rc4-bnx2i.build/doc/iscsiadm.8
--- open-iscsi-2.0-872-rc3-bnx2i/doc/iscsiadm.8 2010-07-11 03:45:50.000000000 -0500 --- open-iscsi-2.0-872-rc4-bnx2i.base/doc/iscsiadm.8 2011-08-14 16:33:53.000000000 -0500
+++ open-iscsi-2.0-872-rc3-bnx2i.diff/doc/iscsiadm.8 2010-07-11 04:00:35.000000000 -0500 +++ open-iscsi-2.0-872-rc4-bnx2i.build/doc/iscsiadm.8 2011-08-14 16:41:07.000000000 -0500
@@ -51,7 +51,7 @@ display help text and exit @@ -57,7 +57,7 @@ MAC address of a scsi host.
.TP .TP
\fB\-I\fR, \fB\-\-interface\fI[iface]\fR \fB\-I\fR, \fB\-\-interface=\fI[iface]\fR
The interface argument specifies the iSCSI interface to use for the operation. The interface argument specifies the iSCSI interface to use for the operation.
-iSCSI interfaces (iface) are defined in /etc/iscsi/ifaces. For hardware -iSCSI interfaces (iface) are defined in /etc/iscsi/ifaces. For hardware
+iSCSI interfaces (iface) are defined in /var/lib/iscsi/ifaces. For hardware +iSCSI interfaces (iface) are defined in /var/lib/iscsi/ifaces. For hardware
iSCSI (qla4xxx) the iface config must have the hardware address iSCSI (qla4xxx) the iface config must have the hardware address
(iface.hwaddress = port's MAC address) (iface.hwaddress = port's MAC address)
and the driver/transport_name (iface.transport_name). The iface's name is and the driver/transport_name (iface.transport_name). The iface's name is
@@ -128,7 +128,7 @@ If no other options are specified: for \ @@ -134,7 +134,7 @@ If no other options are specified: for \
of their respective records are displayed; for \fIsession\fR, all active of their respective records are displayed; for \fIsession\fR, all active
sessions and connections are displayed; for \fIfw\fR, all boot firmware sessions and connections are displayed; for \fIfw\fR, all boot firmware
values are displayed; for \fIhost\fR, all iSCSI hosts are displayed; and values are displayed; for \fIhost\fR, all iSCSI hosts are displayed; and
@ -19,7 +19,7 @@ diff -aurp open-iscsi-2.0-872-rc3-bnx2i/doc/iscsiadm.8 open-iscsi-2.0-872-rc3-bn
.TP .TP
\fB\-n\fR, \fB\-\-name=\fIname\fR \fB\-n\fR, \fB\-\-name=\fIname\fR
@@ -336,10 +336,10 @@ The configuration file read by \fBiscsid @@ -503,10 +503,10 @@ The configuration file read by \fBiscsid
The file containing the iSCSI InitiatorName and InitiatorAlias read by The file containing the iSCSI InitiatorName and InitiatorAlias read by
\fBiscsid\fR and \fBiscsiadm\fR on startup. \fBiscsid\fR and \fBiscsiadm\fR on startup.
.TP .TP
@ -32,10 +32,9 @@ diff -aurp open-iscsi-2.0-872-rc3-bnx2i/doc/iscsiadm.8 open-iscsi-2.0-872-rc3-bn
This directory contains the portals. This directory contains the portals.
.SH "SEE ALSO" .SH "SEE ALSO"
Only in open-iscsi-2.0-872-rc3-bnx2i.diff/doc: iscsiadm.8.orig diff -aurp open-iscsi-2.0-872-rc4-bnx2i.base/README open-iscsi-2.0-872-rc4-bnx2i.build/README
diff -aurp open-iscsi-2.0-872-rc3-bnx2i/README open-iscsi-2.0-872-rc3-bnx2i.diff/README --- open-iscsi-2.0-872-rc4-bnx2i.base/README 2011-08-14 16:41:23.000000000 -0500
--- open-iscsi-2.0-872-rc3-bnx2i/README 2010-07-11 03:58:50.000000000 -0500 +++ open-iscsi-2.0-872-rc4-bnx2i.build/README 2011-08-14 16:42:47.000000000 -0500
+++ open-iscsi-2.0-872-rc3-bnx2i.diff/README 2010-07-11 03:59:00.000000000 -0500
@@ -144,10 +144,10 @@ available on all Linux installations. @@ -144,10 +144,10 @@ available on all Linux installations.
The database contains two tables: The database contains two tables:
@ -50,16 +49,16 @@ diff -aurp open-iscsi-2.0-872-rc3-bnx2i/README open-iscsi-2.0-872-rc3-bnx2i.diff
The iscsiadm utility is a command-line tool to manage (update, delete, The iscsiadm utility is a command-line tool to manage (update, delete,
insert, query) the persistent database. insert, query) the persistent database.
@@ -420,7 +420,7 @@ a scsi_host per HBA port). @@ -422,7 +422,7 @@ a scsi_host per HBA port).
To manage both types of initiator stacks, iscsiadm uses the interface (iface) To manage both types of initiator stacks, iscsiadm uses the interface (iface)
structure. For each HBA port or for software iscsi for each network structure. For each HBA port or for software iscsi for each network
device (ethX) or NIC, that you wish to bind sessions to you must create device (ethX) or NIC, that you wish to bind sessions to you must create
-a iface config /etc/iscsi/ifaces. -a iface config /etc/iscsi/ifaces.
+a iface config /var/lib/iscsi/ifaces. +a iface config /var/lib/iscsi/ifaces.
Running: Prep:
@@ -428,29 +428,29 @@ Running: @@ -456,29 +456,29 @@ Running:
iface0 qla4xxx,00:c0:dd:08:63:e8,20.15.0.7,default,iqn.2005-06.com.redhat:madmax iface0 qla4xxx,00:c0:dd:08:63:e8,20.15.0.7,default,iqn.2005-06.com.redhat:madmax
iface1 qla4xxx,00:c0:dd:08:63:ea,20.15.0.9,default,iqn.2005-06.com.redhat:madmax iface1 qla4xxx,00:c0:dd:08:63:ea,20.15.0.9,default,iqn.2005-06.com.redhat:madmax
@ -94,8 +93,8 @@ diff -aurp open-iscsi-2.0-872-rc3-bnx2i/README open-iscsi-2.0-872-rc3-bnx2i.diff
iface.transport_name = tcp iface.transport_name = tcp
iface.hwaddress = 00:C0:DD:08:63:E7 iface.hwaddress = 00:C0:DD:08:63:E7
@@ -499,7 +499,7 @@ iser iser,<empty>,<empty>,<empty>,<empty @@ -528,7 +528,7 @@ cxgb3i.00:07:43:05:97:07 cxgb3i,00:07:43
cxgb3i.00:07:43:05:97:07 cxgb3i,00:07:43:05:97:07,<empty>,<empty>,<empty> qla4xxx.00:0e:1e:04:8b:2e qla4xxx,00:0e:1e:04:8b:2e,<empty>,<empty>,<empty>
-Will report iface configurations that are setup in /etc/iscsi/ifaces. -Will report iface configurations that are setup in /etc/iscsi/ifaces.
@ -103,16 +102,7 @@ diff -aurp open-iscsi-2.0-872-rc3-bnx2i/README open-iscsi-2.0-872-rc3-bnx2i.diff
The format is: The format is:
iface_name transport_name,hwaddress,ipaddress,net_ifacename,initiatorname iface_name transport_name,hwaddress,ipaddress,net_ifacename,initiatorname
@@ -515,7 +515,7 @@ default one in /etc/iscsi/initiatorname. @@ -614,7 +614,7 @@ need a seperate network connection to th
-To display these values in a more friendly run:
+To display these values in a more friendly way run:
iscsiadm -m iface -I cxgb3i.00:07:43:05:97:07
# BEGIN RECORD 2.0-871
@@ -553,7 +553,7 @@ need a seperate network connection to th
*This will be fixed in the next version of open-iscsi* *This will be fixed in the next version of open-iscsi*
For compatibility reasons, when you run iscsiadm to do discovery, it For compatibility reasons, when you run iscsiadm to do discovery, it
@ -121,7 +111,7 @@ diff -aurp open-iscsi-2.0-872-rc3-bnx2i/README open-iscsi-2.0-872-rc3-bnx2i.diff
tcp for the iface.transport and it will bind the portals that are discovered tcp for the iface.transport and it will bind the portals that are discovered
so that they will be logged in through those ifaces. This behavior can also so that they will be logged in through those ifaces. This behavior can also
be overriden by passing in the interfaces you want to use. For the case be overriden by passing in the interfaces you want to use. For the case
@@ -571,7 +571,7 @@ we do not bind a session to a iface, the @@ -632,7 +632,7 @@ we do not bind a session to a iface, the
iscsiadm -m discoverydb -t st -p ip:port -I default --discover -P 1 iscsiadm -m discoverydb -t st -p ip:port -I default --discover -P 1
@ -130,7 +120,7 @@ diff -aurp open-iscsi-2.0-872-rc3-bnx2i/README open-iscsi-2.0-872-rc3-bnx2i.diff
not pass anything into iscsiadm, running iscsiadm will do the default not pass anything into iscsiadm, running iscsiadm will do the default
behavior, where we allow the network subsystem to decide which behavior, where we allow the network subsystem to decide which
device to use. device to use.
@@ -613,13 +613,13 @@ To now log into targets it is the same a @@ -674,7 +674,7 @@ To now log into targets it is the same a
./iscsiadm -m discoverydb -t st -p 192.168.1.1:3260 --discover ./iscsiadm -m discoverydb -t st -p 192.168.1.1:3260 --discover
@ -139,14 +129,16 @@ diff -aurp open-iscsi-2.0-872-rc3-bnx2i/README open-iscsi-2.0-872-rc3-bnx2i.diff
ID [portal = 192.168.1.1:3260 and type = sendtargets. If found it ID [portal = 192.168.1.1:3260 and type = sendtargets. If found it
will perform discovery using the settings stored in the record. will perform discovery using the settings stored in the record.
If a record does not exist, it will be created using the iscsid.conf If a record does not exist, it will be created using the iscsid.conf
discovery settings. @@ -683,7 +683,7 @@ To now log into targets it is the same a
The argument to -p may also be a hostname instead of an address.
./iscsiadm -m discoverydb -t st -p smoehost --discover
- For the ifaces, iscsiadm will first search /etc/iscsi/ifaces for - For the ifaces, iscsiadm will first search /etc/iscsi/ifaces for
+ For the ifaces, iscsiadm will first search /var/lib/iscsi/ifaces for + For the ifaces, iscsiadm will first search /var/lib/iscsi/ifaces for
interfaces using software iscsi. If any are found then nodes found interfaces using software iscsi. If any are found then nodes found
during discovery will be setup so that they can logged in through during discovery will be setup so that they can logged in through
those interfaces. To specify a specific iface, pass the those interfaces. To specify a specific iface, pass the
@@ -675,7 +675,7 @@ To now log into targets it is the same a @@ -739,7 +739,7 @@ To now log into targets it is the same a
This command will perform discovery, but not manipulate the node DB. This command will perform discovery, but not manipulate the node DB.
- SendTargets iSCSI Discovery with a specific interface. If you - SendTargets iSCSI Discovery with a specific interface. If you
@ -155,7 +147,7 @@ diff -aurp open-iscsi-2.0-872-rc3-bnx2i/README open-iscsi-2.0-872-rc3-bnx2i.diff
then you can pass them in during discovery: then you can pass them in during discovery:
./iscsiadm -m discoverydb -t sendtargets -p 192.168.1.1:3260 \ ./iscsiadm -m discoverydb -t sendtargets -p 192.168.1.1:3260 \
@@ -982,8 +982,8 @@ where targetname is the name of the targ @@ -1050,8 +1050,8 @@ where targetname is the name of the targ
and port of the portal. tpgt, is the portal group tag of and port of the portal. tpgt, is the portal group tag of
the portal, and is not used in iscsiadm commands except for static the portal, and is not used in iscsiadm commands except for static
record creation. And iface name is the name of the iscsi interface record creation. And iface name is the name of the iscsi interface
@ -166,7 +158,7 @@ diff -aurp open-iscsi-2.0-872-rc3-bnx2i/README open-iscsi-2.0-872-rc3-bnx2i.diff
Default here is iscsi_tcp/tcp to be used over which ever NIC the Default here is iscsi_tcp/tcp to be used over which ever NIC the
network layer decides is best. network layer decides is best.
@@ -1098,7 +1098,7 @@ If set, iscsid will perform discovery to @@ -1166,7 +1166,7 @@ If set, iscsid will perform discovery to
discovery.isns.discoveryd_poll_inval or discovery.isns.discoveryd_poll_inval or
discovery.sendtargets.discoveryd_poll_inval seconds, discovery.sendtargets.discoveryd_poll_inval seconds,
and it will log into any portals found from the discovery source using and it will log into any portals found from the discovery source using
@ -175,11 +167,10 @@ diff -aurp open-iscsi-2.0-872-rc3-bnx2i/README open-iscsi-2.0-872-rc3-bnx2i.diff
Note that for iSNS the poll_interval does not have to be set. If not set, Note that for iSNS the poll_interval does not have to be set. If not set,
iscsid will only perform rediscovery when it gets a SCN from the server. iscsid will only perform rediscovery when it gets a SCN from the server.
Only in open-iscsi-2.0-872-rc3-bnx2i.diff/: README.orig diff -aurp open-iscsi-2.0-872-rc4-bnx2i.base/usr/idbm.c open-iscsi-2.0-872-rc4-bnx2i.build/usr/idbm.c
diff -aurp open-iscsi-2.0-872-rc3-bnx2i/usr/idbm.c open-iscsi-2.0-872-rc3-bnx2i.diff/usr/idbm.c --- open-iscsi-2.0-872-rc4-bnx2i.base/usr/idbm.c 2011-08-14 16:41:23.000000000 -0500
--- open-iscsi-2.0-872-rc3-bnx2i/usr/idbm.c 2010-07-11 03:58:50.000000000 -0500 +++ open-iscsi-2.0-872-rc4-bnx2i.build/usr/idbm.c 2011-08-14 16:41:07.000000000 -0500
+++ open-iscsi-2.0-872-rc3-bnx2i.diff/usr/idbm.c 2010-07-11 03:59:00.000000000 -0500 @@ -2359,9 +2359,9 @@ free_info:
@@ -2235,9 +2235,9 @@ free_info:
int idbm_init(idbm_get_config_file_fn *fn) int idbm_init(idbm_get_config_file_fn *fn)
{ {
/* make sure root db dir is there */ /* make sure root db dir is there */
@ -192,10 +183,9 @@ diff -aurp open-iscsi-2.0-872-rc3-bnx2i/usr/idbm.c open-iscsi-2.0-872-rc3-bnx2i.
errno); errno);
return errno; return errno;
} }
Only in open-iscsi-2.0-872-rc3-bnx2i.diff/usr: idbm.c.orig diff -aurp open-iscsi-2.0-872-rc4-bnx2i.base/usr/idbm.h open-iscsi-2.0-872-rc4-bnx2i.build/usr/idbm.h
diff -aurp open-iscsi-2.0-872-rc3-bnx2i/usr/idbm.h open-iscsi-2.0-872-rc3-bnx2i.diff/usr/idbm.h --- open-iscsi-2.0-872-rc4-bnx2i.base/usr/idbm.h 2011-08-14 16:33:53.000000000 -0500
--- open-iscsi-2.0-872-rc3-bnx2i/usr/idbm.h 2010-07-11 03:45:50.000000000 -0500 +++ open-iscsi-2.0-872-rc4-bnx2i.build/usr/idbm.h 2011-08-14 16:41:07.000000000 -0500
+++ open-iscsi-2.0-872-rc3-bnx2i.diff/usr/idbm.h 2010-07-11 03:59:00.000000000 -0500
@@ -27,12 +27,15 @@ @@ -27,12 +27,15 @@
#include "initiator.h" #include "initiator.h"
#include "config.h" #include "config.h"
@ -218,9 +208,9 @@ diff -aurp open-iscsi-2.0-872-rc3-bnx2i/usr/idbm.h open-iscsi-2.0-872-rc3-bnx2i.
#define ST_CONFIG_NAME "st_config" #define ST_CONFIG_NAME "st_config"
#define ISNS_CONFIG_NAME "isns_config" #define ISNS_CONFIG_NAME "isns_config"
diff -aurp open-iscsi-2.0-872-rc3-bnx2i/usr/iface.h open-iscsi-2.0-872-rc3-bnx2i.diff/usr/iface.h diff -aurp open-iscsi-2.0-872-rc4-bnx2i.base/usr/iface.h open-iscsi-2.0-872-rc4-bnx2i.build/usr/iface.h
--- open-iscsi-2.0-872-rc3-bnx2i/usr/iface.h 2010-07-11 03:45:50.000000000 -0500 --- open-iscsi-2.0-872-rc4-bnx2i.base/usr/iface.h 2011-08-14 16:33:53.000000000 -0500
+++ open-iscsi-2.0-872-rc3-bnx2i.diff/usr/iface.h 2010-07-11 03:59:00.000000000 -0500 +++ open-iscsi-2.0-872-rc4-bnx2i.build/usr/iface.h 2011-08-14 16:41:07.000000000 -0500
@@ -20,7 +20,9 @@ @@ -20,7 +20,9 @@
#ifndef ISCSI_IFACE_H #ifndef ISCSI_IFACE_H
#define ISCSI_IFACE_H #define ISCSI_IFACE_H

View File

@ -3,29 +3,49 @@
Summary: iSCSI daemon and utility programs Summary: iSCSI daemon and utility programs
Name: iscsi-initiator-utils Name: iscsi-initiator-utils
Version: 6.2.0.872 Version: 6.2.0.872
Release: 12%{?dist} Release: 13%{?dist}
Source0: http://people.redhat.com/mchristi/iscsi/rhel6.0/source/open-iscsi-2.0-872-rc4-bnx2i.tar.gz Source0: http://people.redhat.com/mchristi/iscsi/rhel6.0/source/open-iscsi-2.0-872-rc4-bnx2i.tar.gz
Source1: iscsid.init Source1: iscsid.init
Source2: iscsidevs.init Source2: iscsidevs.init
Source3: 04-iscsi Source3: 04-iscsi
# sync brcm to 0.7.0.12
Patch0: iscsi-initiator-utils-sync-uio-0.7.0.8.patch
# sync iscsi tools to upstream commit e8c5b1d34ee5ce0a755ff54518829156dfa5fabe
Patch1: iscsi-initiator-utils-sync-iscsi.patch
# Add Red Hat specific info to docs. # Add Red Hat specific info to docs.
Patch0: iscsi-initiator-utils-update-initscripts-and-docs.patch Patch2: iscsi-initiator-utils-update-initscripts-and-docs.patch
# Upstream uses /etc/iscsi for iscsi db info, but use /var/lib/iscsi. # Upstream uses /etc/iscsi for iscsi db info, but use /var/lib/iscsi.
Patch1: iscsi-initiator-utils-use-var-for-config.patch Patch3: iscsi-initiator-utils-use-var-for-config.patch
# Add redhat.com string to default initiator name. # Add redhat.com string to default initiator name.
Patch2: iscsi-initiator-utils-use-red-hat-for-name.patch Patch4: iscsi-initiator-utils-use-red-hat-for-name.patch
# Add a lib for use by anaconda. # Add a lib for use by anaconda.
Patch3: iscsi-initiator-utils-add-libiscsi.patch Patch5: iscsi-initiator-utils-add-libiscsi.patch
# Add bnx2i support. # Add bnx2i support.
Patch4: iscsi-initiator-utils-uip-mgmt.patch Patch6: iscsi-initiator-utils-uip-mgmt.patch
# disable isns for libiscsi (libiscsi does not support isns)
Patch5: iscsi-initiator-utils-disable-isns-for-lib.patch
# fix libiscsi get firmware sysfs init
Patch6: iscsi-initiator-utils-fix-lib-sysfs-init.patch
# fix race between uip and iscsid startup
Patch7: iscsi-initiator-utils-fix-uip-init-race.patch
# Don't compile iscsistart as static # Don't compile iscsistart as static
Patch8: iscsi-initiator-utils-dont-use-static.patch Patch7: iscsi-initiator-utils-dont-use-static.patch
# Remove the OFFLOAD_BOOT_SUPPORTED #ifdef.
Patch8: iscsi-initiator-utils-remove-the-offload-boot-supported-ifdef.patch
# brcm uio: handle the different iface_rec structures in iscsid and brcm.
Patch9: iscsi-initiator-utils-uio-handle-different-iface_rec.patch
# Document missing brcm arguments
Patch10: iscsi-initiator-utils-brcm-man.patch
# setup default ifaces for all ifaces in kernel
Patch11: iscsi-initiator-utils-fix-default-bindings.patch
# fix iscsiadm return value/msg when login fails
Patch12: iscsi-initiator-utils-fix-iscsiadm-return.patch
# don't use openssl-devel
Patch13: iscsi-initiator-utils-dont-use-openssl.patch
# sync uio to 0.7.0.14
Patch14: iscsi-initiator-utils-sync-uio-0.7.0.14.patch
# fix nl msglen
Patch15: iscsi-initiator-utils-fix-nlmsglen.patch
# fixes for offload iface support
Patch16: iscsi-initiator-utils-ofl-iface-fixes.patch
# fix ipv6 ibft/firmware boot
Patch17: iscsi-initiator-utils-fix-ipv6-boot.patch
# add rhel version info to iscsi tools
Patch18: iscsi-initiator-utils-add-rh-ver.patch
Group: System Environment/Daemons Group: System Environment/Daemons
@ -55,19 +75,29 @@ developing applications that use %{name}.
%prep %prep
%setup -q -n open-iscsi-2.0-872-rc4-bnx2i %setup -q -n open-iscsi-2.0-872-rc4-bnx2i
%patch0 -p1 -b .update-initscripts-and-docs %patch0 -p1 -b .sync-uio-0.7.0.8
%patch1 -p1 -b .use-var-for-config %patch1 -p1 -b .sync-iscsi
%patch2 -p1 -b .use-red-hat-for-name %patch2 -p1 -b .update-initscripts-and-docs
%patch3 -p1 -b .add-libiscsi %patch3 -p1 -b .use-var-for-config
%patch4 -p1 -b .uip-mgmt %patch4 -p1 -b .use-red-hat-for-name
%patch5 -p1 -b .disable-isns-for-lib %patch5 -p1 -b .add-libiscsi
%patch6 -p1 -b .fix-lib-sysfs-init %patch6 -p1 -b .uip-mgmt
%patch7 -p1 -b .fix-uip-init-race %patch7 -p1 -b .dont-use-static
%patch8 -p1 -b .dont-use-static %patch8 -p1 -b .remove-the-offload-boot-supported-ifdef
%patch9 -p1 -b .uio-handle-different-iface_rec
%patch10 -p1 -b .brcm-man
%patch11 -p1 -b .fix-default-bindings
%patch12 -p1 -b .fix-iscsiadm-return
%patch13 -p1 -b .dont-use-openssl
%patch14 -p1 -b .sync-uio-0.7.0.14
%patch15 -p1 -b .fix-nlmsglen
%patch16 -p1 -b .ofl-iface-fixes
%patch17 -p1 -b .fix-ipv6-boot
%patch18 -p1 -b .add-rh-ver
%build %build
cd utils/open-isns cd utils/open-isns
./configure ./configure --with-security=no
make OPTFLAGS="%{optflags}" make OPTFLAGS="%{optflags}"
cd ../../ cd ../../
make OPTFLAGS="%{optflags}" -C utils/sysdeps make OPTFLAGS="%{optflags}" -C utils/sysdeps
@ -75,6 +105,13 @@ make OPTFLAGS="%{optflags}" -C utils/fwparam_ibft
make OPTFLAGS="%{optflags}" -C usr make OPTFLAGS="%{optflags}" -C usr
make OPTFLAGS="%{optflags}" -C utils make OPTFLAGS="%{optflags}" -C utils
make OPTFLAGS="%{optflags}" -C libiscsi make OPTFLAGS="%{optflags}" -C libiscsi
cd iscsiuio
chmod u+x configure
./configure --enable-debug
make OPTFLAGS="%{optflags}"
cd ..
pushd libiscsi pushd libiscsi
python setup.py build python setup.py build
touch -r libiscsi.doxy html/* touch -r libiscsi.doxy html/*
@ -87,6 +124,7 @@ mkdir -p $RPM_BUILD_ROOT/sbin
mkdir -p ${RPM_BUILD_ROOT}%{_mandir}/man8 mkdir -p ${RPM_BUILD_ROOT}%{_mandir}/man8
mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d
mkdir -p $RPM_BUILD_ROOT/etc/iscsi mkdir -p $RPM_BUILD_ROOT/etc/iscsi
mkdir -p $RPM_BUILD_ROOT/etc/logrotate.d
mkdir -p $RPM_BUILD_ROOT/etc/NetworkManager/dispatcher.d mkdir -p $RPM_BUILD_ROOT/etc/NetworkManager/dispatcher.d
mkdir -p $RPM_BUILD_ROOT/var/lib/iscsi mkdir -p $RPM_BUILD_ROOT/var/lib/iscsi
mkdir -p $RPM_BUILD_ROOT/var/lib/iscsi/nodes mkdir -p $RPM_BUILD_ROOT/var/lib/iscsi/nodes
@ -108,6 +146,9 @@ install -p -m 644 doc/iscsid.8 $RPM_BUILD_ROOT/%{_mandir}/man8
install -p -m 644 etc/iscsid.conf $RPM_BUILD_ROOT%{_sysconfdir}/iscsi install -p -m 644 etc/iscsid.conf $RPM_BUILD_ROOT%{_sysconfdir}/iscsi
install -p -m 644 doc/iscsistart.8 $RPM_BUILD_ROOT/%{_mandir}/man8 install -p -m 644 doc/iscsistart.8 $RPM_BUILD_ROOT/%{_mandir}/man8
install -p -m 644 doc/iscsi-iname.8 $RPM_BUILD_ROOT/%{_mandir}/man8 install -p -m 644 doc/iscsi-iname.8 $RPM_BUILD_ROOT/%{_mandir}/man8
install -p -m 644 iscsiuio/docs/iscsiuio.8 $RPM_BUILD_ROOT/%{_mandir}/man8
install -p -m 644 iscsiuio/iscsiuiolog $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d
install -p -m 755 iscsiuio/src/unix/iscsiuio $RPM_BUILD_ROOT/sbin
install -p -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_initrddir}/iscsid install -p -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_initrddir}/iscsid
install -p -m 755 %{SOURCE2} $RPM_BUILD_ROOT%{_initrddir}/iscsi install -p -m 755 %{SOURCE2} $RPM_BUILD_ROOT%{_initrddir}/iscsi
@ -179,6 +220,7 @@ fi
%{_libdir}/libiscsi.so.0 %{_libdir}/libiscsi.so.0
%{python_sitearch}/libiscsimodule.so %{python_sitearch}/libiscsimodule.so
%{_mandir}/man8/* %{_mandir}/man8/*
%{_sysconfdir}/logrotate.d/iscsiuiolog
%files devel %files devel
%defattr(-,root,root,-) %defattr(-,root,root,-)
@ -187,6 +229,9 @@ fi
%{_includedir}/libiscsi.h %{_includedir}/libiscsi.h
%changelog %changelog
* Tue Oct 18 2011 Mike Christie <mcrhsit@redhat.com> 6.2.0.872.13
- Update iscsi tools.
* Sat Apr 30 2011 Hans de Goede <hdegoede@redhat.com> - 6.2.0.872-12 * Sat Apr 30 2011 Hans de Goede <hdegoede@redhat.com> - 6.2.0.872-12
- Change iscsi init scripts to check for networking being actually up, rather - Change iscsi init scripts to check for networking being actually up, rather
then for NetworkManager being started (#692230) then for NetworkManager being started (#692230)

View File

@ -26,6 +26,7 @@ exec=/sbin/iscsid
prog=iscsid prog=iscsid
config=/etc/iscsi/iscsid.conf config=/etc/iscsi/iscsid.conf
lockfile=/var/lock/subsys/$prog lockfile=/var/lock/subsys/$prog
iscsi_lockfile=/var/lock/subsys/iscsi
# FIXME this has a false positive for root on nfs # FIXME this has a false positive for root on nfs
root_is_iscsi() { root_is_iscsi() {
@ -33,18 +34,26 @@ root_is_iscsi() {
[[ "$rootopts" =~ "_netdev" ]] [[ "$rootopts" =~ "_netdev" ]]
} }
force_start() { start_iscsid() {
echo -n $"Starting $prog: " echo -n $"Starting $prog: "
modprobe -q iscsi_tcp modprobe -q iscsi_tcp
modprobe -q ib_iser modprobe -q ib_iser
modprobe -q cxgb3i modprobe -q cxgb3i
modprobe -q cxgb4i
modprobe -q bnx2i modprobe -q bnx2i
modprobe -q be2iscsi modprobe -q be2iscsi
daemon iscsiuio
daemon $prog daemon $prog
retval=$? retval=$?
echo echo
[ $retval -eq 0 ] && touch $lockfile touch $lockfile
return $retval }
force_start() {
start_iscsid
# a force start could imply the iscsi service is started due to how it
# lazy starts. We need to touch the lock file so it is shutdown later
touch $iscsi_lockfile
} }
use_discoveryd() { use_discoveryd() {
@ -69,7 +78,7 @@ start() {
# or if iscsid is managing the sessions. # or if iscsid is managing the sessions.
grep -qrs "node.startup = automatic" /var/lib/iscsi/nodes grep -qrs "node.startup = automatic" /var/lib/iscsi/nodes
if [ $? -eq 0 ] || root_is_iscsi || use_discoveryd ; then if [ $? -eq 0 ] || root_is_iscsi || use_discoveryd ; then
force_start start_iscsid
return $? return $?
fi fi
@ -81,7 +90,7 @@ stop() {
iscsiadm -k 0 2>/dev/null iscsiadm -k 0 2>/dev/null
fi fi
declare -a iparams=( $(iscsiadm -m session 2>/dev/null | egrep "tcp|iser|bnx2i|cxgb3i|be2iscsi") ) declare -a iparams=( $(iscsiadm -m session 2>/dev/null | egrep "tcp|iser|bnx2i|cxgb3i|cxgb4i|be2iscsi") )
if [[ -n "${iparams[*]}" ]]; then if [[ -n "${iparams[*]}" ]]; then
# We have active sessions, so don't stop iscsid!! # We have active sessions, so don't stop iscsid!!
echo -n $"Not stopping $prog: iscsi sessions still active" echo -n $"Not stopping $prog: iscsi sessions still active"
@ -93,21 +102,25 @@ stop() {
echo -n $"Stopping $prog: " echo -n $"Stopping $prog: "
iscsiadm -k 0 2>/dev/null iscsiadm -k 0 2>/dev/null
echo
killproc iscsiuio
rm -f /var/run/iscsiuio.pid
# only remove the iscsi drivers when offload is used # only remove the iscsi drivers when offload is used
rmmod bnx2i 2>/dev/null rmmod bnx2i 2>/dev/null
rmmod cnic 2>/dev/null rmmod cnic 2>/dev/null
rmmod cxgb3i 2>/dev/null rmmod cxgb3i 2>/dev/null
rmmod cxgb4i 2>/dev/null
modprobe -r be2iscsi 2>/dev/null # a bug in kobject netlink code will cause this to oops
# modprobe -r be2iscsi 2>/dev/null
modprobe -r ib_iser 2>/dev/null modprobe -r ib_iser 2>/dev/null
modprobe -r iscsi_tcp 2>/dev/null modprobe -r iscsi_tcp 2>/dev/null
success $"Stopping $prog"
rm -f $lockfile rm -f $lockfile
echo
return 0 return 0
} }
@ -122,7 +135,7 @@ restart() {
stop stop
# if iscsid was running then make sure it starts up # if iscsid was running then make sure it starts up
if [ "$use_force_start" -eq 0 ] ; then if [ "$use_force_start" -eq 0 ] ; then
force_start start_iscsid
else else
start start
fi fi

View File

@ -41,46 +41,77 @@ start() {
# if the network isn't up yet exit cleanly, NetworkManager will call us # if the network isn't up yet exit cleanly, NetworkManager will call us
# again when the network is up # again when the network is up
[ ! -f /var/lock/subsys/network ] && ! nm-online -x >/dev/null 2>&1 && exit 0 [ ! -f /var/lock/subsys/network ] && ! nm-online -x >/dev/null 2>&1 && exit 3
# if no nodes are setup to startup automatically exit cleanly # if no nodes are setup to startup automatically exit cleanly
grep -qrs "node.startup = automatic" /var/lib/iscsi/nodes grep -qrs "node.startup = automatic" /var/lib/iscsi/nodes
[ $? -eq 0 ] || exit 0 [ $? -eq 0 ] || exit 3
# this script is normally called from startup so log into # this script is normally called from startup so log into
# nodes marked node.startup=automatic # nodes marked node.startup=automatic
echo -n $"Starting $prog: " echo -n $"Starting $prog: "
$exec -m node --loginall=automatic 2>&1 > /dev/null | grep iscsiadm $exec -m node --loginall=automatic 2>&1 > /dev/null | grep iscsiadm
# Ignore return code, because this command attempts to log into
# <sigh> iscsiadm does not always give a non 0 exit status in case of # multiple sessions and some sessions could get logged into and
# error so we grep for any messages to stderr and see those as errors too # some could be down temporarily.
if [ ${PIPESTATUS[0]} -ne 0 -o ${PIPESTATUS[1]} -eq 0 ]; then
failure $"Starting $prog"
echo
return 1
fi
success $"Starting $prog" success $"Starting $prog"
touch $lockfile touch $lockfile
echo echo
return 0 return 0
} }
stop() { iscsi_sessions_running() {
echo -n $"Stopping $prog: " declare -a iparams=( $(iscsiadm -m session 2>/dev/null | egrep "tcp|iser|bnx2i|be2iscsi|cxgb3i|cxgb4i") )
$exec -m node --logoutall=automatic 2>&1 > /dev/null | grep iscsiadm if [[ -z "${iparams[*]}" ]]; then
# no sessions
return 2
fi
# <sigh> iscsiadm does not always give a non 0 exit status in case of return 0
# error so we grep for any messages to stderr and see those as errors too }
if [ ${PIPESTATUS[0]} -ne 0 -o ${PIPESTATUS[1]} -eq 0 ]; then
cleanup_successful_stop() {
success $"Stopping $prog"
rm -f $lockfile
echo
}
stop() {
# Don't turn off iscsi if root is possibly on a iscsi disk.
rootopts=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $4; }}' /etc/mtab)
if [[ "$rootopts" =~ "_netdev" ]] ; then
echo $"Can not shutdown iSCSI. Root is on a iSCSI disk."
# Just clean up lock file if this is a system shutdown/reboot.
if [ "$RUNLEVEL" = "6" -o "$RUNLEVEL" = "0" -o "$RUNLEVEL" = "1" ]; then
rm -f $lockfile
fi
exit 1
fi
echo -n $"Stopping $prog: "
if ! iscsi_sessions_running ; then
cleanup_successful_stop
return 0
fi
if [ "$RUNLEVEL" = "6" -o "$RUNLEVEL" = "0" -o "$RUNLEVEL" = "1" ]; then
$exec -m node --logoutall=all 2>&1 > /dev/null
else
$exec -m node --logoutall=automatic 2>&1 > /dev/null
fi
ret=$?
# ignore ISCSI_ERR_NO_OBJS_FOUND/21
if [[ "$ret" -ne 0 && "$ret" -ne 21 ]]; then
failure $"Stopping $prog" failure $"Stopping $prog"
echo echo
return 1 return 1
fi fi
success $"Stopping $prog" cleanup_successful_stop
rm -f $lockfile
echo
return 0 return 0
} }
@ -98,14 +129,16 @@ force_reload() {
} }
rh_status() { rh_status() {
[ -f $lockfile ] || return 3 [ -f $lockfile ] || { echo $"$prog is stopped" ; return 3 ; }
declare -a iparams=( $(iscsiadm -m session 2>/dev/null | egrep "tcp|iser|bnx2i|be2iscsi|cxgb3i") ) declare -a iparams=( $(iscsiadm -m session 2>/dev/null | egrep "tcp|iser|bnx2i|be2iscsi|cxgb3i|cxgb4i") )
if [[ -z "${iparams[*]}" ]]; then if [[ -z "${iparams[*]}" ]]; then
# no sessions # no sessions
echo $"No active sessions"
return 2 return 2
fi fi
iscsiadm -m session -P 3
return 0 return 0
} }
@ -120,7 +153,6 @@ case "$1" in
$1 $1
;; ;;
stop) stop)
rh_status_q || exit 0
$1 $1
;; ;;
restart) restart)