Skip to content
Merged
5 changes: 4 additions & 1 deletion .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ jobs:
run: |
./build/test-ttl-expired

- name: Testing ICMP socket by stealing system calls in ping
run: |
sudo LD_PRELOAD=$PWD/libwolfip.so ping -c 5 10.10.10.1

- name: Install check
run: |
sudo apt-get install -y check
Expand All @@ -55,4 +59,3 @@ jobs:
- name: Run unit tests
run: |
build/test/unit

29 changes: 28 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,35 @@ A single network interface can be associated with the device.
- Pre-allocated buffers for packet processing in static memory


## Functional tests with `LD_PRELOAD`

The POSIX shim builds `libwolfip.so`, which can be injected in front of
host tools so that calls to `socket(2)` and friends are redirected to the
wolfIP stack and the TAP device (`wtcp0`). After running `make`:

```sh
sudo LD_PRELOAD=$PWD/libwolfip.so nc 10.10.10.2 80
```

The example above mirrors the existing `nc`-driven demos: any TCP sockets
opened by the intercepted process are serviced by wolfIP instead of the host
kernel.

### Ping over the TAP device

ICMP datagram sockets can be validated the same way. With the TAP interface
created automatically by the shim and the host endpoint configured in
`config.h` (`HOST_STACK_IP` defaults to `10.10.10.1`), run:

```sh
sudo LD_PRELOAD=$PWD/libwolfip.so ping -I wtcp0 -c5 10.10.10.1
```

The `-I wtcp0` flag pins the test to the injected interface and `-c5`
generates five echo requests. Successful replies confirm the ICMP
datagram socket support end-to-end through the tap device.

## Copyright and License

wolfIP is licensed under the GPLv3 license. See the LICENSE file for details.
Copyright (c) 2025 wolfSSL Inc.

6 changes: 6 additions & 0 deletions config.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,14 @@

#define MAX_TCPSOCKETS 4
#define MAX_UDPSOCKETS 2
#define MAX_ICMPSOCKETS 2
#define RXBUF_SIZE LINK_MTU * 16
#define TXBUF_SIZE LINK_MTU * 16

#ifndef WOLFIP_POSIX_TCPDUMP
#define WOLFIP_POSIX_TCPDUMP 0
#endif

#define MAX_NEIGHBORS 16

#ifndef WOLFIP_MAX_INTERFACES
Expand All @@ -34,5 +39,6 @@
/* Linux test configuration */
#define WOLFIP_IP "10.10.10.2"
#define HOST_STACK_IP "10.10.10.1"
#define WOLFIP_STATIC_DNS_IP "9.9.9.9"

#endif
Loading