summaryrefslogtreecommitdiff
path: root/networking/tftp.c
diff options
context:
space:
mode:
authorPaul Fox2005-07-20 19:49:15 +0000
committerPaul Fox2005-07-20 19:49:15 +0000
commit1d4c88c8a5d2c8ffed5555c79d2c654f1287ddd8 (patch)
tree05631f7da48a284204ff88918fece737f6221b8e /networking/tftp.c
parent4905434b8aead249d6bdd134d2fbd8c06dfcc059 (diff)
downloadbusybox-1d4c88c8a5d2c8ffed5555c79d2c654f1287ddd8.zip
busybox-1d4c88c8a5d2c8ffed5555c79d2c654f1287ddd8.tar.gz
applying fix for:
0000271: [PATCH] tftp -g fails if a TFTP_ACK is lost
Diffstat (limited to 'networking/tftp.c')
-rw-r--r--networking/tftp.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/networking/tftp.c b/networking/tftp.c
index 334d03b..9b97477 100644
--- a/networking/tftp.c
+++ b/networking/tftp.c
@@ -320,7 +320,7 @@ static inline int tftp(const int cmd, const struct hostent *host,
FD_ZERO(&rfds);
FD_SET(socketfd, &rfds);
- switch (select(FD_SETSIZE, &rfds, NULL, NULL, &tv)) {
+ switch (select(socketfd + 1, &rfds, NULL, NULL, &tv)) {
case 1:
len = recvfrom(socketfd, buf, tftp_bufsize, 0,
(struct sockaddr *) &from, &fromlen);
@@ -463,6 +463,11 @@ static inline int tftp(const int cmd, const struct hostent *host,
--block_nr;
opcode = TFTP_ACK;
continue;
+ } else if (tmp + 1 == block_nr) {
+ /* Server lost our TFTP_ACK. Resend it */
+ block_nr = tmp;
+ opcode = TFTP_ACK;
+ continue;
}
}