summaryrefslogtreecommitdiff
path: root/net/tftp.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2023-02-03 10:27:27 -0500
committerTom Rini <trini@konsulko.com>2023-02-03 10:27:27 -0500
commitb102bfa15e9efb18104878d8a04a0092de63250c (patch)
tree1ec31a76dd16db5984331663aed37ce6f0a292ba /net/tftp.c
parent9918b25d21db243352fc482671cafa10260b7887 (diff)
parent9bc80c0bc028a1658502eea02af2c1f26456c6b2 (diff)
Merge branch '2023-02-02-assorted-networking-updates'
- DSA driver for the MV88E6xxx, assorted IPv6 fixes, TFTP fix, fsl-mc cleanup coding style and fsl_ls_mdio bugfix
Diffstat (limited to 'net/tftp.c')
-rw-r--r--net/tftp.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/net/tftp.c b/net/tftp.c
index c780c33f379..88e71e67de3 100644
--- a/net/tftp.c
+++ b/net/tftp.c
@@ -593,6 +593,14 @@ static void tftp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
ntohs(*(__be16 *)pkt),
(ushort)(tftp_cur_block + 1));
/*
+ * Only ACK if the block count received is greater than
+ * the expected block count, otherwise skip ACK.
+ * (required to properly handle the server retransmitting
+ * the window)
+ */
+ if ((ushort)(tftp_cur_block + 1) - (short)(ntohs(*(__be16 *)pkt)) > 0)
+ break;
+ /*
* If one packet is dropped most likely
* all other buffers in the window
* that will arrive will cause a sending NACK.
@@ -837,7 +845,7 @@ void tftp_start(enum proto_t protocol)
e = strchr(net_boot_file_name, ']');
len = e - s;
if (s && e) {
- string_to_ip6(s + 1, len, &tftp_remote_ip6);
+ string_to_ip6(s + 1, len - 1, &tftp_remote_ip6);
strlcpy(tftp_filename, e + 2, MAX_LEN);
} else {
strlcpy(tftp_filename, net_boot_file_name, MAX_LEN);