Commit Graph

1335 Commits

Author SHA1 Message Date
Arne Redlich 6819637ddc T0401_inquiry_alloclen: fix compiler warnings
Remove unused variables and mark unused parameter as such.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-10-31 15:59:42 +01:00
Arne Redlich e991146902 T0241_prefetch10_flags: remove unused variable
Pointed out by gcc: num_blocks is set but unused

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-10-31 15:58:31 +01:00
Arne Redlich 1be5fe1bda T0251_prefetch16_flags: remove unused variable
gcc points out that num_blocks is set but never used

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-10-31 15:55:52 +01:00
Arne Redlich d983cdfc2c T0161_readcapacity16_alloclen: remove unused variable
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-10-31 15:54:33 +01:00
Arne Redlich 34b25f94c1 0122_read6_invalid.c: add missing include
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-10-31 15:53:08 +01:00
Arne Redlich 45ce1537f2 T0400_inquiry_basic: fix compiler warnings
gcc complains about an unused parameter (mark it as such) and unused labels
(remove 'em).

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-10-31 15:52:11 +01:00
Arne Redlich 311a63c61d T0401_inquiry_alloclen: remove unused label
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-10-31 15:50:59 +01:00
Arne Redlich 4d27ecae32 test-tool: fix initiatorname and initiatorname2 issues
gcc-4.6.3 warned about this one on several occasions:
  gcc -DHAVE_CONFIG_H -I.  -I. -I./include "-D_U_=__attribute__((unused))" -I./test-tool  -Wall -W -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-align -Wwrite-strings -ggdb3 -O0 -MT test-tool/bin_iscsi_test-0000_testunitready_simple.o -MD -MP -MF test-tool/.deps/bin_iscsi_test-0000_testunitready_simple.Tpo -c -o test-tool/bin_iscsi_test-0000_testunitready_simple.o `test -f 'test-tool/0000_testunitready_simple.c' || echo './'`test-tool/0000_testunitready_simple.c
  test-tool/0000_testunitready_simple.c: In function 'T0000_testunitready_simple':
  test-tool/0000_testunitready_simple.c:23:44: warning: declaration of 'initiator' shadows a global declaration [-Wshadow]
  test-tool/iscsi-test.h:20:20: warning: shadowed declaration is here [-Wshadow]

For now the global initiator is renamed to initiatorname1 (and initiator2 is
renamed to initiatorname2, respectively), but ultimately the globals should
probably go away.

While fixing this it also became apparent that initiator-name-2 was parsed
into the "initiator" variable as well.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-10-31 15:32:18 +01:00
Arne Redlich 3af45f5867 testunitready_simple: fix compiler warnings
The compiler complains about an unused label and and unused
variable.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-10-31 15:19:55 +01:00
Arne Redlich 558ad00038 iscsi_service_reconnect_if_loggedin: fix compiler warning and make it static
Quoth gcc-4.6.3:
  libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I. -I./include "-D_U_=__attribute__((unused))" -Wall -W -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-align -Wwrite-strings -g -O2 -MT lib/socket.lo -MD -MP -MF lib/.deps/socket.Tpo -c lib/socket.c  -fPIC -DPIC -o lib/.libs/socket.o
  lib/socket.c:445:1: warning: 'inline' is not at beginning of declaration [-Wold-style-declaration]

Fix this and make it a static function.
Also remove trailing whitespace from this file while at it.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-10-31 14:39:51 +01:00
Arne Redlich b910efa7c5 iscsi_parse_url: fix spurious compiler warnings
gcc-4.6.3 reports these:
  libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I. -I./include "-D_U_=__attribute__((unused))" -Wall -W -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-align -Wwrite-strings -g -O2 -MT lib/init.lo -MD -MP -MF lib/.deps/init.Tpo -c lib/init.c  -fPIC -DPIC -o lib/.libs/init.o
  lib/init.c: In function 'iscsi_parse_url':
  lib/init.c:410:18: warning: 'l' may be used uninitialized in this function [-Wuninitialized]
  lib/init.c:409:10: warning: 'target' may be used uninitialized in this function [-Wuninitialized]

Both warnings appear to be spurious though, as both "target" and "l" are only used if
"full" is set, which implies that these are initialized before.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-10-31 14:34:30 +01:00
Ronnie Sahlberg 6507f4050f Merge pull request #31 from plieven/master
memory leak fixes + suggestion for iscsi context + qemu-kvm bug
2012-10-30 18:54:38 -07:00
Ronnie Sahlberg 1d56c2f970 Merge pull request #33 from jongrimm/master
Skip test for read supported ops, rather than failure
2012-10-30 18:50:48 -07:00
Ronnie Sahlberg 9e9c6946c0 TESTS: Add a test that a target handles an unsolicited DATA-OUT correctly.
Send a large number of DATA-OUT PDUs that do not have a matching SCSI-COMMAND
PDU and verify that the target responds correctly. Either by terminating the
session or by just ignoring the data.

Verify also that the target is not "surprised" and crashes.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2012-10-30 18:44:35 -07:00
Ronnie Sahlberg 48d5ab9f39 Fix typo
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2012-10-30 18:33:58 -07:00
Peter Lieven 1d348de71f INIT fix typo in iscsi_parse_url() 2012-10-30 21:00:46 +01:00
Peter Lieven a9257d52a7 CONNECT only read/write from sockets when connection is established
qemu-kvm/qemu-img starts in+out polls from the socket before the connection is
established. This leads to a hang if the connection cant be established
(i.e. the target is down when qemu-kvm is started).

before:
LIBISCSI_DEBUG=2 qemu-img convert -f iscsi -O raw iscsi://127.0.0.1/iqn.2004-04.com.qnap:ts-809u:iscsi.lieven20.c53dac/0 /dev/null
libiscsi: connecting to portal 127.0.0.1 [iqn.2004-04.com.qnap:ts-809u:iscsi.lieven20.c53dac]
libiscsi: read from socket failed, errno:111 [iqn.2004-04.com.qnap:ts-809u:iscsi.lieven20.c53dac]
libiscsi: connection to 127.0.0.1 established [iqn.2004-04.com.qnap:ts-809u:iscsi.lieven20.c53dac]
->success!!

after:
LIBISCSI_DEBUG=1 qemu-img convert -f iscsi -O raw iscsi://127.0.0.1/iqn.2004-04.com.qnap:ts-809u:iscsi.lieven20.c53dac/0 /dev/null
libiscsi: iscsi_service: socket error Connection refused(111) while connecting. [iqn.2004-04.com.qnap:ts-809u:iscsi.lieven20.c53dac]
libiscsi: Failed to connect to iSCSI socket. iscsi_service: socket error Connection refused(111) while connecting. [iqn.2004-04.com.qnap:ts-809u:iscsi.lieven20.c53dac]
qemu-img: iSCSI: Failed to connect to LUN : Failed to connect to iSCSI socket. iscsi_service: socket error Connection refused(111) while connecting.
qemu-img: Could not open 'iscsi://127.0.0.1/iqn.2004-04.com.qnap:ts-809u:iscsi.lieven20.c53dac/0': Invalid argument
qemu-img: Could not open 'iscsi://127.0.0.1/iqn.2004-04.com.qnap:ts-809u:iscsi.lieven20.c53dac/0'
2012-10-30 17:22:39 +01:00
Peter Lieven a0fb2d179d ERROR fix error string creation
At some points in the code the error string includes itself. This
generates self-repeating error messages.
2012-10-30 16:38:09 +01:00
Peter Lieven 820410526e INIT fix missing export of iscsi_set_tcp_syncnt() 2012-10-30 12:05:25 +01:00
Peter Lieven ef3b6fe911 INIT fix url parsing error message 2012-10-30 12:02:09 +01:00
Peter Lieven ca6f28437a INIT remove redundant url parsing code 2012-10-30 11:56:12 +01:00
Peter Lieven 9f82d0bf83 INIT allow a trailing / in iscsi_parse_portal_url() 2012-10-30 11:47:12 +01:00
Peter Lieven 774ede1f46 ISCSI_URL change strings from dynamic to static 2012-10-30 11:41:51 +01:00
Peter Lieven e10a5a97be Merge remote-tracking branch 'jongrimm/master' 2012-10-30 11:09:38 +01:00
Jon Grimm f97cd4f816 Test: 0430_report_all_supported_ops: BUG: Need to set return_timeouts parm again after I know full_size. 2012-10-29 18:07:15 -05:00
Peter Lieven d989474a36 ISCSI-TEST free strings malloc'ed by libpopt 2012-10-29 22:07:58 +01:00
Peter Lieven 2e30d7aafb CONNECT correctly free ct in case first testunitready fails 2012-10-29 21:37:39 +01:00
Jon Grimm 9f5a315e0c TEST: skip optional return op codes if not supported. 2012-10-29 10:55:02 -05:00
Peter Lieven 923b9a4fb2 ISCSI-CONTEXT change dynamic string allocations to statics 2012-10-27 17:23:40 +02:00
Peter Lieven 0906109d8a CONNECT fix mem leak of connection_task object 2012-10-27 16:31:56 +02:00
Peter Lieven 83ac22abbb Fix memleaks in iscsi-ls, iscsi-inq & iscsi-readcapacity16 2012-10-27 16:18:50 +02:00
Ronnie Sahlberg 74f09ade13 Merge pull request #30 from plieven/master
debug level explaination, small improvement to iscsi-readcapacity16 and bounds check for data_size in socket_receive
2012-10-26 18:32:12 -07:00
Peter Lieven 4785dd9933 CONNECT do not reseed RNG in iscsi_reconnect 2012-10-26 20:47:35 +02:00
Peter Lieven 0b4424cca0 CONNECT Fix memory leak in iscsi_reconnect 2012-10-26 20:47:15 +02:00
Peter Lieven 48e55669e3 SLIST add function to debug length 2012-10-26 18:10:26 +02:00
Peter Lieven 89e918e9d7 SOCKET validate data_size in in_pdu header 2012-10-26 17:12:07 +02:00
Peter Lieven 4e7bd8767b DPRINTF explain debug levels 2012-10-26 08:43:47 +02:00
Peter Lieven 2df2f4f12e ISCSI_READCAPACITY16 add switch to print only target size 2012-10-26 08:39:37 +02:00
Ronnie Sahlberg 1132e4f941 ISCSI_READCAPACITY16 : Update the output to show all fields in the returned data
not just the total size of the device.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2012-10-25 19:24:09 -07:00
Ronnie Sahlberg 2c7da101b3 Merge pull request #29 from jongrimm/master
Adding MaintenanceIn: Read Supported Opcodes

Good stuff!

This opcode is optional,  so instead of flagging a test failure,  if the opcode returns sense that the opcode is missing then it should just return 'SKIPPED'

Something like
	if (task->status == SCSI_STATUS_CHECK_CONDITION
	    && task->sense.key == SCSI_SENSE_ILLEGAL_REQUEST 
	    && task->sense.ascq == SCSI_SENSE_ASCQ_INVALID_OPERATION_CODE) {		
		printf("[SKIPPED]\n");
		printf("READSUPPORTEDOPCODES Not Supported\n");
		ret = -2;
		scsi_free_scsi_task(task);
		goto finished;
	}
2012-10-25 18:21:12 -07:00
Jon Grimm 8fbc536779 TYPO: 'calculate' in comments 2012-10-25 12:59:55 -05:00
Jon Grimm b81bdd3932 Merge with upstream 2012-10-25 12:56:26 -05:00
Jon Grimm 1eaca70a52 Add MaintenanceIn: Report Supported Opcodes (all) and testcase. 2012-10-25 12:48:37 -05:00
Ronnie Sahlberg 9eb5b96a82 Merge pull request #28 from plieven/master
TEST suite fix + skip command
2012-10-25 06:43:46 -07:00
Peter Lieven 03528f3965 TEST: add skip command to skip individual tests
This patch adds a command to skip individual tests. It additionally accepts
more than one test separated by comma.
2012-10-25 10:27:09 +02:00
Peter Lieven 49947fe5e2 TEST: fix unitialized ret variable in T0000 2012-10-25 09:41:28 +02:00
Ronnie Sahlberg b700d44f03 TESTS: Add a simple test to check that a target survives huge imemdiate data
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2012-10-24 21:19:27 -07:00
Ronnie Sahlberg 97dcf94d72 iSCSI: when reconnecting we should not automatically requeue any DATA-OUT PDUs
Dont requeue data-out pdus, or other pdus with the DELETE_WHEN_SENT flag, such
as nops.
These, like the DATA-OUT pdu will instead be automatically re-sent when the original write command is sent again.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2012-10-24 19:32:00 -07:00
Ronnie Sahlberg a24aca8c50 Merge pull request #27 from plieven/master
small fixes + iscsi-readcapacity16 binary
2012-10-24 19:02:31 -07:00
Peter Lieven 2427926327 ISCSI-READCAPACITY16 modified copyright notice 2012-10-23 17:17:53 +02:00