summaryrefslogtreecommitdiffstats
path: root/tests/shell/testcases/flowtable/0001flowtable_0
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2018-01-22 19:54:36 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2018-03-05 16:30:15 +0100
commitb81ebeb917a33afcaa2e8147a2fb2b6e01f49330 (patch)
tree3944dbb03c88c4414905ac5011cf54581d77e18e /tests/shell/testcases/flowtable/0001flowtable_0
parentfa42f2118746f35ae6883ef5b0d4758863282fc9 (diff)
tests: shell: add flowtable tests
Add basic flowtable tests. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'tests/shell/testcases/flowtable/0001flowtable_0')
-rwxr-xr-xtests/shell/testcases/flowtable/0001flowtable_033
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/shell/testcases/flowtable/0001flowtable_0 b/tests/shell/testcases/flowtable/0001flowtable_0
new file mode 100755
index 00000000..307f06f6
--- /dev/null
+++ b/tests/shell/testcases/flowtable/0001flowtable_0
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+tmpfile=$(mktemp)
+if [ ! -w $tmpfile ] ; then
+ echo "Failed to create tmp file" >&2
+ exit 0
+fi
+
+trap "rm -rf $tmpfile" EXIT # cleanup if aborted
+
+
+EXPECTED='table inet t {
+ flowtable f {
+ hook ingress priority 10
+ devices = { eth0, wlan0 }
+ }
+
+ chain c {
+ flow offload @f
+ }
+}'
+
+echo "$EXPECTED" > $tmpfile
+set -e
+$NFT -f $tmpfile
+
+GET="$($NFT list ruleset)"
+
+if [ "$EXPECTED" != "$GET" ] ; then
+ DIFF="$(which diff)"
+ [ -x $DIFF ] && $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
+ exit 1
+fi