Browse Source

l7-protocol: import from old package repository

gwlim 10 years ago
parent
commit
f9f85e33ad

+ 87
- 0
net/l7-protocols/Makefile View File

@@ -0,0 +1,87 @@
1
+#
2
+# Copyright (C) 2014 OpenWrt.org
3
+#
4
+# This is free software, licensed under the GNU General Public License v2.
5
+# See /LICENSE for more information.
6
+#
7
+
8
+include $(TOPDIR)/rules.mk
9
+
10
+PKG_NAME:=l7-protocols
11
+PKG_VERSION:=2009-05-28
12
+PKG_RELEASE:=2
13
+PKG_LICENSE:=GPL-2.0
14
+
15
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
16
+PKG_SOURCE_URL:=@SF/l7-filter
17
+PKG_MD5SUM:=91be154d12134dcdbc560cc7aa7fe4ce
18
+
19
+include $(INCLUDE_DIR)/uclibc++.mk
20
+include $(INCLUDE_DIR)/package.mk
21
+
22
+define Package/l7-protocols
23
+  SECTION:=net
24
+  CATEGORY:=Network
25
+  TITLE:=Protocols for layer7 filtering
26
+  URL:=http://l7-filter.sourceforge.net/
27
+  SUBMENU:=Firewall
28
+  MAINTAINER:=Lim Guo Wei <limguowei@gmail.com>
29
+  DEPENDS:=iptables-mod-filter
30
+endef
31
+
32
+define Package/l7-protocols/description
33
+       l7-filter classifies packets based on patterns in application
34
+       layer data. This allows correct classification of P2P traffic that
35
+       uses unpredictable ports as well as standard protocols running on
36
+       non-standard ports.
37
+endef
38
+
39
+define Package/l7-protocols-testing
40
+	$(call Package/l7-protocols)
41
+	TITLE:=testing utilities for layer7
42
+	DEPENDS+=l7-protocols $(CXX_DEPENDS)
43
+endef
44
+
45
+define Package/l7-protocols-testing/description
46
+	testing utilities for layer 7 patterns
47
+endef
48
+
49
+define Build/Configure
50
+endef
51
+
52
+ifneq ($(SDK)$(CONFIG_PACKAGE_l7-protocols-testing),)
53
+  define Build/Compile
54
+	cd $(PKG_BUILD_DIR)/testing && $(MAKE) $(CONFIGURE_VARS)
55
+  endef
56
+else
57
+  define Build/Compile
58
+  endef
59
+endif
60
+
61
+define Package/l7-protocols/install
62
+	find $(PKG_BUILD_DIR) -name "README" -delete
63
+	$(INSTALL_DIR) $(1)/etc/l7-protocols
64
+	$(CP) $(PKG_BUILD_DIR)/extra \
65
+		$(PKG_BUILD_DIR)/file_types \
66
+		$(PKG_BUILD_DIR)/groups.sh \
67
+		$(PKG_BUILD_DIR)/malware \
68
+		$(PKG_BUILD_DIR)/protocols \
69
+		$(1)/etc/l7-protocols
70
+endef
71
+
72
+define Package/l7-protocols-testing/install
73
+	$(INSTALL_DIR) $(1)/etc/l7-protocols/testing
74
+	$(CP) $(PKG_BUILD_DIR)/testing/data \
75
+		$(1)/etc/l7-protocols/testing
76
+	$(INSTALL_BIN) \
77
+		$(PKG_BUILD_DIR)/testing/rand{chars,printable} \
78
+		$(PKG_BUILD_DIR)/testing/test_speed-{kernel,userspace} \
79
+		$(PKG_BUILD_DIR)/testing/match_kernel \
80
+		$(PKG_BUILD_DIR)/testing/doallspeeds.sh \
81
+		$(PKG_BUILD_DIR)/testing/test_match.sh \
82
+		$(PKG_BUILD_DIR)/testing/timeit.sh \
83
+		$(1)/etc/l7-protocols/testing
84
+endef
85
+
86
+$(eval $(call BuildPackage,l7-protocols))
87
+$(eval $(call BuildPackage,l7-protocols-testing))

+ 27
- 0
net/l7-protocols/patches/100-testing_crosscompile.patch View File

@@ -0,0 +1,27 @@
1
+--- a/testing/Makefile
2
++++ b/testing/Makefile
3
+@@ -1,19 +1,19 @@
4
+ all: randchars randprintable test_speed-kernel test_speed-userspace match_kernel
5
+ 
6
+ randchars: randchars.c
7
+-	gcc -O2 -o randchars randchars.c
8
++	$(CC) $(CFLAGS) -o randchars randchars.c
9
+ 
10
+ randprintable: randprintable.c
11
+-	gcc -O2 -o randprintable randprintable.c
12
++	$(CC) $(CFLAGS) -o randprintable randprintable.c
13
+ 
14
+ test_speed-kernel: test_speed-kernel.c
15
+-	gcc -o test_speed-kernel test_speed-kernel.c
16
++	$(CC) $(CFLAGS) -o test_speed-kernel test_speed-kernel.c
17
+ 
18
+ test_speed-userspace: test_speed-userspace.cpp l7-parse-patterns.cpp l7-parse-patterns.h
19
+-	g++ -Wall -o test_speed-userspace test_speed-userspace.cpp l7-parse-patterns.cpp
20
++	$(CXX) $(CXXFLAGS) -Wall -o test_speed-userspace test_speed-userspace.cpp l7-parse-patterns.cpp
21
+ 
22
+ match_kernel: match-kernel.c
23
+-	gcc -O2 -o match_kernel match-kernel.c
24
++	$(CC) $(CFLAGS) -o match_kernel match-kernel.c
25
+ 
26
+ clean:
27
+ 	rm -f randprintable randchars test_speed-kernel test_speed-userspace match_kernel

+ 102
- 0
net/l7-protocols/patches/101-testing-timeit.patch View File

@@ -0,0 +1,102 @@
1
+--- a/testing/timeit.sh
2
++++ b/testing/timeit.sh
3
+@@ -1,11 +1,8 @@
4
+ #!/bin/bash
5
+ 
6
+-# "man 1 time" for details
7
+-export TIME="%U seconds"
8
+-
9
+ add()
10
+ {
11
+-	if ! dc -e ""; then
12
++	if ! dc p >/dev/null 2>&1; then
13
+ 	        echo you do not have dc, so I cannot add these numbers...
14
+ 	        exit 1
15
+ 	fi
16
+@@ -14,7 +11,7 @@ add()
17
+ 	tot=0
18
+ 
19
+ 	while read n; do
20
+-	        tot=`dc -e "$n $tot + pop" 2> /dev/null`
21
++	        tot=`dc $n $tot + p 2> /dev/null`
22
+ 	done
23
+ 
24
+ 	echo $tot seconds
25
+@@ -34,7 +31,7 @@ extract()
26
+ 
27
+ if [ ! $3 ] || [ $2 == "-h" ] || [ $2 == "--help" ]; then
28
+ 	echo
29
+-	echo Syntax: ./timeit.sh patternfile kernel\|userspace all\|print\|real [data_files]
30
++	echo Syntax: .//usr/bin/timeit.sh patternfile kernel\|userspace all\|print\|real [data_files]
31
+ 	echo
32
+ 	echo \"kernel\" uses the kernel pattern and library
33
+ 	echo \"userspace\" uses userspace pattern and library
34
+@@ -72,12 +69,12 @@ echo Timing $1
35
+ if [ $3 == "all" ]; then
36
+ 	echo Using all characters
37
+ 	if [ $2 == "kernel" ]; then
38
+-		if ! ./randchars | time $speedprog "`extract $1`" verbose; then
39
++		if ! ./randchars | /usr/bin/time $speedprog "`extract $1`" verbose 2>&1 >/dev/null | grep user | cut -d\  -f2; then
40
+ 			echo $speedprog failed. > /dev/stderr
41
+ 			exit 1
42
+ 		fi
43
+ 	else
44
+-		if ! ./randchars | time $speedprog -f "$1" -v; then
45
++		if ! ./randchars | /usr/bin/time $speedprog -f "$1" -v 2>&1 >/dev/null | grep user | cut -d\  -f2; then
46
+ 			echo $speedprog failed. > /dev/stderr
47
+ 			exit 1
48
+ 		fi
49
+@@ -85,12 +82,12 @@ if [ $3 == "all" ]; then
50
+ elif [ $3 == "print" ]; then
51
+ 	echo Using only printable characters
52
+ 	if [ $2 == "kernel" ]; then
53
+-		if ! ./randprintable | time $speedprog "`extract $1`" verbose; then
54
++		if ! ./randprintable | /usr/bin/time $speedprog "`extract $1`" verbose 2>&1 >/dev/null | grep user | cut -d\  -f2; then
55
+ 			echo $speedprog failed. > /dev/stderr
56
+ 			exit 1
57
+ 		fi
58
+ 	else
59
+-		if ! ./randprintable | time $speedprog -f "$1" -v; then
60
++		if ! ./randprintable | /usr/bin/time $speedprog -f "$1" -v 2>&1 >/dev/null | grep user | cut -d\  -f2; then
61
+ 			echo $speedprog failed. > /dev/stderr
62
+ 			exit 1
63
+ 		fi
64
+@@ -107,12 +104,12 @@ elif [ $3 == "real" ]; then
65
+ 				printf $f\\t
66
+ 				#echo `extract $1`
67
+ 				if [ $2 == "kernel" ]; then
68
+-					if ! cat $f | time $speedprog "`extract $1`" 2> /dev/stdout | tee -a tmp.$$; then
69
++					if ! cat $f | /usr/bin/time $speedprog "`extract $1`" 2>&1 >/dev/null | grep user | cut -d\  -f2 | tee -a tmp.$$; then
70
+ 						echo $speedprog failed. > /dev/stderr
71
+ 						exit 1
72
+ 					fi
73
+ 				else
74
+-					if ! cat $f | time $speedprog -f "$1" 2> /dev/stdout | tee -a tmp.$$; then
75
++					if ! cat $f | /usr/bin/time $speedprog -f "$1" 2>&1 >/dev/null | grep user | cut -d\  -f2 | tee -a tmp.$$; then
76
+ 						echo $speedprog failed. > /dev/stderr
77
+ 						exit 1
78
+ 					fi
79
+@@ -123,12 +120,12 @@ elif [ $3 == "real" ]; then
80
+ 		for f in data/*; do
81
+ 			printf $f\\t
82
+ 			if [ $2 == "kernel" ]; then
83
+-				if ! cat $f | time $speedprog "`extract $1`" 2> /dev/stdout | tee -a tmp.$$; then
84
++				if ! cat $f | /usr/bin/time $speedprog "`extract $1`" 2>&1 >/dev/null | grep user | cut -d\  -f2 | tee -a tmp.$$; then
85
+ 					echo $speedprog failed. > /dev/stderr
86
+ 					exit 1
87
+ 				fi
88
+ 			else
89
+-				if ! cat $f | time $speedprog -f "$1" 2> /dev/stdout | tee -a tmp.$$; then
90
++				if ! cat $f | /usr/bin/time $speedprog -f "$1" 2>&1 >/dev/null | grep user | cut -d\  -f2 | tee -a tmp.$$; then
91
+ 					echo $speedprog failed. > /dev/stderr
92
+ 					exit 1
93
+ 				fi
94
+@@ -137,7 +134,7 @@ elif [ $3 == "real" ]; then
95
+ 	fi
96
+ 
97
+ 	printf Total:\ 
98
+-	cat tmp.$$ | cut -d\  -f 2 | add
99
++	cat tmp.$$ | cut -ds -f 1| add
100
+ 
101
+ 	rm tmp.$$
102
+ else

+ 16
- 0
net/l7-protocols/patches/102-testing-doallspeeds.patch View File

@@ -0,0 +1,16 @@
1
+--- a/testing/doallspeeds.sh
2
++++ b/testing/doallspeeds.sh
3
+@@ -25,11 +25,11 @@ for f in ../*/*.pat; do 
4
+ 	printf `basename $f .pat`
5
+ 
6
+ 	if [ $userspace ]; then 
7
+-		gtime=`./timeit.sh $f userspace   real | grep Total | cut -d\  -f 2`
8
++		gtime=`./timeit.sh $f userspace   real | grep Total | cut -d\  -f 2 | awk '{print $1}'`
9
+ 		printf \\t$gtime
10
+ 	fi
11
+ 	if [ $kernel ]; then 
12
+-		htime=`./timeit.sh $f kernel real | grep Total | cut -d\  -f 2`
13
++		htime=`./timeit.sh $f kernel real | grep Total | cut -d\  -f 2 | awk '{print $1}'`
14
+ 		printf \\t$htime
15
+ 	fi
16
+ 	printf \\n