Skip to content

Zephyr port: Replace Zephyr's stock TCP/IP with wolfIP#113

Closed
danielinux wants to merge 4 commits into
wolfSSL:masterfrom
danielinux:zephyr-port
Closed

Zephyr port: Replace Zephyr's stock TCP/IP with wolfIP#113
danielinux wants to merge 4 commits into
wolfSSL:masterfrom
danielinux:zephyr-port

Conversation

@danielinux
Copy link
Copy Markdown
Member

  • Added routing tables for proper IPv4 traffic routing
  • Patches for zephyr 4.4.0 to replace the stock TCP/IP stack with wolfIP

Copilot AI review requested due to automatic review settings May 11, 2026 14:27
@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 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 thread wolfip.h Outdated
Comment on lines +281 to +283
#define WOLFIP_HAVE_POSIX_TYPES 1
#if __has_include(<sys/uio.h>)
#include <sys/uio.h>
Comment thread src/wolfip.c
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 thread src/wolfip.c
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"
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.

2 participants