Extend blind mode to TFTP
authorJoseph C. Lehner <joseph.c.lehner@gmail.com>
Sun, 1 Mar 2020 20:55:59 +0000 (21:55 +0100)
committerJoseph C. Lehner <joseph.c.lehner@gmail.com>
Sun, 1 Mar 2020 20:57:24 +0000 (21:57 +0100)
tftp.c

diff --git a/tftp.c b/tftp.c
index 27ca32062ec92fd54c330665793991a8aa74ae25..b6f5ce7a5690a1d6c8a567a9360dbb06033f48e1 100644 (file)
--- a/tftp.c
+++ b/tftp.c
@@ -453,6 +453,12 @@ int tftp_put(struct nmrpd_args *args)
                } else if (!ret) {
                        if (++timeouts < 5 || (!block && timeouts < 10)) {
                                continue;
+                       } else if (args->blind) {
+                               timeouts = 0;
+                               // fake an ACK packet
+                               pkt_mknum(rx, ACK);
+                               pkt_mknum(rx + 2, block);
+                               continue;
                        } else if (block) {
                                fprintf(stderr, "Timeout while waiting for ACK(%d).\n", block);
                        } else {