parent
0cb2caa6b0
commit
05db5ec53a
@ -1 +1,2 @@
|
||||
open-iscsi-2.0-870.1.tar.gz
|
||||
open-iscsi-2.0-871.1.1-bnx2i.tar.gz
|
||||
|
@ -1,7 +1,75 @@
|
||||
diff -urN open-iscsi-2.0-870.1.orig/libiscsi/Makefile open-iscsi-2.0-870.1/libiscsi/Makefile
|
||||
--- open-iscsi-2.0-870.1.orig/libiscsi/Makefile 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ open-iscsi-2.0-870.1/libiscsi/Makefile 2009-01-28 14:28:54.000000000 +0100
|
||||
@@ -0,0 +1,54 @@
|
||||
From 2a2342c706783fc3cfd1dac7710dd8d8de835ebc Mon Sep 17 00:00:00 2001
|
||||
From: Mike Christie <michaelc@cs.wisc.edu>
|
||||
Date: Fri, 15 Jan 2010 03:08:06 -0600
|
||||
Subject: [PATCH] Add userspace libiscsi
|
||||
|
||||
---
|
||||
Makefile | 2 +
|
||||
libiscsi/Makefile | 64 ++
|
||||
libiscsi/libiscsi.c | 562 ++++++++++
|
||||
libiscsi/libiscsi.doxy | 1473 +++++++++++++++++++++++++++
|
||||
libiscsi/libiscsi.h | 343 +++++++
|
||||
libiscsi/pylibiscsi.c | 624 ++++++++++++
|
||||
libiscsi/setup.py | 9 +
|
||||
libiscsi/tests/test_discovery_firmware.c | 53 +
|
||||
libiscsi/tests/test_discovery_sendtargets.c | 60 ++
|
||||
libiscsi/tests/test_get_auth.c | 70 ++
|
||||
libiscsi/tests/test_get_initiator_name.c | 38 +
|
||||
libiscsi/tests/test_get_network_config.c | 45 +
|
||||
libiscsi/tests/test_login.c | 52 +
|
||||
libiscsi/tests/test_logout.c | 51 +
|
||||
libiscsi/tests/test_params.c | 103 ++
|
||||
libiscsi/tests/test_set_auth.c | 58 ++
|
||||
usr/discovery.c | 1 +
|
||||
usr/iscsi_ipc.h | 2 +
|
||||
usr/iscsiadm.c | 3 +-
|
||||
usr/iscsid.c | 10 +-
|
||||
usr/iscsistart.c | 3 +-
|
||||
usr/log.c | 65 +-
|
||||
usr/log.h | 9 +-
|
||||
23 files changed, 3660 insertions(+), 40 deletions(-)
|
||||
create mode 100644 libiscsi/Makefile
|
||||
create mode 100644 libiscsi/libiscsi.c
|
||||
create mode 100644 libiscsi/libiscsi.doxy
|
||||
create mode 100644 libiscsi/libiscsi.h
|
||||
create mode 100644 libiscsi/pylibiscsi.c
|
||||
create mode 100644 libiscsi/setup.py
|
||||
create mode 100644 libiscsi/tests/test_discovery_firmware.c
|
||||
create mode 100644 libiscsi/tests/test_discovery_sendtargets.c
|
||||
create mode 100644 libiscsi/tests/test_get_auth.c
|
||||
create mode 100644 libiscsi/tests/test_get_initiator_name.c
|
||||
create mode 100644 libiscsi/tests/test_get_network_config.c
|
||||
create mode 100644 libiscsi/tests/test_login.c
|
||||
create mode 100644 libiscsi/tests/test_logout.c
|
||||
create mode 100644 libiscsi/tests/test_params.c
|
||||
create mode 100644 libiscsi/tests/test_set_auth.c
|
||||
|
||||
diff --git a/Makefile b/Makefile
|
||||
index 7bd1e2f..a02cb96 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -31,6 +31,7 @@ user: ;
|
||||
$(MAKE) -C utils/fwparam_ibft
|
||||
$(MAKE) -C usr
|
||||
$(MAKE) -C utils
|
||||
+ $(MAKE) -C libiscsi
|
||||
@echo
|
||||
@echo "Compilation complete Output file"
|
||||
@echo "----------------------------------- ----------------"
|
||||
@@ -52,6 +53,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..a9598fa
|
||||
--- /dev/null
|
||||
+++ b/libiscsi/Makefile
|
||||
@@ -0,0 +1,64 @@
|
||||
+# This Makefile will work only with GNU make.
|
||||
+
|
||||
+OSNAME=$(shell uname -s)
|
||||
@ -14,14 +82,15 @@ diff -urN open-iscsi-2.0-870.1.orig/libiscsi/Makefile open-iscsi-2.0-870.1/libis
|
||||
+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 = util.o io.o auth.o login.o log.o md5.o sha1.o iface.o idbm.o sysdeps.o sysfs.o iscsi_sysfs.o
|
||||
+FW_PARAM_SRCS = fwparam_ibft.o fw_entry.o prom_lex.o prom_parse.tab.o fwparam_ppc.o fwparam_ibft_sysfs.o
|
||||
+ISCSI_LIB_SRCS = session_info.o 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
|
||||
+FW_PARAM_SRCS = fw_entry.o prom_lex.o prom_parse.tab.o fwparam_ppc.o fwparam_ibft_sysfs.o
|
||||
+
|
||||
+# sources shared with the userspace utils, note we build these separately
|
||||
+# to get PIC versions.
|
||||
+USR_OBJS = $(patsubst %.o, usr-objs/%.o, $(ISCSI_LIB_SRCS) strings.o \
|
||||
+discovery.o)
|
||||
+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
|
||||
@ -32,34 +101,45 @@ diff -urN open-iscsi-2.0-870.1.orig/libiscsi/Makefile open-iscsi-2.0-870.1/libis
|
||||
+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 $@
|
||||
+
|
||||
+libuip-objs/%.o: ../offload/libuip/%.c
|
||||
+ mkdir -p libuip-objs
|
||||
+ $(CC) $(CFLAGS) -c $< -o $@
|
||||
+
|
||||
+fw-objs/%.o: ../utils/fwparam_ibft/%.c
|
||||
+ mkdir -p fw-objs
|
||||
+ $(CC) $(CFLAGS) -c $< -o $@
|
||||
+
|
||||
+$(LIB): $(USR_OBJS) $(FW_OBJS) libiscsi.o
|
||||
+$(LIB): $(COMMON_OBJS) $(FW_OBJS) $(USR_OBJS) libiscsi.o
|
||||
+ $(CC) $(CFLAGS) -shared -Wl,-soname,$(LIB) $^ -o $@
|
||||
+ ln -s -f $(LIB) libiscsi.so
|
||||
+
|
||||
+$(TESTS): $(USR_OBJS) $(LIB)
|
||||
+$(TESTS): $(FW_OBJS) $(COMMON_OBJS) $(USR_OBJS) $(LIB)
|
||||
+
|
||||
+html: libiscsi.h libiscsi.doxy
|
||||
+ doxygen libiscsi.doxy
|
||||
+
|
||||
+clean:
|
||||
+ rm -rf *.o usr-objs fw-objs libiscsi.so* .depend *~ html $(TESTS) tests/*~
|
||||
+ 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 -urN open-iscsi-2.0-870.1.orig/libiscsi/libiscsi.c open-iscsi-2.0-870.1/libiscsi/libiscsi.c
|
||||
--- open-iscsi-2.0-870.1.orig/libiscsi/libiscsi.c 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ open-iscsi-2.0-870.1/libiscsi/libiscsi.c 2009-01-28 14:22:55.000000000 +0100
|
||||
@@ -0,0 +1,567 @@
|
||||
diff --git a/libiscsi/libiscsi.c b/libiscsi/libiscsi.c
|
||||
new file mode 100644
|
||||
index 0000000..4324619
|
||||
--- /dev/null
|
||||
+++ b/libiscsi/libiscsi.c
|
||||
@@ -0,0 +1,562 @@
|
||||
+/*
|
||||
+ * iSCSI Administration library
|
||||
+ *
|
||||
@ -88,10 +168,11 @@ diff -urN open-iscsi-2.0-870.1.orig/libiscsi/libiscsi.c open-iscsi-2.0-870.1/lib
|
||||
+#include <sys/syslog.h>
|
||||
+#include "libiscsi.h"
|
||||
+#include "idbm.h"
|
||||
+#include "iscsiadm.h"
|
||||
+#include "discovery.h"
|
||||
+#include "log.h"
|
||||
+#include "sysfs.h"
|
||||
+#include "iscsi_sysfs.h"
|
||||
+#include "session_info.h"
|
||||
+#include "util.h"
|
||||
+#include "sysdeps.h"
|
||||
+#include "iface.h"
|
||||
@ -163,12 +244,10 @@ diff -urN open-iscsi-2.0-870.1.orig/libiscsi/libiscsi.c open-iscsi-2.0-870.1/lib
|
||||
+ int *nr_found, struct libiscsi_node **found_nodes)
|
||||
+{
|
||||
+ struct discovery_rec drec;
|
||||
+ LIST_HEAD(new_rec_list);
|
||||
+ LIST_HEAD(bound_rec_list);
|
||||
+ struct node_rec *rec;
|
||||
+ int rc = 0, found = 0;
|
||||
+
|
||||
+ INIT_LIST_HEAD(&new_rec_list);
|
||||
+ INIT_LIST_HEAD(&bound_rec_list);
|
||||
+
|
||||
+ if (nr_found)
|
||||
@ -202,12 +281,10 @@ diff -urN open-iscsi-2.0-870.1.orig/libiscsi/libiscsi.c open-iscsi-2.0-870.1/lib
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ CHECK(discovery_sendtargets(&drec, &new_rec_list))
|
||||
+ CHECK(idbm_add_discovery(&drec, 1 /* overwrite existing records */))
|
||||
+ CHECK(idbm_add_discovery(&drec))
|
||||
+
|
||||
+ /* bind ifaces to node recs so we know what we have */
|
||||
+ list_for_each_entry(rec, &new_rec_list, list)
|
||||
+ CHECK(idbm_bind_ifaces_to_node(rec, NULL, &bound_rec_list))
|
||||
+ CHECK(idbm_bind_ifaces_to_nodes(discovery_sendtargets,
|
||||
+ &drec, NULL, &bound_rec_list))
|
||||
+
|
||||
+ /* now add/update records */
|
||||
+ list_for_each_entry(rec, &bound_rec_list, list) {
|
||||
@ -240,8 +317,6 @@ diff -urN open-iscsi-2.0-870.1.orig/libiscsi/libiscsi.c open-iscsi-2.0-870.1/lib
|
||||
+
|
||||
+leave:
|
||||
+ free_rec_list(&bound_rec_list);
|
||||
+ free_rec_list(&new_rec_list);
|
||||
+
|
||||
+ return rc;
|
||||
+}
|
||||
+
|
||||
@ -258,7 +333,7 @@ diff -urN open-iscsi-2.0-870.1.orig/libiscsi/libiscsi.c open-iscsi-2.0-870.1/lib
|
||||
+ *found_nodes = NULL;
|
||||
+
|
||||
+ memset(&fw_entry, 0, sizeof fw_entry);
|
||||
+ rc = fw_get_entry(&fw_entry, NULL);
|
||||
+ rc = fw_get_entry(&fw_entry);
|
||||
+ if (rc) {
|
||||
+ strcpy(context->error_str, "Could not read fw values.");
|
||||
+ return rc;
|
||||
@ -597,7 +672,7 @@ diff -urN open-iscsi-2.0-870.1.orig/libiscsi/libiscsi.c open-iscsi-2.0-870.1/lib
|
||||
+
|
||||
+ memset(config, 0, sizeof *config);
|
||||
+ memset(&fw_entry, 0, sizeof fw_entry);
|
||||
+ if (fw_get_entry(&fw_entry, NULL))
|
||||
+ if (fw_get_entry(&fw_entry))
|
||||
+ return ENODEV;
|
||||
+
|
||||
+ config->dhcp = strlen(fw_entry.dhcp) ? 1 : 0;
|
||||
@ -619,7 +694,7 @@ diff -urN open-iscsi-2.0-870.1.orig/libiscsi/libiscsi.c open-iscsi-2.0-870.1/lib
|
||||
+
|
||||
+ memset(initiatorname, 0, LIBISCSI_VALUE_MAXLEN);
|
||||
+ memset(&fw_entry, 0, sizeof fw_entry);
|
||||
+ if (fw_get_entry(&fw_entry, NULL))
|
||||
+ if (fw_get_entry(&fw_entry))
|
||||
+ return ENODEV;
|
||||
+
|
||||
+ strncpy(initiatorname, fw_entry.initiatorname,
|
||||
@ -627,9 +702,11 @@ diff -urN open-iscsi-2.0-870.1.orig/libiscsi/libiscsi.c open-iscsi-2.0-870.1/lib
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
diff -urN open-iscsi-2.0-870.1.orig/libiscsi/libiscsi.doxy open-iscsi-2.0-870.1/libiscsi/libiscsi.doxy
|
||||
--- open-iscsi-2.0-870.1.orig/libiscsi/libiscsi.doxy 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ open-iscsi-2.0-870.1/libiscsi/libiscsi.doxy 2009-01-28 10:26:36.000000000 +0100
|
||||
diff --git a/libiscsi/libiscsi.doxy b/libiscsi/libiscsi.doxy
|
||||
new file mode 100644
|
||||
index 0000000..663770f
|
||||
--- /dev/null
|
||||
+++ b/libiscsi/libiscsi.doxy
|
||||
@@ -0,0 +1,1473 @@
|
||||
+# Doxyfile 1.5.7.1
|
||||
+
|
||||
@ -2104,9 +2181,11 @@ diff -urN open-iscsi-2.0-870.1.orig/libiscsi/libiscsi.doxy open-iscsi-2.0-870.1/
|
||||
+# used. If set to NO the values of all tags below this one will be ignored.
|
||||
+
|
||||
+SEARCHENGINE = NO
|
||||
diff -urN open-iscsi-2.0-870.1.orig/libiscsi/libiscsi.h open-iscsi-2.0-870.1/libiscsi/libiscsi.h
|
||||
--- open-iscsi-2.0-870.1.orig/libiscsi/libiscsi.h 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ open-iscsi-2.0-870.1/libiscsi/libiscsi.h 2009-01-28 14:16:19.000000000 +0100
|
||||
diff --git a/libiscsi/libiscsi.h b/libiscsi/libiscsi.h
|
||||
new file mode 100644
|
||||
index 0000000..a7d05a5
|
||||
--- /dev/null
|
||||
+++ b/libiscsi/libiscsi.h
|
||||
@@ -0,0 +1,343 @@
|
||||
+/*
|
||||
+ * iSCSI Administration library
|
||||
@ -2451,10 +2530,12 @@ diff -urN open-iscsi-2.0-870.1.orig/libiscsi/libiscsi.h open-iscsi-2.0-870.1/lib
|
||||
+#endif /* __cplusplus */
|
||||
+
|
||||
+#endif
|
||||
diff -urN open-iscsi-2.0-870.1.orig/libiscsi/pylibiscsi.c open-iscsi-2.0-870.1/libiscsi/pylibiscsi.c
|
||||
--- open-iscsi-2.0-870.1.orig/libiscsi/pylibiscsi.c 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ open-iscsi-2.0-870.1/libiscsi/pylibiscsi.c 2009-01-28 14:49:03.000000000 +0100
|
||||
@@ -0,0 +1,615 @@
|
||||
diff --git a/libiscsi/pylibiscsi.c b/libiscsi/pylibiscsi.c
|
||||
new file mode 100644
|
||||
index 0000000..454a26a
|
||||
--- /dev/null
|
||||
+++ b/libiscsi/pylibiscsi.c
|
||||
@@ -0,0 +1,624 @@
|
||||
+/*
|
||||
+ * iSCSI Administration library
|
||||
+ *
|
||||
@ -2942,19 +3023,28 @@ diff -urN open-iscsi-2.0-870.1.orig/libiscsi/pylibiscsi.c open-iscsi-2.0-870.1/l
|
||||
+ char *kwlist[] = {"address", "port", "authinfo", NULL};
|
||||
+ const char *address = NULL;
|
||||
+ int i, nr_found, port = 3260;
|
||||
+ PyIscsiChapAuthInfo *pyauthinfo = NULL;
|
||||
+ PyObject *authinfo_arg = NULL;
|
||||
+ const struct libiscsi_auth_info *authinfo = NULL;
|
||||
+ struct libiscsi_node *found_nodes;
|
||||
+ PyObject* found_node_list;
|
||||
+
|
||||
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "s|iO!",
|
||||
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "s|iO",
|
||||
+ kwlist, &address, &port,
|
||||
+ &PyIscsiChapAuthInfo_Type,
|
||||
+ &pyauthinfo))
|
||||
+ &authinfo_arg))
|
||||
+ return NULL;
|
||||
+
|
||||
+ if (pyauthinfo)
|
||||
+ authinfo = &pyauthinfo->info;
|
||||
+ if (authinfo_arg) {
|
||||
+ if (PyObject_IsInstance(authinfo_arg, (PyObject *)
|
||||
+ &PyIscsiChapAuthInfo_Type)) {
|
||||
+ PyIscsiChapAuthInfo *pyauthinfo =
|
||||
+ (PyIscsiChapAuthInfo *)authinfo_arg;
|
||||
+ authinfo = &pyauthinfo->info;
|
||||
+ } else if (authinfo_arg != Py_None) {
|
||||
+ PyErr_SetString(PyExc_ValueError,
|
||||
+ "invalid authinfo type");
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (libiscsi_discover_sendtargets(context, address, port, authinfo,
|
||||
+ &nr_found, &found_nodes)) {
|
||||
@ -3070,9 +3160,11 @@ diff -urN open-iscsi-2.0-870.1.orig/libiscsi/pylibiscsi.c open-iscsi-2.0-870.1/l
|
||||
+ Py_INCREF(&PyIscsiNode_Type);
|
||||
+ PyModule_AddObject(m, "node", (PyObject *) &PyIscsiNode_Type);
|
||||
+}
|
||||
diff -urN open-iscsi-2.0-870.1.orig/libiscsi/setup.py open-iscsi-2.0-870.1/libiscsi/setup.py
|
||||
--- open-iscsi-2.0-870.1.orig/libiscsi/setup.py 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ open-iscsi-2.0-870.1/libiscsi/setup.py 2009-01-28 10:26:36.000000000 +0100
|
||||
diff --git a/libiscsi/setup.py b/libiscsi/setup.py
|
||||
new file mode 100644
|
||||
index 0000000..bb4329b
|
||||
--- /dev/null
|
||||
+++ b/libiscsi/setup.py
|
||||
@@ -0,0 +1,9 @@
|
||||
+from distutils.core import setup, Extension
|
||||
+
|
||||
@ -3083,9 +3175,11 @@ diff -urN open-iscsi-2.0-870.1.orig/libiscsi/setup.py open-iscsi-2.0-870.1/libis
|
||||
+
|
||||
+setup (name = 'PyIscsi',version = '1.0',
|
||||
+ description = 'libiscsi python bindings', ext_modules = [module1])
|
||||
diff -urN open-iscsi-2.0-870.1.orig/libiscsi/tests/test_discovery_firmware.c open-iscsi-2.0-870.1/libiscsi/tests/test_discovery_firmware.c
|
||||
--- open-iscsi-2.0-870.1.orig/libiscsi/tests/test_discovery_firmware.c 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ open-iscsi-2.0-870.1/libiscsi/tests/test_discovery_firmware.c 2009-01-28 10:26:36.000000000 +0100
|
||||
diff --git a/libiscsi/tests/test_discovery_firmware.c b/libiscsi/tests/test_discovery_firmware.c
|
||||
new file mode 100644
|
||||
index 0000000..76e852a
|
||||
--- /dev/null
|
||||
+++ b/libiscsi/tests/test_discovery_firmware.c
|
||||
@@ -0,0 +1,53 @@
|
||||
+/*
|
||||
+ * iSCSI Administration library
|
||||
@ -3140,9 +3234,11 @@ diff -urN open-iscsi-2.0-870.1.orig/libiscsi/tests/test_discovery_firmware.c ope
|
||||
+
|
||||
+ return rc;
|
||||
+}
|
||||
diff -urN open-iscsi-2.0-870.1.orig/libiscsi/tests/test_discovery_sendtargets.c open-iscsi-2.0-870.1/libiscsi/tests/test_discovery_sendtargets.c
|
||||
--- open-iscsi-2.0-870.1.orig/libiscsi/tests/test_discovery_sendtargets.c 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ open-iscsi-2.0-870.1/libiscsi/tests/test_discovery_sendtargets.c 2009-01-28 10:26:36.000000000 +0100
|
||||
diff --git a/libiscsi/tests/test_discovery_sendtargets.c b/libiscsi/tests/test_discovery_sendtargets.c
|
||||
new file mode 100644
|
||||
index 0000000..1a3c12e
|
||||
--- /dev/null
|
||||
+++ b/libiscsi/tests/test_discovery_sendtargets.c
|
||||
@@ -0,0 +1,60 @@
|
||||
+/*
|
||||
+ * iSCSI Administration library
|
||||
@ -3204,9 +3300,11 @@ diff -urN open-iscsi-2.0-870.1.orig/libiscsi/tests/test_discovery_sendtargets.c
|
||||
+
|
||||
+ return rc;
|
||||
+}
|
||||
diff -urN open-iscsi-2.0-870.1.orig/libiscsi/tests/test_get_auth.c open-iscsi-2.0-870.1/libiscsi/tests/test_get_auth.c
|
||||
--- open-iscsi-2.0-870.1.orig/libiscsi/tests/test_get_auth.c 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ open-iscsi-2.0-870.1/libiscsi/tests/test_get_auth.c 2009-01-28 14:30:25.000000000 +0100
|
||||
diff --git a/libiscsi/tests/test_get_auth.c b/libiscsi/tests/test_get_auth.c
|
||||
new file mode 100644
|
||||
index 0000000..5e234da
|
||||
--- /dev/null
|
||||
+++ b/libiscsi/tests/test_get_auth.c
|
||||
@@ -0,0 +1,70 @@
|
||||
+/*
|
||||
+ * iSCSI Administration library
|
||||
@ -3278,9 +3376,11 @@ diff -urN open-iscsi-2.0-870.1.orig/libiscsi/tests/test_get_auth.c open-iscsi-2.
|
||||
+
|
||||
+ return rc;
|
||||
+}
|
||||
diff -urN open-iscsi-2.0-870.1.orig/libiscsi/tests/test_get_initiator_name.c open-iscsi-2.0-870.1/libiscsi/tests/test_get_initiator_name.c
|
||||
--- open-iscsi-2.0-870.1.orig/libiscsi/tests/test_get_initiator_name.c 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ open-iscsi-2.0-870.1/libiscsi/tests/test_get_initiator_name.c 2009-01-28 10:26:36.000000000 +0100
|
||||
diff --git a/libiscsi/tests/test_get_initiator_name.c b/libiscsi/tests/test_get_initiator_name.c
|
||||
new file mode 100644
|
||||
index 0000000..997c053
|
||||
--- /dev/null
|
||||
+++ b/libiscsi/tests/test_get_initiator_name.c
|
||||
@@ -0,0 +1,38 @@
|
||||
+/*
|
||||
+ * iSCSI Administration library
|
||||
@ -3320,9 +3420,11 @@ diff -urN open-iscsi-2.0-870.1.orig/libiscsi/tests/test_get_initiator_name.c ope
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
diff -urN open-iscsi-2.0-870.1.orig/libiscsi/tests/test_get_network_config.c open-iscsi-2.0-870.1/libiscsi/tests/test_get_network_config.c
|
||||
--- open-iscsi-2.0-870.1.orig/libiscsi/tests/test_get_network_config.c 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ open-iscsi-2.0-870.1/libiscsi/tests/test_get_network_config.c 2009-01-28 10:26:36.000000000 +0100
|
||||
diff --git a/libiscsi/tests/test_get_network_config.c b/libiscsi/tests/test_get_network_config.c
|
||||
new file mode 100644
|
||||
index 0000000..2dedd61
|
||||
--- /dev/null
|
||||
+++ b/libiscsi/tests/test_get_network_config.c
|
||||
@@ -0,0 +1,45 @@
|
||||
+/*
|
||||
+ * iSCSI Administration library
|
||||
@ -3369,9 +3471,11 @@ diff -urN open-iscsi-2.0-870.1.orig/libiscsi/tests/test_get_network_config.c ope
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
diff -urN open-iscsi-2.0-870.1.orig/libiscsi/tests/test_login.c open-iscsi-2.0-870.1/libiscsi/tests/test_login.c
|
||||
--- open-iscsi-2.0-870.1.orig/libiscsi/tests/test_login.c 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ open-iscsi-2.0-870.1/libiscsi/tests/test_login.c 2009-01-28 14:29:13.000000000 +0100
|
||||
diff --git a/libiscsi/tests/test_login.c b/libiscsi/tests/test_login.c
|
||||
new file mode 100644
|
||||
index 0000000..3eb70d6
|
||||
--- /dev/null
|
||||
+++ b/libiscsi/tests/test_login.c
|
||||
@@ -0,0 +1,52 @@
|
||||
+/*
|
||||
+ * iSCSI Administration library
|
||||
@ -3425,9 +3529,11 @@ diff -urN open-iscsi-2.0-870.1.orig/libiscsi/tests/test_login.c open-iscsi-2.0-8
|
||||
+
|
||||
+ return rc;
|
||||
+}
|
||||
diff -urN open-iscsi-2.0-870.1.orig/libiscsi/tests/test_logout.c open-iscsi-2.0-870.1/libiscsi/tests/test_logout.c
|
||||
--- open-iscsi-2.0-870.1.orig/libiscsi/tests/test_logout.c 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ open-iscsi-2.0-870.1/libiscsi/tests/test_logout.c 2009-01-28 10:26:36.000000000 +0100
|
||||
diff --git a/libiscsi/tests/test_logout.c b/libiscsi/tests/test_logout.c
|
||||
new file mode 100644
|
||||
index 0000000..b734dca
|
||||
--- /dev/null
|
||||
+++ b/libiscsi/tests/test_logout.c
|
||||
@@ -0,0 +1,51 @@
|
||||
+/*
|
||||
+ * iSCSI Administration library
|
||||
@ -3480,9 +3586,11 @@ diff -urN open-iscsi-2.0-870.1.orig/libiscsi/tests/test_logout.c open-iscsi-2.0-
|
||||
+
|
||||
+ return rc;
|
||||
+}
|
||||
diff -urN open-iscsi-2.0-870.1.orig/libiscsi/tests/test_params.c open-iscsi-2.0-870.1/libiscsi/tests/test_params.c
|
||||
--- open-iscsi-2.0-870.1.orig/libiscsi/tests/test_params.c 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ open-iscsi-2.0-870.1/libiscsi/tests/test_params.c 2009-01-28 10:26:36.000000000 +0100
|
||||
diff --git a/libiscsi/tests/test_params.c b/libiscsi/tests/test_params.c
|
||||
new file mode 100644
|
||||
index 0000000..d3223be
|
||||
--- /dev/null
|
||||
+++ b/libiscsi/tests/test_params.c
|
||||
@@ -0,0 +1,103 @@
|
||||
+/*
|
||||
+ * iSCSI Administration library
|
||||
@ -3587,9 +3695,11 @@ diff -urN open-iscsi-2.0-870.1.orig/libiscsi/tests/test_params.c open-iscsi-2.0-
|
||||
+
|
||||
+ return rc;
|
||||
+}
|
||||
diff -urN open-iscsi-2.0-870.1.orig/libiscsi/tests/test_set_auth.c open-iscsi-2.0-870.1/libiscsi/tests/test_set_auth.c
|
||||
--- open-iscsi-2.0-870.1.orig/libiscsi/tests/test_set_auth.c 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ open-iscsi-2.0-870.1/libiscsi/tests/test_set_auth.c 2009-01-28 14:28:38.000000000 +0100
|
||||
diff --git a/libiscsi/tests/test_set_auth.c b/libiscsi/tests/test_set_auth.c
|
||||
new file mode 100644
|
||||
index 0000000..a21f888
|
||||
--- /dev/null
|
||||
+++ b/libiscsi/tests/test_set_auth.c
|
||||
@@ -0,0 +1,58 @@
|
||||
+/*
|
||||
+ * iSCSI Administration library
|
||||
@ -3649,112 +3759,56 @@ diff -urN open-iscsi-2.0-870.1.orig/libiscsi/tests/test_set_auth.c open-iscsi-2.
|
||||
+
|
||||
+ return rc;
|
||||
+}
|
||||
diff -urN open-iscsi-2.0-870.1.orig/usr/idbm.c open-iscsi-2.0-870.1/usr/idbm.c
|
||||
--- open-iscsi-2.0-870.1.orig/usr/idbm.c 2009-01-27 21:43:15.000000000 +0100
|
||||
+++ open-iscsi-2.0-870.1/usr/idbm.c 2009-01-28 13:42:37.000000000 +0100
|
||||
@@ -37,6 +37,7 @@
|
||||
#include "transport.h"
|
||||
#include "iscsi_sysfs.h"
|
||||
#include "iface.h"
|
||||
+#include "sysdeps.h"
|
||||
|
||||
#define IDBM_HIDE 0 /* Hide parameter when print. */
|
||||
#define IDBM_SHOW 1 /* Show parameter when print. */
|
||||
@@ -252,7 +253,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
-static void
|
||||
+void
|
||||
idbm_recinfo_node(node_rec_t *r, recinfo_t *ri)
|
||||
{
|
||||
int num = 0, i;
|
||||
@@ -545,6 +546,9 @@
|
||||
"unknown value format '%s' for "
|
||||
"parameter name '%s'",
|
||||
line_number, value, name);
|
||||
+ } else {
|
||||
+ log_error("unknown value format '%s' for "
|
||||
+ "parameter name '%s'", value, name);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -553,6 +557,8 @@
|
||||
return 1;
|
||||
|
||||
updated:
|
||||
+ strlcpy((char*)info[i].value, value, VALUE_MAXVAL);
|
||||
+
|
||||
#define check_password_param(_param) \
|
||||
if (!passwd_done && !strcmp(#_param, name)) { \
|
||||
passwd_done = 1; \
|
||||
@@ -1179,7 +1185,7 @@
|
||||
* This iterates over the ifaces in use in the nodes dir.
|
||||
* It does not iterate over the ifaces setup in /etc/iscsi/ifaces.
|
||||
*/
|
||||
-static int idbm_for_each_iface(int *found, void *data,
|
||||
+int idbm_for_each_iface(int *found, void *data,
|
||||
idbm_iface_op_fn *fn,
|
||||
char *targetname, int tpgt, char *ip, int port)
|
||||
{
|
||||
@@ -1223,6 +1229,7 @@
|
||||
|
||||
iface_dirfd = opendir(portal);
|
||||
if (!iface_dirfd) {
|
||||
+ log_error("iface iter could not read dir %s.", portal);
|
||||
rc = errno;
|
||||
goto free_portal;
|
||||
}
|
||||
diff -urN open-iscsi-2.0-870.1.orig/usr/idbm.h open-iscsi-2.0-870.1/usr/idbm.h
|
||||
--- open-iscsi-2.0-870.1.orig/usr/idbm.h 2009-01-27 21:43:16.000000000 +0100
|
||||
+++ open-iscsi-2.0-870.1/usr/idbm.h 2009-01-28 10:26:36.000000000 +0100
|
||||
@@ -92,6 +92,9 @@
|
||||
node_rec_t *match_rec;
|
||||
idbm_iface_op_fn *fn;
|
||||
diff --git a/usr/discovery.c b/usr/discovery.c
|
||||
index 9deb6f4..04fa6a2 100644
|
||||
--- a/usr/discovery.c
|
||||
+++ b/usr/discovery.c
|
||||
@@ -36,6 +36,7 @@
|
||||
#include "types.h"
|
||||
#include "iscsi_proto.h"
|
||||
#include "initiator.h"
|
||||
+#include "config.h"
|
||||
#include "log.h"
|
||||
#include "idbm.h"
|
||||
#include "iscsi_settings.h"
|
||||
diff --git a/usr/iscsi_ipc.h b/usr/iscsi_ipc.h
|
||||
index 74ef948..713914f 100644
|
||||
--- a/usr/iscsi_ipc.h
|
||||
+++ b/usr/iscsi_ipc.h
|
||||
@@ -111,4 +111,6 @@ struct iscsi_ipc {
|
||||
int (*recv_pdu_end) (struct iscsi_conn *conn);
|
||||
};
|
||||
+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,
|
||||
@@ -143,6 +146,7 @@
|
||||
extern int idbm_verify_param(recinfo_t *info, char *name);
|
||||
extern int idbm_rec_update_param(recinfo_t *info, char *name, char *value,
|
||||
int line_number);
|
||||
+extern void idbm_recinfo_node(node_rec_t *r, recinfo_t *ri);
|
||||
|
||||
enum {
|
||||
IDBM_PRINT_TYPE_DISCOVERY,
|
||||
diff -urN open-iscsi-2.0-870.1.orig/usr/iscsiadm.c open-iscsi-2.0-870.1/usr/iscsiadm.c
|
||||
--- open-iscsi-2.0-870.1.orig/usr/iscsiadm.c 2009-01-27 21:43:16.000000000 +0100
|
||||
+++ open-iscsi-2.0-870.1/usr/iscsiadm.c 2009-01-28 10:26:36.000000000 +0100
|
||||
@@ -2017,9 +2017,8 @@
|
||||
|
||||
+struct iscsi_ipc *ipc;
|
||||
+
|
||||
#endif /* ISCSI_IPC_H */
|
||||
diff --git a/usr/iscsiadm.c b/usr/iscsiadm.c
|
||||
index 2f3bfad..a797baf 100644
|
||||
--- a/usr/iscsiadm.c
|
||||
+++ b/usr/iscsiadm.c
|
||||
@@ -1722,8 +1722,7 @@ main(int argc, char **argv)
|
||||
umask(0177);
|
||||
|
||||
- /* enable stdout logging */
|
||||
/* enable stdout logging */
|
||||
- log_daemon = 0;
|
||||
- log_init(program_name, 1024);
|
||||
+ /* enable stderr logging */
|
||||
+ log_init(program_name, 1024, log_do_log_stderr, NULL);
|
||||
sysfs_init();
|
||||
|
||||
optopt = 0;
|
||||
diff -urN open-iscsi-2.0-870.1.orig/usr/iscsid.c open-iscsi-2.0-870.1/usr/iscsid.c
|
||||
--- open-iscsi-2.0-870.1.orig/usr/iscsid.c 2009-01-27 21:43:16.000000000 +0100
|
||||
+++ open-iscsi-2.0-870.1/usr/iscsid.c 2009-01-28 10:26:36.000000000 +0100
|
||||
@@ -48,7 +48,8 @@
|
||||
|
||||
diff --git a/usr/iscsid.c b/usr/iscsid.c
|
||||
index bfcca6e..ee68f6f 100644
|
||||
--- a/usr/iscsid.c
|
||||
+++ b/usr/iscsid.c
|
||||
@@ -52,6 +52,7 @@ struct iscsi_daemon_config *dconfig = &daemon_config;
|
||||
static char program_name[] = "iscsid";
|
||||
int control_fd, mgmt_ipc_fd;
|
||||
-static pid_t log_pid;
|
||||
+static pid_t log_pid = -1;
|
||||
static pid_t log_pid;
|
||||
+static int daemonize = 1;
|
||||
|
||||
extern char sysfs_file[];
|
||||
|
||||
@@ -276,7 +277,7 @@
|
||||
static struct option const long_options[] = {
|
||||
{"config", required_argument, NULL, 'c'},
|
||||
@@ -294,7 +295,7 @@ static void iscsid_exit(void)
|
||||
static void iscsid_shutdown(void)
|
||||
{
|
||||
log_warning("iscsid shutting down.");
|
||||
@ -3763,7 +3817,7 @@ diff -urN open-iscsi-2.0-870.1.orig/usr/iscsid.c open-iscsi-2.0-870.1/usr/iscsid
|
||||
log_debug(1, "daemon stopping");
|
||||
log_close(log_pid);
|
||||
fprintf(stderr, "done done\n");
|
||||
@@ -342,7 +343,7 @@
|
||||
@@ -360,7 +361,7 @@ int main(int argc, char *argv[])
|
||||
initiatorname_file = optarg;
|
||||
break;
|
||||
case 'f':
|
||||
@ -3772,7 +3826,7 @@ diff -urN open-iscsi-2.0-870.1.orig/usr/iscsid.c open-iscsi-2.0-870.1/usr/iscsid
|
||||
break;
|
||||
case 'd':
|
||||
log_level = atoi(optarg);
|
||||
@@ -370,7 +371,8 @@
|
||||
@@ -388,7 +389,8 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
/* initialize logger */
|
||||
@ -3782,7 +3836,7 @@ diff -urN open-iscsi-2.0-870.1.orig/usr/iscsid.c open-iscsi-2.0-870.1/usr/iscsid
|
||||
if (log_pid < 0)
|
||||
exit(1);
|
||||
|
||||
@@ -402,7 +404,7 @@
|
||||
@@ -420,7 +422,7 @@ int main(int argc, char *argv[])
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@ -3791,11 +3845,12 @@ diff -urN open-iscsi-2.0-870.1.orig/usr/iscsid.c open-iscsi-2.0-870.1/usr/iscsid
|
||||
char buf[64];
|
||||
int fd;
|
||||
|
||||
diff -urN open-iscsi-2.0-870.1.orig/usr/iscsistart.c open-iscsi-2.0-870.1/usr/iscsistart.c
|
||||
--- open-iscsi-2.0-870.1.orig/usr/iscsistart.c 2009-01-27 21:43:16.000000000 +0100
|
||||
+++ open-iscsi-2.0-870.1/usr/iscsistart.c 2009-01-28 10:26:36.000000000 +0100
|
||||
@@ -311,8 +311,7 @@
|
||||
}
|
||||
diff --git a/usr/iscsistart.c b/usr/iscsistart.c
|
||||
index 2080066..e2e4ce2 100644
|
||||
--- a/usr/iscsistart.c
|
||||
+++ b/usr/iscsistart.c
|
||||
@@ -255,8 +255,7 @@ int main(int argc, char *argv[])
|
||||
sigaction(SIGINT, &sa_new, &sa_old );
|
||||
|
||||
/* initialize logger */
|
||||
- log_daemon = 0;
|
||||
@ -3804,9 +3859,10 @@ diff -urN open-iscsi-2.0-870.1.orig/usr/iscsistart.c open-iscsi-2.0-870.1/usr/is
|
||||
|
||||
sysfs_init();
|
||||
if (iscsi_sysfs_check_class_version())
|
||||
diff -urN open-iscsi-2.0-870.1.orig/usr/log.c open-iscsi-2.0-870.1/usr/log.c
|
||||
--- open-iscsi-2.0-870.1.orig/usr/log.c 2008-11-22 18:06:46.000000000 +0100
|
||||
+++ open-iscsi-2.0-870.1/usr/log.c 2009-01-28 10:26:36.000000000 +0100
|
||||
diff --git a/usr/log.c b/usr/log.c
|
||||
index 908aac1..017cf9d 100644
|
||||
--- a/usr/log.c
|
||||
+++ b/usr/log.c
|
||||
@@ -32,10 +32,11 @@
|
||||
#endif
|
||||
|
||||
@ -3820,7 +3876,7 @@ diff -urN open-iscsi-2.0-870.1.orig/usr/log.c open-iscsi-2.0-870.1/usr/log.c
|
||||
|
||||
static void free_logarea (void)
|
||||
{
|
||||
@@ -258,35 +259,34 @@
|
||||
@@ -258,40 +259,39 @@ static void log_syslog (void * buff)
|
||||
syslog(msg->prio, "%s", (char *)&msg->str);
|
||||
}
|
||||
|
||||
@ -3828,23 +3884,31 @@ diff -urN open-iscsi-2.0-870.1.orig/usr/log.c open-iscsi-2.0-870.1/usr/log.c
|
||||
+void log_do_log_daemon(int prio, void *priv, const char *fmt, va_list ap)
|
||||
{
|
||||
- if (log_daemon) {
|
||||
- la->ops[0].sem_op = -1;
|
||||
- if (semop(la->semid, la->ops, 1) < 0) {
|
||||
- syslog(LOG_ERR, "semop up failed %d", errno);
|
||||
- struct sembuf ops[1];
|
||||
+ struct sembuf ops[1];
|
||||
|
||||
- ops[0].sem_num = la->ops[0].sem_num;
|
||||
- ops[0].sem_flg = la->ops[0].sem_flg;
|
||||
+ ops[0].sem_num = la->ops[0].sem_num;
|
||||
+ ops[0].sem_flg = la->ops[0].sem_flg;
|
||||
|
||||
- ops[0].sem_op = -1;
|
||||
- if (semop(la->semid, ops, 1) < 0) {
|
||||
- syslog(LOG_ERR, "semop down failed %d", errno);
|
||||
- return;
|
||||
- }
|
||||
+ la->ops[0].sem_op = -1;
|
||||
+ if (semop(la->semid, la->ops, 1) < 0) {
|
||||
+ syslog(LOG_ERR, "semop up failed %d", errno);
|
||||
+ ops[0].sem_op = -1;
|
||||
+ if (semop(la->semid, ops, 1) < 0) {
|
||||
+ syslog(LOG_ERR, "semop down failed %d", errno);
|
||||
+ return;
|
||||
+ }
|
||||
|
||||
- log_enqueue(prio, fmt, ap);
|
||||
+ log_enqueue(prio, fmt, ap);
|
||||
|
||||
- la->ops[0].sem_op = 1;
|
||||
- if (semop(la->semid, la->ops, 1) < 0) {
|
||||
- syslog(LOG_ERR, "semop down failed");
|
||||
- ops[0].sem_op = 1;
|
||||
- if (semop(la->semid, ops, 1) < 0) {
|
||||
- syslog(LOG_ERR, "semop up failed");
|
||||
- return;
|
||||
- }
|
||||
- } else {
|
||||
@ -3853,9 +3917,9 @@ diff -urN open-iscsi-2.0-870.1.orig/usr/log.c open-iscsi-2.0-870.1/usr/log.c
|
||||
- fprintf(stderr, "\n");
|
||||
- fflush(stderr);
|
||||
- }
|
||||
+ la->ops[0].sem_op = 1;
|
||||
+ if (semop(la->semid, la->ops, 1) < 0)
|
||||
+ syslog(LOG_ERR, "semop down failed");
|
||||
+ ops[0].sem_op = 1;
|
||||
+ if (semop(la->semid, ops, 1) < 0)
|
||||
+ syslog(LOG_ERR, "semop up failed");
|
||||
+}
|
||||
+
|
||||
+void log_do_log_stderr(int prio, void *priv, const char *fmt, va_list ap)
|
||||
@ -3875,7 +3939,7 @@ diff -urN open-iscsi-2.0-870.1.orig/usr/log.c open-iscsi-2.0-870.1/usr/log.c
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
@@ -294,7 +294,7 @@
|
||||
@@ -299,7 +299,7 @@ void log_error(const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
@ -3884,7 +3948,7 @@ diff -urN open-iscsi-2.0-870.1.orig/usr/log.c open-iscsi-2.0-870.1/usr/log.c
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
@@ -303,7 +303,7 @@
|
||||
@@ -308,7 +308,7 @@ void log_debug(int level, const char *fmt, ...)
|
||||
if (log_level > level) {
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
@ -3893,7 +3957,7 @@ diff -urN open-iscsi-2.0-870.1.orig/usr/log.c open-iscsi-2.0-870.1/usr/log.c
|
||||
va_end(ap);
|
||||
}
|
||||
}
|
||||
@@ -379,19 +379,23 @@
|
||||
@@ -389,19 +389,23 @@ static void catch_signal(int signo)
|
||||
|
||||
static void __log_close(void)
|
||||
{
|
||||
@ -3920,7 +3984,7 @@ diff -urN open-iscsi-2.0-870.1.orig/usr/log.c open-iscsi-2.0-870.1/usr/log.c
|
||||
struct sigaction sa_old;
|
||||
struct sigaction sa_new;
|
||||
pid_t pid;
|
||||
@@ -437,11 +441,12 @@
|
||||
@@ -447,11 +451,12 @@ int log_init(char *program_name, int size)
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -3934,9 +3998,10 @@ diff -urN open-iscsi-2.0-870.1.orig/usr/log.c open-iscsi-2.0-870.1/usr/log.c
|
||||
__log_close();
|
||||
return;
|
||||
}
|
||||
diff -urN open-iscsi-2.0-870.1.orig/usr/log.h open-iscsi-2.0-870.1/usr/log.h
|
||||
--- open-iscsi-2.0-870.1.orig/usr/log.h 2008-11-22 18:06:46.000000000 +0100
|
||||
+++ open-iscsi-2.0-870.1/usr/log.h 2009-01-28 10:26:36.000000000 +0100
|
||||
diff --git a/usr/log.h b/usr/log.h
|
||||
index 23b388e..af4019b 100644
|
||||
--- a/usr/log.h
|
||||
+++ b/usr/log.h
|
||||
@@ -26,6 +26,7 @@
|
||||
#ifndef LOG_H
|
||||
#define LOG_H
|
||||
@ -3944,8 +4009,8 @@ diff -urN open-iscsi-2.0-870.1.orig/usr/log.h open-iscsi-2.0-870.1/usr/log.h
|
||||
+#include <stdarg.h>
|
||||
#include "iscsid.h"
|
||||
|
||||
#if defined(Linux)
|
||||
@@ -41,7 +42,6 @@
|
||||
union semun {
|
||||
@@ -39,7 +40,6 @@ union semun {
|
||||
#define DEFAULT_AREA_SIZE 16384
|
||||
#define MAX_MSG_SIZE 256
|
||||
|
||||
@ -3953,7 +4018,7 @@ diff -urN open-iscsi-2.0-870.1.orig/usr/log.h open-iscsi-2.0-870.1/usr/log.h
|
||||
extern int log_level;
|
||||
|
||||
struct logmsg {
|
||||
@@ -67,7 +67,9 @@
|
||||
@@ -65,7 +65,9 @@ struct logarea {
|
||||
|
||||
struct logarea *la;
|
||||
|
||||
@ -3964,7 +4029,7 @@ diff -urN open-iscsi-2.0-870.1.orig/usr/log.h open-iscsi-2.0-870.1/usr/log.h
|
||||
extern void log_close (pid_t pid);
|
||||
extern void dump_logmsg (void *);
|
||||
extern void log_warning(const char *fmt, ...)
|
||||
@@ -77,4 +79,7 @@
|
||||
@@ -75,4 +77,7 @@ extern void log_error(const char *fmt, ...)
|
||||
extern void log_debug(int level, const char *fmt, ...)
|
||||
__attribute__ ((format (printf, 2, 3)));
|
||||
|
||||
@ -3972,3 +4037,6 @@ diff -urN open-iscsi-2.0-870.1.orig/usr/log.h open-iscsi-2.0-870.1/usr/log.h
|
||||
+extern void log_do_log_stderr(int prio, void *priv, const char *fmt, va_list ap);
|
||||
+
|
||||
#endif /* LOG_H */
|
||||
--
|
||||
1.6.5.2
|
||||
|
@ -1,312 +0,0 @@
|
||||
diff -Naurp open-iscsi-2.0-870-rc1/utils/fwparam_ibft/fw_entry.c open-iscsi-2.0-870-rc1.work/utils/fwparam_ibft/fw_entry.c
|
||||
--- open-iscsi-2.0-870-rc1/utils/fwparam_ibft/fw_entry.c 2008-06-30 20:14:03.000000000 -0500
|
||||
+++ open-iscsi-2.0-870-rc1.work/utils/fwparam_ibft/fw_entry.c 2008-06-30 21:21:57.000000000 -0500
|
||||
@@ -29,7 +29,8 @@ int fw_get_entry(struct boot_context *co
|
||||
|
||||
ret = fwparam_ppc(context, filepath);
|
||||
if (ret)
|
||||
- ret = fwparam_ibft(context, filepath);
|
||||
+ ret = fwparam_ibft_sysfs(context, filepath);
|
||||
+
|
||||
return ret;
|
||||
}
|
||||
|
||||
diff -Naurp open-iscsi-2.0-870-rc1/utils/fwparam_ibft/fwparam_ibft.h open-iscsi-2.0-870-rc1.work/utils/fwparam_ibft/fwparam_ibft.h
|
||||
--- open-iscsi-2.0-870-rc1/utils/fwparam_ibft/fwparam_ibft.h 2008-06-30 20:14:03.000000000 -0500
|
||||
+++ open-iscsi-2.0-870-rc1.work/utils/fwparam_ibft/fwparam_ibft.h 2008-06-30 21:21:57.000000000 -0500
|
||||
@@ -153,6 +153,7 @@ extern int dev_count;
|
||||
#define TARGET "target"
|
||||
|
||||
extern int fwparam_ibft(struct boot_context *context, const char *filepath);
|
||||
+extern int fwparam_ibft_sysfs(struct boot_context *context,
|
||||
+ const char *filepath);
|
||||
extern int fwparam_ppc(struct boot_context *context, const char *filepath);
|
||||
-
|
||||
#endif /* FWPARAM_IBFT_H_ */
|
||||
diff -Naurp open-iscsi-2.0-870-rc1/utils/fwparam_ibft/fwparam_ibft_sysfs.c open-iscsi-2.0-870-rc1.work/utils/fwparam_ibft/fwparam_ibft_sysfs.c
|
||||
--- open-iscsi-2.0-870-rc1/utils/fwparam_ibft/fwparam_ibft_sysfs.c 1969-12-31 18:00:00.000000000 -0600
|
||||
+++ open-iscsi-2.0-870-rc1.work/utils/fwparam_ibft/fwparam_ibft_sysfs.c 2008-06-30 21:21:57.000000000 -0500
|
||||
@@ -0,0 +1,271 @@
|
||||
+/*
|
||||
+ * Copyright (C) IBM Corporation. 2007
|
||||
+ * Author: Konrad Rzeszutek <konradr@linux.vnet.ibm.com>
|
||||
+ *
|
||||
+ * 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.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License
|
||||
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+ */
|
||||
+
|
||||
+#define _XOPEN_SOURCE 500
|
||||
+#include <ftw.h>
|
||||
+#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <string.h>
|
||||
+#include <unistd.h>
|
||||
+#include <fcntl.h>
|
||||
+#include <errno.h>
|
||||
+#include "fwparam_ibft.h"
|
||||
+#include <fw_context.h>
|
||||
+
|
||||
+#define IBFT_MAX 255
|
||||
+#define IBFT_SYSFS_ROOT "/sys/firmware/ibft/"
|
||||
+
|
||||
+static char *target_list[IBFT_MAX];
|
||||
+static char *nic_list[IBFT_MAX];
|
||||
+static int nic_cnt;
|
||||
+static int tgt_cnt;
|
||||
+
|
||||
+/*
|
||||
+ * Helper routines.
|
||||
+ */
|
||||
+static int file_exist(const char *file)
|
||||
+{
|
||||
+
|
||||
+ struct stat bootpath_stat;
|
||||
+
|
||||
+ return !stat(file, &bootpath_stat);
|
||||
+}
|
||||
+
|
||||
+static int read_file(const char *file, char **contents)
|
||||
+{
|
||||
+ int error, fd, bytes_read;
|
||||
+ struct stat bootpath_stat;
|
||||
+
|
||||
+ error = stat(file, &bootpath_stat);
|
||||
+ if (error < 0) {
|
||||
+ fprintf(stderr, "(%s:%d) stat %s, %s\n", __FILE__, __LINE__,
|
||||
+ file, strerror(errno));
|
||||
+ return error;
|
||||
+ }
|
||||
+
|
||||
+ *contents = malloc(bootpath_stat.st_size);
|
||||
+ if (!*contents) {
|
||||
+ error = ENOMEM;
|
||||
+ fprintf(stderr, "(%s:%d) Could not allocate enough memory for "\
|
||||
+ "%s: %s (%d)\n",
|
||||
+ __FILE__, __LINE__, file, strerror(error), error);
|
||||
+ return errno;
|
||||
+ }
|
||||
+
|
||||
+ fd = open(file, O_RDONLY);
|
||||
+ if (fd < 0) {
|
||||
+ fprintf(stderr, "(%s:%d): Could not open %s: %s (%d)\n",
|
||||
+ __FILE__, __LINE__, file, strerror(errno), errno);
|
||||
+ free(*contents);
|
||||
+ return errno;
|
||||
+ }
|
||||
+
|
||||
+ bytes_read = read(fd, *contents, bootpath_stat.st_size);
|
||||
+ close(fd);
|
||||
+ if (bytes_read > bootpath_stat.st_size) {
|
||||
+ fprintf(stderr, "(%s:%d) Read more data in than expected for "\
|
||||
+ "%s: %s (%d)\n",
|
||||
+ __FILE__, __LINE__, file, strerror(EIO), EIO);
|
||||
+ free(*contents);
|
||||
+ return errno;
|
||||
+ }
|
||||
+ /* chop() implementation */
|
||||
+ if (*(*contents + (ssize_t)(bytes_read - 1)) == '\n')
|
||||
+ *(*contents + (ssize_t) (bytes_read - 1)) = 0;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int read_data(const char *dir, const char *name, char *dst, ssize_t size)
|
||||
+{
|
||||
+ char *data = NULL;
|
||||
+ char file[FILENAMESZ];
|
||||
+ int rc = 0;
|
||||
+
|
||||
+ memset(file, 0, FILENAMESZ);
|
||||
+ strncat(file, dir, FILENAMESZ);
|
||||
+ strncat(file, name, FILENAMESZ);
|
||||
+
|
||||
+ if (file_exist(file)) {
|
||||
+ rc = read_file(file, &data);
|
||||
+ if (debug)
|
||||
+ fprintf(stderr, "(%s:%d) Read from %s:[%s]\n",
|
||||
+ __FILE__, __LINE__, file, data);
|
||||
+ if (!rc)
|
||||
+ memcpy(dst, data, size);
|
||||
+ free(data);
|
||||
+ }
|
||||
+
|
||||
+ return rc;
|
||||
+}
|
||||
+
|
||||
+static int read_int_data(const char *dir, const char *name, int *dst)
|
||||
+{
|
||||
+ int rc = 0;
|
||||
+ char contents[5]; /* The flag is a 1 byte value */
|
||||
+
|
||||
+ rc = read_data(dir, name, (char *)&contents, sizeof(contents));
|
||||
+ if (!rc)
|
||||
+ *dst = atoi(contents);
|
||||
+
|
||||
+ return rc;
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ * Finds the etherrnetX and targetX under the sysfs directory.
|
||||
+ */
|
||||
+static int find_sysfs_dirs(const char *fpath, const struct stat *sb,
|
||||
+ int tflag, struct FTW *ftw)
|
||||
+{
|
||||
+ if (tflag == FTW_D &&
|
||||
+ (strstr(fpath + ftw->base, "target")))
|
||||
+ target_list[tgt_cnt++] = strdup(fpath);
|
||||
+
|
||||
+ if (tflag == FTW_D &&
|
||||
+ (strstr(fpath + ftw->base, "ethernet")))
|
||||
+ nic_list[nic_cnt++] = strdup(fpath);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ * Routines to fill in the context values.
|
||||
+ */
|
||||
+static int fill_nic_context(const char *dir, struct boot_context *context)
|
||||
+{
|
||||
+ int rc = 0;
|
||||
+
|
||||
+ rc |= read_data(dir, "/mac", context->mac, sizeof(context->mac));
|
||||
+ rc |= read_data(dir, "/vlan", context->vlan, sizeof(context->vlan));
|
||||
+ rc |= read_data(dir, "/ip-addr", context->ipaddr,
|
||||
+ sizeof(context->ipaddr));
|
||||
+ rc |= read_data(dir, "/mask", context->mask, sizeof(context->mask));
|
||||
+
|
||||
+ return rc;
|
||||
+}
|
||||
+
|
||||
+static int fill_initiator_context(const char *dir, struct boot_context *context)
|
||||
+{
|
||||
+ int rc = 0;
|
||||
+
|
||||
+ rc |= read_data(dir, "/initiator-name", context->initiatorname,
|
||||
+ sizeof(context->initiatorname));
|
||||
+ rc |= read_data(dir, "/isns-server", context->isid,
|
||||
+ sizeof(context->isid));
|
||||
+
|
||||
+ return rc;
|
||||
+}
|
||||
+static int fill_tgt_context(const char *dir, struct boot_context *context)
|
||||
+{
|
||||
+ int rc = 0;
|
||||
+
|
||||
+ rc |= read_data(dir, "/target-name", context->targetname,
|
||||
+ sizeof(context->targetname));
|
||||
+ rc |= read_data(dir, "/ip-addr", context->target_ipaddr,
|
||||
+ sizeof(context->target_ipaddr));
|
||||
+ rc |= read_int_data(dir, "/port", &context->target_port);
|
||||
+ rc |= read_data(dir, "/lun", context->lun,
|
||||
+ sizeof(context->lun));
|
||||
+ rc |= read_data(dir, "/chap-name", context->chap_name,
|
||||
+ sizeof(context->chap_name));
|
||||
+ rc |= read_data(dir, "/chap-secret", context->chap_password,
|
||||
+ sizeof(context->chap_password));
|
||||
+ rc |= read_data(dir, "/rev-chap-name", context->chap_name_in,
|
||||
+ sizeof(context->chap_name_in));
|
||||
+ rc |= read_data(dir, "/rev-chap-name-secret", context->chap_password_in,
|
||||
+ sizeof(context->chap_password_in));
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+#define IBFT_SYSFS_FLAG_NAME "/flags"
|
||||
+#define IBFT_SYSFS_FLAG_FW_SEL_BOOT 2
|
||||
+
|
||||
+static int find_boot_flag(char *list[], ssize_t size, int *boot_idx)
|
||||
+{
|
||||
+ int rc = -1;
|
||||
+ int i, flag = -1;
|
||||
+
|
||||
+ for (i = 0; i < size; i++, flag = -1) {
|
||||
+ rc = read_int_data(list[i], IBFT_SYSFS_FLAG_NAME, &flag);
|
||||
+ if (flag & IBFT_SYSFS_FLAG_FW_SEL_BOOT) {
|
||||
+ *boot_idx = i;
|
||||
+ rc = 0;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ }
|
||||
+
|
||||
+ return rc;
|
||||
+}
|
||||
+
|
||||
+static void deallocate_lists(void)
|
||||
+{
|
||||
+ int i;
|
||||
+
|
||||
+ for (i = 0; i < nic_cnt; i++)
|
||||
+ free(nic_list[i]);
|
||||
+
|
||||
+ nic_cnt = 0;
|
||||
+ for (i = 0; i < tgt_cnt; i++)
|
||||
+ free(target_list[i]);
|
||||
+
|
||||
+ tgt_cnt = 0;
|
||||
+
|
||||
+}
|
||||
+
|
||||
+int fwparam_ibft_sysfs(struct boot_context *context, const char *filepath)
|
||||
+{
|
||||
+ char initiator_dir[FILENAMESZ];
|
||||
+ char *root_sysfs = NULL;
|
||||
+ int rc = 1;
|
||||
+ int nic_idx = -1, tgt_idx = -1;
|
||||
+
|
||||
+ if (filepath)
|
||||
+ root_sysfs = (char *)filepath;
|
||||
+ else
|
||||
+ root_sysfs = IBFT_SYSFS_ROOT;
|
||||
+
|
||||
+ memset(&initiator_dir, 0 , FILENAMESZ);
|
||||
+ strncat(initiator_dir, root_sysfs, FILENAMESZ);
|
||||
+ strncat(initiator_dir, "initiator", FILENAMESZ);
|
||||
+
|
||||
+ if (file_exist(initiator_dir)) {
|
||||
+
|
||||
+ /* Find the target's and the ethernet's */
|
||||
+ rc = nftw(root_sysfs, find_sysfs_dirs, 20, 1);
|
||||
+
|
||||
+ /* Find wihch target and which ethernet have
|
||||
+ the boot flag set. */
|
||||
+ rc = find_boot_flag(nic_list, nic_cnt, &nic_idx);
|
||||
+ if (rc)
|
||||
+ goto free;
|
||||
+
|
||||
+ rc = find_boot_flag(target_list, tgt_cnt, &tgt_idx);
|
||||
+ if (rc)
|
||||
+ goto free;
|
||||
+
|
||||
+ /* Fill in the context values */
|
||||
+ rc = fill_nic_context(nic_list[nic_idx], context);
|
||||
+ rc |= fill_tgt_context(target_list[tgt_idx], context);
|
||||
+ rc |= fill_initiator_context(initiator_dir, context);
|
||||
+ }
|
||||
+free:
|
||||
+ deallocate_lists();
|
||||
+ return rc;
|
||||
+}
|
||||
diff -Naurp open-iscsi-2.0-870-rc1/utils/fwparam_ibft/Makefile open-iscsi-2.0-870-rc1.work/utils/fwparam_ibft/Makefile
|
||||
--- open-iscsi-2.0-870-rc1/utils/fwparam_ibft/Makefile 2008-06-30 20:14:03.000000000 -0500
|
||||
+++ open-iscsi-2.0-870-rc1.work/utils/fwparam_ibft/Makefile 2008-06-30 21:22:44.000000000 -0500
|
||||
@@ -22,7 +22,7 @@
|
||||
#
|
||||
|
||||
OBJS := fwparam_ibft.o fw_entry.o
|
||||
-OBJS += prom_lex.o prom_parse.tab.o fwparam_ppc.o
|
||||
+OBJS += prom_lex.o prom_parse.tab.o fwparam_ppc.o fwparam_ibft_sysfs.o
|
||||
CLEANFILES = $(OBJS) *.output *~
|
||||
|
||||
OPTFLAGS ?= -O2 -g -fPIC
|
@ -1,16 +0,0 @@
|
||||
diff -up open-iscsi-2.0-870-rc1/usr/iscsiadm.c.error open-iscsi-2.0-870-rc1/usr/iscsiadm.c
|
||||
--- open-iscsi-2.0-870-rc1/usr/iscsiadm.c.error 2008-09-30 10:20:15.000000000 +0200
|
||||
+++ open-iscsi-2.0-870-rc1/usr/iscsiadm.c 2008-09-30 10:20:15.000000000 +0200
|
||||
@@ -2141,6 +2141,12 @@ main(int argc, char **argv)
|
||||
if (mode < 0)
|
||||
usage(0);
|
||||
|
||||
+ if (getuid()) {
|
||||
+ log_error("Must be run as root.");
|
||||
+ rc = -1;
|
||||
+ goto free_ifaces;
|
||||
+ }
|
||||
+
|
||||
if (mode == MODE_FW) {
|
||||
if ((rc = verify_mode_params(argc, argv, "ml", 0))) {
|
||||
log_error("fw mode: option '-%c' is not "
|
@ -1,219 +0,0 @@
|
||||
diff -aurp open-iscsi-2.0-870.1/include/fw_context.h open-iscsi-2.0-870.1.work/include/fw_context.h
|
||||
--- open-iscsi-2.0-870.1/include/fw_context.h 2008-11-22 11:06:46.000000000 -0600
|
||||
+++ open-iscsi-2.0-870.1.work/include/fw_context.h 2008-11-25 11:31:09.000000000 -0600
|
||||
@@ -23,21 +23,30 @@
|
||||
|
||||
struct boot_context {
|
||||
#define IQNSZ (223+1)
|
||||
+ /* target settings */
|
||||
int target_port;
|
||||
- char initiatorname[IQNSZ];
|
||||
char targetname[IQNSZ];
|
||||
char target_ipaddr[32];
|
||||
char chap_name[127];
|
||||
char chap_password[16];
|
||||
char chap_name_in[127];
|
||||
char chap_password_in[16];
|
||||
+
|
||||
+ /* initiator settings */
|
||||
+ char isid[10];
|
||||
+ char initiatorname[IQNSZ];
|
||||
+
|
||||
+ /* network settings */
|
||||
+ char dhcp[18];
|
||||
char iface[42];
|
||||
char mac[18];
|
||||
char ipaddr[18];
|
||||
+ char gateway[18];
|
||||
+ char primary_dns[18];
|
||||
+ char secondary_dns[18];
|
||||
char mask[18];
|
||||
char lun[17];
|
||||
char vlan[15];
|
||||
- char isid[10];
|
||||
};
|
||||
|
||||
extern int fw_get_entry(struct boot_context *context, const char *filepath);
|
||||
diff -aurp open-iscsi-2.0-870.1/utils/fwparam_ibft/fw_entry.c open-iscsi-2.0-870.1.work/utils/fwparam_ibft/fw_entry.c
|
||||
--- open-iscsi-2.0-870.1/utils/fwparam_ibft/fw_entry.c 2008-11-25 11:34:56.000000000 -0600
|
||||
+++ open-iscsi-2.0-870.1.work/utils/fwparam_ibft/fw_entry.c 2008-11-25 11:34:25.000000000 -0600
|
||||
@@ -34,22 +34,13 @@ int fw_get_entry(struct boot_context *co
|
||||
return ret;
|
||||
}
|
||||
|
||||
-/*
|
||||
- * Dump the 8 byte mac address
|
||||
- */
|
||||
-static void dump_mac(struct boot_context *context)
|
||||
-{
|
||||
- if (!strlen(context->mac))
|
||||
- return;
|
||||
-
|
||||
- printf("iface.hwaddress = %s\n", context->mac);
|
||||
-}
|
||||
-
|
||||
static void dump_initiator(struct boot_context *context)
|
||||
{
|
||||
- if (!strlen(context->initiatorname))
|
||||
- return;
|
||||
- printf("iface.initiatorname = %s\n", context->initiatorname);
|
||||
+ if (strlen(context->initiatorname))
|
||||
+ printf("iface.initiatorname = %s\n", context->initiatorname);
|
||||
+
|
||||
+ if (strlen(context->isid))
|
||||
+ printf("iface.isid = %s\n", context->isid);
|
||||
}
|
||||
|
||||
static void dump_target(struct boot_context *context)
|
||||
@@ -73,11 +64,44 @@ static void dump_target(struct boot_cont
|
||||
if (strlen(context->chap_password_in))
|
||||
printf("node.session.auth.password_in = %s\n",
|
||||
context->chap_password_in);
|
||||
+
|
||||
+ if (strlen(context->lun))
|
||||
+ printf("node.boot_lun = %s\n", context->lun);
|
||||
+}
|
||||
+
|
||||
+/* TODO: add defines for all the idbm strings in this file and add a macro */
|
||||
+static void dump_network(struct boot_context *context)
|
||||
+{
|
||||
+ /* Dump the 8 byte mac address (not iser support) */
|
||||
+ if (strlen(context->mac))
|
||||
+ printf("iface.hwaddress = %s\n", context->mac);
|
||||
+ /*
|
||||
+ * If this has a valid address then DHCP was used (broadcom sends
|
||||
+ * 0.0.0.0).
|
||||
+ */
|
||||
+ if (strlen(context->dhcp) && strcmp(context->dhcp, "0.0.0.0"))
|
||||
+ printf("iface.bootproto = DHCP\n");
|
||||
+ else
|
||||
+ printf("iface.bootproto = STATIC\n");
|
||||
+ if (strlen(context->ipaddr))
|
||||
+ printf("iface.ipaddress = %s\n", context->ipaddr);
|
||||
+ if (strlen(context->mask))
|
||||
+ printf("iface.subnet_mask = %s\n", context->mask);
|
||||
+ if (strlen(context->gateway))
|
||||
+ printf("iface.gateway = %s\n", context->gateway);
|
||||
+ if (strlen(context->primary_dns))
|
||||
+ printf("iface.primary_dns = %s\n", context->primary_dns);
|
||||
+ if (strlen(context->secondary_dns))
|
||||
+ printf("iface.secondary_dns = %s\n", context->secondary_dns);
|
||||
+ if (strlen(context->vlan))
|
||||
+ printf("iface.vlan = %s\n", context->vlan);
|
||||
+ if (strlen(context->iface))
|
||||
+ printf("iface.net_ifacename = %s\n", context->iface);
|
||||
}
|
||||
|
||||
void fw_print_entry(struct boot_context *context)
|
||||
{
|
||||
dump_initiator(context);
|
||||
- dump_mac(context);
|
||||
+ dump_network(context);
|
||||
dump_target(context);
|
||||
}
|
||||
diff -aurp open-iscsi-2.0-870.1/utils/fwparam_ibft/fwparam_ibft_sysfs.c open-iscsi-2.0-870.1.work/utils/fwparam_ibft/fwparam_ibft_sysfs.c
|
||||
--- open-iscsi-2.0-870.1/utils/fwparam_ibft/fwparam_ibft_sysfs.c 2008-11-25 11:34:56.000000000 -0600
|
||||
+++ open-iscsi-2.0-870.1.work/utils/fwparam_ibft/fwparam_ibft_sysfs.c 2008-11-25 11:31:09.000000000 -0600
|
||||
@@ -24,11 +24,15 @@
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
-#include "fwparam_ibft.h"
|
||||
+#include <dirent.h>
|
||||
#include <fw_context.h>
|
||||
+#include <sys/types.h>
|
||||
+
|
||||
+#include "fwparam_ibft.h"
|
||||
|
||||
#define IBFT_MAX 255
|
||||
#define IBFT_SYSFS_ROOT "/sys/firmware/ibft/"
|
||||
+#define IBFT_SYSFS_DE
|
||||
|
||||
static char *target_list[IBFT_MAX];
|
||||
static char *nic_list[IBFT_MAX];
|
||||
@@ -143,6 +147,48 @@ static int find_sysfs_dirs(const char *f
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static int get_iface_from_device(const char *eth_dir,
|
||||
+ struct boot_context *context)
|
||||
+{
|
||||
+ char dev_dir[FILENAMESZ];
|
||||
+ int rc = ENODEV;
|
||||
+ DIR *dirfd;
|
||||
+ struct dirent *dent;
|
||||
+
|
||||
+ memset(dev_dir, 0, FILENAMESZ);
|
||||
+ strncat(dev_dir, eth_dir, FILENAMESZ);
|
||||
+ strncat(dev_dir, "/device", FILENAMESZ);
|
||||
+
|
||||
+ if (!file_exist(dev_dir))
|
||||
+ return 0;
|
||||
+
|
||||
+ dirfd = opendir(dev_dir);
|
||||
+ if (!dirfd)
|
||||
+ return errno;
|
||||
+
|
||||
+ while ((dent = readdir(dirfd))) {
|
||||
+ if (!strcmp(dent->d_name, ".") || !strcmp(dent->d_name, ".."))
|
||||
+ continue;
|
||||
+
|
||||
+ if (strncmp(dent->d_name, "net:", 4))
|
||||
+ continue;
|
||||
+
|
||||
+ if ((strlen(dent->d_name) - 4) > (sizeof(context->iface) - 1)) {
|
||||
+ rc = EINVAL;
|
||||
+ printf("Net device %s too bug for iface buffer.\n",
|
||||
+ dent->d_name);
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ if (sscanf(dent->d_name, "net:%s", context->iface) != 1)
|
||||
+ rc = EINVAL;
|
||||
+ rc = 0;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ return rc;
|
||||
+}
|
||||
+
|
||||
/*
|
||||
* Routines to fill in the context values.
|
||||
*/
|
||||
@@ -154,7 +200,17 @@ static int fill_nic_context(const char *
|
||||
rc |= read_data(dir, "/vlan", context->vlan, sizeof(context->vlan));
|
||||
rc |= read_data(dir, "/ip-addr", context->ipaddr,
|
||||
sizeof(context->ipaddr));
|
||||
- rc |= read_data(dir, "/mask", context->mask, sizeof(context->mask));
|
||||
+ rc |= read_data(dir, "/subnet-mask", context->mask,
|
||||
+ sizeof(context->mask));
|
||||
+ rc |= read_data(dir, "/gateway", context->gateway,
|
||||
+ sizeof(context->gateway));
|
||||
+ rc |= read_data(dir, "/primary-dns", context->primary_dns,
|
||||
+ sizeof(context->primary_dns));
|
||||
+ rc |= read_data(dir, "/secondary-dns", context->secondary_dns,
|
||||
+ sizeof(context->secondary_dns));
|
||||
+ rc |= read_data(dir, "/dhcp", context->dhcp, sizeof(context->dhcp));
|
||||
+
|
||||
+ rc |= get_iface_from_device(dir, context);
|
||||
|
||||
return rc;
|
||||
}
|
||||
@@ -199,7 +255,7 @@ static int fill_tgt_context(const char *
|
||||
static int find_boot_flag(char *list[], ssize_t size, int *boot_idx)
|
||||
{
|
||||
int rc = -1;
|
||||
- int i, flag = -1;
|
||||
+ int i, flag = 0;
|
||||
|
||||
for (i = 0; i < size; i++, flag = -1) {
|
||||
rc = read_int_data(list[i], IBFT_SYSFS_FLAG_NAME, &flag);
|
||||
@@ -208,6 +264,8 @@ static int find_boot_flag(char *list[],
|
||||
rc = 0;
|
||||
break;
|
||||
}
|
||||
+ rc = -1;
|
||||
+ flag = 0;
|
||||
|
||||
}
|
||||
|
@ -1,202 +0,0 @@
|
||||
diff -up open-iscsi-2.0-870-rc1/usr/discovery.c.start-iscsid open-iscsi-2.0-870-rc1/usr/discovery.c
|
||||
--- open-iscsi-2.0-870-rc1/usr/discovery.c.start-iscsid 2008-07-01 03:14:03.000000000 +0200
|
||||
+++ open-iscsi-2.0-870-rc1/usr/discovery.c 2008-09-30 10:41:57.000000000 +0200
|
||||
@@ -87,7 +87,7 @@ int discovery_offload_sendtargets(int ho
|
||||
* and get back the results. We should do this since it would
|
||||
* allows us to then process the results like software iscsi.
|
||||
*/
|
||||
- rc = do_iscsid(&req, &rsp);
|
||||
+ rc = do_iscsid(&req, &rsp, 1);
|
||||
if (rc) {
|
||||
log_error("Could not offload sendtargets to %s.\n",
|
||||
drec->address);
|
||||
@@ -521,7 +521,7 @@ static int request_initiator_name(void)
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.command = MGMT_IPC_CONFIG_INAME;
|
||||
|
||||
- rc = do_iscsid(&req, &rsp);
|
||||
+ rc = do_iscsid(&req, &rsp, 1);
|
||||
if (rc)
|
||||
return EIO;
|
||||
|
||||
@@ -531,7 +531,7 @@ static int request_initiator_name(void)
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.command = MGMT_IPC_CONFIG_IALIAS;
|
||||
|
||||
- rc = do_iscsid(&req, &rsp);
|
||||
+ rc = do_iscsid(&req, &rsp, 0);
|
||||
if (rc)
|
||||
/* alias is optional so return ok */
|
||||
return 0;
|
||||
diff -up open-iscsi-2.0-870-rc1/usr/iscsiadm.c.start-iscsid open-iscsi-2.0-870-rc1/usr/iscsiadm.c
|
||||
--- open-iscsi-2.0-870-rc1/usr/iscsiadm.c.start-iscsid 2008-09-30 10:41:57.000000000 +0200
|
||||
+++ open-iscsi-2.0-870-rc1/usr/iscsiadm.c 2008-09-30 10:41:57.000000000 +0200
|
||||
@@ -191,7 +191,7 @@ static void kill_iscsid(int priority)
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.command = MGMT_IPC_IMMEDIATE_STOP;
|
||||
- rc = do_iscsid(&req, &rsp);
|
||||
+ rc = do_iscsid(&req, &rsp, 0);
|
||||
if (rc) {
|
||||
iscsid_handle_error(rc);
|
||||
log_error("Could not stop iscsid. Trying sending iscsid "
|
||||
@@ -823,7 +823,7 @@ static char *get_config_file(void)
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.command = MGMT_IPC_CONFIG_FILE;
|
||||
|
||||
- rc = do_iscsid(&req, &rsp);
|
||||
+ rc = do_iscsid(&req, &rsp, 1);
|
||||
if (rc)
|
||||
return NULL;
|
||||
|
||||
@@ -883,7 +883,7 @@ static int print_iscsi_state(int sid)
|
||||
req.command = MGMT_IPC_SESSION_INFO;
|
||||
req.u.session.sid = sid;
|
||||
|
||||
- err = do_iscsid(&req, &rsp);
|
||||
+ err = do_iscsid(&req, &rsp, 1);
|
||||
/*
|
||||
* for drivers like qla4xxx, iscsid does not display
|
||||
* anything here since it does not know about it.
|
||||
@@ -1151,7 +1151,7 @@ session_stats(void *data, struct session
|
||||
req.command = MGMT_IPC_SESSION_STATS;
|
||||
req.u.session.sid = info->sid;
|
||||
|
||||
- rc = do_iscsid(&req, &rsp);
|
||||
+ rc = do_iscsid(&req, &rsp, 1);
|
||||
if (rc)
|
||||
return EIO;
|
||||
|
||||
@@ -1617,7 +1617,7 @@ static int isns_dev_attr_query(discovery
|
||||
memset(&req, 0, sizeof(iscsiadm_req_t));
|
||||
req.command = MGMT_IPC_ISNS_DEV_ATTR_QUERY;
|
||||
|
||||
- err = do_iscsid(&req, &rsp);
|
||||
+ err = do_iscsid(&req, &rsp, 1);
|
||||
if (err) {
|
||||
iscsid_handle_error(err);
|
||||
return EIO;
|
||||
diff -up open-iscsi-2.0-870-rc1/usr/iscsid.c.start-iscsid open-iscsi-2.0-870-rc1/usr/iscsid.c
|
||||
--- open-iscsi-2.0-870-rc1/usr/iscsid.c.start-iscsid 2008-07-01 03:14:03.000000000 +0200
|
||||
+++ open-iscsi-2.0-870-rc1/usr/iscsid.c 2008-09-30 10:41:57.000000000 +0200
|
||||
@@ -252,7 +252,7 @@ static int sync_session(void *data, stru
|
||||
req.u.session.sid = info->sid;
|
||||
memcpy(&req.u.session.rec, &rec, sizeof(node_rec_t));
|
||||
|
||||
- do_iscsid(&req, &rsp);
|
||||
+ do_iscsid(&req, &rsp, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
diff -up open-iscsi-2.0-870-rc1/usr/iscsistart.c.start-iscsid open-iscsi-2.0-870-rc1/usr/iscsistart.c
|
||||
--- open-iscsi-2.0-870-rc1/usr/iscsistart.c.start-iscsid 2008-07-01 03:14:03.000000000 +0200
|
||||
+++ open-iscsi-2.0-870-rc1/usr/iscsistart.c 2008-09-30 10:41:57.000000000 +0200
|
||||
@@ -112,7 +112,7 @@ static int stop_event_loop(void)
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.command = MGMT_IPC_IMMEDIATE_STOP;
|
||||
- rc = do_iscsid(&req, &rsp);
|
||||
+ rc = do_iscsid(&req, &rsp, 0);
|
||||
if (rc) {
|
||||
iscsid_handle_error(rc);
|
||||
log_error("Could not stop event_loop\n");
|
||||
@@ -142,7 +142,7 @@ static int setup_session(void)
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.command = MGMT_IPC_SESSION_LOGIN;
|
||||
memcpy(&req.u.session.rec, &config_rec, sizeof(node_rec_t));
|
||||
- rc = do_iscsid(&req, &rsp);
|
||||
+ rc = do_iscsid(&req, &rsp, 0);
|
||||
if (rc)
|
||||
iscsid_handle_error(rc);
|
||||
|
||||
diff -up open-iscsi-2.0-870-rc1/usr/util.c.start-iscsid open-iscsi-2.0-870-rc1/usr/util.c
|
||||
--- open-iscsi-2.0-870-rc1/usr/util.c.start-iscsid 2008-07-01 03:14:03.000000000 +0200
|
||||
+++ open-iscsi-2.0-870-rc1/usr/util.c 2008-09-30 11:25:38.000000000 +0200
|
||||
@@ -120,7 +120,7 @@ int increase_max_files(void)
|
||||
|
||||
#define MAXSLEEP 128
|
||||
|
||||
-static mgmt_ipc_err_e iscsid_connect(int *fd)
|
||||
+static mgmt_ipc_err_e iscsid_connect(int *fd, int iscsid_start)
|
||||
{
|
||||
int nsec;
|
||||
struct sockaddr_un addr;
|
||||
@@ -145,8 +145,12 @@ static mgmt_ipc_err_e iscsid_connect(int
|
||||
|
||||
/* If iscsid isn't there, there's no sense
|
||||
* in retrying. */
|
||||
- if (errno == ECONNREFUSED)
|
||||
- break;
|
||||
+ if (errno == ECONNREFUSED) {
|
||||
+ if (iscsid_start && nsec == 1)
|
||||
+ system("/etc/rc.d/init.d/iscsid force-start");
|
||||
+ else
|
||||
+ break;
|
||||
+ }
|
||||
|
||||
/*
|
||||
* Delay before trying again
|
||||
@@ -158,11 +162,11 @@ static mgmt_ipc_err_e iscsid_connect(int
|
||||
return MGMT_IPC_ERR_ISCSID_COMM_ERR;
|
||||
}
|
||||
|
||||
-mgmt_ipc_err_e iscsid_request(int *fd, iscsiadm_req_t *req)
|
||||
+mgmt_ipc_err_e iscsid_request(int *fd, iscsiadm_req_t *req, int start_iscsid)
|
||||
{
|
||||
int err;
|
||||
|
||||
- err = iscsid_connect(fd);
|
||||
+ err = iscsid_connect(fd, start_iscsid);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
@@ -192,12 +196,13 @@ mgmt_ipc_err_e iscsid_response(int fd, i
|
||||
return iscsi_err;
|
||||
}
|
||||
|
||||
-mgmt_ipc_err_e do_iscsid(iscsiadm_req_t *req, iscsiadm_rsp_t *rsp)
|
||||
+mgmt_ipc_err_e do_iscsid(iscsiadm_req_t *req, iscsiadm_rsp_t *rsp,
|
||||
+ int start_iscsid)
|
||||
{
|
||||
int fd;
|
||||
mgmt_ipc_err_e err;
|
||||
|
||||
- err = iscsid_request(&fd, req);
|
||||
+ err = iscsid_request(&fd, req, start_iscsid);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
@@ -220,7 +225,7 @@ int iscsid_req_by_rec_async(iscsiadm_cmd
|
||||
req.command = cmd;
|
||||
memcpy(&req.u.session.rec, rec, sizeof(node_rec_t));
|
||||
|
||||
- return iscsid_request(fd, &req);
|
||||
+ return iscsid_request(fd, &req, 1);
|
||||
}
|
||||
|
||||
int iscsid_req_by_rec(iscsiadm_cmd_e cmd, node_rec_t *rec)
|
||||
@@ -241,7 +246,7 @@ int iscsid_req_by_sid_async(iscsiadm_cmd
|
||||
req.command = cmd;
|
||||
req.u.session.sid = sid;
|
||||
|
||||
- return iscsid_request(fd, &req);
|
||||
+ return iscsid_request(fd, &req, 1);
|
||||
}
|
||||
|
||||
int iscsid_req_by_sid(iscsiadm_cmd_e cmd, int sid)
|
||||
diff -up open-iscsi-2.0-870-rc1/usr/util.h.start-iscsid open-iscsi-2.0-870-rc1/usr/util.h
|
||||
--- open-iscsi-2.0-870-rc1/usr/util.h.start-iscsid 2008-07-01 03:14:03.000000000 +0200
|
||||
+++ open-iscsi-2.0-870-rc1/usr/util.h 2008-09-30 10:41:57.000000000 +0200
|
||||
@@ -13,9 +13,10 @@ extern int oom_adjust(void);
|
||||
extern void daemon_init(void);
|
||||
extern int increase_max_files(void);
|
||||
|
||||
-extern int do_iscsid(struct iscsiadm_req *req, struct iscsiadm_rsp *rsp);
|
||||
+extern int do_iscsid(struct iscsiadm_req *req, struct iscsiadm_rsp *rsp,
|
||||
+ int iscsid_start);
|
||||
extern void iscsid_handle_error(int err);
|
||||
-extern int iscsid_request(int *fd, struct iscsiadm_req *req);
|
||||
+extern int iscsid_request(int *fd, struct iscsiadm_req *req, int iscsid_start);
|
||||
extern int iscsid_response(int fd, int cmd, struct iscsiadm_rsp *rsp);
|
||||
extern int iscsid_req_wait(int cmd, int fd);
|
||||
extern int iscsid_req_by_rec_async(int cmd, struct node_rec *rec, int *fd);
|
377
iscsi-initiator-utils-uip-mgmt.patch
Normal file
377
iscsi-initiator-utils-uip-mgmt.patch
Normal file
@ -0,0 +1,377 @@
|
||||
diff -Naurp open-iscsi-2.0-871.1.1-bnx2i/usr/initiator.c open-iscsi-2.0-871.1.1-bnx2i.work/usr/initiator.c
|
||||
--- open-iscsi-2.0-871.1.1-bnx2i/usr/initiator.c 2010-01-15 02:24:02.000000000 -0600
|
||||
+++ open-iscsi-2.0-871.1.1-bnx2i.work/usr/initiator.c 2010-01-15 03:46:45.000000000 -0600
|
||||
@@ -45,6 +45,7 @@
|
||||
#include "iscsi_sysfs.h"
|
||||
#include "iscsi_settings.h"
|
||||
#include "iface.h"
|
||||
+#include "host.h"
|
||||
#include "sysdeps.h"
|
||||
|
||||
#define ISCSI_CONN_ERR_REOPEN_DELAY 3
|
||||
@@ -725,6 +726,38 @@ static int iscsi_conn_connect(struct isc
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static int __set_net_config(struct iscsi_transport *t,
|
||||
+ iscsi_session_t *session,
|
||||
+ struct iface_rec *iface)
|
||||
+{
|
||||
+ if (t->template->set_net_config) {
|
||||
+ /* uip needs the netdev name */
|
||||
+ struct host_info hinfo;
|
||||
+ int hostno, rc;
|
||||
+
|
||||
+ /* this assumes that the netdev or hw address is going to be
|
||||
+ set */
|
||||
+ hostno = iscsi_sysfs_get_host_no_from_hwinfo(iface, &rc);
|
||||
+ if (rc) {
|
||||
+ log_debug(4, "Couldn't get host no.\n");
|
||||
+ return rc;
|
||||
+ }
|
||||
+
|
||||
+ /* uip needs the netdev name */
|
||||
+ if (!strlen(iface->netdev)) {
|
||||
+ memset(&hinfo, 0, sizeof(hinfo));
|
||||
+ hinfo.host_no = hostno;
|
||||
+ iscsi_sysfs_get_hostinfo_by_host_no(&hinfo);
|
||||
+ strcpy(iface->netdev, hinfo.iface.netdev);
|
||||
+ }
|
||||
+
|
||||
+ return t->template->set_net_config(t, iface, session);
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
static void
|
||||
__session_conn_reopen(iscsi_conn_t *conn, queue_task_t *qtask, int do_stop,
|
||||
int redirected)
|
||||
@@ -766,6 +799,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 (__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;
|
||||
@@ -2108,6 +2146,10 @@ static int iface_set_param(struct iscsi_
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
+ rc = __set_net_config(t, session, iface);
|
||||
+ if (rc != 0)
|
||||
+ return rc;
|
||||
+
|
||||
rc = __iscsi_host_set_param(t, session->hostno,
|
||||
ISCSI_HOST_PARAM_IPADDRESS,
|
||||
iface->ipaddress, ISCSI_STRING);
|
||||
diff -Naurp open-iscsi-2.0-871.1.1-bnx2i/usr/Makefile open-iscsi-2.0-871.1.1-bnx2i.work/usr/Makefile
|
||||
--- open-iscsi-2.0-871.1.1-bnx2i/usr/Makefile 2010-01-15 02:24:02.000000000 -0600
|
||||
+++ open-iscsi-2.0-871.1.1-bnx2i.work/usr/Makefile 2010-01-15 04:07:30.000000000 -0600
|
||||
@@ -41,7 +41,7 @@ ISCSI_LIB_SRCS = util.o io.o auth.o logi
|
||||
$(SYSDEPS_SRCS)
|
||||
# core initiator files
|
||||
INITIATOR_SRCS = initiator.o scsi.o actor.o event_poll.o mgmt_ipc.o isns.o \
|
||||
- transport.o cxgb3i.o be2iscsi.o
|
||||
+ transport.o cxgb3i.o be2iscsi.o uip_mgmt_ipc.o
|
||||
# fw boot files
|
||||
FW_BOOT_SRCS = $(wildcard ../utils/fwparam_ibft/*.o)
|
||||
|
||||
diff -Naurp open-iscsi-2.0-871.1.1-bnx2i/usr/transport.c open-iscsi-2.0-871.1.1-bnx2i.work/usr/transport.c
|
||||
--- open-iscsi-2.0-871.1.1-bnx2i/usr/transport.c 2010-01-15 02:24:02.000000000 -0600
|
||||
+++ open-iscsi-2.0-871.1.1-bnx2i.work/usr/transport.c 2010-01-15 03:46:45.000000000 -0600
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "log.h"
|
||||
#include "util.h"
|
||||
#include "iscsi_sysfs.h"
|
||||
+#include "uip_mgmt_ipc.h"
|
||||
#include "cxgb3i.h"
|
||||
#include "be2iscsi.h"
|
||||
|
||||
@@ -58,6 +59,7 @@ struct iscsi_transport_template bnx2i =
|
||||
.ep_connect = ktransport_ep_connect,
|
||||
.ep_poll = ktransport_ep_poll,
|
||||
.ep_disconnect = ktransport_ep_disconnect,
|
||||
+ .set_net_config = uip_broadcast_params,
|
||||
};
|
||||
|
||||
struct iscsi_transport_template be2iscsi = {
|
||||
diff -Naurp open-iscsi-2.0-871.1.1-bnx2i/usr/transport.h open-iscsi-2.0-871.1.1-bnx2i.work/usr/transport.h
|
||||
--- open-iscsi-2.0-871.1.1-bnx2i/usr/transport.h 2010-01-15 02:24:02.000000000 -0600
|
||||
+++ open-iscsi-2.0-871.1.1-bnx2i.work/usr/transport.h 2010-01-15 03:46:45.000000000 -0600
|
||||
@@ -35,6 +35,9 @@ struct iscsi_transport_template {
|
||||
int (*ep_poll) (struct iscsi_conn *conn, int timeout_ms);
|
||||
void (*ep_disconnect) (struct iscsi_conn *conn);
|
||||
void (*create_conn) (struct iscsi_conn *conn);
|
||||
+ int (*set_net_config) (struct iscsi_transport *t,
|
||||
+ struct iface_rec *iface,
|
||||
+ struct iscsi_session *session);
|
||||
};
|
||||
|
||||
/* represents data path provider */
|
||||
diff -Naurp open-iscsi-2.0-871.1.1-bnx2i/usr/uip_mgmt_ipc.c open-iscsi-2.0-871.1.1-bnx2i.work/usr/uip_mgmt_ipc.c
|
||||
--- open-iscsi-2.0-871.1.1-bnx2i/usr/uip_mgmt_ipc.c 1969-12-31 18:00:00.000000000 -0600
|
||||
+++ open-iscsi-2.0-871.1.1-bnx2i.work/usr/uip_mgmt_ipc.c 2010-01-15 03:46:45.000000000 -0600
|
||||
@@ -0,0 +1,41 @@
|
||||
+/*
|
||||
+ * uIP iSCSI Daemon/Admin Management IPC
|
||||
+ *
|
||||
+ * 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.
|
||||
+ */
|
||||
+
|
||||
+#include <string.h>
|
||||
+
|
||||
+#include "log.h"
|
||||
+#include "uip_mgmt_ipc.h"
|
||||
+#include "util.h"
|
||||
+
|
||||
+int uip_broadcast_params(struct iscsi_transport *t,
|
||||
+ struct iface_rec *iface,
|
||||
+ struct iscsi_session *session)
|
||||
+{
|
||||
+ struct iscsid_uip_broadcast broadcast;
|
||||
+
|
||||
+ log_debug(3, "broadcasting to uip\n");
|
||||
+
|
||||
+ memset(&broadcast, 0, sizeof(broadcast));
|
||||
+
|
||||
+ broadcast.header.command = ISCSID_UIP_IPC_GET_IFACE;
|
||||
+ broadcast.header.payload_len = sizeof(*iface);
|
||||
+
|
||||
+ memcpy(&broadcast.u.iface_rec, iface, sizeof(*iface));
|
||||
+
|
||||
+ return uip_broadcast(&broadcast,
|
||||
+ sizeof(iscsid_uip_broadcast_header_t) +
|
||||
+ sizeof(*iface));
|
||||
+}
|
||||
diff -Naurp open-iscsi-2.0-871.1.1-bnx2i/usr/uip_mgmt_ipc.h open-iscsi-2.0-871.1.1-bnx2i.work/usr/uip_mgmt_ipc.h
|
||||
--- open-iscsi-2.0-871.1.1-bnx2i/usr/uip_mgmt_ipc.h 1969-12-31 18:00:00.000000000 -0600
|
||||
+++ open-iscsi-2.0-871.1.1-bnx2i.work/usr/uip_mgmt_ipc.h 2010-01-15 03:46:45.000000000 -0600
|
||||
@@ -0,0 +1,71 @@
|
||||
+/*
|
||||
+ * uIP iSCSI Daemon/Admin Management IPC
|
||||
+ *
|
||||
+ * 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 UIP_MGMT_IPC_H
|
||||
+#define UIP_MGMT_IPC_H
|
||||
+
|
||||
+#include "types.h"
|
||||
+#include "iscsi_if.h"
|
||||
+#include "config.h"
|
||||
+#include "mgmt_ipc.h"
|
||||
+
|
||||
+#include "initiator.h"
|
||||
+#include "transport.h"
|
||||
+
|
||||
+#define ISCSID_UIP_NAMESPACE "ISCSID_UIP_ABSTRACT_NAMESPACE"
|
||||
+
|
||||
+typedef enum iscsid_uip_cmd {
|
||||
+ ISCSID_UIP_IPC_UNKNOWN = 0,
|
||||
+ ISCSID_UIP_IPC_GET_IFACE = 1,
|
||||
+
|
||||
+ __ISCSID_UIP_IPC_MAX_COMMAND
|
||||
+} iscsid_uip_cmd_e;
|
||||
+
|
||||
+typedef struct iscsid_uip_broadcast_header {
|
||||
+ iscsid_uip_cmd_e command;
|
||||
+ uint32_t payload_len;
|
||||
+} iscsid_uip_broadcast_header_t;
|
||||
+
|
||||
+/* IPC Request */
|
||||
+typedef struct iscsid_uip_broadcast {
|
||||
+ struct iscsid_uip_broadcast_header header;
|
||||
+
|
||||
+ union {
|
||||
+ /* messages */
|
||||
+ struct ipc_broadcast_iface_rec {
|
||||
+ struct iface_rec rec;
|
||||
+ } iface_rec;
|
||||
+ } u;
|
||||
+} iscsid_uip_broadcast_t;
|
||||
+
|
||||
+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,
|
||||
+} iscsid_uip_mgmt_ipc_err_e;
|
||||
+
|
||||
+/* IPC Response */
|
||||
+typedef struct iscsid_uip_mgmt_rsp {
|
||||
+ iscsid_uip_cmd_e command;
|
||||
+ iscsid_uip_mgmt_ipc_err_e err;
|
||||
+} iscsid_uip_rsp_t;
|
||||
+
|
||||
+extern int uip_broadcast_params(struct iscsi_transport *t,
|
||||
+ struct iface_rec *iface,
|
||||
+ struct iscsi_session *session);
|
||||
+
|
||||
+
|
||||
+#endif /* UIP_MGMT_IPC_H */
|
||||
diff -Naurp open-iscsi-2.0-871.1.1-bnx2i/usr/util.c open-iscsi-2.0-871.1.1-bnx2i.work/usr/util.c
|
||||
--- open-iscsi-2.0-871.1.1-bnx2i/usr/util.c 2010-01-15 02:24:02.000000000 -0600
|
||||
+++ open-iscsi-2.0-871.1.1-bnx2i.work/usr/util.c 2010-01-15 04:05:49.000000000 -0600
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "idbm.h"
|
||||
#include "iface.h"
|
||||
#include "session_info.h"
|
||||
+#include "uip_mgmt_ipc.h"
|
||||
|
||||
void daemon_init(void)
|
||||
{
|
||||
@@ -201,7 +202,8 @@ static void iscsid_startup(void)
|
||||
|
||||
#define MAXSLEEP 128
|
||||
|
||||
-static mgmt_ipc_err_e iscsid_connect(int *fd, int start_iscsid)
|
||||
+static mgmt_ipc_err_e ipc_connect(int *fd, char *unix_sock_name,
|
||||
+ int start_iscsid)
|
||||
{
|
||||
int nsec;
|
||||
struct sockaddr_un addr;
|
||||
@@ -214,8 +216,8 @@ static mgmt_ipc_err_e iscsid_connect(int
|
||||
|
||||
memset(&addr, 0, sizeof(addr));
|
||||
addr.sun_family = AF_LOCAL;
|
||||
- memcpy((char *) &addr.sun_path + 1, ISCSIADM_NAMESPACE,
|
||||
- strlen(ISCSIADM_NAMESPACE));
|
||||
+ memcpy((char *) &addr.sun_path + 1, unix_sock_name,
|
||||
+ strlen(unix_sock_name));
|
||||
/*
|
||||
* Trying to connect with exponential backoff
|
||||
*/
|
||||
@@ -243,6 +245,11 @@ static mgmt_ipc_err_e iscsid_connect(int
|
||||
return MGMT_IPC_ERR_ISCSID_NOTCONN;
|
||||
}
|
||||
|
||||
+static mgmt_ipc_err_e iscsid_connect(int *fd, int 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 err;
|
||||
@@ -340,6 +347,72 @@ int iscsid_req_by_sid(iscsiadm_cmd_e cmd
|
||||
return iscsid_req_wait(cmd, fd);
|
||||
}
|
||||
|
||||
+static mgmt_ipc_err_e uip_connect(int *fd)
|
||||
+{
|
||||
+ return ipc_connect(fd, ISCSID_UIP_NAMESPACE, 0);
|
||||
+}
|
||||
+
|
||||
+int uip_broadcast(void *buf, size_t buf_len)
|
||||
+{
|
||||
+ int err;
|
||||
+ int fd;
|
||||
+ iscsid_uip_rsp_t rsp;
|
||||
+ int flags;
|
||||
+ int count;
|
||||
+
|
||||
+ err = uip_connect(&fd);
|
||||
+ if (err) {
|
||||
+ log_warning("uIP daemon is not up");
|
||||
+ return err;
|
||||
+ }
|
||||
+
|
||||
+ /* Send the data to uIP */
|
||||
+ if ((err = write(fd, buf, buf_len)) != buf_len) {
|
||||
+ log_error("got write error (%d/%d), daemon died?",
|
||||
+ err, errno);
|
||||
+ close(fd);
|
||||
+ return -EIO;
|
||||
+ }
|
||||
+
|
||||
+ /* 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);
|
||||
+ if (flags == -1)
|
||||
+ flags = 0;
|
||||
+ err = fcntl(fd, F_SETFL, flags | O_NONBLOCK);
|
||||
+ if(err != 0) {
|
||||
+ log_error("could not set uip broadcast to non-blocking: %d",
|
||||
+ errno);
|
||||
+ close(fd);
|
||||
+ return -EIO;
|
||||
+ }
|
||||
+
|
||||
+#define MAX_UIP_BROADCAST_READ_TRIES 3
|
||||
+ for(count = 0; count < MAX_UIP_BROADCAST_READ_TRIES; count++) {
|
||||
+ /* 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);
|
||||
+ break;
|
||||
+ } else if((err == -1) && (errno == EAGAIN)) {
|
||||
+ usleep(250000);
|
||||
+ continue;
|
||||
+ } else {
|
||||
+ log_error("Could not read response (%d/%d), daemon died?",
|
||||
+ err, errno);
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if(count == MAX_UIP_BROADCAST_READ_TRIES)
|
||||
+ log_error("Could not broadcast to uIP");
|
||||
+
|
||||
+ close(fd);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
void idbm_node_setup_defaults(node_rec_t *rec)
|
||||
{
|
||||
int i;
|
||||
diff -Naurp open-iscsi-2.0-871.1.1-bnx2i/usr/util.h open-iscsi-2.0-871.1.1-bnx2i.work/usr/util.h
|
||||
--- open-iscsi-2.0-871.1.1-bnx2i/usr/util.h 2010-01-15 02:24:02.000000000 -0600
|
||||
+++ open-iscsi-2.0-871.1.1-bnx2i.work/usr/util.h 2010-01-15 03:46:45.000000000 -0600
|
||||
@@ -36,4 +36,7 @@ extern int __iscsi_match_session(struct
|
||||
extern char *strstrip(char *s);
|
||||
extern char *get_global_string_param(char *pathname, const char *key);
|
||||
|
||||
+extern int uip_broadcast(void *buf, size_t buf_len);
|
||||
+
|
||||
+
|
||||
#endif
|
||||
diff -Naurp open-iscsi-2.0-871.1.1-bnx2i/utils/iscsi-iname.c open-iscsi-2.0-871.1.1-bnx2i.work/utils/iscsi-iname.c
|
||||
--- open-iscsi-2.0-871.1.1-bnx2i/utils/iscsi-iname.c 2010-01-15 03:50:49.000000000 -0600
|
||||
+++ open-iscsi-2.0-871.1.1-bnx2i.work/utils/iscsi-iname.c 2010-01-15 03:44:23.000000000 -0600
|
||||
@@ -73,7 +73,7 @@ main(int argc, char *argv[])
|
||||
exit(0);
|
||||
}
|
||||
} else {
|
||||
- prefix = "iqn.1994-05.com.redhat";
|
||||
+ prefix = "iqn.1994-05.com.fedora";
|
||||
}
|
||||
|
||||
/* try to feed some entropy from the pool to MD5 in order to get
|
@ -1,7 +1,20 @@
|
||||
diff -aurp open-iscsi-2.0-870-rc1/etc/iscsid.conf open-iscsi-2.0-870-rc1.work/etc/iscsid.conf
|
||||
--- open-iscsi-2.0-870-rc1/etc/iscsid.conf 2008-06-30 20:14:03.000000000 -0500
|
||||
+++ open-iscsi-2.0-870-rc1.work/etc/iscsid.conf 2008-06-30 21:08:29.000000000 -0500
|
||||
@@ -27,8 +27,8 @@
|
||||
diff -aurp open-iscsi-2.0-871.1.1-bnx2i/etc/iscsid.conf open-iscsi-2.0-871.1.1-bnx2i.work/etc/iscsid.conf
|
||||
--- open-iscsi-2.0-871.1.1-bnx2i/etc/iscsid.conf 2010-01-15 02:24:02.000000000 -0600
|
||||
+++ open-iscsi-2.0-871.1.1-bnx2i.work/etc/iscsid.conf 2010-01-15 03:42:00.000000000 -0600
|
||||
@@ -24,10 +24,10 @@
|
||||
# maintainers.
|
||||
#
|
||||
# Default for Fedora and RHEL. (uncomment to activate).
|
||||
-# iscsid.startup = /etc/rc.d/init.d/iscsid force-start
|
||||
+iscsid.startup = /etc/rc.d/init.d/iscsid force-start
|
||||
#
|
||||
# Default for upstream open-iscsi scripts (uncomment to activate).
|
||||
-iscsid.startup = /sbin/iscsid
|
||||
+# iscsid.startup = /sbin/iscsid
|
||||
|
||||
|
||||
#############################
|
||||
@@ -43,8 +43,8 @@ iscsid.startup = /sbin/iscsid
|
||||
# To request that the iscsi initd scripts startup a session set to "automatic".
|
||||
# node.startup = automatic
|
||||
#
|
||||
@ -12,10 +25,47 @@ diff -aurp open-iscsi-2.0-870-rc1/etc/iscsid.conf open-iscsi-2.0-870-rc1.work/et
|
||||
|
||||
# *************
|
||||
# CHAP Settings
|
||||
diff -aurp open-iscsi-2.0-870-rc1/README open-iscsi-2.0-870-rc1.work/README
|
||||
--- open-iscsi-2.0-870-rc1/README 2008-06-30 20:14:03.000000000 -0500
|
||||
+++ open-iscsi-2.0-870-rc1.work/README 2008-06-30 21:08:29.000000000 -0500
|
||||
@@ -78,11 +78,6 @@ the cache sync command will fail.
|
||||
@@ -252,29 +252,27 @@ node.conn[0].iscsi.MaxRecvDataSegmentLen
|
||||
discovery.sendtargets.iscsi.MaxRecvDataSegmentLength = 32768
|
||||
|
||||
# To allow the targets to control the setting of the digest checking,
|
||||
-# with the initiator requesting a preference of enabling the checking, uncomment# one or both of the following lines:
|
||||
+# with the initiator requesting a preference of enabling the checking, uncomment
|
||||
+# the following lines (Data digests are not supported and on ppc/ppc64
|
||||
+# both header and data digests are not supported.):
|
||||
#node.conn[0].iscsi.HeaderDigest = CRC32C,None
|
||||
-#node.conn[0].iscsi.DataDigest = CRC32C,None
|
||||
#
|
||||
# To allow the targets to control the setting of the digest checking,
|
||||
# with the initiator requesting a preference of disabling the checking,
|
||||
-# uncomment one or both of the following lines:
|
||||
+# uncomment the following lines:
|
||||
#node.conn[0].iscsi.HeaderDigest = None,CRC32C
|
||||
-#node.conn[0].iscsi.DataDigest = None,CRC32C
|
||||
#
|
||||
# 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 the following lines:
|
||||
#node.conn[0].iscsi.HeaderDigest = CRC32C
|
||||
-#node.conn[0].iscsi.DataDigest = CRC32C
|
||||
#
|
||||
# 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 the following lines:
|
||||
#node.conn[0].iscsi.HeaderDigest = None
|
||||
-#node.conn[0].iscsi.DataDigest = None
|
||||
#
|
||||
# The default is to never use DataDigests or HeaderDigests.
|
||||
#
|
||||
-
|
||||
+node.conn[0].iscsi.HeaderDigest = None
|
||||
|
||||
#************
|
||||
# Workarounds
|
||||
diff -aurp open-iscsi-2.0-871.1.1-bnx2i/README open-iscsi-2.0-871.1.1-bnx2i.work/README
|
||||
--- open-iscsi-2.0-871.1.1-bnx2i/README 2010-01-15 02:24:02.000000000 -0600
|
||||
+++ open-iscsi-2.0-871.1.1-bnx2i.work/README 2010-01-15 03:40:46.000000000 -0600
|
||||
@@ -75,11 +75,6 @@ the cache sync command will fail.
|
||||
- iscsiadm's -P 3 option will not print out scsi devices.
|
||||
- iscsid will not automatically online devices.
|
||||
|
||||
@ -27,7 +77,7 @@ diff -aurp open-iscsi-2.0-870-rc1/README open-iscsi-2.0-870-rc1.work/README
|
||||
By default the kernel source found at
|
||||
/lib/modules/`uname -a`/build
|
||||
will be used to compile the open-iscsi modules. To specify a different
|
||||
@@ -694,7 +689,7 @@ Red Hat or Fedora:
|
||||
@@ -799,7 +794,7 @@ Red Hat or Fedora:
|
||||
-----------------
|
||||
To start open-iscsi in Red Hat/Fedora you can do:
|
||||
|
||||
@ -36,7 +86,7 @@ diff -aurp open-iscsi-2.0-870-rc1/README open-iscsi-2.0-870-rc1.work/README
|
||||
|
||||
To get open-iscsi to automatically start at run time you may have to
|
||||
run:
|
||||
@@ -873,6 +868,8 @@ To login to all the automated nodes, sim
|
||||
@@ -978,6 +973,8 @@ To login to all the automated nodes, sim
|
||||
e.g /etc/init.d/open-iscsi restart. On your next startup the nodes will
|
||||
be logged into autmotically.
|
||||
|
||||
@ -45,3 +95,20 @@ diff -aurp open-iscsi-2.0-870-rc1/README open-iscsi-2.0-870-rc1.work/README
|
||||
|
||||
8. Advanced Configuration
|
||||
=========================
|
||||
diff -aurp open-iscsi-2.0-871.1.1-bnx2i/usr/idbm.c open-iscsi-2.0-871.1.1-bnx2i.work/usr/idbm.c
|
||||
--- open-iscsi-2.0-871.1.1-bnx2i/usr/idbm.c 2010-01-15 02:24:02.000000000 -0600
|
||||
+++ open-iscsi-2.0-871.1.1-bnx2i.work/usr/idbm.c 2010-01-15 03:40:46.000000000 -0600
|
||||
@@ -336,9 +336,13 @@ idbm_recinfo_node(node_rec_t *r, recinfo
|
||||
IDBM_SHOW, "None", "CRC32C", "CRC32C,None",
|
||||
"None,CRC32C", num, 1);
|
||||
sprintf(key, CONN_DATA_DIGEST, i);
|
||||
+
|
||||
+#if 0
|
||||
+We do not support data digests
|
||||
__recinfo_int_o4(key, ri, r, conn[i].iscsi.DataDigest, IDBM_SHOW,
|
||||
"None", "CRC32C", "CRC32C,None",
|
||||
"None,CRC32C", num, 1);
|
||||
+#endif
|
||||
sprintf(key, CONN_IFMARKER, i);
|
||||
__recinfo_int_o2(key, ri, r, conn[i].iscsi.IFMarker, IDBM_SHOW,
|
||||
"No", "Yes", num, 1);
|
||||
|
@ -1,11 +1,12 @@
|
||||
--- open-iscsi-2.0-865/utils/iscsi-iname.c 2007-02-21 12:20:47.000000000 -0600
|
||||
+++ open-iscsi-2.0-865.work/utils/iscsi-iname.c 2007-06-20 12:37:10.000000000 -0500
|
||||
@@ -72,7 +72,7 @@ main(int argc, char *argv[])
|
||||
diff -aurp open-iscsi-2.0-871.1.1-bnx2i/utils/iscsi-iname.c open-iscsi-2.0-871.1.1-bnx2i.work/utils/iscsi-iname.c
|
||||
--- open-iscsi-2.0-871.1.1-bnx2i/utils/iscsi-iname.c 2010-01-15 02:24:02.000000000 -0600
|
||||
+++ open-iscsi-2.0-871.1.1-bnx2i.work/utils/iscsi-iname.c 2010-01-15 03:44:23.000000000 -0600
|
||||
@@ -73,7 +73,7 @@ main(int argc, char *argv[])
|
||||
exit(0);
|
||||
}
|
||||
} else {
|
||||
- prefix = "iqn.2005-03.org.open-iscsi";
|
||||
+ prefix = "iqn.1994-05.com.fedora";
|
||||
+ prefix = "iqn.1994-05.com.redhat";
|
||||
}
|
||||
|
||||
/* try to feed some entropy from the pool to MD5 in order to get
|
||||
|
@ -1,16 +1,16 @@
|
||||
diff -aurp open-iscsi-2.0-870-rc1/doc/iscsiadm.8 open-iscsi-2.0-870-rc1.work/doc/iscsiadm.8
|
||||
--- open-iscsi-2.0-870-rc1/doc/iscsiadm.8 2008-06-30 20:14:03.000000000 -0500
|
||||
+++ open-iscsi-2.0-870-rc1.work/doc/iscsiadm.8 2008-06-30 21:36:44.000000000 -0500
|
||||
@@ -47,7 +47,7 @@ display help text and exit
|
||||
diff -aurp open-iscsi-2.0-871.1.1-bnx2i/doc/iscsiadm.8 open-iscsi-2.0-871.1.1-bnx2i.work/doc/iscsiadm.8
|
||||
--- open-iscsi-2.0-871.1.1-bnx2i/doc/iscsiadm.8 2010-01-15 02:24:02.000000000 -0600
|
||||
+++ open-iscsi-2.0-871.1.1-bnx2i.work/doc/iscsiadm.8 2010-01-15 03:43:24.000000000 -0600
|
||||
@@ -49,7 +49,7 @@ display help text and exit
|
||||
.TP
|
||||
\fB\-I\fR, \fB\-\-interface\fI[iface]\fR
|
||||
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 /var/lib/iscsi/ifaces. For hardware
|
||||
or the iface config must have the hardware address (iface.hwaddress)
|
||||
iSCSI (qla4xxx) the iface config must have the hardware address
|
||||
(iface.hwaddress = port's MAC address)
|
||||
and the driver/transport_name (iface.transport_name). The iface's name is
|
||||
then the filename of the iface config. For software iSCSI, the iface config
|
||||
@@ -317,10 +317,10 @@ The configuration file read by \fBiscsid
|
||||
@@ -320,10 +320,10 @@ The configuration file read by \fBiscsid
|
||||
The file containing the iSCSI InitiatorName and InitiatorAlias read by
|
||||
\fBiscsid\fR and \fBiscsiadm\fR on startup.
|
||||
.TP
|
||||
@ -23,10 +23,10 @@ diff -aurp open-iscsi-2.0-870-rc1/doc/iscsiadm.8 open-iscsi-2.0-870-rc1.work/doc
|
||||
This directory contains the portals.
|
||||
|
||||
.SH "SEE ALSO"
|
||||
diff -aurp open-iscsi-2.0-870-rc1/README open-iscsi-2.0-870-rc1.work/README
|
||||
--- open-iscsi-2.0-870-rc1/README 2008-06-30 21:37:05.000000000 -0500
|
||||
+++ open-iscsi-2.0-870-rc1.work/README 2008-06-30 21:36:44.000000000 -0500
|
||||
@@ -148,10 +148,10 @@ available on all Linux installations.
|
||||
diff -aurp open-iscsi-2.0-871.1.1-bnx2i/README open-iscsi-2.0-871.1.1-bnx2i.work/README
|
||||
--- open-iscsi-2.0-871.1.1-bnx2i/README 2010-01-15 03:43:42.000000000 -0600
|
||||
+++ open-iscsi-2.0-871.1.1-bnx2i.work/README 2010-01-15 03:43:24.000000000 -0600
|
||||
@@ -145,10 +145,10 @@ available on all Linux installations.
|
||||
|
||||
The database contains two tables:
|
||||
|
||||
@ -40,24 +40,24 @@ diff -aurp open-iscsi-2.0-870-rc1/README open-iscsi-2.0-870-rc1.work/README
|
||||
|
||||
The iscsiadm utility is a command-line tool to manage (update, delete,
|
||||
insert, query) the persistent database.
|
||||
@@ -327,7 +327,7 @@ a scsi_host per HBA port).
|
||||
@@ -349,7 +349,7 @@ a scsi_host per HBA port).
|
||||
To manage both types of initiator stacks, iscsiadm uses the interface (iface)
|
||||
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
|
||||
-a iface config /etc/iscsi/ifaces.
|
||||
+a iface config /var/lib/iscsi/ifaces.
|
||||
|
||||
When you run iscsiadm the first time a hardware iscsi driver like qla4xxx is
|
||||
loaded, iscsiadm will create default iface configs for you. The config created
|
||||
@@ -340,29 +340,29 @@ Running:
|
||||
iface0 qla4xxx,00:c0:dd:08:63:e8,default
|
||||
iface1 qla4xxx,00:c0:dd:08:63:ea,default
|
||||
Running:
|
||||
|
||||
@@ -357,29 +357,29 @@ Running:
|
||||
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
|
||||
|
||||
-Will report iface configurations that are setup in /etc/iscsi/ifaces.
|
||||
+Will report iface configurations that are setup in /var/lib/iscsi/ifaces.
|
||||
The format is:
|
||||
|
||||
iface_name transport_name,hwaddress,net_ifacename
|
||||
iface_name transport_name,hwaddress,ipaddress,net_ifacename,initiatorname
|
||||
|
||||
For software iscsi, you can create the iface configs by hand, but it is
|
||||
reccomended that you use iscsiadm's iface mode. There is a iface.example in
|
||||
@ -84,16 +84,34 @@ diff -aurp open-iscsi-2.0-870-rc1/README open-iscsi-2.0-870-rc1.work/README
|
||||
|
||||
iface.transport_name = tcp
|
||||
iface.hwaddress = 00:C0:DD:08:63:E7
|
||||
@@ -386,7 +386,7 @@ but you have not logged in then, iscsiad
|
||||
all existing bindings.
|
||||
@@ -428,7 +428,7 @@ iser iser,<empty>,<empty>,<empty>,<empty
|
||||
cxgb3i.00:07:43:05:97:07 cxgb3i,00:07:43:05:97:07,<empty>,<empty>,<empty>
|
||||
|
||||
When you then run iscsiadm to do discovery, it will check for interfaces
|
||||
-in /etc/iscsi/ifaces and bind the portals that are discovered so that
|
||||
+in /var/lib/iscsi/ifaces and bind the portals that are discovered so that
|
||||
they will be logged in through each iface. This behavior can also be overriden
|
||||
by passing in the interfaces you want to use. For example if you had defined
|
||||
two interface but only wanted to use one you can use the
|
||||
@@ -400,7 +400,7 @@ we do not bind a session to a iface, the
|
||||
|
||||
-Will report iface configurations that are setup in /etc/iscsi/ifaces.
|
||||
+Will report iface configurations that are setup in /var/lib/iscsi/ifaces.
|
||||
The format is:
|
||||
|
||||
iface_name transport_name,hwaddress,ipaddress,net_ifacename,initiatorname
|
||||
@@ -444,7 +444,7 @@ default one in /etc/iscsi/initiatorname.
|
||||
|
||||
|
||||
|
||||
-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
|
||||
@@ -482,7 +482,7 @@ need a seperate network connection to th
|
||||
*This will be fixed in the next version of open-iscsi*
|
||||
|
||||
For compatibility reasons, when you run iscsiadm to do discovery, it
|
||||
-will check for interfaces in /etc/iscsi/iscsi/ifaces that are using
|
||||
+will check for interfaces in /var/lib/iscsi/ifaces that are using
|
||||
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
|
||||
be overriden by passing in the interfaces you want to use. For the case
|
||||
@@ -500,7 +500,7 @@ we do not bind a session to a iface, the
|
||||
|
||||
iscsiadm -m discovery -t st -p ip:port -I default -P 1
|
||||
|
||||
@ -102,7 +120,7 @@ diff -aurp open-iscsi-2.0-870-rc1/README open-iscsi-2.0-870-rc1.work/README
|
||||
not pass anything into iscsiadm, running iscsiadm will do the default
|
||||
behavior, where we allow the network subsystem to decide which
|
||||
device to use.
|
||||
@@ -435,7 +435,7 @@ iscsiadm -m node -p ip:port -I iface0 --
|
||||
@@ -540,7 +540,7 @@ To now log into targets it is the same a
|
||||
|
||||
./iscsiadm -m discovery -t sendtargets -p 192.168.1.1:3260
|
||||
|
||||
@ -111,7 +129,7 @@ diff -aurp open-iscsi-2.0-870-rc1/README open-iscsi-2.0-870-rc1.work/README
|
||||
using software iscsi. If any are found then nodes found during
|
||||
discovery will be setup so that they can logged in through
|
||||
those interfaces.
|
||||
@@ -483,7 +483,7 @@ iscsiadm -m node -p ip:port -I iface0 --
|
||||
@@ -588,7 +588,7 @@ To now log into targets it is the same a
|
||||
existing portals.
|
||||
|
||||
- SendTargets iSCSI Discovery with a specific interface. If you
|
||||
@ -120,7 +138,7 @@ diff -aurp open-iscsi-2.0-870-rc1/README open-iscsi-2.0-870-rc1.work/README
|
||||
then you can pass them in during discovery:
|
||||
|
||||
./iscsiadm -m discovery -t sendtargets -p 192.168.1.1:3260 \
|
||||
@@ -768,8 +768,8 @@ where targetname is the name of the targ
|
||||
@@ -873,8 +873,8 @@ where targetname is the name of the targ
|
||||
and port of the portal. tpgt, is the portal group tag of
|
||||
the portal, and is not used in iscsiadm commands except for static
|
||||
record creation. And iface name is the name of the iscsi interface
|
||||
@ -131,10 +149,10 @@ diff -aurp open-iscsi-2.0-870-rc1/README open-iscsi-2.0-870-rc1.work/README
|
||||
Default here is iscsi_tcp/tcp to be used over which ever NIC the
|
||||
network layer decides is best.
|
||||
|
||||
diff -aurp open-iscsi-2.0-870-rc1/usr/idbm.c open-iscsi-2.0-870-rc1.work/usr/idbm.c
|
||||
--- open-iscsi-2.0-870-rc1/usr/idbm.c 2008-06-30 20:14:03.000000000 -0500
|
||||
+++ open-iscsi-2.0-870-rc1.work/usr/idbm.c 2008-06-30 21:36:44.000000000 -0500
|
||||
@@ -2137,9 +2137,9 @@ free_info:
|
||||
diff -aurp open-iscsi-2.0-871.1.1-bnx2i/usr/idbm.c open-iscsi-2.0-871.1.1-bnx2i.work/usr/idbm.c
|
||||
--- open-iscsi-2.0-871.1.1-bnx2i/usr/idbm.c 2010-01-15 03:43:42.000000000 -0600
|
||||
+++ open-iscsi-2.0-871.1.1-bnx2i.work/usr/idbm.c 2010-01-15 03:43:24.000000000 -0600
|
||||
@@ -2139,9 +2139,9 @@ free_info:
|
||||
int idbm_init(idbm_get_config_file_fn *fn)
|
||||
{
|
||||
/* make sure root db dir is there */
|
||||
@ -147,10 +165,10 @@ diff -aurp open-iscsi-2.0-870-rc1/usr/idbm.c open-iscsi-2.0-870-rc1.work/usr/idb
|
||||
errno);
|
||||
return errno;
|
||||
}
|
||||
diff -aurp open-iscsi-2.0-870-rc1/usr/idbm.h open-iscsi-2.0-870-rc1.work/usr/idbm.h
|
||||
--- open-iscsi-2.0-870-rc1/usr/idbm.h 2008-06-30 20:14:03.000000000 -0500
|
||||
+++ open-iscsi-2.0-870-rc1.work/usr/idbm.h 2008-06-30 21:36:58.000000000 -0500
|
||||
@@ -26,11 +26,12 @@
|
||||
diff -aurp open-iscsi-2.0-871.1.1-bnx2i/usr/idbm.h open-iscsi-2.0-871.1.1-bnx2i.work/usr/idbm.h
|
||||
--- open-iscsi-2.0-871.1.1-bnx2i/usr/idbm.h 2010-01-15 02:24:02.000000000 -0600
|
||||
+++ open-iscsi-2.0-871.1.1-bnx2i.work/usr/idbm.h 2010-01-15 03:43:24.000000000 -0600
|
||||
@@ -26,12 +26,15 @@
|
||||
#include "initiator.h"
|
||||
#include "config.h"
|
||||
|
||||
@ -158,25 +176,31 @@ diff -aurp open-iscsi-2.0-870-rc1/usr/idbm.h open-iscsi-2.0-870-rc1.work/usr/idb
|
||||
-#define SLP_CONFIG_DIR ISCSI_CONFIG_ROOT"slp"
|
||||
-#define ISNS_CONFIG_DIR ISCSI_CONFIG_ROOT"isns"
|
||||
-#define STATIC_CONFIG_DIR ISCSI_CONFIG_ROOT"static"
|
||||
-#define FW_CONFIG_DIR ISCSI_CONFIG_ROOT"fw"
|
||||
-#define ST_CONFIG_DIR ISCSI_CONFIG_ROOT"send_targets"
|
||||
+#define ISCSIVAR "/var/lib/iscsi/"
|
||||
+
|
||||
+#define NODE_CONFIG_DIR ISCSIVAR"nodes"
|
||||
+#define SLP_CONFIG_DIR ISCSIVAR"slp"
|
||||
+#define ISNS_CONFIG_DIR ISCSIVAR"isns"
|
||||
+#define STATIC_CONFIG_DIR ISCSIVAR"static"
|
||||
+#define ST_CONFIG_DIR ISCSIVAR"send_targets"
|
||||
+#define FW_CONFIG_DIR ISCSIVAR"fw"
|
||||
+
|
||||
#define ST_CONFIG_NAME "st_config"
|
||||
|
||||
#define TYPE_INT 0
|
||||
diff -aurp open-iscsi-2.0-870-rc1/usr/iface.h open-iscsi-2.0-870-rc1.work/usr/iface.h
|
||||
--- open-iscsi-2.0-870-rc1/usr/iface.h 2008-06-30 20:14:03.000000000 -0500
|
||||
+++ open-iscsi-2.0-870-rc1.work/usr/iface.h 2008-06-30 21:36:44.000000000 -0500
|
||||
@@ -20,7 +20,7 @@
|
||||
diff -aurp open-iscsi-2.0-871.1.1-bnx2i/usr/iface.h open-iscsi-2.0-871.1.1-bnx2i.work/usr/iface.h
|
||||
--- open-iscsi-2.0-871.1.1-bnx2i/usr/iface.h 2010-01-15 02:24:02.000000000 -0600
|
||||
+++ open-iscsi-2.0-871.1.1-bnx2i.work/usr/iface.h 2010-01-15 03:43:24.000000000 -0600
|
||||
@@ -20,7 +20,9 @@
|
||||
#ifndef ISCSI_IFACE_H
|
||||
#define ISCSI_IFACE_H
|
||||
|
||||
-#define IFACE_CONFIG_DIR ISCSI_CONFIG_ROOT"ifaces"
|
||||
+#define IFACE_CONFIG_DIR "/var/lib/iscsi/ifaces"
|
||||
+#include "idbm.h"
|
||||
+
|
||||
+#define IFACE_CONFIG_DIR ISCSIVAR"ifaces"
|
||||
|
||||
struct iface_rec;
|
||||
struct list_head;
|
||||
|
@ -2,24 +2,18 @@
|
||||
|
||||
Summary: iSCSI daemon and utility programs
|
||||
Name: iscsi-initiator-utils
|
||||
Version: 6.2.0.870
|
||||
Release: 10%{?dist}.1
|
||||
Source0: http://www.open-iscsi.org/bits/open-iscsi-2.0-870.1.tar.gz
|
||||
Version: 6.2.0.871.1.1
|
||||
Release: 1%{?dist}
|
||||
Source0: http://people.redhat.com/mchristi/iscsi/rhel6.0/source/open-iscsi-2.0-871.1.1-bnx2i.tar.gz
|
||||
Source1: iscsid.init
|
||||
Source2: iscsidevs.init
|
||||
Source3: 04-iscsi
|
||||
Patch0: iscsi-initiator-utils-update-initscripts-and-docs.patch
|
||||
Patch1: iscsi-initiator-utils-use-var-for-config.patch
|
||||
Patch2: iscsi-initiator-utils-use-red-hat-for-name.patch
|
||||
Patch3: iscsi-initiator-utils-ibft-sysfs.patch
|
||||
Patch4: iscsi-initiator-utils-print-ibft-net-info.patch
|
||||
Patch5: iscsi-initiator-utils-only-root-use.patch
|
||||
Patch6: iscsi-initiator-utils-start-iscsid.patch
|
||||
Patch7: open-iscsi-2.0-870.1-add-libiscsi.patch
|
||||
Patch8: open-iscsi-2.0-870.1-no-exit.patch
|
||||
Patch9: open-iscsi-2.0-870.1-ibft-newer-kernel.patch
|
||||
Patch10: open-iscsi-2.0-870.1-485217.patch
|
||||
Patch11: open-iscsi-2.0-870.1-fwparam-ppc-crash.patch
|
||||
Patch3: iscsi-initiator-utils-add-libiscsi.patch
|
||||
Patch4: iscsi-initiator-utils-uip-mgmt.patch
|
||||
|
||||
|
||||
Group: System Environment/Daemons
|
||||
License: GPLv2+
|
||||
@ -28,6 +22,7 @@ Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
BuildRequires: openssl-devel flex bison python-devel doxygen glibc-static
|
||||
Requires(post): chkconfig
|
||||
Requires(preun): chkconfig /sbin/service
|
||||
ExcludeArch: s390 s390x
|
||||
|
||||
%description
|
||||
The iscsi package provides the server daemon for the iSCSI protocol,
|
||||
@ -45,26 +40,25 @@ The %{name}-devel package contains libraries and header files for
|
||||
developing applications that use %{name}.
|
||||
|
||||
%prep
|
||||
%setup -q -n open-iscsi-2.0-870.1
|
||||
%setup -q -n open-iscsi-2.0-871.1.1-bnx2i
|
||||
%patch0 -p1 -b .update-initscripts-and-docs
|
||||
%patch1 -p1 -b .use-var-for-config
|
||||
%patch2 -p1 -b .use-red-hat-for-name
|
||||
%patch3 -p1 -b .ibft-sysfs
|
||||
%patch4 -p1 -b .print-ibft-net-info
|
||||
%patch5 -p1 -b .only-root
|
||||
%patch6 -p1 -b .start-iscsid
|
||||
%patch7 -p1
|
||||
%patch8 -p1
|
||||
%patch9 -p1
|
||||
%patch10 -p1
|
||||
%patch11 -p1
|
||||
|
||||
%patch3 -p1 -b .add-libiscsi
|
||||
%patch4 -p1 -b .uip-mgmt
|
||||
|
||||
%build
|
||||
make OPTFLAGS="%{optflags}" -C utils/sysdeps
|
||||
make OPTFLAGS="%{optflags}" -C utils/fwparam_ibft
|
||||
make OPTFLAGS="%{optflags}" -C usr
|
||||
make OPTFLAGS="%{optflags}" -C utils
|
||||
make OPTFLAGS="%{optflags}" -C libiscsi
|
||||
|
||||
cd brcm_iscsi_uio
|
||||
./configure
|
||||
make OPTFLAGS="%{optflags}"
|
||||
cd ..
|
||||
|
||||
pushd libiscsi
|
||||
python setup.py build
|
||||
popd
|
||||
@ -91,8 +85,12 @@ mkdir -p $RPM_BUILD_ROOT%{python_sitearch}
|
||||
|
||||
|
||||
install -p -m 755 usr/iscsid usr/iscsiadm utils/iscsi-iname usr/iscsistart $RPM_BUILD_ROOT/sbin
|
||||
install -m 755 brcm_iscsi_uio/src/unix/brcm_iscsiuio $RPM_BUILD_ROOT/sbin
|
||||
install -p -m 644 doc/iscsiadm.8 $RPM_BUILD_ROOT/%{_mandir}/man8
|
||||
install -p -m 644 doc/iscsid.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 brcm_iscsi_uio/docs/brcm_iscsiuio.8 $RPM_BUILD_ROOT/%{_mandir}/man8
|
||||
install -p -m 644 etc/iscsid.conf $RPM_BUILD_ROOT%{_sysconfdir}/iscsi
|
||||
|
||||
install -p -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_initrddir}/iscsid
|
||||
@ -137,6 +135,7 @@ fi
|
||||
%files
|
||||
%defattr(-,root,root)
|
||||
%doc README
|
||||
%dir /etc/iscsi
|
||||
%dir %{_var}/lib/iscsi
|
||||
%dir %{_var}/lib/iscsi/nodes
|
||||
%dir %{_var}/lib/iscsi/isns
|
||||
@ -161,6 +160,11 @@ fi
|
||||
%{_includedir}/libiscsi.h
|
||||
|
||||
%changelog
|
||||
* Fri Jan 25 2010 Mike Christie <mchristi@redhat.com> 6.2.0.871.1.1-1
|
||||
- Sync to upstream
|
||||
- 529324 Add iscsi-iname and iscsistart man page
|
||||
- 463582 OF/iBFT support
|
||||
|
||||
* Fri Jul 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 6.2.0.870-10.1
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
|
||||
|
||||
|
@ -37,6 +37,9 @@ force_start() {
|
||||
echo -n $"Starting $prog: "
|
||||
modprobe -q iscsi_tcp
|
||||
modprobe -q ib_iser
|
||||
modprobe -q cxgb3i
|
||||
modprobe -q bnx2i
|
||||
daemon brcm_iscsiuio
|
||||
daemon $prog
|
||||
retval=$?
|
||||
echo
|
||||
|
@ -1,38 +0,0 @@
|
||||
diff -up open-iscsi-2.0-870.1/libiscsi/pylibiscsi.c~ open-iscsi-2.0-870.1/libiscsi/pylibiscsi.c
|
||||
--- open-iscsi-2.0-870.1/libiscsi/pylibiscsi.c~ 2009-02-12 15:30:52.000000000 +0100
|
||||
+++ open-iscsi-2.0-870.1/libiscsi/pylibiscsi.c 2009-02-12 15:48:30.000000000 +0100
|
||||
@@ -485,19 +485,28 @@ static PyObject *pylibiscsi_discover_sen
|
||||
char *kwlist[] = {"address", "port", "authinfo", NULL};
|
||||
const char *address = NULL;
|
||||
int i, nr_found, port = 3260;
|
||||
- PyIscsiChapAuthInfo *pyauthinfo = NULL;
|
||||
+ PyObject *authinfo_arg = NULL;
|
||||
const struct libiscsi_auth_info *authinfo = NULL;
|
||||
struct libiscsi_node *found_nodes;
|
||||
PyObject* found_node_list;
|
||||
|
||||
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "s|iO!",
|
||||
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "s|iO",
|
||||
kwlist, &address, &port,
|
||||
- &PyIscsiChapAuthInfo_Type,
|
||||
- &pyauthinfo))
|
||||
+ &authinfo_arg))
|
||||
return NULL;
|
||||
|
||||
- if (pyauthinfo)
|
||||
- authinfo = &pyauthinfo->info;
|
||||
+ if (authinfo_arg) {
|
||||
+ if (PyObject_IsInstance(authinfo_arg, (PyObject *)
|
||||
+ &PyIscsiChapAuthInfo_Type)) {
|
||||
+ PyIscsiChapAuthInfo *pyauthinfo =
|
||||
+ (PyIscsiChapAuthInfo *)authinfo_arg;
|
||||
+ authinfo = &pyauthinfo->info;
|
||||
+ } else if (authinfo_arg != Py_None) {
|
||||
+ PyErr_SetString(PyExc_ValueError,
|
||||
+ "invalid authinfo type");
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ }
|
||||
|
||||
if (libiscsi_discover_sendtargets(context, address, port, authinfo,
|
||||
&nr_found, &found_nodes)) {
|
@ -1,55 +0,0 @@
|
||||
diff -up open-iscsi-2.0-870.1/utils/fwparam_ibft/fwparam_ppc.c.crash open-iscsi-2.0-870.1/utils/fwparam_ibft/fwparam_ppc.c
|
||||
--- open-iscsi-2.0-870.1/utils/fwparam_ibft/fwparam_ppc.c.crash 2008-11-22 18:06:46.000000000 +0100
|
||||
+++ open-iscsi-2.0-870.1/utils/fwparam_ibft/fwparam_ppc.c 2009-04-27 20:33:33.000000000 +0200
|
||||
@@ -341,6 +341,7 @@ static int loop_devs(const char *devtree
|
||||
int i;
|
||||
char prefix[256];
|
||||
|
||||
+ nic_count = 0;
|
||||
error = nftw(devtree, find_nics, 20, 0);
|
||||
if (error)
|
||||
return error;
|
||||
@@ -352,6 +353,7 @@ static int loop_devs(const char *devtree
|
||||
qsort(niclist, nic_count, sizeof(char *), nic_cmp);
|
||||
|
||||
snprintf(prefix, sizeof(prefix), "%s/%s", devtree, "aliases");
|
||||
+ dev_count = 0;
|
||||
error = nftw(prefix, find_initiator, 20, 0);
|
||||
if (error)
|
||||
return error;
|
||||
@@ -366,8 +368,6 @@ static int loop_devs(const char *devtree
|
||||
|
||||
}
|
||||
}
|
||||
- if (!error)
|
||||
- putchar('\n');
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -425,7 +425,7 @@ static void fill_context(struct boot_con
|
||||
int fwparam_ppc(struct boot_context *context, const char *filepath)
|
||||
{
|
||||
int error;
|
||||
- int fplen = 0;
|
||||
+ int dev_count;
|
||||
char *devtree;
|
||||
|
||||
/*
|
||||
@@ -435,13 +435,10 @@ int fwparam_ppc(struct boot_context *con
|
||||
* systems that can support iscsi are the ones that provide
|
||||
* the appropriate FCODE with a load method.
|
||||
*/
|
||||
- if (filepath) {
|
||||
- strncat(filename, filepath, FILENAMESZ);
|
||||
- fplen = strlen(filename);
|
||||
- } else
|
||||
- strncat(filename, DT_TOP, FILENAMESZ);
|
||||
-
|
||||
- strncat(filename + fplen, BOOTPATH, FILENAMESZ - fplen);
|
||||
+ if (filepath)
|
||||
+ snprintf(filename, FILENAMESZ, "%s%s", filepath, BOOTPATH);
|
||||
+ else
|
||||
+ snprintf(filename, FILENAMESZ, "%s%s", DT_TOP, BOOTPATH);
|
||||
|
||||
if (debug)
|
||||
fprintf(stderr, "%s: file:%s; debug:%d\n", __func__, filename,
|
@ -1,44 +0,0 @@
|
||||
diff -up open-iscsi-2.0-870.1/utils/fwparam_ibft/fwparam_ibft_sysfs.c~ open-iscsi-2.0-870.1/utils/fwparam_ibft/fwparam_ibft_sysfs.c
|
||||
--- open-iscsi-2.0-870.1/utils/fwparam_ibft/fwparam_ibft_sysfs.c~ 2009-01-28 22:09:21.000000000 +0100
|
||||
+++ open-iscsi-2.0-870.1/utils/fwparam_ibft/fwparam_ibft_sysfs.c 2009-01-28 22:10:29.000000000 +0100
|
||||
@@ -186,6 +186,40 @@ static int get_iface_from_device(const c
|
||||
break;
|
||||
}
|
||||
|
||||
+ closedir(dirfd);
|
||||
+
|
||||
+ if (rc != ENODEV)
|
||||
+ return rc;
|
||||
+
|
||||
+ /* If not found try again with newer kernel networkdev sysfs layout */
|
||||
+ strncat(dev_dir, "/net", FILENAMESZ);
|
||||
+
|
||||
+ if (!file_exist(dev_dir))
|
||||
+ return rc;
|
||||
+
|
||||
+ dirfd = opendir(dev_dir);
|
||||
+ if (!dirfd)
|
||||
+ return errno;
|
||||
+
|
||||
+ while ((dent = readdir(dirfd))) {
|
||||
+ if (!strcmp(dent->d_name, ".") || !strcmp(dent->d_name, ".."))
|
||||
+ continue;
|
||||
+
|
||||
+ /* Take the first "regular" directory entry */
|
||||
+ if (strlen(dent->d_name) > (sizeof(context->iface) - 1)) {
|
||||
+ rc = EINVAL;
|
||||
+ printf("Net device %s too bug for iface buffer.\n",
|
||||
+ dent->d_name);
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ strcpy(context->iface, dent->d_name);
|
||||
+ rc = 0;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ closedir(dirfd);
|
||||
+
|
||||
return rc;
|
||||
}
|
||||
|
@ -1,221 +0,0 @@
|
||||
--- open-iscsi-2.0-870.1/usr/idbm.c~ 2009-01-28 13:23:47.000000000 +0100
|
||||
+++ open-iscsi-2.0-870.1/usr/idbm.c 2009-01-28 13:25:06.000000000 +0100
|
||||
@@ -843,7 +843,7 @@ int idbm_lock(void)
|
||||
if (access(LOCK_DIR, F_OK) != 0) {
|
||||
if (mkdir(LOCK_DIR, 0660) != 0) {
|
||||
log_error("Could not open %s. Exiting\n", LOCK_DIR);
|
||||
- exit(-1);
|
||||
+ return errno;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -857,10 +857,10 @@ int idbm_lock(void)
|
||||
break;
|
||||
|
||||
if (errno != EEXIST) {
|
||||
+ log_error("Maybe you are not root?");
|
||||
log_error("Could not lock discovery DB: %s: %s",
|
||||
LOCK_WRITE_FILE, strerror(errno));
|
||||
- log_error("Maybe you are not root?");
|
||||
- exit(-1);
|
||||
+ return errno;
|
||||
} else if (i == 0)
|
||||
log_debug(2, "Waiting for discovery DB lock");
|
||||
|
||||
@@ -915,7 +915,10 @@ static int __idbm_rec_read(node_rec_t *o
|
||||
if (!info)
|
||||
return ENOMEM;
|
||||
|
||||
- idbm_lock();
|
||||
+ rc = idbm_lock();
|
||||
+ if (rc)
|
||||
+ goto free_info;
|
||||
+
|
||||
f = fopen(conf, "r");
|
||||
if (!f) {
|
||||
log_debug(5, "Could not open %s err %d\n", conf, errno);
|
||||
@@ -931,6 +934,7 @@ static int __idbm_rec_read(node_rec_t *o
|
||||
|
||||
unlock:
|
||||
idbm_unlock();
|
||||
+free_info:
|
||||
free(info);
|
||||
return rc;
|
||||
}
|
||||
@@ -1386,14 +1390,18 @@ idbm_discovery_read(discovery_rec_t *out
|
||||
return ENOMEM;
|
||||
|
||||
portal = malloc(PATH_MAX);
|
||||
- if (!portal)
|
||||
+ if (!portal) {
|
||||
+ rc = ENOMEM;
|
||||
goto free_info;
|
||||
+ }
|
||||
|
||||
snprintf(portal, PATH_MAX, "%s/%s,%d", ST_CONFIG_DIR,
|
||||
addr, port);
|
||||
log_debug(5, "Looking for config file %s\n", portal);
|
||||
|
||||
- idbm_lock();
|
||||
+ rc = idbm_lock();
|
||||
+ if (rc)
|
||||
+ goto free_info;
|
||||
|
||||
f = idbm_open_rec_r(portal, ST_CONFIG_NAME);
|
||||
if (!f) {
|
||||
@@ -1494,7 +1502,9 @@ static int idbm_rec_write(node_rec_t *re
|
||||
rec->name, rec->conn[0].address, rec->conn[0].port);
|
||||
log_debug(5, "Looking for config file %s", portal);
|
||||
|
||||
- idbm_lock();
|
||||
+ rc = idbm_lock();
|
||||
+ if (rc)
|
||||
+ goto free_portal;
|
||||
|
||||
rc = stat(portal, &statb);
|
||||
if (rc) {
|
||||
@@ -1579,13 +1589,16 @@ idbm_discovery_write(discovery_rec_t *re
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
- idbm_lock();
|
||||
+ rc = idbm_lock();
|
||||
+ if (rc)
|
||||
+ goto free_portal;
|
||||
+
|
||||
snprintf(portal, PATH_MAX, "%s", ST_CONFIG_DIR);
|
||||
if (access(portal, F_OK) != 0) {
|
||||
if (mkdir(portal, 0660) != 0) {
|
||||
log_error("Could not make %s\n", portal);
|
||||
rc = errno;
|
||||
- goto free_portal;
|
||||
+ goto unlock;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1596,13 +1609,14 @@ idbm_discovery_write(discovery_rec_t *re
|
||||
if (!f) {
|
||||
log_error("Could not open %s err %d\n", portal, errno);
|
||||
rc = errno;
|
||||
- goto free_portal;
|
||||
+ goto unlock;
|
||||
}
|
||||
|
||||
idbm_print(IDBM_PRINT_TYPE_DISCOVERY, rec, 1, f);
|
||||
fclose(f);
|
||||
-free_portal:
|
||||
+unlock:
|
||||
idbm_unlock();
|
||||
+free_portal:
|
||||
free(portal);
|
||||
return rc;
|
||||
}
|
||||
@@ -1722,7 +1736,10 @@ int idbm_add_node(node_rec_t *newrec, di
|
||||
log_debug(7, "node addition making link from %s to %s", node_portal,
|
||||
disc_portal);
|
||||
|
||||
- idbm_lock();
|
||||
+ rc = idbm_lock();
|
||||
+ if (rc)
|
||||
+ goto free_portal;
|
||||
+
|
||||
if (symlink(node_portal, disc_portal)) {
|
||||
if (errno == EEXIST)
|
||||
log_debug(7, "link from %s to %s exists", node_portal,
|
||||
@@ -2009,7 +2026,10 @@ static int idbm_remove_disc_to_node_link
|
||||
if (rc)
|
||||
goto done;
|
||||
|
||||
- idbm_lock();
|
||||
+ rc = idbm_lock();
|
||||
+ if (rc)
|
||||
+ goto done;
|
||||
+
|
||||
if (!stat(portal, &statb)) {
|
||||
if (unlink(portal)) {
|
||||
log_error("Could not remove link %s err %d\n",
|
||||
@@ -2046,7 +2066,10 @@ int idbm_delete_node(node_rec_t *rec)
|
||||
log_debug(5, "Removing config file %s iface id %s\n",
|
||||
portal, rec->iface.name);
|
||||
|
||||
- idbm_lock();
|
||||
+ rc = idbm_lock();
|
||||
+ if (rc)
|
||||
+ goto free_portal;
|
||||
+
|
||||
if (!stat(portal, &statb))
|
||||
goto rm_conf;
|
||||
|
||||
diff -up open-iscsi-2.0-870.1/usr/iface.c~ open-iscsi-2.0-870.1/usr/iface.c
|
||||
--- open-iscsi-2.0-870.1/usr/iface.c~ 2009-01-28 13:29:31.000000000 +0100
|
||||
+++ open-iscsi-2.0-870.1/usr/iface.c 2009-01-28 13:29:31.000000000 +0100
|
||||
@@ -208,7 +208,10 @@ int iface_conf_read(struct iface_rec *if
|
||||
return 0;
|
||||
}
|
||||
|
||||
- idbm_lock();
|
||||
+ rc = idbm_lock();
|
||||
+ if (rc)
|
||||
+ return rc;
|
||||
+
|
||||
rc = __iface_conf_read(iface);
|
||||
idbm_unlock();
|
||||
return rc;
|
||||
@@ -232,11 +235,15 @@ int iface_conf_delete(struct iface_rec *
|
||||
return ENOMEM;
|
||||
|
||||
sprintf(iface_conf, "%s/%s", IFACE_CONFIG_DIR, iface->name);
|
||||
- idbm_lock();
|
||||
+ rc = idbm_lock();
|
||||
+ if (rc)
|
||||
+ goto free_conf;
|
||||
+
|
||||
if (unlink(iface_conf))
|
||||
rc = errno;
|
||||
idbm_unlock();
|
||||
|
||||
+free_conf:
|
||||
free(iface_conf);
|
||||
return rc;
|
||||
}
|
||||
@@ -267,10 +274,14 @@ int iface_conf_write(struct iface_rec *i
|
||||
goto free_conf;
|
||||
}
|
||||
|
||||
- idbm_lock();
|
||||
+ rc = idbm_lock();
|
||||
+ if (rc)
|
||||
+ goto close_f;
|
||||
+
|
||||
idbm_print(IDBM_PRINT_TYPE_IFACE, iface, 1, f);
|
||||
idbm_unlock();
|
||||
|
||||
+close_f:
|
||||
fclose(f);
|
||||
free_conf:
|
||||
free(iface_conf);
|
||||
@@ -471,7 +482,9 @@ void iface_setup_host_bindings(void)
|
||||
{
|
||||
int nr_found = 0;
|
||||
|
||||
- idbm_lock();
|
||||
+ if (idbm_lock())
|
||||
+ return;
|
||||
+
|
||||
if (access(IFACE_CONFIG_DIR, F_OK) != 0) {
|
||||
if (mkdir(IFACE_CONFIG_DIR, 0660) != 0) {
|
||||
log_error("Could not make %s. HW/OFFLOAD iscsi "
|
||||
@@ -658,7 +671,12 @@ int iface_for_each_iface(void *data, int
|
||||
continue;
|
||||
}
|
||||
|
||||
- idbm_lock();
|
||||
+ err = idbm_lock();
|
||||
+ if (err) {
|
||||
+ free(iface);
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
err = __iface_conf_read(iface);
|
||||
idbm_unlock();
|
||||
if (err) {
|
Loading…
Reference in New Issue
Block a user