netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tests: shell: add testcases for named limits
@ 2017-10-14 10:46 Harsha Sharma
  2017-10-17 12:02 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 2+ messages in thread
From: Harsha Sharma @ 2017-10-14 10:46 UTC (permalink / raw)
  To: pablo; +Cc: netfilter-devel, outreachy-kernel, Harsha Sharma

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] tests: shell: add testcases for named limits
  2017-10-14 10:46 [PATCH] tests: shell: add testcases for named limits Harsha Sharma
@ 2017-10-17 12:02 ` Pablo Neira Ayuso
  0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2017-10-17 12:02 UTC (permalink / raw)
  To: Harsha Sharma; +Cc: netfilter-devel, outreachy-kernel

On Sat, Oct 14, 2017 at 04:16:03PM +0530, Harsha Sharma wrote:
> Add testcases for creating named limits and referencing them
> from rule

Applied, thanks Harsha.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-10-17 12:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-14 10:46 [PATCH] tests: shell: add testcases for named limits Harsha Sharma
2017-10-17 12:02 ` Pablo Neira Ayuso

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).