From aeb1c31bae431ad3b9269befa221229458adb854 Mon Sep 17 00:00:00 2001 From: Tim Newsome Date: Wed, 8 Sep 2010 14:11:42 -0700 Subject: [PATCH] tftpd: Don't resend the OACK packet on block number wrap When uploading a file that is larger than 32MB (with standard block size), the block number will roll over. If it rolls over to 0, the code mistakenly resends the option ack frame instead of acknowledging the 0 data block. This change fixes that behavior. --- tftpd/tftpd.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tftpd/tftpd.c b/tftpd/tftpd.c index 69ff121..0a8da72 100644 --- a/tftpd/tftpd.c +++ b/tftpd/tftpd.c @@ -1646,6 +1646,10 @@ static void tftp_recvfile(struct formats *pf, struct tftphdr *oap, int oacklen) ap->th_opcode = htons((u_short) ACK); ap->th_block = htons((u_short) block); acksize = 4; + /* If we're sending a regular ACK, that means we have successfully + * sent the OACK. Clear oap so that we won't try to send another + * OACK when the block number wraps back to 0. */ + oap = NULL; } if (!++block) block = rollover_val;