If no reservation is held a SCSI target sends a response that is eight
bytes long while scsi-lowlevel.c fills in the first twelve bytes of a
data structure for which only eight bytes are allocated. Fix this buffer
overflow by always allocating a full
scsi_persistent_reserve_in_read_reservation structure.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Add a simple test that it works or is not implemented.
Add a RCTD test to verify that with this flag clear we get command descriptors without CTDP set and with it set we get command descriptors with CTDP set and a timeout descriptor
This makes sure that CHAP authentication is disabled if the system
is running in FIPS 140-2 mode. MD5 is not a secure algorithm according
to the standard.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Default to 0 meaning no timeout.
Implement a test for iSCS to test what happens if we send a command
with CMDSN being higher than the target allows.
In this case we dont strictly know what will happen, just that what should
NOT happen is the target responding with success.
But we have to be prepared for any kind of failure, including a timeout,
scsi sense, or even iscsi reject or session failure.
in case the maximum number of reconnects is limited with
iscsi_set_reconnect_max_retries() the an iscsi_context
is leaked if the limit is exhausted.
Signed-off-by: Peter Lieven <pl@kamp.de>
If the amount of reconnects is limited with iscsi_set_reconnect_max_retries()
it might happen that iscsi_reconnect is called while there is already a deferred
reconnect.
Signed-off-by: Peter Lieven <pl@kamp.de>
iscsi_data.size is used as parameter to memory
operation functions (such as malloc) which except
size_t rather than int.
Signed-off-by: Peter Lieven <pl@kamp.de>
Add support for BUSY status coide from the target and just pass this
back to the application as is (instead of converting it to _ERROR).
This allows the application to trap task->status==SCSI_STATUS_BUSY and
decide what/how to proceed.
Ordering by itt adds the special case of handling
itt == 0xffffffff. Order by CmdSN instead as described
by RFC3720.
Signed-off-by: Peter Lieven <pl@kamp.de>
Queing packets with itt = 0xffffffff (e.g. NOP-Out replies) ahead
of queue because they might have a higher CmdSN than following
packets. This again could lead to a deadlock AND its a protocol
violotion:
RFC3720 Section 3.2.2.1 second last paragraph on Page 21:
"On any connection, the iSCSI initiator MUST send the commands in
increasing order of CmdSN, except for commands that are retransmitted
due to digest error recovery and connection recovery."
Signed-off-by: Peter Lieven <pl@kamp.de>
This patch adds support for read/writev to directly read and write
from/to iovectors. Before this patch on read and write from/to socket
the operation was limited by the iovec boundaries. If there is enough
data in the buffer or enough buffer space available its now possible
to transfer the whole data in one atomic operaion.
Signed-off-by: Peter Lieven <pl@kamp.de>
This will set TCP_NODELAY on the socket connection
to the target. This is the first step to improve latency.
For systems supporting TCP_CORK we plan to add a cork
around certain PDUs e.g. DATA-Out, but this needs further
testing.
Signed-off-by: Peter Lieven <pl@kamp.de>