From: Varsha Rao <rvarsha016@gmail.com>
To: Pablo Neira Ayuso <pablo@netfilter.org>, netfilter-devel@vger.kernel.org
Cc: Varsha Rao <rvarsha016@gmail.com>
Subject: [PATCH nft 06/16] tests: shell: Add tests for payload expression.
Date: Mon, 30 Oct 2017 02:19:21 +0530 [thread overview]
Message-ID: <20171029204931.7792-6-rvarsha016@gmail.com> (raw)
In-Reply-To: <20171029204931.7792-1-rvarsha016@gmail.com>
This patch adds test case for adjacent payload expression.
Signed-off-by: Varsha Rao <rvarsha016@gmail.com>
---
tests/shell/testcases/transactions/0024rule_0 | 44 +++++++++++++++++++++++++++
1 file changed, 44 insertions(+)
create mode 100755 tests/shell/testcases/transactions/0024rule_0
diff --git a/tests/shell/testcases/transactions/0024rule_0 b/tests/shell/testcases/transactions/0024rule_0
new file mode 100755
index 0000000..7644ce8
--- /dev/null
+++ b/tests/shell/testcases/transactions/0024rule_0
@@ -0,0 +1,44 @@
+#!/bin/bash
+
+# Tests for adjacent payload expressions.
+
+set -e
+
+tmpfile=$(mktemp)
+if [ ! -w $tmpfile ] ; then
+ echo "Failed to create tmp file" >&2
+ exit 0
+fi
+
+trap "rm -rf $tmpfile" EXIT # cleanup if aborted
+
+RULESET="add table x
+add chain x y
+add rule x y tcp sport 1024 tcp dport 22 counter
+add rule x y ip saddr 192.168.0.1 ip daddr 192.168.0.100 counter
+add rule x y tcp sequence 0 tcp sport 1024 tcp dport 22
+add rule x y tcp sport 1024 tcp dport 22 tcp sequence 0"
+
+echo "$RULESET" > $tmpfile
+$NFT -f $tmpfile
+if [ $? -ne 0 ] ; then
+ echo "E: unable to load good ruleset" >&2
+ exit 1
+fi
+
+EXPECTED="table ip x {
+ chain y {
+ tcp sport 1024 tcp dport ssh counter packets 0 bytes 0
+ ip saddr 192.168.0.1 ip daddr 192.168.0.100 counter packets 0 bytes 0
+ tcp sport 1024 tcp dport ssh tcp sequence 0
+ tcp sport 1024 tcp dport ssh tcp sequence 0
+ }
+}"
+
+GET="$($NFT list ruleset)"
+
+if [ "$EXPECTED" != "$GET" ] ; then
+ DIFF="$(which diff)"
+ [ -x $DIFF ] && $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
+ exit 1
+fi
--
2.13.6
next prev parent reply other threads:[~2017-10-29 20:49 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-29 20:39 [PATCH nft 00/16] tests: files: Remove test files Varsha Rao
2017-10-29 20:49 ` [PATCH nft 01/16] tests: files: Remove tests for ipv4 Varsha Rao
2017-10-29 20:49 ` [PATCH nft 02/16] tests: files: Remove tests for ipv6 Varsha Rao
2017-10-29 20:49 ` [PATCH nft 03/16] tests: shell: Add test for log statement Varsha Rao
2017-10-29 20:49 ` [PATCH nft 04/16] tests: files: Remove log statement tests Varsha Rao
2017-10-29 20:49 ` [PATCH nft 05/16] tests: shell: Add test for log flags Varsha Rao
2017-10-29 20:49 ` Varsha Rao [this message]
2017-10-29 20:49 ` [PATCH nft 07/16] tests: files: Remove payload expression tests Varsha Rao
2017-10-29 20:49 ` [PATCH nft 08/16] tests: files: Remove test for syntactical errors Varsha Rao
2017-10-29 20:49 ` [PATCH nft 09/16] tests: shell: Add test for ct expression Varsha Rao
2017-10-29 20:49 ` [PATCH nft 10/16] tests: files: Remove " Varsha Rao
2017-10-29 20:49 ` [PATCH nft 11/16] tests: files: Remove prefix file Varsha Rao
2017-10-29 20:49 ` [PATCH nft 12/16] tests: files: Test for meta expressions Varsha Rao
2017-10-29 20:49 ` [PATCH nft 13/16] tests: files: Remove test for meta expression Varsha Rao
2017-10-29 20:49 ` [PATCH nft 14/16] tests: shell: Add tests for concat expression Varsha Rao
2017-10-29 20:49 ` [PATCH nft 15/16] tests: files: Remove " Varsha Rao
2017-10-29 20:49 ` [PATCH nft 16/16] tests: shell: Add test case for map expression Varsha Rao
2017-11-06 15:04 ` [PATCH nft 00/16] tests: files: Remove test files 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=20171029204931.7792-6-rvarsha016@gmail.com \
--to=rvarsha016@gmail.com \
--cc=netfilter-devel@vger.kernel.org \
--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).