add support for disabling VXLAN/eBPF support
authorFelix Fietkau <nbd@nbd.name>
Mon, 29 Aug 2022 18:52:20 +0000 (20:52 +0200)
committerFelix Fietkau <nbd@nbd.name>
Mon, 29 Aug 2022 18:52:22 +0000 (20:52 +0200)
This makes it easier to backport or de-bloat on smaller systems

Signed-off-by: Felix Fietkau <nbd@nbd.name>
CMakeLists.txt
service.c

index 17760766850268be2961818c6898076cda0d134e..8c0e5e88c5fa161817997c70985273088631554b 100644 (file)
@@ -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)
index 668eaf06bd40ab4002ad1445ee80749f2e7b6d60..73cf5b8146ff5c289f86cffd671aaa4ce18918fd 100644 (file)
--- a/service.c
+++ b/service.c
@@ -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