aboutsummaryrefslogtreecommitdiff
path: root/lib/tftp.c
diff options
context:
space:
mode:
authorTim Newsome <tnewsome@aristanetworks.com>2010-09-24 09:43:49 -0700
committerDaniel Stenberg <daniel@haxx.se>2010-09-26 23:30:56 +0200
commit6bf2014745bb2aad4ce80c7a8f4cf924fb782817 (patch)
treecc54eb3a1404760581707b1acbd617c27e2e7ed0 /lib/tftp.c
parenta10f5b34ff7932060beb4d297be1241b81b64774 (diff)
TFTP: Work around tftpd-hpa upload bug
tftpd-hpa has a bug where it will send an incorrect ack when the block counter wraps and tftp options have been sent. Work around that by accepting an ack for 65535 when we're expecting one for 0.
Diffstat (limited to 'lib/tftp.c')
-rw-r--r--lib/tftp.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/tftp.c b/lib/tftp.c
index 83be8e2b9..95da9b893 100644
--- a/lib/tftp.c
+++ b/lib/tftp.c
@@ -719,7 +719,13 @@ static CURLcode tftp_tx(tftp_state_data_t *state, tftp_event_t event)
/* Ack the packet */
rblock = getrpacketblock(&state->rpacket);
- if(rblock != state->block) {
+ if(rblock != state->block &&
+ /* There's a bug in tftpd-hpa that causes it to send us an ack for
+ * 65535 when the block number wraps to 0. So when we're expecting
+ * 0, also accept 65535. See
+ * http://syslinux.zytor.com/archives/2010-September/015253.html
+ * */
+ !(state->block == 0 && rblock == 65535)) {
/* This isn't the expected block. Log it and up the retry counter */
infof(data, "Received ACK for block %d, expecting %d\n",
rblock, state->block);