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.
This commit is contained in:
Tim Newsome 2010-09-08 14:11:42 -07:00 committed by H. Peter Anvin
parent a63534e6e6
commit aeb1c31bae

View file

@ -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;