Skip to contentSkip to conversation

net: tftp: Fix incorrect tftp_next_ack on no OACK

PATCH New Harm Berntsen 3 participants 3 messages Nov 27, 2020 – Jan 19, 2021 Networking

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: tftp: Fix incorrect tftp_next_ack on no OACK

When the tftp server did not send any OACK, the tftp_next_ack variable was not set to the correct value . As the server was transmitting blocks we generated a lot of 'Received unexpected block: $n, expected $n+1' error messages. Depending on the timeout setting the transfer could still complete though.

---

 net/tftp.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
net/tftp.c +3 -1
index 6fdb1a821a..9371d7ef2c 100644
@@ -624,8 +624,10 @@ static void tftp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 		tftp_cur_block++;
 		tftp_cur_block %= TFTP_SEQUENCE_SIZE;
 
-		if (tftp_state == STATE_SEND_RRQ)
+		if (tftp_state == STATE_SEND_RRQ) {
 			debug("Server did not acknowledge any options!\n");
+			tftp_next_ack = tftp_windowsize;
+		}
 
 		if (tftp_state == STATE_SEND_RRQ || tftp_state == STATE_OACK ||
 		    tftp_state == STATE_RECV_WRQ) {
Signature · 1 line
2.29.2
#1 lore raw

PATCH 1/1 net: tftp: Fix incorrect tftp_next_ack on no OACK

Quoted 31 lines · Harm Berntsen

When the tftp server did not send any OACK, the tftp_next_ack variable was not set to the correct value . As the server was transmitting blocks we generated a lot of 'Received unexpected block: $n, expected $n+1' error messages. Depending on the timeout setting the transfer could still complete though.

---

 net/tftp.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
net/tftp.c +3 -2
index 6fdb1a821a..9371d7ef2c 100644
@@ -624,8 +624,10 @@ static void tftp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
                tftp_cur_block++;
                tftp_cur_block %= TFTP_SEQUENCE_SIZE;
 
-               if (tftp_state == STATE_SEND_RRQ)
+               if (tftp_state == STATE_SEND_RRQ) {
                        debug("Server did not acknowledge any options!\n");
+                       tftp_next_ack = tftp_windowsize;
+               }
 
                if (tftp_state == STATE_SEND_RRQ || tftp_state == STATE_OACK ||
                    tftp_state == STATE_RECV_WRQ) {
--
Quoted 3 lines

2.29.2

#2 lore raw

PATCH 1/1 net: tftp: Fix incorrect tftp_next_ack on no OACK

In reply to Harm Berntsen
Quoted 9 lines · Harm Berntsen

When the tftp server did not send any OACK, the tftp_next_ack variable was not set to the correct value . As the server was transmitting blocks we generated a lot of 'Received unexpected block: $n, expected $n+1' error messages. Depending on the timeout setting the transfer could still complete though.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210119/e99710bb/attachment.sig>