
Hi,
I send a patch fixing the wget issue. There is a wrap around issue as already mentioned in [1].
The log in [2] indicates the following packets.
- Success packet Packets received 64368, Transfer Successful Bytes transferred = 93198937 (58e1a59 hex)
- Failed packet Packets received 64368, Transfer Successful Bytes transferred = 26984682 (19bc0ea hex)
"Bytes transferred" are different, but "Packets received" are same. First one output by net_boot_file_size that is assigned at store_block(). Second one output by packets that is incremented at wget_handler(). Those differences are caused by the following line. If tcp_seq_num is wrap around, store_block() isn't called.
``` static void wget_handler(uchar *pkt, u16 dport, ... if (tcp_seq_num >= initial_data_seq_num && store_block(pkt, tcp_seq_num - initial_data_seq_num, len) != 0) { wget_fail("wget: store error\n", tcp_seq_num, tcp_ack_num, action); net_set_state(NETLOOP_FAIL); return; } ```
I reproduced the issue and fixed it with the following patch. Please check this patch. I will recommend to apply patch in [3] with this patch, if packets may drop.
[1]: https://lore.kernel.org/u-boot/CAOf5uwmb0vJOwSj81KvfWpK6yobyz0Ozm5vDGCa9K0rZ... [2]: https://lore.kernel.org/u-boot/CAJ+vNU2U9W2NRT6hf1CAEQ_56SDQviUEzuDD1iYOpdf1... [3]: https://lore.kernel.org/u-boot/20240414104607.5966-1-yasuharu.shibata@gmail....
Yasuharu Shibata (1): net: wget: fix TCP sequence number wrap around issue
net/wget.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)