add testing for l7 filters, and modify it so that it actually works
git-svn-id: svn://svn.openwrt.org/openwrt/packages@9469 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
075e39fc74
commit
cce4f6ad19
@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
|
|||||||
|
|
||||||
PKG_NAME:=l7-protocols
|
PKG_NAME:=l7-protocols
|
||||||
PKG_VERSION:=2007-10-10
|
PKG_VERSION:=2007-10-10
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=2
|
||||||
|
|
||||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||||
PKG_SOURCE_URL:=@SF/l7-filter
|
PKG_SOURCE_URL:=@SF/l7-filter
|
||||||
@ -15,20 +15,38 @@ define Package/l7-protocols
|
|||||||
CATEGORY:=Network
|
CATEGORY:=Network
|
||||||
TITLE:=Protocols for layer7 filtering
|
TITLE:=Protocols for layer7 filtering
|
||||||
URL:=http://l7-filter.sourceforge.net/
|
URL:=http://l7-filter.sourceforge.net/
|
||||||
|
SUBMENU:=layer7
|
||||||
|
DEPENDS:=iptables-mod-filter
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/l7-protocols/description
|
define Package/l7-protocols/description
|
||||||
l7-filter classifies packets based on patterns in application
|
l7-filter classifies packets based on patterns in application
|
||||||
layer data. This allows correct classification of P2P traffic that
|
layer data. This allows correct classification of P2P traffic that
|
||||||
uses unpredictable ports as well as standard protocols running on
|
uses unpredictable ports as well as standard protocols running on
|
||||||
non-standard ports.
|
non-standard ports.
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/l7-protocols-testing
|
||||||
|
$(call Package/l7-protocols)
|
||||||
|
TITLE:=testing utilities for layer7
|
||||||
|
DEPENDS+=l7-protocols +uclibcxx
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/l7-protocols-testing/description
|
||||||
|
testing utilities for layer 7 patterns
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Build/Configure
|
define Build/Configure
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Build/Compile
|
ifneq ($(SDK)$(CONFIG_PACKAGE_l7-protocols-testing),)
|
||||||
endef
|
define Build/Compile
|
||||||
|
cd $(PKG_BUILD_DIR)/testing && $(MAKE) $(TARGET_CONFIGURE_OPTS) CXX="$(STAGING_DIR)/usr/bin/g++-uc"
|
||||||
|
endef
|
||||||
|
else
|
||||||
|
define Build/Compile
|
||||||
|
endef
|
||||||
|
endif
|
||||||
|
|
||||||
define Package/l7-protocols/install
|
define Package/l7-protocols/install
|
||||||
$(INSTALL_DIR) $(1)/etc/l7-protocols
|
$(INSTALL_DIR) $(1)/etc/l7-protocols
|
||||||
@ -38,8 +56,22 @@ define Package/l7-protocols/install
|
|||||||
$(PKG_BUILD_DIR)/groups.sh \
|
$(PKG_BUILD_DIR)/groups.sh \
|
||||||
$(PKG_BUILD_DIR)/malware \
|
$(PKG_BUILD_DIR)/malware \
|
||||||
$(PKG_BUILD_DIR)/protocols \
|
$(PKG_BUILD_DIR)/protocols \
|
||||||
$(PKG_BUILD_DIR)/testing \
|
|
||||||
$(1)/etc/l7-protocols
|
$(1)/etc/l7-protocols
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
define Package/l7-protocols-testing/install
|
||||||
|
$(INSTALL_DIR) $(1)/etc/l7-protocols/testing
|
||||||
|
$(CP) $(PKG_BUILD_DIR)/testing/data \
|
||||||
|
$(1)/etc/l7-protocols/testing
|
||||||
|
$(INSTALL_BIN) \
|
||||||
|
$(PKG_BUILD_DIR)/testing/rand{chars,printable} \
|
||||||
|
$(PKG_BUILD_DIR)/testing/test_speed-{kernel,userspace} \
|
||||||
|
$(PKG_BUILD_DIR)/testing/match_kernel \
|
||||||
|
$(PKG_BUILD_DIR)/testing/doallspeeds.sh \
|
||||||
|
$(PKG_BUILD_DIR)/testing/test_match.sh \
|
||||||
|
$(PKG_BUILD_DIR)/testing/timeit.sh \
|
||||||
|
$(1)/etc/l7-protocols/testing
|
||||||
|
endef
|
||||||
|
|
||||||
$(eval $(call BuildPackage,l7-protocols))
|
$(eval $(call BuildPackage,l7-protocols))
|
||||||
|
$(eval $(call BuildPackage,l7-protocols-testing))
|
||||||
|
29
net/l7-protocols/patches/100-testing_crosscompile.patch
Normal file
29
net/l7-protocols/patches/100-testing_crosscompile.patch
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
Index: l7-protocols-2007-10-10/testing/Makefile
|
||||||
|
===================================================================
|
||||||
|
--- l7-protocols-2007-10-10.orig/testing/Makefile 2007-10-31 14:40:41.000000000 -0500
|
||||||
|
+++ l7-protocols-2007-10-10/testing/Makefile 2007-10-31 14:40:41.000000000 -0500
|
||||||
|
@@ -1,19 +1,19 @@
|
||||||
|
all: randchars randprintable test_speed-kernel test_speed-userspace match_kernel
|
||||||
|
|
||||||
|
randchars: randchars.c
|
||||||
|
- gcc -O2 -o randchars randchars.c
|
||||||
|
+ $(CC) -O2 -o randchars randchars.c
|
||||||
|
|
||||||
|
randprintable: randprintable.c
|
||||||
|
- gcc -O2 -o randprintable randprintable.c
|
||||||
|
+ $(CC) -O2 -o randprintable randprintable.c
|
||||||
|
|
||||||
|
test_speed-kernel: test_speed-kernel.c
|
||||||
|
- gcc -o test_speed-kernel test_speed-kernel.c
|
||||||
|
+ $(CC) -o test_speed-kernel test_speed-kernel.c
|
||||||
|
|
||||||
|
test_speed-userspace: test_speed-userspace.cpp l7-parse-patterns.cpp l7-parse-patterns.h
|
||||||
|
- g++ -Wall -o test_speed-userspace test_speed-userspace.cpp l7-parse-patterns.cpp
|
||||||
|
+ $(CXX) -Wall -o test_speed-userspace test_speed-userspace.cpp l7-parse-patterns.cpp
|
||||||
|
|
||||||
|
match_kernel: match-kernel.c
|
||||||
|
- gcc -O2 -o match_kernel match-kernel.c
|
||||||
|
+ $(CC) -O2 -o match_kernel match-kernel.c
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f randprintable randchars test_speed-kernel test_speed-userspace match_kernel
|
104
net/l7-protocols/patches/101-testing-timeit.patch
Normal file
104
net/l7-protocols/patches/101-testing-timeit.patch
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
Index: l7-protocols-2007-10-10/testing/timeit.sh
|
||||||
|
===================================================================
|
||||||
|
--- l7-protocols-2007-10-10.orig/testing/timeit.sh 2007-10-31 15:58:48.000000000 -0500
|
||||||
|
+++ l7-protocols-2007-10-10/testing/timeit.sh 2007-10-31 16:02:19.000000000 -0500
|
||||||
|
@@ -1,11 +1,8 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
-# "man 1 time" for details
|
||||||
|
-export TIME="%U seconds"
|
||||||
|
-
|
||||||
|
add()
|
||||||
|
{
|
||||||
|
- if ! dc -e ""; then
|
||||||
|
+ if ! dc p >/dev/null 2>&1; then
|
||||||
|
echo you do not have dc, so I cannot add these numbers...
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
@@ -14,7 +11,7 @@
|
||||||
|
tot=0
|
||||||
|
|
||||||
|
while read n; do
|
||||||
|
- tot=`dc -e "$n $tot + pop" 2> /dev/null`
|
||||||
|
+ tot=`dc $n $tot + p 2> /dev/null`
|
||||||
|
done
|
||||||
|
|
||||||
|
echo $tot seconds
|
||||||
|
@@ -34,7 +31,7 @@
|
||||||
|
|
||||||
|
if [ ! $3 ] || [ $2 == "-h" ] || [ $2 == "--help" ]; then
|
||||||
|
echo
|
||||||
|
- echo Syntax: ./timeit.sh patternfile kernel\|userspace all\|print\|real [data_files]
|
||||||
|
+ echo Syntax: .//usr/bin/timeit.sh patternfile kernel\|userspace all\|print\|real [data_files]
|
||||||
|
echo
|
||||||
|
echo \"kernel\" uses the kernel pattern and library
|
||||||
|
echo \"userspace\" uses userspace pattern and library
|
||||||
|
@@ -72,12 +69,12 @@
|
||||||
|
if [ $3 == "all" ]; then
|
||||||
|
echo Using all characters
|
||||||
|
if [ $2 == "kernel" ]; then
|
||||||
|
- if ! ./randchars | time $speedprog "`extract $1`" verbose; then
|
||||||
|
+ if ! ./randchars | /usr/bin/time $speedprog "`extract $1`" verbose 2>&1 >/dev/null | grep user | cut -d\ -f2; then
|
||||||
|
echo $speedprog failed. > /dev/stderr
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
- if ! ./randchars | time $speedprog -f "$1" -v; then
|
||||||
|
+ if ! ./randchars | /usr/bin/time $speedprog -f "$1" -v 2>&1 >/dev/null | grep user | cut -d\ -f2; then
|
||||||
|
echo $speedprog failed. > /dev/stderr
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
@@ -85,12 +82,12 @@
|
||||||
|
elif [ $3 == "print" ]; then
|
||||||
|
echo Using only printable characters
|
||||||
|
if [ $2 == "kernel" ]; then
|
||||||
|
- if ! ./randprintable | time $speedprog "`extract $1`" verbose; then
|
||||||
|
+ if ! ./randprintable | /usr/bin/time $speedprog "`extract $1`" verbose 2>&1 >/dev/null | grep user | cut -d\ -f2; then
|
||||||
|
echo $speedprog failed. > /dev/stderr
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
- if ! ./randprintable | time $speedprog -f "$1" -v; then
|
||||||
|
+ if ! ./randprintable | /usr/bin/time $speedprog -f "$1" -v 2>&1 >/dev/null | grep user | cut -d\ -f2; then
|
||||||
|
echo $speedprog failed. > /dev/stderr
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
@@ -107,12 +104,12 @@
|
||||||
|
printf $f\\t
|
||||||
|
#echo `extract $1`
|
||||||
|
if [ $2 == "kernel" ]; then
|
||||||
|
- if ! cat $f | time $speedprog "`extract $1`" 2> /dev/stdout | tee -a tmp.$$; then
|
||||||
|
+ if ! cat $f | /usr/bin/time $speedprog "`extract $1`" 2>&1 >/dev/null | grep user | cut -d\ -f2 | tee -a tmp.$$; then
|
||||||
|
echo $speedprog failed. > /dev/stderr
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
- if ! cat $f | time $speedprog -f "$1" 2> /dev/stdout | tee -a tmp.$$; then
|
||||||
|
+ if ! cat $f | /usr/bin/time $speedprog -f "$1" 2>&1 >/dev/null | grep user | cut -d\ -f2 | tee -a tmp.$$; then
|
||||||
|
echo $speedprog failed. > /dev/stderr
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
@@ -123,12 +120,12 @@
|
||||||
|
for f in data/*; do
|
||||||
|
printf $f\\t
|
||||||
|
if [ $2 == "kernel" ]; then
|
||||||
|
- if ! cat $f | time $speedprog "`extract $1`" 2> /dev/stdout | tee -a tmp.$$; then
|
||||||
|
+ if ! cat $f | /usr/bin/time $speedprog "`extract $1`" 2>&1 >/dev/null | grep user | cut -d\ -f2 | tee -a tmp.$$; then
|
||||||
|
echo $speedprog failed. > /dev/stderr
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
- if ! cat $f | time $speedprog -f "$1" 2> /dev/stdout | tee -a tmp.$$; then
|
||||||
|
+ if ! cat $f | /usr/bin/time $speedprog -f "$1" 2>&1 >/dev/null | grep user | cut -d\ -f2 | tee -a tmp.$$; then
|
||||||
|
echo $speedprog failed. > /dev/stderr
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
@@ -137,7 +134,7 @@
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf Total:\
|
||||||
|
- cat tmp.$$ | cut -d\ -f 2 | add
|
||||||
|
+ cat tmp.$$ | cut -ds -f 1| add
|
||||||
|
|
||||||
|
rm tmp.$$
|
||||||
|
else
|
18
net/l7-protocols/patches/102-testing-doallspeeds.patch
Normal file
18
net/l7-protocols/patches/102-testing-doallspeeds.patch
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
Index: l7-protocols-2007-10-10/testing/doallspeeds.sh
|
||||||
|
===================================================================
|
||||||
|
--- l7-protocols-2007-10-10.orig/testing/doallspeeds.sh 2007-10-31 16:07:03.000000000 -0500
|
||||||
|
+++ l7-protocols-2007-10-10/testing/doallspeeds.sh 2007-10-31 16:07:20.000000000 -0500
|
||||||
|
@@ -25,11 +25,11 @@
|
||||||
|
printf `basename $f .pat`
|
||||||
|
|
||||||
|
if [ $userspace ]; then
|
||||||
|
- gtime=`./timeit.sh $f userspace real | grep Total | cut -d\ -f 2`
|
||||||
|
+ gtime=`./timeit.sh $f userspace real | grep Total | cut -d\ -f 2 | awk '{print $1}'`
|
||||||
|
printf \\t$gtime
|
||||||
|
fi
|
||||||
|
if [ $kernel ]; then
|
||||||
|
- htime=`./timeit.sh $f kernel real | grep Total | cut -d\ -f 2`
|
||||||
|
+ htime=`./timeit.sh $f kernel real | grep Total | cut -d\ -f 2 | awk '{print $1}'`
|
||||||
|
printf \\t$htime
|
||||||
|
fi
|
||||||
|
printf \\n
|
Loading…
x
Reference in New Issue
Block a user