Commit Graph

764 Commits

Author SHA1 Message Date
Peter Lieven
9f82d0bf83 INIT allow a trailing / in iscsi_parse_portal_url() 2012-10-30 11:47:12 +01:00
Peter Lieven
774ede1f46 ISCSI_URL change strings from dynamic to static 2012-10-30 11:41:51 +01:00
Peter Lieven
2e30d7aafb CONNECT correctly free ct in case first testunitready fails 2012-10-29 21:37:39 +01:00
Peter Lieven
923b9a4fb2 ISCSI-CONTEXT change dynamic string allocations to statics 2012-10-27 17:23:40 +02:00
Peter Lieven
0906109d8a CONNECT fix mem leak of connection_task object 2012-10-27 16:31:56 +02:00
Peter Lieven
4785dd9933 CONNECT do not reseed RNG in iscsi_reconnect 2012-10-26 20:47:35 +02:00
Peter Lieven
0b4424cca0 CONNECT Fix memory leak in iscsi_reconnect 2012-10-26 20:47:15 +02:00
Peter Lieven
89e918e9d7 SOCKET validate data_size in in_pdu header 2012-10-26 17:12:07 +02:00
Jon Grimm
8fbc536779 TYPO: 'calculate' in comments 2012-10-25 12:59:55 -05:00
Jon Grimm
b81bdd3932 Merge with upstream 2012-10-25 12:56:26 -05:00
Jon Grimm
1eaca70a52 Add MaintenanceIn: Report Supported Opcodes (all) and testcase. 2012-10-25 12:48:37 -05:00
Ronnie Sahlberg
97dcf94d72 iSCSI: when reconnecting we should not automatically requeue any DATA-OUT PDUs
Dont requeue data-out pdus, or other pdus with the DELETE_WHEN_SENT flag, such
as nops.
These, like the DATA-OUT pdu will instead be automatically re-sent when the original write command is sent again.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2012-10-24 19:32:00 -07:00
Peter Lieven
6e82c48185 RECONNECT fix read from freed iscsi context 2012-10-23 10:55:04 +02:00
Peter Lieven
a26a6e12d5 Fix paramter to DPRINTF in tcp_set_user_timeout() 2012-10-20 19:13:53 +02:00
Peter Lieven
d30b279474 Unify paramters in tcp_set_user_timeout()
Use the same function definition as in the other tcp setters.
2012-10-20 19:12:13 +02:00
Peter Lieven
20cf2b279e Fix incorrect whitespaces
At a few places there where spaces where tabulators where appropriate
2012-10-20 19:08:57 +02:00
Peter Lieven
3f5a75ce5e Remove redundant code in iscsi_service() 2012-10-20 19:00:32 +02:00
Peter Lieven
881fc9743a Use generic tcp_set_sockopt function for tcp setsockopt operations 2012-10-20 18:54:46 +02:00
Peter Lieven
cbae6ae058 Remove accidently left debug message in iscsi_service 2012-10-20 18:44:43 +02:00
Peter Lieven
78a31ad4a1 Add iscsi_set_tcp_syncnt function
This patch adds support for setting TCP_SYNCNT to overwrite
the system default values. This allows indirect support
for a configurable connect timeout.

Linux uses a exponential backoff for SYN retries starting
with 1 second.

This means for a value n for TCP_SYNCNT, the connect will
effectively timeout after 2^(n+1)-1 seconds.
2012-10-20 18:43:48 +02:00
Peter Lieven
d1110b7515 Add various environment variables
This patch allows the following parameters inside libiscsi to be adjusted without code modification:
LIBISCSI_DEBUG
LIBISCSI_TCP_USER_TIMEOUT
LIBISCSI_TCP_KEEPIDLE
LIBISCSI_TCP_KEEPCNT
LIBISCSI_TCP_KEEPINTVL

You can now enable debugging of libiscsi inside e.g. qemu-kvm with
LIBISCSI_DEBUG=3 qemu-kvm -hda iscsi://...
2012-10-20 18:11:35 +02:00
Peter Lieven
236aaa011f Fix compiler warnings
These patch fixes 3 compiler warnings introduce by my recent patches.
2012-10-19 23:48:04 +02:00
Peter Lieven
ad9cd56b2d Add setters for TCP keepalive values
This patch adds 3 functions to set the 3 keepalive values TCP_KEEPIDLE, TCP_KEEPCNT
and TCP_KEEPINTVL. The values have to be set after iscsi context creation and are
then configured on the socket on each new connection.
2012-10-19 23:40:12 +02:00
Ronnie Sahlberg
abd20f3587 Use the literal ISCSI_STATUS_REDIRECT instead of the numeric value 2012-10-18 20:03:58 -07:00
Peter Lieven
cc2b0c9b1d Set SO_KEEPALIVE before TCP_USER_TIMEOUT
For TCP_USER_TIMEOUT to work it seems to be necessary that SO_KEEPALIVE is
enabled. RFC5482 section 4.2 also says that the TCP_USER_TIMEOUT has to be
less than the keepalive timeout. This means less than 30000 ms in the
current libiscsi default settings for TCP keepalives.
2012-10-18 14:31:09 +02:00
Peter Lieven
326b2ea49d Add backoff mechanism to iscsi_reconnect
This patch adds a linear backoff mechanishm + jitter in case
a reconnect fails. If there is a longer outage this is to
avoid a large amount of simultaneous connects to the storage.
2012-10-18 12:18:40 +02:00
Peter Lieven
f973608578 Add iscsi_tcp_set_user_timeout function
This patch adds a user configurable option to set the TCP_USER_TIMEOUT
socket option. With this timeout set a broken TCP session is shutdown
after a given timeout even there are unacked packets. SO_KEEPALIVE
seems not to work in this case.
2012-10-18 11:55:15 +02:00
Peter Lieven
cb6f2ce252 iSCSI Redirect support
This patch adds support for persistant portals like they are common
to storage arrays with different interfaces or physical members.
2012-10-18 10:48:52 +02:00
Peter Lieven
4cb845477d Add debugging framework
This patch adds a user configurable debug level. For testing
it includes connection info and reporting errors.
2012-10-18 10:36:26 +02:00
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