[syslinux] [PATCH] tftpd: Fix wrap-around logic when receiving large files
Simon Glass
sjg at chromium.org
Mon Oct 24 16:48:46 PDT 2011
Sending a large file (typically >90MB) to tftpd fails because it never
acks the packet after a rollover. This patch attempts to correct that.
I could not load the git repo, and cannot check kernel.org to see if
this is already fixed so this patch is against tftp-hpa_5.0-11ubuntu2.1.
Please ignore this patch if you have already fixed this. Also please cc
me on any reply since I do not get mailing list emails.
Thank you.
Signed-off-by: Simon Glass <sjg at chromium.org>
---
tftpd/tftpd.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/tftpd/tftpd.c b/tftpd/tftpd.c
index b3b49ee..52db5dd 100644
--- a/tftpd/tftpd.c
+++ b/tftpd/tftpd.c
@@ -1580,6 +1580,7 @@ static void tftp_recvfile(struct formats *pf, struct tftphdr *oap, int oacklen)
static struct tftphdr *ap; /* ack buffer */
static u_short block = 0;
static int acksize;
+ static int first = 1;
u_short dp_opcode, dp_block;
unsigned long r_timeout;
@@ -1587,9 +1588,10 @@ static void tftp_recvfile(struct formats *pf, struct tftphdr *oap, int oacklen)
do {
timeout = rexmtval;
- if (!block && oap) {
+ if (first && oap) {
ap = (struct tftphdr *)ackbuf;
acksize = oacklen;
+ first = 0;
} else {
ap = (struct tftphdr *)ackbuf;
ap->th_opcode = htons((u_short) ACK);
--
1.7.3.1
More information about the Syslinux
mailing list