The filesize is not known for push requests and barebox always sent '0'. Server might reject data because it will always exceed this length. Send this option only for RRQ requests. Signed-off-by: Enrico Scholz <enrico.scholz@xxxxxxxxxxxxxxxxx> --- fs/tftp.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/fs/tftp.c b/fs/tftp.c index 913ca1df6e42..361661d2180e 100644 --- a/fs/tftp.c +++ b/fs/tftp.c @@ -132,18 +132,23 @@ static int tftp_send(struct file_priv *priv) "octet%c" "timeout%c" "%d%c" - "tsize%c" - "%lld%c" "blksize%c" "1432", priv->filename + 1, 0, 0, 0, TIMEOUT, 0, - 0, - priv->filesize, 0, 0); pkt++; + + if (!priv->push) + /* we do not know the filesize in WRQ requests and + 'priv->filesize' will always be zero */ + pkt += sprintf((unsigned char *)pkt, + "tsize%c%lld%c", + '\0', priv->filesize, + '\0'); + len = pkt - xp; break; -- 2.37.2