Message ID | 20171005101539.32010-1-harshasharmaiitr@gmail.com |
---|---|
State | Accepted |
Delegated to: | Pablo Neira |
Headers | show |
Series | tests: shell: add testcases for named objects | expand |
On Thu, Oct 05, 2017 at 03:45:39PM +0530, Harsha Sharma wrote: > Add testcases for creating named objects with unique name, defined > by user and referencing them from rule. Also applied, thanks. Could you add another tests for 'limit' objects too? I think I posted an example to the mailing list. -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Fri, Oct 6, 2017 at 6:08 PM, Pablo Neira Ayuso <pablo@netfilter.org> wrote: > On Thu, Oct 05, 2017 at 03:45:39PM +0530, Harsha Sharma wrote: >> Add testcases for creating named objects with unique name, defined >> by user and referencing them from rule. > > Also applied, thanks. > > Could you add another tests for 'limit' objects too? I think I posted > an example to the mailing list. Hello, I have pulled to latest tree, then make and make installed all changes but still I'm unable to add named 'limit' objects. If there is something that I'm missing, please let me know. Can you also please suggest some more tasks ? Thanks in advance. Regards, Harsha Sharma -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Sat, Oct 07, 2017 at 01:11:17PM +0530, Harsha Sharma wrote: > On Fri, Oct 6, 2017 at 6:08 PM, Pablo Neira Ayuso <pablo@netfilter.org> wrote: > > On Thu, Oct 05, 2017 at 03:45:39PM +0530, Harsha Sharma wrote: > >> Add testcases for creating named objects with unique name, defined > >> by user and referencing them from rule. > > > > Also applied, thanks. > > > > Could you add another tests for 'limit' objects too? I think I posted > > an example to the mailing list. > > Hello, > I have pulled to latest tree, then make and make installed all changes > but still I'm unable to add named 'limit' objects. If there is something that > I'm missing, please let me know. Are you using a kernel compiled from nf.git tree? > Can you also please suggest some more tasks ? Yes. It would be great if you could update tests/py/nft-tests.py to add a new option, basically to take all tests from files, place them in a file and exercise the 'nft -f' path with such an autogenerated large file with all tests. Would you have a look into that? Thanks. -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Mon, Oct 9, 2017 at 5:32 PM, Pablo Neira Ayuso <pablo@netfilter.org> wrote: > On Sat, Oct 07, 2017 at 01:11:17PM +0530, Harsha Sharma wrote: >> On Fri, Oct 6, 2017 at 6:08 PM, Pablo Neira Ayuso <pablo@netfilter.org> wrote: >> > On Thu, Oct 05, 2017 at 03:45:39PM +0530, Harsha Sharma wrote: >> >> Add testcases for creating named objects with unique name, defined >> >> by user and referencing them from rule. >> > >> > Also applied, thanks. >> > >> > Could you add another tests for 'limit' objects too? I think I posted >> > an example to the mailing list. >> >> Hello, >> I have pulled to latest tree, then make and make installed all changes >> but still I'm unable to add named 'limit' objects. If there is something that >> I'm missing, please let me know. > > Are you using a kernel compiled from nf.git tree? No, I was using kernel 4.10 but I have build the kernel 4.14 from nf-git tree now. > >> Can you also please suggest some more tasks ? > > Yes. It would be great if you could update tests/py/nft-tests.py to > add a new option, basically to take all tests from files, place them > in a file and exercise the 'nft -f' path with such an autogenerated > large file with all tests. > > Would you have a look into that? > Yes, definitely. Thanks for your time :). Regards, Harsha Sharma > Thanks. -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Mon, Oct 9, 2017 at 5:32 PM, Pablo Neira Ayuso <pablo@netfilter.org> wrote: > On Sat, Oct 07, 2017 at 01:11:17PM +0530, Harsha Sharma wrote: >> On Fri, Oct 6, 2017 at 6:08 PM, Pablo Neira Ayuso <pablo@netfilter.org> wrote: >> > On Thu, Oct 05, 2017 at 03:45:39PM +0530, Harsha Sharma wrote: >> >> Add testcases for creating named objects with unique name, defined >> >> by user and referencing them from rule. >> > >> > Also applied, thanks. >> > >> > Could you add another tests for 'limit' objects too? I think I posted >> > an example to the mailing list. >> >> Hello, >> I have pulled to latest tree, then make and make installed all changes >> but still I'm unable to add named 'limit' objects. If there is something that >> I'm missing, please let me know. > > Are you using a kernel compiled from nf.git tree? > >> Can you also please suggest some more tasks ? > > Yes. It would be great if you could update tests/py/nft-tests.py to > add a new option, basically to take all tests from files, place them > in a file and exercise the 'nft -f' path with such an autogenerated > large file with all tests. > > Would you have a look into that? > Hi, I have one doubt, nft-tests.py when executed without any argument or with option -d , already runs all commands in all test files ( don't directly run nft -f path as according to structure of tests in py, for lines starting with '*', table is added and similarly for ':', chain is added and similarly for objects, sets, etc.) so directly exercising 'nft -f' path on autogenerated file containing content of all tests files doesn't make sense. And calling function run_test_file for the large autogenerated file (as is called for each test file) will not make a lot of difference in result (compared to when executed without any argument) other than not printing total no. of test files executed and total no. of files passed. I hope I'm clear. Please correct me I'm wrong. What is exactly that I have to do in this task ? Thanks a lot for your time. Regards, Harsha Sharma > Thanks. -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/tests/shell/testcases/sets/0024named_objects_0 b/tests/shell/testcases/sets/0024named_objects_0 new file mode 100755 index 0000000..de02d65 --- /dev/null +++ b/tests/shell/testcases/sets/0024named_objects_0 @@ -0,0 +1,41 @@ +#!/bin/bash + +# This is the testscase: +# * creating valid named objects +# * 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 inet x { + counter user123 { + packets 12 bytes 1433 + } + quota user123 { + over 2000 bytes + } + quota user124 { + over 2000 bytes + } + set y { + type ipv4_addr + } + map test { + type ipv4_addr : quota + elements = { 192.168.2.2 : "user124", 192.168.2.3 : "user124"} + } + chain y { + type filter hook input priority 0; policy accept; + counter name ip saddr map { 192.168.2.2 : "user123", 1.1.1.1 : "user123", 2.2.2.2 : "user123"} + quota name ip saddr map @test drop + } +}" > $tmpfile + +set -e +$NFT -f $tmpfile
Add testcases for creating named objects with unique name, defined by user and referencing them from rule. Signed-off-by: Harsha Sharma <harshasharmaiitr@gmail.com> --- tests/shell/testcases/sets/0024named_objects_0 | 41 ++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100755 tests/shell/testcases/sets/0024named_objects_0 -- 2.11.0 -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html