]> git.ipfire.org Git - thirdparty/ipset.git/blob - tests/bitmap:ip.t
netfilter: ipset: fix race condition between swap/destroy and kernel side add/del...
[thirdparty/ipset.git] / tests / bitmap:ip.t
1 # Range: Try to create from an invalid range with timeout
2 1 ipset create test bitmap:ip range 2.0.0.1-2.1.0.1 timeout 5
3 # Range: Create a set from a valid range with timeout
4 0 ipset create test bitmap:ip range 2.0.0.1-2.1.0.0 timeout 5
5 # Range: Add lower boundary
6 0 ipset add test 2.0.0.1 timeout 4
7 # Range: Add upper boundary
8 0 ipset add test 2.1.0.0 timeout 0
9 # Range: Test lower boundary
10 0 ipset test test 2.0.0.1
11 # Range: Test upper boundary
12 0 ipset test test 2.1.0.0
13 # Range: Test element not added to the set
14 1 ipset test test 2.0.0.2
15 # Range: Test element before lower boundary
16 1 ipset test test 2.0.0.0
17 # Range: Test element after upper boundary
18 1 ipset test test 2.1.0.1
19 # Range: Try to add element before lower boundary
20 1 ipset add test 2.0.0.0
21 # Range: Try to add element after upper boundary
22 1 ipset add test 2.1.0.1
23 # Range: Delete element not added to the set
24 1 ipset -D test 2.0.0.2
25 # Range: Delete element not added to the set, with exist flag
26 0 ipset -! -D test 2.0.0.2
27 # Range: Add element in the middle
28 0 ipset -A test 2.0.0.128
29 # Range: Add element in the middle again
30 1 ipset -A test 2.0.0.128
31 # Range: Add element in the middle again, with exist flag
32 0 ipset -! -A test 2.0.0.128
33 # Range: Delete the same element
34 0 ipset -D test 2.0.0.128
35 # Range: Add a range of elements
36 0 ipset -A test 2.0.0.128-2.0.0.131 timeout 4
37 # Range: List set
38 0 ipset list test > .foo
39 # Range: Check listing
40 0 ./diff.sh .foo bitmap:ip.t.list4
41 # Sleep 5s so that entries can time out
42 0 sleep 5s
43 # Range: List set after timeout
44 0 ipset list test > .foo
45 # Range: Check listing
46 0 ./diff.sh .foo bitmap:ip.t.list0
47 # Range: Flush test set
48 0 ipset flush test
49 # Range: Delete test set
50 0 ipset destroy test
51 # Network: Try to create a set from an invalid network with timeout
52 1 ipset create test bitmap:ip range 2.0.0.0/15 timeout 5
53 # Network: Create a set from a valid network with timeout
54 0 ipset create test bitmap:ip range 2.0.0.1/16 timeout 5
55 # Network: Add lower boundary
56 0 ipset add test 2.0.0.0 timeout 0
57 # Network: Add upper boundary
58 0 ipset add test 2.0.255.255 timeout 4
59 # Network: Test lower boundary
60 0 ipset test test 2.0.0.0
61 # Network: Test upper boundary
62 0 ipset test test 2.0.255.255
63 # Network: Test element not added to the set
64 1 ipset test test 2.0.0.1
65 # Network: Test element before lower boundary
66 1 ipset test test 1.255.255.255
67 # Network: Test element after upper boundary
68 1 ipset test test 2.1.0.0
69 # Network: Try to add element before lower boundary
70 1 ipset add test 1.255.255.255
71 # Network: Try to add element after upper boundary
72 1 ipset add test 2.1.0.0
73 # Network: Delete element not added to the set
74 1 ipset -D test 2.0.0.2
75 # Network: Add element in the middle
76 0 ipset -A test 2.0.0.128 timeout 4
77 # Network: Delete the same element
78 0 ipset -D test 2.0.0.128
79 # Network: List set
80 0 ipset list test > .foo
81 # Network: Check listing
82 0 ./diff.sh .foo bitmap:ip.t.list5
83 # Sleep 5s so that entries can time out
84 0 sleep 5s
85 # Network: List set
86 0 ipset list test > .foo
87 # Network: Check listing
88 0 ./diff.sh .foo bitmap:ip.t.list1
89 # Network: Flush test set
90 0 ipset flush test
91 # Network: Delete test set
92 0 ipset destroy test
93 # Subnets: Create a set to store networks with timeout
94 0 ipset create test bitmap:ip range 10.0.0.0/8 netmask 24 timeout 5
95 # Subnets: Add lower boundary
96 0 ipset add test 10.0.0.0 timeout 4
97 # Subnets: Add upper boundary
98 0 ipset add test 10.255.255.255 timeout 0
99 # Subnets: Test lower boundary
100 0 ipset test test 10.0.0.255
101 # Subnets: Test upper boundary
102 0 ipset test test 10.255.255.0
103 # Subnets: Test element not added to the set
104 1 ipset test test 10.1.0.0
105 # Subnets: Test element before lower boundary
106 1 ipset test test 9.255.255.255
107 # Subnets: Test element after upper boundary
108 1 ipset test test 11.0.0.0
109 # Subnets: Try to add element before lower boundary
110 1 ipset add test 9.255.255.255
111 # Subnets: Try to add element after upper boundary
112 1 ipset add test 11.0.0.0
113 # Subnets: Try to delete element not added to the set
114 1 ipset -D test 10.2.0.0
115 # Subnets: Add element to the set
116 0 ipset -A test 10.2.0.0
117 # Subnets: Delete the same element from the set
118 0 ipset -D test 10.2.0.0
119 # Subnets: Add a subnet of subnets
120 0 ipset -A test 10.8.0.0/16 timeout 4
121 # Subnets: List set
122 0 ipset list test > .foo
123 # Subnets: Check listing
124 0 ./diff.sh .foo bitmap:ip.t.list6
125 # Sleep 5s so that entries can time out
126 0 sleep 5s
127 # Subnets: List set
128 0 ipset list test > .foo
129 # Subnets: Check listing
130 0 ./diff.sh .foo bitmap:ip.t.list2
131 # Subnets: Flush test set
132 0 ipset flush test
133 # Subnets: Delete test set
134 0 ipset destroy test
135 # Full: Create full IPv4 space with /16 networks and timeout
136 0 ipset create test bitmap:ip range 0.0.0.0/0 netmask 16 timeout 5
137 # Full: Add lower boundary
138 0 ipset add test 0.0.255.255 timeout 0
139 # Full: Add upper boundary
140 0 ipset add test 255.255.0.0 timeout 0
141 # Full: Test lower boundary
142 0 ipset test test 0.0.0.0
143 # Full: Test upper boundary
144 0 ipset test test 255.255.255.255
145 # Full: Test element not added to the set
146 1 ipset test test 0.1.0.0
147 # Full: List set
148 0 ipset list test > .foo
149 # Full: Check listing
150 0 ./diff.sh .foo bitmap:ip.t.list3
151 # Full: flush set
152 0 ipset flush test
153 # Full: add element with 1s timeout
154 0 ipset add test 1.1.1.1 timeout 1
155 # Full: readd element with 3s timeout
156 0 ipset add test 1.1.1.1 timeout 3 -exist
157 # Full: sleep 2s
158 0 sleep 2s
159 # Full: check readded element
160 0 ipset test test 1.1.1.1
161 # Full: Delete test set
162 0 ipset destroy test
163 # Counters: create set
164 0 ipset n test bitmap:ip range 2.0.0.1-2.1.0.0 counters
165 # Counters: add element with packet, byte counters
166 0 ipset a test 2.0.0.1 packets 5 bytes 3456
167 # Counters: check element
168 0 ipset t test 2.0.0.1
169 # Counters: check counters
170 0 ./check_counters test 2.0.0.1 5 3456
171 # Counters: delete element
172 0 ipset d test 2.0.0.1
173 # Counters: test deleted element
174 1 ipset t test 2.0.0.1
175 # Counters: add element with packet, byte counters
176 0 ipset a test 2.0.0.10 packets 12 bytes 9876
177 # Counters: check counters
178 0 ./check_counters test 2.0.0.10 12 9876
179 # Counters: update counters
180 0 ipset -! a test 2.0.0.10 packets 13 bytes 12479
181 # Counters: check counters
182 0 ./check_counters test 2.0.0.10 13 12479
183 # Counters: destroy set
184 0 ipset x test
185 # Counters and timeout: create set
186 0 ipset n test bitmap:ip range 2.0.0.1-2.1.0.0 counters timeout 600
187 # Counters and timeout: add element with packet, byte counters
188 0 ipset a test 2.0.0.1 packets 5 bytes 3456
189 # Counters and timeout: check element
190 0 ipset t test 2.0.0.1
191 # Counters and timeout: check counters
192 0 ./check_extensions test 2.0.0.1 600 5 3456
193 # Counters and timeout: delete element
194 0 ipset d test 2.0.0.1
195 # Counters and timeout: test deleted element
196 1 ipset t test 2.0.0.1
197 # Counters and timeout: add element with packet, byte counters
198 0 ipset a test 2.0.0.10 packets 12 bytes 9876
199 # Counters and timeout: check counters
200 0 ./check_extensions test 2.0.0.10 600 12 9876
201 # Counters and timeout: update counters
202 0 ipset -! a test 2.0.0.10 packets 13 bytes 12479
203 # Counters and timeout: check counters
204 0 ./check_extensions test 2.0.0.10 600 13 12479
205 # Counters and timeout: update timeout
206 0 ipset -! a test 2.0.0.10 timeout 700
207 # Counters and timeout: check counters
208 0 ./check_extensions test 2.0.0.10 700 13 12479
209 # Counters and timeout: destroy set
210 0 ipset x test
211 # Counters: require sendip
212 skip which sendip
213 # Counters: create set
214 0 ipset n test bitmap:ip range 10.255.0.0/16 counters
215 # Counters: add elemet with zero counters
216 0 ipset a test 10.255.255.64
217 # Counters: generate packets
218 0 ./check_sendip_packets -4 src 5
219 # Counters: check counters
220 0 ./check_counters test 10.255.255.64 5 $((5*40))
221 # Counters: destroy set
222 0 ipset x test
223 # Counters and timeout: create set
224 0 ipset n test bitmap:ip range 10.255.0.0/16 counters timeout 600
225 # Counters and timeout: add elemet with zero counters
226 0 ipset a test 10.255.255.64
227 # Counters and timeout: generate packets
228 0 ./check_sendip_packets -4 src 6
229 # Counters and timeout: check counters
230 0 ./check_extensions test 10.255.255.64 600 6 $((6*40))
231 # Counters and timeout: destroy set
232 0 ipset x test
233 # eof