Commit Graph

2070 Commits

Author SHA1 Message Date
Li Feng
97d2f681d7 iscsi-support: fix memory leak
If doesn't support the report_supported_opcodes, the task will not be
freed in REPORT_SUPPORTED_OPCODES.

Change-Id: I1e251eec518721fb35e51013621aa61865d4b46b
Signed-off-by: Li Feng <fengli@smartx.com>
2021-09-30 19:54:08 -07:00
Bart Van Assche
d592e2e01e Merge pull request #364 from tianrenz2/fix-dist-make
Add some files into the dist tarball necessary for rpm generation
2021-09-12 15:06:42 -07:00
Tianren Zhang
2b8905b4f9 add README.md to dist tarball
README is required in rpm spec, but not included into the dist
tarball
2021-09-12 03:44:23 -04:00
Tianren Zhang
e31fe70fb5 add libiscsi.syms.in to dist tarball
libiscsi.syms.in is required for 'make libiscsi.syms'
2021-09-12 03:30:51 -04:00
Bart Van Assche
b781b21d50 test-tool, xcopy: Fix target descriptor handling
Fail the XCOPY tests if no appropriate target descriptor is available
instead of causing memory corruption or truncating the descriptor.
2021-09-05 20:00:02 -07:00
Bart Van Assche
aa214feaf3 iser: Fix a compiler warning triggered by the container_of() definition
This patch fixes the following compiler warning:

iser.c:338:14: error: cast from 'uint8_t *' (aka 'unsigned char *') to 'struct iser_pdu *' increases required alignment from 1 to 8 [-Werror,-Wcast-align]
                iser_pdu = container_of(pdu, struct iser_pdu, iscsi_pdu);
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2021-09-05 20:00:02 -07:00
Bart Van Assche
5cbbc95c20 configure: Remove -Wno-strict-aliasing
Using -Wno-strict-aliasing is almost always wrong. If any code would be
introduced in the future that violates the strict aliasing rules, please
use -fno-strict-aliasing instead.
2021-09-05 20:00:02 -07:00
Bart Van Assche
3f9735b3a4 slist: Clean up the slist.h header file
Fix indentation, align backslashes, surround multiline macros with
do { } while (0) and remove the unused ISCSI_LIST_LENGTH() macro.
2021-09-05 20:00:02 -07:00
Li Feng
6b93325b39 slist: Make this header file compatible with C++
C++ requires explicit conversions from a void to a non-void pointer.

Signed-off-by: Li Feng <fengli@smartx.com>
[ bvanassche: edited commit message, removed casts and changed the declaration
  type ]
2021-09-05 20:00:02 -07:00
Bart Van Assche
c412ae0e1d scsi-lowlevel.h: Include <assert.h>
Checking whether static_assert() is defined must happen after <assert.h> has
been included. Hence include <assert.h>.
2021-09-05 20:00:02 -07:00
Simon Rowe
35dcf89599 examples/iscsi-dd: use stderr for all error text
Signed-off-by: Simon Rowe <simon.rowe@nutanix.com>
2021-09-05 20:00:02 -07:00
Simon Rowe
b3a30d995e examples/iscsi-dd: fix typos
Signed-off-by: Simon Rowe <simon.rowe@nutanix.com>
2021-09-05 20:00:02 -07:00
Bart Van Assche
d7bdd9690e ci: Add a github build action 2021-09-05 20:00:02 -07:00
Bart Van Assche
7d3d6f6242 Merge pull request #359 from ddiss/xcopy_large_fix_skip
test: fix ExtendedCopy.Large SKIPPED cases
2021-07-29 14:31:42 -07:00
David Disseldorp
73d541b00b test: fix ExtendedCopy.Large SKIPPED cases
CU_PASS() needs to be coupled with a return to actually skip the test.
Similarly, the CU_PASS message isn't printed, so a logging() call is
also needed here.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2021-07-29 17:39:39 +02:00
Bart Van Assche
3c977c573a Merge pull request #358 from zippy2/pkg_config_fixup
configure.ac: Quote argument to m4_esyscmd() properly
2021-07-27 08:03:41 -07:00
Michal Privoznik
07464ec0a3 configure.ac: Quote argument to m4_esyscmd() properly
In one of recent commits the argument passed to m4_esyscmd()
macro was switched to its unescaped version. This is not correct
because package version is then defined as "Version 1.19.0"
instead of just "1.19.0".

Fixes: cb4489776b
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2021-07-27 09:21:07 +02:00
Bart Van Assche
696ac1e948 Merge pull request #353 from Ser01x/master
Before running the SCSI.ReceiveCopyResults.CopyStatus test we should check that it is supported
2021-07-26 20:34:19 -07:00
Ser01x
e8c15866fa Fixed several code style problems 2021-07-26 09:24:54 +00:00
Ser01x
053c6db9e1 test-tool: check that ReceiveCopyResults is implemented
We check that the RECEIVE COPY STATUS(LID1) command is supported
by SCSI device before sending it.
2021-07-21 16:37:57 +00:00
Ser01x
1c3e2083c9 lib: init version for 8Fh VPD page
The third-party copy (8Fh) VPD page helps to check the capabilities
supported by the copy manager.
2021-07-21 16:28:16 +00:00
Bart Van Assche
2a65548f22 ci: Enable MinGW 2021-07-18 20:13:03 -07:00
Bart Van Assche
5e6f6ec5ed MinGW: Second step of porting to MinGW 2021-07-18 20:13:03 -07:00
Bart Van Assche
16f817bfba configure.ac: Use AC_CONFIG_HEADERS() instead of AC_CONFIG_HEADER()
AC_CONFIG_HEADER() is obsolete since autoconf 2.70.
2021-07-18 20:10:08 -07:00
Bart Van Assche
fddacc0600 lib/libiscsi.syms: Sort alphabetically 2021-07-17 21:34:46 -07:00
Bart Van Assche
8b4670db3e ci: First phase of adding MingW support 2021-07-17 21:06:19 -07:00
Bart Van Assche
cb4489776b configure.ac: Run autoupdate 2021-07-17 20:59:53 -07:00
Bart Van Assche
1e545eedb2 README.md: Update
Change the reference to the 'src' directory into a reference to the 'utils'
directory since commit c07779cfa7 ("AUTOTOOLS: Add a Makefile.am for the
iscsi-* utilities") renamed the 'src' directory into 'utils'.

Document the purpose of the test-tool directory.

Fix the link to the release tarballs.
2021-07-17 19:35:18 -07:00
Bart Van Assche
c9fd0743bc README: Rename into README.md
Additionally, restrict the contents of README.md to 80 columns.
2021-07-17 19:35:17 -07:00
Bart Van Assche
b446ab3188 ci: Switch from Travis to AppVeyor
Since June 15th, 2021, the building on travis-ci.org is ceased. Hence switch
to AppVeyor.
2021-07-16 21:31:50 -07:00
Bart Van Assche
c49461e4b7 test-tool: Do not use empty initializers
Empty initializers are a GNU extension that is not supported by older
versions of gcc.

Fixes: https://github.com/sahlberg/libiscsi/issues/356
2021-06-24 20:07:54 -07:00
Bart Van Assche
70759869ff Port to MinGW
Compile-tested only.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
2021-05-23 13:23:52 -07:00
Bart Van Assche
ca9c585ef6 win32/win32_compat.c: Reformat this file
This file has been reformatted with clang-format --style=file and the Linux
kernel .clang-format style file.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
2021-05-23 13:23:52 -07:00
Bart Van Assche
2a5a0b3291 Enable -Wno-unused-parameter
Instead of adding __attribute__((unused)) to unused arguments, add the
-Wno-unused-parameter compiler flag.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
2021-05-23 13:23:41 -07:00
Bart Van Assche
ea6b2282d4 Use __attribute__((format(printf, ...))) directly
Instead of defining the macro _R_(), define __attribute__() as a macro for
compilers that do not support __attribute__(), namely Microsoft Visual
Studio.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
2021-05-23 11:52:40 -07:00
Bart Van Assche
4ea2bc6acb Merge pull request #352 from orbea/automake
Makefile.am improvements
2021-05-23 09:22:07 -07:00
orbea
c437afa825 build: Add -no-undefined where missing
Signed-off-by: orbea <orbea@riseup.net>
2021-05-22 19:32:12 -07:00
orbea
9649fe1ddc build: Correct usage of LIBADD and LDADD
Signed-off-by: orbea <orbea@riseup.net>
2021-05-22 19:31:52 -07:00
orbea
c547d2dc7f build: Remove bogus LDADD variables
Signed-off-by: orbea <orbea@riseup.net>
2021-05-22 19:31:50 -07:00
Bart Van Assche
4072e608c1 Merge pull request #351 from concatime/patch-1
Include header <strings.h> for strncasecmp()
2021-05-03 07:56:00 -07:00
Issam Maghni
d08547f38a Add header <strings.h> for strncasecmp 2021-05-03 03:45:44 +00:00
Bart Van Assche
f87a5adaa0 test-tool: Change command_is_implemented from a global variable into an argument
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
2021-02-08 19:01:31 -08:00
Bart Van Assche
c7a9f51d23 test-tool: Move a logging statement into write_residuals_test()
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
2021-02-08 17:55:19 -08:00
Bart Van Assche
a21065cf71 test-tool: Add default clauses in recently modified switch statements
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
2021-02-08 17:50:46 -08:00
Bart Van Assche
0c304f0c3c test-tool, residuals: Rename struct residuals_test_data members
Bring the names of these struture members closer to the names used in the
SCSI and iSCSI standards.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
2021-02-08 17:50:38 -08:00
Bart Van Assche
88a46a03d3 Merge pull request #345 from nastya-nizharadze/residuals-tests-fix2
Improve WriteResidual tests
2021-02-08 17:13:11 -08:00
Anastasia Kovaleva
1b7d1743ae test-tool: Add overwrite check for all test cases
Check if the residual data does not owerwrite existing data blocks has now
been added for all testing data to improve the uniformity of test runs,
increase test readability and remove the duplicate testing data records.
2021-02-08 15:28:26 +03:00
Anastasia Kovaleva
e9bf7c2d05 test-tool: Change write residuals tests overwrite check according to FCP-4
According to FCP-4 there are several possibilities for target to react on
incorrect data length field value in CDB:

a) process the command normally except that data beyond the FCP_DL count
shall not be requested or transferred;

b) transfer no data and return CHECK CONDITION status with the sense key
set to ILLEGAL REQUEST and the additional sense code set to
INVALID FIELD IN COMMAND INFORMATION UNIT;

Add check to support the second one and accept no data write.
2021-02-08 15:23:55 +03:00
Anastasia Kovaleva
2e8c571955 test-tool: Refactoring residuals write tests
Looking at test_write10_residuals.c, test_write12_residuals.c and
test_write16_residuals.c tests the similarity of the testing scenario
can be found. There are several EDTL and SPDTL combinations which are
the same for different length write command tests. They form the core
of testing scenario of these commands. There aren't so much differences
in the way of testing these combinations itself either. It is possible
to move the main parameters describing the testing scenario into a
separate structure and move the scenario itself into a separate function.
It will increase the readability and reduce the duplicate code of these tests.
2021-02-08 15:23:49 +03:00
Anastasia Kovaleva
34fd477ede test-tool: Allow CHECK CONDITION in response to overflow/underflow
According to the RFC 7143 11.4.5.1:
"Targets may set the residual count,and initiators may use
 it when the response code is Command Completed at Target (even if the
 status returned is not GOOD)."

Therefore valid retuned status may be not only GOOD. Also this check:
task->sense.ascq == SCSI_SENSE_ASCQ_INVALID_FIELD_IN_INFORMATION_UNIT
would make Underflow/Overflow response universal for FC/ISCSI.
2021-02-02 11:46:27 +03:00