commit 57f6656d87e1c06a253a3d1149e9713acc207607
parent d0376d41016e0ddbd532b63f7fd3b2f4fcbcdf37
Author: Peter Collingbourne <peter@pcc.me.uk>
Date: Sun, 3 May 2026 01:24:23 -0700
tufted: Roll over the tid on overflow
The specific rollover value is unspecified, but we assume that the other
side is U-Boot which rolls over to 0.
https://github.com/u-boot/u-boot/blob/bb0f3eebb3c196d9b6efbbd1e5aa9b16abbb9ad6/net/tftp.c#L275
This allows for very large images to be transferred, which is sometimes
necessary for running debugging or profiling tools designed for normal
Linux distributions such as perf.
Diffstat:
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/pkgs/tufted/tftp.lua b/pkgs/tufted/tftp.lua
@@ -177,9 +177,10 @@ function tftp:handle_RRQ(socket, host, port, source, options)
end
log(("coroutine started on %s:%s/"):format(host, port))
while not done do
- if tid >= 2^16 then
- socket:sendto(err("File too big."), host, port)
- error("File too big.")
+ if tid == 2^16 then
+ -- Roll over the tid. The specific rollover value is unspecified, but we
+ -- assume that the other side is U-Boot which rolls over to 0.
+ tid = 0
end
local okay, continue, data = pcall(source, blksize)
if not okay then