]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
fix(nvmf): don't try to validate network connections in cmdline hook
authorMartin Wilck <mwilck@suse.com>
Fri, 16 Sep 2022 21:46:42 +0000 (23:46 +0200)
committerJóhann B. Guðmundsson <johannbg@gmail.com>
Fri, 30 Sep 2022 06:02:18 +0000 (06:02 +0000)
The cmdline hook runs before any network interfaces have been brought
up. There's no point in trying to validate the connections at this
stage.

modules.d/95nvmf/parse-nvmf-boot-connections.sh

index 46c006369171ef1fd93b2bac62aa9047bebce0d7..399235034ac75297cad83ae0ee294014bea786e9 100755 (executable)
@@ -26,34 +26,6 @@ fi
 
 initqueue --onetime modprobe --all -b -q nvme nvme_tcp nvme_core nvme_fabrics
 
-validate_ip_conn() {
-    if ! getargbool 0 rd.neednet; then
-        warn "$trtype transport requires rd.neednet=1"
-        return 1
-    fi
-
-    local_address=$(ip -o route get to "$traddr" | sed -n 's/.*src \([0-9a-f.:]*\).*/\1/p')
-
-    # confirm we got a local IP address
-    if ! is_ip "$local_address"; then
-        warn "$traddr is an invalid address"
-        return 1
-    fi
-
-    ifname=$(ip -o route get from "$local_address" to "$traddr" | sed -n 's/.*dev \([^ ]*\).*/\1/p')
-
-    if ! ip l show "$ifname" > /dev/null 2>&1; then
-        warn "invalid network interface $ifname"
-        return 1
-    fi
-
-    # confirm there's a route to destination
-    if ! ip route get "$traddr" > /dev/null 2>&1; then
-        warn "no route to $traddr"
-        return 1
-    fi
-}
-
 parse_nvmf_discover() {
     traddr="none"
     trtype="none"
@@ -103,9 +75,6 @@ parse_nvmf_discover() {
         warn "unsupported transport $trtype"
         return 0
     fi
-    if [ "$trtype" = "tcp" ]; then
-        validate_ip_conn
-    fi
     if [ "$trtype" = "fc" ]; then
         echo "--transport=$trtype --traddr=$traddr --host-traddr=$hosttraddr" >> /etc/nvme/discovery.conf
     else