summaryrefslogtreecommitdiffstats
path: root/tests/shell/testcases/sets/0060set_multistmt_1
blob: 04ef047caa52d003ffa7c391cd6b4bb3e9fb742e (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
#!/bin/bash

# NFT_TEST_REQUIRES(NFT_TEST_HAVE_set_with_two_expressions)

RULESET="table x {
	set y {
		type ipv4_addr
		size 65535
		flags dynamic
		counter quota 500 bytes
		elements = { 1.2.3.4 counter packets 9 bytes 756 quota 500 bytes used 500 bytes }
	}
	chain y {
		type filter hook output priority filter; policy accept;
		update @y { ip daddr }
	}
}"

$NFT -f - <<< $RULESET
# should work
if [ $? -ne 0 ]
then
	exit 1
fi

# should work
$NFT add element x y { 1.1.1.1 }
if [ $? -ne 0 ]
then
	exit 1
fi

# should work
$NFT add element x y { 2.2.2.2 counter quota 1000 bytes }
if [ $? -ne 0 ]
then
	exit 1
fi

exit 0