Skip to content

Added TFTP Client / server#111

Merged
dgarske merged 9 commits into
wolfSSL:masterfrom
danielinux:tftp
May 12, 2026
Merged

Added TFTP Client / server#111
dgarske merged 9 commits into
wolfSSL:masterfrom
danielinux:tftp

Conversation

@danielinux
Copy link
Copy Markdown
Member

@danielinux danielinux commented May 8, 2026

Add support for TFTP client and server.

  • Tested against tftpd-hpa and tftp-hpa, respectively. Tested in github action
  • Unit test coverage above project average (92% Lines, 100% functions, 80.9%)

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 thread src/tftp/wolftftp.c Outdated
Comment thread src/tftp/wolftftp.c Outdated
Comment thread src/tftp/wolftftp.h
Comment thread Makefile
Comment thread CMakeLists.txt
Comment thread src/tftp/wolftftp.c
Comment thread src/tftp/wolftftp.c Outdated
Comment thread src/tftp/wolftftp.c Outdated
Comment thread src/tftp/wolftftp.c
Fixed POSIX violation in UDP recv:
 - don't enforce "connected" sockets upon sendto automatically (only on
   actual connect). Relax source filter. Adjusted unit tests

 - Actual TFTP fixes after interop tests with tftp[d]-hpa
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

Copilot reviewed 15 out of 15 changed files in this pull request and generated 4 comments.

Comment thread src/wolfip.c
Comment thread src/tftp/wolftftp.c Outdated
Comment thread tools/scripts/tftpd-hpa-wolfip.conf Outdated
Comment thread src/test/test_tftp_interop.c Outdated
Copy link
Copy Markdown

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Choose a reason for hiding this comment

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

Fenrir Automated Review — PR #111

Scan targets checked: wolfip-bugs, wolfip-src

Findings: 2
2 finding(s) posted as inline comments (see file-level comments below)

This review was generated automatically by Fenrir. Findings are non-blocking.

Comment thread src/tftp/wolftftp.c Outdated
Comment thread src/tftp/wolftftp.c Outdated
Copy link
Copy Markdown
Member

@dgarske dgarske left a comment

Choose a reason for hiding this comment

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

TFTP client on the STM32H5 worked great! I'll put up a PR update for the H5 example.

Initializing TFTP client demo...
  TFTP server: 10.0.4.24
  TFTP file: test.txt
TFTP: RRQ sent
Entering main loop. Ready for connections!
  TCP Echo: port 7
TFTP: open update partition (erase on demand)
TFTP: programmed bytes=44
TFTP: update flag set, reset to apply
TFTP: close status=0

Comment thread src/tftp/wolftftp.c
@danielinux danielinux requested a review from dgarske May 12, 2026 07:51
Copy link
Copy Markdown
Member

@dgarske dgarske left a comment

Choose a reason for hiding this comment

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

Wonderful!

@dgarske dgarske merged commit 1164e65 into wolfSSL:master May 12, 2026
30 checks passed
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.

4 participants