Commit Graph

971 Commits

Author SHA1 Message Date
Ronnie Sahlberg
027ff2fdca Solaris: older versions of solaris needs to link with nsl/socket 2013-06-29 12:16:16 -07:00
Ronnie Sahlberg
b73e91c89a Don't use -Wwrite-strings on Solaris
They have a weirdass struct option {} so we can't use this warning.
2013-06-29 12:10:43 -07:00
Ronnie Sahlberg
8140c5b726 Flag another argument as _U_ 2013-06-29 11:20:23 -07:00
Ronnie Sahlberg
bc7b1dc600 Add _U_ to some variables that might be unused 2013-06-29 11:14:46 -07:00
Ronnie Sahlberg
b555bbebdd Add a cast to ssize_t 2013-06-29 11:12:41 -07:00
Ronnie Sahlberg
9f88ea2e9a Change a u_int32_t to uint32_t
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2013-06-25 20:23:21 -07:00
Ronnie Sahlberg
21a6a08814 Update libiscsi.def/.syms for iscsi_set_bind_interfaces
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2013-06-25 20:15:35 -07:00
Ronnie Sahlberg
e061cba1b9 URL encoded Targetnames
Assume target names are URL encoded with '%' as the special character.

Any sequence of '%' followed by two bytes in the target name will be replaced
with the byte that the second two bytes represent in hexadecimal.

Example
iqn.ronnie.test%3A1234
will be translated to iqn.ronnie.test:1234
2013-06-16 11:35:14 -07:00
Bart Van Assche
12f93b60c7 Retry RESERVE6/RELEASE6 upon BUS RESET UA
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
2013-06-08 07:45:18 -07:00
Bart Van Assche
49d1145a10 Next to BUS RESET, also accept NEXUS LOSS unit attention after login
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
2013-06-08 07:44:43 -07:00
Ronnie Sahlberg
8cc2915a17 Merge pull request #63 from cardoe/werror
Allow users to disable -Werror at configure time
2013-06-05 20:17:47 -07:00
Doug Goldstein
2d43a056a9 Allow users to disable -Werror at configure time
Some users and distro packagers might not want to build with -Werror,
this allows them to disable using -Werror but enables it in the default
case so as to maintain the current behavior.
2013-06-05 14:28:48 -05:00
Ronnie Sahlberg
12a7d2f60d TEST: update SANITIZE test output 2013-06-02 16:37:56 -07:00
Ronnie Sahlberg
dd44a62994 typo 2013-06-01 09:02:04 -07:00
Ronnie Sahlberg
44e64fb8cf TESTS: SANITIZE. Produce warnings if WABEREQ does not match BLOCK ERASE support status 2013-06-01 08:59:37 -07:00
Ronnie Sahlberg
804ab643a3 TESTS: SANITIZE tests. Print additional warnings.
If SANITIZE is supported but we dont have the BlockDeviceCharacteristics
page we produce a warning.
If OVERWRITE is supported on SSDs we warn.
If BLOCK ERASE is supported on HDDs we warn.
2013-06-01 08:53:54 -07:00
Ronnie Sahlberg
7d413da22c TESTS: Print NORMAL log level by default 2013-06-01 08:47:05 -07:00
Ronnie Sahlberg
cb793f01f3 TESTS: Fix typo. s/allow_sanitize/allow-sanitize/g 2013-06-01 08:40:43 -07:00
Ronnie Sahlberg
595b7043b7 TESTS: fix test for modesense6 residuals. We never get overflow
but we get underflow if less than EDTL was returned
2013-06-01 07:57:31 -07:00
Ronnie Sahlberg
a16dd132db TESTS: Add a test and verify we dont get residuals for MODE SENSE 6 2013-05-30 22:01:25 -07:00
Ronnie Sahlberg
3766067328 TESTS: Add a simple test for MODESENSE6 that we can read it and we get at least 3 bydet of mode data (minimum size, header only) 2013-05-30 21:40:52 -07:00
Ronnie Sahlberg
dcb9504ec0 READ6, make the truncation from a potantial 9-bit value (0-256) to 8 bits
explicit by masking it with 0xff instead of relying on obscure truncation
rules.
2013-05-30 19:29:53 -07:00
Ronnie Sahlberg
5494580b4a TEST: READ6 add a test to verify that READ6 with transferlength
gets 256 blocks of data back from the target.
2013-05-30 19:16:57 -07:00
Ronnie Sahlberg
5713c2d363 TESTS: Initialize is_usb or else it will be very seldom that is_usb==0 and thus we dont truncate the transferlengths 2013-05-30 19:04:58 -07:00
Ronnie Sahlberg
b95f44a4ff Type: print correct sizes we test for for std inquiry page 2013-05-29 19:26:11 -07:00
Ronnie Sahlberg
c9a01c4c1f TESTS: For the inquiry test for whether a target only looks at the low
order byte of the two byte transfer length field or not.
Since the maximum size of a std vpd page takes 260 bytes to transfer
and some targets send this much,  testing and comparing the returned buffer
between allocation length == 255 and == 256 doesnt work.
Instead change test to verify that allocation length 511 and 512 returns the same amount and content of data.

This test then still allows finding targets that only look at the low order byte
(which is 0xff for 511   but is 0 for 512)
2013-05-29 19:21:39 -07:00
Ronnie Sahlberg
b5a31571dc TESTS: Remove the READ6 0-blocks test.
Since you can not request a read for 0 blocks with READ6
this test makes no sense.
(transfer length ==0  means 256 blocks for READ6)
2013-05-29 19:05:39 -07:00
Bart Van Assche
7b011a5ee2 Fix scsi_cdb_read6()
The maximum number of blocks that can be transferred at once via a READ6
command is 256 instead of 265.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
2013-05-29 18:56:27 -07:00
Bart Van Assche
9dce01bbea Fix PERSISTENT RESERVE IN / READ RESERVATION response unmarshalling
The code that verifies the pr_type response must compare only the
lower four bits of byte 21 of the response ("TYPE") and must ignore
the upper four bits ("SCOPE").

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
2013-05-29 18:56:00 -07:00
Bart Van Assche
0577fa9d66 Fix a buffer overflow in the code for unmarshalling the, PERSISTENT RESERVE IN / READ RESERVATION
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>
2013-05-29 18:55:02 -07:00
Bart Van Assche
8da8cf8c4c Fix block limit tests
The tests currently verify whether two block limits are above 2**20. Change
these tests into <= 2**20.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
2013-05-29 18:52:21 -07:00
Ronnie Sahlberg
99a74310a2 Block Device Characteristics: Add decode of the rest of this page that was missing 2013-05-27 08:28:26 -07:00
Ronnie Sahlberg
10d101cf51 TESTS: Try reading the BlockDeviceCharacteristics VPD page on startup 2013-05-26 19:53:27 -07:00
Ronnie Sahlberg
b193e08be8 Tests: Update the SANITIZE tests 2013-05-26 19:36:35 -07:00
Ronnie Sahlberg
58dde352f1 Update SANITIZE OVERWRITE tests, test one block/half block and 4 byte
initialization pattern.
2013-05-26 15:51:46 -07:00
Ronnie Sahlberg
1c832923c8 Add test that all undefined SANITIZE service actions return an error. 2013-05-26 15:30:26 -07:00
Ronnie Sahlberg
4e08d27031 Add tests from SANITIZE OVERWRITE parameter length 2013-05-26 15:21:43 -07:00
Ronnie Sahlberg
e5e8d7e3ef TESTS: Add a simple test for SANITIZE OVERWRITE 2013-05-26 11:48:45 -07:00
Ronnie Sahlberg
92b987de52 Add helpers for the SANITIZE service actions 2013-05-26 10:51:19 -07:00
Ronnie Sahlberg
eebd04e613 Add initial support for SANITIZE and a simple test to generate this opcode. 2013-05-25 16:02:02 -07:00
Ronnie Sahlberg
28cc715a7c TEST: INQUIRY, request 260 bytes of data when reading the standard VPD page.
This is the maximum possible size of this page.

Previouslly we only read the arbitrary 255 bytes of page, but for targets
that return >255 bytes of data this would then incorrectly make the test fail
since the data-in buffer was truncated and thus the inq->additional_length
no longer matched up with the datain buffer size.

Now reading up to 260 bytes will avoid the datain buffer from ever becomming truncated, and as a second feature also make sure to test that the target
understands > 8-bit values for the allocation length in the request.
2013-05-25 06:53:48 -07:00
Ronnie Sahlberg
fcbeb2858f REPORT_SUPPORTED_OPCODES, serviceaction is a 16 bit integer at offset 4, not a 32 bit integer 2013-05-19 09:47:45 -07:00
Ronnie Sahlberg
ec5855c6b2 fix incorrect check in test 2013-05-19 08:42:10 -07:00
Ronnie Sahlberg
4df179bfd4 TESTS: Add checks for CDB sanity to REPORT SUPPORTED OPCODES
Read all individual opcodes and check that CDB length > 0  and that
CDB[0] Usage Data is 0xFF
2013-05-19 08:18:09 -07:00
Ronnie Sahlberg
c9ee8525b2 TESTS: Add a test for the reprot one command reporting options for
REPORT SUPPORTED OPCODES.

Opcodes that are listed in the full list of all supported opcodes as taking
a service action should work to ask reporting option 2 (uses service action)
from  but fail when asked for option 1 (no service action)

Similarly, opcodes that are flagged as not taking a service action should
work when used with option 1 but fail with option 2.
2013-05-19 07:27:33 -07:00
Ronnie Sahlberg
d7acb5f128 remove extraneous and incorrect log message from a test 2013-05-18 16:34:08 -07:00
Ronnie Sahlberg
2753878cd3 TEST: REPORT SUPPORTED OPCODES, SERVACTV
When this flag is clear then service action must be zero.
2013-05-18 16:31:16 -07:00
Ronnie Sahlberg
d34e28dc1a TESTS: Improve the REPORT SUPPORTED OPCODES test for RCTD and also verify that
the returned timeout descriptors have the correct length.
2013-05-18 14:00:25 -07:00
Ronnie Sahlberg
709410b1d7 TESTS: Add some REPORT SUPPORTED OPCODES tests
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
2013-05-18 13:56:02 -07:00
Ronnie Sahlberg
ce4623b2fb READ SUPPORTED OPCODES. Update the signature to allow setting all of the
parameters to this command.
2013-05-18 12:34:03 -07:00