diff options
author | V3n3RiX <venerix@redcorelinux.org> | 2017-10-09 18:53:29 +0100 |
---|---|---|
committer | V3n3RiX <venerix@redcorelinux.org> | 2017-10-09 18:53:29 +0100 |
commit | 4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch) | |
tree | ba5f07bf3f9d22d82e54a462313f5d244036c768 /sys-block/open-iscsi/files |
reinit the tree, so we can have metadata
Diffstat (limited to 'sys-block/open-iscsi/files')
19 files changed, 989 insertions, 0 deletions
diff --git a/sys-block/open-iscsi/files/99-iscsi.rules b/sys-block/open-iscsi/files/99-iscsi.rules new file mode 100644 index 000000000000..3816126264c7 --- /dev/null +++ b/sys-block/open-iscsi/files/99-iscsi.rules @@ -0,0 +1 @@ +KERNEL=="sd*", SUBSYSTEMS=="block", RUN{program}+="/etc/udev/scripts/iscsidev.sh" diff --git a/sys-block/open-iscsi/files/initiatorname.iscsi b/sys-block/open-iscsi/files/initiatorname.iscsi new file mode 100644 index 000000000000..22179903c543 --- /dev/null +++ b/sys-block/open-iscsi/files/initiatorname.iscsi @@ -0,0 +1,30 @@ +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License, v2 or later +# +# This file must contain a InitiatorName entry! +# white space is significent here! +#InitiatorName=iqn.2005-09.tld.domain.hostname:openiscsi-initiator +#InitiatorAlias=foobar + +# Sample documentation follows: + +# The InitiatorName should take the following format +# iqn.${YEAR}-${MONTH}-${DOMAIN_REVERSED}.${HOSTNAME}:${UNIQUE_STRING} +# Where YEAR and MONTH are the dates that your domain was registered. +# You can use WHOIS to find when your domain was registered. +# If you don't have a real domain in the outside world, invent one, but use +# .local for your top-level. + +# Example case #1: +# This assumes you own foobar.co.uk. +# Domain name: foobar.co.uk. +# Registration date: March 2001 +# Hostname: linux +# InitiatorName=iqn.2001-03.uk.co.foobar.linux:openiscsi-29b48ad602d5f83dd9cd9aa3ef741216 + +# Example case #2: +# This assumes you don't have a domain of your own. +# Domain name: foobar.local +# Registration date: March 2001 +# Hostname: linux +# InitiatorName=iqn.2001-03.local.foobar.linux:openiscsi-29b48ad602d5f83dd9cd9aa3ef741216 diff --git a/sys-block/open-iscsi/files/iscsid-conf.d b/sys-block/open-iscsi/files/iscsid-conf.d new file mode 100644 index 000000000000..02e584fbce52 --- /dev/null +++ b/sys-block/open-iscsi/files/iscsid-conf.d @@ -0,0 +1,18 @@ +# /etc/conf.d/iscsid + +# config file to use +CONFIG_FILE=/etc/iscsi/iscsid.conf + +# you need to specify an initiatorname in the file +INITIATORNAME_FILE=/etc/iscsi/initiatorname.iscsi + +# options to pass to iscsid +OPTS="-i ${INITIATORNAME_FILE}" + +# Start automatic targets when iscsid is started +AUTOSTARTTARGETS="yes" + +# if set to "strict", iscsid will stop, if connecting the +# autostart targets failed +# AUTOSTART="strict" + diff --git a/sys-block/open-iscsi/files/iscsid-init.d b/sys-block/open-iscsi/files/iscsid-init.d new file mode 100644 index 000000000000..617af9ac1097 --- /dev/null +++ b/sys-block/open-iscsi/files/iscsid-init.d @@ -0,0 +1,106 @@ +#!/sbin/openrc-run +# Copyright 1999-2015 Gentoo Foundation, Inc. +# Distributed under the terms of the GNU General Public License, v2 or later + +command="/usr/sbin/iscsid" +command_args="${OPTS}" +start_stop_daemon_args="-w 100" # iscsid might fail e.g. when the iSCSI kernel modules aren't available +pidfile=${PIDFILE:-/var/run/${SVCNAME}.pid} + +extra_started_commands="starttargets stoptargets" +extra_commands="restarttargets" + +ISCSIADM=/usr/sbin/iscsiadm + +depend() { + after modules multipath + use net +} + +checkconfig() { + if [ ! -e /etc/conf.d/${SVCNAME} ]; then + eerror "Config file /etc/conf.d/${SVCNAME} does not exist!" + return 1 + fi + if [ ! -e "${CONFIG_FILE}" ]; then + eerror "Config file ${CONFIG_FILE} does not exist!" + return 1 + fi + + if [ -e ${INITIATORNAME_FILE} ]; then + . ${INITIATORNAME_FILE} + fi + if [ ! -e ${INITIATORNAME_FILE} -o -z "${InitiatorName}" ]; then + ewarn "${INITIATORNAME_FILE} should contain a string with your initiatior name." + local IQN=$(/usr/sbin/iscsi-iname) + ebegin "Creating InitiatorName ${IQN} in ${INITIATORNAME_FILE}" + echo "InitiatorName=${IQN}" >> "${INITIATORNAME_FILE}" + eend $? + fi +} + +starttargets() { + ebegin "Setting up iSCSI targets" + $ISCSIADM -m node --loginall=automatic + local ret=$? + eend $ret + return $ret +} + +stoptargets() { + ebegin "Disconnecting iSCSI targets" + sync + $ISCSIADM -m node --logoutall=all + local ret=$? + + if [ $ret -eq 21 ]; then + # See man iscsiadm(8) + einfo "No active sessions to disconnect" + eend 0 + return 0 + fi + + eend $ret + return $ret +} + +restarttargets() { + stoptargets + starttargets +} + +status() { + ebegin "Showing current active iSCSI sessions" + $ISCSIADM -m session +} + + +start_pre() { + local ret=1 + + ebegin "Checking Open-iSCSI configuration" + checkconfig + ret=$? + if [ $ret -ne 0 ]; then + eend 1 + return 1 + fi + eend 0 +} + +start_post() { + # Start automatic targets when iscsid is started + if [ "${AUTOSTARTTARGETS}" = "yes" ]; then + starttargets + local ret=$? + if [ "${AUTOSTART}" = "strict" -a $ret -ne 0 ]; then + stop + return $ret + fi + fi + return 0 +} + +stop_pre() { + stoptargets +} diff --git a/sys-block/open-iscsi/files/iscsidev.sh b/sys-block/open-iscsi/files/iscsidev.sh new file mode 100644 index 000000000000..d045fae570fc --- /dev/null +++ b/sys-block/open-iscsi/files/iscsidev.sh @@ -0,0 +1,78 @@ +#!/usr/bin/env bash + +# KERNEL=="sd*", SUBSYSTEMS=="block", RUN{program}="/etc/udev/scripts/iscsidev.sh" + +# we only care about iscsi devices +[[ $ID_VENDOR = "IET" ]] || exit 1 + +# don't care about partitions either +echo $DEVNAME | egrep -q "[0-9]$" +status=$? +[[ $status != 0 ]] || exit 1 + +#ID_MODEL=VIRTUAL-DISK +#ID_MODEL_ENC=VIRTUAL-DISK +#ID_REVISION=0001 +#DEVTYPE=disk +#ID_BUS=scsi +#SUBSYSTEM=block +#ID_SERIAL=1IET_00010001 +#DEVPATH=/devices/platform/host74/session68/target74:0:0/74:0:0:1/block/sde +#ID_VENDOR_ENC=IET\x20\x20\x20\x20\x20 +#MINOR=64 +#ID_SCSI=1 +#ACTION=add +#PWD=/ +#ID_PART_TABLE_UUID=54f71c65-a5d5-45cd-8915-5ffd5ff4fea6 +#ID_FS_TYPE= +#USEC_INITIALIZED=999037905 +#MAJOR=8 +#ID_SCSI_SERIAL=beaf11 +#DEVLINKS=/dev/disk/by-id/scsi-1IET_00010001 +#DEVNAME=/dev/sde +#SHLVL=1 +#ID_TYPE=disk +#ID_PART_TABLE_TYPE=gpt +#ID_VENDOR=IET +#ID_SERIAL_SHORT=IET_00010001 +#SEQNUM=25775 + +# do the removal +if [[ $ACTION = 'remove' ]]; then + # nohup needed so this isn't constantly run... + nohup find -L /dev/disk/by-path/ -type l -lname ${DEVNAME} -exec rm "{}" + 2>/dev/null & + exit 0 +fi + +TARGET_NAME=$(lsscsi -t | grep "${DEVNAME}" | awk '{print $3}' | awk -F, '{print $1}') +[[ $TARGET_NAME = '' ]] && exit 1 + +# we don't know which host is correct +declare -a POSSIBLE_HOSTS +declare -a POSSIBLE_PORTS +for item in $(cat /sys/class/iscsi_connection/connection*/address); do + POSSIBLE_HOSTS+=("${item}") +done +for item in $(cat /sys/class/iscsi_connection/connection*/port); do + POSSIBLE_PORTS+=("${item}") +done + +#get correct ip and port +for ((i=0;i<${#POSSIBLE_HOSTS[@]};++i)); do + printf "%s is in %s\n" "$POSSIBLE_HOSTS[i]}" "${POSSIBLE_PORTS[i]}" + iscsiadm --mode node --targetname "${TARGET_NAME}" -p "${POSSIBLE_HOSTS[i]}":"${POSSIBLE_PORTS[i]}" + status=$? + if [[ $status = 0 ]]; then + TARGET_IP="${POSSIBLE_HOSTS[i]}" + TARGET_PORT="${POSSIBLE_PORTS[i]}" + break + fi +done + +# exit if not found +[[ -z $TARGET_IP ]] && exit 1 +[[ -z $TARGET_PORT ]] && exit 1 + +# actually create the link +mkdir -p /dev/disk/by-path/ +ln -s "${DEVNAME}" "/dev/disk/by-path/ip-${TARGET_IP}:${TARGET_PORT}-iscsi-${TARGET_NAME}-lun-1" diff --git a/sys-block/open-iscsi/files/musl-fixes.patch b/sys-block/open-iscsi/files/musl-fixes.patch new file mode 100644 index 000000000000..f101eda6ddeb --- /dev/null +++ b/sys-block/open-iscsi/files/musl-fixes.patch @@ -0,0 +1,64 @@ +--- ./utils/open-isns/isns.h.orig ++++ ./utils/open-isns/isns.h +@@ -13,6 +13,7 @@ + #include <sys/socket.h> + #include <netinet/in.h> + #include <stdio.h> ++#include <time.h> + + #include <isns-proto.h> + #include "types.h" +--- ./utils/fwparam_ibft/fwparam_ppc.c.orig ++++ ./utils/fwparam_ibft/fwparam_ppc.c +@@ -356,7 +356,7 @@ + * Sort the nics into "natural" order. The proc fs + * device-tree has them in somewhat random, or reversed order. + */ +- qsort(niclist, nic_count, sizeof(char *), (__compar_fn_t)nic_cmp); ++ qsort(niclist, nic_count, sizeof(char *), (int (*)(const void *, const void *))nic_cmp); + + snprintf(prefix, sizeof(prefix), "%s/%s", devtree, "aliases"); + dev_count = 0; +--- ./usr/idbm.c.orig ++++ ./usr/idbm.c +@@ -25,6 +25,7 @@ + #include <stdlib.h> + #include <string.h> + #include <errno.h> ++#include <fcntl.h> + #include <dirent.h> + #include <limits.h> + #include <sys/stat.h> +--- ./usr/iscsiadm.c.orig 2012-05-21 02:59:24.000000000 +0200 ++++ ./usr/iscsiadm.c 2016-07-20 22:00:54.430451701 +0200 +@@ -2403,6 +2403,7 @@ main(int argc, char **argv) + int tpgt = PORTAL_GROUP_TAG_UNKNOWN, killiscsid=-1, do_show=0; + int packet_size=32, ping_count=1, ping_interval=0; + int do_discover = 0, sub_mode = -1; ++ int argerror = 0; + struct sigaction sa_old; + struct sigaction sa_new; + struct list_head ifaces; +@@ -2553,7 +2554,11 @@ main(int argc, char **argv) + return 0; + case 'h': + usage(0); +- } ++ ++ case '?': ++ log_error("unrecognized character '%c'", optopt); ++ argerror = 1; ++ } + + if (name && value) { + param = idbm_alloc_user_param(name, value); +@@ -2568,8 +2573,7 @@ main(int argc, char **argv) + } + } + +- if (optopt) { +- log_error("unrecognized character '%c'", optopt); ++ if (argerror) { + rc = ISCSI_ERR_INVAL; + goto free_ifaces; + diff --git a/sys-block/open-iscsi/files/open-iscsi-2.0.872-conf.d b/sys-block/open-iscsi/files/open-iscsi-2.0.872-conf.d new file mode 100644 index 000000000000..02e584fbce52 --- /dev/null +++ b/sys-block/open-iscsi/files/open-iscsi-2.0.872-conf.d @@ -0,0 +1,18 @@ +# /etc/conf.d/iscsid + +# config file to use +CONFIG_FILE=/etc/iscsi/iscsid.conf + +# you need to specify an initiatorname in the file +INITIATORNAME_FILE=/etc/iscsi/initiatorname.iscsi + +# options to pass to iscsid +OPTS="-i ${INITIATORNAME_FILE}" + +# Start automatic targets when iscsid is started +AUTOSTARTTARGETS="yes" + +# if set to "strict", iscsid will stop, if connecting the +# autostart targets failed +# AUTOSTART="strict" + diff --git a/sys-block/open-iscsi/files/open-iscsi-2.0.872-dont-call-configure.patch b/sys-block/open-iscsi/files/open-iscsi-2.0.872-dont-call-configure.patch new file mode 100644 index 000000000000..185f1acd8373 --- /dev/null +++ b/sys-block/open-iscsi/files/open-iscsi-2.0.872-dont-call-configure.patch @@ -0,0 +1,11 @@ +--- open-iscsi-2.0-872.orig/Makefile ++++ open-iscsi-2.0-872/Makefile +@@ -27,7 +27,7 @@ IFACEFILES = etc/iface.example + all: user kernel + + user: ; +- cd utils/open-isns; ./configure; $(MAKE) ++ cd utils/open-isns; $(MAKE) + $(MAKE) -C utils/sysdeps + $(MAKE) -C utils/fwparam_ibft + $(MAKE) -C usr diff --git a/sys-block/open-iscsi/files/open-iscsi-2.0.872-glibc212.patch b/sys-block/open-iscsi/files/open-iscsi-2.0.872-glibc212.patch new file mode 100644 index 000000000000..61717032940a --- /dev/null +++ b/sys-block/open-iscsi/files/open-iscsi-2.0.872-glibc212.patch @@ -0,0 +1,10 @@ +--- usr/iscsid.c 2010-10-10 23:06:37.000000000 +0200 ++++ usr/iscsid.c 2010-10-10 23:07:55.000000000 +0200 +@@ -31,6 +31,7 @@ + #include <sys/utsname.h> + #include <sys/types.h> + #include <sys/wait.h> ++#include <sys/stat.h> + + #include "iscsid.h" + #include "mgmt_ipc.h" diff --git a/sys-block/open-iscsi/files/open-iscsi-2.0.872-init.d-r1 b/sys-block/open-iscsi/files/open-iscsi-2.0.872-init.d-r1 new file mode 100644 index 000000000000..597d0804feb3 --- /dev/null +++ b/sys-block/open-iscsi/files/open-iscsi-2.0.872-init.d-r1 @@ -0,0 +1,130 @@ +#!/sbin/openrc-run +# Copyright 1999-2013 Gentoo Foundation, Inc. +# Distributed under the terms of the GNU General Public License, v2 or later + +opts="${opts} starttargets stoptargets restarttargets" + +depend() { + after modules + use net +} + +PIDFILE=${PIDFILE:-/var/run/${SVCNAME}.pid} +BINARY="/usr/sbin/iscsid" + +checkconfig() { + if [ ! -e /etc/conf.d/${SVCNAME} ]; then + eerror "Config file /etc/conf.d/${SVCNAME} does not exist!" + return 1 + fi + if [ ! -e "${CONFIG_FILE}" ]; then + eerror "Config file ${CONFIG_FILE} does not exist!" + return 1 + fi + if [ ! -e ${INITIATORNAME_FILE} ] || [ ! "$(grep "^InitiatorName=iqn\." ${INITIATORNAME_FILE})" ]; then + ewarn "${INITIATORNAME_FILE} should contain a string with your initiatior name." + IQN=iqn.$(date +%Y-%m).$(hostname -f | awk 'BEGIN { FS=".";}{x=NF; while (x>0) {printf $x ;x--; if (x>0) printf ".";} print ""}'):openiscsi + IQN=${IQN}-$(echo ${RANDOM}${RANDOM}${RANDOM}${RANDOM}${RANDOM} | md5sum | sed -e "s/\(.*\) -/\1/g" -e 's/ //g') + ebegin "Creating InitiatorName ${IQN} in ${INITIATORNAME_FILE}" + echo "InitiatorName=${IQN}" >> "${INITIATORNAME_FILE}" + eend $? + fi +} + +do_modules() { + msg="$1" + shift + modules="${1}" + shift + modopts="$@" + for m in ${modules} + do + if modprobe --show --quiet "${m}" + then + ebegin "${msg} ${m}" + modprobe ${modopts} ${m} + ret=$? + eend ${ret} + if [ ${ret} -ne 0 ]; then + return ${ret} + fi + else + ebegin "${msg} ${m}: not found" + return 1 + fi + done + return 0 +} + +start() { + ebegin "Checking open-iSCSI configuration" + checkconfig + ret=$? + if [ $ret -ne 0 ]; then + eend 1 + return 1 + fi + ebegin "Loading iSCSI modules" + do_modules 'Loading' 'libiscsi scsi_transport_iscsi iscsi_tcp' + ret=$? + if [ $ret -ne 0 ]; then + eend 1 + return 1 + fi + + ebegin "Starting ${SVCNAME}" + start-stop-daemon --start --quiet --exec ${BINARY} -- ${OPTS} + ret=$? + if [ $ret -ne 0 ]; then + eend $? + return $? + fi + + # Start automatic targets when iscsid is started + if [ "${AUTOSTARTTARGETS}" = "yes" ]; then + starttargets + ret=$? + if [ "${AUTOSTART}" = "strict" ] && [ $ret -ne 0 ]; then + stop + return $ret + fi + fi + return 0 +} + +stop() { + stoptargets + ebegin "Stopping ${SVCNAME}" + start-stop-daemon --stop --quiet --exec ${BINARY} --pidfile ${PIDFILE} + eend $? + + do_modules 'Removing iSCSI modules' 'iscsi_tcp scsi_transport_iscsi libiscsi' '-r' + eend $? +} + +starttargets() { + ebegin "Setting up iSCSI targets" + /usr/sbin/iscsiadm -m node --loginall=automatic + ret=$? + eend $ret + return $ret +} + +stoptargets() { + ebegin "Disconnecting iSCSI targets" + sync + /usr/sbin/iscsiadm -m node --logoutall=all + ret=$? + eend $ret + return $ret +} + +restarttargets() { + stoptargets + starttargets +} + +status() { + ebegin "Showing current active iSCSI sessions" + /usr/sbin/iscsiadm -m session +} diff --git a/sys-block/open-iscsi/files/open-iscsi-2.0.872-isns-slp.patch b/sys-block/open-iscsi/files/open-iscsi-2.0.872-isns-slp.patch new file mode 100644 index 000000000000..db280a3dd862 --- /dev/null +++ b/sys-block/open-iscsi/files/open-iscsi-2.0.872-isns-slp.patch @@ -0,0 +1,16 @@ +diff -Nuar open-iscsi-2.0-872.orig/usr/Makefile open-iscsi-2.0-872/usr/Makefile +--- open-iscsi-2.0-872.orig/usr/Makefile 2012-02-09 08:25:13.656604152 +0000 ++++ open-iscsi-2.0-872/usr/Makefile 2012-02-09 08:26:28.960171260 +0000 +@@ -53,10 +53,10 @@ + + iscsid: $(ISCSI_LIB_SRCS) $(IPC_OBJ) $(INITIATOR_SRCS) $(DISCOVERY_SRCS) \ + iscsid.o session_mgmt.o discoveryd.o +- $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ -L../utils/open-isns -lisns -lcrypto ++ $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ -L../utils/open-isns -lisns $(SLP_LIBS) -lcrypto + + iscsiadm: $(ISCSI_LIB_SRCS) $(DISCOVERY_SRCS) iscsiadm.o session_mgmt.o +- $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ -L../utils/open-isns -lisns -lcrypto ++ $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ -L../utils/open-isns -lisns $(SLP_LIBS) -lcrypto + + iscsistart: $(IPC_OBJ) $(ISCSI_LIB_SRCS) $(INITIATOR_SRCS) $(FW_BOOT_SRCS) \ + iscsistart.o statics.o diff --git a/sys-block/open-iscsi/files/open-iscsi-2.0.872-ldflags.patch b/sys-block/open-iscsi/files/open-iscsi-2.0.872-ldflags.patch new file mode 100644 index 000000000000..fc02cbcc1ec4 --- /dev/null +++ b/sys-block/open-iscsi/files/open-iscsi-2.0.872-ldflags.patch @@ -0,0 +1,11 @@ +--- utils/Makefile 2011-05-31 01:30:27.302609540 +0200 ++++ utils/Makefile 2011-05-31 01:32:50.229602790 +0200 +@@ -6,7 +6,7 @@ + all: $(PROGRAMS) + + iscsi-iname: md5.o iscsi-iname.o +- $(CC) $(CFLAGS) $^ $(DBM_LIB) -o $@ ++ $(CC) $(CFLAGS) $(LDFLAGS) $^ $(DBM_LIB) -o $@ + + clean: + rm -f *.o $(PROGRAMS) .depend diff --git a/sys-block/open-iscsi/files/open-iscsi-2.0.872-makefile-cleanup-pass2.patch b/sys-block/open-iscsi/files/open-iscsi-2.0.872-makefile-cleanup-pass2.patch new file mode 100644 index 000000000000..fb563d10e1bc --- /dev/null +++ b/sys-block/open-iscsi/files/open-iscsi-2.0.872-makefile-cleanup-pass2.patch @@ -0,0 +1,55 @@ +diff -NuarwbB open-iscsi-2.0-872/usr/Makefile open-iscsi-2.0-872.orig/usr/Makefile +--- open-iscsi-2.0-872.orig/usr/Makefile 2012-02-09 08:58:04.402623915 +0000 ++++ open-iscsi-2.0-872/usr/Makefile 2012-02-09 08:56:51.159070006 +0000 +@@ -65,6 +65,6 @@ + rm -f *.o $(PROGRAMS) .depend $(LIBSYS) + + depend: ++ $(CC) $(CFLAGS) -M `ls *.c` > .depend +- gcc $(CFLAGS) -M `ls *.c` > .depend + + -include .depend +diff -NuarwbB open-iscsi-2.0-872/utils/fwparam_ibft/Makefile open-iscsi-2.0-872.orig/utils/fwparam_ibft/Makefile +--- open-iscsi-2.0-872.orig/utils/fwparam_ibft/Makefile 2012-02-09 08:57:58.579273051 +0000 ++++ open-iscsi-2.0-872/utils/fwparam_ibft/Makefile 2010-08-11 15:27:07.000000000 +0000 +@@ -38,6 +38,6 @@ + $(OBJS): prom_parse.tab.h prom_parse.h fwparam_ibft.h + + depend: ++ $(CC) $(CFLAGS) -M `ls *.c` > .depend +- gcc $(CFLAGS) -M `ls *.c` > .depend + + -include .depend +diff -NuarwbB open-iscsi-2.0-872/utils/Makefile open-iscsi-2.0-872.orig/utils/Makefile +--- open-iscsi-2.0-872.orig/utils/Makefile 2012-02-09 08:57:37.825877235 +0000 ++++ open-iscsi-2.0-872/utils/Makefile 2012-02-09 08:56:51.145736633 +0000 +@@ -12,6 +12,6 @@ + rm -f *.o $(PROGRAMS) .depend + + depend: ++ $(CC) $(CFLAGS) -M `ls *.c` > .depend +- gcc $(CFLAGS) -M `ls *.c` > .depend + + -include .depend +diff -NuarwbB open-iscsi-2.0-872/utils/open-isns/Makefile.in open-iscsi-2.0-872.orig/utils/open-isns/Makefile.in +--- open-iscsi-2.0-872.orig/utils/open-isns/Makefile.in 2012-02-09 08:57:47.812573971 +0000 ++++ open-iscsi-2.0-872/utils/open-isns/Makefile.in 2010-08-11 15:27:07.000000000 +0000 +@@ -77,6 +77,6 @@ + ar cr $@ $(LIBOBJS) + + depend: ++ $(CC) $(CFLAGS) -M `ls *.c` > .depend +- gcc $(CFLAGS) -M `ls *.c` > .depend + + -include .depend +diff -NuarwbB open-iscsi-2.0-872/utils/sysdeps/Makefile open-iscsi-2.0-872.orig/utils/sysdeps/Makefile +--- open-iscsi-2.0-872.orig/utils/sysdeps/Makefile 2012-02-09 08:57:43.459227530 +0000 ++++ open-iscsi-2.0-872/utils/sysdeps/Makefile 2010-08-11 15:27:07.000000000 +0000 +@@ -10,6 +10,6 @@ + rm -f *.o .depend + + depend: ++ $(CC) $(CFLAGS) -M `ls *.c` > .depend +- gcc $(CFLAGS) -M `ls *.c` > .depend + + -include .depend diff --git a/sys-block/open-iscsi/files/open-iscsi-2.0.872-makefile-cleanup.patch b/sys-block/open-iscsi/files/open-iscsi-2.0.872-makefile-cleanup.patch new file mode 100644 index 000000000000..b3e93f459fc2 --- /dev/null +++ b/sys-block/open-iscsi/files/open-iscsi-2.0.872-makefile-cleanup.patch @@ -0,0 +1,20 @@ +--- usr/Makefile 2010-10-10 22:48:04.000000000 +0200 ++++ usr/Makefile.ori 2010-10-10 22:48:34.000000000 +0200 +@@ -53,14 +53,14 @@ + + iscsid: $(ISCSI_LIB_SRCS) $(IPC_OBJ) $(INITIATOR_SRCS) $(DISCOVERY_SRCS) \ + iscsid.o session_mgmt.o discoveryd.o +- $(CC) $(CFLAGS) $^ -o $@ -L../utils/open-isns -lisns -lcrypto ++ $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ -L../utils/open-isns -lisns -lcrypto + + iscsiadm: $(ISCSI_LIB_SRCS) $(DISCOVERY_SRCS) iscsiadm.o session_mgmt.o +- $(CC) $(CFLAGS) $^ -o $@ -L../utils/open-isns -lisns -lcrypto ++ $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ -L../utils/open-isns -lisns -lcrypto + + iscsistart: $(IPC_OBJ) $(ISCSI_LIB_SRCS) $(INITIATOR_SRCS) $(FW_BOOT_SRCS) \ + iscsistart.o statics.o +- $(CC) $(CFLAGS) -static $^ -o $@ ++ $(CC) $(CFLAGS) -static $(LDFLAGS) $^ -o $@ + clean: + rm -f *.o $(PROGRAMS) .depend $(LIBSYS) + diff --git a/sys-block/open-iscsi/files/open-iscsi-2.0.873-Makefiles.patch b/sys-block/open-iscsi/files/open-iscsi-2.0.873-Makefiles.patch new file mode 100644 index 000000000000..db5d6d14ec5a --- /dev/null +++ b/sys-block/open-iscsi/files/open-iscsi-2.0.873-Makefiles.patch @@ -0,0 +1,161 @@ +diff --git a/Makefile b/Makefile +index c5d9700..4dbff18 100644 +--- a/Makefile ++++ b/Makefile +@@ -14,8 +14,8 @@ mandir = $(prefix)/share/man + etcdir = /etc + initddir = $(etcdir)/init.d + +-MANPAGES = doc/iscsid.8 doc/iscsiadm.8 doc/iscsi_discovery.8 +-PROGRAMS = usr/iscsid usr/iscsiadm utils/iscsi_discovery utils/iscsi-iname ++MANPAGES = doc/iscsid.8 doc/iscsiadm.8 doc/iscsi_discovery.8 doc/iscsistart.8 doc/iscsi-iname.8 ++PROGRAMS = usr/iscsid usr/iscsiadm utils/iscsi_discovery utils/iscsi-iname usr/iscsistart + INSTALL = install + ETCFILES = etc/iscsid.conf + IFACEFILES = etc/iface.example +@@ -84,11 +84,11 @@ install_programs: $(PROGRAMS) + # ugh, auto-detection is evil + # Gentoo maintains their own init.d stuff + install_initd: +- if [ -f /etc/debian_version ]; then \ ++ if [ -f $(DESTDIR)$(etcdir)/debian_version ]; then \ + $(MAKE) install_initd_debian ; \ +- elif [ -f /etc/redhat-release ]; then \ ++ elif [ -f $(DESTDIR)$(etcdir)/redhat-release ]; then \ + $(MAKE) install_initd_redhat ; \ +- elif [ -f /etc/SuSE-release ]; then \ ++ elif [ -f $(DESTDIR)$(etcdir)/SuSE-release ]; then \ + $(MAKE) install_initd_suse ; \ + fi + +@@ -115,7 +115,7 @@ install_iface: $(IFACEFILES) + $(INSTALL) -m 644 $^ $(DESTDIR)$(etcdir)/iscsi/ifaces + + install_etc: $(ETCFILES) +- if [ ! -f /etc/iscsi/iscsid.conf ]; then \ ++ if [ ! -f $(DESTDIR)$(etcdir)/iscsi/iscsid.conf ]; then \ + $(INSTALL) -d $(DESTDIR)$(etcdir)/iscsi ; \ + $(INSTALL) -m 644 $^ $(DESTDIR)$(etcdir)/iscsi ; \ + fi +@@ -128,11 +128,11 @@ install_kernel: + $(MAKE) -C kernel install_kernel + + install_iname: +- if [ ! -f /etc/iscsi/initiatorname.iscsi ]; then \ +- echo "InitiatorName=`$(DESTDIR)/sbin/iscsi-iname`" > $(DESTDIR)/etc/iscsi/initiatorname.iscsi ; \ ++ if [ ! -f $(DESTDIR)$(etcdir)/iscsi/initiatorname.iscsi ]; then \ ++ echo "InitiatorName=`$(DESTDIR)$(sbindir)/iscsi-iname`" > $(DESTDIR)$(etcdir)/iscsi/initiatorname.iscsi ; \ + echo "***************************************************" ; \ +- echo "Setting InitiatorName to `cat $(DESTDIR)/etc/iscsi/initiatorname.iscsi`" ; \ +- echo "To override edit /etc/iscsi/initiatorname.iscsi" ; \ ++ echo "Setting InitiatorName to `cat $(DESTDIR)$(etcdir)/iscsi/initiatorname.iscsi`" ; \ ++ echo "To override edit $(etcdir)/iscsi/initiatorname.iscsi" ; \ + echo "***************************************************" ; \ + fi + +diff --git a/usr/Makefile b/usr/Makefile +index 673b7f1..83507f3 100644 +--- a/usr/Makefile ++++ b/usr/Makefile +@@ -54,18 +54,18 @@ all: $(PROGRAMS) + + iscsid: $(ISCSI_LIB_SRCS) $(INITIATOR_SRCS) $(DISCOVERY_SRCS) \ + iscsid.o session_mgmt.o discoveryd.o +- $(CC) $(CFLAGS) $^ -o $@ -L../utils/open-isns -lisns ++ $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ -L../utils/open-isns -lisns + + iscsiadm: $(ISCSI_LIB_SRCS) $(DISCOVERY_SRCS) iscsiadm.o session_mgmt.o +- $(CC) $(CFLAGS) $^ -o $@ -L../utils/open-isns -lisns ++ $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ -L../utils/open-isns -lisns + + iscsistart: $(ISCSI_LIB_SRCS) $(INITIATOR_SRCS) $(FW_BOOT_SRCS) \ + iscsistart.o statics.o +- $(CC) $(CFLAGS) -static $^ -o $@ ++ $(CC) $(CFLAGS) -static $(LDFLAGS) $^ -o $@ + clean: +- rm -f *.o $(PROGRAMS) .depend $(LIBSYS) ++ $(RM) *.o $(PROGRAMS) .depend $(LIBSYS) + + depend: +- gcc $(CFLAGS) -M `ls *.c` > .depend ++ $(CC) $(CFLAGS) -M `ls *.c` > .depend + + -include .depend +diff --git a/utils/Makefile b/utils/Makefile +index 2c7e891..62c49fa 100644 +--- a/utils/Makefile ++++ b/utils/Makefile +@@ -1,17 +1,18 @@ + # This Makefile will work only with GNU make. + +-CFLAGS += $(OPTFLAGS) -O2 -fno-inline -Wall -Wstrict-prototypes -g ++OPTFLAGS ?= -O2 -g ++CFLAGS += $(OPTFLAGS) -fno-inline -Wall -Wstrict-prototypes + PROGRAMS = iscsi-iname + + all: $(PROGRAMS) + + iscsi-iname: md5.o iscsi-iname.o +- $(CC) $(CFLAGS) $^ $(DBM_LIB) -o $@ ++ $(CC) $(CFLAGS) $(LDFLAGS) $^ $(DBM_LIB) -o $@ + + clean: +- rm -f *.o $(PROGRAMS) .depend ++ $(RM) *.o $(PROGRAMS) .depend + + depend: +- gcc $(CFLAGS) -M `ls *.c` > .depend ++ $(GCC) $(CFLAGS) -M `ls *.c` > .depend + + -include .depend +diff --git a/utils/fwparam_ibft/Makefile b/utils/fwparam_ibft/Makefile +index c72bb7f..a36c2d2 100644 +--- a/utils/fwparam_ibft/Makefile ++++ b/utils/fwparam_ibft/Makefile +@@ -26,18 +26,18 @@ OBJS := fw_entry.o fwparam_sysfs.o $(SYSDEPS_OBJS) ../../usr/iscsi_net_util.o + OBJS += prom_lex.o prom_parse.tab.o fwparam_ppc.o + CLEANFILES = $(OBJS) *.output *~ + +-OPTFLAGS ?= -O2 -g -fPIC ++OPTFLAGS ?= -O2 -g + WARNFLAGS ?= -Wall -Wstrict-prototypes +-CFLAGS += $(OPTFLAGS) $(WARNFLAGS) -I../../include -I../../usr -D_GNU_SOURCE ++CFLAGS += $(OPTFLAGS) $(WARNFLAGS) -fPIC -I../../include -I../../usr -D_GNU_SOURCE + + all: $(OBJS) + + clean: +- rm -f *.o $(CLEANFILES) .depend ++ $(RM) *.o $(CLEANFILES) .depend + + $(OBJS): prom_parse.tab.h prom_parse.h fwparam_ibft.h + + depend: +- gcc $(CFLAGS) -M `ls *.c` > .depend ++ $(CC) $(CFLAGS) -M `ls *.c` > .depend + + -include .depend +diff --git a/utils/sysdeps/Makefile b/utils/sysdeps/Makefile +index 53c10e5..19cfe19 100644 +--- a/utils/sysdeps/Makefile ++++ b/utils/sysdeps/Makefile +@@ -1,15 +1,16 @@ + # This Makefile will work only with GNU make. + +-CFLAGS += $(OPTFLAGS) $(WARNFLAGS) -O2 -fno-inline -Wall -Wstrict-prototypes -g ++OPTFLAGS ?= -O2 -g ++CFLAGS += $(OPTFLAGS) $(WARNFLAGS) -fno-inline -Wall -Wstrict-prototypes + + SYSDEPS_OBJS=sysdeps.o + + all: $(SYSDEPS_OBJS) + + clean: +- rm -f *.o .depend ++ $(RM) *.o .depend + + depend: +- gcc $(CFLAGS) -M `ls *.c` > .depend ++ $(CC) $(CFLAGS) -M `ls *.c` > .depend + + -include .depend diff --git a/sys-block/open-iscsi/files/open-iscsi-2.0.873-memset.patch b/sys-block/open-iscsi/files/open-iscsi-2.0.873-memset.patch new file mode 100644 index 000000000000..c56669192f09 --- /dev/null +++ b/sys-block/open-iscsi/files/open-iscsi-2.0.873-memset.patch @@ -0,0 +1,24 @@ +clear the size of the storage, not the size of the pointer + +--- a/usr/md5.c ++++ b/usr/md5.c +@@ -127,7 +127,7 @@ MD5Final(md5byte digest[16], struct MD5Context *ctx) + + byteSwap(ctx->buf, 4); + memcpy(digest, ctx->buf, 16); +- memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */ ++ memset(ctx, 0, sizeof(*ctx)); /* In case it's sensitive */ + } + + #ifndef ASM_MD5 +--- a/utils/md5.c ++++ b/utils/md5.c +@@ -133,7 +133,7 @@ MD5Final(md5byte digest[16], struct MD5Context *ctx) + + byteSwap(ctx->buf, 4); + memcpy(digest, ctx->buf, 16); +- memset(ctx, 0, sizeof (ctx)); /* In case it's sensitive */ ++ memset(ctx, 0, sizeof (*ctx)); /* In case it's sensitive */ + } + + #ifndef ASM_MD5 diff --git a/sys-block/open-iscsi/files/open-iscsi-2.0.874-Makefiles.patch b/sys-block/open-iscsi/files/open-iscsi-2.0.874-Makefiles.patch new file mode 100644 index 000000000000..33c5d8a960d0 --- /dev/null +++ b/sys-block/open-iscsi/files/open-iscsi-2.0.874-Makefiles.patch @@ -0,0 +1,116 @@ +diff -dur a/Makefile b/Makefile +--- a/Makefile 2016-09-29 13:33:24.000000000 -0500 ++++ b/Makefile 2017-01-02 11:25:04.606549073 -0600 +@@ -14,8 +14,8 @@ + etcdir = /etc + initddir = $(etcdir)/init.d + +-MANPAGES = doc/iscsid.8 doc/iscsiadm.8 doc/iscsi_discovery.8 iscsiuio/docs/iscsiuio.8 +-PROGRAMS = usr/iscsid usr/iscsiadm utils/iscsi_discovery utils/iscsi-iname iscsiuio/src/unix/iscsiuio ++MANPAGES = doc/iscsid.8 doc/iscsiadm.8 doc/iscsi_discovery.8 doc/iscsistart.8 doc/iscsi-iname.8 ++PROGRAMS = usr/iscsid usr/iscsiadm utils/iscsi_discovery utils/iscsi-iname usr/iscsistart + INSTALL = install + ETCFILES = etc/iscsid.conf + IFACEFILES = etc/iface.example +@@ -99,11 +99,11 @@ + # ugh, auto-detection is evil + # Gentoo maintains their own init.d stuff + install_initd: +- if [ -f /etc/debian_version ]; then \ ++ if [ -f $(DESTDIR)$(etcdir)/debian_version ]; then \ + $(MAKE) install_initd_debian ; \ +- elif [ -f /etc/redhat-release ]; then \ ++ elif [ -f $(DESTDIR)$(etcdir)/redhat-release ]; then \ + $(MAKE) install_initd_redhat ; \ +- elif [ -f /etc/SuSE-release ]; then \ ++ elif [ -f $(DESTDIR)$(etcdir)/SuSE-release ]; then \ + $(MAKE) install_initd_suse ; \ + fi + +@@ -130,7 +130,7 @@ + $(INSTALL) -m 644 $^ $(DESTDIR)$(etcdir)/iscsi/ifaces + + install_etc: $(ETCFILES) +- if [ ! -f $(DESTDIR)/etc/iscsi/iscsid.conf ]; then \ ++ if [ ! -f $(DESTDIR)$(etcdir)/iscsi/iscsid.conf ]; then \ + $(INSTALL) -d $(DESTDIR)$(etcdir)/iscsi ; \ + $(INSTALL) -m 644 $^ $(DESTDIR)$(etcdir)/iscsi ; \ + fi +@@ -143,11 +143,11 @@ + $(MAKE) -C kernel install_kernel + + install_iname: +- if [ ! -f $(DESTDIR)/etc/iscsi/initiatorname.iscsi ]; then \ +- echo "InitiatorName=`$(DESTDIR)/sbin/iscsi-iname`" > $(DESTDIR)/etc/iscsi/initiatorname.iscsi ; \ ++ if [ ! -f $(DESTDIR)$(etcdir)/iscsi/initiatorname.iscsi ]; then \ ++ echo "InitiatorName=`$(DESTDIR)$(sbindir)/iscsi-iname`" > $(DESTDIR)$(etcdir)/iscsi/initiatorname.iscsi ; \ + echo "***************************************************" ; \ +- echo "Setting InitiatorName to `cat $(DESTDIR)/etc/iscsi/initiatorname.iscsi`" ; \ +- echo "To override edit $(DESTDIR)/etc/iscsi/initiatorname.iscsi" ; \ ++ echo "Setting InitiatorName to `cat $(DESTDIR)$(etcdir)/iscsi/initiatorname.iscsi`" ; \ ++ echo "To override edit $(etcdir)/iscsi/initiatorname.iscsi" ; \ + echo "***************************************************" ; \ + fi + +diff -dur a/usr/Makefile b/usr/Makefile +--- a/usr/Makefile 2016-09-29 13:33:24.000000000 -0500 ++++ b/usr/Makefile 2017-01-02 11:27:55.417297639 -0600 +@@ -63,9 +63,9 @@ + iscsistart.o statics.o + $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ -lrt + clean: +- rm -f *.o $(PROGRAMS) .depend $(LIBSYS) ++ $(RM) *.o $(PROGRAMS) .depend $(LIBSYS) + + depend: +- gcc $(CFLAGS) -M `ls *.c` > .depend ++ $(CC) $(CFLAGS) -M `ls *.c` > .depend + + -include .depend +diff -dur a/utils/fwparam_ibft/Makefile b/utils/fwparam_ibft/Makefile +--- a/utils/fwparam_ibft/Makefile 2016-09-29 13:33:24.000000000 -0500 ++++ b/utils/fwparam_ibft/Makefile 2017-01-02 11:30:42.358440507 -0600 +@@ -33,11 +33,11 @@ + all: $(OBJS) + + clean: +- rm -f *.o $(CLEANFILES) .depend ++ $(RM) *.o $(CLEANFILES) .depend + + $(OBJS): prom_parse.tab.h prom_parse.h fwparam_ibft.h + + depend: +- gcc $(CFLAGS) -M `ls *.c` > .depend ++ $(CC) $(CFLAGS) -M `ls *.c` > .depend + + -include .depend +diff -dur a/utils/Makefile b/utils/Makefile +--- a/utils/Makefile 2016-09-29 13:33:24.000000000 -0500 ++++ b/utils/Makefile 2017-01-02 11:29:24.193611039 -0600 +@@ -10,9 +10,9 @@ + $(CC) $(CFLAGS) $(LDFLAGS) $^ $(DBM_LIB) -o $@ + + clean: +- rm -f *.o $(PROGRAMS) .depend ++ $(RM) *.o $(PROGRAMS) .depend + + depend: +- gcc $(CFLAGS) -M `ls *.c` > .depend ++ $(GCC) $(CFLAGS) -M `ls *.c` > .depend + + -include .depend +diff -dur a/utils/sysdeps/Makefile b/utils/sysdeps/Makefile +--- a/utils/sysdeps/Makefile 2016-09-29 13:33:24.000000000 -0500 ++++ b/utils/sysdeps/Makefile 2017-01-02 11:31:24.219926338 -0600 +@@ -8,9 +8,9 @@ + all: $(SYSDEPS_OBJS) + + clean: +- rm -f *.o .depend ++ $(RM) *.o .depend + + depend: +- gcc $(CFLAGS) -M `ls *.c` > .depend ++ $(CC) $(CFLAGS) -M `ls *.c` > .depend + + -include .depend diff --git a/sys-block/open-iscsi/files/open-iscsi-2.0.874-musl-ethtool-compat.patch b/sys-block/open-iscsi/files/open-iscsi-2.0.874-musl-ethtool-compat.patch new file mode 100644 index 000000000000..12b82c71405c --- /dev/null +++ b/sys-block/open-iscsi/files/open-iscsi-2.0.874-musl-ethtool-compat.patch @@ -0,0 +1,69 @@ +From: Anthony G. Basiel <blueness@gentoo.org> + +diff -Naur open-iscsi-2.0.874.orig/iscsiuio/src/unix/libs/bnx2x.c open-iscsi-2.0.874/iscsiuio/src/unix/libs/bnx2x.c +--- open-iscsi-2.0.874.orig/iscsiuio/src/unix/libs/bnx2x.c 2016-09-29 18:33:24.000000000 +0000 ++++ open-iscsi-2.0.874/iscsiuio/src/unix/libs/bnx2x.c 2017-01-03 21:45:47.504035833 +0000 +@@ -42,7 +42,7 @@ + #include <arpa/inet.h> + #include <linux/types.h> /* Needed for linux/ethtool.h on RHEL 5.x */ + #include <linux/sockios.h> +-#include <linux/ethtool.h> ++#include "ethtool-compat.h" + #include <sys/mman.h> + #include <sys/ioctl.h> + #include <sys/types.h> +diff -Naur open-iscsi-2.0.874.orig/iscsiuio/src/unix/libs/ethtool-compat.h open-iscsi-2.0.874/iscsiuio/src/unix/libs/ethtool-compat.h +--- open-iscsi-2.0.874.orig/iscsiuio/src/unix/libs/ethtool-compat.h 1970-01-01 00:00:00.000000000 +0000 ++++ open-iscsi-2.0.874/iscsiuio/src/unix/libs/ethtool-compat.h 2017-01-03 21:45:23.016034980 +0000 +@@ -0,0 +1,51 @@ ++/* ++ * ethtool-compat.h: adopted from ++ # ethtool.h: Defines for Linux ethtool. ++ * ++ * Copyright (C) 1998 David S. Miller (davem@redhat.com) ++ * Copyright 2001 Jeff Garzik <jgarzik@pobox.com> ++ * Portions Copyright 2001 Sun Microsystems (thockin@sun.com) ++ * Portions Copyright 2002 Intel (eli.kupermann@intel.com, ++ * christopher.leech@intel.com, ++ * scott.feldman@intel.com) ++ * Portions Copyright (C) Sun Microsystems 2008 ++ */ ++ ++#include <linux/types.h> ++#include <netinet/if_ether.h> ++ ++#define ETHTOOL_FWVERS_LEN 32 ++#define ETHTOOL_BUSINFO_LEN 32 ++#define ETHTOOL_EROMVERS_LEN 32 ++ ++struct ethtool_drvinfo { ++ __u32 cmd; ++ char driver[32]; ++ char version[32]; ++ char fw_version[ETHTOOL_FWVERS_LEN]; ++ char bus_info[ETHTOOL_BUSINFO_LEN]; ++ char erom_version[ETHTOOL_EROMVERS_LEN]; ++ char reserved2[12]; ++ __u32 n_priv_flags; ++ __u32 n_stats; ++ __u32 testinfo_len; ++ __u32 eedump_len; ++ __u32 regdump_len; ++}; ++ ++struct ethtool_tcpip4_spec { ++ __be32 ip4src; ++ __be32 ip4dst; ++ __be16 psrc; ++ __be16 pdst; ++ __u8 tos; ++}; ++ ++struct ethtool_ah_espip4_spec { ++ __be32 ip4src; ++ __be32 ip4dst; ++ __be32 spi; ++ __u8 tos; ++}; ++ ++#define ETHTOOL_GDRVINFO 0x00000003 /* Get driver info. */ diff --git a/sys-block/open-iscsi/files/open-iscsi-2.0.874-musl-fixes.patch b/sys-block/open-iscsi/files/open-iscsi-2.0.874-musl-fixes.patch new file mode 100644 index 000000000000..cf8b76210b99 --- /dev/null +++ b/sys-block/open-iscsi/files/open-iscsi-2.0.874-musl-fixes.patch @@ -0,0 +1,51 @@ +--- ./utils/fwparam_ibft/fwparam_ppc.c 2016-09-29 13:33:24.000000000 -0500 ++++ ./utils/fwparam_ibft/fwparam_ppc.c 2017-01-02 11:37:32.738351217 -0600 +@@ -356,7 +356,7 @@ + * Sort the nics into "natural" order. The proc fs + * device-tree has them in somewhat random, or reversed order. + */ +- qsort(niclist, nic_count, sizeof(char *), (__compar_fn_t)nic_cmp); ++ qsort(niclist, nic_count, sizeof(char *), (int (*)(const void *, const void *))nic_cmp); + + snprintf(prefix, sizeof(prefix), "%s/%s", devtree, "aliases"); + dev_count = 0; +--- ./usr/idbm.c.orig ++++ ./usr/idbm.c +@@ -25,6 +25,7 @@ + #include <stdlib.h> + #include <string.h> + #include <errno.h> ++#include <fcntl.h> + #include <dirent.h> + #include <limits.h> + #include <sys/stat.h> +--- a/usr/iscsiadm.c 2016-09-29 13:33:24.000000000 -0500 ++++ b/usr/iscsiadm.c 2017-01-02 11:46:37.643506953 -0600 +@@ -3262,6 +3262,7 @@ + int tpgt = PORTAL_GROUP_TAG_UNKNOWN, killiscsid=-1, do_show=0; + int packet_size=32, ping_count=1, ping_interval=0; + int do_discover = 0, sub_mode = -1; ++ int argerror = 0; + int portal_type = -1; + struct sigaction sa_old; + struct sigaction sa_new; +@@ -3426,6 +3427,9 @@ + break; + case 'h': + usage(0); ++ case '?': ++ log_error("unrecognized character '%c'", optopt); ++ argerror = 1; + } + + if (name && value) { +@@ -3441,8 +3445,7 @@ + } + } + +- if (optopt) { +- log_error("unrecognized character '%c'", optopt); ++ if (argerror) { + rc = ISCSI_ERR_INVAL; + goto free_ifaces; + } |