Skip to content

Commit

Permalink
Add switch to enable/disable ipv6 support for sfe and fast-classifie…
Browse files Browse the repository at this point in the history
…r package (coolsnowwolf#5645)
  • Loading branch information
plutoghost authored Oct 27, 2020
1 parent cedc143 commit 365348f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package/lean/fast-classifier/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)) \
Expand Down
2 changes: 2 additions & 0 deletions package/lean/fast-classifier/src/fast-classifier.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
17 changes: 15 additions & 2 deletions package/lean/shortcut-fe/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down Expand Up @@ -58,15 +63,23 @@ 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)" \
$(KERNEL_MAKE_FLAGS) \
$(PKG_MAKE_FLAGS) \
M="$(PKG_BUILD_DIR)" \
EXTRA_CFLAGS="$(EXTRA_CFLAGS)" \
SFE_SUPPORT_IPV6=1 \
${ISV6} \
modules
endef

Expand Down

0 comments on commit 365348f

Please sign in to comment.