2
0

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.
bb0f3eebb3/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.
This commit is contained in:
Peter Collingbourne
2026-05-03 01:24:23 -07:00
parent d0376d4101
commit 57f6656d87

View File

@@ -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