File: 0001named_interval_0

package info (click to toggle)
nftables 1.1.6-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 15,384 kB
  • sloc: ansic: 50,901; sh: 20,277; yacc: 5,861; python: 1,746; lex: 1,367; makefile: 392
file content (39 lines) | stat: -rwxr-xr-x 672 bytes parent folder | download | duplicates (5)
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
#!/bin/bash

# This is the most basic testscase:
# * creating a valid interval set
# * referencing it from a valid rule

RULESET="
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
	}
}"

set -e
$NFT -f - <<< "$RULESET"