Skip to content

Commit

Permalink
fix(nvmf): don't try to validate network connections in cmdline hook
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mwilck authored and johannbg committed Sep 30, 2022
1 parent 9664e98 commit b3ff3f3
Showing 1 changed file with 0 additions and 31 deletions.
31 changes: 0 additions & 31 deletions modules.d/95nvmf/parse-nvmf-boot-connections.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit b3ff3f3

Please sign in to comment.