]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
fix(nvmf): validate_ip_conn
authorCharles Rose <charles.rose@dell.com>
Mon, 23 Aug 2021 14:14:16 +0000 (09:14 -0500)
committerJóhann B. Guðmundsson <johannbg@gmail.com>
Mon, 23 Aug 2021 20:20:11 +0000 (20:20 +0000)
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>
modules.d/95nvmf/parse-nvmf-boot-connections.sh

index 0822bec916c15f38e8eb29420d4ce4afc3a22685..ae80c13296592c59e53ae6653a69210b045180d9 100755 (executable)
@@ -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