summaryrefslogtreecommitdiffstats
path: root/tests/shell/testcases/rule_management/0007delete_0
blob: 126fe5dd445264eb590347713c60f9963cb37399 (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
#!/bin/bash

# tests for Netfilter bug #965 and the related fix
# (regarding rule management with a given position/handle spec)

set -e
$NFT add table t
$NFT add chain t c
$NFT add rule t c accept	# should have handle 2
$NFT add rule t c drop		# should have handle 3
$NFT delete rule t c handle 2

EXPECTED="table ip t {
	chain c {
		drop
	}
}"

GET="$($NFT list ruleset)"

if [ "$EXPECTED" != "$GET" ] ; then
	DIFF="$(which diff)"
	[ -x $DIFF ] && $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
	exit 1
fi