Declare dynamically allocated strings as 'char *' instead of 'const char *'.
Remove the discard_const() macro. Do not test whether or not a pointer is
NULL before calling free() because it is allowed to pass NULL to free().
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
rfc3720 indicates that SendTargets on discovery *and* normal operational
sessions must be supported by targets:
A system that contains targets MUST support discovery sessions on
each of its iSCSI IP address-port pairs, and MUST support the
SendTargets command on the discovery session.
...
A target MUST support the SendTargets command on operational
sessions...
Signed-off-by: David Disseldorp <ddiss@suse.de>
This splits a transport into static driver specific functions for the common
iscsi commands. Optionally, a driver specific opaque memory is introduced
which is currently only used by iSER transport.
Last a lot of functions changed to static.
Signed-off-by: Peter Lieven <pl@kamp.de>
include/iscsi-private: adding queue_pdu in transport function pointers
struct
include/iscsi: declaration of tcp_queue_pdu function
socket: adding queue_pdu function to transport initialization
all_library: changing iscsi_queue_pdu into iscsi->t->queue_pdu
Signed-off-by: Roy Shterman <roysh@mellanox.com>
Remove iscsi_allocate_pdu() which is just a wrapper.
Rename iscsi_allocate_pdu_with_itt_flags() to iscsi_allocate_pdu()
and update all callers.
This only removes a wrapper function and contains no logic changes.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Cast ptrdiff (diff between two pointers) to long to fix printfs.
This fixes FTBFS on 32bit architectures.
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Some targets return multiple TargetAddress for individual targets.
Create a linked list of addresses for each target instead of
failing the discovery process when this happens.
Empty discovery and login packets are legal, and have the same behavior
as packets with a single NUL in them. Introduced by commit 94d73fc
(Merge pull request #83 from bonzini/coverity, 2013-11-05).
Reported-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Otherwise we access a NULL pointer. RFC3270 appendix D confirms
that TargetName must always come before TargetAddress.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Checking for the presence of the NUL character should be done
without accessing beyond the PDU datain. Use memchr instead
of strlen, and compute the length only if a NUL character is
actually there.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This patch adds a wrapper around all memory allocations and frees.
The idea is to get warned immediately if the application leaks memory.
Additionally the wrapper functions make it easy to add different
memory allocators or memory pools in the future.
Input processing used to keep all data in one single input buffer, which
makes it hard to handle nested events as well as reading directly from the
socket into the application buffer without an extra copy.
Create a new iscsi_in_pdu structure where we store the header, and any data
for the recevied pdu and store them in a proper input queue.
Change the signature for all processing functions to tahe a iscsi_in_pdu
structure for the received pdu instead of just a pointer to a buffer.