File tree Expand file tree Collapse file tree 10 files changed +2048
-378
lines changed Expand file tree Collapse file tree 10 files changed +2048
-378
lines changed Original file line number Diff line number Diff line change 4444 run : |
4545 ./build/test-ttl-expired
4646
47+ - name : Testing ICMP socket by stealing system calls in ping
48+ run : |
49+ sudo LD_PRELOAD=$PWD/libwolfip.so ping -c 5 10.10.10.1
50+
4751 - name : Install check
4852 run : |
4953 sudo apt-get install -y check
5559 - name : Run unit tests
5660 run : |
5761 build/test/unit
58-
Original file line number Diff line number Diff line change @@ -27,8 +27,35 @@ A single network interface can be associated with the device.
2727 - Pre-allocated buffers for packet processing in static memory
2828
2929
30+ ## Functional tests with ` LD_PRELOAD `
31+
32+ The POSIX shim builds ` libwolfip.so ` , which can be injected in front of
33+ host tools so that calls to ` socket(2) ` and friends are redirected to the
34+ wolfIP stack and the TAP device (` wtcp0 ` ). After running ` make ` :
35+
36+ ``` sh
37+ sudo LD_PRELOAD=$PWD /libwolfip.so nc 10.10.10.2 80
38+ ```
39+
40+ The example above mirrors the existing ` nc ` -driven demos: any TCP sockets
41+ opened by the intercepted process are serviced by wolfIP instead of the host
42+ kernel.
43+
44+ ### Ping over the TAP device
45+
46+ ICMP datagram sockets can be validated the same way. With the TAP interface
47+ created automatically by the shim and the host endpoint configured in
48+ ` config.h ` (` HOST_STACK_IP ` defaults to ` 10.10.10.1 ` ), run:
49+
50+ ``` sh
51+ sudo LD_PRELOAD=$PWD /libwolfip.so ping -I wtcp0 -c5 10.10.10.1
52+ ```
53+
54+ The ` -I wtcp0 ` flag pins the test to the injected interface and ` -c5 `
55+ generates five echo requests. Successful replies confirm the ICMP
56+ datagram socket support end-to-end through the tap device.
57+
3058## Copyright and License
3159
3260wolfIP is licensed under the GPLv3 license. See the LICENSE file for details.
3361Copyright (c) 2025 wolfSSL Inc.
34-
Original file line number Diff line number Diff line change 1010
1111#define MAX_TCPSOCKETS 4
1212#define MAX_UDPSOCKETS 2
13+ #define MAX_ICMPSOCKETS 2
1314#define RXBUF_SIZE LINK_MTU * 16
1415#define TXBUF_SIZE LINK_MTU * 16
1516
17+ #ifndef WOLFIP_POSIX_TCPDUMP
18+ #define WOLFIP_POSIX_TCPDUMP 0
19+ #endif
20+
1621#define MAX_NEIGHBORS 16
1722
1823#ifndef WOLFIP_MAX_INTERFACES
3439/* Linux test configuration */
3540#define WOLFIP_IP "10.10.10.2"
3641#define HOST_STACK_IP "10.10.10.1"
42+ #define WOLFIP_STATIC_DNS_IP "9.9.9.9"
3743
3844#endif
You can’t perform that action at this time.
0 commit comments