]> git.ipfire.org Git - thirdparty/u-boot.git/commit
net: lwip: tftp: add support of tsize option to client
authorMarek Vasut <marek.vasut+renesas@mailbox.org>
Wed, 28 Jan 2026 23:43:45 +0000 (00:43 +0100)
committerJerome Forissier <jerome.forissier@arm.com>
Fri, 6 Feb 2026 15:42:37 +0000 (16:42 +0100)
commit337f50bad2ac8e1db126e4f6d372a3186bba2893
tree893e2b6ce6c75fa1fbf900cb1a1c57c3f03df254
parenta28db0f1ccd6d7f88e9715486376bc039975f72c
net: lwip: tftp: add support of tsize option to client

The TFTP server can report the size of the entire file that is about to
be received in the Transfer Size Option, this is described in RFC 2349.
This functionality is optional and the server may not report tsize in
case it is not supported.

Always send tsize request to the server to query the transfer size,
and in case the server does respond, cache that information locally
in tftp_state.tsize, otherwise cache size 0. Introduce new function
tftp_client_get_tsize() which returns the cached tftp_state.tsize so
clients can determine the transfer size and use it.

Update net/lwip/tftp.c to make use of tftp_client_get_tsize() and
avoid excessive printing of '#' during TFTP transfers in case the
transfer size is reported by the server.

Submitted upstream: https://savannah.nongnu.org/patch/index.php?item_id=10557

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Acked-by: Jerome Forissier <jerome.forissier@arm.com>
lib/lwip/lwip/src/apps/tftp/tftp.c
lib/lwip/lwip/src/include/lwip/apps/tftp_client.h
net/lwip/tftp.c