Skip to content

Added TFTP Client / server#111

Open
danielinux wants to merge 1 commit intowolfSSL:masterfrom
danielinux:tftp
Open

Added TFTP Client / server#111
danielinux wants to merge 1 commit intowolfSSL:masterfrom
danielinux:tftp

Conversation

@danielinux
Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings May 8, 2026 19:33
@danielinux danielinux self-assigned this May 8, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a reusable, allocation-free TFTP (client + server) module to wolfIP, integrates it into the top-level build systems, and introduces unit tests + documentation updates to cover the new functionality.

Changes:

  • New src/tftp/ module implementing TFTP RRQ/WRQ (octet mode) with option negotiation and callback-driven I/O/verification.
  • Build integration via Makefile and CMake to compile/link src/tftp/*.c, plus a new WOLFIP_ENABLE_TFTP config knob.
  • New unit test suite for the TFTP module, wired into the existing unit test runner; docs updated to mention module/layout.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
src/tftp/wolftftp.h New public TFTP API/types/config structs and callbacks.
src/tftp/wolftftp.c New TFTP client/server implementation (packet parsing/building, state machines, polling).
src/test/unit/unit.c Registers the new TFTP unit test suite.
src/test/unit/unit_tests_tftp.c New unit tests covering helpers, client/server success paths, and error paths.
src/test/unit/unit_shared.c Enables TFTP for unit tests and includes the module into the single-TU unit build.
README.md Documents the presence and purpose of the TFTP module.
docs/API.md Documents TFTP capability and build integration details.
config.h Adds WOLFIP_ENABLE_TFTP default configuration.
Makefile Adds src/tftp/*.c objects into build/link sets and updates coverage commands.
CMakeLists.txt Globs src/tftp/*.c into WOLFIP_SRCS; fixes unit build gating on Check_FOUND.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/tftp/wolftftp.c
Comment on lines +161 to +165
session->last_status = status;
if (status == 0) {
if (session->state != WOLFTFTP_SESSION_FREE)
session->state = WOLFTFTP_SESSION_COMPLETE;
} else {
Comment thread src/tftp/wolftftp.c
if (ret != 0)
return ret;
client->server = *server;
client->server.port = WOLFTFTP_PORT;
Comment thread src/tftp/wolftftp.c
req->timeout_s = (uint16_t)number;
req->opts |= WOLFTFTP_OPT_TIMEOUT;
} else if (wolftftp_stricmp_local(key, "tsize") == 0) {
number = wolftftp_parse_u32(value, 0xFFFFFFFFUL);
Comment thread src/tftp/wolftftp.h
Comment on lines +151 to +153
void *handle;
uint8_t last_tx[4 + (2 * 16) + WOLFTFTP_MAX_FILENAME];
uint16_t last_tx_len;
Comment thread Makefile
Comment on lines 141 to +150
OBJ=build/wolfip.o \
$(WOLFIP_TFTP_OBJ) \
$(TAP_OBJ)

IPFILTER_OBJ=build/ipfilter/wolfip.o \
$(WOLFIP_TFTP_OBJ) \
$(TAP_OBJ)

ESP_OBJ=build/esp/wolfip.o \
$(WOLFIP_TFTP_OBJ) \
Comment thread CMakeLists.txt
Comment on lines +63 to 65
${WOLFIP_TFTP_SRCS}
${WOLFIP_TAP_SRC})

Comment thread src/tftp/wolftftp.c
Comment on lines +1113 to +1114
} else {
(void)wolftftp_server_send_window(server, session);
Comment thread src/tftp/wolftftp.c
client->deadline_ms = wolftftp_deadline(&client->neg, now_ms);
return 0;
}
if (client->deadline_ms != 0U && now_ms < client->deadline_ms)
Comment thread src/tftp/wolftftp.c
Comment on lines +1097 to +1098
if (session->deadline_ms != 0U && now_ms < session->deadline_ms)
continue;
Comment thread src/tftp/wolftftp.c
@@ -0,0 +1,1120 @@
#include "wolftftp.h"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add proper license headers. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants