summaryrefslogtreecommitdiffstats
path: root/tests/shell/testcases/rule_management/0003insert_0
blob: 6691c166cc78133aefee19daca3cb5c692f6bce7 (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

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

set -e
$NFT add table t
$NFT add chain t c
$NFT insert rule t c accept
$NFT insert rule t c drop
$NFT insert rule t c masquerade

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

GET="$($NFT list ruleset)"

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