OBS User unknown
2007-04-04 18:32:14 +00:00
committed by Git OBS Bridge
parent 9105d32d29
commit c9a0b514ad
17 changed files with 12451 additions and 556 deletions

View File

@@ -4,7 +4,7 @@
#
### BEGIN INIT INFO
# Provides: iscsiboot
# Required-Start:
# Required-Start: boot.proc
# Should-Start:
# Required-Stop:
# Should-Stop:
@@ -14,6 +14,7 @@
#
### END INIT INFO
ISCSIADM=/sbin/iscsiadm
PID_FILE=/var/run/iscsi.pid
CONFIG_FILE=/etc/iscsid.conf
DAEMON=/sbin/iscsid
@@ -29,10 +30,10 @@ ARGS="-c $CONFIG_FILE -p $PID_FILE"
#
iscsi_mark_root_nodes()
{
TARGETS=$($ISCSIADM -m session 2> /dev/null | sed 's@\[[^:]*:\(.*\)\] .*@\1@g')
TARGETS=$($ISCSIADM -m session 2> /dev/null | sed 's@.*\[[^:]*:\(.*\)\] .*@\1@g')
for rec in $TARGETS; do
STARTUP=`$ISCSIADM -m node -r $rec | grep "node.conn\[0\].startup" | cut -d' ' -f3`
if [ $STARTUP != "onboot" ] ; then
if [ "$STARTUP" != "onboot" ] ; then
$ISCSIADM -m node -r $rec -o update -n node.conn[0].startup -v onboot
fi
done
@@ -43,7 +44,7 @@ rc_reset
# We only need to start this for root on iSCSI
if ! grep -q iscsi_tcp /proc/modules ; then
rc_failed 7
rc_failed 6
rc_exit
fi

View File

@@ -0,0 +1,77 @@
#/bin/bash
#
# /sbin/iscsi-gen-initiatorname
#
# Generate a default iSCSI Initiatorname for SUSE installations.
#
# Copyright (c) 2007 Hannes Reinecke, SUSE Linux Products GmbH.
# All rights reserved.
#
if [ "$1" ] ; then
if [ "$1" = "-f" ] ; then
FORCE=1
else
echo "Invalid option $1"
echo "Usage: $0 [-f]"
exit 1
fi
fi
if [ -f /etc/iscsi/initiatorname.iscsi -a -z "$FORCE" ] ; then
if [ -x /sbin/fwparam_ibft ] ; then
eval $(/sbin/fwparam_ibft -b 2> /dev/null | grep iSCSI_INITIATOR_NAME)
fi
if [ "$iSCSI_INITIATOR_NAME" ] ; then
eval $(cat /etc/iscsi/initiatorname.iscsi | sed -e '/^#/d')
if [ "$iSCSI_INITIATOR_NAME" != "$InitiatorName" ] ; then
echo "iSCSI Initiatorname from iBFT is different from the current setting."
echo "Please call '/sbin/iscsi-gen-initiatorname -f' to update the iSCSI Initiatorname."
exit 1
fi
fi
exit 0
fi
if [ -x /sbin/fwparam_ibft ] ; then
eval $(/sbin/fwparam_ibft -b 2> /dev/null | sed -ne '/iSCSI_INITIATOR_NAME/p')
if [ "$iSCSI_INITIATOR_NAME" ] ; then
cat << EOF >> /etc/iscsi/initiatorname.iscsi
##
## /etc/iscsi/iscsi.initiatorname
##
## iSCSI Initiatorname taken from iBFT BIOS tables.
##
## DO NOT EDIT OR REMOVE THIS FILE!
## If you remove this file, the iSCSI daemon will not start.
## Any change here will not be reflected to the iBFT BIOS tables.
## If a different initiatorname is required please change the
## initiatorname in the BIOS setup and call
## /sbin/iscsi-gen-initiatorname -f
## to recreate an updated version of this file.
##
InitiatorName=$iSCSI_INITIATOR_NAME
EOF
fi
fi
if [ ! -f /etc/iscsi/initiatorname.iscsi ] ; then
cat << EOF >> /etc/iscsi/initiatorname.iscsi
##
## /etc/iscsi/iscsi.initiatorname
##
## Default iSCSI Initiatorname.
##
## DO NOT EDIT OR REMOVE THIS FILE!
## If you remove this file, the iSCSI daemon will not start.
## If you change the InitiatorName, existing access control lists
## may reject this initiator. The InitiatorName must be unique
## for each iSCSI initiator. Do NOT duplicate iSCSI InitiatorNames.
EOF
ISSUEDATE="1996-04"
INAME=$(/sbin/iscsi-iname -p iqn.$ISSUEDATE.de.suse:01)
printf "InitiatorName=$INAME\n" >>/etc/iscsi/initiatorname.iscsi
chmod 0600 /etc/iscsi/initiatorname.iscsi
fi

View File

@@ -1,140 +0,0 @@
/*
* 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.4 2004/12/03 19:36:13 mikenc 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 <stdio.h>
#include <stdint.h>
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/utsname.h>
#include <sys/time.h>
#include "md5.h"
#define TARGET_NAME_MAXLEN 255
#define RANDOM_NUM_GENERATOR "/dev/urandom"
int
main(int argc, char *argv[])
{
char iname[TARGET_NAME_MAXLEN + 1];
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");
return 0;
} else if ( strcmp(prefix, "-p") == 0 ) {
prefix = argv[2];
} else {
printf("\nUsage: iscsi-iname [-h | --help | "
"-p <prefix>]\n");
return 0;
}
} else {
prefix = "iqn.1987-05.com.cisco: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;
}

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2bd837f02a8f82c9782346b91836e17172f6f62ecc4b2224739eb2e8d5d9ea08
size 177056

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:fc286e8bc457612af733fafab0608a25280b81f7306c9f218c9361e1fd8e573e
size 223383

View File

@@ -1,226 +0,0 @@
Index: kernel/scsi_transport_iscsi.c
===================================================================
--- kernel/scsi_transport_iscsi.c (revision 707)
+++ kernel/scsi_transport_iscsi.c (revision 713)
@@ -33,7 +33,7 @@
#define ISCSI_SESSION_ATTRS 11
#define ISCSI_CONN_ATTRS 11
#define ISCSI_HOST_ATTRS 0
-#define ISCSI_TRANSPORT_VERSION "2.0-707"
+#define ISCSI_TRANSPORT_VERSION "2.0-711"
struct iscsi_internal {
int daemon_pid;
Index: doc/iscsid.8
===================================================================
--- doc/iscsid.8 (revision 707)
+++ doc/iscsid.8 (revision 713)
@@ -15,11 +15,11 @@
.TP
.BI [-c|--config=]\fIconfig\-file\fP
Read configuration from \fIconfig\-file\fR rather than the default
-\fI/etc/iscsid.conf\fR file.
+\fI/etc/iscsi/iscsid.conf\fR file.
.TP
.BI [-i|--initiatorname=]\fIiname\-file\fP
Read initiator name from \fIiname\-file\fR rather than the default
-\fI/etc/initiatorname.iscsi\fR file.
+\fI/etc/iscsi/initiatorname.iscsi\fR file.
.TP
.BI [-f|--foreground]
run
@@ -47,14 +47,14 @@
.SH FILES
.TP
-/etc/iscsid.conf
+/etc/iscsi/iscsid.conf
The configuration file read by
.B iscsid
and
.B iscsiadm
on startup.
.TP
-/etc/initiatorname.iscsi
+/etc/iscsi/initiatorname.iscsi
The file containing the iSCSI initiatorname
and initiatoralias read by
.B iscsid
@@ -62,7 +62,7 @@
.B iscsiadm
on startup.
.TP
-/var/db/iscsi/*.db
+/etc/iscsi/nodes
Open-iSCSI persistent configuration database
.SH "SEE ALSO"
Index: usr/idbm.c
===================================================================
--- usr/idbm.c (revision 707)
+++ usr/idbm.c (revision 713)
@@ -961,15 +961,14 @@
discovery_rec_t *drec;
node_rec_t *nrec;
- /* sync default configuration */
- idbm_sync_config(db, 1);
-
/* allocate new discovery record and initialize with defaults */
drec = malloc(sizeof(discovery_rec_t));
if (!drec) {
log_error("out of memory on discovery record allocation");
return NULL;
}
+ drec->type = type;
+
if (drec->type == DISCOVERY_TYPE_SENDTARGETS) {
memcpy(drec, &db->drec_st, sizeof(discovery_rec_t));
} else if (drec->type == DISCOVERY_TYPE_SLP) {
@@ -988,7 +987,6 @@
memcpy(nrec, &db->nrec, sizeof(node_rec_t));
/* update discovery record */
- drec->type = type;
if (drec->type == DISCOVERY_TYPE_SENDTARGETS) {
strncpy(drec->u.sendtargets.address, ip, NI_MAXHOST);
drec->u.sendtargets.port = port;
@@ -1138,6 +1136,9 @@
void
idbm_sendtargets_defaults(idbm_t *db, struct iscsi_sendtargets_config *cfg)
{
+ /* sync default configuration */
+ idbm_sync_config(db, 1);
+
memcpy(cfg, &db->drec_st.u.sendtargets,
sizeof(struct iscsi_sendtargets_config));
}
Index: usr/initiator.c
===================================================================
--- usr/initiator.c (revision 707)
+++ usr/initiator.c (revision 713)
@@ -1528,6 +1528,10 @@
log_debug(6, "looking for session [%s,%s,%d]",
rec->name, rec->conn[0].address, rec->conn[0].port);
+ if (strlen(rec->name) != strlen(targetname) ||
+ strlen(rec->conn[0].address) != strlen(address))
+ return 0;
+
if (!strncmp(rec->name, targetname, strlen(rec->name)) &&
!strncmp(rec->conn[0].address, address,
strlen(rec->conn[0].address)) &&
Index: usr/version.h
===================================================================
--- usr/version.h (revision 707)
+++ usr/version.h (revision 713)
@@ -6,7 +6,7 @@
* This may not be the same value as the kernel versions because
* some other maintainer could merge a patch without going through us
*/
-#define ISCSI_VERSION_STR "2.0-707"
+#define ISCSI_VERSION_STR "2.0-711"
#define ISCSI_VERSION_FILE "/sys/module/scsi_transport_iscsi/version"
#endif
Index: etc/initd/initd.suse
===================================================================
--- etc/initd/initd.suse (revision 707)
+++ etc/initd/initd.suse (revision 713)
@@ -15,7 +15,7 @@
### END INIT INFO
PID_FILE=/var/run/iscsi.pid
-CONFIG_FILE=/etc/iscsid.conf
+CONFIG_FILE=/etc/iscsi/iscsid.conf
DAEMON=/sbin/iscsid
ISCSIADM=/sbin/iscsiadm
ARGS="-c $CONFIG_FILE -p $PID_FILE"
@@ -59,7 +59,7 @@
$ISCSIADM -m session | while read line; do
set ${line}
TARGET=$(echo $line | cut -d" " -f4)
- PORTAL=$(echo $line | cut -d" " -f3 | sed 's/,.//')
+ PORTAL=$(echo $line | cut -d" " -f3 | sed 's/,.*//')
STARTUP=`$ISCSIADM -m node --targetname $TARGET -p $PORTAL | grep "node.conn\[0\].startup" | cut -d' ' -f3`
NODE=`$ISCSIADM -m node --targetname $TARGET -p $PORTAL | grep "node.name" | cut -d' ' -f3`
if [ $STARTUP != "onboot" ] ; then
@@ -85,7 +85,7 @@
$ISCSIADM -m session | while read line; do
set ${line}
TARGET=$(echo $line | cut -d" " -f4)
- PORTAL=$(echo $line | cut -d" " -f3 | sed 's/,.//')
+ PORTAL=$(echo $line | cut -d" " -f3 | sed 's/,.*//')
NODE=`$ISCSIADM -m node --targetname $TARGET -p $PORTAL | grep "node.name" | cut -d' ' -f3`
echo -e "\t$NODE"
done
Index: etc/initd/initd.debian
===================================================================
--- etc/initd/initd.debian (revision 707)
+++ etc/initd/initd.debian (revision 713)
@@ -6,7 +6,7 @@
PID_FILE=/var/run/iscsid.pid
CONFIG_FILE=/etc/iscsid.conf
-DAEMON=/usr/sbin/iscsid
+DAEMON=/sbin/iscsid
PATH=/sbin:/bin:/usr/sbin:/usr/bin
Index: README
===================================================================
--- README (revision 707)
+++ README (revision 713)
@@ -123,7 +123,7 @@
Usage: iscsid [OPTION]
- -c, --config=[path] Execute in the config file (/etc/iscsid.conf).
+ -c, --config=[path] Execute in the config file (/etc/iscsi/iscsid.conf).
-f, --foreground run iscsid in the foreground
-d, --debug debuglevel print debugging information
-u, --uid=uid run as uid, default is current user
@@ -141,10 +141,10 @@
The database contains two tables:
-- Discovery table (discovery.db);
-- Node table (node.db).
+- Discovery table (/etc/iscsi/send_targets);
+- Node table (/etc/iscsi/nodes).
-The regular place for iSCSI database files: /var/db/iscsi/*.db
+The regular place for iSCSI database files: /etc/iscsi/nodes
The iscsiadm utility is a command-line tool to manage (update, delete,
insert, query) the persistent database.
@@ -250,7 +250,7 @@
6. Configuration
================
-The default configuration file is /etc/iscsid.conf. This file contains
+The default configuration file is /etc/iscsi/iscsid.conf. This file contains
only configuration that could be overwritten by iSCSI Discovery,
or manualy updated via iscsiadm utility. Its OK if this file does not
exist in which case compiled-in default configuration will take place
@@ -333,9 +333,9 @@
Once iscsi is up, you can perform discovery to targets using:
iscsiadm -m discovery -t sendtargets -p 192.168.1.1:3260
-While discovery targets are kept in the discovery.db, they are
+While discovery targets are kept in the discovery db, they are
usefull only for re-discovery. The discovered targets (a.k.a. nodes)
-are stored as records in the xxx.db.
+are stored as records in the node db.
The discovered targets are not logged into yet. Rather than logging
into the discovered nodes (making LUs from those nodes available as
@@ -350,7 +350,7 @@
iscsiadm -m node -T targetname -p ip:port --op update -n node.conn[0].startup -v automatic
Or to set the "node.conn[0].statup" attribute to "startup" as default for
-all sessions add the following to the /etc/iscsid.conf:
+all sessions add the following to the /etc/iscsi/iscsid.conf:
node.conn[0].startup = automatic

10546
open-iscsi-779.diff Normal file

File diff suppressed because it is too large Load Diff

49
open-iscsi-connect-retry Normal file
View File

@@ -0,0 +1,49 @@
--- open-iscsi-2.0-707/usr/util.c 2007/03/06 08:20:18 1.9
+++ open-iscsi-2.0-707/usr/util.c 2007/03/06 08:56:09
@@ -79,14 +79,16 @@
return str;
}
+#define MAXSLEEP 128
+
static int iscsid_connect(void)
{
- int fd, err;
+ int fd, err, nsec;
struct sockaddr_un addr;
fd = socket(AF_LOCAL, SOCK_STREAM, 0);
if (fd < 0) {
- log_error("can not create IPC socket!");
+ log_error("can not create IPC socket (%d)!", errno);
return fd;
}
@@ -95,12 +97,22 @@
memcpy((char *) &addr.sun_path + 1, ISCSIADM_NAMESPACE,
strlen(ISCSIADM_NAMESPACE));
- if ((err = connect(fd, (struct sockaddr *) &addr, sizeof(addr))) < 0) {
- log_error("can not connect to iSCSI daemon!");
- fd = err;
+ /*
+ * Trying to connect with exponential backoff
+ */
+ for (nsec = 1; nsec <= MAXSLEEP; nsec <<= 1) {
+ if (connect(fd, (struct sockaddr *) &addr, sizeof(addr)) == 0) {
+ /* Connection established */
+ return fd;
+ }
+ /*
+ * Delay before trying again
+ */
+ if (nsec <= MAXSLEEP/2)
+ sleep(nsec);
}
-
- return fd;
+ log_error("can not connect to iSCSI daemon (%d)!", errno);
+ return -1;
}
static int iscsid_request(int fd, iscsiadm_req_t *req)

View File

@@ -0,0 +1,11 @@
--- open-iscsi-2.0-707/utils/fwparam_ibft/fwparam_ibft.c 2007/03/14 09:48:24 1.7
+++ open-iscsi-2.0-707/utils/fwparam_ibft/fwparam_ibft.c 2007/03/16 10:48:24
@@ -232,7 +232,7 @@
* bringup, this sounds less flexible than the normal
* masks used.
*/
- printf("%s%s:%d\n", prefix, "MASK", nic->subnet_mask_prefix);
+ printf("%s%s=%d\n", prefix, "MASK", nic->subnet_mask_prefix);
dump_ipaddr(prefix, "GATEWAY", nic->gateway);
dump_ipaddr(prefix, "DNSADDR1", nic->primary_dns);
dump_ipaddr(prefix, "DNSADDR2", nic->secondary_dns);

1524
open-iscsi-fwparam-openprom Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,20 +0,0 @@
--- open-iscsi-0.5-454/usr/Makefile 2006/02/09 09:41:31 1.7
+++ open-iscsi-0.5-454/usr/Makefile 2006/02/09 09:42:46
@@ -33,7 +33,7 @@
OPTFLAGS ?= -O2 -fno-inline -g
WARNFLAGS ?= -Wall -Wstrict-prototypes
CFLAGS += $(OPTFLAGS) $(WARNFLAGS) -I../include -D$(OSNAME) $(IPC_CFLAGS)
-PROGRAMS = iscsid iscsiadm iscsistart
+PROGRAMS = iscsid iscsiadm iscsistart iscsi-iname
# sources shared between iscsid and iscsiadm
COMMON_SRCS = util.o io.o auth.o login.o log.o md5.o sha1.o idbm.o
@@ -47,5 +47,8 @@
iscsistart: $(IPC_OBJ) $(ISCSI_LIB_SRCS) $(INITIATOR_SRCS) iscsistart.o
$(CC) $^ $(DBM_LIB) -o $@
+iscsi-iname: md5.o iscsi-iname.o
+ $(CC) $^ -o $@
+
clean:
rm -f *.o $(PROGRAMS)

View File

@@ -1,21 +0,0 @@
Index: etc/initd/initd.suse
===================================================================
--- etc/initd/initd.suse (revision 713)
+++ etc/initd/initd.suse (working copy)
@@ -23,16 +23,9 @@
# Source LSB init functions
. /etc/rc.status
-. /etc/sysconfig/open-iscsi
-
# Reset status of this service
rc_reset
-iscsi_discovery()
-{
- $ISCSIADM -m discovery --type=$ISCSI_DISCOVERY --portal=$ISCSI_PORTAL > /dev/null
-}
-
iscsi_login_all_nodes()
{
$ISCSIADM -m node 2> /dev/null | while read line; do

View File

@@ -0,0 +1,61 @@
diff --git a/etc/initd/initd.suse b/etc/initd/initd.suse
index 6d4cbd8..ce9fa70 100644
--- a/etc/initd/initd.suse
+++ b/etc/initd/initd.suse
@@ -77,6 +77,39 @@ iscsi_logout_all_nodes()
return ${RETVAL:-0}
}
+iscsi_umount_all_luns()
+{
+ local d m dev p s
+
+ cat /proc/mounts | sed -ne '/^\/dev\/.*/p' | while read d m t o x; do
+ if [ "$m" = "/" ] ; then
+ continue;
+ fi
+ if [ -L "$d" ] ; then
+ d=$(readlink -f $d)
+ fi
+ dev=${d##/dev}
+
+ if [ "${dev##/sd}" = "$dev" ] ; then
+ continue;
+ fi
+ p="/sys/block${dev%%[0-9]*}"
+
+ if [ ! -d ${p} ] && [ ! -d ${p}/device ] ; then
+ continue;
+ fi
+
+ s=$(cd -P ${p}/device && echo $PWD)
+
+ case "$s" in
+ */session[0-9]*/*)
+ # This is an iSCSI device
+ umount "$m"
+ ;;
+ esac
+ done
+}
+
iscsi_list_all_nodes()
{
TARGETS=$($ISCSIADM -m session | sed 's@\[[^:]*:\(.*\)\] .*@\1@g')
@@ -110,6 +143,7 @@ case "$1" in
fi
;;
stop)
+ iscsi_umount_all_luns
if iscsi_logout_all_nodes ; then
killproc -KILL $DAEMON
RETVAL=$?
diff --git a/include/iscsi_if.h b/include/iscsi_if.h
diff --git a/kernel/iscsi_tcp.c b/kernel/iscsi_tcp.c
diff --git a/kernel/libiscsi.c b/kernel/libiscsi.c
diff --git a/kernel/libiscsi.h b/kernel/libiscsi.h
diff --git a/kernel/scsi_transport_iscsi.c b/kernel/scsi_transport_iscsi.c
diff --git a/usr/discovery.c b/usr/discovery.c
diff --git a/usr/initiator.c b/usr/initiator.c
diff --git a/usr/initiator.h b/usr/initiator.h
diff --git a/usr/iscsid.c b/usr/iscsid.c

View File

@@ -1,103 +0,0 @@
Index: usr/auth.c
===================================================================
--- usr/auth.c (revision 713)
+++ usr/auth.c (working copy)
@@ -28,6 +28,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
+#include <fcntl.h>
#include "auth.h"
#include "initiator.h"
@@ -186,20 +188,32 @@
long r;
unsigned n;
+ int fd;
+ fd = open("/dev/urandom", O_RDONLY);
while (length > 0) {
- r = rand();
+ if (fd)
+ read(fd, &r, sizeof(long));
+ else
+ r = rand();
r = r ^ (r >> 8);
r = r ^ (r >> 4);
n = r & 0x7;
- r = rand();
+ if (fd)
+ read(fd, &r, sizeof(long));
+ else
+ r = rand();
r = r ^ (r >> 8);
r = r ^ (r >> 5);
n = (n << 3) | (r & 0x7);
- r = rand();
+ if (fd)
+ read(fd, &r, sizeof(long));
+ else
+ r = rand();
+
r = r ^ (r >> 8);
r = r ^ (r >> 5);
n = (n << 2) | (r & 0x3);
@@ -207,6 +221,8 @@
*data++ = n;
length--;
}
+ if (fd)
+ close(fd);
}
/**
Index: usr/chap.c
===================================================================
--- usr/chap.c (revision 713)
+++ usr/chap.c (working copy)
@@ -324,6 +324,7 @@
char text[CHAP_CHALLENGE_MAX * 2 + 8];
static int chap_id;
int i;
+ int fd;
value = text_key_find(conn, "CHAP_A");
if (!value)
@@ -353,7 +354,8 @@
* wise, or should we rather always use the max. allowed length of
* 1024 for the (unencoded) challenge?
*/
- conn->auth.chap.challenge_size = (rand() % (CHAP_CHALLENGE_MAX / 2)) + CHAP_CHALLENGE_MAX / 2;
+ conn->auth.chap.challenge_size = (sizeof(int) % (CHAP_CHALLENGE_MAX / 2)) +
+ CHAP_CHALLENGE_MAX / 2;
conn->auth.chap.challenge = xmalloc(conn->auth.chap.challenge_size);
if (!conn->auth.chap.challenge)
@@ -362,11 +364,21 @@
p = text;
strcpy(p, "0x");
p += 2;
+
+ fd = open("/dev/urandom", O_RDONLY);
+ if (fd) {
+ read(fd, conn->auth.chap.challenge,
+ sizeof(int) * conn->auth.chap.challenge_size);
+ }
+
for (i = 0; i < conn->auth.chap.challenge_size; i++) {
- conn->auth.chap.challenge[i] = rand();
+ if (!fd) {
+ conn->auth.chap.challenge[i] = rand();
+ }
sprintf(p, "%.2hhx", conn->auth.chap.challenge[i]);
p += 2;
}
+ if (fd) close(fd);
text_key_add(conn, "CHAP_C", text);
return 0;

View File

@@ -1,3 +1,76 @@
-------------------------------------------------------------------
Wed Apr 4 10:51:56 CEST 2007 - hare@suse.de
- update to official release 2.0-754
- update to svn r779
- Include changes from SLES10 SP1
-------------------------------------------------------------------
Fri Mar 30 13:50:42 CEST 2007 - hare@suse.de
- Include fwparam_ibft program for OpenPROM (#226682)
-------------------------------------------------------------------
Wed Mar 28 12:24:23 CEST 2007 - hare@suse.de
- Return status '6' when root on iSCSI is not enabled (#257979)
-------------------------------------------------------------------
Fri Mar 16 11:51:33 CET 2007 - hare@suse.de
- Fix typo in output of fwparam_ibft (#250445)
-------------------------------------------------------------------
Thu Mar 8 12:49:39 CET 2007 - hare@suse.de
- connect() to the daemon might fail on busy machines (#244649)
-------------------------------------------------------------------
Mon Mar 5 16:29:05 CET 2007 - hare@suse.de
- Add /usr/bin/iscsi-dbconvert to convert SLES10 GA
databases to new format (#251298)
-------------------------------------------------------------------
Fri Feb 16 20:00:45 CET 2007 - hare@suse.de
- Fix iscsiadm to print session info correctly (#243203)
-------------------------------------------------------------------
Thu Feb 8 16:19:08 CET 2007 - hare@suse.de
- update to svn r768
- Update iSNS support (#243203)
- Correct typo in /etc/init.d/boot.open-iscsi (#243203)
-------------------------------------------------------------------
Fri Feb 2 15:23:18 CET 2007 - hare@suse.de
- Umount all luns on shutdown (#223484)
-------------------------------------------------------------------
Wed Jan 31 09:43:38 CET 2007 - hare@suse.de
- Remove the start iSCSI after Xen hack (#231077)
- Fixup /etc/init.d/boot.open-iscsi script (#239819)
-------------------------------------------------------------------
Thu Jan 18 15:07:04 CET 2007 - hare@suse.de
- Fix compat mode to display the record id.
- Add /sbin/iscsi-gen-initiatorname to generate
a default iSCSI initiatorname.
-------------------------------------------------------------------
Mon Jan 15 17:47:13 CET 2007 - hare@suse.de
- Fixup %post scripts.
-------------------------------------------------------------------
Mon Jan 15 13:10:53 CET 2007 - hare@suse.de
- Reference symlink to /etc/iscsid.conf in rpm.
-------------------------------------------------------------------
Fri Oct 20 14:14:33 CEST 2006 - hare@suse.de
@@ -15,6 +88,13 @@ Fri Jul 28 13:19:29 CEST 2006 - olh@suse.de
- remove unused boot.proc from boot.open-iscsi (#181972)
-------------------------------------------------------------------
Mon Jun 19 18:22:18 CEST 2006 - hare@suse.de
- update to svn r606
- Include local patches
- Fix OCFS2 hangs (#185107, #180773)
-------------------------------------------------------------------
Thu Jun 1 17:06:24 CEST 2006 - hare@suse.de

View File

@@ -1,7 +1,7 @@
#
# spec file for package open-iscsi (Version 2.0.713)
# spec file for package open-iscsi (Version 2.0.779)
#
# Copyright (c) 2006 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#
@@ -11,26 +11,29 @@
# norootforbuild
Name: open-iscsi
BuildRequires: db-devel
URL: http://www.open-iscsi.org
License: GNU General Public License (GPL) - all versions
License: GNU General Public License (GPL)
Group: Productivity/Networking/Other
Prereq: %fillup_prereq %insserv_prereq
Autoreqprov: on
Version: 2.0.713
Version: 2.0.779
Release: 1
Provides: linux-iscsi
Obsoletes: linux-iscsi
%define iscsi_release 707
%define iscsi_release 754
Summary: Linux* Open-iSCSI Software Initiator
Source: %{name}-2.0-707.tar.gz
Source: %{name}-2.0-754.tar.gz
Source2: open-iscsi.sysconfig
Source3: boot.open-iscsi
Source12: iscsi-iname.c
Patch1: %{name}-713.diff
Patch2: %{name}-suse.diff
Patch3: %{name}-use-dev-urandom
Patch12: %{name}-start-iscsi-after-xen
Source11: iscsi-gen-initiatorname.sh
Patch1: %{name}-779.diff
Patch12: %{name}-connect-retry
Patch13: %{name}-fwparam-mask-typo
Patch14: %{name}-fwparam-openprom
Patch20: %{name}-start-iscsi-after-xen
Patch21: %{name}-check-active-sessions-before-delete
Patch22: %{name}-iscsi-iname-Makefile.patch
Patch23: %{name}-umount-all-luns
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
@@ -59,16 +62,27 @@ Authors:
open-iscsi@googlegroups.com
%prep
%setup -n %{name}-2.0-707
%patch1 -p0
%patch2 -p0
%patch3 -p0
%setup -n %{name}-2.0-%{iscsi_release}
%patch1
# %patch10
%patch23 -p1
# %patch11 -p1
%patch12 -p1
%patch22 -p1
cp %{S:12} usr/
%patch13 -p1
%patch14 -p1
%build
%ifarch %ix86 x86_64
%define target_arch x86
%else
%ifarch ppc ppc64
%define target_arch ppc
%else
%define target_arch none
%endif
%endif
%{__make} OPTFLAGS="${RPM_OPT_FLAGS}" -C usr
%{__make} OPTFLAGS="${RPM_OPT_FLAGS} -U_FORTIFY_SOURCE" ARCH=%target_arch -C utils
%install
[ "${RPM_BUILD_ROOT}" != "/" -a -d ${RPM_BUILD_ROOT} ] && rm -rf ${RPM_BUILD_ROOT}
@@ -76,9 +90,10 @@ make DESTDIR=${RPM_BUILD_ROOT} install_programs
make DESTDIR=${RPM_BUILD_ROOT} install_etc
make DESTDIR=${RPM_BUILD_ROOT} install_initd_suse
make DESTDIR=${RPM_BUILD_ROOT} install_doc
install -D -m 755 usr/iscsi-iname ${RPM_BUILD_ROOT}/sbin/iscsi-iname
install -D -m 755 %{S:11} ${RPM_BUILD_ROOT}/sbin/iscsi-gen-initiatorname
install -D -m 755 %{S:3} ${RPM_BUILD_ROOT}/etc/init.d/boot.open-iscsi
(cd ${RPM_BUILD_ROOT}/sbin; ln -sf /etc/init.d/open-iscsi rcopen-iscsi)
(cd ${RPM_BUILD_ROOT}/etc; ln -sf iscsi/iscsid.conf iscsid.conf)
%clean
[ "${RPM_BUILD_ROOT}" != "/" -a -d ${RPM_BUILD_ROOT} ] && rm -rf ${RPM_BUILD_ROOT}
@@ -87,25 +102,10 @@ install -D -m 755 %{S:3} ${RPM_BUILD_ROOT}/etc/init.d/boot.open-iscsi
%{fillup_and_insserv -Y boot.open-iscsi}
if [ -f /etc/initiatorname.iscsi ] ; then
mv /etc/initiatorname.iscsi /etc/iscsi
ln -sf /etc/iscsi/initiatorname.iscsi /etc/initiatorname.iscsi
fi
if [ ! -f /etc/iscsi/initiatorname.iscsi ]; then
cat << EOF >> /etc/iscsi/initiatorname.iscsi
## DO NOT EDIT OR REMOVE THIS FILE!
## If you remove this file, the iSCSI daemon will not start.
## If you change the InitiatorName, existing access control lists
## may reject this initiator. The InitiatorName must be unique
## for each iSCSI initiator. Do NOT duplicate iSCSI InitiatorNames.
EOF
ISSUEDATE="1996-04"
INAME=$(/sbin/iscsi-iname -p iqn.$ISSUEDATE.de.suse:01)
printf "InitiatorName=$INAME\n" >>/etc/iscsi/initiatorname.iscsi
chmod 0600 /etc/iscsi/initiatorname.iscsi
fi
if [ -f /var/lib/iscsi/discovery ]; then
mv /var/lib/iscsi/discovery /var/lib/open-iscsi
fi
if [ -f /var/lib/iscsi/node ] ; then
mv /var/lib/iscsi/node /var/lib/open-iscsi
if [ ! -f /etc/iscsi/initiatorname.iscsi ] ; then
/sbin/iscsi-gen-initiatorname
fi
%postun
@@ -114,14 +114,49 @@ fi
%files
%defattr(-,root,root)
%attr(0600,root,root) %config(noreplace) /etc/iscsi/iscsid.conf
/etc/iscsid.conf
%config /etc/init.d/open-iscsi
%config /etc/init.d/boot.open-iscsi
%dir /etc/iscsi
/sbin/*
%dir /etc/iscsi
%doc COPYING README
%doc %{_mandir}/man8/*
%changelog -n open-iscsi
%changelog
* Wed Apr 04 2007 - hare@suse.de
- update to official release 2.0-754
- update to svn r779
- Include changes from SLES10 SP1
* Fri Mar 30 2007 - hare@suse.de
- Include fwparam_ibft program for OpenPROM (#226682)
* Wed Mar 28 2007 - hare@suse.de
- Return status '6' when root on iSCSI is not enabled (#257979)
* Fri Mar 16 2007 - hare@suse.de
- Fix typo in output of fwparam_ibft (#250445)
* Thu Mar 08 2007 - hare@suse.de
- connect() to the daemon might fail on busy machines (#244649)
* Mon Mar 05 2007 - hare@suse.de
- Add /usr/bin/iscsi-dbconvert to convert SLES10 GA
databases to new format (#251298)
* Fri Feb 16 2007 - hare@suse.de
- Fix iscsiadm to print session info correctly (#243203)
* Thu Feb 08 2007 - hare@suse.de
- update to svn r768
- Update iSNS support (#243203)
- Correct typo in /etc/init.d/boot.open-iscsi (#243203)
* Fri Feb 02 2007 - hare@suse.de
- Umount all luns on shutdown (#223484)
* Wed Jan 31 2007 - hare@suse.de
- Remove the start iSCSI after Xen hack (#231077)
- Fixup /etc/init.d/boot.open-iscsi script (#239819)
* Thu Jan 18 2007 - hare@suse.de
- Fix compat mode to display the record id.
- Add /sbin/iscsi-gen-initiatorname to generate
a default iSCSI initiatorname.
* Mon Jan 15 2007 - hare@suse.de
- Fixup %%post scripts.
* Mon Jan 15 2007 - hare@suse.de
- Reference symlink to /etc/iscsid.conf in rpm.
* Fri Oct 20 2006 - hare@suse.de
- Update to svn r713
- Use /dev/urandom instead of rand() (#180837)
@@ -130,6 +165,10 @@ fi
- Update to official version 2.0-707
* Fri Jul 28 2006 - olh@suse.de
- remove unused boot.proc from boot.open-iscsi (#181972)
* Mon Jun 19 2006 - hare@suse.de
- update to svn r606
- Include local patches
- Fix OCFS2 hangs (#185107, #180773)
* Thu Jun 01 2006 - hare@suse.de
- Added new startmode 'onboot' for root on iSCSI
- Added new init script boot.open-iscsi startup

17
open-iscsi.sysconfig Normal file
View File

@@ -0,0 +1,17 @@
## Path: Network/iSCSI/Client
## Description: iSCSI Default Portal
## Type: string
## Default: ""
#
# The iSCSI Default Portal to use on startup. Use either the hostname
# or IP number of the machine providing the iSCSI Targets to use
#
ISCSI_PORTAL=""
## Type: list(sendtargets,isns,slp)
## Default: sendtargets
#
# The iSCSI discovery method to use. Currently only 'sendtargets' is
# implemented.
#
ISCSI_DISCOVERY="sendtargets"