File: netdev

package info (click to toggle)
nftables 1.1.6-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 15,384 kB
  • sloc: ansic: 50,901; sh: 20,277; yacc: 5,861; python: 1,746; lex: 1,367; makefile: 392
file content (30 lines) | stat: -rwxr-xr-x 725 bytes parent folder | download | duplicates (2)
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
#!/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

$NFT delete chain netdev test_table test_chain