summaryrefslogtreecommitdiffstats
path: root/tests/shell/testcases/json/netdev
blob: 8c16cf42baa069d4059fc9ea133db69f3f3441f5 (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
#!/bin/bash

set -e

iface_cleanup() {
	ip link del d0 &>/dev/null || :
}
trap 'iface_cleanup' EXIT
iface_cleanup

ip link add d0 type dummy

$NFT flush ruleset
$NFT add table inet test
$NFT add chain inet test c

$NFT flush ruleset

RULESET='{"nftables":[{"flush":{"ruleset":null}},{"add":{"table":{"family":"netdev","name":"test_table"}}},{"add":{"chain":{"family":"netdev","table":"test_table","name":"test_chain","type":"filter","hook":"ingress","prio":0,"dev":"d0","policy":"accept"}}}]}'

if [ "$NFT_TEST_HAVE_json" != n ]; then
	$NFT -j -f - <<< $RULESET
fi

if [ "$NFT_TEST_HAVE_json" = n ]; then
	echo "Test partially skipped due to missing JSON support."
	exit 77
fi