aboutsummaryrefslogtreecommitdiff
path: root/stand
diff options
context:
space:
mode:
authorEmmanuel Vadot <manu@FreeBSD.org>2021-12-30 08:47:06 +0000
committerEmmanuel Vadot <manu@FreeBSD.org>2021-12-30 15:30:13 +0000
commitdfc9c1d4937d0e2eab2910665069faba814bca1e (patch)
treee2511b4ba406617d23fb427eb731c9408e15b9a8 /stand
parentb6f7942cbcbde7c09788e86fdfe9310eafcb6e9f (diff)
downloadsrc-dfc9c1d4937d0e2eab2910665069faba814bca1e.tar.gz
src-dfc9c1d4937d0e2eab2910665069faba814bca1e.zip
loader: tftp: Copy the first block into the cache
tftp_open reads the first block so copy it in the cached data. If we have more than one block (i.e. we called tftp_read before tftp_preload) simply just reset the transfer. Reported by: mmel Reviewed by: mmel, tsoome MFC after: 2 weeks Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D33697
Diffstat (limited to 'stand')
-rw-r--r--stand/libsa/tftp.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/stand/libsa/tftp.c b/stand/libsa/tftp.c
index 9d1c70236925..c520a9e3b3b1 100644
--- a/stand/libsa/tftp.c
+++ b/stand/libsa/tftp.c
@@ -680,6 +680,13 @@ tftp_preload(struct open_file *f)
start = getsecs();
printf("Preloading %s ", tftpfile->path);
#endif
+ if (tftpfile->currblock == 1)
+ bcopy(tftpfile->tftp_hdr->th_data,
+ cache,
+ tftpfile->validsize);
+ else
+ tftpfile->currblock = 0;
+
while (tftpfile->islastblock == 0) {
twiddle(32);
rc = tftp_getnextblock(tftpfile);