blob: cf11da8a6c122c450a18de53d5a2e8bd819c7cb5 (
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
31
32
33
34
35
36
|
#!/bin/bash
set -e
$NFT add table test-ip
$NFT add chain test-ip x # should have handle 1
$NFT add chain test-ip y # should have handle 2
$NFT add chain test-ip z # should have handle 3
$NFT add table ip6 test-ip6
$NFT add chain ip6 test-ip6 x # should have handle 1
$NFT add chain ip6 test-ip6 y # should have handle 2
$NFT add chain ip6 test-ip6 z # should have handle 3
$NFT delete chain test-ip handle 2
$NFT delete chain ip6 test-ip6 handle 3
EXPECTED="table ip test-ip {
chain x {
}
chain z {
}
}
table ip6 test-ip6 {
chain x {
}
chain y {
}
}"
GET="$($NFT list ruleset)"
if [ "$EXPECTED" != "$GET" ] ; then
DIFF="$(which diff)"
[ -x $DIFF ] && $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
exit 1
fi
|