From: Thomas Blume Date: Mon, 6 Jul 2020 13:16:35 +0000 (+0200) Subject: 95iscsi: fix ipv6 target discovery X-Git-Tag: 051~147 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3b869230a08088a4f51d5bde8d5cfc8497779815;p=thirdparty%2Fdracut.git 95iscsi: fix ipv6 target discovery ipv6 addresses need square brackets, otherwise the iscsi discovery and log-in, which adds the iscsi port after another colon will get confused and fail. --- diff --git a/modules.d/95iscsi/iscsiroot.sh b/modules.d/95iscsi/iscsiroot.sh index cc2ed2cc1..ac43b4871 100755 --- a/modules.d/95iscsi/iscsiroot.sh +++ b/modules.d/95iscsi/iscsiroot.sh @@ -213,6 +213,9 @@ handle_netroot() echo "iscsi_lun=$iscsi_lun . /bin/mount-lun.sh " > $hookdir/mount/01-$$-iscsi.sh fi + if strglobin $iscsi_target_ip '*:*:*' && ! strglobin $iscsi_target_ip '['; then + iscsi_target_ip="[$iscsi_target_ip]" + fi targets=$(iscsiadm -m discovery -t st -p $iscsi_target_ip:${iscsi_target_port:+$iscsi_target_port} | sed 's/^.*iqn/iqn/') [ -z "$targets" ] && echo "Target discovery to $iscsi_target_ip:${iscsi_target_port:+$iscsi_target_port} failed with status $?" && exit 1