summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorEnrico Scholz <enrico.scholz@sigma-chemnitz.de>2022-08-30 09:37:59 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2022-08-31 08:31:21 +0200
commit0e12f6eb1b3e6c6e447586c0b72edf1663c0ae96 (patch)
treee642be6d532d92f6274f732b247449f3c1875453 /fs
parent9b20ccc09c33c6ae12ee7f6b52c22f5c9db3163f (diff)
downloadbarebox-0e12f6eb1b3e6c6e447586c0b72edf1663c0ae96.tar.gz
tftp: do not set 'tsize' in WRQ requests
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@sigma-chemnitz.de> Link: https://lore.barebox.org/20220830073816.2694734-5-enrico.scholz@sigma-chemnitz.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'fs')
-rw-r--r--fs/tftp.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/fs/tftp.c b/fs/tftp.c
index 913ca1df6e..361661d218 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;