mirror of
https://kernel.googlesource.com/pub/scm/network/tftp/tftp-hpa
synced 2025-04-26 01:49:52 +03:00
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:
parent
a63534e6e6
commit
aeb1c31bae
1 changed files with 4 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue