summaryrefslogtreecommitdiff
path: root/utils
Commit message (Collapse)AuthorAgeFilesLines
* Use meson as the main build system (#365)Lee Duncan2022-09-212-19/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Build: Add an iscsiuio 'build_date.sh' script This is currently unused, but will be used by meson to build the "build_date.[ch]" files used by iscsiuio. * Build: have git ignore file '.setup' I commonly use this file for shell aliases/functions. * Add framework to support building using meson. This adds the ability to use meson/ninja to build open-iscsi and iscsiuio, rather than the current system that uses 'autoconf' for iscsiuio and uses 'make' for everything else. The old make/autoconf system is left in place, for now, but deprecated, including a warning about that when running 'make all' or 'make user' from the top-level. * utils/build: enhance iscsi-iname to generate prefix Added new "-g/--generate-iname-prefix" argument to generate the InitiatorName= prefix. Also, updated iscsi-iname to use getopts. Also, use the new option from meson. * git/meson: remove 'builddir' from ignored files The build directory can be called anything. Suggested by: Eli Schwartz * iscsiuio build: fix new build_date.sh script Fixed several issues: - fix option handling for "-S" - fix epoch date handling from env (noticed by Eli Schwartz) - remove debug statements * iscsiuio meson: warn when not creating a symlink for iscsiuio * meson: install man pages more efficiently We don't need to specify path or subdirectory * iscsiuio meson: remove unused source date epoch option This option was never used, since we pass this info from the environment. * meson: no need to set libdir: default is fine * iscsiuio meson: no need to add c_args: already there * Don't generate initiatorname when cross-building (#367) Let it be generated by the iscsi-init service. Signed-off-by: TIAN Yuanhao <tianyuanhao3@163.com> * Set ISCSI_CONFIG_ROOT by meson Signed-off-by: TIAN Yuanhao <tianyuanhao3@163.com> * Set LOCK_DIR from home_dir to lock_dir Signed-off-by: TIAN Yuanhao <tianyuanhao3@163.com> * Install iface.example to db_root/ifaces Signed-off-by: TIAN Yuanhao <tianyuanhao3@163.com> Signed-off-by: TIAN Yuanhao <tianyuanhao3@163.com> Co-authored-by: TIAN Yuanhao <78596099+tianyuanhao@users.noreply.github.com> Co-authored-by: TIAN Yuanhao <tianyuanhao3@163.com>
* Small bug fixes (#364)Lee Duncan2022-09-062-91/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * build: move utils/sysdeps to top-level The routines here are used by iscsiuio, so move them to the top level. * libopeniscsiusr: fix kernel-doc bugs There were errors in four places, effecting the generated manual pages. * libopeniscsiusr: clean up kernel-doc usage Simplify generation of library interface documentation using the kernel-doc script: * make the kernel-doc perl script executble (the only visible change) * remove mention of sed (not used) * stop compressing man pages -- let distros do that * improve kernel-doc so that doc-preclean.pl and split-man.pl are no longer needed * add list-man-pages.sh to simplify things (copied from libnvme) * build: keep current version number in one place Move the current version number (now 2.1.7) into the top-level Makefile, and out of usr/version.h and libopeniscsiusr/version.h, completely eliminating the need for the latter. Note that this ties the libopeniscsiusr library idea of "version" to the usr/ (iscsid, etc) idea of version, even though they used to be defined separately. But they always had the same value, so nothing lost. * build: insteall man pages uncompressed We were delivering some man pages compressed and other not, and it turns out distros know how to install man pages using the compression they prefer, so stop doing it for them.
* make: avoid hard-coding path to sed (#357)Chris Hofstaedtler2022-07-301-1/+1
| | | | | | Just use PATH to find sed. Not all distributions have moved to a /usr-merged layout yet. Signed-off-by: Chris Hofstaedtler <zeha@debian.org>
* Add a 'distclean' Makefile top-level targetLee Duncan2022-05-092-1/+9
| | | | | | | | | | This cleans up a little more than "make clean", in particular removing files generated from templates, and automake-generated files in iscsiuio. Also, a ".PHONY:" target was added where needed so that each Makefile has a complete list of phony targets.
* Merge pull request #333 from thesamesam/masterLee Duncan2022-04-102-3/+3
|\ | | | | Build system tweaks from downstream
| * Makefiles: respect $(CC) fully (don't hardcode GCC); use $(RM)Sam James2022-04-062-3/+3
| | | | | | | | | | | | | | - Don't hardcode GCC, instead respect the detected CC (or from the environment) - Use $(RM) as the location may vary and we've already done the work to detect it Signed-off-by: Sam James <sam@gentoo.org>
* | Check for root in iscsi-gen-initiatornameLee Duncan2022-04-081-6/+10
| | | | | | | | The man page is also updated
* | utils: remove errant spaces in scriptLee Duncan2022-04-071-5/+5
| | | | | | | | | | There were a few spaces accidentally left at the ends of a few lines in iscsi-gen-initiatorname, so remove them.
* | Use kernel initiatorname when setting local inameLee Duncan2022-04-071-36/+118
| | | | | | | | | | | | | | | | | | | | | | Update the iscsi-gen-initatorname script to take its initiator name from the kernel command line, if present. Also, beef up and simplify the error checking. Error messages will now go to stderr, and it is now an error to overwrite the initiatorname file unless the "force" option is set. The man page was updated, as well.
* | Build: remove redundant definition in utils MakefileLee Duncan2022-04-041-2/+1
|/ | | | We do not need two definitions for "/etc" in utils/Makefile.
* Build: Cleanup fwparam_ibft and sysdeps subdirs.Lee Duncan2022-03-3115-7080/+2
| | | | | | | | | | | | This commit moves the "fwparam_ibft" subdirectory from being under "utils" to being under "usr", where its actually used. It also updates usr/Makefile so that it's smarter about how and when to build the fwparam_ibft object files it needs, as well as how to build sysdeps.o. From the top-level Makefile, "make user" will now make the fwparam_ibft files, as needed for the "user" targets, before building iscsid and friends.
* Make DB and ISCSIHOME directories configurable.Lee Duncan2022-03-253-13/+18
| | | | | | | | | | | | | | | | | | | | This commit adds two new top-level build options: one for the "home" directory for open-iscsi called "HOMEDIR", and one for the "database" directory, called "DBROOT". One can now override the defaults of "/etc/iscsi" for either or both of these directories on the make command line. The README and man pages are updated with details about these new options. Some Makefile cleanup/repair was done as well. Installation of the initiatorname.iscsi file, was moved out of the top-level Makefile into the etc subdirectory, and installation of man ages moved from the top-level Makefile to the doc subdirectory. Also, this fixes some issues from commit fd14dd8316b1 ("Clean p Makefile build system."), which incorrectly changed the DESTDIR ariable in the Makefiles. This current commit also fixes the top-level variable names for moving DBROOT and HOMEDIR.
* Clean up Makefile build system.Lee Duncan2022-03-207-4/+65
| | | | | | | | | | | | | | | | | | | | | | | A major overdue overhaul of the Make layout, including moving lots of lower-level things out of the top-level Makefile into the Makefiles for the appropriate subdirectory, renaming the template files (where @SBINDIR@ gets translated) so that their purpose is more obvious, making the build more idempotent (no need to install a file if it's not newer). Should be no functional change, as no script or C file changed. Main difference from before: now the udev rules gets made and installed by default (as part of "make"/"make install"), and the iscsiuio daemon is now installed for "make install". One should now be able to go into any subdirectory and type "make"/"make install" to build and install the targets from that directory, at least for the etc, utils, and usr subdirectories. This change is in preparation for more template translations coming.
* Remove HEREIS usage from iscsi-gen-initiatornameLee Duncan2022-02-171-25/+26
| | | | | | | This script can be called early in the boot process, when /tmp is not writable (but /etc/iscsi is), so change the usage of HEREIS to simple variables. Otherwise, no change in functionality.
* change iscsi-gen-initiatorname option -b => -pLee Duncan2021-12-031-5/+5
| | | | | This matches with iscsi-iname, which already exists and is used by this script.
* Update the iscsi-gen-initiatorname script: harden and generalizeLee Duncan2021-12-031-22/+50
| | | | | | | | | | | | | | | | | | | | | | | | | The iscsi-gen-initiatorname script seems only to be used by the SUSE distrubution, so it has never been very "general". This update makes the script more resiliant, with better error messages if a problem occurs, as well as more generic, allowing the caller to set the "base IQN" value, though the default contains to be the same. Changes: - Added use of getopts to parse options - Added a "-h" option for help - Added an option to supply base IQN - Added better checking of options and params - Added comments to the script itself - Now check to see if iname file can be written to (handling read-only mounts better) - Fixed initiator name listed in file (it was wrong) - Removed use of printf(1) - Fixed iBFT initiator name setting in general - Now set iname file mode to 0600 even when it comes from iBFT - Cleaned up the script to use variables instead of repeating file pathnames or other values
* Finish ability to have binary location configurable.Lee Duncan2021-10-283-7/+7
| | | | | | | | | | A Recent commit, fff82c57f5df ("Use "sbindir" for path in systemd service files") added the ability to have our binaries in another location rather than /sbin (e.g. /usr/sbin), but it was incomplete. This commit finishes the job. Fixes: fff82c57f5dfe6d3db795f1195b4d2ebc497d33c
* Handle qedi correctly in NPAR modeLee Duncan2021-09-011-8/+6
| | | | | | | Use the correct driver, and handle the NPAR 4-MAC-ADDr offset of qedi, unlike other Offload cards. Found-by: David Bond <DBond@suse.com>
* Support the "qede" CNA-card driver.Lee Duncan2021-07-201-0/+8
| | | | The iscsi_offload command needs to recognize the "qede" driver.
* fwparam_ppc: Fix memory leak in fwparam_ppc.cWenchao Hao2020-12-121-0/+10
| | | | | | | | | | calloc() is called because loop_devs() to allocate memory which stored in array ofwdev. These memory should be freed at the end. Signed-off-by: Wenchao Hao <haowenchao@huawei.com> Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com> Signed-off-by: Wu Bo <wubo40@huawei.com>
* fwparam_ppc: Fix illegal memory access in fwparam_ppc.cWenchao Hao2020-12-121-10/+23
| | | | | | | | | | | | | bootpath_val is allocated in find_file() and referenced if find_file() excute successfully, while it was freed in find_file() and dereferenced after find_file() if find_file() returns 1. This patch remove free(bootpath_val) in find_file() and free bootpath_val when it is used done. Signed-off-by: Wenchao Hao <haowenchao@huawei.com> Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com> Signed-off-by: Wu Bo <wubo40@huawei.com>
* fwparam_ppc: Fix NULL pointer dereference in find_devtree()Wenchao Hao2020-12-121-0/+3
| | | | | | | | | If strdup() returns NULL, find_devtree() just return NULL to indicate this function execute failed. Signed-off-by: Wenchao Hao <haowenchao@huawei.com> Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com> Signed-off-by: Wu Bo <wubo40@huawei.com>
* open-iscsi: Fix invalid pointer deference in find_initiator()Wenchao Hao2020-12-121-2/+9
| | | | | | | | If calloc() returns NULL just return ENOMEM; if strdup() returns NULL we should free dev and return errno. Signed-off-by: Wenchao Hao <haowenchao@huawei.com> Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
* iscsi-iname: Verify open() return value before calling read()Wenchao Hao2020-12-121-2/+4
| | | | | | | | | System call open() might return -1 if an error occurred which should be taken into consideration. Signed-off-by: Wenchao Hao <haowenchao@huawei.com> Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com> Signed-off-by: Wu Bo <wubo40@huawei.com>
* Merge pull request #211 from liubozju/iscsi-devLee Duncan2020-06-061-1/+4
|\ | | | | iscsi: Add break to while loop
| * iscsi: Add break to while loopwubo0092020-06-041-1/+4
| |
* | iscsi: fix fd leakwubo0092020-06-041-0/+1
|/
* Fix issue where "iscsi-iname -p" core dumps.Lee Duncan2020-03-252-5/+14
| | | | | While I was at it, I made the usage message a function and made it print to stderr insted of stdout.
* fwparam_pcc mulitple resource leaksChris Leech2019-10-311-2/+1
| | | | | Resource Leak: Variable mac_file going out of scope leaks the storage it points to. Resource Leak: Handle variable mac_fd going out of scope leaks the storage it points to.
* iscsistart -b probably never worked with PPC OF parsing?Chris Leech2019-10-311-1/+0
| | | | | | Picked up by Coverity as a resource leak on the allocated context, callers are not expected allocation here (and the function would need to take a **boot_context if they were)
* iscsi-iname remove unneeded temp bufferChris Leech2019-10-311-6/+1
|
* iscsi-iname: verify prefix length is at most 210 charactersChris Leech2019-10-311-0/+9
| | | | Don't know who might be trying to make really long IQNs ¯\_(ツ)_/¯
* iscsi-iname: change default IQN prefixChris Leech2019-10-311-1/+1
| | | | | We don't actually control the open-iscsi.org domain anymore, so change the prefix to reflect the use of open-iscsi.com
* Update GPLv2 License information.Lee Duncan2018-10-091-11/+11
| | | | | | Update the COPYING file, with the whole GPLv2.0 license, and a script that seems to have a notice, as well. Both were outdated and had incorrect FSF addresses.
* Fix qsort() comparator function call.Lee Duncan2018-09-271-2/+2
| | | | | | | | | The compare function is supposed to match the prototype: int (*compar)(const void *, const void *) so the function nic_cmp() was declared incorrectly, which makes gcc much happier.
* Remove unused file fwparam_ibft_sysfs.c.Lee Duncan2018-05-311-394/+0
| | | | | I believe it was, at one time, used instead of fwparam_sysfs.c? But it is not used at all now.
* iscsiadm: get transport_name correctly for offload ifaceNilesh Javali2018-04-231-4/+6
| | | | | | | | | The qedi offload iface does not have netdev associated with it. Correctly get the transport_name from boot context. iBFT and offload iface can rely on this method to get the transport name. Signed-off-by: Nilesh Javali <nilesh.javali@cavium.com>
* fwparam_ppc.c: Do not use __compar_fn_tKhem Raj2018-03-211-1/+1
| | | | | | __compar_fn_t is not defined in musl Signed-off-by: Khem Raj <raj.khem@gmail.com>
* libopeniscsiusr: Use libopeniscsiusr in iscsiadmGris Ge2018-01-221-2/+10
| | | | | | | | | | | * Use libopeniscsiusr for `iscsiadm -m session -P <0-3>` command. * Use libopeniscsiusr for iSCSI session information used by `iscsiadm -m node -H <host_no> -P <2 - 4>`command. * Since `/sys/class/iscsi_session/session1/username` require root permission, this patch require `iscsiadm` been ran with root privilege. Signed-off-by: Gris Ge <fge@redhat.com>
* Add in tracking IP prefix length, in addition to mask.Lee Duncan2018-01-182-0/+3
| | | | | The modern IP standard stresses the IP prefix length rather than the mask, so track the IP prefix length.
* Automate logging into iSCSI FW targets.Lee Duncan2018-01-162-0/+27
| | | | | | | Add a script that logs into all iSCSI firmware targets, and add a udev rule to call that script when new targets are detected. Also, add a man page for the script.
* Fix compiler warnings about string overflows in prom_parseLee Duncan2017-12-024-1065/+1057
| | | | | | | | | | | | | | Gcc compiler version 7.2.1 complains about possible string overflow from prom_parse.y: > prom_parse.tab.c: In function ‘yyparse’: > prom_parse.y:98:25: warning: ‘%s’ directive writing up to 255 bytes into a region of size between 0 and 255 [-Wformat-overflow=] > sprintf($$, "%s/%s", $<str>1, $<str>3); > ^~~~~~~ So make the string buffer larger. Also, tell the compiler it is ok if we truncate strings, since our buffer is very large. Lastly, ensure we use strncpy() when copying strings.
* Replace deprecated _SVID_SOURCE with _DEFAULT_SOURCELee Duncan2017-12-022-2/+2
| | | | | | | | | | | | | Gcc version 7.2.1 and linux-glibc-devel version 4.14 complain about _SVID_SOURCE, which is deprecated, so use the replacement of _DEFAULT_SOURCE. The error message looks like: > In file included from /usr/include/ftw.h:25:0, > from fwparam_sysfs.c:23: > /usr/include/features.h:183:3: warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Wcpp] > # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" > ^~~~~~~
* Fix compiler warning: possible string truncationLee Duncan2017-12-022-2/+2
| | | | | | | | | | | Gcc version 7.2.1 complains about string formatting that may be truncated, generating messages such as: > fwparam_sysfs.c: In function ‘fwparam_sysfs_boot_info’: > fwparam_sysfs.c:45:25: warning: ‘%s’ directive output may be truncated writing up to 255 bytes into a region of size 242 [-Wformat-truncation=] > #define ISCSI_LLD_ROOT "/sys/firmware/" Making the destination strings longer fixes this issue.
* Merge pull request #55 from apatters/bnx2-software-ibft-supportLee Duncan2017-08-301-24/+36
|\ | | | | Add bnx2{,x} software initiator IBFT support
| * iscsistart: move offload discovery/setup to fw_get_targets()Andrew Patterson2017-06-021-24/+36
| | | | | | | | | | Move iscsistart offload discovery/setup from dump_targets() (--fwparam_print) to fw_get_targets() (--fwparam_network).
* | Fixed typo for spelling of 'default'Neal Wise2017-06-091-4/+4
|/
* iBFT 'origin' is an enum, not a stringLee Duncan2016-11-181-2/+1
| | | | | | A recent change, commit 4959a89f421fdebc, modified open-iscsi to treat the "origin" field as an enum, not a character string. But one spot was missed.
* fixed typo in iscsi_discovery usage()Mark Karpeles2016-09-181-1/+1
| | | | quick fix changing trasnpot into transport
* iscsistart: support booting over a VLANChris Leech2016-04-121-2/+1
| | | | | | | Adds code to check for VLAN devices if the boot configuration specifies a VLAN ID. Does not create VLANs, they need to already be in place.