Skip to contentSkip to conversation

tests: shell: add testcases for named limits

PATCH Applied Harsha Sharma 2 participants 2 messages Oct 14, 2017 – Oct 17, 2017 netfilter

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests: shell: add testcases for named limits

Add testcases for creating named limits and referencing them from rule

---
 tests/shell/testcases/sets/0025named_limit_0 | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
 create mode 100755 tests/shell/testcases/sets/0025named_limit_0
tests/shell/testcases/sets/0025named_limit_0 new file +27 -0
new file mode 100755
index 0000000..91553f3
@@ -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
Signature · 1 line
2.11.0
maintainer Applied
#1 lore raw
Quoted 2 lines · Harsha Sharma

Add testcases for creating named limits and referencing them from rule

Applied, thanks Harsha.