summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorLey Foon Tan <ley.foon.tan@intel.com>2020-08-25 10:26:35 +0800
committerTom Rini <trini@konsulko.com>2020-09-30 16:48:18 -0400
commit6bf46367f5f1fd159f8a497d094ecfcbb6bc3c1d (patch)
tree60347fafa5d389da3e6f0c2f59be24cd3eed255c /net
parent387cbf096e443705fa66776027273ed257ec6ca3 (diff)
downloadu-boot-socfpga-6bf46367f5f1fd159f8a497d094ecfcbb6bc3c1d.tar.gz
net: tftp: Fix tftp_prev_block counter update
Fixes missing update to tftp_prev_block counter before increase tftp_cur_block counter when do the tftpput operation. tftp_prev_block counter is used in update_block_number() function to check whether block number (sequence number) is rollover. This bug cause the tftpput command fail to upload a large file when block number is greater than 16-bit (0xFFFF). Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com> Reviewed-By: Ramon Fried <rfried.dev@gmail.com>
Diffstat (limited to 'net')
-rw-r--r--net/tftp.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/net/tftp.c b/net/tftp.c
index 84e970bec1..380094d493 100644
--- a/net/tftp.c
+++ b/net/tftp.c
@@ -502,6 +502,7 @@ static void tftp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
int block = ntohs(*s);
int ack_ok = (tftp_cur_block == block);
+ tftp_prev_block = tftp_cur_block;
tftp_cur_block = (unsigned short)(block + 1);
update_block_number();
if (ack_ok)