205 Commits

Author SHA1 Message Date
Gleb Chesnokov
828940842a iscsi-scst/usr/iscsi_adm.c: Fix use of uninitialized struct field
This patch fixes the following Coverity complaint:

    CID 271601 (#1 of 1): Uninitialized scalar variable (UNINIT)
    uninit_use_in_call: Using uninitialized value req.
    Field req.cid is uninitialized when calling iscsid_request.
2022-06-27 14:14:52 +03:00
Gleb Chesnokov
a1ded333e8 scst: Replace zero-length arrays with flexible-array members
There is a regular need in the kernel to provide a way to declare
having a dynamically sized set of trailing elements in a structure.
Kernel code should always use “flexible array members”[1] for these
cases. The older style of one-element or zero-length arrays should
no longer be used[2].

This code was transformed with the help of Coccinelle:
($ spatch --jobs $(getconf _NPROCESSORS_ONLN) --sp-file script.cocci --include-headers --dir . > output.patch)

@@
identifier S, member, array;
type T1, T2;
@@

struct S {
  ...
  T1 member;
  T2 array[
- 0
  ];
};

[1] https://en.wikipedia.org/wiki/Flexible_array_member
[2] https://www.kernel.org/doc/html/v5.16/process/deprecated.html#zero-length-and-one-element-arrays

Link: https://github.com/KSPP/linux/issues/78
2022-04-03 14:44:17 +03:00
Gleb Chesnokov
84f48fe6a6 iscsi-scstd: Allow to specify multiple addresses the server should listen on
Add the opportunity to globally specify multiple addresses, which
iSCSI/iSER portal will listen on.

There is a way to specify the addresses for a target, on which
portals it will be available, using the allowed_portal parameter.

There is also a way to set this globally via the iscsi-scstd
--address parameter. The problem is that the last option allows
you to specify only one local address. So extend this functionality
to specify more then one address.

Also increase the maximum number of listening addresses to 32.

Signed-off-by: Aleksandr Dyadyushkin <alextalker@ya.ru>
2022-03-01 19:54:53 +03:00
Bart Van Assche
af9504a0f5 iscsi-scst/usr/Makefile: Use -Werror when testing a compiler option
This is necessary for clang.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9430 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2021-05-29 01:16:42 +00:00
Bart Van Assche
a4ea5c02e1 iscsi-scst: Fix SHA-1 algorithm number
According to
https://www.iana.org/assignments/ppp-numbers/ppp-numbers.xml#ppp-numbers-9
the value of the SHA-1 algorithm is 6 and not 7, as it is now in
iscsi-scst/usr/chap.c. If on a client side node.session.auth.chap_algs is
SHA1, login fails.

Signed-off-by: Lev Vainblat <lev@zadarastorage.com>


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9171 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-10-14 02:15:33 +00:00
Bart Van Assche
c647d76ef2 Fix compiler warnings triggered by building against the musl C library
See also https://github.com/bvanassche/scst/issues/23.

Reported-by: Lucian Cristian lucian.cristian@gmail.com


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9001 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-06-01 04:52:50 +00:00
Bart Van Assche
fda71c077d Include <poll.h> instead of <sys/poll.h>
According to the Single Unix Specification, the poll() function has been
declared in the <poll.h> header file. This makes the SCST code compatible
with the musl C library. See also https://en.wikipedia.org/wiki/Musl. See
also https://github.com/bvanassche/scst/issues/23.



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8992 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-31 03:41:17 +00:00
Bart Van Assche
75d059e9f0 iscsi-scstd: Fix a gcc 10 compiler warning
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8954 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-23 17:14:21 +00:00
Bart Van Assche
d12b0a0d91 Fix spelling in documentation and source code
See also https://github.com/bvanassche/scst/pull/20.

[ bvanassche: left out qla2x00t-32gbit changes and changed patch description ]



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8920 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-15 18:53:48 +00:00
Bart Van Assche
08ba5d8f1a iscsi-scst: Remove unnecessary %s format modifiers
See also https://github.com/bvanassche/scst/pull/18.

Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8903 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-05-12 14:57:00 +00:00
Bart Van Assche
69d90841b6 iscsi-scstd: Fix a memory leak in conn_free()
Signed-off-by: Lev Vainblat <lev@zadarastorage.com>


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8783 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2020-03-05 02:35:34 +00:00
Bart Van Assche
e945943861 iscsi-scst/usr: Improve coding style
This patch only affects code formatting and does not change any functionality.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8356 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2019-05-09 16:26:46 +00:00
Bart Van Assche
dc7e039124 Makefiles: Remove most instances of $(SCST_INC_DIR)
Move the $(SCST_INC_DIR) definitions from the out-of-tree sections into
the in-kernel sections. Since SCST is now distributed as a single tar
archive, only support in-tree builds with $(SCST_INC_DIR) and $(SCST_DIR).


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8079 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2019-03-25 22:10:21 +00:00
Bart Van Assche
08e532715d Remove procfs support
Since all RHEL/CentOS 5 users have upgraded to a newer version, procfs
support is no longer necessary. Hence remove procfs support. This patch
has been generated as follows:

git grep -lw CONFIG_SCST_PROC iscsi-scst qla2x00t scst scst_local srpt |\
  while read f; do
    echo ${f}
    unifdef -U CONFIG_SCST_PROC ${f} >${f}.out
    mv ${f}.out ${f}
  done

followed by two small manual edits in scst/include/scst.h and also in
qla2x00t/qla2x00-target/qla2x00t.c.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7999 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2019-03-02 20:04:25 +00:00
Bart Van Assche
c55eaa7d5e iscsi-scstd: Change the gcc-specific __FUNCTION__ into __func__
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7520 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2018-10-14 22:02:24 +00:00
Vladislav Bolkhovitin
f549829482 Copyrights updated
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7396 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2018-04-12 03:49:10 +00:00
Bart Van Assche
9153f57314 iscsi-scst/usr/Makefile: Pass -Wno-format-truncation if supported
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7257 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-11-12 05:01:16 +00:00
Bart Van Assche
642744c9fc Fix spelling of "Ardis Technologies"
Reference: http://www.ddpsan.com/support-sales/about-us.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7165 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-05-02 22:32:06 +00:00
Vladislav Bolkhovitin
68fa7e1a0d Copyright updates
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7146 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-04-22 03:19:52 +00:00
Vladislav Bolkhovitin
82f5ffd255 iscsi-scstd: daemon handle EOF (rc == 0) from nl_fd
Daemon now handles receipt of EOF (rc == 0) from nl_fd.  Probably this never
happens in a real kernel build, but it does during shutdown in a usermode build
and it seems like it is "generically correct" in either case.

Signed-off-by: David Butterfield <dab21774@gmail.com>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7140 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-04-21 01:04:16 +00:00
Vladislav Bolkhovitin
344387c40e iscsi-scstd: replace signal() with sigaction()
Replace signal() with sigaction() for validity in a multithreaded process

Signed-off-by: David Butterfield <dab21774@gmail.com>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7139 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-04-21 01:02:25 +00:00
Vladislav Bolkhovitin
74bee99f59 iscsi-scst: replace strncpy() by strlcpy()
Follow up for r7109: strlcpy() is more appropriate in this place.



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7134 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-04-18 03:57:12 +00:00
Vladislav Bolkhovitin
eaa99a8770 Fix a few minor "extra" compiler warnings (mostly "const" issues)
Add "XXX" comments in a few places about potential problems seen in SCST code,
for future investigation and possible repair.

Signed-off-by: David Butterfield <dab21774@gmail.com>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7123 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-04-14 01:03:25 +00:00
Vladislav Bolkhovitin
a2e0916fbf Fix a few compiler messages issued when some extra warnings are enabled:
casting const to non-const
    uninitialized structure members
    non-static local function
    missing enumerated switch-value cases

Signed-off-by: David Butterfield <dab21774@gmail.com>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7122 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-04-13 23:58:32 +00:00
Vladislav Bolkhovitin
bcb87d57ec iscsi: logging improvements for iscsi_scstd.c
Logging improvements for iscsi_scstd.c print more information about failures.

Signed-off-by: David Butterfield <dab21774@gmail.com>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7113 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-04-13 23:16:57 +00:00
Vladislav Bolkhovitin
b71fa76b5b iscsi: fix misleading error logging in config.c
This fixes four similar instances of a very misleading and confusing logging
statement, which would print a "Wrong value" that had already been corrected by
the check function.

Signed-off-by: David Butterfield <dab21774@gmail.com>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7112 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-04-13 23:15:17 +00:00
Vladislav Bolkhovitin
aa6c6a4c2f Change memcpy() to strncpy() because the source name string is not guaranteed
to exist as valid addressable memory beyond the NULL byte.

Signed-off-by: David Butterfield <dab21774@gmail.com>

with small addition to force set last byte NULL



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7109 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-04-13 22:38:38 +00:00
Vladislav Bolkhovitin
d236725cae create_and_open_dev() returns a (-errno), so the "if (iser_fd...)" check should
detect *any* negative return value as a case when fd should be set to -1.

Signed-off-by: David Butterfield <dab21774@gmail.com>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7108 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-04-13 22:30:25 +00:00
Bart Van Assche
e372a0123e scst: Coding style updates related to whitespace
This patch changes whitespace only and nothing else.



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7102 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2017-03-02 00:09:14 +00:00
Vladislav Bolkhovitin
0c2fd8e564 iscsi-scst: handle a case in target_del() where the target was already freed
target_del() calls handle_iscsi_events() which may recursively call target_del().
The 1st target_del() may resume its execution after the target object was already freed.

Signed-off-by: Erez Zilber <erezzi.list@gmail.com>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6908 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2016-07-02 01:42:49 +00:00
Bart Van Assche
3990a6ccd4 iscsi-scstd: Insert a blank line after declarations
Additionally, surround complex values with parentheses, declare static
char arrays const and change C++ comments into C comments.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6849 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2016-03-27 16:24:59 +00:00
Bart Van Assche
c477b5f99c iscsi-scstd: Fix more checkpatch complaints about whitespace
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6848 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2016-03-27 16:16:06 +00:00
Bart Van Assche
2681ed8bcb iscsi-scstd: Fix checkpatch complaints about whitespace
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6847 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2016-03-27 16:10:45 +00:00
Vladislav Bolkhovitin
fa2f54ac9e Copyrights updated
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6787 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2016-01-22 04:04:43 +00:00
Bart Van Assche
f92a917d45 iscsi-scst: Suppress strict aliasing compiler warnings
Avoid that the compiler reports warnings about strict aliasing when
building iscsi-scst on RHEL 6. This patch does not change any
functionality.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6414 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-07-10 22:22:57 +00:00
Bart Van Assche
11df045449 iscsiadm: Fix a resource leak in an error path
Detected by Coverity.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6389 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-06-17 00:32:53 +00:00
Bart Van Assche
bb0a7c894a iscsi-scstd: Annotate a fall-through for Coverity
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6388 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-06-17 00:32:27 +00:00
Bart Van Assche
476d0ba898 iscsi-scstd: Constify several function arguments
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6387 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-06-17 00:32:02 +00:00
Bart Van Assche
f05dfcf88f iscsi-scstd: Suppress a compiler warning
Avoid that gcc reports the following compiler warning:
    
message.c:197:44: warning: 'rsp_data_sz' may be used uninitialized in this function [-Wmaybe-uninitialized]


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6386 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-06-17 00:31:20 +00:00
Bart Van Assche
8a4e41fb44 iscsi-scstd: Allow the compiler to inline functions
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6385 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-06-17 00:30:40 +00:00
Bart Van Assche
a8da0107f8 iscsiadm: Fix a resource leak
Detected by Coverity.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6380 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-06-17 00:28:02 +00:00
Bart Van Assche
ad38432332 iscsiadm: Fix strerror() argument
Detected by Coverity.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6379 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-06-17 00:27:41 +00:00
Bart Van Assche
a14df39942 iscsiadm: Do not allocate more memory than needed
Detected by Coverity.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6378 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-06-17 00:27:18 +00:00
Bart Van Assche
ff2b660264 iscsiadm: Fix a file descriptor leak in an error path
Detected by Coverity.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6377 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-06-17 00:26:35 +00:00
Bart Van Assche
f5f85b95fb iscsi-scstd: Fix a resource leak in an error path
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6376 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-06-17 00:26:08 +00:00
Bart Van Assche
a6121b03c8 iscsi-scstd: Fix a potential file descriptor leak
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6375 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-06-17 00:25:42 +00:00
Bart Van Assche
74b4104994 iscsi-scstd: Avoid that Coverity complains about a use-after-free
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6374 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-06-17 00:25:05 +00:00
Bart Van Assche
b3f49a0a17 iscsi-scstd: Annotate fall-throughs for Coverity
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6373 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-06-17 00:24:25 +00:00
Bart Van Assche
102d8d54c9 iscsi-scstd: Move two local variables to suppress a Coverity complaint
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6372 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-06-17 00:24:03 +00:00
Bart Van Assche
41caee3148 iscsi-scstd: Fix a file descriptor leak in an error path
Detected by Coverity.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6371 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2015-06-17 00:23:38 +00:00