| 1 | #!/bin/bashscip-shell filesystem . . `/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 | checkscip-shell shell nftables 1.1.6-1 check().() { |
| 8 | $NFT add element "${1}" t s "{ ${2} . ${3} }" |
| 9 | [scip-shell system . . `[`. "$( $NFT list set "${1}" t s | grepscip-shell system . . 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 $(seqscip-shell system . . seq. 32 127); do |
| 19 | h="$(printfscip-shell system . . printf. %x "${n}")" |
| 20 | checkscip-shell shell nftables 1.1.6-1 check(). ip6 "2001:db8::/${n}" "2001:db8:${h}::-2001:db8:${h}::${h}:1" |
| 21 | done |
| 22 | |
| 23 | for n in $(seqscip-shell system . . seq. 24 31); do |
| 24 | checkscip-shell shell nftables 1.1.6-1 check(). ip "192.0.2.0/${n}" "192.0.2.$((n * 3))-192.0.2.$((n * 3 + 2))" |
| 25 | done |