Skip to contentSkip to conversation

net: tftp: Avoid sending extra ack on completion

PATCH Superseded Ramon Fried 4 participants 5 messages Feb 3, 2021 – Feb 18, 2021 Networking

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 net: tftp: Avoid sending extra ack on completion

in tftpboot, if ack was already sent previously for this packet, don't send again.

Fixes cc6b87ecaa96 ("net: tftp: Add client support for RFC 7440")

---
v2: Fix it so it actually works :)

 net/tftp.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
net/tftp.c +6 -5
index 03079ded34..6b781ccf67 100644
@@ -668,6 +668,12 @@ static void tftp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 			break;
 		}
 
+		if (len < tftp_block_size) {
+			tftp_send();
+			tftp_complete();
+			break;
+		}
+
 		/*
 		 *	Acknowledge the block just received, which will prompt
 		 *	the remote for the next one.
@@ -676,11 +682,6 @@ static void tftp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 			tftp_send();
 			tftp_next_ack += tftp_windowsize;
 		}
-
-		if (len < tftp_block_size) {
-			tftp_send();
-			tftp_complete();
-		}
 		break;
 
 	case TFTP_ERROR:
Signature · 1 line
2.17.1
#1 lore raw

PATCH v2 1/1 net: tftp: Avoid sending extra ack on completion

Quoted 44 lines · Ramon Fried

in tftpboot, if ack was already sent previously for this packet, don't send again.

Fixes cc6b87ecaa96 ("net: tftp: Add client support for RFC 7440")

---
v2: Fix it so it actually works :)

 net/tftp.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
net/tftp.c +6 -6
index 03079ded34..6b781ccf67 100644
@@ -668,6 +668,12 @@ static void tftp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
                        break;
                }
 
+               if (len < tftp_block_size) {
+                       tftp_send();
+                       tftp_complete();
+                       break;
+               }
+
                /*
                 *      Acknowledge the block just received, which will prompt
                 *      the remote for the next one.
@@ -676,11 +682,6 @@ static void tftp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
                        tftp_send();
                        tftp_next_ack += tftp_windowsize;
                }
-
-               if (len < tftp_block_size) {
-                       tftp_send();
-                       tftp_complete();
-               }
                break;
 
        case TFTP_ERROR:
--
Quoted 2 lines

2.17.1

#3 lore raw

PATCH v2 1/1 net: tftp: Avoid sending extra ack on completion

Quoted 11 lines · Oliver Graute
Quoted 7 lines · Ramon Fried

in tftpboot, if ack was already sent previously for this packet, don't send again.

Fixes cc6b87ecaa96 ("net: tftp: Add client support for RFC 7440")

Tom, can you please merge this ?
This is an important bug fix that should be merged asap.

Thanks,
Ramon.

#4 lore raw

PATCH v2 1/1 net: tftp: Avoid sending extra ack on completion

In reply to Ramon Fried
Quoted 9 lines · Ramon Fried

in tftpboot, if ack was already sent previously for this packet, don't send again.

Fixes cc6b87ecaa96 ("net: tftp: Add client support for RFC 7440")

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/20210218/15744abf/attachment.sig>