Thus spake Brenda J. Butler:

We were seeing some timeouts when getting files with the busybox tftp
client.

With tcpdump, we saw that the tftp client was receiving blocks and
ack'ing them, but the server was failing to receive the occasional
ack.

When that happened, the server would send the last block over again,
but the tftp client was expecting the next block.

This patch allows the client to recover from this situation
(it sends an ack for the repeat block but does not write it
to the local file).

I hope it meets your approval, please don't hesitate to send
me comments for improvement.

The patch is against "head" in svn, I tested it on an older version
of busybox in our environment.  It applied cleanly to the older
version.

Credit for this goes to my co-worker John McCarthy for finding
it and me for fixing it (assuming it works for everyone else too).

cheerio,
bjb
This commit is contained in:
Rob Landley 2005-06-07 02:40:39 +00:00
parent f7662da2af
commit f3133c4149

View File

@ -458,6 +458,12 @@ static inline int tftp(const int cmd, const struct hostent *host,
opcode = TFTP_ACK;
continue;
}
/* in case the last ack disappeared into the ether */
if ( tmp == (block_nr - 1) ) {
--block_nr;
opcode = TFTP_ACK;
continue;
}
}
if (cmd_put && (opcode == TFTP_ACK)) {