File: netdev_chain_0

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 638 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

# NFT_TEST_REQUIRES(NFT_TEST_HAVE_netdev_chain_without_device)

set -e

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

ip link add d0 type dummy
ip link add d1 type dummy
ip link add d2 type dummy

RULESET="table netdev x {
	chain y {
		type filter hook ingress priority 0; policy accept;
	}
}"

$NFT -f - <<< "$RULESET"

$NFT add chain netdev x y '{ devices = { d0 }; }'
$NFT add chain netdev x y '{ devices = { d1, d2, lo }; }'
$NFT delete chain netdev x y '{ devices = { lo }; }'
$NFT delete chain netdev x y