- Rewrite SysV initscripts, fixes rh 441290, 246960, 282001, 436175, 430791

- Add patch to make iscsiadm complain and exit when run as user instead of
    hang spinning for the database lock
- Add patch to make iscsiadm start iscsid when needed (rh 436175 related)
- Don't start iscsi service when network not yet up (in case of using NM)
    add NM dispatcher script to start iscsi service once network is up
This commit is contained in:
Hans de Goede 2008-09-30 12:21:47 +00:00
parent 5003024128
commit a4c8b301eb
20 changed files with 345 additions and 1463 deletions

View File

@ -10,3 +10,4 @@ open-iscsi-2.0-754.tar.gz
open-iscsi-2.0-865.2.tar.gz
open-iscsi-2.0-865.13.tar.gz
open-iscsi-2.0-868-test1.tar.gz
open-iscsi-2.0-870-rc1.tar.gz

View File

@ -1,94 +0,0 @@
diff -aurp open-iscsi-2.0-868-test1/usr/initiator.c open-iscsi-2.0-868-test1.work/usr/initiator.c
--- open-iscsi-2.0-868-test1/usr/initiator.c 2008-03-03 09:36:11.000000000 -0600
+++ open-iscsi-2.0-868-test1.work/usr/initiator.c 2008-03-03 09:39:17.000000000 -0600
@@ -602,7 +602,10 @@ session_conn_shutdown(iscsi_conn_t *conn
{
iscsi_session_t *session = conn->session;
- if (!conn->ksetup)
+ if (session->id == -1)
+ goto disconnect_conn;
+
+ if (!sysfs_session_has_leadconn(session->id))
goto disconnect_conn;
if (conn->state == STATE_IN_LOGIN ||
@@ -623,7 +626,6 @@ session_conn_shutdown(iscsi_conn_t *conn
log_error("can not safely destroy connection %d", conn->id);
return MGMT_IPC_ERR_INTERNAL;
}
- conn->ksetup = 0;
disconnect_conn:
log_debug(2, "disconnect conn");
@@ -1720,7 +1722,6 @@ static void session_conn_poll(void *data
err = MGMT_IPC_ERR_INTERNAL;
goto cleanup;
}
- conn->ksetup = 1;
log_debug(3, "created new iSCSI connection "
"%d:%d", session->id, conn->id);
}
diff -aurp open-iscsi-2.0-868-test1/usr/initiator.h open-iscsi-2.0-868-test1.work/usr/initiator.h
--- open-iscsi-2.0-868-test1/usr/initiator.h 2008-03-03 09:36:11.000000000 -0600
+++ open-iscsi-2.0-868-test1.work/usr/initiator.h 2008-03-03 09:39:17.000000000 -0600
@@ -116,7 +116,6 @@ struct iscsi_conn_context;
/* daemon's connection structure */
typedef struct iscsi_conn {
uint32_t id;
- int ksetup;
struct iscsi_session *session;
iscsi_login_context_t login_context;
struct iscsi_conn_context *recv_context;
diff -aurp open-iscsi-2.0-868-test1/usr/iscsi_sysfs.c open-iscsi-2.0-868-test1.work/usr/iscsi_sysfs.c
--- open-iscsi-2.0-868-test1/usr/iscsi_sysfs.c 2008-03-03 09:36:11.000000000 -0600
+++ open-iscsi-2.0-868-test1.work/usr/iscsi_sysfs.c 2008-03-03 09:39:17.000000000 -0600
@@ -38,6 +38,12 @@
#define ISCSI_MAX_SYSFS_BUFFER NI_MAXHOST
+/*
+ * TODO: make this into a real API and check inputs better and add doc.
+ * We should also use a common lib and search sysfs according to the sysfs
+ * doc in the kernel documetnation.
+ */
+
/* tmp buffer used by sysfs functions */
static char sysfs_file[PATH_MAX];
int num_transports = 0;
@@ -439,6 +445,24 @@ free_info:
return rc;
}
+/**
+ * sysfs_session_has_leadconn - checks if session has lead conn in kernel
+ * @sid: session id
+ *
+ * return 1 if session has lead conn and 0 if not.
+ */
+int sysfs_session_has_leadconn(uint32_t sid)
+{
+ struct stat statb;
+
+ memset(sysfs_file, 0, PATH_MAX);
+ sprintf(sysfs_file, ISCSI_CONN_DIR"/connection%u:0", sid);
+ if (!stat(sysfs_file, &statb))
+ return 1;
+ else
+ return 0;
+}
+
int get_sessioninfo_by_sysfs_id(struct session_info *info, char *session)
{
int ret, pers_failed = 0;
diff -aurp open-iscsi-2.0-868-test1/usr/iscsi_sysfs.h open-iscsi-2.0-868-test1.work/usr/iscsi_sysfs.h
--- open-iscsi-2.0-868-test1/usr/iscsi_sysfs.h 2008-03-03 09:36:11.000000000 -0600
+++ open-iscsi-2.0-868-test1.work/usr/iscsi_sysfs.h 2008-03-03 09:39:17.000000000 -0600
@@ -53,6 +53,7 @@ extern int get_iscsi_kernel_version(char
extern int check_class_version(void);
extern int get_sessioninfo_by_sysfs_id(struct session_info *info,
char *sys_session);
+extern int sysfs_session_has_leadconn(uint32_t sid);
typedef int (sysfs_session_op_fn)(void *, struct session_info *);
typedef int (sysfs_host_op_fn)(void *, struct host_info *);

View File

@ -1,186 +0,0 @@
diff -aurp open-iscsi-2.0-868-test1.orig/doc/iscsiadm.8 open-iscsi-2.0-868-test1/doc/iscsiadm.8
--- open-iscsi-2.0-868-test1.orig/doc/iscsiadm.8 2008-01-11 17:30:38.000000000 -0600
+++ open-iscsi-2.0-868-test1/doc/iscsiadm.8 2008-01-11 17:51:12.000000000 -0600
@@ -12,7 +12,7 @@ iscsiadm \- open-iscsi administration ut
\fBiscsiadm\fR -m iface [ -hV ] [ -d debug_level ] [ -P printlevel ] [ -I ifacename ] [ [ -o operation ] [ -n name ] [ -v value ] ]
-\fBiscsiadm\fR -m fw
+\fBiscsiadm\fR -m fw [-l]
\fBiscsiadm\fR -k priority
@@ -90,7 +90,7 @@ This command and iscsid's SIGTERM handli
.TP
\fB\-l\fR, \fB\-\-login\fR
-For node mode, login to a specified record. For discovery mode, login to
+For node and fw mode, login to a specified record. For discovery mode, login to
all discovered targets.
.IP
This option is only valid for discovery and node modes.
diff -aurp open-iscsi-2.0-868-test1.orig/usr/iscsiadm.c open-iscsi-2.0-868-test1/usr/iscsiadm.c
--- open-iscsi-2.0-868-test1.orig/usr/iscsiadm.c 2008-01-11 17:30:38.000000000 -0600
+++ open-iscsi-2.0-868-test1/usr/iscsiadm.c 2008-01-11 17:53:29.000000000 -0600
@@ -102,6 +102,7 @@ iscsiadm -m node [ -hV ] [ -d debug_leve
[ [ -o operation ] [ -n name ] [ -v value ] ]\n\
iscsiadm -m session [ -hV ] [ -d debug_level ] [ -P printlevel] [ -r sessionid | sysfsdir [ -R | -u | -s ] [ -o operation ] [ -n name ] [ -v value ] ]\n\
iscsiadm -m iface [ -hV ] [ -d debug_level ] [ -P printlevel ] [ -I ifacename ] [ [ -o operation ] [ -n name ] [ -v value ] ]\n\
+iscsiadm -m fw [ -l ]\n\
iscsiadm -k priority\n");
}
exit(status == 0 ? 0 : -1);
@@ -1538,53 +1539,6 @@ static void print_fw_nodes(struct node_r
}
}
-static int do_fw_discovery(idbm_t *db, discovery_rec_t *drec, int do_login,
- int info_level)
-{
- struct boot_context context;
- struct node_rec *rec;
- int ret;
-
- memset(&context, 0, sizeof(struct boot_context));
- ret = fw_get_entry(&context, NULL);
- if (ret) {
- log_error("Could not read fw values.");
- return ret;
- }
- /* tpgt hard coded to 1 */
- rec = create_node_record(db, context.targetname, 1,
- context.target_ipaddr, context.target_port,
- NULL, 1);
- if (!rec) {
- log_error("Could not setup rec for fw discovery login.");
- return ENOMEM;
- }
-
- /* todo - grab mac and set that here */
- iface_init(&rec->iface);
- strncpy(rec->iface.iname, context.initiatorname,
- sizeof(context.initiatorname));
- strncpy(rec->session.auth.username, context.chap_name,
- sizeof(context.chap_name));
- strncpy((char *)rec->session.auth.password, context.chap_password,
- sizeof(context.chap_password));
- strncpy(rec->session.auth.username_in, context.chap_name_in,
- sizeof(context.chap_name_in));
- strncpy((char *)rec->session.auth.password_in, context.chap_password_in,
- sizeof(context.chap_password_in));
- rec->session.auth.password_length =
- strlen((char *)context.chap_password);
- rec->session.auth.password_in_length =
- strlen((char *)context.chap_password_in);
-
- print_fw_nodes(rec, info_level);
- if (do_login)
- ret = login_portal(db, NULL, rec);
- free(rec);
- return ret;
-}
-
-
static int isns_dev_attr_query(idbm_t *db, discovery_rec_t *drec,
int info_level)
{
@@ -1887,10 +1841,46 @@ out:
return rc;
}
-static int exec_fw_op(void)
+static struct node_rec *
+fw_create_rec_by_entry(idbm_t *db, struct boot_context *context)
+{
+ struct node_rec *rec;
+
+ /* tpgt hard coded to 1 ??? */
+ rec = create_node_record(db, context->targetname, 1,
+ context->target_ipaddr, context->target_port,
+ NULL, 1);
+ if (!rec) {
+ log_error("Could not setup rec for fw discovery login.");
+ return NULL;
+ }
+
+ /* todo - grab mac and set that here */
+ iface_init(&rec->iface);
+ strncpy(rec->iface.iname, context->initiatorname,
+ sizeof(context->initiatorname));
+ strncpy(rec->session.auth.username, context->chap_name,
+ sizeof(context->chap_name));
+ strncpy((char *)rec->session.auth.password, context->chap_password,
+ sizeof(context->chap_password));
+ strncpy(rec->session.auth.username_in, context->chap_name_in,
+ sizeof(context->chap_name_in));
+ strncpy((char *)rec->session.auth.password_in,
+ context->chap_password_in,
+ sizeof(context->chap_password_in));
+ rec->session.auth.password_length =
+ strlen((char *)context->chap_password);
+ rec->session.auth.password_in_length =
+ strlen((char *)context->chap_password_in);
+ return rec;
+}
+
+static int exec_fw_op(idbm_t *db, discovery_rec_t *drec, int do_login,
+ int info_level)
{
struct boot_context context;
- int ret;
+ struct node_rec *rec;
+ int ret = 0;
memset(&context, 0, sizeof(struct boot_context));
ret = fw_get_entry(&context, NULL);
@@ -1899,8 +1889,22 @@ static int exec_fw_op(void)
return ret;
}
- fw_print_entry(&context);
- return 0;
+ rec = fw_create_rec_by_entry(db, &context);
+ if (!rec)
+ return ENODEV;
+
+ /* if discovery, print nodes that were found. */
+ if (drec)
+ print_fw_nodes(rec, info_level);
+
+ if (do_login)
+ ret = login_portal(db, NULL, rec);
+ free(rec);
+
+ /* print the fw node info if called in fw mode with no params */
+ if (!do_login && !drec)
+ fw_print_entry(&context);
+ return ret;
}
static int parse_sid(char *session)
@@ -2106,14 +2110,14 @@ main(int argc, char **argv)
usage(0);
if (mode == MODE_FW) {
- if ((rc = verify_mode_params(argc, argv, "m", 0))) {
+ if ((rc = verify_mode_params(argc, argv, "ml", 0))) {
log_error("fw mode: option '-%c' is not "
"allowed/supported", rc);
rc = -1;
goto out;
}
- rc = exec_fw_op();
+ rc = exec_fw_op(db, NULL, do_login, info_level);
goto out;
}
@@ -2186,7 +2190,7 @@ main(int argc, char **argv)
break;
case DISCOVERY_TYPE_FWBOOT:
drec.type = DISCOVERY_TYPE_FWBOOT;
- if (do_fw_discovery(db, &drec, do_login, info_level))
+ if (exec_fw_op(db, &drec, do_login, info_level))
rc = -1;
break;
default:

View File

@ -1,470 +0,0 @@
diff -Naurp open-iscsi/Makefile open-iscsi-5.0.5.595/Makefile
--- open-iscsi/Makefile 2006-05-30 01:51:42.000000000 -0500
+++ open-iscsi-5.0.5.595/Makefile 2006-05-30 02:29:46.000000000 -0500
@@ -26,6 +26,7 @@ ETCFILES = etc/iscsid.conf
all:
$(MAKE) -C usr
$(MAKE) -C kernel
+ $(MAKE) -C utils
@echo
@echo "Compilation complete Output file"
@echo "----------------------------------- ----------------"
@@ -38,6 +39,7 @@ all:
@echo Read README file for detailed information.
clean:
+ $(MAKE) -C utils clean
$(MAKE) -C usr clean
$(MAKE) -C kernel clean
diff -Naurp open-iscsi/utils/iscsi-iname.c open-iscsi-5.0.5.595/utils/iscsi-iname.c
--- open-iscsi/utils/iscsi-iname.c 1969-12-31 18:00:00.000000000 -0600
+++ open-iscsi-5.0.5.595/utils/iscsi-iname.c 2006-05-30 02:28:34.000000000 -0500
@@ -0,0 +1,140 @@
+/*
+ * iSCSI InitiatorName creation utility
+ * Copyright (C) 2001 Cisco Systems, Inc.
+ * maintained by linux-iscsi-devel@lists.sourceforge.net
+ *
+ * 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.
+ *
+ * $Id: iscsi-iname.c,v 1.1.2.3 2005/03/15 06:33:44 wysochanski Exp $
+ *
+ * iscsi-iname.c - Compute an iSCSI InitiatorName for this host.
+ * Note that to ensure uniqueness, the system time is
+ * a factor. This name must be cached and only regenerated
+ * if there is no cached value.
+ */
+
+#include <stdint.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/utsname.h>
+#include <sys/time.h>
+
+#include "md5.h"
+
+#define RANDOM_NUM_GENERATOR "/dev/urandom"
+
+int
+main(int argc, char *argv[])
+{
+ char iname[256];
+ struct timeval time;
+ struct utsname system_info;
+ long hostid;
+ struct MD5Context context;
+ unsigned char digest[16];
+ unsigned char *bytes = digest;
+ unsigned char entropy[16];
+ int e;
+ int fd;
+ char *prefix;
+
+ /* initialize */
+ memset(iname, 0, sizeof (iname));
+ memset(digest, 0, sizeof (digest));
+ memset(&context, 0, sizeof (context));
+ MD5Init(&context);
+
+ /* take a prefix if given, otherwise use a default. */
+ if (argc > 1 && argv[1]) {
+ prefix = argv[1];
+ if (( strcmp(prefix, "-h") == 0 ) ||
+ ( strcmp(prefix, "--help") == 0 )) {
+ printf("\nDisplays the iSCSI initiator name\n");
+ exit(0);
+ } else if ( strcmp(prefix, "-p") == 0 ) {
+ prefix = argv[2];
+ } else {
+ printf("\nUsage: iscsi-iname [-h | --help | "
+ "-p <prefix>]\n");
+ exit(0);
+ }
+ } else {
+ prefix = "iqn.2005-03.com.redhat:01";
+ }
+
+ /* try to feed some entropy from the pool to MD5 in order to get
+ * uniqueness properties
+ */
+
+ if ((fd = open(RANDOM_NUM_GENERATOR, O_RDONLY))) {
+ e = read(fd, &entropy, 16);
+ if (e >= 1)
+ MD5Update(&context, (md5byte *)entropy, e);
+ close(fd);
+ }
+
+ /* time the name is created is a factor in order to get
+ * uniqueness properties
+ */
+ if (gettimeofday(&time, NULL) < 0) {
+ perror("error: gettimeofday failed");
+ return 1;
+ }
+ MD5Update(&context, (md5byte *) & time.tv_sec, sizeof (time.tv_sec));
+ MD5Update(&context, (md5byte *) & time.tv_usec, sizeof (time.tv_usec));
+
+ /* hostid */
+ hostid = gethostid();
+ MD5Update(&context, (md5byte *) & hostid, sizeof (hostid));
+
+ /* get the hostname and system name */
+ if (uname(&system_info) < 0) {
+ perror("error: uname failed");
+ return 1;
+ }
+ MD5Update(&context, (md5byte *) system_info.sysname,
+ sizeof (system_info.sysname));
+ MD5Update(&context, (md5byte *) system_info.nodename,
+ sizeof (system_info.nodename));
+ MD5Update(&context, (md5byte *) system_info.release,
+ sizeof (system_info.release));
+ MD5Update(&context, (md5byte *) system_info.version,
+ sizeof (system_info.version));
+ MD5Update(&context, (md5byte *) system_info.machine,
+ sizeof (system_info.machine));
+
+ /* compute the md5 hash of all the bits we just collected */
+ MD5Final(digest, &context);
+
+ /* vary which md5 bytes we pick (though we probably don't need to do
+ * this, since hopefully MD5 produces results such that each byte is as
+ * good as any other).
+ */
+
+ if ((fd = open(RANDOM_NUM_GENERATOR, O_RDONLY))) {
+ if (read(fd, entropy, 1) == 1)
+ bytes = &digest[(entropy[0] % (sizeof(digest) - 6))];
+ close(fd);
+ }
+
+ /* print the prefix followed by 6 bytes of the MD5 hash */
+ sprintf(iname, "%s.%x%x%x%x%x%x", prefix,
+ bytes[0], bytes[1], bytes[2], bytes[3], bytes[4], bytes[5]);
+
+ iname[sizeof (iname) - 1] = '\0';
+ printf("%s\n", iname);
+ return 0;
+}
diff -Naurp open-iscsi/utils/Makefile open-iscsi-5.0.5.595/utils/Makefile
--- open-iscsi/utils/Makefile 1969-12-31 18:00:00.000000000 -0600
+++ open-iscsi-5.0.5.595/utils/Makefile 2006-05-30 02:28:34.000000000 -0500
@@ -0,0 +1,12 @@
+# This Makefile will work only with GNU make.
+
+CFLAGS += $(OPTFLAGS) -O2 -fno-inline -Wall -Wstrict-prototypes -g
+PROGRAMS = iscsi-iname
+
+all: $(PROGRAMS)
+
+iscsi-iname: md5.o iscsi-iname.o
+ $(CC) $(CFLAGS) $^ $(DBM_LIB) -o $@
+
+clean:
+ rm -f *.o $(PROGRAMS)
diff -Naurp open-iscsi/utils/md5.c open-iscsi-5.0.5.595/utils/md5.c
--- open-iscsi/utils/md5.c 1969-12-31 18:00:00.000000000 -0600
+++ open-iscsi-5.0.5.595/utils/md5.c 2006-05-30 02:28:34.000000000 -0500
@@ -0,0 +1,242 @@
+/*
+ * This code implements the MD5 message-digest algorithm.
+ * The algorithm is due to Ron Rivest. This code was
+ * written by Colin Plumb in 1993, no copyright is claimed.
+ * This code is in the public domain; do with it what you wish.
+ *
+ * Equivalent code is available from RSA Data Security, Inc.
+ * This code has been tested against that, and is equivalent,
+ * except that you don't need to include two pages of legalese
+ * with every copy.
+ *
+ * To compute the message digest of a chunk of bytes, declare an
+ * MD5Context structure, pass it to MD5Init, call MD5Update as
+ * needed on buffers full of bytes, and then call MD5Final, which
+ * will fill a supplied 16-byte array with the digest.
+ *
+ * Changed so as no longer to depend on Colin Plumb's `usual.h' header
+ * definitions; now uses stuff from dpkg's config.h.
+ * - Ian Jackson <ijackson@nyx.cs.du.edu>.
+ * Still in the public domain.
+ */
+
+#include <string.h>
+
+#include "md5.h"
+
+#if (__BYTE_ORDER == __BIG_ENDIAN)
+/*
+ * we can compile this away for little endian since
+ * it does not do anything on those archs
+ */
+void
+byteSwap(uint32_t * buf, unsigned words)
+{
+ md5byte *p = (md5byte *) buf;
+
+ do {
+ *buf++ = (uint32_t) ((unsigned) p[3] << 8 | p[2]) << 16 |
+ ((unsigned) p[1] << 8 | p[0]);
+ p += 4;
+ } while (--words);
+}
+#else
+#define byteSwap(buf,words)
+#endif
+
+/*
+ * Start MD5 accumulation. Set bit count to 0 and buffer to mysterious
+ * initialization constants.
+ */
+void
+MD5Init(struct MD5Context *ctx)
+{
+ ctx->buf[0] = 0x67452301;
+ ctx->buf[1] = 0xefcdab89;
+ ctx->buf[2] = 0x98badcfe;
+ ctx->buf[3] = 0x10325476;
+
+ ctx->bytes[0] = 0;
+ ctx->bytes[1] = 0;
+}
+
+/*
+ * Update context to reflect the concatenation of another buffer full
+ * of bytes.
+ */
+void
+MD5Update(struct MD5Context *ctx, md5byte const *buf, unsigned len)
+{
+ uint32_t t;
+
+ /* Update byte count */
+
+ t = ctx->bytes[0];
+ if ((ctx->bytes[0] = t + len) < t)
+ ctx->bytes[1]++; /* Carry from low to high */
+
+ t = 64 - (t & 0x3f); /* Space available in ctx->in (at least 1) */
+ if (t > len) {
+ memcpy((md5byte *) ctx->in + 64 - t, buf, len);
+ return;
+ }
+ /* First chunk is an odd size */
+ memcpy((md5byte *) ctx->in + 64 - t, buf, t);
+ byteSwap(ctx->in, 16);
+ MD5Transform(ctx->buf, ctx->in);
+ buf += t;
+ len -= t;
+
+ /* Process data in 64-byte chunks */
+ while (len >= 64) {
+ memcpy(ctx->in, buf, 64);
+ byteSwap(ctx->in, 16);
+ MD5Transform(ctx->buf, ctx->in);
+ buf += 64;
+ len -= 64;
+ }
+
+ /* Handle any remaining bytes of data. */
+ memcpy(ctx->in, buf, len);
+}
+
+/*
+ * Final wrapup - pad to 64-byte boundary with the bit pattern
+ * 1 0* (64-bit count of bits processed, MSB-first)
+ */
+void
+MD5Final(md5byte digest[16], struct MD5Context *ctx)
+{
+ int count = ctx->bytes[0] & 0x3f; /* Number of bytes in ctx->in */
+ md5byte *p = (md5byte *) ctx->in + count;
+
+ /* Set the first char of padding to 0x80. There is always room. */
+ *p++ = 0x80;
+
+ /* Bytes of padding needed to make 56 bytes (-8..55) */
+ count = 56 - 1 - count;
+
+ if (count < 0) { /* Padding forces an extra block */
+ memset(p, 0, count + 8);
+ byteSwap(ctx->in, 16);
+ MD5Transform(ctx->buf, ctx->in);
+ p = (md5byte *) ctx->in;
+ count = 56;
+ }
+ memset(p, 0, count);
+ byteSwap(ctx->in, 14);
+
+ /* Append length in bits and transform */
+ ctx->in[14] = ctx->bytes[0] << 3;
+ ctx->in[15] = ctx->bytes[1] << 3 | ctx->bytes[0] >> 29;
+ MD5Transform(ctx->buf, ctx->in);
+
+ byteSwap(ctx->buf, 4);
+ memcpy(digest, ctx->buf, 16);
+ memset(ctx, 0, sizeof (ctx)); /* In case it's sensitive */
+}
+
+#ifndef ASM_MD5
+
+/* The four core functions - F1 is optimized somewhat */
+
+/* #define F1(x, y, z) (x & y | ~x & z) */
+#define F1(x, y, z) (z ^ (x & (y ^ z)))
+#define F2(x, y, z) F1(z, x, y)
+#define F3(x, y, z) (x ^ y ^ z)
+#define F4(x, y, z) (y ^ (x | ~z))
+
+/* This is the central step in the MD5 algorithm. */
+#define MD5STEP(f,w,x,y,z,in,s) \
+ (w += f(x,y,z) + in, w = (w<<s | w>>(32-s)) + x)
+
+/*
+ * The core of the MD5 algorithm, this alters an existing MD5 hash to
+ * reflect the addition of 16 longwords of new data. MD5Update blocks
+ * the data and converts bytes into longwords for this routine.
+ */
+void
+MD5Transform(uint32_t buf[4], uint32_t const in[16])
+{
+ register uint32_t a, b, c, d;
+
+ a = buf[0];
+ b = buf[1];
+ c = buf[2];
+ d = buf[3];
+
+ MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7);
+ MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12);
+ MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17);
+ MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22);
+ MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7);
+ MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12);
+ MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17);
+ MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22);
+ MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7);
+ MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12);
+ MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17);
+ MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22);
+ MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7);
+ MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12);
+ MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17);
+ MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22);
+
+ MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5);
+ MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9);
+ MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14);
+ MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20);
+ MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5);
+ MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9);
+ MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14);
+ MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20);
+ MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5);
+ MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9);
+ MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14);
+ MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20);
+ MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5);
+ MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9);
+ MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14);
+ MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20);
+
+ MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4);
+ MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11);
+ MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16);
+ MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23);
+ MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4);
+ MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11);
+ MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16);
+ MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23);
+ MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4);
+ MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11);
+ MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16);
+ MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23);
+ MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4);
+ MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11);
+ MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16);
+ MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23);
+
+ MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6);
+ MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10);
+ MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15);
+ MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21);
+ MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6);
+ MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10);
+ MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15);
+ MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21);
+ MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6);
+ MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10);
+ MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15);
+ MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21);
+ MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6);
+ MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10);
+ MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15);
+ MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21);
+
+ buf[0] += a;
+ buf[1] += b;
+ buf[2] += c;
+ buf[3] += d;
+}
+
+#endif
diff -Naurp open-iscsi/utils/md5.h open-iscsi-5.0.5.595/utils/md5.h
--- open-iscsi/utils/md5.h 1969-12-31 18:00:00.000000000 -0600
+++ open-iscsi-5.0.5.595/utils/md5.h 2006-05-30 02:28:34.000000000 -0500
@@ -0,0 +1,41 @@
+/*
+ * This is the header file for the MD5 message-digest algorithm.
+ * The algorithm is due to Ron Rivest. This code was
+ * written by Colin Plumb in 1993, no copyright is claimed.
+ * This code is in the public domain; do with it what you wish.
+ *
+ * Equivalent code is available from RSA Data Security, Inc.
+ * This code has been tested against that, and is equivalent,
+ * except that you don't need to include two pages of legalese
+ * with every copy.
+ *
+ * To compute the message digest of a chunk of bytes, declare an
+ * MD5Context structure, pass it to MD5Init, call MD5Update as
+ * needed on buffers full of bytes, and then call MD5Final, which
+ * will fill a supplied 16-byte array with the digest.
+ *
+ * Changed so as no longer to depend on Colin Plumb's `usual.h'
+ * header definitions; now uses stuff from dpkg's config.h
+ * - Ian Jackson <ijackson@nyx.cs.du.edu>.
+ * Still in the public domain.
+ */
+
+#ifndef MD5_H
+#define MD5_H
+
+#include <stdint.h>
+
+#define md5byte unsigned char
+
+struct MD5Context {
+ uint32_t buf[4];
+ uint32_t bytes[2];
+ uint32_t in[16];
+};
+
+void MD5Init(struct MD5Context *context);
+void MD5Update(struct MD5Context *context, md5byte const *buf, unsigned len);
+void MD5Final(unsigned char digest[16], struct MD5Context *context);
+void MD5Transform(uint32_t buf[4], uint32_t const in[16]);
+
+#endif /* !MD5_H */

View File

@ -1,22 +0,0 @@
diff -aurp open-iscsi-2.0-868-test1/usr/idbm.c open-iscsi-2.0-868-test1.work/usr/idbm.c
--- open-iscsi-2.0-868-test1/usr/idbm.c 2008-01-03 13:23:36.000000000 -0600
+++ open-iscsi-2.0-868-test1.work/usr/idbm.c 2008-02-06 15:23:10.000000000 -0600
@@ -26,6 +26,7 @@
#include <string.h>
#include <errno.h>
#include <dirent.h>
+#include <limits.h>
#include <sys/stat.h>
#include <sys/file.h>
diff -aurp open-iscsi-2.0-868-test1/usr/list.h open-iscsi-2.0-868-test1.work/usr/list.h
--- open-iscsi-2.0-868-test1/usr/list.h 2008-01-03 13:23:36.000000000 -0600
+++ open-iscsi-2.0-868-test1.work/usr/list.h 2008-02-06 16:19:27.000000000 -0600
@@ -1,6 +1,7 @@
#ifndef __LIST_H__
#define __LIST_H__
+#include <stddef.h>
/* taken from linux kernel */
#undef offsetof

View File

@ -1,12 +0,0 @@
diff -aurp open-iscsi-2.0-868-test1/usr/io.c open-iscsi-2.0-868-test1.work/usr/io.c
--- open-iscsi-2.0-868-test1/usr/io.c 2008-03-18 17:41:06.000000000 -0500
+++ open-iscsi-2.0-868-test1.work/usr/io.c 2008-03-18 17:41:36.000000000 -0500
@@ -794,7 +794,7 @@ iscsi_io_recv_pdu(iscsi_conn_t *conn, st
if (dlength == 0)
goto done;
- if (data + dlength >= end) {
+ if (data + dlength > end) {
log_warning("buffer size %u too small for data length %u",
max_data_length, dlength);
failed = 1;

View File

@ -1,40 +0,0 @@
diff -aurp open-iscsi-2.0-868-test1/usr/iscsid.c open-iscsi-2.0-868-test1.work/usr/iscsid.c
--- open-iscsi-2.0-868-test1/usr/iscsid.c 2008-03-11 17:25:29.000000000 -0500
+++ open-iscsi-2.0-868-test1.work/usr/iscsid.c 2008-03-11 17:25:50.000000000 -0500
@@ -177,7 +177,7 @@ setup_rec_from_negotiated_values(idbm_t
static int sync_session(void *data, struct session_info *info)
{
idbm_t *db = data;
- node_rec_t rec;
+ node_rec_t rec, sysfsrec;
iscsiadm_req_t req;
iscsiadm_rsp_t rsp;
struct iscsi_transport *t;
@@ -219,6 +219,27 @@ static int sync_session(void *data, stru
log_warning("Could not read data from db. Using default and "
"currently negotiated values\n");
setup_rec_from_negotiated_values(db, &rec, info);
+ } else {
+ /*
+ * we have a valid record and iface so lets merge
+ * the values from them and sysfs to try and get
+ * the most uptodate values.
+ *
+ * Currenlty that means we will use the CHAP, target and
+ * and portal values from sysfs and use timer, queue depth,
+ * and segment length values from the record. In the future
+ * when boot supports iface binding we will want to use
+ * those values from sysfs.
+ */
+ memset(&sysfsrec, 0, sizeof(node_rec_t));
+ setup_rec_from_negotiated_values(db, &sysfsrec, info);
+ /*
+ * target and portal values have to be the same or
+ * we would not have found the record, so just copy
+ * CHAP.
+ */
+ memcpy(&rec.session.auth, &sysfsrec.session.auth,
+ sizeof(struct iscsi_auth_config));
}
/* multiple drivers could be connected to the same portal */

View File

@ -1,15 +0,0 @@
diff -aurp open-iscsi-2.0-868-test1/usr/isns.c open-iscsi-2.0-868-test1.work/usr/isns.c
--- open-iscsi-2.0-868-test1/usr/isns.c 2008-03-03 09:36:11.000000000 -0600
+++ open-iscsi-2.0-868-test1.work/usr/isns.c 2008-03-03 09:38:03.000000000 -0600
@@ -286,7 +286,10 @@ static void add_new_target_node(char *ta
char dst[INET6_ADDRSTRLEN];
memset(dst, 0, sizeof(dst));
- if (!memcmp(ip, dst, 10) && ip[10] == 0xff && ip[11] == 0xff)
+ /*
+ * some servers are sending compat instead of mapped
+ */
+ if (IN6_IS_ADDR_V4MAPPED(ip) || IN6_IS_ADDR_V4COMPAT(ip))
inet_ntop(AF_INET, ip + 12, dst, sizeof(dst));
else
inet_ntop(AF_INET6, ip, dst, sizeof(dst));

View File

@ -1,6 +1,6 @@
diff -Naurp open-iscsi-2.0-868-test1/utils/fwparam_ibft/fw_entry.c open-iscsi-2.0-868-test1.curr/utils/fwparam_ibft/fw_entry.c
--- open-iscsi-2.0-868-test1/utils/fwparam_ibft/fw_entry.c 2008-01-03 13:23:36.000000000 -0600
+++ open-iscsi-2.0-868-test1.curr/utils/fwparam_ibft/fw_entry.c 2008-01-23 12:07:52.000000000 -0600
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);
@ -11,9 +11,9 @@ diff -Naurp open-iscsi-2.0-868-test1/utils/fwparam_ibft/fw_entry.c open-iscsi-2.
return ret;
}
diff -Naurp open-iscsi-2.0-868-test1/utils/fwparam_ibft/fwparam_ibft.h open-iscsi-2.0-868-test1.curr/utils/fwparam_ibft/fwparam_ibft.h
--- open-iscsi-2.0-868-test1/utils/fwparam_ibft/fwparam_ibft.h 2008-01-03 13:23:36.000000000 -0600
+++ open-iscsi-2.0-868-test1.curr/utils/fwparam_ibft/fwparam_ibft.h 2008-01-23 12:07:52.000000000 -0600
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"
@ -23,9 +23,9 @@ diff -Naurp open-iscsi-2.0-868-test1/utils/fwparam_ibft/fwparam_ibft.h open-iscs
extern int fwparam_ppc(struct boot_context *context, const char *filepath);
-
#endif /* FWPARAM_IBFT_H_ */
diff -Naurp open-iscsi-2.0-868-test1/utils/fwparam_ibft/fwparam_ibft_sysfs.c open-iscsi-2.0-868-test1.curr/utils/fwparam_ibft/fwparam_ibft_sysfs.c
--- open-iscsi-2.0-868-test1/utils/fwparam_ibft/fwparam_ibft_sysfs.c 1969-12-31 18:00:00.000000000 -0600
+++ open-iscsi-2.0-868-test1.curr/utils/fwparam_ibft/fwparam_ibft_sysfs.c 2008-01-23 12:08:04.000000000 -0600
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
@ -298,19 +298,15 @@ diff -Naurp open-iscsi-2.0-868-test1/utils/fwparam_ibft/fwparam_ibft_sysfs.c ope
+ deallocate_lists();
+ return rc;
+}
diff -Naurp open-iscsi-2.0-868-test1/utils/fwparam_ibft/Makefile open-iscsi-2.0-868-test1.curr/utils/fwparam_ibft/Makefile
--- open-iscsi-2.0-868-test1/utils/fwparam_ibft/Makefile 2008-01-03 13:23:36.000000000 -0600
+++ open-iscsi-2.0-868-test1.curr/utils/fwparam_ibft/Makefile 2008-01-23 12:07:52.000000000 -0600
@@ -21,11 +21,10 @@
# "Prasanna Mumbai" <mumbai.prasanna@gmail.com>
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 := fwparam_ibft.o fw_entry.o fwparam_ibft_sysfs.o
OBJS += prom_lex.o prom_parse.tab.o fwparam_ppc.o
GENFILES := prom_lex.c prom_parse.tab.c prom_parse.tab.h
CLEANFILES = $(OBJS) $(GENFILES) *.output *~
-
BISONFLAGS = -d
FLEXFLAGS = -t
# turn off #line number markers
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

View File

@ -0,0 +1,18 @@
diff -up open-iscsi-2.0-870-rc1/usr/idbm.c~ open-iscsi-2.0-870-rc1/usr/idbm.c
--- open-iscsi-2.0-870-rc1/usr/idbm.c~ 2008-09-29 13:01:48.000000000 +0200
+++ open-iscsi-2.0-870-rc1/usr/idbm.c 2008-09-29 13:01:48.000000000 +0200
@@ -849,6 +849,14 @@ int idbm_lock(void)
ret = link(LOCK_FILE, LOCK_WRITE_FILE);
if (ret == 0)
break;
+
+ if (errno != EEXIST) {
+ log_error("Could not lock discovery DB: %s: %s",
+ LOCK_WRITE_FILE, strerror(errno));
+ log_error("Maybe you are not root?");
+ exit(-1);
+ } else if (i == 0)
+ log_warning("Waiting for discovery DB lock");
usleep(10000);
}

View File

@ -1,7 +1,7 @@
diff -aurp open-iscsi-2.0-868-test1/etc/iscsid.conf open-iscsi-2.0-868-test1.tmp/etc/iscsid.conf
--- open-iscsi-2.0-868-test1/etc/iscsid.conf 2008-01-03 13:23:36.000000000 -0600
+++ open-iscsi-2.0-868-test1.tmp/etc/iscsid.conf 2008-01-03 13:55:59.000000000 -0600
@@ -27,8 +20,8 @@
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 @@
# To request that the iscsi initd scripts startup a session set to "automatic".
# node.startup = automatic
#
@ -12,75 +12,9 @@ diff -aurp open-iscsi-2.0-868-test1/etc/iscsid.conf open-iscsi-2.0-868-test1.tmp
# *************
# CHAP Settings
@@ -92,17 +85,6 @@ node.conn[0].timeo.noop_out_interval = 5
# this will cause the IO to be failed to the multipath layer.
node.conn[0].timeo.noop_out_timeout = 5
-# To specify the time to wait for abort response before
-# failing the operation and trying a logical unit reset edit the line.
-# The value is in seconds and the default is 15 seconds.
-node.session.err_timeo.abort_timeout = 15
-
-# To specify the time to wait for a logical unit response
-# before failing the operation and trying session re-establishment
-# edit the line.
-# The value is in seconds and the default is 30 seconds.
-node.session.err_timeo.lu_reset_timeout = 20
-
#******
# Retry
#******
@@ -188,41 +170,24 @@ 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, uncommen
+# 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 and to allow the target to control
# the setting of the HeaderDigest checking with the initiator requesting
# a preference of disabling the checking.
-
-#************
-# Workarounds
-#************
-
-# Some targets like IET prefer after an initiator has sent a task
-# management function like an ABORT TASK or LOGICAL UNIT RESET, that
-# it does not respond to PDUs like R2Ts. To enable this behavior uncomment
-# the following line (The default behavior is Yes):
-node.session.iscsi.FastAbort = Yes
-
-# Some targets like Equalogic prefer that after an initiator has sent
-# a task management function like an ABORT TASK or LOGICAL UNIT RESET, that
-# it continue to respond to R2Ts. To enable this uncomment this line
-# node.session.iscsi.FastAbort = No
diff -aurp open-iscsi-2.0-868-test1/README open-iscsi-2.0-868-test1.tmp/README
--- open-iscsi-2.0-868-test1/README 2008-01-03 13:23:36.000000000 -0600
+++ open-iscsi-2.0-868-test1.tmp/README 2008-01-03 13:53:11.000000000 -0600
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.
- iscsiadm's -P 3 option will not print out scsi devices.
- iscsid will not automatically online devices.
@ -93,7 +27,7 @@ diff -aurp open-iscsi-2.0-868-test1/README open-iscsi-2.0-868-test1.tmp/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
@@ -613,7 +608,7 @@ Red Hat or Fedora:
@@ -694,7 +689,7 @@ Red Hat or Fedora:
-----------------
To start open-iscsi in Red Hat/Fedora you can do:
@ -102,7 +36,7 @@ diff -aurp open-iscsi-2.0-868-test1/README open-iscsi-2.0-868-test1.tmp/README
To get open-iscsi to automatically start at run time you may have to
run:
@@ -792,6 +778,8 @@ To login to all the automated nodes, sim
@@ -873,6 +868,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.
@ -111,21 +45,3 @@ diff -aurp open-iscsi-2.0-868-test1/README open-iscsi-2.0-868-test1.tmp/README
8. Advanced Configuration
=========================
diff -aurp open-iscsi-2.0-868-test1/usr/idbm.c open-iscsi-2.0-868-test1.tmp/usr/idbm.c
--- open-iscsi-2.0-868-test1/usr/idbm.c 2008-01-03 13:23:36.000000000 -0600
+++ open-iscsi-2.0-868-test1.tmp/usr/idbm.c 2008-01-03 13:52:01.000000000 -0600
@@ -364,10 +364,14 @@ idbm_recinfo_node(node_rec_t *r, recinfo
__recinfo_int_o4(key, ri, r, conn[i].iscsi.HeaderDigest,
IDBM_SHOW, "None", "CRC32C", "CRC32C,None",
"None,CRC32C", num);
+/*
+ We only support data digests
+
sprintf(key, "node.conn[%d].iscsi.DataDigest", i);
__recinfo_int_o4(key, ri, r, conn[i].iscsi.DataDigest, IDBM_SHOW,
"None", "CRC32C", "CRC32C,None",
"None,CRC32C", num);
+*/
sprintf(key, "node.conn[%d].iscsi.IFMarker", i);
__recinfo_int_o2(key, ri, r, conn[i].iscsi.IFMarker, IDBM_SHOW,
"No", "Yes", num);

View File

@ -1,37 +0,0 @@
--- open-iscsi-2.0-868-test1/README 2008-03-14 12:28:27.000000000 -0500
+++ open-iscsi-2.0-868-test1.work/README 2008-03-14 12:29:06.000000000 -0500
@@ -225,11 +225,11 @@ Usage: iscsiadm [OPTION]
Stats prints the iSCSI stats for the session.
-m node --logoutall=[all|manual|automatic]
Logout "all" the running sessions or just the ones
- with a node or conn startup value manual or automatic.
+ with a node startup value manual or automatic.
Nodes marked as ONBOOT are skipped.
-m node --loginall=[all|manual|automatic]
Login "all" the running sessions or just the ones
- with a node or conn startup value manual or automatic.
+ with a node startup value manual or automatic.
Nodes marked as ONBOOT are skipped.
-m session display all active sessions and connections
-m session --sid=[sid] [ --print=level | --rescan | --logout ]
@@ -769,16 +769,16 @@ Note: this may only work for distros wit
To automate login to a node, use the following with the record ID
(record ID is the targetname and portal) of the node discovered in the
discovery above:
- iscsiadm -m node -T targetname -p ip:port --op update -n node.conn[0].startup -v automatic
+ iscsiadm -m node -T targetname -p ip:port --op update -n node.startup -v automatic
To set the automatic setting to all portals on a target through every
interface setup for each protal, the following can be run:
- iscsiadm -m node -T targetname --op update -n node.conn[0].startup -v automatic
+ iscsiadm -m node -T targetname --op update -n node.startup -v automatic
-Or to set the "node.conn[0].statup" attribute to "startup" as default for
+Or to set the "node.startup" attribute to "startup" as default for
all sessions add the following to the /etc/iscsi/iscsid.conf:
- node.conn[0].startup = automatic
+ node.startup = automatic
Setting this in iscsid.conf, will not affect existing nodes. It will only
affect nodes that are discovered after setting the value.

View File

@ -1,110 +0,0 @@
diff -aurp open-iscsi-2.0-868-test1.orig/usr/discovery.c open-iscsi-2.0-868-test1/usr/discovery.c
--- open-iscsi-2.0-868-test1.orig/usr/discovery.c 2008-01-23 12:13:55.000000000 -0600
+++ open-iscsi-2.0-868-test1/usr/discovery.c 2008-01-23 12:14:25.000000000 -0600
@@ -981,7 +981,6 @@ redirect_reconnect:
break;
case LOGIN_IO_ERROR:
- case LOGIN_WRONG_PORTAL_GROUP:
case LOGIN_REDIRECTION_FAILED:
/* try again */
log_warning("retrying discovery login to %s", host);
diff -aurp open-iscsi-2.0-868-test1.orig/usr/initiator.c open-iscsi-2.0-868-test1/usr/initiator.c
--- open-iscsi-2.0-868-test1.orig/usr/initiator.c 2008-01-23 12:13:55.000000000 -0600
+++ open-iscsi-2.0-868-test1/usr/initiator.c 2008-01-23 12:14:25.000000000 -0600
@@ -149,7 +149,6 @@ __login_response_status(iscsi_conn_t *co
case LOGIN_REDIRECT:
return CONN_LOGIN_IMM_REDIRECT_RETRY;
case LOGIN_IO_ERROR:
- case LOGIN_WRONG_PORTAL_GROUP:
case LOGIN_REDIRECTION_FAILED:
return CONN_LOGIN_RETRY;
default:
diff -aurp open-iscsi-2.0-868-test1.orig/usr/initiator.h open-iscsi-2.0-868-test1/usr/initiator.h
--- open-iscsi-2.0-868-test1.orig/usr/initiator.h 2008-01-23 12:13:55.000000000 -0600
+++ open-iscsi-2.0-868-test1/usr/initiator.h 2008-01-23 12:14:25.000000000 -0600
@@ -75,10 +75,9 @@ enum iscsi_login_status {
LOGIN_VERSION_MISMATCH = 3,
LOGIN_NEGOTIATION_FAILED = 4,
LOGIN_AUTHENTICATION_FAILED = 5,
- LOGIN_WRONG_PORTAL_GROUP = 6,
- LOGIN_REDIRECTION_FAILED = 7,
- LOGIN_INVALID_PDU = 8,
- LOGIN_REDIRECT = 9,
+ LOGIN_REDIRECTION_FAILED = 6,
+ LOGIN_INVALID_PDU = 7,
+ LOGIN_REDIRECT = 8,
};
typedef enum iscsi_event_e {
diff -aurp open-iscsi-2.0-868-test1.orig/usr/login.c open-iscsi-2.0-868-test1/usr/login.c
--- open-iscsi-2.0-868-test1.orig/usr/login.c 2008-01-23 12:13:55.000000000 -0600
+++ open-iscsi-2.0-868-test1/usr/login.c 2008-01-23 12:14:25.000000000 -0600
@@ -264,24 +264,20 @@ get_security_text_keys(iscsi_session_t *
&value, &value_end)) {
/*
* We should have already obtained this
- * via discovery.
- * We've already picked an isid, so the
- * most we can do is confirm we reached
- * the portal group we were expecting to
+ * via discovery, but the value could be stale.
+ * If the target was reconfigured it will send us
+ * the updated tpgt.
*/
tag = strtoul(value, NULL, 0);
if (session->portal_group_tag >= 0) {
- if (tag != session->portal_group_tag) {
- log_error("Portal group tag "
+ if (tag != session->portal_group_tag)
+ log_debug(2, "Portal group tag "
"mismatch, expected %u, "
- "received %u",
+ "received %u. Updating",
session->portal_group_tag, tag);
- return LOGIN_WRONG_PORTAL_GROUP;
- }
- } else
- /* we now know the tag */
- session->portal_group_tag = tag;
-
+ }
+ /* we now know the tag */
+ session->portal_group_tag = tag;
text = value_end;
} else {
/*
@@ -339,21 +335,22 @@ get_op_params_text_keys(iscsi_session_t
}
} else if (iscsi_find_key_value("TargetPortalGroupTag", text, end,
&value, &value_end)) {
+ int tag = strtoul(value, NULL, 0);
/*
- * confirm we reached the portal group we were expecting to
+ * We should have already obtained this
+ * via discovery, but the value could be stale.
+ * If the target was reconfigured it will send us
+ * the updated tpgt.
*/
- int tag = strtoul(value, NULL, 0);
if (session->portal_group_tag >= 0) {
- if (tag != session->portal_group_tag) {
- log_error("Portal group tag mismatch, "
- "expected %u, received %u",
+ if (tag != session->portal_group_tag)
+ log_debug(2, "Portal group tag "
+ "mismatch, expected %u, "
+ "received %u. Updating",
session->portal_group_tag, tag);
- return LOGIN_WRONG_PORTAL_GROUP;
- }
- } else
- /* we now know the tag */
- session->portal_group_tag = tag;
-
+ }
+ /* we now know the tag */
+ session->portal_group_tag = tag;
text = value_end;
} else if (iscsi_find_key_value("InitialR2T", text, end, &value,
&value_end)) {

View File

@ -1,16 +1,16 @@
diff -aurp open-iscsi-2.0-868-test1/doc/iscsiadm.8 open-iscsi-2.0-868-test1.tmp/doc/iscsiadm.8
--- open-iscsi-2.0-868-test1/doc/iscsiadm.8 2008-01-03 14:07:04.000000000 -0600
+++ open-iscsi-2.0-868-test1.tmp/doc/iscsiadm.8 2008-01-03 14:08:44.000000000 -0600
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
.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 offload, the iface config must have the hardware address (iface.hwaddress)
or the iface config must have the hardware address (iface.hwaddress)
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
@@ -310,10 +310,10 @@ The configuration file read by \fBiscsid
@@ -317,10 +317,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-868-test1/doc/iscsiadm.8 open-iscsi-2.0-868-test1.tmp/
This directory contains the portals.
.SH "SEE ALSO"
diff -aurp open-iscsi-2.0-868-test1/README open-iscsi-2.0-868-test1.tmp/README
--- open-iscsi-2.0-868-test1/README 2008-01-03 14:07:04.000000000 -0600
+++ open-iscsi-2.0-868-test1.tmp/README 2008-01-03 14:05:35.000000000 -0600
@@ -138,10 +138,10 @@ available on all Linux installations.
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.
The database contains two tables:
@ -40,7 +40,7 @@ diff -aurp open-iscsi-2.0-868-test1/README open-iscsi-2.0-868-test1.tmp/README
The iscsiadm utility is a command-line tool to manage (update, delete,
insert, query) the persistent database.
@@ -288,7 +288,7 @@ a scsi_host per HBA port).
@@ -327,7 +327,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
@ -49,7 +49,7 @@ diff -aurp open-iscsi-2.0-868-test1/README open-iscsi-2.0-868-test1.tmp/README
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
@@ -301,29 +301,29 @@ Running:
@@ -340,29 +340,29 @@ Running:
iface0 qla4xxx,00:c0:dd:08:63:e8,default
iface1 qla4xxx,00:c0:dd:08:63:ea,default
@ -84,7 +84,7 @@ diff -aurp open-iscsi-2.0-868-test1/README open-iscsi-2.0-868-test1.tmp/README
iface.transport_name = tcp
iface.hwaddress = 00:C0:DD:08:63:E7
@@ -347,7 +347,7 @@ but you have not logged in then, iscsiad
@@ -386,7 +386,7 @@ but you have not logged in then, iscsiad
all existing bindings.
When you then run iscsiadm to do discovery, it will check for interfaces
@ -93,7 +93,7 @@ diff -aurp open-iscsi-2.0-868-test1/README open-iscsi-2.0-868-test1.tmp/README
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
@@ -361,7 +361,7 @@ we do not bind a session to a iface, the
@@ -400,7 +400,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 +102,7 @@ diff -aurp open-iscsi-2.0-868-test1/README open-iscsi-2.0-868-test1.tmp/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.
@@ -396,13 +396,13 @@ iscsiadm -m node -p ip:port -I iface0 --
@@ -435,7 +435,7 @@ iscsiadm -m node -p ip:port -I iface0 --
./iscsiadm -m discovery -t sendtargets -p 192.168.1.1:3260
@ -111,19 +111,32 @@ diff -aurp open-iscsi-2.0-868-test1/README open-iscsi-2.0-868-test1.tmp/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 --
existing portals.
- SendTargets iSCSI Discovery with a specific interface. If you
- SendTargets iSCSI Discovery with a specific interface. If you
- wish to only use a subset of the interfaces in /etc/iscsi/ifaces
+ wish to only use a subset of the interfaces in /var/lib/iscsi/ifaces
then you can pass them in during discovery:
./iscsiadm -m discovery -t sendtargets -p 192.168.1.1:3260 \
diff -aurp open-iscsi-2.0-868-test1/usr/idbm.c open-iscsi-2.0-868-test1.tmp/usr/idbm.c
--- open-iscsi-2.0-868-test1/usr/idbm.c 2008-01-03 14:07:04.000000000 -0600
+++ open-iscsi-2.0-868-test1.tmp/usr/idbm.c 2008-01-03 14:03:36.000000000 -0600
@@ -2582,9 +2582,9 @@ idbm_init(idbm_get_config_file_fn *fn)
idbm_t *db;
@@ -768,8 +768,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
-defined in /etc/iscsi/ifaces. If no interface was defined in
-/etc/iscsi/ifaces or passed in, the default behavior is used.
+defined in /var/lib/iscsi/ifaces. If no interface was defined in
+/var/lib/iscsi/ifaces or passed in, the default behavior is used.
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:
int idbm_init(idbm_get_config_file_fn *fn)
{
/* make sure root db dir is there */
- if (access(ISCSI_CONFIG_ROOT, F_OK) != 0) {
- if (mkdir(ISCSI_CONFIG_ROOT, 0660) != 0) {
@ -132,26 +145,22 @@ diff -aurp open-iscsi-2.0-868-test1/usr/idbm.c open-iscsi-2.0-868-test1.tmp/usr/
+ if (mkdir(ISCSIVAR, 0660) != 0) {
+ log_error("Could not make %s %d\n", ISCSIVAR,
errno);
return NULL;
return errno;
}
Only in open-iscsi-2.0-868-test1.tmp/usr: idbm.c.orig
diff -aurp open-iscsi-2.0-868-test1/usr/idbm.h open-iscsi-2.0-868-test1.tmp/usr/idbm.h
--- open-iscsi-2.0-868-test1/usr/idbm.h 2008-01-03 13:23:36.000000000 -0600
+++ open-iscsi-2.0-868-test1.tmp/usr/idbm.h 2008-01-03 14:03:36.000000000 -0600
@@ -26,12 +26,14 @@
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 @@
#include "initiator.h"
#include "config.h"
-#define NODE_CONFIG_DIR ISCSI_CONFIG_ROOT"nodes"
-#define IFACE_CONFIG_DIR ISCSI_CONFIG_ROOT"ifaces"
-#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 ST_CONFIG_DIR ISCSI_CONFIG_ROOT"send_targets"
+#define ISCSIVAR "/var/lib/iscsi/"
+
+#define NODE_CONFIG_DIR ISCSIVAR"nodes"
+#define IFACE_CONFIG_DIR ISCSIVAR"ifaces"
+#define SLP_CONFIG_DIR ISCSIVAR"slp"
+#define ISNS_CONFIG_DIR ISCSIVAR"isns"
+#define STATIC_CONFIG_DIR ISCSIVAR"static"
@ -159,3 +168,15 @@ diff -aurp open-iscsi-2.0-868-test1/usr/idbm.h open-iscsi-2.0-868-test1.tmp/usr/
#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 @@
#ifndef ISCSI_IFACE_H
#define ISCSI_IFACE_H
-#define IFACE_CONFIG_DIR ISCSI_CONFIG_ROOT"ifaces"
+#define IFACE_CONFIG_DIR "/var/lib/iscsi/ifaces"
struct iface_rec;
struct list_head;

View File

@ -1,23 +1,18 @@
Summary: iSCSI daemon and utility programs
Name: iscsi-initiator-utils
Version: 6.2.0.868
Release: 0.6%{?dist}
Source0: http://www.open-iscsi.org/bits/open-iscsi-2.0-868-test1.tar.gz
Version: 6.2.0.870
Release: 0.1.rc1%{?dist}
Source0: http://www.open-iscsi.org/bits/open-iscsi-2.0-870-rc1.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-add-fw-login.patch
Patch5: iscsi-initiator-utils-use-new-tpgt.patch
Patch6: iscsi-initiator-utils-fix-compile-err-include-limits.patch
Patch7: iscsi-initiator-utils-handle-ipv6-compat-addrs.patch
Patch8: iscsi-initiator-utils-Fix-connection-cleanup-when-iscsid-is-restarted.patch
Patch9: iscsi-initiator-utils-fix-sync-up.patch
Patch10: iscsi-initiator-utils-update-startup-doc.patch
Patch11: iscsi-initiator-utils-fix-segment-len-check.patch
Patch12: iscsi-initiator-utils-print-ibft-net-info.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
Group: System Environment/Daemons
License: GPLv2+
@ -35,20 +30,14 @@ for distributed disk access using SCSI commands sent over Internet
Protocol networks.
%prep
%setup -q -n open-iscsi-2.0-868-test1
%setup -q -n open-iscsi-2.0-870-rc1
%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 .add-fw-login
%patch5 -p1 -b .use-new-tpgt
%patch6 -p1 -b .fix-compile-err-include-limits
%patch7 -p1 -b .handle-ipv6-compat-addrs
%patch8 -p1 -b .Fix-connection-cleanup-when-iscsid-is-restarted
%patch9 -p1 -b .fix-sync-up
%patch10 -p1 -b .update-startup-doc
%patch11 -p1 -b .fix-segment-len-check
%patch12 -p1 -b .print-ibft-net-info
%patch4 -p1 -b .print-ibft-net-info
%patch5 -p1 -b .only-root
%patch6 -p1 -b .start-iscsid
%build
@ -62,6 +51,7 @@ mkdir -p $RPM_BUILD_ROOT/sbin
mkdir -p ${RPM_BUILD_ROOT}%{_mandir}/man8
mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d
mkdir -p $RPM_BUILD_ROOT/etc/iscsi
mkdir -p $RPM_BUILD_ROOT/etc/NetworkManager/dispatcher.d
mkdir -p $RPM_BUILD_ROOT/var/lib/iscsi
mkdir -p $RPM_BUILD_ROOT/var/lib/iscsi/nodes
mkdir -p $RPM_BUILD_ROOT/var/lib/iscsi/send_targets
@ -80,6 +70,8 @@ install -p -m 644 etc/iscsid.conf $RPM_BUILD_ROOT%{_sysconfdir}/iscsi
install -p -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_initrddir}/iscsid
install -p -m 755 %{SOURCE2} $RPM_BUILD_ROOT%{_initrddir}/iscsi
install -p -m 755 %{SOURCE3} $RPM_BUILD_ROOT/etc/NetworkManager/dispatcher.d
%clean
rm -rf $RPM_BUILD_ROOT
@ -118,12 +110,28 @@ fi
%dir %{_var}/lock/iscsi
%{_initrddir}/iscsi
%{_initrddir}/iscsid
%{_sysconfdir}/NetworkManager
%attr(0600,root,root) %config(noreplace) %{_sysconfdir}/iscsi/iscsid.conf
/sbin/*
%{_mandir}/man8/*
%changelog
* Tue Sep 30 2008 Hans de Goede <hdegoede@redhat.com> 6.2.0.870-0.1.rc1
- Rewrite SysV initscripts, fixes rh 441290, 246960, 282001, 436175, 430791
- Add patch to make iscsiadm complain and exit when run as user instead
of hang spinning for the database lock
- Add patch to make iscsiadm start iscsid when needed (rh 436175 related)
- Don't start iscsi service when network not yet up (in case of using NM)
add NM dispatcher script to start iscsi service once network is up
* Mon Jun 30 2008 Mike Christie <mchristie@redhat.com> - 6.2.0.870
- Rebase to open-iscsi-2-870
- 453282 Handle sysfs changes.
* Fri Apr 25 2008 Mike Christie <mchristie@redhat.com> - 6.2.0.868-0.7
- 437522 log out sessions that are not used for root during "iscsi stop".
* Fri Apr 4 2008 Mike Christie <mchristie@redhat.com> - 6.2.0.868-0.6
- Rebase to RHEL5 to bring in bug fixes.
- 437522 iscsi startup does not need to modify with network startup.

View File

@ -1,90 +0,0 @@
#!/bin/sh
#
# chkconfig: 345 13 89
# description: Starts and stops the iSCSI initiator
#
# processname: iscsid
# pidfile: /etc/iscsi/iscsid.pid
# config: /etc/iscsi/iscsid.conf
# Source function library.
. /etc/init.d/functions
PATH=/sbin:/bin:/usr/sbin:/usr/bin
RETVAL=0
start()
{
echo -n $"Starting iSCSI initiator service: "
modprobe -q iscsi_tcp
modprobe -q ib_iser
daemon iscsid
RETVAL=$?
echo
[ $RETVAL -eq 0 ] || return
touch /var/lock/subsys/iscsi
echo -n $"Setting up iSCSI targets: "
TARGETS=`iscsiadm -m node 2>/dev/null | sed 's/ /@/g'`
for node in $TARGETS; do
target=`echo $node | cut -d@ -f2`
port=`echo $node | cut -d@ -f1`
STARTUP=`iscsiadm -m node -T $target -p $port | grep "node.conn\[0\].startup" | cut -d' ' -f3`
if [ "$STARTUP" = "automatic" ]; then
iscsiadm -m node -T $target -p $port -l
fi
done
success
echo
}
stop()
{
echo -n $"Stopping iSCSI initiator service: "
sync
# TARGETS=`iscsiadm -m session | grep "\[*\]" | sed 's@\[\(.*\)\] .*@\1@g'`
# for rec in $TARGETS; do
# iscsiadm -m node -r $rec -u
# done
killproc iscsid
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/iscsi
modprobe -r ib_iser 2>/dev/null
modprobe -r iscsi_tcp 2>/dev/null
}
restart()
{
stop
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
status)
status iscsid
RETVAL=$?
;;
condrestart)
[ -f /var/lock/subsys/iscsi ] && restart
;;
*)
echo $"Usage: $0 {start|stop|restart|status|condrestart}"
exit 1
esac
exit $RETVAL

View File

@ -1,124 +1,131 @@
#!/bin/sh
#
# iscsid iSCSI daemon
#
# chkconfig: 345 7 89
# description: Starts and stops the iSCSI daemon.
#
# processname: iscsid
# pidfile: /var/run/iscsid.pid
# config: /etc/iscsi/iscsid.conf
#
### BEGIN INIT INFO
# Provides: iscsid
# Required-Start: $network
# Required-Stop: $network
# Default-Start: 3 4 5
# Default-Stop: 0 1 2 6
# Short-Description: Starts and stops login iSCSI daemon.
# Description: iscsid provides the iSCSI session and connection state machine
# for software iscsi/iser (iscsi_tcp/ib_iser) and partialy
# offloaded hardware (bnx2i).
### END INIT INFO
#
# Source function library.
. /etc/init.d/functions
. /etc/rc.d/init.d/functions
PATH=/sbin:/bin:/usr/sbin:/usr/bin
exec=/sbin/iscsid
prog=iscsid
config=/etc/iscsi/iscsid.conf
lockfile=/var/lock/subsys/$prog
RETVAL=0
# FIXME this has a false positive for root on nfs
root_is_iscsi() {
rootopts=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $4; }}' /etc/mtab)
[[ "$rootopts" =~ "_netdev" ]]
}
start()
{
if [ -f /var/lock/subsys/iscsid ] ; then
echo
success
return
fi
start() {
[ -x $exec ] || exit 5
[ -f $config ] || exit 6
echo -n $"Starting iSCSI daemon: "
# only start if nodes are setup to startup automatically or root is iscsi
grep -qrs "node.startup = automatic" /var/lib/iscsi/nodes
if [ $? -eq 0 ] || root_is_iscsi; then
echo -n $"Starting $prog: "
modprobe -q iscsi_tcp
modprobe -q ib_iser
daemon iscsid
RETVAL=$?
echo
[ $RETVAL -eq 0 ] || return
daemon $prog
retval=$?
echo
[ $retval -eq 0 ] || return 1
touch $lockfile
fi
touch /var/lock/subsys/iscsid
success
echo
return 0
}
stop_iscsid()
{
killproc iscsid
echo
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/iscsid
stop() {
declare -a iparams=( $(iscsiadm -m session 2>/dev/null | egrep "tcp|iser") )
if [[ -n "${iparams[*]}" ]]; then
# We have active sessions, so don't stop iscsid!!
echo -n $"Not stopping $prog: iscsi sessions still active"
warning $"Not stopping $prog: iscsi sessions still active"
echo
return 0
fi
modprobe -r ib_iser 2>/dev/null
modprobe -r iscsi_tcp 2>/dev/null
echo -n $"Stopping $prog: "
killproc $prog
retval=$?
echo
modprobe -r ib_iser 2>/dev/null
modprobe -r iscsi_tcp 2>/dev/null
[ $retval -eq 0 ] && rm -f $lockfile
return $retval
}
stop()
{
if [ ! -f /var/lock/subsys/iscsid ]; then
echo
success
return
fi
declare -a iparams=( $(iscsiadm -m session 2>/dev/null | egrep "tcp|iser") )
if [[ -z "${iparams[*]}" ]]; then
# no sessions so we can just quit
stop_iscsid
return
fi
# If this is a final shutdown/halt, do nothing since
# we may need iscsid for as long as possible (halt script kills
# us at the last second)
if [ "$RUNLEVEL" = "6" -o "$RUNLEVEL" = "0" -o "$RUNLEVEL" = "1" ]; then
rm -f /var/lock/subsys/iscsid
success
return
fi
# don't turn off iscsi if root is possibly on a iscsi disk
rootopts=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $4; }}' /etc/mtab)
if [[ "$rootopts" =~ "_netdev" ]] ; then
echo $"Can not shutdown iSCSI. Root is on a iSCSI disk."
exit 1
fi
echo -n $"Stopping iSCSI daemon: "
stop_iscsid
restart() {
stop
start
}
restart()
{
stop
start
reload() {
return 3
}
force_reload() {
restart
}
rh_status() {
status $prog
}
rh_status_q() {
rh_status >/dev/null 2>&1
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
status)
status iscsid
RETVAL=$?
;;
condrestart)
[ -f /var/lock/subsys/iscsid ] && restart
;;
*)
echo $"Usage: $0 {start|stop|restart|status|condrestart}"
exit 1
start)
rh_status_q && exit 0
$1
;;
stop)
rh_status_q || exit 0
$1
;;
restart)
$1
;;
reload)
rh_status_q || exit 7
$1
;;
force-reload)
force_reload
;;
status)
rh_status
;;
condrestart|try-restart)
rh_status_q || exit 0
restart
;;
*)
echo $"Usage: $0
{start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
exit 2
esac
exit $RETVAL
exit $?

View File

@ -1,116 +1,146 @@
#!/bin/sh
#
# iscsi: log into iSCSI targets
#
# chkconfig: 345 13 89
# description: Logs into iSCSI targets needed at system startup
#
# Note we should have $network in Required-Start/Stop but we don't because if
# we would require network chkconfig will put us directly after NetworkManager
# when using NM, which will make our see if the network is up test succeed
# while NM is actually still configuring the network. By not requiring network
# chkconfig will use the chkconfig header to determine our start prio, starting
# us after the old network service, but before NM (netfs does this the same).
### BEGIN INIT INFO
# Provides: iscsi
# Required-Start: $network $iscsid
# Required-Stop: $network $iscsid
# Required-Start: iscsid
# Required-Stop: iscsid
# Default-Start: 3 4 5
# Default-Stop: 0 1 2 6
# Short-Description: Starts and stops login and scanning of iSCSI devices.
# Description: iscsi provides the iSCSI state machine for software iscsi/iser
# and partial offloaded hardware. iscsi logs into and scans
# for iSCSI devices, and shuts them down when stopped.
### END INIT INFO
#
# Source function library.
. /etc/init.d/functions
. /etc/rc.d/init.d/functions
PATH=/sbin:/bin:/usr/sbin:/usr/bin
exec="/sbin/iscsiadm"
prog="iscsi"
config="/etc/iscsi/initiatorname.iscsi"
lockfile=/var/lock/subsys/$prog
iscsid_lockfile=/var/lock/subsys/${prog}_iscsid
RETVAL=0
start() {
[ -x $exec ] || exit 5
[ -f $config ] || exit 6
start()
{
if [ -f /var/lock/subsys/iscsi ] ; then
echo
success
return
fi
# if the network isn't up yet exit cleanly, NetworkManager will call us
# again when the network is up
[ ! -f /var/lock/subsys/network -a ! -f /var/lock/subsys/NetworkManager ] && exit 0
# Not sure if this is ok.
# It was done for compatiblity where users were used to
# just starting the iscsi service, but for root boot we
# need need iscsid start earlier than the devices we
# log into below.
status iscsid
RETVAL=$?
# if no nodes are setup to startup automatically exit cleanly
grep -qrs "node.startup = automatic" /var/lib/iscsi/nodes
[ $? -eq 0 ] || exit 0
if [ $RETVAL -ne 0 ]; then
/etc/init.d/iscsid start
fi
# this script is normally called from startup so log into
# nodes marked node.startup=automatic
echo -n $"Starting $prog: "
$exec -m node --loginall=automatic 2>&1 > /dev/null | grep iscsiadm
# this script is normally called from startup so log into
# nodes marked node.startup=automatic
iscsiadm -m node --loginall=automatic
touch /var/lock/subsys/iscsi
success
echo
# <sigh> iscsiadm does not always give a non 0 exit status in case of
# error so we grep for any messages to stderr and see those as errors too
if [ ${PIPESTATUS[0]} -ne 0 -o ${PIPESTATUS[1]} -eq 0 ]; then
failure $"Starting $prog"
echo
return 1
fi
success $"Starting $prog"
touch $lockfile
echo
return 0
}
cleanup_iscsi()
{
/etc/init.d/iscsid stop
rm -f /var/lock/subsys/iscsi
success
stop() {
echo -n $"Stopping $prog: "
$exec -m node --logoutall=automatic 2>&1 > /dev/null | grep iscsiadm
# <sigh> iscsiadm does not always give a non 0 exit status in case of
# error so we grep for any messages to stderr and see those as errors too
if [ ${PIPESTATUS[0]} -ne 0 -o ${PIPESTATUS[1]} -eq 0 ]; then
failure $"Stopping $prog"
echo
return 1
fi
success $"Stopping $prog"
rm -f $lockfile
echo
return 0
}
stop()
{
if [ ! -f /var/lock/subsys/iscsi ]; then
echo
success
return
fi
declare -a iparams=( $(iscsiadm -m session 2>/dev/null | egrep "tcp|iser") )
if [[ -z "${iparams[*]}" ]]; then
# no sessions so we can just quit
cleanup_iscsi
return
fi
# If this is a final shutdown/halt, do nothing since
# lvm/dm, md, power path, etc do not always handle this nicely.
# The kernel will do the right thing and shutdown devices (send
# cache syncs, start_stops, etc) that need it.
if [ "$RUNLEVEL" = "6" -o "$RUNLEVEL" = "0" -o "$RUNLEVEL" = "1" ]; then
rm -f /var/lock/subsys/iscsi
success
return
fi
# don't turn off iscsi if root is possibly on a iscsi disk
rootopts=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $4; }}' /etc/mtab)
if [[ "$rootopts" =~ "_netdev" ]] ; then
echo $"Can not shutdown iSCSI. Root is on a iSCSI disk."
exit 1
fi
iscsiadm -m node --logoutall=all
cleanup_iscsi
restart() {
stop
start
}
reload() {
return 3
}
force_reload() {
restart
}
rh_status() {
[ -f $lockfile ] || return 3
declare -a iparams=( $(iscsiadm -m session 2>/dev/null | egrep "tcp|iser") )
if [[ -z "${iparams[*]}" ]]; then
# no sessions
return 2
fi
return 0
}
rh_status_q() {
rh_status >/dev/null 2>&1
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
status)
status iscsid
RETVAL=$?
;;
condrestart)
[ -f /var/lock/subsys/iscsi ] && restart
;;
*)
echo $"Usage: $0 {start|stop|restart|status|condrestart}"
exit 1
start)
rh_status_q && exit 0
$1
;;
stop)
rh_status_q || exit 0
$1
;;
restart)
$1
;;
reload)
rh_status_q || exit 7
$1
;;
force-reload)
force_reload
;;
status)
rh_status
;;
condrestart|try-restart)
rh_status_q || exit 0
restart
;;
*)
echo $"Usage: $0
{start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
exit 2
esac
exit $RETVAL
exit $?

View File

@ -1,39 +0,0 @@
diff -Naurp open-iscsi-6.0.5.595/usr/Makefile open-iscsi-6.0.5.610.work/usr/Makefile
--- open-iscsi-6.0.5.595/usr/Makefile 2006-06-21 12:32:51.000000000 -0500
+++ open-iscsi-6.0.5.610.work/usr/Makefile 2006-06-21 12:33:55.000000000 -0500
@@ -50,8 +50,9 @@ iscsid: $(COMMON_SRCS) $(IPC_OBJ) $(INIT
iscsiadm: $(COMMON_SRCS) strings.o discovery.o iscsiadm.o
$(CC) $(CFLAGS) $^ $(DBM_LIB) -o $@
-iscsistart: $(IPC_OBJ) $(ISCSI_LIB_SRCS) $(INITIATOR_SRCS) iscsistart.o
- $(CC) $(CFLAGS) $^ -o $@
+iscsistart: $(IPC_OBJ) $(ISCSI_LIB_SRCS) $(INITIATOR_SRCS) iscsistart.o \
+ statics.o
+ $(CC) -static $(CFLAGS) $^ -o $@
clean:
rm -f *.o $(PROGRAMS)
diff -Naurp open-iscsi-6.0.5.595/usr/statics.c open-iscsi-6.0.5.610.work/usr/statics.c
--- open-iscsi-6.0.5.595/usr/statics.c 1969-12-31 18:00:00.000000000 -0600
+++ open-iscsi-6.0.5.610.work/usr/statics.c 2006-06-21 12:30:05.000000000 -0500
@@ -0,0 +1,20 @@
+#include <unistd.h>
+#include <pwd.h>
+#include <sys/errno.h>
+#include <sys/types.h>
+
+static struct passwd root_pw = {
+ .pw_name = "root",
+};
+
+struct passwd*
+getpwuid(uid_t uid)
+{
+ if (uid == 0)
+ return &root_pw;
+ else {
+ errno = ENOENT;
+ return 0;
+ }
+}
+

View File

@ -1 +1 @@
e453be2213e60cb463353d896a9c3a78 open-iscsi-2.0-868-test1.tar.gz
2740f55611d3ea59a21ec08b25853c55 open-iscsi-2.0-870-rc1.tar.gz