blob: 8d08b755094c7277b2b9e1dc64c9c6584ec37689 (
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
|
#!/bin/bash
# This is the most basic testscase:
# * creating a valid interval set
# * referencing it from a valid rule
tmpfile=$(mktemp)
if [ ! -w $tmpfile ] ; then
echo "Failed to create tmp file" >&2
exit 0
fi
trap "rm -rf $tmpfile" EXIT # cleanup if aborted
echo "
table inet t {
set s1 {
type ipv4_addr
flags interval
elements = { 10.0.0.0-11.0.0.0, 172.16.0.0/16 }
}
set s2 {
type ipv6_addr
flags interval
elements = { fe00::/64, fe11::-fe22::}
}
set s3 {
type inet_proto
flags interval
elements = { 10-20, 50-60}
}
set s4 {
type inet_service
flags interval
elements = {8080-8082, 0-1024, 10000-40000}
}
chain c {
ip saddr @s1 accept
ip6 daddr @s2 accept
ip protocol @s3 accept
ip6 nexthdr @s3 accept
tcp dport @s4 accept
}
}" > $tmpfile
set -e
$NFT -f $tmpfile
|