aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2025-02-17 13:11:28 +0000
committerMichael Brown <mcb30@ipxe.org>2025-02-17 13:30:27 +0000
commitb35300fc67cc050ce3f709a88a4437153d85e0ee (patch)
tree72f34e0da4d14bf26e5dfda7160912469aa13c67
parent8e6b914c53732b6764c344856787cf67dd44026c (diff)
downloadipxe-b35300fc67cc050ce3f709a88a4437153d85e0ee.tar.gz
[efi] Increase download timeout for autoexec.ipxe
In almost all cases, the download timeout for autoexec.ipxe is irrelevant: the operation will either succeed or fail relatively quickly (e.g. due to a nonexistent file). The overall download timeout exists only to ensure that an unattended or headless system will not wait indefinitely in the case of a degenerate network response (e.g. an HTTP server that returns an endless trickle of data using chunked transfer encoding without ever reaching the end of the file). The current download timeout is too short if PeerDist content encoding is enabled, since the overall download will abort before the first peer discovery attempt has completed, and without allowing sufficient time for an origin server range request. The single timeout value is currently used for both the download timeout and the sync timeout. The latter timeout exists only to allow network communication to be gracefully quiesced before removing the temporary MNP network device, and may safely be shortened without affecting functionality. Fix by increasing the download timeout from two seconds to 30 seconds, and defining a separate one-second timeout for the sync operation. Reported-by: Michael Niehaus <niehaus@live.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
-rw-r--r--src/interface/efi/efi_autoexec.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/interface/efi/efi_autoexec.c b/src/interface/efi/efi_autoexec.c
index 44b8b645b..73ba5df33 100644
--- a/src/interface/efi/efi_autoexec.c
+++ b/src/interface/efi/efi_autoexec.c
@@ -43,7 +43,10 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
*/
/** Timeout for autoexec script downloads */
-#define EFI_AUTOEXEC_TIMEOUT ( 2 * TICKS_PER_SEC )
+#define EFI_AUTOEXEC_TIMEOUT ( 30 * TICKS_PER_SEC )
+
+/** Timeout for autoexec pending operation completion */
+#define EFI_AUTOEXEC_SYNC_TIMEOUT ( 1 * TICKS_PER_SEC )
/** Autoexec script image name */
#define EFI_AUTOEXEC_NAME "autoexec.ipxe"
@@ -136,7 +139,7 @@ static int efi_autoexec_network ( EFI_HANDLE handle, struct image **image ) {
}
/* Ensure network exchanges have completed */
- sync ( EFI_AUTOEXEC_TIMEOUT );
+ sync ( EFI_AUTOEXEC_SYNC_TIMEOUT );
err_open:
err_cwuri: