Commit Graph

151 Commits

Author SHA1 Message Date
lukem 293645aa72 sign-compare fixes 2009-01-25 14:25:27 +00:00
oster 6664ee6283 memset to zero the entire nop_in structure. Fixes PR#39688 by
Henning Petersen.  Thanks!
2008-10-08 14:58:57 +00:00
agc b2da2cdd81 Implement the SCSI MODE_SENSE_10 command - helps quieten an error seen by
Jeff Rizzo with the Studio Networks initiator.

This is WIP - more SCSI commands will be handled in the next commit.
2008-04-30 20:28:30 +00:00
agc a769917eda Fix for "raid0 devices don't accept extents of different sizes" from
Jeff Rizzo
2008-04-11 08:22:37 +00:00
agc 5025457bc5 Update the autoconf glue to version 20080207 of the portable NetBSD
iSCSI initiator and target.
2008-02-07 19:12:26 +00:00
agc c00abf65a9 Changes to make the iSCSI initiator have a chance of building on
other platforms - include ${PREFIX}/include when compiling, and
${PREFIX}/lib when linking.

Fill out the dependency information correctly.
2008-02-07 19:10:52 +00:00
agc 02806300b2 If we're doing discovery, and the TSIH cannot be found, set it to
the disk number held in the session parameters - avoid using a negative
index to the array of target disks.
2008-02-07 19:09:02 +00:00
agc d77f56d46b Add documentation on setting up the iSCSI target, and on how to use the
NetBSD iSCSI initiator together with cgd to provide encrypted iSCSI
storage.
2008-01-06 11:00:49 +00:00
agc cbc63dde2a Thanks to Mark Foster for the reference to the Wiki page where he tracks
the interoperation between the NetBSD iSCSI target and the Linux
open-iscsi initiator.

Add details about inter-operation with the NetBSD iSCSI initiator.

Add dates to all entries.

Add last updated date to the COMPATIBILITY file.
2007-12-24 15:48:40 +00:00
agc bfdff00bed Regenerate autoconf files for the portable version 2007-12-21 13:06:03 +00:00
agc 7683937c60 Peter Eisch: CentOS lacks strlcat(3), so use snprintf(3) to crack the
nut.
2007-12-20 23:17:05 +00:00
agc daa7a94cfb When defining extents, the new keyword "size" can be used in the place
of the physical size of the regular file. This is useful for presenting
ISO images to initiators, as in the following:

	In /etc/iscsi/targets:
	# present an ISO image
	extent2         /usr/sets/20071214/release/iso/i386cd.iso 0 size
	target2         ro      extent2         any

	% priv /etc/rc.d/iscsi_target restart
	Stopping iscsi_target.
	Starting iscsi_target.
	Reading configuration from `/etc/iscsi/targets'
	target0:rw:any
		extent0:/tmp/iscsi-target0:0:104857600
	target1:rw:any
		extent1:/tmp/iscsi-target1:0:52428800
	target2:ro:any
		extent2:/usr/sets/20071214/release/iso/i386cd.iso:0:354906112
	DISK: 1 logical unit (204800 blocks, 512 bytes/block), type iscsi fs
	DISK: LUN 0: 100 MB disk storage for "target0"
	DISK: 1 logical unit (102400 blocks, 512 bytes/block), type iscsi fs
	DISK: LUN 0: 50 MB disk storage for "target1"
	DISK: 1 logical unit (693176 blocks, 512 bytes/block), type iscsi fs
	DISK: LUN 0: 338 MB readonly disk storage for "target2"
	TARGET: TargetName is iqn.1994-04.org.netbsd.iscsi-target
	%

Please note that the NetBSD initiator can mount (via vnd) an iSCSI target
presented in this manner. The Microsoft iSCSI initiator sees the read-only
target as a normal SCSI disk, and fails (not surprisingly) to initialize
the disk. It's now possible to make ISO images available via iSCSI, and
NetBSD will DTRT.

In read-only targets, don't attempt to seek to the last block and rewrite
it, it may not work.

Don't assign 8 MB of unused space for use in each iSCSI disk - just use
1MB, which will be enough for the scatter gather iovecs.

Get rid of some dead code.
2007-12-18 20:31:50 +00:00
agc f327aec7bc Update portable version of the iSCSI software to 20071218, to
include various minor build fixes.
2007-12-18 11:19:06 +00:00
agc bb94308fd7 Pre-define HAVE_CONFIG_H for the portable autoconf-ed version as well. 2007-12-17 12:29:05 +00:00
agc 1e49aaff48 clean up a dependency on a file which has been removed 2007-12-17 12:05:35 +00:00
agc 8d29cd66d3 Do some rudimentary bounds checking on arguments passed in from
external functions.
2007-12-11 19:57:58 +00:00
agc 75a8f5acf1 Bump the number of targets that the initiator can handle to 16 (from 1). 2007-12-11 08:49:12 +00:00
agc 87c66df218 Remove a debug printf from the initiator code now that we have a real
discovery mode in the initiator.
2007-12-10 23:06:45 +00:00
agc a3d56a1b30 Update to version 20071209, to include new initiator "discovery only"
option, the iqn alias configuration option, and the different md5
routines which are being used.
2007-12-09 09:38:48 +00:00
agc 7d25996b8b Add prototypes for initiator_get_targets() and initiator_set_target_name(). 2007-12-09 09:33:35 +00:00
agc 4ed8885f3b Move the iSCSI code over to use the endian neutral md5 code,
originally from Poul-Henning Kamp, as found in pkgsrc/pkgtools/digest.
This should address some of the MD5 problems that are being seen on
some hosts at login time.

Re-run autoconf, autoheader and configure.
2007-12-09 09:21:03 +00:00
agc df4b4cffe4 Add support in the target for specifying the target IQN (iSCSI Qualified
Name) in the targets configuration file.

Now an entry of the form:
target0=iqn.binky rw extent0 any

will mean that target0 gets presented with the iqn of "iqn.binky".
This can be useful for shorter aliases for IQNs. With thanks to Peter
Eisch for the idea.

Note that the target's base IQN can still be set with the -t parameter
to iscsi-target.
2007-12-09 09:16:42 +00:00
agc d2f1aa150b Get rid of some files which aren't used. 2007-12-09 09:09:02 +00:00
oster b99a3154c6 Add bits needed by my last changes to iscsifs.c (oops! :( ). In
particular, initialize the target name properly in g_target, and add
functions for setting the target name and retrieving a list of
available targets.

Thanks to agc for catching this.
2007-12-08 15:20:24 +00:00
agc 06a857cac5 Add some definitions necessary for building on busybox thanks to Peter
Eisch, update to version 20071206, and run autoconf and autoheader
again to regenerate the version information.
2007-12-06 00:08:05 +00:00
agc 6febf18c31 Quieten gcc - remove an extraneous ',' after the last element in an
enumerated type.
2007-12-05 07:23:03 +00:00
oster 2b8d2018cc Set "lun = sess->d" early on (but not too early), and allow multiple
targets to now work correctly.  XXX: This will need to be re-visited
at some point, and fixed properly.

Commit requested by: agc
2007-12-04 16:25:37 +00:00
agc 6436d01687 Update autoconf parts to 20071130 to pick up two fixes:
md5 endian fix for Big Endian platforms

Greg Oster's impressively found fix for parameter negotiation
2007-11-30 09:56:32 +00:00
oster 1aad397ee0 We have 4 cases here: rx_answer, tx_answer, rx_offer, and tx_offer.
When determining what to put in to param->negotiated, it is *NOT*
sufficient to just pick one of offer_tx or offer_rx -- we may need to
use answer_rx or answer_tx as the negotiated parameter.  Failure to
pay attention to which case we are handling means we will occasionally
get "old parameter values" stuffed into responses, resulting in
obscure behavior (such as getting luns mixed up after a normal
connection is made) that is very difficult to replicate.
2007-11-30 00:33:34 +00:00
agc 23c77f8d12 Do runtime detection of machine's endianness, rather than relying on a cpp
macro which was never changed. This is the QAD fix, longer term we will
move to use native md5 routines if available.

Should go some way to fixing authentication problems when using an
initiator and target of different endianness.
2007-11-28 16:46:38 +00:00
agc 9e8e283ee9 Update the portable version to 20071122, via autoconf.
Only change is that the target returns MAXLBA in a READ_CAPACITY command
response, and the initiator adds one to it to find out the size.
2007-11-22 22:56:20 +00:00
agc 516da92e13 Add some more definitions which will be needed in the future. 2007-11-22 22:51:09 +00:00
agc fe6dd62563 Note to self - document in comments the reasons for doing certain things.
Revert Max LBA calculation when returning the Maximum LBA from the target
to the iinitiator, following an email conversation with Jonathan Kollasch,
who points out a number of things:

+ the NetBSD scsipi driver reads the value returned by the drive and adds
one to it, so that standard SCSI drives return the 0-based Max LBA in a
READ CAPACITY command.

+ it is up to the initiator to add 1 to the Max LBA to find out the size
of the LUN (Jonathan verified this by using the UNH iSCSI initiator on
to a NetBSD target)

+ an analogous change to the NetBSD initiator (revision 1.4 of
iscsifs.c) is needed.
2007-11-18 23:52:19 +00:00
agc 445a5e5f36 Bump version to 20071114, to include the iSCSI initiator in the portable
version.
2007-11-14 20:05:52 +00:00
agc f56debaab1 Rationalise this completely for the portable GNU autoconf version (which
is not used by the NetBSD reachover framework).

Get rid of the misplaced bin directory during the build phase, it's not
necessary.

Add commands to build the NetBSD iSCSI initiator.
2007-11-14 20:00:06 +00:00
agc e99d7af118 Add some commented out code (not enabled yet) to deal with MODE_SENSE_10
SCSI commands.

No functional change.
2007-11-14 19:58:06 +00:00
agc 7f7c78c76b Rename include/util.h to include/iscsiutil.h to avoid a nameclash
with /usr/include/util.h.
2007-11-12 23:25:40 +00:00
agc d880ffcdf0 In READ_CAPACITY, send back the size of the LUN, not the maximum LBA,
which is zero-based.

Problem reported by, and fix verified by, Greg Oster. Thanks, Greg!
2007-11-06 15:59:10 +00:00
agc 2f510db93e Recognise the word "lun" as a synonym for "target" in the configuration
file - allows us to export luns as well as targets, which should reduce
some confusion when presenting storage to external entities.
2007-11-03 09:44:06 +00:00
agc d7728ae0d3 Update to version 20071025
Pay closer attention to the TSIH value that is assigned by the target -
rather than a simple (session id + 1) value, which cycles after 16 sessions
are used, use a central counter, and increment that whenever a TSIH is
apportioned. This fixes some problems for me with multiple targets being
ignored, and only the first target being used. Tested with the Microsoft
initiator, and the embryonic NetBSD initiator.

Use more enumerated types, rather than cpp definitions.

Use enumerated types also in preference to magic numbers.

In the iSCSI test harness, use the -t argument to specify a disk target
exported by the NetBSD iSCSI target. This allows us to test for the
situation outlined above.

Add my copyright to the test harness - there's no Intel code left anymore.

Modify the way initiator login and logout information is presented to the
user. This is only of concern to people who use this with the target in
non-detached (non-daemon) mode.

Get rid of the MODE_SENSE_10 and MODE_SELECT_10 cases in the disk switch,
since they do not return responses in the correct format yet.
2007-10-26 18:36:45 +00:00
agc 06e992a132 Correct the name of the AIX 5.3 initiator reporter (where known) 2007-10-26 18:19:36 +00:00
agc a7eecfa1f4 Add a file containing information about NetBSD iSCSI target compatibility
with various different initiators.

Any more information gratefully received (either positive or negative).
2007-10-14 11:01:21 +00:00
agc 7bc5694f64 Fix an off-by-511 error, pointed out by Andrey Yakovlev 2007-09-26 12:01:49 +00:00
agc 7dcbb17115 Bump version of the NetBSD iSCSI target to 20070925.
+ fix a reported problem with newer versions of FreeBSD which require
a block of data to be read and written, rather than a single byte.

+ add support for Extended Inquiry Data VPD Page (0x86), reported to be
necessary to interoperate with the AIX initiator.

+ add preliminary support for the Write and Verify SCSI operation (0x2e).
2007-09-25 22:16:58 +00:00
agc 91566c8774 As part of the initial checks to se ethat a writable disk really is
writable, do the touch(1) dance with 512 bytes of information, rather
than just a single byte - the single byte read and write causes
problems on newer versions of FreeBSD, I am informed.  Patch from
Andrey Yakovlev, cleaned up to compile by myself.

Add support for Extended Inquiry Data VPD Page (0x86), reported to be
necessary to interoperate with the AIX initiator.

Add preliminary support for the Write and Verify SCSI operation (0x2e).
2007-09-25 22:15:00 +00:00
agc f22b6d776c Add a utility function to copy the target information to the caller - used
in the initiator functionality to keep a track of the target details.
2007-09-25 22:09:51 +00:00
agc bfe5c01baa fix formatting in a comment 2007-09-25 22:08:10 +00:00
agc 4e1fbeb934 Might as well define MODE_SELECT_6 and MODE_SELECT_10 too before too
many people get violent.
2007-09-19 23:28:15 +00:00
agc 6a20fc2b13 Preliminary support for MODE_SELECT_{6,10} and MODE_SENSE_10.
Committed now because some high priority fixes are about to come down
the line.
2007-09-19 19:54:09 +00:00
agc e0ef0e5000 Welcome to version 20070908 - multiple targets bug fix. 2007-09-08 09:52:20 +00:00