Now the dracut does not have enough info to setup the ipv6 to connect
the iscsi target in the 2nd kernel, if the iscsi connecting is ipv6
protocal.
For this patch, we will parse the iscsi connecting, pass the config to
the dracut to setup the ipv6 in the 2nd kernel.
Signed-off-by: Minfei Huang <mhuang(a)redhat.com>
---
dracut-module-setup.sh | 25 ++++++++++++++++++++-----
1 file changed, 20 insertions(+), 5 deletions(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index 1a1f03e..6ed1034 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -480,6 +480,7 @@ kdump_get_iscsi_initiator() {
kdump_setup_iscsi_device() {
local path=$1
local tgt_name; local tgt_ipaddr;
+ local _srcaddr _prefix _netdev
local username; local password; local userpwd_str;
local username_in; local password_in; local userpwd_in_str;
local netdev
@@ -517,19 +518,33 @@ kdump_setup_iscsi_device() {
[ -n "$username_in" ] &&
userpwd_in_str=":$username_in:$password_in"
- netdev=$(/sbin/ip route get to ${tgt_ipaddr} | \
- sed 's|.*dev \(.*\).*|\1|g')
+ if is_ipv6_address $tgt_ipaddr; then
+ netdev=$(/sbin/ip -6 route get to $(get_remote_host $tgt_ipaddr) | \
+ sed 's|.*dev \(.*\).*|\1|g')
+ else
+ netdev=$(/sbin/ip route get to ${tgt_ipaddr} | \
+ sed 's|.*dev \(.*\).*|\1|g')
+ fi
srcaddr=$(echo $netdev | awk '{ print $3; exit }')
netdev=$(echo $netdev | awk '{ print $1; exit }')
- kdump_setup_netdev $netdev $srcaddr $tgt_ipaddr
+ kdump_setup_netdev $netdev $srcaddr $(get_remote_host $tgt_ipaddr)
# prepare netroot= command line
- # FIXME: IPV6 addresses require explicit [] around $tgt_ipaddr
# FIXME: Do we need to parse and set other parameters like protocol, port
# iscsi_iface_name, netdev_name, LUN etc.
-
netroot_str="netroot=iscsi:${userpwd_str}${userpwd_in_str}@$tgt_ipaddr::::$tgt_name"
+ if is_ipv6_address $tgt_ipaddr; then
+ if `echo $tgt_ipaddr | grep -q "%"`; then
+ _prefix=${tgt_ipaddr%\%*}
+ _netdev=${tgt_ipaddr#*\%}
+ _netdev=$(kdump_setup_ifname $_netdev)
+ tgt_ipaddr=$_prefix%$_netdev
+ fi
+
netroot_str="netroot=iscsi:${userpwd_str}${userpwd_in_str}@[$tgt_ipaddr]::::$tgt_name"
+ else
+
netroot_str="netroot=iscsi:${userpwd_str}${userpwd_in_str}@$tgt_ipaddr::::$tgt_name"
+ fi
[[ -f $netroot_conf ]] || touch $netroot_conf
--
2.2.2