Skip to content

Commit 655c65e

Browse files
Charles Rosejohannbg
Charles Rose
authored andcommitted
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 <[email protected]>
1 parent 4afdcba commit 655c65e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@ validate_ip_conn() {
4040
return 1
4141
fi
4242

43-
ifname=$(ip -o route get to "$local_address" | sed -n 's/.*dev \([^ ]*\).*/\1/p')
43+
ifname=$(ip -o route get from "$local_address" to "$traddr" | sed -n 's/.*dev \([^ ]*\).*/\1/p')
4444

45-
if ip l show "$ifname" > /dev/null 2>&1; then
45+
if ! ip l show "$ifname" > /dev/null 2>&1; then
4646
warn "invalid network interface $ifname"
4747
return 1
4848
fi
4949

5050
# confirm there's a route to destination
51-
if ip route get "$traddr" > /dev/null 2>&1; then
51+
if ! ip route get "$traddr" > /dev/null 2>&1; then
5252
warn "no route to $traddr"
5353
return 1
5454
fi

0 commit comments

Comments
 (0)