]> git.ipfire.org Git - thirdparty/dracut-ng.git/commitdiff
fix(fcoe-uefi): exit early on empty vlan
authorPavel Valena <pvalena@redhat.com>
Sat, 12 Jul 2025 16:47:28 +0000 (12:47 -0400)
committerLaszlo <laszlo.gombos@gmail.com>
Tue, 29 Jul 2025 10:40:46 +0000 (06:40 -0400)
Exit early in case get_fcoe_boot_vlan exits with error or just an empty string,
instead of producing invalid config entry.

modules.d/74fcoe-uefi/parse-uefifcoe.sh

index e120dec3286857baf4bda8eeaa288cf4701e83d8..d582798043b8ecbfea5d3436bd47369914f25561 100755 (executable)
@@ -9,19 +9,21 @@ print_fcoe_uefi_conf() {
     mac=$(get_fcoe_boot_mac "$1")
     [ -z "$mac" ] && return 1
     dev=$(set_ifname fcoe "$mac")
-    vlan=$(get_fcoe_boot_vlan "$1")
-    if [ "$vlan" -ne "0" ]; then
-        case "$vlan" in
-            [0-9]*)
-                printf "%s\n" "vlan=$dev.$vlan:$dev"
-                dev="$dev.$vlan"
-                ;;
-            *)
-                printf "%s\n" "vlan=$vlan:$dev"
-                dev="$vlan"
-                ;;
-        esac
-    fi
+    vlan=$(get_fcoe_boot_vlan "$1") || return 1
+    case "$vlan" in
+        "0") ;;
+        '')
+            return 1
+            ;;
+        [0-9]*)
+            printf "%s\n" "vlan=$dev.$vlan:$dev"
+            dev="$dev.$vlan"
+            ;;
+        *)
+            printf "%s\n" "vlan=$vlan:$dev"
+            dev="$vlan"
+            ;;
+    esac
     # fcoe=eth0:nodcb
     printf "fcoe=%s\n" "$dev:nodcb"
     return 0