Blob Blame History Raw
From 6dbae7e77238dd44bedb0ca2478f985f451c05bf Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.de>
Date: Fri, 10 Jul 2020 18:09:05 +0200
Subject: [PATCH] 95iscsi: use ip_params_for_remote_addr()

Use the new helper function.
---
 modules.d/95iscsi/module-setup.sh | 22 +---------------------
 1 file changed, 1 insertion(+), 21 deletions(-)

diff --git a/modules.d/95iscsi/module-setup.sh b/modules.d/95iscsi/module-setup.sh
index 8b6300d5..dfacd797 100755
--- a/modules.d/95iscsi/module-setup.sh
+++ b/modules.d/95iscsi/module-setup.sh
@@ -120,27 +120,7 @@ install_iscsiroot() {
     done
 
     [ -z "$iscsi_address" ] && return
-    local_address=$(ip -o route get to $iscsi_address | sed -n 's/.*src \([0-9a-f.:]*\).*/\1/p')
-    ifname=$(ip -o route get to $iscsi_address | sed -n 's/.*dev \([^ ]*\).*/\1/p')
-
-    # follow ifcfg settings for boot protocol
-    for _path in \
-        "/etc/sysconfig/network-scripts/ifcfg-$ifname" \
-        "/etc/sysconfig/network/ifcfg-$ifname" \
-    ; do
-        [ -f "$_path" ] && bootproto=$(sed -n "s/BOOTPROTO='\?\([[:alpha:]]*6\?\)4\?/\1/p" "$_path")
-    done
-
-    if [ $bootproto ]; then
-        printf 'ip=%s:%s ' ${ifname} ${bootproto}
-    else
-        printf 'ip=%s:static ' ${ifname}
-    fi
-
-    if [ -e /sys/class/net/$ifname/address ] ; then
-        ifmac=$(cat /sys/class/net/$ifname/address)
-        printf 'ifname=%s:%s ' ${ifname} ${ifmac}
-    fi
+    ip_params_for_remote_addr "$iscsi_address"
 
     if [ -n "$iscsi_address" -a -n "$iscsi_targetname" ] ; then
         if [ -n "$iscsi_port" -a "$iscsi_port" -eq 3260 ] ; then