From: Joseph C. Lehner Date: Thu, 5 Sep 2019 13:38:29 +0000 (+0200) Subject: Warn about TFTP block rollover X-Git-Tag: v0.9.14~8 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=0373577005398f5212351ef708c2a95368a74bad;p=oweals%2Fnmrpflash.git Warn about TFTP block rollover --- diff --git a/tftp.c b/tftp.c index 06258dc..27ca320 100644 --- a/tftp.c +++ b/tftp.c @@ -314,6 +314,7 @@ int tftp_put(struct nmrpd_args *args) char rx[2048], tx[2048]; const char *file_remote = args->file_remote; char *val, *end; + bool rollover; sock = -1; ret = -1; @@ -373,6 +374,7 @@ int tftp_put(struct nmrpd_args *args) last_len = -1; len = 0; errors = 0; + rollover = false; /* Not really, but this way the loop sends our WRQ before receiving */ timeouts = 1; @@ -394,6 +396,10 @@ int tftp_put(struct nmrpd_args *args) ret = -1; goto cleanup; } + + if (verbosity) { + printf("Remote accepted blksize option: %d b\n", blksize); + } } } } @@ -401,8 +407,10 @@ int tftp_put(struct nmrpd_args *args) if (timeouts || ackblock == block) { if (!timeouts) { if (++block == 0) { - // rollover; skip to block 1 - block = 1; + if (!rollover) { + printf("Warning: TFTP block rollover. Upload might fail!\n"); + rollover = true; + } } pkt_mknum(tx, DATA);