Added TFTP Client / server#111
Open
danielinux wants to merge 1 commit intowolfSSL:masterfrom
Open
Conversation
Contributor
There was a problem hiding this comment.
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 newWOLFIP_ENABLE_TFTPconfig 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 on lines
+161
to
+165
| session->last_status = status; | ||
| if (status == 0) { | ||
| if (session->state != WOLFTFTP_SESSION_FREE) | ||
| session->state = WOLFTFTP_SESSION_COMPLETE; | ||
| } else { |
| if (ret != 0) | ||
| return ret; | ||
| client->server = *server; | ||
| client->server.port = WOLFTFTP_PORT; |
| 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 on lines
+151
to
+153
| void *handle; | ||
| uint8_t last_tx[4 + (2 * 16) + WOLFTFTP_MAX_FILENAME]; | ||
| uint16_t last_tx_len; |
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 on lines
+63
to
65
| ${WOLFIP_TFTP_SRCS} | ||
| ${WOLFIP_TAP_SRC}) | ||
|
|
Comment on lines
+1113
to
+1114
| } else { | ||
| (void)wolftftp_server_send_window(server, session); |
| client->deadline_ms = wolftftp_deadline(&client->neg, now_ms); | ||
| return 0; | ||
| } | ||
| if (client->deadline_ms != 0U && now_ms < client->deadline_ms) |
Comment on lines
+1097
to
+1098
| if (session->deadline_ms != 0U && now_ms < session->deadline_ms) | ||
| continue; |
dgarske
requested changes
May 8, 2026
| @@ -0,0 +1,1120 @@ | |||
| #include "wolftftp.h" | |||
Member
There was a problem hiding this comment.
Please add proper license headers. Thanks!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.