Add switch to enable/disable ipv6 support for sfe and fast-classifier package (#5645)

This commit is contained in:
plutoghost 2020-10-27 17:55:05 +08:00 committed by GitHub
parent cedc143ffe
commit 365348f6b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 3 deletions

View File

@ -49,7 +49,7 @@ Example user space program that communicates with fast
classifier kernel module
endef
SFE_MAKE_OPTS:=SFE_SUPPORT_IPV6=y
SFE_MAKE_OPTS:=SFE_SUPPORT_IPV6=n
define Build/Compile/kmod
+$(MAKE) $(PKG_JOBS) -C "$(LINUX_DIR)" $(strip $(SFE_MAKE_OPTS)) \

View File

@ -346,11 +346,13 @@ static bool fast_classifier_find_dev_and_mac_addr(struct sk_buff *skb, sfe_ip_ad
dst = (struct dst_entry *)rt;
} else {
#ifdef SFE_SUPPORT_IPV6
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 17, 0))
rt6 = rt6_lookup(&init_net, (struct in6_addr *)addr->ip6, 0, 0, NULL, 0);
#else
rt6 = rt6_lookup(&init_net, (struct in6_addr *)addr->ip6, 0, 0, 0);
#endif /*KERNEL_VERSION(4, 17, 0)*/
#endif
if (!rt6) {
goto ret_fail;
}

View File

@ -19,13 +19,18 @@ PKG_RELEASE:=2
include $(INCLUDE_DIR)/package.mk
SFE_SUPPORT_IPV6=n
define KernelPackage/shortcut-fe
SECTION:=kernel
CATEGORY:=Kernel modules
SUBMENU:=Network Support
DEPENDS:=
TITLE:=Kernel driver for SFE
ifeq (${SFE_SUPPORT_IPV6},y)
FILES:=$(PKG_BUILD_DIR)/shortcut-fe.ko $(PKG_BUILD_DIR)/shortcut-fe-ipv6.ko
else
FILES:=$(PKG_BUILD_DIR)/shortcut-fe.ko
endif
KCONFIG:=CONFIG_NF_CONNTRACK_EVENTS=y \
CONFIG_NF_CONNTRACK_TIMEOUT=y \
CONFIG_SHORTCUT_FE=y \
@ -58,7 +63,15 @@ define KernelPackage/shortcut-fe-cm/Description
Simple connection manager for the Shortcut forwarding engine.
endef
EXTRA_CFLAGS+=-DSFE_SUPPORT_IPV6
ifeq (${SFE_SUPPORT_IPV6},y)
EXTRA_CFLAGS+=-DSFE_SUPPORT_IPV6
ISV6=SFE_SUPPORT_IPV6=1
else
ISV6=SFE_SUPPORT_IPV6=""
endif
define Build/Compile
+$(MAKE) $(PKG_JOBS) -C "$(LINUX_DIR)" \
@ -66,7 +79,7 @@ define Build/Compile
$(PKG_MAKE_FLAGS) \
M="$(PKG_BUILD_DIR)" \
EXTRA_CFLAGS="$(EXTRA_CFLAGS)" \
SFE_SUPPORT_IPV6=1 \
${ISV6} \
modules
endef