Browse Source

fix(nvmf): validate_ip_conn

Fix how ifname for a given local_address is found.
Fix logic to detect presence of ifname and route.

Signed-off-by: Charles Rose <charles.rose@dell.com>
master
Charles Rose 3 years ago committed by Jóhann B. Guðmundsson
parent
commit
655c65e6ce
  1. 6
      modules.d/95nvmf/parse-nvmf-boot-connections.sh

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

@ -40,15 +40,15 @@ validate_ip_conn() { @@ -40,15 +40,15 @@ validate_ip_conn() {
return 1
fi

ifname=$(ip -o route get to "$local_address" | sed -n 's/.*dev \([^ ]*\).*/\1/p')
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
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
if ! ip route get "$traddr" > /dev/null 2>&1; then
warn "no route to $traddr"
return 1
fi

Loading…
Cancel
Save