aboutsummaryrefslogtreecommitdiff
path: root/toys
diff options
context:
space:
mode:
authorfilipperich <filip@perich.net>2018-04-19 16:38:45 -0700
committerRob Landley <rob@landley.net>2018-04-20 10:34:16 -0500
commitdffdc0a75b70a71541f5d648dbffb6209e670cff (patch)
tree5d6f69ffe0220f187aecbddf50533ab77dd6b468 /toys
parent941f5644d18b751693bf086c4af1dc21cae558d8 (diff)
downloadtoybox-dffdc0a75b70a71541f5d648dbffb6209e670cff.tar.gz
Update tftp.c
Optionally, accept and acknowledge OACK from server after sending original RRQ, if the server implements RFC2347 and responds first with an OACK before sending DATA packets.
Diffstat (limited to 'toys')
-rw-r--r--toys/pending/tftp.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/toys/pending/tftp.c b/toys/pending/tftp.c
index 1c6fe9e6..30ebe81c 100644
--- a/toys/pending/tftp.c
+++ b/toys/pending/tftp.c
@@ -330,7 +330,15 @@ static int file_get(void)
if (rblockno && (rblockno < 9)) message = arr[rblockno - 1];
error_msg(message);
}
- if (opcode > 5) {
+ else if (blockno == 1 && opcode == TFTP_OP_OACK) {
+ len = mkpkt_ack(packet, 0);
+ ret = write_server(sd, packet, len, &from);
+ if (ret != len){
+ unlink(TT.local_file);
+ goto errout_with_sd;
+ }
+ }
+ else if (opcode > 5) {
len = mkpkt_err(packet, TFTP_ER_ILLEGALOP, TFTP_ES_ILLEGALOP);
ret = write_server(sd, packet, len, &from);
}