mass-import of iscsi-initiator-utils-6.2.0.870-8.fc11.src.rpm from dist-f11
This commit is contained in:
parent
2f14a070a1
commit
2628f3092f
10
.cvsignore
10
.cvsignore
@ -1,9 +1 @@
|
||||
open-iscsi-5.0.4.446.tar.gz
|
||||
open-iscsi-5.0.5.476.tar.bz2
|
||||
open-iscsi-5.0.5.595.tar.bz2
|
||||
open-iscsi-6.0.5.595.tar.bz2
|
||||
open-iscsi-1.1-645.tar.bz2
|
||||
open-iscsi-6.1.1.645.tar.bz2
|
||||
open-iscsi-6.1.1.685.tar.bz2
|
||||
open-iscsi-6.2.0.695.tar.bz2
|
||||
open-iscsi-2.0-754.tar.gz
|
||||
open-iscsi-2.0-870.1.tar.gz
|
||||
|
17
04-iscsi
Executable file
17
04-iscsi
Executable file
@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
|
||||
export LC_ALL=C
|
||||
|
||||
if [ "$2" = "down" ]; then
|
||||
if ! /sbin/ip route ls | grep -q ^default &&
|
||||
[ -f /var/lock/subsys/iscsi ]; then
|
||||
/etc/rc.d/init.d/iscsi stop
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$2" = "up" ]; then
|
||||
if /sbin/ip -o route show dev "$1" | grep -q '^default' &&
|
||||
/sbin/chkconfig iscsi; then
|
||||
/etc/rc.d/init.d/iscsi start
|
||||
fi
|
||||
fi
|
@ -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 */
|
312
iscsi-initiator-utils-ibft-sysfs.patch
Normal file
312
iscsi-initiator-utils-ibft-sysfs.patch
Normal file
@ -0,0 +1,312 @@
|
||||
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
|
16
iscsi-initiator-utils-only-root-use.patch
Normal file
16
iscsi-initiator-utils-only-root-use.patch
Normal file
@ -0,0 +1,16 @@
|
||||
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 "
|
219
iscsi-initiator-utils-print-ibft-net-info.patch
Normal file
219
iscsi-initiator-utils-print-ibft-net-info.patch
Normal file
@ -0,0 +1,219 @@
|
||||
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;
|
||||
|
||||
}
|
||||
|
202
iscsi-initiator-utils-start-iscsid.patch
Normal file
202
iscsi-initiator-utils-start-iscsid.patch
Normal file
@ -0,0 +1,202 @@
|
||||
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);
|
@ -1,7 +1,7 @@
|
||||
diff -aurp open-iscsi-2.0-737/etc/iscsid.conf open-iscsi-2.0-737.work/etc/iscsid.conf
|
||||
--- open-iscsi-2.0-737/etc/iscsid.conf 2006-11-22 14:21:17.000000000 -0600
|
||||
+++ open-iscsi-2.0-737.work/etc/iscsid.conf 2006-11-24 16:26:17.000000000 -0600
|
||||
@@ -14,8 +14,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,46 +12,36 @@ diff -aurp open-iscsi-2.0-737/etc/iscsid.conf open-iscsi-2.0-737.work/etc/iscsid
|
||||
|
||||
# *************
|
||||
# CHAP Settings
|
||||
diff -aurp open-iscsi-2.0-737/README open-iscsi-2.0-737.work/README
|
||||
--- open-iscsi-2.0-737/README 2006-11-22 14:32:55.000000000 -0600
|
||||
+++ open-iscsi-2.0-737.work/README 2006-11-24 16:38:37.000000000 -0600
|
||||
@@ -303,19 +303,10 @@ option. For example this would mount a i
|
||||
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.
|
||||
|
||||
/dev/sdb /mnt/iscsi ext3 _netdev 0 0
|
||||
|
||||
-SUSE or Debian:
|
||||
----------------
|
||||
-Otherwise, if there is a initd script for your distro in etc/initd that
|
||||
-gets installed with "make install"
|
||||
-You need to enable "Cryptographic API" under "Cryptographic options" in the
|
||||
-kernel config. And you must enable "CRC32c CRC algorithm" even if
|
||||
-you do not use header or data digests. They are the kernel options,
|
||||
-CONFIG_CRYPTO and CONFIG_CRYPTO_CRC32C, respectively.
|
||||
-
|
||||
- /etc/init.d/open-iscsi start
|
||||
-
|
||||
-will usually get you started.
|
||||
-
|
||||
-Other:
|
||||
+Manual:
|
||||
------
|
||||
-If there is no initd script, you must start the tools by hand. First load the
|
||||
-iscsi modules with:
|
||||
+If there is no initd script or you wish to run iscsi manually, you must start
|
||||
+the tools by hand. First load the iscsi modules with:
|
||||
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:
|
||||
-----------------
|
||||
To start open-iscsi in Red Hat/Fedora you can do:
|
||||
|
||||
modprobe -q iscsi_tcp
|
||||
- service open-iscsi start
|
||||
+ service iscsi start
|
||||
|
||||
@@ -358,8 +349,6 @@ storage), it is better to automate the l
|
||||
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
|
||||
e.g /etc/init.d/open-iscsi restart. On your next startup the nodes will
|
||||
be logged into autmotically.
|
||||
|
||||
3. automate target logins for future system reboots
|
||||
---------------------------------------------------
|
||||
-Note: this may only work for Red Hat, Fedora and SUSE configurations
|
||||
-
|
||||
To automate login to a node, use the following with the record ID 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
|
||||
@@ -372,7 +361,6 @@ all sessions add the following to the /e
|
||||
To login to all the automated nodes, simply restart the iscsi service
|
||||
e.g /etc/init.d/open-iscsi restart
|
||||
|
||||
-
|
||||
8. TBD
|
||||
======
|
||||
+To set the startup value, so that nodes are not logged into automatically
|
||||
+use the value "manual".
|
||||
|
||||
8. Advanced Configuration
|
||||
=========================
|
||||
|
11
iscsi-initiator-utils-use-red-hat-for-name.patch
Normal file
11
iscsi-initiator-utils-use-red-hat-for-name.patch
Normal file
@ -0,0 +1,11 @@
|
||||
--- 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[])
|
||||
exit(0);
|
||||
}
|
||||
} else {
|
||||
- prefix = "iqn.2005-03.org.open-iscsi";
|
||||
+ prefix = "iqn.1994-05.com.fedora";
|
||||
}
|
||||
|
||||
/* try to feed some entropy from the pool to MD5 in order to get
|
@ -1,78 +1,182 @@
|
||||
diff -aurp open-iscsi-6.2.0.695/usr/idbm.c open-iscsi-6.2.0.695.work/usr/idbm.c
|
||||
--- open-iscsi-6.2.0.695/usr/idbm.c 2006-10-03 13:54:51.000000000 -0500
|
||||
+++ open-iscsi-6.2.0.695.work/usr/idbm.c 2006-10-03 14:44:56.000000000 -0500
|
||||
@@ -831,10 +831,18 @@ idbm_node_write(idbm_t *db, node_rec_t *
|
||||
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 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
|
||||
@@ -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
|
||||
-/etc/iscsi/nodes/
|
||||
+/var/lib/iscsi/nodes/
|
||||
This directory contains the nodes with their targets.
|
||||
.TP
|
||||
-/etc/iscsi/send_targets
|
||||
+/var/lib/iscsi/send_targets
|
||||
This directory contains the portals.
|
||||
|
||||
idbm_lock(db);
|
||||
.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.
|
||||
|
||||
- snprintf(portal, PATH_MAX, "%s", NODE_CONFIG_DIR);
|
||||
- if (access(portal, F_OK) != 0) {
|
||||
+ /* bah: there has to be a function to make all these subdirs for us */
|
||||
+ if (access(CONFIG_DIR, F_OK) != 0) {
|
||||
if (mkdir(portal, 0660) != 0) {
|
||||
- log_error("Could not make %s\n", portal);
|
||||
+ log_error("Could not make %s %d\n", CONFIG_DIR, errno);
|
||||
+ rc = errno;
|
||||
+ goto free_portal;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (access(NODE_CONFIG_DIR, F_OK) != 0) {
|
||||
+ if (mkdir(NODE_CONFIG_DIR, 0660) != 0) {
|
||||
+ log_error("Could not make %s\n", NODE_CONFIG_DIR);
|
||||
rc = errno;
|
||||
goto free_portal;
|
||||
}
|
||||
@@ -869,6 +877,7 @@ free_portal:
|
||||
return rc;
|
||||
}
|
||||
The database contains two tables:
|
||||
|
||||
+/* TODO: merged these two functions */
|
||||
static int
|
||||
idbm_discovery_write(idbm_t *db, discovery_rec_t *rec)
|
||||
-- Discovery table (/etc/iscsi/send_targets);
|
||||
-- Node table (/etc/iscsi/nodes).
|
||||
+- Discovery table (/var/lib/iscsi/send_targets);
|
||||
+- Node table (/var/lib/iscsi/nodes).
|
||||
|
||||
-The regular place for iSCSI database files: /etc/iscsi/nodes
|
||||
+The regular place for iSCSI database files: /var/lib/iscsi/nodes
|
||||
|
||||
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).
|
||||
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
|
||||
|
||||
-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
|
||||
|
||||
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
|
||||
-/etc/iscsi/ifaces which can be used as a template for the daring.
|
||||
+/var/lib/iscsi/ifaces which can be used as a template for the daring.
|
||||
|
||||
For each network object you wish to bind a session to you must create
|
||||
-a seperate iface config in /etc/iscsi/ifaces and each iface config file
|
||||
+a seperate iface config in /var/lib/iscsi/ifaces and each iface config file
|
||||
must have a unique name which is less than or equal to 64 characters.
|
||||
|
||||
Example:
|
||||
|
||||
If you have NIC1 with MAC address 00:0F:1F:92:6B:BF and NIC2 with
|
||||
MAC address 00:C0:DD:08:63:E7 and you wanted to do software iscsi over
|
||||
-TCP/IP. Then in /etc/iscsi/ifaces/iface0 you would enter:
|
||||
+TCP/IP. Then in /var/lib/iscsi/ifaces/iface0 you would enter:
|
||||
|
||||
iface.transport_name = tcp
|
||||
iface.hwaddress = 00:0F:1F:92:6B:BF
|
||||
|
||||
-and in /etc/iscsi/ifaces/iface1 you would enter:
|
||||
+and in /var/lib/iscsi/ifaces/iface1 you would enter:
|
||||
|
||||
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.
|
||||
|
||||
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
|
||||
|
||||
iscsiadm -m discovery -t st -p ip:port -I default -P 1
|
||||
|
||||
-And if you did not define any interfaces in /etc/iscsi/ifaces and do
|
||||
+And if you did not define any interfaces in /var/lib/iscsi/ifaces and do
|
||||
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 --
|
||||
|
||||
./iscsiadm -m discovery -t sendtargets -p 192.168.1.1:3260
|
||||
|
||||
- This will first search /etc/iscsi/ifaces for interfaces
|
||||
+ This will first search /var/lib/iscsi/ifaces for interfaces
|
||||
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
|
||||
- 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 \
|
||||
@@ -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)
|
||||
{
|
||||
@@ -883,10 +892,18 @@ idbm_discovery_write(idbm_t *db, discove
|
||||
}
|
||||
|
||||
idbm_lock(db);
|
||||
- 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);
|
||||
+
|
||||
+ if (access(CONFIG_DIR, F_OK) != 0) {
|
||||
+ if (mkdir(CONFIG_DIR, 0660) != 0) {
|
||||
+ log_error("Could not make %s %d\n", CONFIG_DIR, errno);
|
||||
+ rc = errno;
|
||||
+ goto free_portal;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (access(ST_CONFIG_DIR, F_OK) != 0) {
|
||||
+ if (mkdir(ST_CONFIG_DIR, 0660) != 0) {
|
||||
+ log_error("Could not make %s\n", ST_CONFIG_DIR);
|
||||
rc = errno;
|
||||
goto free_portal;
|
||||
/* make sure root db dir is there */
|
||||
- if (access(ISCSI_CONFIG_ROOT, F_OK) != 0) {
|
||||
- if (mkdir(ISCSI_CONFIG_ROOT, 0660) != 0) {
|
||||
- log_error("Could not make %s %d\n", ISCSI_CONFIG_ROOT,
|
||||
+ if (access(ISCSIVAR, F_OK) != 0) {
|
||||
+ if (mkdir(ISCSIVAR, 0660) != 0) {
|
||||
+ log_error("Could not make %s %d\n", ISCSIVAR,
|
||||
errno);
|
||||
return errno;
|
||||
}
|
||||
diff -aurp open-iscsi-6.2.0.695/usr/initiator.h open-iscsi-6.2.0.695.work/usr/initiator.h
|
||||
--- open-iscsi-6.2.0.695/usr/initiator.h 2006-10-03 13:54:51.000000000 -0500
|
||||
+++ open-iscsi-6.2.0.695.work/usr/initiator.h 2006-10-03 14:08:09.000000000 -0500
|
||||
@@ -31,11 +31,15 @@
|
||||
#include "actor.h"
|
||||
#include "queue.h"
|
||||
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 ST_CONFIG_DIR "/etc/iscsi/send_targets"
|
||||
-#define NODE_CONFIG_DIR "/etc/iscsi/nodes"
|
||||
+#define CONFIG_DIR "/var/lib/iscsi"
|
||||
+#define ST_CONFIG_DIR "/var/lib/iscsi/send_targets"
|
||||
+#define NODE_CONFIG_DIR "/var/lib/iscsi/nodes"
|
||||
+
|
||||
#define CONFIG_FILE "/etc/iscsi/iscsid.conf"
|
||||
-#define PID_FILE "/var/run/iscsid.pid"
|
||||
#define INITIATOR_NAME_FILE "/etc/iscsi/initiatorname.iscsi"
|
||||
+
|
||||
+#define PID_FILE "/var/run/iscsid.pid"
|
||||
+
|
||||
#define LOCK_DIR "/var/lock/iscsi"
|
||||
#define LOCK_FILE "/var/lock/iscsi/lock"
|
||||
#define LOCK_WRITE_FILE "/var/lock/iscsi/lock.write"
|
||||
-#define NODE_CONFIG_DIR ISCSI_CONFIG_ROOT"nodes"
|
||||
-#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 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 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;
|
||||
|
@ -1,20 +1,33 @@
|
||||
%{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
|
||||
|
||||
Summary: iSCSI daemon and utility programs
|
||||
Name: iscsi-initiator-utils
|
||||
Version: 6.2.0.754
|
||||
Release: 0.0%{?dist}
|
||||
Source0: http://www.open-iscsi.org/bits/open-iscsi-2.0-754.tar.gz
|
||||
Version: 6.2.0.870
|
||||
Release: 8%{?dist}
|
||||
Source0: http://www.open-iscsi.org/bits/open-iscsi-2.0-870.1.tar.gz
|
||||
Source1: iscsid.init
|
||||
Source2: iscsidevs.init
|
||||
Source3: 04-iscsi
|
||||
Patch0: iscsi-initiator-utils-update-initscripts-and-docs.patch
|
||||
Patch1: iscsi-initiator-utils-add-iscsi-iname.patch
|
||||
Patch2: iscsi-initiator-utils-use-var-for-config.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-490515-workaround.patch
|
||||
|
||||
Group: System Environment/Daemons
|
||||
License: GPL
|
||||
License: GPLv2+
|
||||
URL: http://www.open-iscsi.org
|
||||
Buildroot: %{_tmppath}/%{name}-root
|
||||
BuildRequires: openssl-devel
|
||||
Prereq: /sbin/chkconfig
|
||||
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
|
||||
@ -23,15 +36,39 @@ as well as the utility programs used to manage it. iSCSI is a protocol
|
||||
for distributed disk access using SCSI commands sent over Internet
|
||||
Protocol networks.
|
||||
|
||||
%package devel
|
||||
Summary: Development files for %{name}
|
||||
Group: Development/Libraries
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
|
||||
%description devel
|
||||
The %{name}-devel package contains libraries and header files for
|
||||
developing applications that use %{name}.
|
||||
|
||||
%prep
|
||||
%setup -q -n open-iscsi-2.0-754
|
||||
%setup -q -n open-iscsi-2.0-870.1
|
||||
%patch0 -p1 -b .update-initscripts-and-docs
|
||||
%patch1 -p1 -b .add-iscsi-iname
|
||||
%patch2 -p1 -b .use-var-for-config
|
||||
%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
|
||||
|
||||
|
||||
%build
|
||||
make OPTFLAGS="%{optflags}" -C utils/fwparam_ibft
|
||||
make OPTFLAGS="%{optflags}" -C usr
|
||||
make OPTFLAGS="%{optflags}" -C utils
|
||||
make OPTFLAGS="%{optflags}" -C libiscsi
|
||||
pushd libiscsi
|
||||
python setup.py build
|
||||
popd
|
||||
|
||||
%install
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
@ -39,51 +76,158 @@ 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/iscsi
|
||||
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
|
||||
mkdir -p $RPM_BUILD_ROOT/var/lib/iscsi/static
|
||||
mkdir -p $RPM_BUILD_ROOT/var/lib/iscsi/isns
|
||||
mkdir -p $RPM_BUILD_ROOT/var/lib/iscsi/slp
|
||||
mkdir -p $RPM_BUILD_ROOT/var/lib/iscsi/ifaces
|
||||
mkdir -p $RPM_BUILD_ROOT/var/lock/iscsi
|
||||
mkdir -p $RPM_BUILD_ROOT%{_libdir}
|
||||
mkdir -p $RPM_BUILD_ROOT%{_includedir}
|
||||
mkdir -p $RPM_BUILD_ROOT%{python_sitearch}
|
||||
|
||||
install -s -m 755 usr/iscsid usr/iscsiadm utils/iscsi-iname usr/iscsistart $RPM_BUILD_ROOT/sbin
|
||||
install -m 644 doc/iscsiadm.8 $RPM_BUILD_ROOT/%{_mandir}/man8
|
||||
install -m 644 doc/iscsid.8 $RPM_BUILD_ROOT/%{_mandir}/man8
|
||||
#install -m 755 etc/initd/initd.redhat $RPM_BUILD_ROOT/etc/rc.d/init.d/iscsi
|
||||
install -m 644 etc/iscsid.conf $RPM_BUILD_ROOT/etc/iscsi
|
||||
|
||||
install -m 755 %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/iscsid
|
||||
install -m 755 %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/iscsi
|
||||
|
||||
install -p -m 755 usr/iscsid usr/iscsiadm utils/iscsi-iname usr/iscsistart $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 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
|
||||
|
||||
install -p -m 755 libiscsi/libiscsi.so.0 $RPM_BUILD_ROOT%{_libdir}
|
||||
ln -s libiscsi.so.0 $RPM_BUILD_ROOT%{_libdir}/libiscsi.so
|
||||
install -p -m 644 libiscsi/libiscsi.h $RPM_BUILD_ROOT%{_includedir}
|
||||
|
||||
install -p -m 755 libiscsi/build/lib.linux-*/libiscsimodule.so \
|
||||
$RPM_BUILD_ROOT%{python_sitearch}
|
||||
|
||||
|
||||
%clean
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%post
|
||||
if [ ! -f /etc/iscsi/initiatorname.iscsi ]; then
|
||||
echo "InitiatorName=`/sbin/iscsi-iname`" > /etc/iscsi/initiatorname.iscsi
|
||||
/sbin/ldconfig
|
||||
if [ "$1" -eq "1" ]; then
|
||||
if [ ! -f %{_sysconfdir}/iscsi/initiatorname.iscsi ]; then
|
||||
echo "InitiatorName=`/sbin/iscsi-iname`" > %{_sysconfdir}/iscsi/initiatorname.iscsi
|
||||
fi
|
||||
/sbin/chkconfig --add iscsid
|
||||
/sbin/chkconfig --add iscsi
|
||||
fi
|
||||
/sbin/chkconfig --add iscsid
|
||||
/sbin/chkconfig --add iscsi
|
||||
|
||||
%postun -p /sbin/ldconfig
|
||||
|
||||
%preun
|
||||
if [ "$1" = "0" ]; then
|
||||
# stop iscsi
|
||||
/sbin/service iscsi stop > /dev/null 2>&1
|
||||
# delete service
|
||||
/sbin/chkconfig --del iscsi
|
||||
# stop iscsid
|
||||
/sbin/service iscsid stop > /dev/null 2>&1
|
||||
# delete service
|
||||
/sbin/chkconfig --del iscsid
|
||||
fi
|
||||
|
||||
%files
|
||||
%defattr(-,root,root)
|
||||
%doc README
|
||||
%dir /var/lib/iscsi/nodes
|
||||
%dir /var/lib/iscsi/send_targets
|
||||
%dir /var/lock/iscsi
|
||||
%config /etc/rc.d/init.d/iscsi
|
||||
%config /etc/rc.d/init.d/iscsid
|
||||
%attr(0600,root,root) %config(noreplace) /etc/iscsi/iscsid.conf
|
||||
%dir %{_var}/lib/iscsi
|
||||
%dir %{_var}/lib/iscsi/nodes
|
||||
%dir %{_var}/lib/iscsi/isns
|
||||
%dir %{_var}/lib/iscsi/static
|
||||
%dir %{_var}/lib/iscsi/slp
|
||||
%dir %{_var}/lib/iscsi/ifaces
|
||||
%dir %{_var}/lib/iscsi/send_targets
|
||||
%dir %{_var}/lock/iscsi
|
||||
%{_initrddir}/iscsi
|
||||
%{_initrddir}/iscsid
|
||||
%{_sysconfdir}/NetworkManager
|
||||
%attr(0600,root,root) %config(noreplace) %{_sysconfdir}/iscsi/iscsid.conf
|
||||
/sbin/*
|
||||
%{_mandir}/*/*
|
||||
%{_libdir}/libiscsi.so.0
|
||||
%{python_sitearch}/libiscsimodule.so
|
||||
%{_mandir}/man8/*
|
||||
|
||||
%files devel
|
||||
%defattr(-,root,root,-)
|
||||
%doc libiscsi/html
|
||||
%{_libdir}/libiscsi.so
|
||||
%{_includedir}/libiscsi.h
|
||||
|
||||
%changelog
|
||||
* Fri Apr 3 2009 Hans de Goede <hdegoede@redhat.com> 6.2.0.870-8
|
||||
- Stop the NM script from exiting with an error status when it
|
||||
didn't do anything (#493411)
|
||||
|
||||
* Fri Mar 20 2009 Hans de Goede <hdegoede@redhat.com> 6.2.0.870-7
|
||||
- libiscsi: use fwparam_ibft_sysfs() instead of fw_get_entry(), as
|
||||
the latter causes stack corruption (workaround #490515)
|
||||
|
||||
* Sat Mar 14 2009 Terje Rosten <terje.rosten@ntnu.no> - 6.2.0.870-6
|
||||
- Add glibc-static to buildreq to build in F11
|
||||
|
||||
* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 6.2.0.870-5
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
|
||||
|
||||
* Thu Feb 12 2009 Hans de Goede <hdegoede@redhat.com> 6.2.0.870-4
|
||||
- Fix libiscsi.discover_sendtargets python method to accept None as valid
|
||||
authinfo argument (#485217)
|
||||
|
||||
* Wed Jan 28 2009 Hans de Goede <hdegoede@redhat.com> 6.2.0.870-3
|
||||
- Fix reading of iBFT firmware with newer kernels
|
||||
|
||||
* Wed Jan 28 2009 Hans de Goede <hdegoede@redhat.com> 6.2.0.870-2
|
||||
- Add libiscsi iscsi administration library and -devel subpackage
|
||||
|
||||
* Tue Nov 25 2008 Mike Christie <mchristie@redhat.com> 6.2.0.870-1.0
|
||||
- Rebase to upstream
|
||||
|
||||
* Thu Nov 6 2008 Hans de Goede <hdegoede@redhat.com> 6.2.0.870-0.2.rc1
|
||||
- Add force-start iscsid initscript option and use that in "patch to make
|
||||
iscsiadm start iscsid when needed" so that iscsid will actual be started
|
||||
even if there are no iscsi disks configured yet (rh 470437)
|
||||
- Do not start iscsid when not running when iscsiadm -k 0 gets executed
|
||||
(rh 470438)
|
||||
|
||||
* 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.
|
||||
- 436175 Check for running sessions when stopping service.
|
||||
|
||||
* Wed Feb 5 2008 Mike Christie <mchristie@redhat.com> - 6.2.0.868-0.3
|
||||
- Rebase to upstream and RHEL5.
|
||||
- 246960 LSB init script changes.
|
||||
|
||||
* Fri Oct 5 2007 Mike Christie <mchristie@redhat.com> - 6.2.0.865-0.2
|
||||
- Rebase to upstream's bug fix release.
|
||||
- Revert init script startup changes from 225915 which reviewers did
|
||||
not like.
|
||||
|
||||
* Mon Jun 20 2007 Mike Christie <mchristie@redhat.com> - 6.2.0.754-0.1
|
||||
- 225915 From Adrian Reber - Fix up spec and init files for rpmlint.
|
||||
|
||||
* Tue Feb 6 2007 Mike Christie <mchristie@redhat.com> - 6.2.0.754-0.0
|
||||
- Rebase to upstream.
|
||||
- Add back --map functionality but in session mode to match RHEL5 fixes
|
||||
|
98
iscsi.init
98
iscsi.init
@ -1,98 +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 $"Turning off network shutdown."
|
||||
# we do not want iscsi or network to run during system shutdown
|
||||
# incase there are RAID or multipath devices using
|
||||
# iscsi disks
|
||||
chkconfig --level 06 network off
|
||||
rm /etc/rc0.d/*network
|
||||
rm /etc/rc6.d/*network
|
||||
|
||||
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
|
199
iscsid.init
199
iscsid.init
@ -1,5 +1,7 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# iscsid iSCSI daemon
|
||||
#
|
||||
# chkconfig: 345 7 89
|
||||
# description: Starts and stops the iSCSI daemon.
|
||||
#
|
||||
@ -7,94 +9,131 @@
|
||||
# pidfile: /var/run/iscsid.pid
|
||||
# config: /etc/iscsi/iscsid.conf
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: iscsid
|
||||
# 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
|
||||
|
||||
start()
|
||||
{
|
||||
echo -n $"Turning off network shutdown. "
|
||||
# we do not want iscsi or network to run during system shutdown
|
||||
# incase there are RAID or multipath devices using
|
||||
# iscsi disks
|
||||
chkconfig --level 06 network off
|
||||
rm /etc/rc0.d/*network
|
||||
rm /etc/rc6.d/*network
|
||||
|
||||
echo -n $"Starting iSCSI daemon: "
|
||||
modprobe -q iscsi_tcp
|
||||
modprobe -q ib_iser
|
||||
daemon iscsid
|
||||
RETVAL=$?
|
||||
echo
|
||||
[ $RETVAL -eq 0 ] || return
|
||||
|
||||
touch /var/lock/subsys/iscsid
|
||||
|
||||
success
|
||||
echo
|
||||
# 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" ]]
|
||||
}
|
||||
|
||||
stop()
|
||||
{
|
||||
rm -f /var/lock/subsys/iscsid
|
||||
|
||||
# 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
|
||||
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: "
|
||||
|
||||
# iscsid does not have a nice shutdown process.
|
||||
# It really should never be stopped
|
||||
pkill -KILL iscsid
|
||||
echo
|
||||
|
||||
modprobe -r ib_iser 2>/dev/null
|
||||
modprobe -r iscsi_tcp 2>/dev/null
|
||||
force_start() {
|
||||
echo -n $"Starting $prog: "
|
||||
modprobe -q iscsi_tcp
|
||||
modprobe -q ib_iser
|
||||
daemon $prog
|
||||
retval=$?
|
||||
echo
|
||||
[ $retval -eq 0 ] && touch $lockfile
|
||||
return $retval
|
||||
}
|
||||
|
||||
restart()
|
||||
{
|
||||
stop
|
||||
start
|
||||
start() {
|
||||
[ -x $exec ] || exit 5
|
||||
[ -f $config ] || exit 6
|
||||
|
||||
# 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
|
||||
force_start
|
||||
return $?
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
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
|
||||
;;
|
||||
force-start)
|
||||
force_start
|
||||
;;
|
||||
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 $?
|
||||
|
185
iscsidevs.init
185
iscsidevs.init
@ -1,77 +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: 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 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
|
||||
|
||||
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
|
||||
|
||||
echo -n $"Setting up iSCSI targets: "
|
||||
# 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
|
||||
}
|
||||
|
||||
stop()
|
||||
{
|
||||
rm -f /var/lock/subsys/iscsi
|
||||
stop() {
|
||||
echo -n $"Stopping $prog: "
|
||||
$exec -m node --logoutall=automatic 2>&1 > /dev/null | grep iscsiadm
|
||||
|
||||
# If this is a final shutdown/halt, do nothing since
|
||||
# lvm/dm, md, power path, etc do not always handle this
|
||||
if [ "$RUNLEVEL" = "6" -o "$RUNLEVEL" = "0" -o "$RUNLEVEL" = "1" ]; then
|
||||
success
|
||||
return
|
||||
fi
|
||||
# <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
|
||||
|
||||
# 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
|
||||
/etc/init.d/iscsid stop
|
||||
success
|
||||
success $"Stopping $prog"
|
||||
rm -f $lockfile
|
||||
echo
|
||||
return 0
|
||||
}
|
||||
|
||||
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 $?
|
||||
|
@ -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;
|
||||
+ }
|
||||
+}
|
||||
+
|
38
open-iscsi-2.0-870.1-485217.patch
Normal file
38
open-iscsi-2.0-870.1-485217.patch
Normal file
@ -0,0 +1,38 @@
|
||||
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)) {
|
45
open-iscsi-2.0-870.1-490515-workaround.patch
Normal file
45
open-iscsi-2.0-870.1-490515-workaround.patch
Normal file
@ -0,0 +1,45 @@
|
||||
diff -up open-iscsi-2.0-870.1/include/fw_context.h.workaround open-iscsi-2.0-870.1/include/fw_context.h
|
||||
--- open-iscsi-2.0-870.1/include/fw_context.h.workaround 2009-03-20 15:47:16.000000000 +0100
|
||||
+++ open-iscsi-2.0-870.1/include/fw_context.h 2009-03-20 15:48:03.000000000 +0100
|
||||
@@ -51,5 +51,7 @@ struct boot_context {
|
||||
|
||||
extern int fw_get_entry(struct boot_context *context, const char *filepath);
|
||||
extern void fw_print_entry(struct boot_context *context);
|
||||
+extern int fwparam_ibft_sysfs(struct boot_context *context,
|
||||
+ const char *filepath);
|
||||
|
||||
#endif /* FWPARAM_CONTEXT_H_ */
|
||||
diff -up open-iscsi-2.0-870.1/libiscsi/libiscsi.c.workaround open-iscsi-2.0-870.1/libiscsi/libiscsi.c
|
||||
--- open-iscsi-2.0-870.1/libiscsi/libiscsi.c.workaround 2009-03-20 15:45:28.000000000 +0100
|
||||
+++ open-iscsi-2.0-870.1/libiscsi/libiscsi.c 2009-03-20 15:47:03.000000000 +0100
|
||||
@@ -196,10 +196,10 @@ int libiscsi_discover_firmware(struct li
|
||||
*found_nodes = NULL;
|
||||
|
||||
memset(&fw_entry, 0, sizeof fw_entry);
|
||||
- rc = fw_get_entry(&fw_entry, NULL);
|
||||
+ rc = fwparam_ibft_sysfs(&fw_entry, NULL);
|
||||
if (rc) {
|
||||
strcpy(context->error_str, "Could not read fw values.");
|
||||
- return rc;
|
||||
+ return ENODEV;
|
||||
}
|
||||
|
||||
memset(&rec, 0, sizeof rec);
|
||||
@@ -535,7 +535,7 @@ int libiscsi_get_firmware_network_config
|
||||
|
||||
memset(config, 0, sizeof *config);
|
||||
memset(&fw_entry, 0, sizeof fw_entry);
|
||||
- if (fw_get_entry(&fw_entry, NULL))
|
||||
+ if (fwparam_ibft_sysfs(&fw_entry, NULL))
|
||||
return ENODEV;
|
||||
|
||||
config->dhcp = strlen(fw_entry.dhcp) ? 1 : 0;
|
||||
@@ -557,7 +557,7 @@ int libiscsi_get_firmware_initiator_name
|
||||
|
||||
memset(initiatorname, 0, LIBISCSI_VALUE_MAXLEN);
|
||||
memset(&fw_entry, 0, sizeof fw_entry);
|
||||
- if (fw_get_entry(&fw_entry, NULL))
|
||||
+ if (fwparam_ibft_sysfs(&fw_entry, NULL))
|
||||
return ENODEV;
|
||||
|
||||
strncpy(initiatorname, fw_entry.initiatorname,
|
3974
open-iscsi-2.0-870.1-add-libiscsi.patch
Normal file
3974
open-iscsi-2.0-870.1-add-libiscsi.patch
Normal file
File diff suppressed because it is too large
Load Diff
44
open-iscsi-2.0-870.1-ibft-newer-kernel.patch
Normal file
44
open-iscsi-2.0-870.1-ibft-newer-kernel.patch
Normal file
@ -0,0 +1,44 @@
|
||||
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;
|
||||
}
|
||||
|
221
open-iscsi-2.0-870.1-no-exit.patch
Normal file
221
open-iscsi-2.0-870.1-no-exit.patch
Normal file
@ -0,0 +1,221 @@
|
||||
--- 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