summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Landley2005-06-07 02:40:39 +0000
committerRob Landley2005-06-07 02:40:39 +0000
commitf3133c414989a1409d79db43a426f122dc06cbed (patch)
treef12f8a0c90838f21d42e87a64e66f2de144c5025
parentf7662da2af1b6a9982ca0b2c8186dd1893d8c292 (diff)
downloadbusybox-f3133c414989a1409d79db43a426f122dc06cbed.zip
busybox-f3133c414989a1409d79db43a426f122dc06cbed.tar.gz
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
-rw-r--r--networking/tftp.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/networking/tftp.c b/networking/tftp.c
index 095dc58..334d03b 100644
--- a/networking/tftp.c
+++ b/networking/tftp.c
@@ -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)) {