Commit Graph

93 Commits

Author SHA1 Message Date
agc b734ab10f3 Use the proper tracing functionality 2007-01-11 22:59:53 +00:00
agc 766d3d66b8 Get rid of some magic constants. 2007-01-11 19:57:23 +00:00
agc 977a3071b2 Explain what's happening when a target is not exporting any iSCSI
targets to the initiator rather than a cryptic message about a portal
group tag not being present.
2007-01-11 19:14:32 +00:00
agc 9f740696e2 Pass the target hostname to the iscsi_sock_connect() call, so that it's
available for getaddrinfo.

Use the correct IQN name for the NetBSD iSCSI initiator.
2007-01-11 18:56:57 +00:00
agc 0b68869633 Use getaddrinfo(3) to get the required information about the host. Use this
explicitly in iscsi_socket_connect(), and ignore the port argument to this
function for just now.
2007-01-11 18:54:58 +00:00
agc 524517b593 Make the code a bit smarter, and dynamically allocate the buffers that are
used to cache the data for the read and write operations. This will reduce the
resident set size down from 80+ MB to something much more manageable.
2007-01-10 22:40:31 +00:00
agc f980d4284c Move away from magic constants for the SCSI return codes.
Give the appropriate size bound when filling in data for the extended
INQUIRY command.
2007-01-10 18:04:31 +00:00
agc b0ab3a15b9 Return the correct length of the T10 identifier and uuid in the VPD page 83
response.

Found by the embryonic NetBSD initiator.
2007-01-09 19:08:08 +00:00
agc e1d88c5d14 read the values of max_lba and blocklen, and byte swap them if necessary,
before printing out their values.
2007-01-08 22:05:47 +00:00
agc c0040e78f5 various enhancements to make this compile with WARNS=4 2007-01-08 21:46:00 +00:00
agc eaf1b66230 Export the function to split a config file entry up into parts,
conffile_split(), and make it work in the presence of a NULL conffile
descriptor (i.e. from stdin).
2007-01-08 21:44:47 +00:00
agc a43651f235 Modify netmask calculation so that /0 is fast-tracked, and so that network
addresses with bit 31 set are processed properly.

Fix from Hiroshi Nakamoto in PR 34578.

	[22:09:17] agc@inspiron1300 ...dist/iscsi/src 26 > ./n 10.4/16 10.4.0.29 10.4/16 10.5.0.29 10.4/0 10.4.0.19 10.4 10.4.0.19 10.4.3/8 10.4.3.7 10.4.3/24 10.4.3.7
	addr 10.4.0.29 00000a04, mask 10.4.0.0 00000a04, slash 16
	mask 10.4/16 matches addr 10.4.0.29

	addr 10.5.0.29 00000a05, mask 10.4.0.0 00000a04, slash 16
	No match for mask 10.4/16 from addr 10.5.0.29

	mask 10.4/0 matches addr 10.4.0.19

	addr 10.4.0.19 0a040013, mask 10.4.0.0 0a040000, slash 32
	No match for mask 10.4 from addr 10.4.0.19

	addr 10.4.3.7 0000000a, mask 10.4.3.0 0000000a, slash 8
	mask 10.4.3/8 matches addr 10.4.3.7

	addr 10.4.3.7 000a0403, mask 10.4.3.0 000a0403, slash 24
	mask 10.4.3/24 matches addr 10.4.3.7

	[22:09:20] agc@inspiron1300 ...dist/iscsi/src 27 > ./n any 192.168.0.1
	mask any matches addr 192.168.0.1
2006-11-27 22:24:27 +00:00
christos 7631e65b9f fix an incomplete initializer. 2006-10-15 19:52:40 +00:00
agc 9410ca204b mark VPD 0x80 (Unit Serial Number VPD Page) as being done 2006-08-03 20:50:45 +00:00
agc 72a3c3e7b9 Add support for Vital Product Data 0x80, Unit Serial Number, reported to be
used by the beta FreeBSD initiator by Paul Dekkers.
2006-08-03 20:49:11 +00:00
agc 66644e0749 + add support for IPv6 in the target (CIDR scoping has still to be
implemented for IPv6, but works fine for IPv4)

+ now poll any connections opened in the target.  select is used if
poll is not available

+ remove ramdisk type of backing store, since it was never used, and
is of no use for our needs

+ bump version to 20060727
2006-08-03 20:21:59 +00:00
agc 2b1d5a0345 :g/%i/s//%d/gc
Also make a first stab at implementing persistent reserve in SCSI command.
2006-05-31 19:53:13 +00:00
agc c52b27c275 Bump version number for the portability fix, and the dynamic number of
sessions.
2006-05-27 21:29:32 +00:00
agc 36fad19155 Rather than hardcoding the maximum number of sessions that a target can
serve simultaneously to DEFAULT_TARGET_MAX_SESSIONS, add a -s argument to
iscsi-target(8) to specify the maximum number of sessions.

Also bump default from 4 to 16.
2006-05-27 21:21:04 +00:00
agc 6dff2af424 Include another header file - should make this compile on platforms where
arpa/inet.h does not include netinet/in.h automatically.

Some people do just make life harder for themselves.
2006-05-27 16:00:05 +00:00
agc 2fa516b2eb Rewrite the way report_luns() works, after suspicion by Matt Green, and
following Dan Carosone's suggestion of the uint64_t array.

Abstract a bit more from the HTOBE64() macro intrigue, for platforms
like Solaris/x86 which have fun in this part.

Tested only with little-endian initiators for now.

Bump version to 20060526.
2006-05-26 16:34:43 +00:00
agc 8a1a8b8c5c Include compat.h for the definition of uuid_t, in the case where we don't
have it from <uuid.h>
2006-05-25 19:41:06 +00:00
he c6974f26a9 Use the value-returning variants of the 64-bit endian macros instead
of the argument-tweaking variants (e.g. htobe64 instead of HTOBE64).
2006-05-22 20:48:08 +00:00
agc e32a776a5a Adjust the data VPD returns, to work around a problem in the Cisco
initiator (used on Solaris 10 Update 1) - the initiator demands that a
UUID is returned, so give it one.

Add autoconf glue for that, and a compat uuid_create(3) and
uuid_to_string(3).

This still spews a lot of output via the target's syslog, but persevere,
since it does actually make the target work with the Solaris initiator:

	solaris10# format
	Searching for disks...done


	AVAILABLE DISK SELECTIONS:
	       0. c1d0 <DEFAULT cyl 29728 alt 2 hd 64 sec 63>
		  /pci@0,0/pci-ide@1f,1/ide@0/cmdk@0,0
	       1. c2t5d0 <DEFAULT cyl 96 alt 2 hd 64 sec 32>
		  /iscsi/disk@0000iqn.1994-04.org.netbsd.iscsi-target%3Atarget00001,0
	Specify disk (enter its number): ^D
	solaris10# df -k /mnt
	Filesystem            kbytes    used   avail capacity  Mounted on
	/dev/dsk/c2t5d0s0      91407    1041   81226     2%    /mnt
	solaris10# uname -a
	SunOS solaris10 5.10 Generic_118844-26 i86pc i386 i86pc
	solaris10#
2006-05-21 09:26:37 +00:00
christos 19a2d0dbea Coverity CID 3197: Don't leak fp. 2006-05-13 22:50:24 +00:00
uwe ee952d9fc0 Use be64toh/htobe64 instead of upper-case versions.
Thanks to lint that caught this on big-endian arches.  Little-endian
compiled, but I guess that converting your loop counter into
big-endian inside the loop is not exactly what you want to do.
2006-04-30 01:07:59 +00:00
agc 62b10a5c9c Rather than hardcoding 8 LUNs per disk, use the number for the disc. 2006-04-26 20:31:43 +00:00
agc 84fba20a22 Use the correct opcode for the WRITE6 SCSI command 2006-04-26 20:29:56 +00:00
agc 000a68021a + Some minor formatting cleanup in the header files.
+ Properly pad the names with spaces (with thanks to Bill Studenmund)
+ Use the official T10 vendor name, "NetBSD".
+ Minor cleanup in the INQUIRY command
+ Rather than just punting on the REPORT LUNs SCSI command, emulate it
properly.  This change makes the target work with the Solaris initiator:

	AVAILABLE DISK SELECTIONS:
	       0. c1d0 <DEFAULT cyl 29728 alt 2 hd 64 sec 63>
		  /pci@0,0/pci-ide@1f,1/ide@0/cmdk@0,0
	       1. c2t5d0 <DEFAULT cyl 97 alt 2 hd 64 sec 32>
		  /iscsi/disk@0000iqn.1994-04.org.netbsd.iscsi-target%3Atarget00001,0
	Specify disk (enter its number): 1
2006-04-24 21:59:03 +00:00
agc 339a11eb23 Bump version to 20060417 for the Mac OS X build fixes (thanks, Jason) 2006-04-18 06:52:59 +00:00
thorpej e82413c3cf disk_read() / disk_write(): Make the temporary pointer a uint8_t *, rather
than a char *.  Eliminates a GCC4 warning.
2006-04-17 16:58:31 +00:00
thorpej 0c7787e9ae Let MD5Update() take a void *, rather than a uint8_t *. Gets rid of a
GCC 4 warning.
2006-04-17 16:49:16 +00:00
thorpej 01de58d459 Test HAVE_STDINT_H and bring in <stdint.h> if defined. 2006-04-17 16:45:02 +00:00
thorpej 57de6c70c3 Pull in config.h to get the definition of HAVE_STDINT_H 2006-04-17 16:44:42 +00:00
thorpej 7dd6393f48 Check for <libkern/OSByteOrder.h>. If it exists, use it to get the
OSSwapBigToHostInt64() definition for HTOBE64().  This now builds on
Mac OS X 10.4.6.
2006-04-17 16:30:00 +00:00
agc f27a3c2c6b Commit regenerated config.h so that the correct version strings are picked
up for NetBSD.
2006-04-16 17:19:50 +00:00
agc 7a2241d682 Regenerate with new version number (20060416) 2006-04-15 23:45:30 +00:00
agc 4819a3749d Fix two other bugs which would manifest themselves on architectures which
aren't quite as forgiving as i386 - when using a 16 bit value, use 16 bit
alignment6, not 32 bit. Makes the NetBSD iSCSI target function perfectly
with the Microsoft initiator when run on Solaris 9 on Sparc.
2006-04-15 23:44:08 +00:00
agc 147705130b Bump version number to 20060415 for the bug-fix on big-endian Solaris
platforms.
2006-04-15 08:48:42 +00:00
agc 975cee31c1 Fix a bug found when running the NetBSD iSCSI target on big-endian (i.e.
Sparc) Solaris hosts - check that the stored username is not NULL before
freeing it.

Some minor formatting cleanup.
2006-04-15 08:46:23 +00:00
agc 9be1dc8d96 Use the correct type for the length argument to lba2cdb. 2006-04-02 10:46:47 +00:00
agc 8b20725dfb Fix a (repeated) obvious bug in the tracing functions.
Modify the return values of some boolean functions to be 1 for success, 0
for failure, rather than 0 and -1 respectively.
2006-04-02 09:36:57 +00:00
agc cf0dd67053 Provide a bit more information in the error and warning routines - needed
since variadic macros were removed.
2006-03-31 23:22:24 +00:00
agc 2171876d1d More portability fixes, mainly for Solaris 9. 2006-03-28 20:03:30 +00:00
agc f02decf866 Add changes to make the NetBSD iSCSI target compile and run on Solaris 9
Ultrasparc.
2006-03-27 22:26:28 +00:00
agc 6e1f35f92e minor cleanup in preparation for porting the NetBSD iSCSI target to Solaris 9. 2006-03-26 23:34:06 +00:00
agc e1d9f9cea5 First stab at implementing INQUIRY for Vital Product Data, aka Page 83
information in the Solaris initiator, with information taken from
SPC3, T10/1416-D Revision 23, from www.t10.org.

This is untested, work-in-progress.
2006-03-23 00:01:48 +00:00
agc 86caa230d8 Actually do something with the SYNC_CACHE command - use fsync_range(2) if
it's available, falling back to fsync(2) if it's not. Add the necessary
glue to the autoconf scripts.
2006-03-21 22:56:55 +00:00
agc cbf5d4f8f5 Abstract out some common code, and place it in the utilities source.
Get rid of some #ifdef __KERNEL__ abstractions - they're not needed.
2006-03-21 21:03:14 +00:00
agc a055fd96f7 Incorporate changes from F. Senault, modified by myself to use
autoconf glue, to make the NetBSD iSCSI target build and run on
FreeBSD.
2006-03-20 20:45:07 +00:00