Commit Graph

1059 Commits

Author SHA1 Message Date
Bart Van Assche
e5ba667cea test_writesame16_unmap: Do not leak memory if WRITESAME16 is not supported
Detected by Valgrind.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
2013-10-01 06:27:50 -07:00
Bart Van Assche
1337185fe9 test_read6_simple: Avoid triggering a use-after-free
Do not use the 'task' pointer after the memory it points at has been freed.
Detected via valgrind.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
2013-10-01 06:24:55 -07:00
Bart Van Assche
4653cd8df4 iscsi_reconnect: Fix a use-after-free
This patch fixes the following Valgrind complaint:

Invalid read of size 4
   at 0x524A858: iscsi_reconnect (connect.c:378)
   by 0x5258794: iscsi_service (socket.c:707)
   by 0x52599C4: event_loop (sync.c:67)
   by 0x525AFD7: iscsi_reserve6_sync (sync.c:1096)
   by 0x40A40A: reserve6 (iscsi-support.c:3291)
   by 0x422C95: test_reserve6_target_warm_reset (test_reserve6_target_warm_reset.c:39)
   by 0x503B05F: ??? (in /usr/lib/libcunit.so.1.0.1)
   by 0x503B375: ??? (in /usr/lib/libcunit.so.1.0.1)
   by 0x503B69F: CU_run_all_tests (in /usr/lib/libcunit.so.1.0.1)
   by 0x403171: main (iscsi-test-cu.c:1258)
 Address 0x6443958 is 3,032 bytes inside a block of size 4,120 free'd
   at 0x4C2B83A: free (vg_replace_malloc.c:468)
   by 0x524A846: iscsi_reconnect (connect.c:374)
   by 0x5258794: iscsi_service (socket.c:707)
   by 0x52599C4: event_loop (sync.c:67)
   by 0x525AFD7: iscsi_reserve6_sync (sync.c:1096)
   by 0x40A40A: reserve6 (iscsi-support.c:3291)
   by 0x422C95: test_reserve6_target_warm_reset (test_reserve6_target_warm_reset.c:39)
   by 0x503B05F: ??? (in /usr/lib/libcunit.so.1.0.1)
   by 0x503B375: ??? (in /usr/lib/libcunit.so.1.0.1)
   by 0x503B69F: CU_run_all_tests (in /usr/lib/libcunit.so.1.0.1)
   by 0x403171: main (iscsi-test-cu.c:1258)

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
2013-10-01 06:24:07 -07:00
Bart Van Assche
bd948c959e Port to CUnit version 2
Linux distributions like openSUSE 12.3 include CUnit version 2.
Apparently libiscsi uses some CUnit version 1 data structures that
have been modified in CUnit version 2. This causes the libiscsi
build to fail against CUnit version 2. Fix this by detecting the
CUnit version during the configure step.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
2013-10-01 06:22:06 -07:00
Ronnie Sahlberg
766d92221c Reconnect: recalculate the header digest when we re-queue after a reconnect 2013-09-26 18:26:29 -07:00
Ronnie Sahlberg
286df50244 Add more status codes : CONDITIONS_MET/TASK_SET_FULL/ACA_ACTIVE/TASK_ABORTED 2013-09-25 20:26:00 -07:00
Ronnie Sahlberg
99d7107ada Merge pull request #80 from sitsofe/initiator2
Fix incorrect second initiator
2013-09-25 19:23:09 -07:00
Sitsofe Wheeler
69867d23a8 Fix incorrect second initiator
Use the second initiator name in all files found by
ack "iscsic2 = "
2013-09-25 23:05:01 +01:00
Ronnie Sahlberg
8aa6d9de8f TESTS: Add a test for COMPARE_AND_WRITE when the data to verify does not match 2013-09-23 21:58:55 -07:00
Ronnie Sahlberg
e7c7a99ede Merge pull request #79 from trasz/master
Replace alloca.h with stdlib.h; the former doesn't exist on FreeBSD.
2013-09-23 07:28:00 -07:00
Edward Tomasz Napierala
ae298ec940 Fix test to actually do what the comment says and send too low CmdSN. 2013-09-23 13:14:43 +02:00
Edward Tomasz Napierala
f9d4c742a2 Replace alloca.h with stdlib.h; the former doesn't exist on FreeBSD. 2013-09-23 11:34:06 +02:00
Ronnie Sahlberg
a9b75b96a3 SCSI: Add definitions for some more 0x29xx ASCQs
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2013-09-22 17:09:11 -07:00
Ronnie Sahlberg
9f1a28f753 TESTS: Add an initial simple test for COMPARE_AND_WRITE
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2013-09-22 17:02:30 -07:00
Ronnie Sahlberg
baf0910331 Merge branch 'master' of github.com:sahlberg/libiscsi 2013-09-21 14:57:27 -07:00
Bart Van Assche
31f40b2e53 test-tool/1120_persistent_register_simple.c: Spelling fix
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
2013-09-21 14:57:00 -07:00
Ronnie Sahlberg
b1a6e5923a Merge pull request #78 from sitsofe/makefile
Fix Makefile.am breakage.
2013-09-19 15:02:00 -07:00
Sitsofe Wheeler
7417a6fcf5 Fix Makefile.am breakage.
Complete the changes made in commit 7692027.
2013-09-18 17:02:56 +01:00
Ronnie Sahlberg
657a7a4f7f Merge branch 'master' of github.com:sahlberg/libiscsi 2013-09-17 09:17:53 -07:00
Ronnie Sahlberg
158f2226c0 TEST: read10invalid use the reported blocksize instead of a hardcoded value 2013-09-17 09:16:59 -07:00
Ronnie Sahlberg
8958a88ae9 Merge pull request #76 from sitsofe/osx
Fix compilation on OS X
2013-09-10 06:24:30 -07:00
Ronnie Sahlberg
9b40f0a94d Merge pull request #75 from sitsofe/clang
Fix compilation issues under clang
2013-09-10 06:24:08 -07:00
Ronnie Sahlberg
b61a3bb4ca Merge pull request #74 from sitsofe/compareandwrite
TESTS: Fix COMPAREANDWRITE tests to send write data
2013-09-10 06:22:59 -07:00
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