[PATCH 06/13] tftp: reduce block size on lookup requests

Enrico Scholz enrico.scholz at sigma-chemnitz.de
Mon Jul 18 05:22:21 PDT 2022


Save some bytes on network traffic by reducing the server response for
lookup requests.

Signed-off-by: Enrico Scholz <enrico.scholz at sigma-chemnitz.de>
---
 fs/tftp.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/tftp.c b/fs/tftp.c
index ab1af0e9084c..01d3beff14bf 100644
--- a/fs/tftp.c
+++ b/fs/tftp.c
@@ -144,7 +144,9 @@ static int tftp_send(struct file_priv *priv)
 			        '\0',	/* "tsize" */
 				priv->filesize, '\0',
 			       '\0',	/* "blksize" */
-			       TFTP_MTU_SIZE);
+			        /* use only a minimal blksize for getattr
+				   operations, */
+			       priv->is_getattr ? TFTP_BLOCK_SIZE : TFTP_MTU_SIZE);
 		pkt++;
 		len = pkt - xp;
 		break;
-- 
2.36.1




More information about the barebox mailing list