diff options
author | Tim Newsome <tnewsome@aristanetworks.com> | 2010-09-08 14:11:42 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@linux.intel.com> | 2010-09-20 17:48:33 -0700 |
commit | aeb1c31bae431ad3b9269befa221229458adb854 (patch) | |
tree | cac878f7df4417b6c0d8ee754cae4d3ce5ead6ba | |
parent | a63534e6e6fa351d1c51b1d7cd14f916af3f835a (diff) | |
download | tftp-hpa-aeb1c31bae431ad3b9269befa221229458adb854.tar.gz |
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.
-rw-r--r-- | tftpd/tftpd.c | 4 |
1 files changed, 4 insertions, 0 deletions
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; |