Commit Graph

2236 Commits

Author SHA1 Message Date
Sitsofe Wheeler 2fda87160c Fix compilation on OS X
OS X doesn't implement SOL_TCP so workaround this the same way as on
FreeBSD/Solaris.
2013-09-09 19:38:00 +01:00
Sitsofe Wheeler 7692027d6c Fix compilation issues under clang
clang defaults to c99 so remove inline statements
(http://clang.llvm.org/compatibility.html#inline ) on functions shared
across different translation units.
clang's linker doesn't like major numbers over 255 so change how SOREL
is generated in Makefile.am.
2013-09-09 18:04:06 +01:00
Sitsofe Wheeler 0b6b12ba53 TESTS: Fix COMPAREANDWRITE tests to send write data
Previously COMPAREANDWRITE was only sending verify instance data which
can cause targets to generate COMMAND ABORTED/NOT ENOUGH UNSOLICITED
DATA errors due to the buffer being obviously too small to contain
verify AND write instance data.

The buffer size check has been modified and compareandwrite tests
updated to pass a larger buffer with interesting write instance data.
2013-09-09 17:48:13 +01:00
Ronnie Sahlberg 45a3752d16 TESTS: Abort READ6 test if lun is bigger than what READ6 can address 2013-09-02 12:19:24 -07:00
Ronnie Sahlberg 2627d371fd Merge pull request #73 from sitsofe/master
Fix incorrect second initiator
2013-09-02 11:57:43 -07:00
Sitsofe Wheeler 489f9b27e3 Fix incorrect second initiator. 2013-08-30 09:14:37 +01:00
Ronnie Sahlberg dae7fb6c37 Merge pull request #72 from bonzini/master
Ignore padding when an iovector is supplied
2013-08-26 19:21:10 -07:00
Paolo Bonzini 73b0d4777f Ignore padding when an iovector is supplied
The iSCSI protocol adds padding to a data packet if the data size is not
a multiple of four.  The iovector provided by QEMU does not include such
padding, and libiscsi then complains that there was a protocol error.
This patch fixes this by reading the padding in a separate "recv"
system call.  These packets anyway do not happen in the data path,
where the packet size is a multiple of 512.

This fixes QEMU's scsi-generic backend, which triggered the problem when
the target sent a 66-byte INQUIRY response.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-08-26 23:53:31 +02:00
Ronnie Sahlberg daac72a8f9 TESTS more writesame1* test fixes 2013-08-25 16:39:38 -07:00
Ronnie Sahlberg ab600e39b0 TESTS: Fixes to the WRITESAME tests 2013-08-25 15:26:36 -07:00
Ronnie Sahlberg 1e5a256366 Update comments 2013-08-04 18:51:58 -07:00
Ronnie Sahlberg dc981c93ef Cleanup: rename to payload_* the PDU variables used to track writing to socket 2013-08-04 17:34:15 -07:00
Ronnie Sahlberg 6cb88eb0ce Cleanup: rename pdu->written -> pdu->outdata_written 2013-08-04 17:27:29 -07:00
Ronnie Sahlberg c5bd95aac9 Remove the use of TCP_CORK 2013-08-04 16:15:22 -07:00
Ronnie Sahlberg 6041dcd136 Add a new function to create a scsi_task using an existing CDB 2013-08-04 14:35:58 -07:00
Ronnie Sahlberg 06eab264f6 Rewrite and simplify iscsi_iovector_readv_writev 2013-08-04 14:34:57 -07:00
Ronnie Sahlberg 7772b9fafd TESTS: Fix memory leak in the VERIFY16 Mismatch test 2013-08-04 14:07:06 -07:00
Ronnie Sahlberg 4ccfe10a70 Merge pull request #71 from bonzini/aliasing-more
use scsi_get/set_uint16/32/64 in tests
2013-08-03 06:52:43 -07:00
Paolo Bonzini 3916872d27 use scsi_get/set_uint16/32/64 in tests
Fixes ARM problems too.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-08-02 17:30:24 +02:00
Ronnie Sahlberg 912b5dc495 Merge pull request #67 from plieven/small_allocations
MEMORY introduce a small allocation pool
2013-08-02 06:45:35 -07:00
Ronnie Sahlberg eeefd121a8 Merge pull request #69 from bonzini/abi
bump ABI version
2013-08-02 06:40:30 -07:00
Ronnie Sahlberg 327dd42bf0 Merge pull request #70 from bonzini/aliasing-more
More aliasing/alignment fixes
2013-08-02 06:37:38 -07:00
Paolo Bonzini 73ce7f40c8 avoid casting struct sockaddr
On ARM, this produces a warning.  Use a union instead.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-08-02 15:06:16 +02:00
Paolo Bonzini 31a3aeb0e0 fix another aliasing problem
scsi_set_uint64 should just use scsi_set_uint32, similar to
what scsi_get_uint64 does.  This avoids problems on architectures
where "uint32_t" requires more alignment than "char", e.g. ARM.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-08-02 14:07:42 +02:00
Paolo Bonzini d4a6e4b3e3 bump ABI version
The ABI version was changed many times since the first release, but no
one noticed.  Now that I am packaging a newer version of libiscsi
I need to bump the soname from 1 to 2, which will be (posthumously)
the ABI for 1.9.0.  Declare the next version to have ABI version 3.

Please do not hesitate to ask for review of header-file patches to
catch ABI changes (which should be avoided!).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-08-02 13:04:16 +02:00
Ronnie Sahlberg e7df1af3b9 TESTS: READ10 and STARTSTOPUNIT should fail while sanitize is in progress
Other commands should fail too  but we dont need to test them all
2013-07-21 14:33:22 -07:00
Ronnie Sahlberg 03f03ce518 TESTS: Inquiry is still allowed while SANITIZE is running 2013-07-21 14:21:16 -07:00
Ronnie Sahlberg d901700633 Add a test that a sanitize operation will continue across resets
Verify that abort task/abort task set/lun reset/warm reset/cold reset
and full blown session failures will not affect a sanitize that is in
progress
2013-07-21 14:11:13 -07:00
Ronnie Sahlberg 49698e0322 Dont fail the login just because a sanitize is in progress 2013-07-21 14:04:41 -07:00
Ronnie Sahlberg 804c5b0211 Dont reference *pdu after it has been freed 2013-07-21 13:29:43 -07:00
Ronnie Sahlberg 83a0cd90f9 Add SANITIZE_IN_PROGRESS ASCQ 2013-07-21 09:55:35 -07:00
Ronnie Sahlberg b1b3c603af TESTS: clear unit attention after changing SWP settings in the readonly test 2013-07-21 09:20:00 -07:00
Ronnie Sahlberg 52a83e91af Add POWER_CONDITION modepage marshalling/unmarshalling 2013-07-20 15:35:38 -07:00
Ronnie Sahlberg 0013ae25e6 Merge branch 'master' of github.com:sahlberg/libiscsi 2013-07-20 14:06:05 -07:00
Ronnie Sahlberg fd38ff4bfc Add MODESENSE6/10 and MODESELECT6/10 support 2013-07-20 14:05:20 -07:00
Ronnie Sahlberg e556a0399b SCSI MODESELECT: leave the 4/8 byte header completely blank.
The convention is to not fill this header in when sending modeselect to a target
2013-07-20 09:08:52 -07:00
Ronnie Sahlberg c172e12968 UTILS: Check that an iscsi url was provided on the command line before strdup()ing it 2013-07-20 09:01:38 -07:00
Ronnie Sahlberg 1f958fc7c2 Merge pull request #68 from plieven/iscsi-ls-url
iscsi-ls: add --url parameter
2013-07-18 06:11:26 -07:00
Peter Lieven bb2aca580c iscsi-ls: add --url parameter
Signed-off-by: Peter Lieven <pl@kamp.de>
2013-07-18 11:33:35 +02:00
Peter Lieven d429276907 MEMORY introduce a small allocation pool
This patch finally introduces a small allocation pool
which recycles all the small portions of memory that
are used for headers and pdu structures. This was
the initial idea behind wrapping all memory functions
in libiscsi.

The results of booting are test system up to the login
prompt are quite impressive:

BEFORE:
libiscsi:5 memory is clean at iscsi_destroy_context() after 10712 mallocs, 18 realloc(s) and 10712 free(s)

AFTER:
libiscsi:5 memory is clean at iscsi_destroy_context() after 41 mallocs, 18 realloc(s), 41 free(s) and 10584 reused small allocations

Signed-off-by: Peter Lieven <pl@kamp.de>
2013-07-18 11:15:56 +02:00
Ronnie Sahlberg cc02faabb0 Add TCP_CORK support when available 2013-07-10 14:14:36 -07:00
Ronnie Sahlberg a3283fbafd TESTS: Add a test that SANITIZE fails when SWP is on. 2013-07-09 02:27:30 -07:00
Ronnie Sahlberg 6e5a5745aa TESTS: Add a test that SANITIZE commands fail when there is a RESERVATION 2013-07-09 01:51:00 -07:00
Ronnie Sahlberg 9e9ca71247 Modesense6 decoding bugs, start preparing for modesense10 decoding 2013-07-08 01:31:03 -07:00
Ronnie Sahlberg e31e0ce58d TESTS: Log when we skip tests on normal log level, not just for -V 2013-07-08 00:23:39 -07:00
Ronnie Sahlberg ebb1f06830 Add parameter list length error sense code 2013-07-06 23:35:03 -07:00
Ronnie Sahlberg a51d706d32 Add invalid field in parameter list sense code 2013-07-06 22:35:36 -07:00
Ronnie Sahlberg 6b93af26a9 Add utility to get/set the software write protect flag 2013-07-06 21:59:03 -07:00
Ronnie Sahlberg 7895fb700c Add MODESELECT6 support
Add support for MODESELECT6 and add marshalling functions for the
mode pages we support so far.
2013-07-06 16:11:17 -07:00
Ronnie Sahlberg b6e5af558d Unmarshall support for Control modepage 2013-07-05 22:38:45 -07:00