summaryrefslogtreecommitdiffstats
path: root/tests/shell/testcases/cache/0001_cache_handling_0
blob: 3693f15a952f7bc4c4c4941d8ad479c15ac7909a (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
28
29
30
#!/bin/bash

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 test {
	set test {
		type ipv4_addr
		elements = { 1.1.1.1}
	}

	chain test {
		ip saddr @test counter accept
		ip daddr { 2.2.2.2} counter accept
	}
}" > $tmpfile

set -e

$NFT -f $tmpfile
rule_handle=$($NFT list ruleset -a | awk '/saddr/{print $NF}')
$NFT delete rule inet test test handle $rule_handle
$NFT delete set inet test test
$NFT -f $tmpfile