Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ jobs:
- name: Build linux tests
run: |
mkdir -p build/port
make
make EXTRA_CFLAGS="-DWOLFIP_RAWSOCKETS=1 -DWOLFIP_PACKET_SOCKETS=1"
make EXTRA_CFLAGS="-DWOLFIP_RAWSOCKETS=1 -DWOLFIP_PACKET_SOCKETS=1" build/raw_ping build/packet_ping

- name: Run standalone "event loop" test
timeout-minutes: 5
Expand Down Expand Up @@ -73,6 +74,18 @@ jobs:
set -euo pipefail
timeout --preserve-status 2m sudo LD_PRELOAD=$PWD/libwolfip.so ping -c 5 10.10.10.1

- name: Testing raw sockets with raw_ping
timeout-minutes: 2
run: |
set -euo pipefail
timeout --preserve-status 2m sudo ./build/raw_ping 10.10.10.1

- name: Testing packet sockets with packet_ping
timeout-minutes: 2
run: |
set -euo pipefail
timeout --preserve-status 2m sudo ./build/packet_ping wtcp0 10.10.10.1

- name: Install check
run: |
sudo apt-get install -y check
Expand Down
13 changes: 12 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
CC?=gcc
CFLAGS:=-Wall -Werror -Wextra -I. -D_GNU_SOURCE
CFLAGS+=-g -ggdb -Wdeclaration-after-statement
EXTRA_CFLAGS?=
CFLAGS+=$(EXTRA_CFLAGS)
LDFLAGS+=-pthread
# additional debug flags:
# CFLAGS+=-DDEBUG_TAP
Expand Down Expand Up @@ -155,7 +157,8 @@ endif
EXE=build/tcpecho build/tcp_netcat_poll build/tcp_netcat_select \
build/test-evloop build/test-dns build/test-wolfssl-forwarding \
build/test-ttl-expired build/test-wolfssl build/test-httpd \
build/ipfilter-logger build/test-esp build/esp-server
build/ipfilter-logger \
build/test-esp build/esp-server
LIB=libwolfip.so

PREFIX=/usr/local
Expand Down Expand Up @@ -233,6 +236,14 @@ build/tcp_netcat_select: $(OBJ) build/port/posix/bsd_socket.o build/test/tcp_net
@echo "[LD] $@"
@$(CC) $(CFLAGS) -o $@ $(BEGIN_GROUP) $(^) $(LDFLAGS) $(END_GROUP)

build/raw_ping: $(OBJ) build/port/posix/bsd_socket.o build/test/raw_ping.o
@echo "[LD] $@"
@$(CC) $(CFLAGS) -o $@ $(BEGIN_GROUP) $(^) $(LDFLAGS) $(END_GROUP)

build/packet_ping: $(OBJ) build/port/posix/bsd_socket.o build/test/packet_ping.o
@echo "[LD] $@"
@$(CC) $(CFLAGS) -o $@ $(BEGIN_GROUP) $(^) $(LDFLAGS) $(END_GROUP)


build/test-wolfssl:CFLAGS+=-Wno-cpp -DWOLFSSL_DEBUG -DWOLFSSL_WOLFIP
build/test-httpd:CFLAGS+=-Wno-cpp -DWOLFSSL_DEBUG -DWOLFSSL_WOLFIP -Isrc/http
Expand Down
22 changes: 22 additions & 0 deletions config.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,28 @@
#define WOLFIP_MAX_INTERFACES 2
#endif

#ifndef WOLFIP_RAWSOCKETS
#define WOLFIP_RAWSOCKETS 0
#endif

#ifndef WOLFIP_MAX_RAWSOCKETS
#define WOLFIP_MAX_RAWSOCKETS 4
#endif

#ifndef WOLFIP_PACKET_SOCKETS
#define WOLFIP_PACKET_SOCKETS 0
#endif

#if WOLFIP_PACKET_SOCKETS && !defined(ETHERNET)
#undef WOLFIP_PACKET_SOCKETS
#define WOLFIP_PACKET_SOCKETS 0
#error "WOLFIP_PACKET_SOCKETS requires ETHERNET to be defined. Please adjust your configuration."
#endif

#ifndef WOLFIP_MAX_PACKETSOCKETS
#define WOLFIP_MAX_PACKETSOCKETS 2
#endif

#ifndef WOLFIP_ENABLE_FORWARDING
#define WOLFIP_ENABLE_FORWARDING 0
#endif
Expand Down
Loading