File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3535 - name : Build linux tests
3636 run : |
3737 mkdir -p build/port
38- make
38+ make EXTRA_CFLAGS="-DWOLFIP_RAWSOCKETS=1 -DWOLFIP_PACKET_SOCKETS=1"
39+ make EXTRA_CFLAGS="-DWOLFIP_RAWSOCKETS=1 -DWOLFIP_PACKET_SOCKETS=1" build/raw_ping build/packet_ping
3940
4041 - name : Run standalone "event loop" test
4142 timeout-minutes : 5
@@ -102,6 +103,18 @@ jobs:
102103 set -euo pipefail
103104 timeout --preserve-status 2m sudo LD_PRELOAD=$PWD/libwolfip.so ping -4 -n -c 5 127.0.0.1
104105
106+ - name : Testing raw sockets with raw_ping
107+ timeout-minutes : 2
108+ run : |
109+ set -euo pipefail
110+ timeout --preserve-status 2m sudo ./build/raw_ping 10.10.10.1
111+
112+ - name : Testing packet sockets with packet_ping
113+ timeout-minutes : 2
114+ run : |
115+ set -euo pipefail
116+ timeout --preserve-status 2m sudo ./build/packet_ping wtcp0 10.10.10.1
117+
105118 - name : Install check
106119 run : |
107120 sudo apt-get install -y check
Original file line number Diff line number Diff line change 11CC? =gcc
22CFLAGS: =-Wall -Werror -Wextra -I. -D_GNU_SOURCE
33CFLAGS+ =-g -ggdb -Wdeclaration-after-statement
4+ EXTRA_CFLAGS? =
45CFLAGS+ =$(EXTRA_CFLAGS )
56LDFLAGS+ =-pthread
67# additional debug flags:
@@ -160,7 +161,8 @@ endif
160161EXE =build/tcpecho build/tcp_netcat_poll build/tcp_netcat_select \
161162 build/test-evloop build/test-dns build/test-wolfssl-forwarding \
162163 build/test-ttl-expired build/test-wolfssl build/test-httpd \
163- build/ipfilter-logger build/test-esp build/esp-server
164+ build/ipfilter-logger \
165+ build/test-esp build/esp-server
164166ifeq ($(UNAME_S ) ,Linux)
165167 EXE+ = build/test-evloop-tun
166168endif
@@ -256,6 +258,14 @@ build/tcp_netcat_select: $(OBJ) build/port/posix/bsd_socket.o build/test/tcp_net
256258 @echo " [LD] $@ "
257259 @$(CC ) $(CFLAGS ) -o $@ $(BEGIN_GROUP ) $(^ ) $(LDFLAGS ) $(END_GROUP )
258260
261+ build/raw_ping : $(OBJ ) build/port/posix/bsd_socket.o build/test/raw_ping.o
262+ @echo " [LD] $@ "
263+ @$(CC ) $(CFLAGS ) -o $@ $(BEGIN_GROUP ) $(^ ) $(LDFLAGS ) $(END_GROUP )
264+
265+ build/packet_ping : $(OBJ ) build/port/posix/bsd_socket.o build/test/packet_ping.o
266+ @echo " [LD] $@ "
267+ @$(CC ) $(CFLAGS ) -o $@ $(BEGIN_GROUP ) $(^ ) $(LDFLAGS ) $(END_GROUP )
268+
259269
260270build/test-wolfssl:CFLAGS+ =-Wno-cpp -DWOLFSSL_DEBUG -DWOLFSSL_WOLFIP
261271build/test-httpd:CFLAGS+ =-Wno-cpp -DWOLFSSL_DEBUG -DWOLFSSL_WOLFIP -Isrc/http
Original file line number Diff line number Diff line change @@ -18,6 +18,18 @@ configured to forward traffic between multiple network interfaces.
1818- Multi-interface support
1919- Optional IPv4-forwarding
2020
21+ ## Supported socket types
22+
23+ wolfIP exposes a BSD-like ` socket(2) ` API for IPv4 sockets:
24+
25+ | Domain | Type | Protocol | Notes |
26+ | --------| ------| ----------| -------|
27+ | ` AF_INET ` | ` SOCK_STREAM ` / ` IPSTACK_SOCK_STREAM ` | TCP | Connection-oriented TCP sockets |
28+ | ` AF_INET ` | ` SOCK_DGRAM ` / ` IPSTACK_SOCK_DGRAM ` | UDP, or ` 0 ` | UDP datagram sockets |
29+ | ` AF_INET ` | ` SOCK_DGRAM ` / ` IPSTACK_SOCK_DGRAM ` | ICMP | ICMP datagram sockets, used for ping-style traffic |
30+ | ` AF_INET ` | ` SOCK_RAW ` / ` IPSTACK_SOCK_RAW ` | IP protocol number | IPv4 raw sockets when ` WOLFIP_RAWSOCKETS ` is enabled |
31+ | ` AF_PACKET ` | ` SOCK_RAW ` / ` IPSTACK_SOCK_RAW ` | Ethernet protocol number | Link-layer packet sockets when ` WOLFIP_PACKET_SOCKETS ` is enabled |
32+
2133## Protocols and RFCs
2234
2335| Layer | Protocol | Features | RFC(s) |
Original file line number Diff line number Diff line change 3535#define WOLFIP_MAX_INTERFACES 2
3636#endif
3737
38+ #ifndef WOLFIP_RAWSOCKETS
39+ #define WOLFIP_RAWSOCKETS 0
40+ #endif
41+
42+ #ifndef WOLFIP_MAX_RAWSOCKETS
43+ #define WOLFIP_MAX_RAWSOCKETS 4
44+ #endif
45+
46+ #ifndef WOLFIP_PACKET_SOCKETS
47+ #define WOLFIP_PACKET_SOCKETS 0
48+ #endif
49+
50+ #if WOLFIP_PACKET_SOCKETS && !defined(ETHERNET )
51+ #undef WOLFIP_PACKET_SOCKETS
52+ #define WOLFIP_PACKET_SOCKETS 0
53+ #error "WOLFIP_PACKET_SOCKETS requires ETHERNET to be defined. Please adjust your configuration."
54+ #endif
55+
56+ #ifndef WOLFIP_MAX_PACKETSOCKETS
57+ #define WOLFIP_MAX_PACKETSOCKETS 2
58+ #endif
59+
3860#ifndef WOLFIP_ENABLE_FORWARDING
3961#define WOLFIP_ENABLE_FORWARDING 0
4062#endif
You can’t perform that action at this time.
0 commit comments