Skip to content

Commit

Permalink
add support for disabling VXLAN/eBPF support
Browse files Browse the repository at this point in the history
This makes it easier to backport or de-bloat on smaller systems

Signed-off-by: Felix Fietkau <nbd@nbd.name>
  • Loading branch information
nbd168 committed Aug 29, 2022
1 parent 5d79b88 commit 0041fca
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,26 @@ ADD_DEFINITIONS(-Os -Wall -Werror --std=gnu99 -g3 -Wmissing-declarations -DRUNST
FIND_LIBRARY(libjson NAMES json-c json)

OPTION(UBUS_SUPPORT "enable ubus support" ON)
OPTION(VXLAN_SUPPORT "enable VXLAN support" ON)
IF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
FIND_LIBRARY(nl nl-tiny)
SET(SOURCES ${SOURCES} wg-linux.c)
ELSE()
SET(nl "")
SET(VXLAN_SUPPORT OFF)
ENDIF()
IF(VXLAN_SUPPORT)
find_library(bpf NAMES bpf)
find_library(elf NAMES elf)
find_library(zlib NAMES z)
SET(SOURCES ${SOURCES} wg-linux.c vxlan.c bpf.c rtnl.c)
SET(SOURCES ${SOURCES} bpf.c vxlan.c rtnl.c)
ADD_DEFINITIONS(-DVXLAN_SUPPORT)
ELSE()
SET(nl "")
SET(bpf "")
SET(elf "")
SET(zlib "")
ENDIF()

IF(UBUS_SUPPORT)
SET(SOURCES ${SOURCES} ubus.c)
ADD_DEFINITIONS(-DUBUS_SUPPORT=1)
Expand Down
2 changes: 1 addition & 1 deletion service.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ service_add(struct network *net, struct blob_attr *data)
s->type = strcpy(type_buf, type);
if (config)
s->config = memcpy(config_buf, config, blob_pad_len(config));
#ifdef linux
#ifdef VXLAN_SUPPORT
if (type && !strcmp(type, "vxlan"))
s->ops = &vxlan_ops;
#endif
Expand Down

0 comments on commit 0041fca

Please sign in to comment.