summaryrefslogtreecommitdiff
path: root/tests/resizen.sh
blob: 9322bd2a2cfcecf00fd371a3b62434125b3b9308 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#!/bin/sh

# set -x
set -e

ipset=${IPSET_BIN:-../src/ipset}

case "$1" in
    -4)
    	ip=10.0.
    	sep=.
    	net=32
    	ip2=192.168.162.33
    	;;
    -6)
    	ip=10::
    	sep=:
    	net=128
    	ip2=192:168::162:33
    	;;
esac

case "$2" in
    ipportnet)
    	$ipset n test hash:ip,port,net $1 hashsize 64
    	for x in `seq 0 16`; do
    	    for y in `seq 0 255`; do
    	    	$ipset a test $ip$x$sep$y,1023,$ip2/$net nomatch
    	    done
    	done
    	for x in `seq 0 16`; do
    	    for y in `seq 0 255`; do
    	    	$ipset t test $ip$x$sep$y,1023,$ip2/$net nomatch 2>/dev/null
    	    done
    	done
    	;;
    netportnet)
    	$ipset n test hash:net,port,net $1 hashsize 64
    	for x in `seq 0 16`; do
    	    for y in `seq 0 255`; do
    	    	$ipset a test $ip$x$sep$y,1023,$ip2/$net nomatch
    	    done
    	done
    	for x in `seq 0 16`; do
    	    for y in `seq 0 255`; do
    	    	$ipset t test $ip$x$sep$y,1023,$ip2/$net nomatch 2>/dev/null
    	    done
    	done
    	;;
    net)
    	$ipset n test hash:net $1 hashsize 64
    	for x in `seq 0 16`; do
    	    for y in `seq 0 255`; do
    	    	$ipset a test $ip$x$sep$y/$net nomatch
    	    done
    	done
    	for x in `seq 0 16`; do
    	    for y in `seq 0 255`; do
    	    	$ipset t test $ip$x$sep$y/$net nomatch 2>/dev/null
    	    done
    	done
    	;;
    netnet)
	$ipset n test hash:net,net $1 hashsize 64
	for x in `seq 0 16`; do
	    for y in `seq 0 255`; do
		$ipset a test $ip$x$sep$y/$net,$ip$y$sep$x/$net nomatch
	    done
	done
	for x in `seq 0 16`; do
	    for y in `seq 0 255`; do
		$ipset t test $ip$x$sep$y/$net,$ip$y$sep$x/$net nomatch \
		2>/dev/null
	    done
	done
	;;
    netport)
    	$ipset n test hash:net,port $1 hashsize 64
    	for x in `seq 0 16`; do
    	    for y in `seq 0 255`; do
    	    	$ipset a test $ip$x$sep$y/$net,1023 nomatch
    	    done
    	done
    	for x in `seq 0 16`; do
    	    for y in `seq 0 255`; do
    	    	$ipset t test $ip$x$sep$y/$net,1023 nomatch 2>/dev/null
    	    done
    	done
    	;;
    netiface)
    	$ipset n test hash:net,iface $1 hashsize 64
    	for x in `seq 0 16`; do
    	    for y in `seq 0 255`; do
    	    	$ipset a test $ip$x$sep$y/$net,eth0 nomatch
    	    done
    	done
    	for x in `seq 0 16`; do
    	    for y in `seq 0 255`; do
    	    	$ipset t test $ip$x$sep$y/$net,eth0 nomatch 2>/dev/null
    	    done
    	done
    	;;
esac
$ipset x
exit 0