diff options
author | Harsha Sharma <harshasharmaiitr@gmail.com> | 2017-10-14 16:16:03 +0530 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2017-10-17 14:01:42 +0200 |
commit | 4ab749cbe15a70fbc93f0a8f9f8cc28b7b17bec2 (patch) | |
tree | 08f1a391ea6ffa5c2ab9671da0be38107d32a5bd /tests | |
parent | d58807906ff3293f7ec912ee69ca47af2c635f94 (diff) |
tests: shell: add testcases for named limits
Add testcases for creating named limits and referencing them
from rule
Signed-off-by: Harsha Sharma <harshasharmaiitr@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/shell/testcases/sets/0025named_limit_0 | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/shell/testcases/sets/0025named_limit_0 b/tests/shell/testcases/sets/0025named_limit_0 new file mode 100755 index 00000000..91553f34 --- /dev/null +++ b/tests/shell/testcases/sets/0025named_limit_0 @@ -0,0 +1,27 @@ +#!/bin/bash + +# This is the testscase: +# * creating valid named limits +# * referencing them from a valid rule + +tmpfile=$(mktemp) +if [ ! -w $tmpfile ] ; then + echo "Failed to create tmp file" >&2 + exit 0 +fi + +trap "rm -rf $tmpfile" EXIT # cleanup if aborted + +echo " +table ip filter { + limit http-traffic { + rate 1/second + } + chain input { + type filter hook input priority 0; policy accept; + limit name tcp dport map { 80 : "http-traffic", 443 : "http-traffic"} + } +}" > $tmpfile + +set -e +$NFT -f $tmpfile |