#!/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