Debian Codegraph @

tests/shell/testcases/sets/0043concatenated_ranges_1

raw symbols SCIP
1 #!/bin/bash -e
2 #
3 # 0043concatenated_ranges_1 - Insert and list subnets of different sizes
4
5 # NFT_TEST_REQUIRES(NFT_TEST_HAVE_pipapo)
6
7 check() {
8 $NFT add element "${1}" t s "{ ${2} . ${3} }"
9 [ "$( $NFT list set "${1}" t s | grep -c "${2} . ${3}" )" = 1 ]
10 }
11
12 $NFT add table ip6 t
13 $NFT add table ip t
14
15 $NFT add set ip6 t s '{ type ipv6_addr . ipv6_addr ; flags interval ; }'
16 $NFT add set ip t s '{ type ipv4_addr . ipv4_addr ; flags interval ; }'
17
18 for n in $(seq 32 127); do
19 h="$(printf %x "${n}")"
20 check ip6 "2001:db8::/${n}" "2001:db8:${h}::-2001:db8:${h}::${h}:1"
21 done
22
23 for n in $(seq 24 31); do
24 check ip "192.0.2.0/${n}" "192.0.2.$((n * 3))-192.0.2.$((n * 3 + 2))"
25 done