Skip to content

Zephyr TCP/IP replacement#114

Open
danielinux wants to merge 7 commits into
wolfSSL:masterfrom
danielinux:zephyr-tcpip-replace
Open

Zephyr TCP/IP replacement#114
danielinux wants to merge 7 commits into
wolfSSL:masterfrom
danielinux:zephyr-tcpip-replace

Conversation

@danielinux
Copy link
Copy Markdown
Member

  • Added routing tables support for IPv4 routing
  • Added patches to replace stock TCP/IP from Zephyr with wolfIP

Copilot AI review requested due to automatic review settings May 11, 2026 14:56
@danielinux danielinux changed the title Zephyr tcpip replace Zephyr TCP/IP replace May 11, 2026
@danielinux danielinux self-assigned this May 11, 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

This PR extends wolfIP with an IPv4 routing table (static routes + longest-prefix-match selection) and adds an out-of-tree Zephyr port that replaces Zephyr’s native IPv4/TCP/UDP stack with wolfIP via a custom L2 and socket-offload integration.

Changes:

  • Added routing table storage and public APIs (wolfIP_route_*) plus route-aware next-hop/interface selection.
  • Added a DNS server getter API (wolfIP_dns_server_get) and accompanying unit tests.
  • Added Zephyr port documentation and patch set (glue layer, L2 module, net-shell integration, and a TAP echo sample).

Reviewed changes

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

Show a summary per file
File Description
wolfip.h Adds route info struct, route API declarations, and POSIX-type inclusion tweaks; adds DNS server getter prototype.
src/wolfip.c Implements route table, LPM route lookup, route-aware nexthop/egress selection, and DNS server getter.
src/test/unit/unit.c Registers new unit tests for routing table behavior and DNS getter.
src/test/unit/unit_tests_proto.c Adds unit tests covering route LPM, default route deletion/fallback, update semantics, and connected-subnet precedence; adds DNS getter test.
port/zephyr/README.md Documents the Zephyr port design, usage, patch structure, and limitations.
port/zephyr/patches/0001-wolfip-glue-and-public-api.patch Adds Zephyr glue/runtime, control wrappers, Kconfig/CMake integration, and public Zephyr header.
port/zephyr/patches/0002-net-l2-wolfip-module.patch Adds NET_L2_WOLFIP to intercept raw Ethernet frames and delegate L3+ to wolfIP.
port/zephyr/patches/0003-net-shell-wolfip.patch Makes Zephyr net-shell commands work when wolfIP is enabled (route/arp/ipv4/dhcp/ping/tcp/udp, etc.).
port/zephyr/patches/0004-sample-wolfip-tap-echo.patch Adds a Zephyr native_sim TAP-based TCP/UDP echo sample using wolfIP.

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

Comment thread src/wolfip.c
Comment thread src/wolfip.c Outdated
Comment thread port/zephyr/patches/0001-wolfip-glue-and-public-api.patch
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 10 out of 10 changed files in this pull request and generated 2 comments.

Comment thread src/wolfip.c
Comment thread src/wolfip.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 #114

Scan targets checked: wolfip-bugs, wolfip-src
Findings: 1

Low (1)

Functional inconsistency in TX interface selection and MAC address derivation

Function: wolfIP_select_nexthop_ex, ip_output_add_header, wolfIP_ll_send_frame, arp_lookup
Category: Logic Error

The routed tx_if from wolfIP_select_nexthop_ex is used for wolfIP_ll_send_frame and arp_lookup operations, while ip_output_add_header still derives the Ethernet source MAC from wolfIP_socket_if_idx(t). This represents a functional inconsistency where different code paths may select different interfaces for routing decisions and MAC address derivation.

Recommendation: Verify that the MAC address derivation in ip_output_add_header is correctly synchronized with the interface selected by wolfIP_select_nexthop_ex, or document the intentional separation of concerns if this behavior is by design. This should be verified to ensure consistent interface selection across the TX path.


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

@danielinux
Copy link
Copy Markdown
Member Author

Fenrir has a point in its comment, but the refactor needed is outside the scope for this PR, and there is no functional issue associated, so leaving as is.

@danielinux danielinux changed the title Zephyr TCP/IP replace Zephyr TCP/IP replacement May 11, 2026
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.

Very nice!

@dgarske dgarske removed their assignment May 11, 2026
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.

5 participants