diff mbox series

net: tftpput: reset timeout_count when an ACK is received

Message ID 20241129144733.779043-1-jerome.forissier@linaro.org
State New
Headers show
Series net: tftpput: reset timeout_count when an ACK is received | expand

Commit Message

Jerome Forissier Nov. 29, 2024, 2:47 p.m. UTC
timeout_count is never reset once a tftpput transfer has started. If for
whatever reason timeouts occur frequently, but the server keeps replying
nonetheless, the transfer may be needlessly aborted.

Reset timer_count on reception of an ACK to avoid this situation.

Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
---
 net/tftp.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Mikhail Kshevetskiy Nov. 29, 2024, 2:56 p.m. UTC | #1
actually there is the same issue with tftpget
The following patch fix it

From 2da22fc1fc2601e5b80c742c503177ca235157f8 Mon Sep 17 00:00:00 2001
From: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Date: Sun, 29 May 2022 19:48:55 +0300
Subject: [PATCH] feature: net/tftp: clear timeout on every successfull block

This patch makes TFTP files loading much more reliable.

Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
---
 net/tftp.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/tftp.c b/net/tftp.c
index 704b20b4ff8..8f948204a6f 100644
--- a/net/tftp.c
+++ b/net/tftp.c
@@ -498,6 +498,7 @@ static void tftp_handler(uchar *pkt, unsigned dest,
struct in_addr sip,
                         tftp_state = STATE_DATA;
                         tftp_remote_port = src;
                     }
+                    timeout_count = 0;
                     tftp_send(); /* Send next data block */
                 }
             }
@@ -657,6 +658,7 @@ static void tftp_handler(uchar *pkt, unsigned dest,
struct in_addr sip,
             net_set_state(NETLOOP_FAIL);
             break;
         }
+        timeout_count = 0;
 
         if (len < tftp_block_size) {
             tftp_send();
diff mbox series

Patch

diff --git a/net/tftp.c b/net/tftp.c
index 704b20b4ff8..8d54a83d9c2 100644
--- a/net/tftp.c
+++ b/net/tftp.c
@@ -478,6 +478,7 @@  static void tftp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 	case TFTP_ACK:
 #ifdef CONFIG_CMD_TFTPPUT
 		if (tftp_put_active) {
+			timeout_count = 0;
 			if (tftp_put_final_block_sent) {
 				tftp_complete();
 			} else {