From: Felix Fietkau Date: Mon, 29 Aug 2022 18:52:20 +0000 (+0200) Subject: add support for disabling VXLAN/eBPF support X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=0041fcacb62492653a1054098ec7d811d8eaacbf;p=project%2Funetd.git add support for disabling VXLAN/eBPF support This makes it easier to backport or de-bloat on smaller systems Signed-off-by: Felix Fietkau --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 1776076..8c0e5e8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/service.c b/service.c index 668eaf0..73cf5b8 100644 --- 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