Skip to content

Commit

Permalink
fix(nvmf): validate_ip_conn
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Charles Rose authored and johannbg committed Aug 23, 2021
1 parent 4afdcba commit 655c65e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions modules.d/95nvmf/parse-nvmf-boot-connections.sh
Expand Up @@ -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
Expand Down

0 comments on commit 655c65e

Please sign in to comment.