summaryrefslogtreecommitdiffstats
path: root/tests/shell/testcases/maps/0016map_leak_0
blob: e110ee4b9de57edb66e157ecec5e7e038cbef312 (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
#!/bin/bash

set -e

RULESET="table ip t {
        map sourcemap {
                type ipv4_addr : verdict
                elements = { 100.123.10.2 : jump c }
        }

        chain c {
        }
}"

$NFT -f - <<< "$RULESET"
# again, since it is addition, not creation, it is successful
$NFT -f - <<< "$RULESET"
# flush it to check for refcount leak
$NFT flush ruleset

#
# again with stateful objects
#

RULESET="table ip t {
	counter c {}

        map sourcemap {
                type ipv4_addr : counter
                elements = { 100.123.10.2 : \"c\" }
        }
}"

$NFT -f - <<< "$RULESET"
# again, since it is addition, not creation, it is successful
$NFT -f - <<< "$RULESET"
# flush it to check for refcount leak
$NFT flush ruleset