summaryrefslogtreecommitdiffstats
path: root/tests/shell/testcases/sets/errors_0
blob: 27f65df3f76bf430794093f20a152bae95863b57 (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
#!/bin/bash

RULESET="table ip x {
	set y {
		type ipv4_addr
		flags interval
	}
}

delete element ip x y { 2.3.4.5 }"

$NFT -f - <<< $RULESET
if [ $? -eq 0 ]
then
	exit 1
fi

RULESET="table ip x {
        set y {
                type ipv4_addr
                flags interval
        }
}

add element x y { 1.1.1.1/24 }
delete element x y { 1.1.1.1/24 }
add element x y { 1.1.1.1/24 }
delete element x y { 2.2.2.2/24 }"

$NFT -f - <<< $RULESET
if [ $? -eq 0 ]
then
	exit 1
fi

RULESET="flush ruleset
create table inet filter
set inet filter foo {}
add element inet filter foo { foobar }"

$NFT -f - <<< $RULESET
if [ $? -eq 0 ]
then
	exit 1
fi

RULESET="table ip x {
        map x {
                type ifname . ipv4_addr : verdict
                elements = { if2 . 10.0.0.2 : jump chain2,
                             if2 . 192.168.0.0/24 : jump chain2 }
        }

        chain chain2 {}
}"

$NFT -f - <<< $RULESET
if [ $? -eq 0 ]
then
	exit 1
fi

RULESET="add set inet filter myset { type ipv4_addr; flags interval; auto-merge }
add element inet filter myset { 192.168.0.0/24 }
add element inet filter myset { 192.168.0.2 }
add element inet filter myset { 192.168.1.0/24 }
add element inet filter myset { 192.168.1.100 }"

$NFT -f - <<< $RULESET || exit 0