Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Openwrt makefile #61

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion README
Original file line number Diff line number Diff line change
Expand Up @@ -572,10 +572,21 @@ ipt_NETFLOW linux 2.6.x-4.x kernel module by <[email protected]> -- 2008-2016.
desirable to combine it with packet processing on very highly loaded
routers.

This option also could be changed at runtime with:
This option could be changed at runtime with:

# echo number > /sys/module/ipt_NETFLOW/parameters/exportcpu

engine_id=number
- Observation Domain ID (on IPFIX, Source Id on NetFlow v9, or Engine Id
on NetFlow v5) value to be exported. This may help your collector to
distinguish between multiple exporters. On Netflow v9 and IPFIX this
value is 32-bit on NetFlow v5 only 8 low bits are significant.
Default value is 0.

This option could be changed at runtime with:

# echo number > /sys/module/ipt_NETFLOW/parameters/engine_id


====================
= HOW TO READ STAT =
Expand Down
2 changes: 1 addition & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ do
--disable-snmp-a*) SKIPSNMP=1 ;;
--disable-net-snmp*) SKIPSNMP=1 ;;
--disable-dkms*) SKIPDKMS=1 ;;
--from-dkms-conf) ;;
--from-dkms-conf*) ;;
--make) echo called from make; CARGS=`echo $CARGS | sed s/--make//g` ;;
-Werror) KOPTS="$KOPTS -Werror" ;;
--help|-h) show_help ;;
Expand Down
7 changes: 5 additions & 2 deletions ipt_NETFLOW.c
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,10 @@ MODULE_PARM_DESC(maxflows, "maximum number of flows");
static int peakflows = 0;
static unsigned long peakflows_at; /* jfffies */

static int engine_id = 0;
module_param(engine_id, int, 0644);
MODULE_PARM_DESC(engine_id, "Observation Domain ID");

#ifdef ENABLE_AGGR
#define AGGR_SIZE 1024
static char aggregation_buf[AGGR_SIZE] = "";
Expand Down Expand Up @@ -271,7 +275,6 @@ static union {
struct netflow9_pdu v9;
struct ipfix_pdu ipfix;
} pdu;
static int engine_id = 0; /* Observation Domain */
static __u8 *pdu_data_used;
static __u8 *pdu_high_wm; /* high watermark */
static struct flowset_data *pdu_flowset = NULL; /* current data flowset */
Expand Down Expand Up @@ -2532,7 +2535,7 @@ static void netflow_export_pdu_v5(void)
pdu.v5.ts_unsecs = htonl(tv.tv_usec);
pdu.v5.seq = htonl(pdu_seq);
//pdu.v5.eng_type = 0;
pdu.v5.eng_id = engine_id;
pdu.v5.eng_id = (__u8)engine_id;
#ifdef ENABLE_SAMPLER
pdu.v5.sampling = htons(sampler_nf_v5());
#endif
Expand Down
50 changes: 50 additions & 0 deletions openwrt/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk

PKG_NAME:=ipt-netflow
PKG_VERSION:=2.2
PKG_RELEASE:=1
PKG_MD5SUM:=5952f05d6a067400d0225b7524cde590

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tgz
PKG_SOURCE_URL:=@SF/ipt-netflow

PKG_BUILD_DIR := $(KERNEL_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_DEPENDS:=iptables

include $(INCLUDE_DIR)/package.mk

define KernelPackage/ipt-netflow
SECTION:=net
CATEGORY:=Network
SUBMENU:=Netflow
TITLE:=Netflow iptables module for Linux kernel
URL:=http://ipt-netflow.sourceforge.net/
FILES:=$(PKG_BUILD_DIR)/ipt_NETFLOW.ko
DEPENDS:=+iptables
endef

define Package/iptables-mod-netflow
SECTION:=net
CATEGORY:=Network
SUBMENU:=Netflow
TITLE:=Netflow iptables module for Linux kernel
URL:=http://ipt-netflow.sourceforge.net/
DEPENDS:=+kmod-ipt-netflow libc
endef

CONFIGURE_ARGS:= \
--kdir="$(LINUX_DIR)" \
--ipt-ver=1.4.21 \
--disable-dkms \
--disable-snmp-agent

$(eval $(call KernelPackage,ipt-netflow))

$(eval $(call Package,kmod-ipt-netflow))

define Package/iptables-mod-netflow/install
$(MAKE) -C $(PKG_BUILD_DIR) DESTDIR=$(1) linstall
endef

$(eval $(call BuildPackage,iptables-mod-netflow))
17 changes: 17 additions & 0 deletions openwrt/patches/310-Makefile_crosscompile.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Index: ipt-netflow-2.2/Makefile.in
===================================================================
--- ipt-netflow-2.2.orig/Makefile.in
+++ ipt-netflow-2.2/Makefile.in
@@ -64,10 +64,10 @@ sinstall: | snmp_NETFLOW.so IPT-NETFLOW-
fi

%_sh.o: libipt_NETFLOW.c
- gcc -O2 -Wall -Wunused $(IPTABLES_CFLAGS) -fPIC -o $@ -c libipt_NETFLOW.c
+ $(CC) $(CFLAGS) -O2 -Wall -Wunused $(IPTABLES_CFLAGS) -fPIC -o $@ -c libipt_NETFLOW.c

%.so: %_sh.o
- gcc -shared -o $@ $<
+ $(CC) -shared -o $@ $<

version.h: ipt_NETFLOW.c ipt_NETFLOW.h compat.h Makefile
@./version.sh --define > version.h