Re: [PATCH nft] parser_bison: restore nft {import,export} ruleset

2018-02-14 Thread Shyam Saini
> On Wed, Feb 14, 2018 at 08:16:52PM +0100, Pablo Neira Ayuso wrote: >> On Thu, Feb 15, 2018 at 12:34:31AM +0530, Shyam Saini wrote: >> > Hi Pablo, >> > >> > On Thu, Feb 15, 2018 at 12:02 AM, Pablo Neira Ayuso >> > wrote: >> > > Restore o

Re: [PATCH nft] parser_bison: restore nft {import,export} ruleset

2018-02-14 Thread Shyam Saini
Hi Pablo, On Thu, Feb 15, 2018 at 12:02 AM, Pablo Neira Ayuso wrote: > Restore original syntax for the yet experimental VM low-level json > representation. > > Closes: https://bugzilla.netfilter.org/show_bug.cgi?id=1224 > Signed-off-by: Pablo Neira Ayuso > --- > I asked for this change to make r

[Iptables PATCH] extensions: Rename 'flow table' keyword to meter

2018-01-26 Thread shyam saini
DROP nft add rule ip filter INPUT tcp dport 80 meter http3 { ip saddr and 255.255.255.0 limit rate 200/second } counter drop Signed-off-by: shyam saini --- extensions/libxt_hashlimit.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extensions/libxt_hashlimit.c b/

Re: [RFC PATCH nft V6 1/2] src: Add import command for low level json

2018-01-17 Thread Shyam Saini
> Hi Shyam, Hi Pablo, > On Tue, Dec 05, 2017 at 07:37:34PM +0530, Shyam Saini wrote: >> This new operation allows to import low level virtual machine ruleset in >> json to make incremental changes using the parse functions of libnftnl. >> >> A basic way to

[Iptables PATCH] extensions: Add test for cluster nft translation

2018-01-16 Thread Shyam Saini
This patch adds test cases for iptables to nft translation of cluster match This adds all test cases including corner cases. Run these test cases like: $ ./xlate-test.py extensions/libxt_cluster.txlate Signed-off-by: Shyam Saini --- extensions/libxt_cluster.txlate | 26

Re: [Iptables Patch V3] extensions: libxt_cluster: Add translation to nft

2018-01-15 Thread Shyam Saini
> Hi Shyam, Hi Pablo, > On Mon, Jan 15, 2018 at 11:29:28AM +0530, Shyam Saini wrote: >> Add translation for cluster to nft >> >> $ sudo iptables-translate -A PREROUTING -t mangle -i eth1 -m cluster >> --cluster-total-nodes 7 --cluster-local-node 5 --cluster-hash-se

[Iptables Patch V3] extensions: libxt_cluster: Add translation to nft

2018-01-14 Thread Shyam Saini
original saddr mod 7 seed 0xdeadbeef eq { 0, 2 } meta pkttype set host counter meta mark set 0x Signed-off-by: Shyam Saini --- extensions/libxt_cluster.c | 52 +- 1 file changed, 51 insertions(+), 1 deletion(-) diff --git a/extensions/libxt_cluster.c b

[RFC PATCH nft V6 1/2] src: Add import command for low level json

2017-12-05 Thread Shyam Saini
and Arturo Borrero Acked-by: Arturo Borrero Gonzalez Signed-off-by: Shyam Saini --- V6: Patch series Rebased V5: Adopt new "vm" symbol in the grammer which will be used to specify json format in low level virtual machine format. The defaut format will be high level json format w

[PATCH nft V5 2/2] tests: shell: Add tests for low level json import

2017-12-05 Thread Shyam Saini
s/import/vm_json_import_0 Signed-off-by: Shyam Saini --- V5: Patch series rebased V4: Adopt new "vm" symbol for export/import operations --- tests/shell/testcases/import/vm_json_import_0 | 71 +++ 1 file changed, 71 insertions(+) create mode 100755 tests/s

[PATCH nft V4 2/2] tests: shell: Add tests for low level json import

2017-10-15 Thread Shyam Saini
s/import/vm_json_import_0 Signed-off-by: Shyam Saini --- V4: Adopt new "vm" symbol for export/import operations --- tests/shell/testcases/import/vm_json_import_0 | 72 +++ 1 file changed, 72 insertions(+) create mode 100755 tests/shell/testcases/import/vm

[RFC PATCH nft V5 1/2] src: Add import command for low level json

2017-10-15 Thread Shyam Saini
and Arturo Borrero Acked-by: Arturo Borrero Gonzalez Signed-off-by: Shyam Saini --- V5: Adopt new "vm" symbol in the grammer which will be used to specify json format in low level virtual machine format. The defaut format will be high level json format which will come into exi

Re: [RFC PATCH nft V4] src: Add import command for json

2017-09-25 Thread Shyam Saini
> My only concern with this is that we'll end up having a json > representation in high-level format. > > So I wonder if it would be good to make a distinction between the > low-level VM (Virtual-Machine) json representation and the high-level > one. > > What I'm proposing is that we just add a com

[RFC PATCH nft V4] src: Add import command for json

2017-09-20 Thread Shyam Saini
Neira and Arturo Borrero Acked-by: Arturo Borrero Gonzalez Signed-off-by: Shyam Saini --- V4: Fix coding style issues Avoid nested function calls (As Suggested by Arturo ) --- include/netlink.h | 9 ++ include/rule.h | 14 +-- src/evaluate.c | 2 + src/netlink.c | 285

[RFC PATCH nft V3] src: Add import command for json

2017-09-11 Thread Shyam Saini
Neira and Arturo Borrero Signed-off-by: Shyam Saini --- V3: Follow kernel coding style --- include/netlink.h | 9 ++ include/rule.h | 14 +-- src/evaluate.c | 2 + src/netlink.c | 288 + src/parser_bison.y | 38

Re: [RFC PATCH nft V2] src: Add import command for json

2017-09-11 Thread Shyam Saini
a ruleset exported in json format. >> >> Highly based on work from Alvaro Neira >> and Arturo Borrero . >> >> Signed-off-by: Shyam Saini >> --- >> V2: >> Build Patch over updated repository. > > > Hi Shyam, Hi Arturo, > I was able t

[RFC PATCH nft V2] src: Add import command for json

2017-09-10 Thread Shyam Saini
Neira and Arturo Borrero . Signed-off-by: Shyam Saini --- V2: Build Patch over updated repository. --- include/netlink.h | 9 ++ include/rule.h | 14 +-- src/evaluate.c | 2 + src/netlink.c | 280 + src/parser_bison.y | 38

Re: [nft PATCH V2] tests: shell: Add tests for json import

2017-09-05 Thread Shyam Saini
> Hi Shyam, Hi Arturo, > your v3 looks fine. Thank you :) > I was going to test it out, but it seems the first patch [0] in the > series requires a refresh. > Please, refresh this first patch. > > thanks for your work! > > [0] http://patchwork.ozlabs.org/patch/803561/ Sorry, for the inconvenien

Re: [nft PATCH V2] tests: shell: Add tests for json import

2017-09-04 Thread Shyam Saini
rules_ipv6*->ip6 table rules files >> rules_arp* -> arp table rules files >> rules_bridge* ->bridge table rules files >> >> Signed-off-by: Shyam Saini >> --- > > This is v2: generally in this patch section we include

[PATCH nft V3] tests: shell: Add tests for json import

2017-09-04 Thread Shyam Saini
ases/import/json_import_0 Signed-off-by: Shyam Saini --- v3: Retain json_import_0 file which runs the actaual tests Drop all the rules_* files as they are no longer useful Drop all_ruleset_list file as rules are already included in test file v2: Add rules_* file for the reference Add

[nft PATCH V2] tests: shell: Add tests for json import

2017-09-02 Thread Shyam Saini
* ->bridge table rules files Signed-off-by: Shyam Saini --- tests/shell/testcases/import/all_ruleset_list | 46 ++ tests/shell/testcases/import/json_import_0 | 72 ++ .../testcases/import/rules_arp_hlen_range.json | 1 +

Re: [PATCH] examples: Fix memory leaks detected by Valgrind

2017-08-30 Thread Shyam Saini
On Wed, Aug 30, 2017 at 3:09 AM, Arturo Borrero Gonzalez wrote: > Thanks Shyam, > > Acked-by: Arturo Borrero Gonzalez > in the future, please add a tag to the [PATCH] header, like "[PATCH > libnftnl]" so we can easily know to which tree this patch should be > applied to. Thanks Arturo I'll fol

[PATCH] examples: Fix memory leaks detected by Valgrind

2017-08-29 Thread Shyam Saini
==definitely lost: 40 bytes in 1 blocks ==11831==indirectly lost: 0 bytes in 0 blocks ==11831== possibly lost: 0 bytes in 0 blocks ==11831==still reachable: 0 bytes in 0 blocks ==11831== suppressed: 0 bytes in 0 blocks Signed-off-by: Shyam Saini --- examples/nft-chain-add.c

Re: [PATCH V2] tests: json: Add test cases for json format

2017-08-24 Thread Shyam Saini
> > > These test cases can be used to test upcoming "import json" command. > > > > Here is the short description of the files: > > all_ruleset_list ->contains list of all the individual rules > > Wait. You are generating the JSON files from this ruleset, right? > yes. > > Then, why not simpl

[PATCH V2] tests: json: Add test cases for json format

2017-08-24 Thread Shyam Saini
of time some tests may fails. For example: dup to 172.20.0.2 ether daddr 00:01:02:03:04:05 ether saddr set ff:fe:dc:ba:98:76 drop Signed-off-by: Shyam Saini --- tests/shell/testcases/import/all_ruleset_list | 50 ++ .../testcases/import/rules_arp_hlen_range.json |

Re: [PATCH] tests: json: Add test cases for json format

2017-08-24 Thread Shyam Saini
On Wed, Aug 23, 2017 at 3:32 PM, Arturo Borrero Gonzalez wrote: > On 22 August 2017 at 11:30, Shyam Saini wrote: >> >> Should I send the version 2 of this patch with this script? >> > > Yes, > > my suggestion is: > > * create a new testcase in nftables: te

Re: [PATCH] tests: json: Add test cases for json format

2017-08-22 Thread Shyam Saini
On Tue, Aug 22, 2017 at 2:43 PM, Arturo Borrero Gonzalez wrote: > On 21 August 2017 at 22:55, Shyam Saini wrote: >> These cases can be used to test upcoming "import json" command. >> >> Here is the short description of the files: >> all_ruleset_list ->

[PATCH] tests: json: Add test cases for json format

2017-08-21 Thread Shyam Saini
arp table rules_bridge* ->bridge table At this point of time some tests may fails. For example: dup to 172.20.0.2 ether daddr 00:01:02:03:04:05 ether saddr set ff:fe:dc:ba:98:76 drop Signed-off-by: Shyam Saini --- tests/json/all_ruleset_list| 50 +

Re: [RFC PATCH] src: Add import command for json

2017-08-19 Thread Shyam Saini
Here is the rules.json file which i tested. On Sat, Aug 19, 2017 at 6:10 PM, Shyam Saini wrote: > This new operation allows to import ruleset in json to make > incremental changes using the parse functions of libnftnl. > > A basic way to test this new functionality is: > >

[RFC PATCH] src: Add import command for json

2017-08-19 Thread Shyam Saini
Neira and Arturo Borrero . Signed-off-by: Shyam Saini --- include/netlink.h | 9 ++ include/rule.h | 14 +-- src/evaluate.c | 10 +- src/netlink.c | 279 + src/parser_bison.y | 38 +--- src/rule.c | 44

Re: [PATCH 1/2] tests: shell: Add test for incomplete set add set command

2017-06-26 Thread Shyam Saini
On Mon, Jun 26, 2017 at 11:38 PM, Pablo Neira Ayuso wrote: > On Mon, Jun 26, 2017 at 11:24:23PM +0530, Shyam Saini wrote: >> On Mon, Jun 26, 2017 at 11:07 PM, Pablo Neira Ayuso >> wrote: >> > On Mon, Jun 26, 2017 at 11:02:34PM +0530, Shyam Saini wrote: >> >&

Re: [PATCH 1/2] tests: shell: Add test for incomplete set add set command

2017-06-26 Thread Shyam Saini
On Mon, Jun 26, 2017 at 11:07 PM, Pablo Neira Ayuso wrote: > On Mon, Jun 26, 2017 at 11:02:34PM +0530, Shyam Saini wrote: >> On Mon, Jun 26, 2017 at 10:29 PM, Pablo Neira Ayuso >> wrote: >> > On Fri, Jun 23, 2017 at 05:35:55PM +0530, Shyam Saini wrote: >> >>

Re: [PATCH 1/2] tests: shell: Add test for incomplete set add set command

2017-06-26 Thread Shyam Saini
On Mon, Jun 26, 2017 at 10:29 PM, Pablo Neira Ayuso wrote: > On Fri, Jun 23, 2017 at 05:35:55PM +0530, Shyam Saini wrote: >> Before the [Test] commit if we run nft with incomplete "add set" >> command it caused segmentation fault and exit with error code 139 and >&

[PATCH 2/2] tests: shell: Test input descriptors for included files

2017-06-23 Thread Shyam Saini
Before the [Test] commit, nft error message was pointing to wrong file. But after the commit it points to right file. This commit test the changes made in the [Test] commit. Test:b14572f72aac (" erec: Fix input descriptors for included files ") Signed-off-by: Shyam Saini --- .

[PATCH 1/2] tests: shell: Add test for incomplete set add set command

2017-06-23 Thread Shyam Saini
an incomplete set add command" ) Signed-off-by: Shyam Saini --- .../testcases/sets/0023incomplete_add_set_command_0 | 16 1 file changed, 16 insertions(+) create mode 100755 tests/shell/testcases/sets/0023incomplete_add_set_command_0 diff --git a/tests/shell/testcases/sets/

Re: [PATCHv3] tests: py: Add test for ambiguity while setting the value

2017-06-21 Thread Shyam Saini
On Sun, Jun 18, 2017 at 3:18 PM, Pablo Neira Ayuso wrote: > On Sun, Jun 18, 2017 at 11:29:13AM +0200, Pablo Neira Ayuso wrote: >> On Sat, Jun 17, 2017 at 01:05:42AM +0530, Shyam Saini wrote: >> > This test checks bug identified and fixed in the commit mentioned below >> &

[PATCH] tests: py: Fail test forcefully when bug is not fixed

2017-06-21 Thread Shyam Saini
atements which set values") Signed-off-by: Shyam Saini --- tests/py/nft-test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/py/nft-test.py b/tests/py/nft-test.py index c1da71aaf827..8d099a15aaf8 100755 --- a/tests/py/nft-test.py +++ b/tests/py/nft-test.py @@ -702

Re: [PATCHv3] tests: py: Add test for ambiguity while setting the value

2017-06-21 Thread Shyam Saini
On Sun, Jun 18, 2017 at 3:01 PM, Pablo Neira Ayuso wrote: > On Sun, Jun 18, 2017 at 11:29:13AM +0200, Pablo Neira Ayuso wrote: >> On Sat, Jun 17, 2017 at 01:05:42AM +0530, Shyam Saini wrote: >> > This test checks bug identified and fixed in the commit mentioned below >> &

Re: [PATCHv3] tests: py: Add test for ambiguity while setting the value

2017-06-21 Thread Shyam Saini
On Sun, Jun 18, 2017 at 2:59 PM, Pablo Neira Ayuso wrote: > On Sat, Jun 17, 2017 at 01:05:42AM +0530, Shyam Saini wrote: >> This test checks bug identified and fixed in the commit mentioned below >> In a statement if there are multiple src data then it would be >> totall

[PATCHv3] tests: py: Add test for ambiguity while setting the value

2017-06-16 Thread Shyam Saini
("evaluate: avoid reference to multiple src data in statements which set values") Signed-off-by: Shyam Saini --- tests/py/any/ct.t | 10 ++ tests/py/any/meta.t | 8 tests/py/bridge/ether.t | 7 +++ tests/py/inet/tcp.t | 7 +++ tests/py/inet/udp.

Re: [PATCHv2] tests: shell: Add test for ambguity while setting the value

2017-06-15 Thread Shyam Saini
On Thu, Jun 15, 2017 at 3:21 PM, Pablo Neira Ayuso wrote: > On Fri, Jun 09, 2017 at 09:31:00PM +0530, Shyam Saini wrote: >> This test checks bug identified and fixed in the commit mentioned below >> In a statement if there are multiple src data then it would be >> totall

Re: [PATCHv2] tests: shell: Add test for ambguity while setting the value

2017-06-12 Thread Shyam Saini
On Mon, Jun 12, 2017 at 4:19 PM, Pablo Neira Ayuso wrote: > On Mon, Jun 12, 2017 at 04:16:16PM +0530, Shyam Saini wrote: >> On Mon, Jun 12, 2017 at 2:52 PM, Pablo Neira Ayuso >> wrote: >> > On Fri, Jun 09, 2017 at 09:31:00PM +0530, Shyam Saini wrote: >> >>

Re: [PATCHv2] tests: shell: Add test for ambguity while setting the value

2017-06-12 Thread Shyam Saini
On Mon, Jun 12, 2017 at 2:52 PM, Pablo Neira Ayuso wrote: > On Fri, Jun 09, 2017 at 09:31:00PM +0530, Shyam Saini wrote: >> diff --git a/tests/shell/testcases/sets/0023unknown_value_to_use_0 >> b/tests/shell/testcases/sets/0023unknown_value_to_use_0 >> new file mode 10

[PATCHv2] tests: shell: Add test for ambguity while setting the value

2017-06-09 Thread Shyam Saini
; as return code. So, we can't detect 134 != 1 there. (both 1 and 134 stats failure) Test: 986dea8 ("evaluate: avoid reference to multiple src data in statements which set values") Signed-off-by: Shyam Saini --- .../testcases/sets/0023unknown_value_to_use_0 | 33 +

Re: [PATCH] tests: shell: Add test for ambguity while setting the value

2017-06-09 Thread Shyam Saini
On Fri, Jun 9, 2017 at 3:28 PM, Arturo Borrero Gonzalez wrote: > On 9 June 2017 at 11:30, Shyam Saini wrote: >> This test checks bug identified and fixed in the commit mentioned below >> In a statement if there are multiple src data then it would be >> totally ambiguous

[PATCH] tests: shell: Add test for ambguity while setting the value

2017-06-09 Thread Shyam Saini
; as return code. So, we can't detect 134 != 1 there. (both 1 and 134 stats failure) Test: 986dea8 ("evaluate: avoid reference to multiple src data in statements which set values") Signed-off-by: Shyam Saini --- .../testcases/sets/0023unknown_value_to_use_0 | 34 +

Re: [PATCHv2] extensions: libxt_cluster: Add translation to nft

2017-05-30 Thread Shyam Saini
On Tue, May 30, 2017 at 3:50 PM, Pablo Neira Ayuso wrote: > On Tue, May 30, 2017 at 12:08:55PM +0200, Pablo Neira Ayuso wrote: >> On Tue, May 30, 2017 at 01:55:34PM +0530, Shyam Saini wrote: >> > Add translation for cluster match to nftables >> > >> > $ sudo

[PATCHv2] extensions: libxt_cluster: Add translation to nft

2017-05-30 Thread Shyam Saini
-nodes is 2) in the cluster then modulus 2 = {0, 1} For node 1 (--cluster-local-node 1) jhash ct original saddr mod 2 seed 0xdeadbeef eq 0 For node 2 (--cluster-local-node 2) jhash ct original saddr mod 2 seed 0xdeadbeef eq 1 Signed-off-by: Shyam Saini --- extensions/libxt_clu

Re: [PATCH 1/1] extensions: libxt_cluster: Add translation to nft

2017-05-25 Thread Shyam Saini
On Wed, May 24, 2017 at 9:14 PM, Pablo Neira Ayuso wrote: > On Wed, May 24, 2017 at 06:01:51PM +0530, Shyam Saini wrote: >> Add translation for cluster to nft > > I think this should be: > > -m cluster --cluster-total-nodes 2 --cluster-local-node 1 > --clus

Re: [PATCH 1/1] extensions: libxt_cluster: Add translation to nft

2017-05-25 Thread Shyam Saini
>> Add translation for cluster to nft >> >> $ sudo iptables-translate -A PREROUTING -t mangle -i eth1 -m cluster >> --cluster-total-nodes 2 --cluster-local-node 1 --cluster-hash-seed >> 0xdeadbeef -j MARK --set-mark 0x >> >> nft add rule ip mangle PREROUTING iifname eth1 ct state {new,establis

[PATCH 1/1] extensions: libxt_cluster: Add translation to nft

2017-05-24 Thread Shyam Saini
] [ cmp eq reg 1 0x ] [ payload load 4b @ network header + 12 => reg 2 ] [ hash reg 1 = jhash(reg 2, 4, 0xdeadbeef) % mod 2 offset 1 ] [ meta set mark with reg 1 ] [ counter pkts 0 bytes 0 ] [ immediate reg 1 0x ] [ meta set mark with reg 1 ] Signed-off-by:

[PATCH] iptables: fix the wrong appending of jump verdict after the comment.

2017-01-26 Thread Shyam Saini
PT After this patch $ iptables-translate -A INPUT -p tcp -m tcp --sport http -s 192.168.0.0/16 -d 192.168.0.0/16 -j LONGNACCEPT -m comment --comment "foobar" nft add rule ip filter INPUT ip saddr 192.168.0.0/16 ip daddr 192.168.0.0/16 tcp sport 80 counter jump LONGNACCEPT comme

[PATCH 1/2] libxtables: xtables: remove unnecessary debug code

2016-12-12 Thread Shyam Saini
Remove unnecessary debug code Signed-off-by: Shyam Saini --- libxtables/xtables.c | 33 + 1 file changed, 5 insertions(+), 28 deletions(-) diff --git a/libxtables/xtables.c b/libxtables/xtables.c index 921dfe9..6e75c15 100644 --- a/libxtables/xtables.c +++ b

[PATCH 2/2] libxtables: xtables: Use getnameinfo()

2016-12-12 Thread Shyam Saini
Replace gethostbyaddr() with getnameinfo() as getnameinfo() deprecates the former and allows programs to eliminate IPv4-versus-IPv6 dependencies Signed-off-by: Shyam Saini --- libxtables/xtables.c | 15 ++- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/libxtables

[PATCH] libxtables: xtables.c: Use getnameinfo()

2016-12-09 Thread Shyam Saini
Use getnameinfo() instead of deprecated gethostbyaddr() Signed-off-by: Shyam Saini --- libxtables/xtables.c | 25 - 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/libxtables/xtables.c b/libxtables/xtables.c index 921dfe9..338e325 100644 --- a/libxtables