From 655c65e6ced00e7a80c41e96c5f6fe108da07839 Mon Sep 17 00:00:00 2001 From: Charles Rose Date: Mon, 23 Aug 2021 09:14:16 -0500 Subject: [PATCH] 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 --- modules.d/95nvmf/parse-nvmf-boot-connections.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules.d/95nvmf/parse-nvmf-boot-connections.sh b/modules.d/95nvmf/parse-nvmf-boot-connections.sh index 0822bec916..ae80c13296 100755 --- a/modules.d/95nvmf/parse-nvmf-boot-connections.sh +++ b/modules.d/95nvmf/parse-nvmf-boot-connections.sh @@ -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