Commit Graph

82 Commits

Author SHA1 Message Date
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
agc 2010c5954a Clean up, mostly to autoconf glue, to check whether syslog(3) exists or not. 2006-03-20 20:25:42 +00:00
agc a4c7ca1aeb Get rid of c99isms in the form of variable number of args to CPP macros.
This should slim down the resulting binaries a fair bit as well.
2006-03-12 18:47:27 +00:00
agc 7acf73bedf Thanks to Thomas for the prod - update usage message to include all
supported options.
2006-03-11 12:09:36 +00:00
wiz fb778aad1c Compact single letter options in SYNOPSIS. Sort option descriptions. 2006-03-11 11:58:53 +00:00
wiz 674cf041a7 Sort options as in man page. 2006-03-11 11:58:22 +00:00
wiz 93ba37c7ea Add -V to SYNOPSIS; serial comma; sort option descriptions. 2006-03-11 09:21:03 +00:00
agc d4397af4d8 One more off the TODO list, although I hadn't realised it was going to be
as painful as it was.

Teach GNU autoconf to recognise socklen_t, and use it in the code.
2006-03-06 20:52:32 +00:00
agc 32306cea7e I have a nasty feeling it's time to sell all my guitars:
Add some very crude hacks which allow the iscsi-target to work with IPv6:

Mar  5 23:43:45 sys3 iscsi-target: > Discovery login from iqn.1994-04.org.NetBSD.iscsi-initiator:agc on 7f00:1::1002:cbc
Mar  5 23:43:45 sys3 iscsi-target: < Discovery logout from iqn.1994-04.org.NetBSD.iscsi-initiator:agc on 7f00:1::1002:cbc
Mar  5 23:43:45 sys3 iscsi-target: > Normal login from iqn.1994-04.org.NetBSD.iscsi-initiator:agc on 7f00:1::1002:cbc
Mar  5 23:43:48 sys3 iscsi-target: < Normal logout from iqn.1994-04.org.NetBSD.iscsi-initiator:agc on 7f00:1::1002:cbc

These have still to be cleaned up, but this will happen over the next
few days.

Update the TODO list to reflect the current state.
2006-03-05 23:50:46 +00:00
agc ff69df84c5 Add IPv6 awareness. 2006-03-04 22:06:26 +00:00
agc 7717b41470 Include version number, passed down from GNU autoconf.
Add a -V argument to iscsi-target (and iscsi-harness), which will print
the utility name, version number, and destination for all bug reports,
and then exit the utility.

Modify the documentation accordingly.

Re-run autoconf and autoheader to pick up the necessary autoconf glue.
2006-03-04 21:56:11 +00:00
agc a70556aee7 Sync example file with reality - this has no effect on NetBSD, since
configuration files are held in src/etc/iscsi, not src/dist/iscsi.
2006-03-04 21:53:16 +00:00