From: Mart Frauenlob <mart.frauenlob@chello.at>
To: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>
Cc: netfilter-devel@vger.kernel.org, pablo@netfilter.org
Subject: Re: [nft PATCH] tests/shell: add chain validations tests
Date: Wed, 23 Mar 2016 01:09:06 +0100 [thread overview]
Message-ID: <56F1DEA2.70409@chello.at> (raw)
In-Reply-To: <145865193086.6118.9200431804176858644.stgit@nfdev2.cica.es>
Good day,
On 22.03.2016 14:06, Arturo Borrero Gonzalez wrote:
> Some basic test regarding chains: jumps and validations.
>
> Signed-off-by: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>
> ---
> NOTE: the testcases/chains/0009masquerade_jump_1 file fails, seems like a bug
> in the kernel validation. Needs more investigation.
>
> tests/shell/testcases/chains/0001jumps_0 | 17 +++++++++++++++
> tests/shell/testcases/chains/0002jumps_1 | 22 ++++++++++++++++++++
> tests/shell/testcases/chains/0003jump_loop_1 | 21 +++++++++++++++++++
> tests/shell/testcases/chains/0004busy_1 | 11 ++++++++++
> tests/shell/testcases/chains/0005busy_map_1 | 11 ++++++++++
> tests/shell/testcases/chains/0006masquerade_0 | 7 ++++++
> tests/shell/testcases/chains/0007masquerade_1 | 9 ++++++++
> tests/shell/testcases/chains/0008masquerade_jump_1 | 11 ++++++++++
> tests/shell/testcases/chains/0009masquerade_jump_1 | 11 ++++++++++
> 9 files changed, 120 insertions(+)
> create mode 100755 tests/shell/testcases/chains/0001jumps_0
> create mode 100755 tests/shell/testcases/chains/0002jumps_1
> create mode 100755 tests/shell/testcases/chains/0003jump_loop_1
> create mode 100755 tests/shell/testcases/chains/0004busy_1
> create mode 100755 tests/shell/testcases/chains/0005busy_map_1
> create mode 100755 tests/shell/testcases/chains/0006masquerade_0
> create mode 100755 tests/shell/testcases/chains/0007masquerade_1
> create mode 100755 tests/shell/testcases/chains/0008masquerade_jump_1
> create mode 100755 tests/shell/testcases/chains/0009masquerade_jump_1
>
> diff --git a/tests/shell/testcases/chains/0001jumps_0 b/tests/shell/testcases/chains/0001jumps_0
> new file mode 100755
> index 0000000..b39df38
> --- /dev/null
> +++ b/tests/shell/testcases/chains/0001jumps_0
> @@ -0,0 +1,17 @@
> +#!/bin/bash
I've not looked up the code calling this, but:
First: bash only?
Second: It's not granted to be in /bin.
Third: May not be the wanted version.
So a shebang like:
#!/usr/bin/env bash
or
#!/urs/bin/env sh
should be more compatible and fail proof.
> +
> +set -e
> +
> +MAX_JUMPS=16
> +
> +$NFT add table t
Unquoted variable, may fail if, unlikely but possible, the name contains
i.e. spaces.
> +
> +for i in $(seq 1 $MAX_JUMPS)
> +do
> + $NFT add chain t c${i}
> +done
Requires `seq' binary.
I think for ((i=1; i<=$MAX_JUMPS; i++)) is more portable.
> +
> +for i in $(seq 1 $((MAX_JUMPS - 1)))
> +do
> + $NFT add rule t c${i} jump c$((i + 1))
> +done
Why not add functions? i.e.
runft() {
"$NFT" "$@"
}
nfat() {
runft add table "$@"
}
nfac() {
runft add chain "$@"
}
....
[...]
Best regards,
Mart
next prev parent reply other threads:[~2016-03-23 0:09 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-22 13:06 [nft PATCH] tests/shell: add chain validations tests Arturo Borrero Gonzalez
2016-03-22 19:20 ` Pablo Neira Ayuso
2016-03-23 7:44 ` Arturo Borrero Gonzalez
2016-03-29 11:16 ` Pablo Neira Ayuso
2016-03-23 0:09 ` Mart Frauenlob [this message]
2016-03-23 8:02 ` Arturo Borrero Gonzalez
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=56F1DEA2.70409@chello.at \
--to=mart.frauenlob@chello.at \
--cc=arturo.borrero.glez@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.