summaryrefslogtreecommitdiffstats
path: root/tests/shell/testcases/maps/0006interval_map_overlap_0
blob: 682ac65b0e19a192053c65dcea80489f42469fa8 (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
#!/bin/bash

# test adding elements to an interval map
# shows how disjoint intervals are seen as overlaps
# NOTE this is only an issue with two separate nft calls

tmpfile=$(mktemp)
if [ ! -w $tmpfile ] ; then
	echo "Failed to create tmp file" >&2
	exit 0
fi

trap "rm -rf $tmpfile" EXIT # cleanup if aborted

n=1
echo "add table x
add map x y { type ipv4_addr : ipv4_addr; flags interval; }
add element x y { 10.0.${n}.0/24 : 10.0.0.${n} }" > $tmpfile

set -e
$NFT -f $tmpfile

n=2
echo "add element x y { 10.0.${n}.0/24 : 10.0.0.${n} }" > $tmpfile

$NFT -f $tmpfile