2
0

21 Commits

Author SHA1 Message Date
Peter Collingbourne 57f6656d87 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.
2026-05-03 04:02:31 -07:00
dan 7e2b0068e6 nixfmt-rfc-style
There is nothing in this commit except for the changes made by
nix-shell -p nixfmt-rfc-style --run "nixfmt ."

If this has mucked up your open branches then sorry about that. You
can probably nixfmt them to match before merging
2025-02-10 21:55:08 +00:00
dan 2e5a8a572e tufted: more robust merge-pathname impl 2024-12-17 17:24:40 +00:00
dan 3df1ec76ff cleanup whitespace and commas
* [] is now [ ]
* {} is now { }
* commas in arglists go at end of line not beginning

In short, I ran the whole thing through nixfmt-rfc-style but only
accepted about 30% of its changes. I might grow accustomed to more
of it over time
2024-06-30 17:16:28 +01:00
dan e94bf62ec1 remove dead code (run deadnix) 2024-06-29 22:59:27 +01:00
dan 8798ee9830 partial fix for timeout handling
1) "Unknown transfer id" message was because the local variable "tid"
is not a transfer id, it is a sequence number  - so the check was
actually comparing expected vs actual acknowledged sequence number,
not TID.  It's still a problem if we get the wrong one, but it
indicates a lost packet (so we should resend) not a packet that was
sent from somewhere else.

2) if the ACK packet has not been received, our retry should involve
_resending_ it, not just trying to wait for it again.

3) I have removed the timeout condition for terminating the resend
loop, because in practice (assuming both ends have the same timeout
setting) all it did was ensure that the loop only ran once. The
timeout is supposed to regulate how long we wait for before retrying
(it doesn't do this, we wait indefinitely), not how long we wait for
before giving up.
2023-10-18 23:35:23 +01:00
dan b438a0fd17 handlersocket must be bound before calling select()
this is due to a rather odd (imo) decision in luasocket which
says that the underlying socket (and therefore its file
descriptor) isn't actually created until we call something
that lets it work out whether ipv4 or ipv6
2023-02-15 22:06:28 +00:00
dan 2388e4ca24 recvfrom(-1) is not the same as recvfrom() 2023-02-15 22:06:28 +00:00
dan f98b9c5c97 add README to say where Tufted came from 2023-02-15 22:06:28 +00:00
dan 1a29e2ba0f use locally modified tftp.lua instead of upstream tufty 2023-02-15 22:06:28 +00:00
dan 118f78f334 remove "using luasocket" message 2023-02-15 22:06:28 +00:00
dan a258456f25 check return value of bind
is common to forget to run this as root, in which case we would like
to see the permission denied error when it tries to open port 69
2023-02-15 22:06:28 +00:00
dan 71e37f1b96 update listen docstring 2023-02-15 22:06:28 +00:00
dan 55688c14ed pass remote host and port to callback as params 2..3
This allows the callback to handle the response differently
depending on who is asking - for example, to refuse requests
from clients on a blocklist
2023-02-15 22:06:28 +00:00
dan 59c0881235 remove unhelpful debug message 2023-02-15 22:06:28 +00:00
dan 1b372bcb2b simpler eof handling 2023-02-15 22:06:28 +00:00
dan b84a6e0aa5 fix poll() to not mutate its parameter 2023-02-15 22:06:28 +00:00
dan d729709869 remove nixio support 2023-02-15 22:06:28 +00:00
dan 740314b329 added at 3cb95c869e2fe74cc61ca303d88af6c5daad6734 2023-02-15 22:06:28 +00:00
dan 52d8c03ddd update tufted for nixpkgs fennel changes 2023-02-07 23:42:19 +00:00
dan e7987c9520 add build-host tftp server 2022-10-04 23:08:43 +01:00