fastd: make L2TP support a config option instead of a variant

We enable the option by default, but do not depend on the kernel modules
required for L2TP offloading to avoid wasting space when the feature is
not needed. To use offloading, kmod-l2tp-eth must be installed.

Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
This commit is contained in:
Matthias Schiffer 2021-06-27 16:46:38 +02:00
parent 62742985d7
commit 03ff71d5ba
No known key found for this signature in database
GPG key ID: 16EF3F64CB201D9C
2 changed files with 9 additions and 26 deletions

View file

@ -1,4 +1,4 @@
if PACKAGE_fastd || PACKAGE_fastd-l2tp if PACKAGE_fastd
menu "Configuration" menu "Configuration"
@ -76,6 +76,10 @@ config FASTD_WITH_STATUS_SOCKET
bool "Include support for status sockets" bool "Include support for status sockets"
default y default y
config FASTD_WITH_OFFLOAD_L2TP
bool "Enable L2TP offloading"
default y
endmenu endmenu
endif endif

View file

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=fastd PKG_NAME:=fastd
PKG_VERSION:=22 PKG_VERSION:=22
PKG_RELEASE=2 PKG_RELEASE=3
PKG_MAINTAINER:=Matthias Schiffer <mschiffer@universe-factory.net> PKG_MAINTAINER:=Matthias Schiffer <mschiffer@universe-factory.net>
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
@ -39,7 +39,8 @@ PKG_CONFIG_DEPENDS:=\
CONFIG_FASTD_WITH_CMDLINE_OPERATION \ CONFIG_FASTD_WITH_CMDLINE_OPERATION \
CONFIG_FASTD_WITH_CMDLINE_COMMANDS \ CONFIG_FASTD_WITH_CMDLINE_COMMANDS \
CONFIG_FASTD_WITH_DYNAMIC_PEERS \ CONFIG_FASTD_WITH_DYNAMIC_PEERS \
CONFIG_FASTD_WITH_STATUS_SOCKET CONFIG_FASTD_WITH_STATUS_SOCKET \
CONFIG_FASTD_WITH_OFFLOAD_L2TP
PKG_BUILD_DEPENDS:=meson/host nacl PKG_BUILD_DEPENDS:=meson/host nacl
@ -55,14 +56,6 @@ define Package/fastd
TITLE:=Fast and Secure Tunneling Daemon TITLE:=Fast and Secure Tunneling Daemon
URL:=https://github.com/NeoRaider/fastd/ URL:=https://github.com/NeoRaider/fastd/
SUBMENU:=VPN SUBMENU:=VPN
VARIANT:=default
endef
define Package/fastd-l2tp
$(Package/fastd)
DEPENDS+=+kmod-l2tp +kmod-l2tp-eth
TITLE+=(L2TP kernel offloading)
VARIANT:=l2tp
PROVIDES:=fastd
endef endef
define Package/fastd/config define Package/fastd/config
@ -93,32 +86,20 @@ MESON_ARGS += \
-Dmethod_null=$(call feature,ENABLE_METHOD_NULL) \ -Dmethod_null=$(call feature,ENABLE_METHOD_NULL) \
-Dmethod_null_l2tp=$(call feature,ENABLE_METHOD_NULL_L2TP) \ -Dmethod_null_l2tp=$(call feature,ENABLE_METHOD_NULL_L2TP) \
-Dstatus_socket=$(call feature,WITH_STATUS_SOCKET) \ -Dstatus_socket=$(call feature,WITH_STATUS_SOCKET) \
-Doffload_l2tp=disabled \ -Doffload_l2tp=$(call feature,WITH_OFFLOAD_L2TP) \
-Dlibmnl_builtin=true \ -Dlibmnl_builtin=true \
-Dsystemd=disabled \ -Dsystemd=disabled \
-Duse_nacl=true \ -Duse_nacl=true \
-Db_lto=true \ -Db_lto=true \
-Dprefix=/usr -Dprefix=/usr
ifeq ($(BUILD_VARIANT),l2tp)
MESON_ARGS += \
-Dmethod_null_l2tp=enabled \
-Doffload_l2tp=enabled
endif
define Package/fastd/description define Package/fastd/description
Fast and secure tunneling daemon, which is optimized on small code size and few dependencies Fast and secure tunneling daemon, which is optimized on small code size and few dependencies
endef endef
define Package/fastd-l2tp/description
$(Package/fastd/description)
This variant enables L2TP kernel offloadig support.
endef
define Package/fastd/conffiles define Package/fastd/conffiles
/etc/config/fastd /etc/config/fastd
endef endef
Package/fastd-l2tp/conffiles = $(Package/fastd/conffiles)
define Package/fastd/install define Package/fastd/install
$(INSTALL_DIR) $(1)/usr/bin $(INSTALL_DIR) $(1)/usr/bin
@ -132,7 +113,5 @@ define Package/fastd/install
$(INSTALL_DIR) $(1)/lib/upgrade/keep.d $(INSTALL_DIR) $(1)/lib/upgrade/keep.d
$(INSTALL_DATA) files/fastd.upgrade $(1)/lib/upgrade/keep.d/fastd $(INSTALL_DATA) files/fastd.upgrade $(1)/lib/upgrade/keep.d/fastd
endef endef
Package/fastd-l2tp/install = $(Package/fastd/install)
$(eval $(call BuildPackage,fastd)) $(eval $(call BuildPackage,fastd))
$(eval $(call BuildPackage,fastd-l2tp))