From dffdc0a75b70a71541f5d648dbffb6209e670cff Mon Sep 17 00:00:00 2001 From: filipperich Date: Thu, 19 Apr 2018 16:38:45 -0700 Subject: 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. --- toys/pending/tftp.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'toys/pending') 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); } -- cgit v1.2.3