Debian Codegraph @

tests/shell/testcases/maps/0018map_leak_timeout_0

raw
1 #!/bin/bash
2
3 # NFT_TEST_SKIP(NFT_TEST_SKIP_slow)
4
5 set -e
6
7 RULESET="table ip t {
8 map sourcemap {
9 type ipv4_addr : verdict
10 timeout 3s
11 elements = { 100.123.10.2 : jump c }
12 }
13
14 chain c {
15 }
16 }"
17
18 $NFT -f - <<< "$RULESET"
19 # again, since it is addition, not creation, it is successful
20 $NFT -f - <<< "$RULESET"
21
22 # wait for elements to expire
23 sleep 5
24
25 # flush it to check for refcount leak
26 $NFT flush ruleset
27
28 #
29 # again with stateful objects
30 #
31
32 RULESET="table ip t {
33 counter c {}
34
35 map sourcemap {
36 type ipv4_addr : counter
37 timeout 3s
38 elements = { 100.123.10.2 : \"c\" }
39 }
40 }"
41
42 $NFT -f - <<< "$RULESET"
43 # again, since it is addition, not creation, it is successful
44 $NFT -f - <<< "$RULESET"
45 # flush it to check for refcount leak
46
47 # wait for elements to expire
48 sleep 5
49
50 $NFT flush ruleset