summaryrefslogtreecommitdiff
path: root/recipes-bsp/u-boot/u-boot-2016.09.01/tftpput.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-bsp/u-boot/u-boot-2016.09.01/tftpput.patch')
-rw-r--r--recipes-bsp/u-boot/u-boot-2016.09.01/tftpput.patch28
1 files changed, 28 insertions, 0 deletions
diff --git a/recipes-bsp/u-boot/u-boot-2016.09.01/tftpput.patch b/recipes-bsp/u-boot/u-boot-2016.09.01/tftpput.patch
new file mode 100644
index 0000000..b5e419f
--- /dev/null
+++ b/recipes-bsp/u-boot/u-boot-2016.09.01/tftpput.patch
@@ -0,0 +1,28 @@
+/*
+ * tftpput in u-boot has two issues. It never resets the timeout, so
+ * tftpput must complete within the timeout perious (by defaut 5 seconds)
+ * and it does not properly handle the block wrap at 65535 back to zero,
+ * so it will transmit data forever, or at least a very long time, if
+ * the timeout is set long enough, or the timeout issue is patched by
+ * itself.
+ */
+diff -Naru old/net/tftp.c new/net/tftp.c
+--- old/net/tftp.c 2017-07-05 15:52:28.865818329 -0500
++++ new/net/tftp.c 2017-07-11 16:15:27.870430395 -0500
+@@ -499,10 +499,15 @@
+ int block = ntohs(*s);
+ int ack_ok = (tftp_cur_block == block);
+
++ /* update_block_number needs tftp_prev_block */
++ tftp_prev_block = tftp_cur_block;
+ tftp_cur_block = (unsigned short)(block + 1);
+ update_block_number();
+- if (ack_ok)
++ if (ack_ok) {
++ /* We got the ACK, so reset the timeout */
++ net_set_timeout_handler(timeout_ms, tftp_timeout_handler);
+ tftp_send(); /* Send next data block */
++ }
+ }
+ }
+ #endif