File: bad_expression

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 (38 lines) | stat: -rwxr-xr-x 637 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
31
32
33
34
35
36
37
38
#!/bin/bash

# table with invalid expression (masquerade called from filter table).
# nft must return an error.  Also catch nfnetlink retry loops that
# cause nft or kernel to spin.
timeout 3 $NFT -f - <<EOF
table ip t0 {
	chain c { }
	chain input {
		type filter hook input priority 0;
		jump c
	}
}

table ip t1 {
	chain a {
		masquerade
	}
	chain input {
		type filter hook input priority 1;
		jump a
	}
}
EOF

rc=$?
if [ $rc -eq 0 ]; then
	echo "Ruleset should have failed" 1>&2
	exit 111
fi

# 124 means 'command timed out', fail if this
# happens.  Else, pass, failure is wanted here.
if [ $rc -ne 124 ]; then
	exit 0
fi

exit $rc