Commit Graph

71 Commits

Author SHA1 Message Date
Luca Weiss 00fe2775de tqftpserv: add docs for options
The explanation is spread throughout various RFCs or the code - or at
least for rsize based on strace'ing the communication.
2024-01-19 11:52:32 +01:00
Luca Weiss fb20008c86 translate: don't try to close already closed class_fd
After calling fdopendir "the file descriptor is under the control of the
system" and calling closedir(class_dir) already closes class_fd, so
let's not try to close it again.

Just close class_fd when fdopendir fails and remove the close call from
the regular exit path.
2024-01-18 15:33:46 +01:00
Luca Weiss a540a1c307 tqftpserv: also print value for unknown options 2023-02-10 13:17:28 +01:00
Luca Weiss 3fa49eafe0 tqftpserv: handle OP_ERROR code
When we get an error from the remote we should print it, for example:

  [TQFTP] received error:  8 - Expected OACK for UNLINK
2023-02-10 12:13:00 +01:00
Luca Weiss aaba76c6ba tqftpserv: also print error code on read error
Along with the error message we also get a uint16 error code that we can
print.
2023-02-10 12:10:46 +01:00
John Stultz de42697a24 translate: Null terminate firmware_value string
Null terminate firmware_value string to prevent
strlen() read past the end of buffer.

Change-Id: I57cd01c4d0c58c6057872bc4b36129f09bc034a3
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>
2023-01-17 22:57:14 -06:00
Amit Pundir 538efb3096 translate: Use /data/vendor for temporary files
On AOSP, /tmp is not available. Use /data/vendor instead
for temporary files.

Change-Id: I1d6ebd669573b3c3134e6da943ea9355ed83a3fe
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>
2023-01-17 22:57:14 -06:00
Sireesh Kodali 48b9e1cbb1 tqftpserv: add support for TFTP options on WRQs 2023-01-17 22:56:21 -06:00
Jami Kettunen 3488007880 Makefile: allow $(CFLAGS), $(LDFLAGS) override
The caller might have specified CFLAGS or LDFLAGS. Let's respect those.
2023-01-17 22:54:25 -06:00
Amit Pundir 783425b550 ANDROID: Add Android.bp makefile
Add Android.bp makefile to build tqftpserv for AOSP.

Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
v1.0
2020-02-07 10:43:39 -08:00
Khem Raj 2324458f18 include limits.h for PATH_MAX
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2019-12-02 13:45:16 -08:00
Bjorn Andersson fe53d2a810 tqftpserv: Implement path translation
The tftp clients in the modem requests files from either /readwrite or
/readonly/firmware/image, but as the wlanmdsp.mbn file requested is
signed with a vendor specific key these paths needs to be translated.

/readwrite is translated to /tmp/tqftpserv for now and the
/readonly/firmware/image is translated to a search for the requested
file alongside any of the remoteproc firmware files. The result is that
the wlanmdsp.mbn can be stored in linux-firmware alongside it's
device/vendor specific modem firmware.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2019-10-26 11:14:03 -07:00
Bjorn Andersson 75a7a89398 tqftpserv.service: Add systemd service
Add tqftpserv.service and install this.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2019-07-25 11:36:16 -07:00
Bjorn Andersson 6348c52f20 tqftpserv: Remove the spamming of stdout
Some mechanism for toggling the verbosity of the prints should be
introduced, but for now just comment out all the debug prints.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2019-06-10 16:40:11 -07:00
Bjorn Andersson 7167c88ead tqftpserv: Don't close socket at EOF
When during a read we close the socket as we send the last block the
remote will be notified about the closure and consider the transfer
incomplete. Leave the socket open until we receive a EOF error from the
remote side.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2019-06-10 16:36:13 -07:00
Bjorn Andersson 2ae2758cba Add LICENSE file
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2019-03-15 11:34:42 -07:00
Ben Chan 4fa490847a tqftpserv: fix memory leak in tftp_send_error() v0.0 2018-07-26 06:10:31 -07:00
Ben Chan a175e68796 tqftpserv: remove duplicated initialization in handle_rrq() 2018-07-26 06:09:47 -07:00
Bjorn Andersson 9c4bc44c44 tqftpserv: Fix invalid include directives
The two include files was dropped during development but lingered in my
repository, remove the include of them - and define MAX(x, y).

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-07-10 19:02:52 -07:00
Bjorn Andersson e4894436dd tqftpserv: Initial prototype implementation
Introduce a prototype of the tqftpserv, a server implementing trivial
file transfer protocol over AF_QIPCRTR.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-06-29 15:57:40 -07:00
Bjorn Andersson 73a4053779 ... 2018-06-29 15:54:40 -07:00