diff --git a/package/lean/fast-classifier/Makefile b/package/lean/fast-classifier/Makefile index 1bb5cba853..5fe73bc7bf 100644 --- a/package/lean/fast-classifier/Makefile +++ b/package/lean/fast-classifier/Makefile @@ -23,6 +23,18 @@ define KernelPackage/fast-classifier/description FAST Classifier talks to SFE to make decisions about offloading connections endef +define Package/fast-classifier-example + SECTION:=net + CATEGORY:=Network + TITLE:=Example user space program for fast-classifier + DEPENDS:=+kmod-fast-classifier +libnl +endef + +define Package/fast-classifier-example/description + Example user space program that communicates with fast + classifier kernel module. +endef + SFE_MAKE_OPTS:=SFE_SUPPORT_IPV6=y define Build/Compile @@ -33,6 +45,15 @@ define Build/Compile CONFIG_FAST_CLASSIFIER=m \ EXTRA_CFLAGS="$(EXTRA_CFLAGS)" \ modules + +ifneq ($(CONFIG_PACKAGE_fast-classifier-example),) + $(TARGET_CC) -o $(PKG_BUILD_DIR)/userspace_fast_classifier \ + -I $(PKG_BUILD_DIR) \ + -I$(STAGING_DIR)/usr/include/libnl \ + -I$(STAGING_DIR)/usr/include/libnl3 \ + -lnl-genl-3 -lnl-3 \ + $(PKG_BUILD_DIR)/nl_classifier_test.c +endif endef define Build/InstallDev @@ -40,4 +61,10 @@ define Build/InstallDev $(CP) $(PKG_BUILD_DIR)/fast-classifier.h $(1)/usr/include/ endef +define Package/fast-classifier-example/install + $(INSTALL_DIR) $(1)/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/userspace_fast_classifier $(1)/sbin/ +endef + $(eval $(call KernelPackage,fast-classifier)) +$(eval $(call BuildPackage,fast-classifier-example))