Commit Graph

185 Commits

Author SHA1 Message Date
Peter Lieven
c4592550d6 Move iscsi_set_tcp_keepalive after socket creation
Socket options should be set directly after socket creation.
2012-10-18 09:40:05 +02:00
Peter Lieven
91267f5aaa Limit immediate and unsolicited data to FirstBurstLength
RFC3270 describes in section 12.14 that immediate and unsolicited data
sent from the initiator to the target must not exceed FristBurstLength
bytes in total.
2012-10-18 09:21:54 +02:00
Ronnie Sahlberg
c3adf1d814 Merge pull request #20 from jongrimm/master
RESERVE6/RELEASE6 Commands + testcase.
2012-09-27 18:39:22 -07:00
Jon Grimm
c7d8d2593c Add RESERVE6/RELEASE6 Support. 2012-09-27 12:45:06 -05:00
Ronnie Sahlberg
85e427ea54 SCSI: READTOC change alloclen to a uint32 and encode it in the CDB 2012-09-25 06:54:01 -07:00
Jon Grimm
c3c1628c1d read TOC: set XFER_NONE when xferlen==0 to match Ronnie's change 2012-09-24 10:43:07 -05:00
Jon Grimm
d6bea3db52 merge fixup 2012-09-24 10:22:58 -05:00
Jon Grimm
e55ec72f36 Add Read TOC (0x43) Command Support (and basic testcase). 2012-09-24 10:15:00 -05:00
Ronnie Sahlberg
62b8681409 SCSI: Fix all remaining places where alloc_len==0 means xfer direction should be == NONE 2012-09-19 19:43:01 -07:00
Ronnie Sahlberg
8f98cf3e12 INQUIRY: When alloc_len is set to 0 we should set XFER direction to NONOE, not READ 2012-09-19 18:23:54 -07:00
Ronnie Sahlberg
ead085ecd0 SCSI: INQUIRY fullsize is additional-length + 5, not +3
This bug would report the standard inquiry data size two bytes less than expected
2012-09-12 07:07:04 -07:00
Ronnie Sahlberg
dd006029a2 SCSI: Add unmarshalling of inquiry ADITIONAL_LENGTH field 2012-09-12 06:57:41 -07:00
Ronnie Sahlberg
116af01156 TYPO: Change periperal_device_type to just device_type
but leave the old name as a define for backward compatibility
2012-09-03 09:45:59 -07:00
Ronnie Sahlberg
0cf42c3662 TESTS: Add a test for ISCSI CMDSN out of range
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2012-08-10 15:36:10 +10:00
Ronnie Sahlberg
08034c3335 SYNC CONNECT: make sure state is non-NULL before we dereference it 2012-08-09 08:46:29 +10:00
Ronnie Sahlberg
06cc2d2ece CONNECT: connect data is not always malloc()ed so we can demand it is free()able
After a sync connection, make sure to clear connect_data since it will otherwise
point to a structure on the stack.
2012-08-09 08:27:48 +10:00
Ronnie Sahlberg
a98b6e63f0 MAXCMDSN: Stop sending new PDUs to the target when maxcmdsn is reached
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2012-08-02 09:46:42 +10:00
Ronnie Sahlberg
71be26ad03 Add tracking of MAXCMDSN 2012-08-02 09:09:22 +10:00
Ronnie Sahlberg
439f68e555 CONNECTION: Track the connection state and callback via the context structure
Dont free the connection state when login is finished, instead track it via the
iscsi context structure and free it once the context is destroyed
2012-08-02 08:51:25 +10:00
Ronnie Sahlberg
77d8e41be7 TESTS: Add a mechanism to temporarily disable the session reconnect
Some tests may cause a target to drop the session.
For these tests we DO want the test tool to detect that the command
failed and later reconnect the session again when we proceed to the next subtest

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2012-08-01 16:32:40 +10:00
Ronnie Sahlberg
98b0a757b2 R2T: Reset datasn to 0 everytime we start a new sequence from r2t 2012-08-01 13:44:03 +10:00
Ronnie Sahlberg
1f98c40edf DATASN: We have to increment DATASN in each DATA-OUT PDU in a sequence.
For writes that span across multiple DATA-OUT segments we have to
increment the DATASN field for each segment.
We didnt use to, and most targets were perfectly happy, ignoring that the DATASN was constant 0 for every DATAOUT we sent.
LIO however does check this and did cause it to reject the libiscsi test tool.
(This is something we should write a iscsi test for  so we can flag all non-LIO targets as broken and needing to be fixed)

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2012-08-01 13:30:13 +10:00
Ronnie Sahlberg
2a15e39460 Add a new sense code 2012-07-30 07:38:38 +10:00
Ronnie Sahlberg
9986cd85d7 ISCSI: Support devices with more than 255 LUNs 2012-07-25 13:24:55 +10:00
Ronnie Sahlberg
43bf059fca Add ASCQ for MEDIUM_REMOVAL_PREVENTED 2012-07-21 10:28:32 +10:00
Ronnie Sahlberg
16da01ed4e Add PREVENTALLOWMEDIUMREMOVAL support 2012-07-17 18:12:03 +10:00
Ronnie Sahlberg
025136e81c Add support for STARTSTOPUNIT command 2012-07-15 08:10:39 +10:00
Ronnie Sahlberg
1ce5d97e57 TEST: Add test for ORWRITE command 2012-07-14 17:29:58 +10:00
Ronnie Sahlberg
11f7da678b Add support for ORWRITE 2012-07-14 17:01:38 +10:00
Ronnie Sahlberg
017bb69ccd Add new sense code for miscompare during verify 2012-07-14 12:49:42 +10:00
Ronnie Sahlberg
bac1d4d7af We need to allow >uint8_t as xferlen since this is in unit of bytes, not blocks in the libiscsi api 2012-07-14 12:31:38 +10:00
Ronnie Sahlberg
bdd6e6bb11 Add support for COMPARE_AND_WRITE command 2012-07-14 11:34:40 +10:00
Ronnie Sahlberg
29f5e9378f Add support for WRITEVERIFY10/12/16 2012-07-14 08:19:43 +10:00
Ronnie Sahlberg
1745f76bef Add SYNCHRONIZECACHE16 support 2012-07-13 10:19:44 +10:00
Ronnie Sahlberg
a34874289b Add ascq for WRITE_PROTECTED 2012-07-13 09:43:21 +10:00
Ronnie Sahlberg
3221e631c0 MODE_SENSE Add sync version of mode sense 6 2012-07-13 09:33:41 +10:00
Ronnie Sahlberg
6f4afb6edb MEDIUM_NOT_PRESENT/TRAY-CLOSED/TRAY_OPEN is not an error that blocks a successful connect 2012-07-12 18:55:35 +10:00
Ronnie Sahlberg
c251a429f3 Add more sense key strings for the error messages
Add all the missing sense keys to the value string table so that we can map any
key to a nice text string
2012-07-11 15:38:38 +10:00
Ronnie Sahlberg
801bfb342d Login: dont fail the login just because there is no media in a device
in that case we will never reach test unit ready being successful since it will fail with NOT_READY/MEDIUM_NOT_PRESENT.
Treat this sense code as a successful login as far as the login process is concerned
2012-07-11 15:33:32 +10:00
Ronnie Sahlberg
cadc1650e1 Add ASCQ for MEDIUM_NOT_PRESENT 2012-07-10 16:40:58 +10:00
Yuri Pankov
2a0ad3bd2d FreeBSD and illumos do not define SOL_TCP 2012-06-20 02:54:34 +04:00
Ronnie Sahlberg
b23547546f LOGIN commands NEVER use header digest since even if the login is spanning multiple PDU sequences it is still treated as one logical operation.
Dont update the header_digest setting until we have finished login and are transitioning to the full-feature phase.
2012-06-17 12:37:13 +10:00
Ronnie Sahlberg
d5f646099d READ10/WRITE10: Change these functions to sue the same signatures as the other READ/WRITE
Harmonize the signatures for READ10/WRITE10 to match the ones for READ12/16 and WRITE12/16

This breaks the API/ABI so this forces the next version of the library to bump the major version to 2.0

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2012-06-05 19:20:02 +10:00
Ronnie Sahlberg
9130d2eb45 Add support for VERIFY12 and tests
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2012-06-04 20:35:15 +10:00
Ronnie Sahlberg
6003000809 Add VERIFY16 support and tests
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2012-06-04 20:16:44 +10:00
Ronnie Sahlberg
9e09a46ddd LOGIN: Once the login phase has finished, bump ITT by one
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2012-06-02 17:51:10 +10:00
Ronnie Sahlberg
819248a519 LOGIN: Dont increment the ITT if the target wants another round of LOGIN
If the login phase takes multiple login requests we should keep the ITT the same for all login requets and not increment it.
A multi-phase login is only a single task eventhough it may be spread across multiple login requetst.

While most targets are forgiving and still work if we increment the ITT for each login command, some targets such as SOLARIS/COMSTAR is NOT forgiving if we break the protocol in this situation.

Fix the ITT handling so that we dont make SOLARIS/COMSTAR upset.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2012-06-02 15:41:38 +10:00
Ronnie Sahlberg
812df62bfd SBC: Add GET_LBA_STATUS support and simple test 2012-05-30 18:41:12 +10:00
Ronnie Sahlberg
6be4a82407 Remove some unused variables 2012-05-30 18:23:15 +10:00
Ronnie Sahlberg
824a33c834 win32 set the socket to nonblocking moe for win32 2012-05-15 22:08:10 +10:00