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

ip link add d0 type dummy || {
        echo "Skipping, no dummy interface available"
        exit 77
}
trap "ip link del d0" EXIT

set -e

$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