From: Harsha Sharma <harshasharmaiitr@gmail.com>
To: pablo@netfilter.org
Cc: netfilter-devel@vger.kernel.org,
outreachy-kernel@googlegroups.com,
Harsha Sharma <harshasharmaiitr@gmail.com>
Subject: [PATCH] tests: shell: add testcases for named limits
Date: Sat, 14 Oct 2017 16:16:03 +0530 [thread overview]
Message-ID: <20171014104603.16365-1-harshasharmaiitr@gmail.com> (raw)
Add testcases for creating named limits and referencing them
from rule
Signed-off-by: Harsha Sharma <harshasharmaiitr@gmail.com>
---
tests/shell/testcases/sets/0025named_limit_0 | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
create mode 100755 tests/shell/testcases/sets/0025named_limit_0
diff --git a/tests/shell/testcases/sets/0025named_limit_0 b/tests/shell/testcases/sets/0025named_limit_0
new file mode 100755
index 0000000..91553f3
--- /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
--
2.11.0
next reply other threads:[~2017-10-14 10:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-14 10:46 Harsha Sharma [this message]
2017-10-17 12:02 ` [PATCH] tests: shell: add testcases for named limits Pablo Neira Ayuso
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171014104603.16365-1-harshasharmaiitr@gmail.com \
--to=harshasharmaiitr@gmail.com \
--cc=netfilter-devel@vger.kernel.org \
--cc=outreachy-kernel@googlegroups.com \
--cc=pablo@netfilter.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).