Zephyr port: Replace Zephyr's stock TCP/IP with wolfIP#113
Closed
danielinux wants to merge 4 commits into
Closed
Conversation
Member
danielinux
commented
May 11, 2026
- Added routing tables for proper IPv4 traffic routing
- Patches for zephyr 4.4.0 to replace the stock TCP/IP stack with wolfIP
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds Zephyr RTOS integration artifacts (out-of-tree patch set + documentation) for replacing Zephyr’s native IPv4 stack with wolfIP, and extends wolfIP core with a simple IPv4 routing table + DNS server accessor to support the port’s routing and shell needs.
Changes:
- Add static routing-table support to wolfIP (add/delete/lookup/enumerate) and use it for next-hop / egress interface selection.
- Expose DNS server getter and add unit tests covering route-table behavior.
- Add Zephyr port documentation and the patch series implementing the Zephyr-side glue, L2 module, shell support, and sample.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| wolfip.h | Adds public route-info struct + route APIs, DNS server getter, and adjusts POSIX header probing |
| src/wolfip.c | Implements route table storage, route lookup (LPM), and route CRUD/enumeration APIs; updates nexthop selection to use routing |
| src/test/unit/unit.c | Registers new unit tests for routing behavior (when forwarding enabled) |
| src/test/unit/unit_tests_proto.c | Adds new routing-table unit tests (LPM, default route fallback, update semantics, connected-subnet preference) |
| port/zephyr/README.md | Adds detailed Zephyr port design/usage documentation and patch breakdown |
| port/zephyr/patches/0001-wolfip-glue-and-public-api.patch | Zephyr-side public header + runtime glue + control wrappers + Kconfig/CMake integration |
| port/zephyr/patches/0002-net-l2-wolfip-module.patch | Zephyr NET_L2_WOLFIP module to hand raw Ethernet frames to wolfIP |
| port/zephyr/patches/0003-net-shell-wolfip.patch | Zephyr net-shell extensions to use wolfIP control wrappers and sockets |
| port/zephyr/patches/0004-sample-wolfip-tap-echo.patch | Adds a Zephyr TAP-based echo sample demonstrating the integration |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+281
to
+283
| #define WOLFIP_HAVE_POSIX_TYPES 1 | ||
| #if __has_include(<sys/uio.h>) | ||
| #include <sys/uio.h> |
Comment on lines
+1843
to
+1847
| const struct ipconf *conf = wolfIP_ipconf_at(s, i); | ||
| uint8_t prefix_len; | ||
|
|
||
| if (!conf || conf->ip == IPADDR_ANY) | ||
| continue; |
Comment on lines
1374
to
+1376
| uint64_t last_tick; | ||
| uint32_t route_generation; | ||
| struct wolfIP_route_entry routes[WOLFIP_MAX_ROUTES]; |
Comment on lines
+1153
to
+1164
| + * NOTE: wolfip_is_supported_family() in wolfip_zephyr.c currently | ||
| + * only allows proto == 0 / IPPROTO_TCP / IPPROTO_UDP. IPPROTO_ICMP | ||
| + * is not yet whitelisted there, so this socket() call will fail with | ||
| + * EAFNOSUPPORT until wolfip_is_supported_family is updated to also | ||
| + * accept IPPROTO_ICMP for SOCK_DGRAM. | ||
| + */ | ||
| + int fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_ICMP); | ||
| + | ||
| + if (fd < 0) { | ||
| + shell_error(sh, "wolfIP ICMP socket: %d (errno %d) — " | ||
| + "IPPROTO_ICMP not yet allowed in " | ||
| + "wolfip_is_supported_family()", fd, errno); |
Comment on lines
+1213
to
+1217
| +struct wolfIP_route_info { | ||
| + uint32_t prefix; | ||
| + uint32_t gateway; | ||
| + uint8_t prefix_len; | ||
| + uint8_t if_idx; |
| +++ b/samples/net/sockets/wolfip_tap_echo/boards/native_sim.conf | ||
| @@ -0,0 +1,3 @@ | ||
| +CONFIG_ETH_NATIVE_TAP_RANDOM_MAC=n | ||
| +CONFIG_ETH_NATIVE_TAP_MAC_ADDR="00:00:5e:00:53:61" |
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.