| 1 |
#!/bin/bash |
| 2 |
|
| 3 |
set -e |
| 4 |
|
| 5 |
# The ruleset is supposed to fail due to non-existing interfaces, |
| 6 |
# hence depends on non-name-based interface hooks. |
| 7 |
[ "$NFT_TEST_HAVE_ifname_based_hooks" = y ] && exit 77 |
| 8 |
|
| 9 |
RULESET="table inet filter { |
| 10 |
flowtable ftable { |
| 11 |
hook ingress priority 0; devices = { eno1, eno0, x }; |
| 12 |
} |
| 13 |
|
| 14 |
chain forward { |
| 15 |
type filter hook forward priority 0; policy drop; |
| 16 |
|
| 17 |
ip protocol { tcp, udp } ct mark and 1 == 1 counter flow add @ftable |
| 18 |
ip6 nexthdr { tcp, udp } ct mark and 2 == 2 counter flow add @ftable |
| 19 |
ct mark and 30 == 30 ct state established,related log prefix \"nftables accept: \" level info accept |
| 20 |
} |
| 21 |
}" |
| 22 |
|
| 23 |
$NFT -f - <<< "$RULESET" >/dev/null || exit 0 |