From bffbacba14e6deac8989bbec2c142cba47b067d6 Mon Sep 17 00:00:00 2001 From: Max Weiss Date: Sat, 1 May 2021 23:50:28 -0700 Subject: [PATCH] Fix failure to try second NIC when first NIC is present but has no connectivity --- embed.ipxe | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/embed.ipxe b/embed.ipxe index 3ff66cf..d243e76 100644 --- a/embed.ipxe +++ b/embed.ipxe @@ -89,6 +89,32 @@ goto boot_all ################# +:try_next_card +imgfree +ifclose +sleep 1 +# If dhcp, it will go to the static boot, which already has ifopen +iseq ip-info dhcp || ifopen +iseq ip-info dhcp || sleep 1 +iseq ip-info dhcp && clear ip-info && goto try_static_from_dhcp_fail || goto try_next_static_card + +:try_static_from_dhcp_fail +iseq arch-info arm64 && goto static_ip_boot_arm64 || +iseq arch-info amd64 && goto static_ip_boot_amd64 || +goto error_handler + +:try_next_static_card +isset ip-dev-name && clear ip-dev-name +isset ip-addr && clear ip-addr +isset ip-gateway && clear ip-gateway +isset ip-netmask && clear ip-netmask +isset ip-dns && clear ip-dns +isset successful && clear successful +set successful f +isset idx && inc idx || goto error_handler +goto loop + + # In case we want to... log?? Or do something else. :error_handler echo "###########################################################" @@ -160,7 +186,7 @@ goto static_ip_boot_setup # However, note that imgverify will fail if you refer to it as "/squashfs" # instead of "squashfs". -imgfetch http://images.sysdeploy.org/${ubuntu-variant}/${arch-info}/squashfs /squashfs || goto error_handler +imgfetch http://images.sysdeploy.org/${ubuntu-variant}/${arch-info}/squashfs /squashfs || goto try_next_card imgverify --signer images.sysdeploy.org squashfs http://images.sysdeploy.org/${ubuntu-variant}/${arch-info}/squashfs.sig || goto error_handler # "--signer" validates against the subject common name field of the signing @@ -172,10 +198,10 @@ imgverify --signer images.sysdeploy.org squashfs http://images.sysdeploy.org/${u # using a custom CA that you import during build. -initrd http://images.sysdeploy.org/${ubuntu-variant}/${arch-info}/boot-initrd || goto error_handler +initrd http://images.sysdeploy.org/${ubuntu-variant}/${arch-info}/boot-initrd || goto try_next_card imgverify --signer images.sysdeploy.org boot-initrd http://images.sysdeploy.org/${ubuntu-variant}/${arch-info}/boot-initrd.sig || goto error_handler -kernel http://images.sysdeploy.org/${ubuntu-variant}/${arch-info}/boot-kernel || goto error_handler +kernel http://images.sysdeploy.org/${ubuntu-variant}/${arch-info}/boot-kernel || goto try_next_card imgverify --signer images.sysdeploy.org boot-kernel http://images.sysdeploy.org/${ubuntu-variant}/${arch-info}/boot-kernel.sig || goto error_handler