Commit Graph

173 Commits

Author SHA1 Message Date
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
Ronnie Sahlberg
dafa186868 win32: connect.c needs the compatibility functions 2012-05-15 21:54:10 +10:00
Ronnie Sahlberg
201d6c3b54 win32: sinc.c need the compatibility header so it finds the replacement for poll() 2012-05-15 21:51:53 +10:00
Ronnie Sahlberg
05d2f81a84 win32: unistd.h is not available under win32 2012-05-15 21:45:30 +10:00
Ronnie Sahlberg
ec0d9682a7 Dont use FIONREAD just rely on the fact the socket is nonblocking and look for EAGAIN when we reach the end of available data.
From Paolo Bonzini <pbonzini@redhat.com>
2012-05-15 20:32:37 +10:00
Ronnie Sahlberg
83730f7d4c w32: dont export our version of poll. 2012-05-13 17:21:53 +10:00
Ronnie Sahlberg
1c63b55e20 W32: update libiscsi.def with all new and missing symbols 2012-05-13 17:05:25 +10:00
Ronnie Sahlberg
ed4b8ec72e W32: Remove our poor emulation of poll() from the w32 build. 2012-05-13 16:46:38 +10:00
Michael Tokarev
261924d73a export only required symbols, do not export internal symbols from the library
Hopefully I collected the list of symbols to expot correctly.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2012-05-12 08:46:06 +10:00
Michael Tokarev
aee0e3bf72 always export iscsi_set_tcp_keepalive()
Set only the (socket) options which are defined on a given platform.
The function becomes a no-op if no option is known at complie time.
Remove autoconf test for HAVE_TCP_KEEPALIVE too.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2012-05-12 08:41:34 +10:00
Ronnie Sahlberg
c91de1e35a We might be called by some eventsystems with POLLIN eventhough there is
no data to read from the socket and there is no error.
For this case, if FIONREAD tells us that there are 0 bytes to read, check if
there is a socket error and return ok/error based on that.

Some eventsystems may cause this to burn some cpu if the socket is ok
but there are no bytes available to read by invoking POLLIN over and over, but it is better than failing the application.
2012-05-10 20:04:22 +10:00
Ronnie Sahlberg
733b97f4b8 Add PREFETCH10/16 implementations 2012-05-03 06:21:49 +10:00
Ronnie Sahlberg
974738968d Implement READ/WRITE_12/16 and a simple test for read16
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2012-05-01 21:54:32 +10:00