74 Commits

Author SHA1 Message Date
David Disseldorp
114bbf00e1 configure: fix bogus TEST_CHAP_BASE64 conditional
The conditional should be checking for gnutls presence.

On openSUSE Tumbleweed without gnutls this gives me:
  > ./test-tool/iscsi-test-cu --list|grep -i chap
  ALL.iSCSICHAP
  ALL.iSCSICHAP.Simple
  ALL.iSCSICHAP.Invalid
  iSCSI.iSCSICHAP
  iSCSI.iSCSICHAP.Simple
  iSCSI.iSCSICHAP.Invalid

Install gnutls, rebuild and check for base64 test presence:
  > sudo zypper in gnutls-devel

  > git clean -fxd .
  <rebuild>

  > ./test-tool/iscsi-test-cu --list|grep -i chap
  ALL.iSCSICHAP
  ALL.iSCSICHAP.Simple
  ALL.iSCSICHAP.Invalid
  ALL.iSCSICHAP.Base64
  ALL.iSCSICHAP.Base64Oversize
  iSCSI.iSCSICHAP
  iSCSI.iSCSICHAP.Simple
  iSCSI.iSCSICHAP.Invalid
  iSCSI.iSCSICHAP.Base64
  iSCSI.iSCSICHAP.Base64Oversize

Signed-off-by: David Disseldorp <ddiss@suse.de>
2026-05-22 18:40:50 +10:00
David Disseldorp
311548e860 test-tool: add iSCSICHAP.Base64 test
Some targets such as LIO support base64 encoded CHAP_R values. Test this
by intercepting hex-encoded CHAP_R responses and converting the value to
base64.
This will fail on targets which don't support base64; we should probably
skip the test instead.
base64 encoding is performed using the gnutls_base64_encode2() function,
so the test is only present for gnutls-enabled builds.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2026-05-21 21:53:43 +10:00
Brad Smith
c74b6e71ce Add detection for function pthread_threadid_np for macOS
Fix #443
2026-03-22 19:11:59 -04:00
Brad Smith
9ab0fa8793 Fix linking of libiscsi to libpthread
libiscsi utilizes a bunch of POSIX threads functions but does
not link against libpthread as it should nor the pkg-config file
properly listing libpthread as a static link time dependency.
2026-03-22 18:57:44 -04:00
Ronnie Sahlberg
cb44ad4e26 Add multithreading helpers
Add an abstraction for mutexts and threads
that handles both pthread api and native win32 api

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2025-03-07 08:46:47 +10:00
Ronnie Sahlberg
f8542ab5cc Add checks if pthreads are available and enable HAVE_MULTITHREADING
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2025-03-07 07:04:17 +10:00
Paolo Bonzini
35fec3ea0e login: add support for gnutls
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2024-04-09 16:06:35 +02:00
Paolo Bonzini
380c16a82b configure: add --with-libgcrypt option
libgcrypt is a relatively large dependency that is used only for
the sake of computing MD5 in the CHAP authentication protocol.

Allow distributions to disable it forcibly and rely on the
embedded MD5 implementation.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2024-04-09 16:01:42 +02: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
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
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
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
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
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
zhenwei pi
6ed1ffb7b2 iser: support rdma ack timeout optimization
Since 2c1619edef61a03cb516efaa81750784c3071d10 for linux kernel and
55843c4ab8f559679d28c559cc4d681836be769b for rdma-core, rdma cma
supports RDMA_OPTION_ID_ACK_TIMEOUT. It's useful for RDMA out of
sequence case. Because this feature is added recently, we have to
check this in autogen.sh before building source code.

Depend on production enviroument, tunning rdma ack timeout could get
the best performance. Suggested by Bart and Ronnie, instead of using
a fixed timeout value, add two methods to set rdma ack timeout value.
1, add URL variable 'LIBISCSI_RDMA_ACK_TIMEOUT'. This could works
for a specified connection.
2, add env argument 'LIBISCSI_RDMA_ACK_TIMEOUT'. This works as a
common setting for all the connection of a process.

Test under different packet loss rate and different ack timeout, run
fio (iodepth=1) in a guest os, I got this result:
latency under packet loss rate 0.00001:
	timeout 19: avg 170.22, pct99.9 215
	timeout 10: avg 160.08, pct99.9 215
	timeout 8 : avg 146.39, pct99.9 177
	timeout 7 : avg 148.37, pct99.9 211

latency under packet loss rate 0.0001:
	timeout 19: avg 949.23, pct99.9 306
	timeout 10: avg 818.53, pct99.9 378
	timeout 8 : avg 615.84, pct99.9 189
	timeout 7 : avg 618.89, pct99.9 310

Base on this test report, setting ack timeout to 8(1048.576 usec) is
a good choice in my test enviroument.

Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2020-03-07 12:37:46 -08:00
Bart Van Assche
66e5af9422 configure.ac: Add -Wcast-qual
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
2020-02-28 21:54:49 -08:00
Ronnie Sahlberg
e6bcdf5fdb drop the LD_PRELOAD tool
I don't have time to maintain it. And it is just a toy anyway.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2020-02-12 15:21:03 +10:00
Bart Van Assche
9d2493248b Use dynamic memory allocation instead of variable-length arrays
Since it is easy to trigger a stack overflow with variable-length arrays,
use dynamic memory allocation instead of VLAs. Add -Wvla to the compiler
options such that no new VLAs get introduced.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
2019-11-09 13:39:34 -08:00
Yann E. MORIN
a8d54cc82d buildsys: add option to enable/disable building the examples
In a production system, the examples are not needed.

Add a configure option to disable building the examples.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
2018-12-04 10:47:34 +01:00
Yann E. MORIN
eec4954986 buildsys: add option to enable/disable build of test-tool
When doing a production system, the production environment has been
pre-validated (with this test-toll or by other means), so the teest-tool
is not needed in production.

Add a configure option to disable building test-tool.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
2018-12-04 09:27:32 +01:00
Yann E. MORIN
fb2e460df9 buildsys: add option to enable/disable building tests
When doing cross-compilation, the tests are meant to be run on the
target. However, they are currently not installed, so it does not make
sense to build tehm to start with.

Additionally, when doing a system for production, those tests are not
needed anyway.

Add a configure option to disable building the tests altogether.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
2018-12-04 09:27:32 +01:00
Yann E. MORIN
b8a28fad54 buildsys: handle ac_cv_cunit as a true cache-val
The ac_cv_-prefix variables are supposed to be settable from the command
line, à-la: ./configure ac_cv_foo=no

The canonical way of doing so is to use AC_CACHE_VAL() or AC_CACHE_CHECK().
The latter is to be preferred in our case, as it handles printing the
message for us.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
2018-12-04 09:27:30 +01:00
Paolo Bonzini
4728d4eaa6 do not warn for strncpy
strncpy use in iscsi_reconnect is just fine.  Do not warn for it, and
also do not warn if clang does not recognize the flag.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2018-10-04 14:06:39 +02:00
Ronnie Sahlberg
f750101980 Add initial visual studio project files and fix the win32 build
Win32 has been rotting for a while. This patch adds vs17 build files
as well as fixing up all build errors that have accumulated.
There are still build warnings but those can be addressed in a followup
patch.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-05-11 21:19:14 -07:00
Ronnie Sahlberg
0a1b96c383 Add configure checks for iSER support
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-06-03 18:54:38 -07:00
Bart Van Assche
cfac4c5d55 configure.ac: Fix RHEL 5 build
Avoid that building libiscsi on a RHEL 5 system fails as follows:

configure.ac:7: error: possibly undefined macro: AM_SILENT_RULES

Avoid that the following warning is printed when building on a RHEL 5
system:

examples/Makefile.am:24: Libtool library used but `LIBTOOL' is undefined
examples/Makefile.am:24:
examples/Makefile.am:24: The usual way to define `LIBTOOL' is to add `AC_PROG_LIBTOOL'
examples/Makefile.am:24: to `configure.ac' and run `aclocal' and `autoconf' again.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
2015-04-16 06:39:04 -07:00
Bart Van Assche
d13a85cd39 configure.ac: Suppress an autoconf warning
Avoid that autoconf prints the following warning if AM_PROG_AR
is not defined:

configure.ac:9: warning: macro `AM_PROG_AR' not found in library

See also commits 1deb4f8e4a, ace7f200fb, b9cf7e8cd2 and
6cdb47b9b4.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
2015-04-16 06:38:36 -07:00
Ronnie Sahlberg
e8a2296f94 Initial test branch for adding tests to libiscsi
These tests depends on not yet released version on TGTD to allow running
both TGTD and TGTADM as unprivileged users to set up and configure
targets to test against during make test.
Update TGTD to tip of master before running these tests.

See STGT mailinglist for patches.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-04-13 14:58:30 -07:00
Sitsofe Wheeler
7c6a3e4a0b iscsi-perf: Use gettimeofday if clock_gettime is unavailable
clock_gettime doesn't existing on OS X
(http://stackoverflow.com/questions/5167269/clock-gettime-alternative-in-mac-os-x
) so add an autoconf test to check if the platform has it and fall back
on gettimeofday if not.

Signed-off-by: Sitsofe Wheeler <sitsofe@yahoo.com>
2015-03-01 16:15:51 +00:00
Ronnie Sahlberg
7865a8a26e Merge branch 'sgio' 2014-12-21 15:07:40 -08:00
Ronnie Sahlberg
3d6c2be342 configure: only build the test tool and ld-iscsi iff we have shared libraries
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2014-10-22 17:44:03 -07:00
Ronnie Sahlberg
40de7d95a9 Configure: add a test for SG_IO
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2014-09-18 14:26:03 -07:00
Thomas Petazzoni
474e88740a Fix CUnit test for cross-compilation
The current test in configure.ac for CUnit uses AC_TRY_RUN, which
doesn't work in a cross-compilation context, because we can't run on
the build machine the binaries that are built for the target. In
addition, the current logic assumes CUnit is available when the
AC_TRY_RUN test cannot be used (e.g in a cross-compilation case).

Since we actually don't care about *running* but only about testing
whether a simple program include the CUnit header file and linking
against the cunit library works, simply use AC_TRY_LINK() instead of
AC_TRY_RUN().

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2014-09-07 14:40:02 +02:00
Ronnie Sahlberg
1deb4f8e4a configure: tell platforms that dont have AM_PROG_* to just ignore it
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2014-08-16 19:43:25 -07:00
Ronnie Sahlberg
ace7f200fb Revert "Revert "configure.ac: Avoid that automake complains that AM_PROG_AR is missing""
After checking several platforms, we do need this change in order to build.
If CentOS<old-version> does not manage we need to figure out why and how to fix it.

This reverts commit b9cf7e8cd2.
2014-08-16 18:23:34 -07:00
Ronnie Sahlberg
b9cf7e8cd2 Revert "configure.ac: Avoid that automake complains that AM_PROG_AR is missing"
AM_PROG_AR is not available on some platforms. Revert while I investigate.

This reverts commit 6cdb47b9b4.
2014-08-11 05:59:17 -07:00
Bart Van Assche
370741f83d configure.ac: Enable the subdir-objects option
Avoid that automake >= 1.14 warns that some source files are in a
subdirectory but that the option subdir-objects is disabled. See also
http://www.gnu.org/software/automake/manual/html_node/List-of-Automake-options.html#index-Options_002c-subdir_002dobjects

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
2014-08-02 08:29:56 -07:00
Bart Van Assche
6cdb47b9b4 configure.ac: Avoid that automake complains that AM_PROG_AR is missing
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
2014-08-02 08:29:26 -07:00
Ronnie Sahlberg
ae60611f68 AUTOTOOLS: Add Makefile.am for examples/ 2014-03-22 17:46:02 -07:00
Ronnie Sahlberg
ea790b2f75 AUTOTOOLS: Add Makefile.am to test-tool 2014-03-22 16:46:25 -07:00
Ronnie Sahlberg
c07779cfa7 AUTOTOOLS: Add a Makefile.am for the iscsi-* utilities 2014-03-22 13:10:19 -07:00
Ronnie Sahlberg
65d3597c1b AUTOTOOLS: Create Makefile.am for lib 2014-03-22 13:10:15 -07:00
Ronnie Sahlberg
5500f84402 AUTOTOOLS: Create a separate Makefile.am for the docs directory 2014-03-22 13:10:07 -07:00
Ronnie Sahlberg
7d1f7a5308 DOCS: Add configure --enable-manpages which controls whether to build the manpages or not 2014-03-22 13:08:24 -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
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
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