Re: [PATCH nf-next] netfilter: nft: add support for native socket matching

2018-05-28 Thread Máté Eckl
On Tue, May 29, 2018 at 08:10:53AM +0800, kbuild test robot wrote: q > Hi Máté, > > Thank you for the patch! Yet something to improve: > > [auto build test ERROR on nf-next/master] > > url: > https://github.com/0day-ci/linux/commits/M-t-Eckl/netfilter-nft-add-support-for-native-socket-matchi

Re: [PATCH nf-next 2/8] netfilter: nf_tables: nf_tables_gettable: use call_rcu

2018-05-28 Thread kbuild test robot
Hi Florian, I love your patch! Perhaps something to improve: [auto build test WARNING on nf-next/master] url: https://github.com/0day-ci/linux/commits/Florian-Westphal/netfilter-nf_tables-make-get-and-dump-operations-lockless/20180529-071211 base: https://git.kernel.org/pub/scm/linux/kerne

[PATCH nf] netfilter: xt_CT: Force user-space strings as null terminated

2018-05-28 Thread gfree . wind
From: Gao Feng The helper and timeout strings are from user-space, we need to make sure they are null terminated. If not, evil user could make kernel read the unexpected memory, even print it when fail to find by the following codes. pr_info_ratelimited("No such helper \"%s\"\n", helper_name);

Re: [PATCH 0/9] Netfilter/IPVS fixes for net

2018-05-28 Thread David Miller
From: Pablo Neira Ayuso Date: Tue, 29 May 2018 01:42:12 +0200 > The following patchset contains Netfilter/IPVS fixes for your net tree: > > 1) Null pointer dereference when dumping conntrack helper configuration, >from Taehee Yoo. > > 2) Missing sanitization in ebtables extension name throu

[RFC PATCH] netfilter: nft: nft_socket_type can be static

2018-05-28 Thread kbuild test robot
Fixes: 809f719f9b3f ("netfilter: nft: add support for native socket matching") Signed-off-by: kbuild test robot --- nft_socket.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/netfilter/nft_socket.c b/net/netfilter/nft_socket.c index 5eb1069..3429a2e 100644 --- a/net

Re: [PATCH nf-next] netfilter: nft: add support for native socket matching

2018-05-28 Thread kbuild test robot
Hi Máté, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on nf-next/master] url: https://github.com/0day-ci/linux/commits/M-t-Eckl/netfilter-nft-add-support-for-native-socket-matching/20180529-064304 base: https://git.kernel.org/pub/scm/linux/kernel/git/pabl

Re: [PATCH nf-next] netfilter: nft: add support for native socket matching

2018-05-28 Thread kbuild test robot
Hi Máté, Thank you for the patch! Yet something to improve: [auto build test ERROR on nf-next/master] url: https://github.com/0day-ci/linux/commits/M-t-Eckl/netfilter-nft-add-support-for-native-socket-matching/20180529-064304 base: https://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-n

[PATCH 7/9] netfilter: nf_tables: disable preemption in nft_update_chain_stats()

2018-05-28 Thread Pablo Neira Ayuso
This patch fixes the following splat. [118709.054937] BUG: using smp_processor_id() in preemptible [] code: test/1571 [118709.054970] caller is nft_update_chain_stats.isra.4+0x53/0x97 [nf_tables] [118709.054980] CPU: 2 PID: 1571 Comm: test Not tainted 4.17.0-rc6+ #335 [...] [118709.054992

[PATCH 4/9] netfilter: nft_limit: fix packet ratelimiting

2018-05-28 Thread Pablo Neira Ayuso
Credit calculations for the packet ratelimiting are not correct, as per the applied ratelimit of 25/second and burst 8, a total of 33 packets should have been accepted. This is true in iptables(33) but not in nftables (~65). For packet ratelimiting, use: div_u64(limit->nsecs, limit->rate)

[PATCH 6/9] netfilter: provide correct argument to nla_strlcpy()

2018-05-28 Thread Pablo Neira Ayuso
From: Eric Dumazet Recent patch forgot to remove nla_data(), upsetting syzkaller a bit. BUG: KASAN: slab-out-of-bounds in nla_strlcpy+0x13d/0x150 lib/nlattr.c:314 Read of size 1 at addr 8801ad1f4fdd by task syz-executor189/4509 CPU: 1 PID: 4509 Comm: syz-executor189 Not tainted 4.17.0-rc6+

[PATCH 8/9] netfilter: nf_tables: fix NULL-ptr in nf_tables_dump_obj()

2018-05-28 Thread Pablo Neira Ayuso
From: Taehee Yoo The table field in nft_obj_filter is not an array. In order to check tablename, we should check if the pointer is set. Test commands: %nft add table ip filter %nft add counter ip filter ct1 %nft reset counters Splat looks like: [ 306.510504] kasan: CONFIG_KASAN_INLI

[PATCH 5/9] ipvs: fix buffer overflow with sync daemon and service

2018-05-28 Thread Pablo Neira Ayuso
From: Julian Anastasov syzkaller reports for buffer overflow for interface name when starting sync daemons [1] What we do is that we copy user structure into larger stack buffer but later we search NUL past the stack buffer. The same happens for sched_name when adding/editing virtual server. We

[PATCH 9/9] netfilter: nf_tables: increase nft_counters_enabled in nft_chain_stats_replace()

2018-05-28 Thread Pablo Neira Ayuso
From: Taehee Yoo When a chain is updated, a counter can be attached. if so, the nft_counters_enabled should be increased. test commands: %nft add table ip filter %nft add chain ip filter input { type filter hook input priority 4\; } %iptables-compat -Z input %nft delete chain ip fil

[PATCH 0/9] Netfilter/IPVS fixes for net

2018-05-28 Thread Pablo Neira Ayuso
Hi David, The following patchset contains Netfilter/IPVS fixes for your net tree: 1) Null pointer dereference when dumping conntrack helper configuration, from Taehee Yoo. 2) Missing sanitization in ebtables extension name through compat, from Paolo Abeni. 3) Broken fetch of tracing value

[PATCH 1/9] netfilter: nf_tables: fix NULL pointer dereference on nft_ct_helper_obj_dump()

2018-05-28 Thread Pablo Neira Ayuso
From: Taehee Yoo In the nft_ct_helper_obj_dump(), always priv->helper4 is dereferenced. But if family is ipv6, priv->helper6 should be dereferenced. Steps to reproduces: #test.nft table ip6 filter { ct helper ftp { type "ftp" protocol tcp }

[PATCH 2/9] netfilter: ebtables: handle string from userspace with care

2018-05-28 Thread Pablo Neira Ayuso
From: Paolo Abeni strlcpy() can't be safely used on a user-space provided string, as it can try to read beyond the buffer's end, if the latter is not NULL terminated. Leveraging the above, syzbot has been able to trigger the following splat: BUG: KASAN: stack-out-of-bounds in strlcpy include/li

[PATCH 3/9] netfilter: nft_meta: fix wrong value dereference in nft_meta_set_eval

2018-05-28 Thread Pablo Neira Ayuso
From: Taehee Yoo In the nft_meta_set_eval, nftrace value is dereferenced as u32 from sreg. But correct type is u8. so that sometimes incorrect value is dereferenced. Steps to reproduce: %nft add table ip filter %nft add chain ip filter input { type filter hook input priority 4\; } %nft

BUG: unable to handle kernel (3)

2018-05-28 Thread syzbot
Hello, syzbot found the following crash on: HEAD commit:861d9dd37526 Merge tag 'kbuild-fixes-v4.17-2' of git://git.. git tree: upstream console output: https://syzkaller.appspot.com/x/log.txt?x=10bffd0f80 kernel config: https://syzkaller.appspot.com/x/.config?x=982e2df1b9e60b02 da

[PATCH v2,xtables 3/4] xtables: rework rule cache logic

2018-05-28 Thread Pablo Neira Ayuso
Perform incremental tracking on rule cache updates, instead of flushing and resynchronizing with the kernel over and over again. Note that there is no need to call flush_rule_cache() from nft_rule_delete() and nft_rule_delete_num(), since __nft_rule_del() already deletes the rule from the list. S

[PATCH v2,xtables 4/4] xtables: initialize basechains for rule flush command too

2018-05-28 Thread Pablo Neira Ayuso
Otherwise, flush commands on not-yet-initialized basechains hit ENOENT. Signed-off-by: Pablo Neira Ayuso --- v2: no changes. iptables/nft.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/iptables/nft.c b/iptables/nft.c index 03a9f29df0ee..ec9dd13b4031 100644 --- a/iptables/nft.c +++ b/i

[PATCH v2,xtables 1/4] xtables: initialize basechains only once on ruleset restore

2018-05-28 Thread Pablo Neira Ayuso
We cannot assume iptables-restore files always come with explicit basechain definition, eg. :PREROUTING ACCEPT incremental ruleset updates may deliberately skip this. But loading basechains over and over again can take time, so do it just once per batch. Signed-off-by: Pablo Neira Ayuso --- v2

[PATCH v2,xtables 2/4] xtables: add chain cache

2018-05-28 Thread Pablo Neira Ayuso
So we don't have to dump the chain cache content over and over again. Moreover, perform incremental updates on the chain cache to add and to delete non-base chains. Signed-off-by: Pablo Neira Ayuso --- v2: no changes. iptables/nft.c | 82 -

[PATCH xtables 1/4] xtables: always initialize basechains on ruleset restore

2018-05-28 Thread Pablo Neira Ayuso
We cannot assume iptables-restore files always come with explicit basechain definition, eg. :PREROUTING ACCEPT incremental ruleset updates may deliberately skip this. Signed-off-by: Pablo Neira Ayuso --- iptables/nft.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/iptables/nft.c b/ipta

Re: [PATCH libnftnl] Updated nf_tables.h

2018-05-28 Thread Pablo Neira Ayuso
Applied with changes, thanks. -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: [PATCH nft] Updated nf_tables.h

2018-05-28 Thread Pablo Neira Ayuso
Applied with changes, thanks. -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

[PATCH nf-next v3] netfilter: nft_ct: add ct timeout support

2018-05-28 Thread Harsha Sharma
This patch allows to add, list and delete connection tracking timeout policies via nft objref infrastructure and assigning these timeout via nft rule. Ruleset: table ip raw { ct timeout cttime { protocol tcp established 111 close 13 l3proto ip } chain output {

Re: [PATCH nf-next] netfilter: nf_tables: remove unused variables

2018-05-28 Thread Pablo Neira Ayuso
On Tue, May 29, 2018 at 01:15:27AM +0900, Taehee Yoo wrote: > The comment and trace_loginfo are not used anymore. Applied, thanks. -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger

Re: [PATCH nf-next] netfilter: nf_tables: fix endian mismatch in return type

2018-05-28 Thread Pablo Neira Ayuso
On Sun, May 27, 2018 at 11:21:31AM +0200, Florian Westphal wrote: > harmless, but it avoids sparse warnings: > > nf_tables_api.c:2813:16: warning: incorrect type in return expression > (different base types) > nf_tables_api.c:2863:47: warning: incorrect type in argument 3 (different > base types

Re: [PATCH nf-next] netfilter: nf_tables: fail batch if fatal signal is pending

2018-05-28 Thread Pablo Neira Ayuso
On Sun, May 27, 2018 at 11:24:34AM +0200, Florian Westphal wrote: > abort batch processing and return so task can exit faster. > Otherwise even SIGKILL has no immediate effect. Applied, thanks. -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message t

Re: [PATCH nf-next 1/8] netfilter: nf_tables: nf_tables_getgen: use call_rcu

2018-05-28 Thread Pablo Neira Ayuso
On Tue, May 29, 2018 at 12:50:55AM +0200, Pablo Neira Ayuso wrote: > On Sun, May 27, 2018 at 11:31:46AM +0200, Florian Westphal wrote: > > This callback just fetches the current base sequence, > > there is no need to serialize this with nfnl nft mutex. > > Series applied, thanks! For the record:

Re: [PATCH net-next v16 4/8] netfilter: Add nf_ct_get_tuple_skb callback

2018-05-28 Thread Toke Høiland-Jørgensen
Pablo Neira Ayuso writes: > On Mon, May 28, 2018 at 04:27:46PM +0200, Toke Høiland-Jørgensen wrote: > [...] >> diff --git a/net/netfilter/core.c b/net/netfilter/core.c >> index 0f6b8172fb9a..520565198f0e 100644 >> --- a/net/netfilter/core.c >> +++ b/net/netfilter/core.c >> @@ -572,6 +572,27 @@ vo

Re: [PATCH nf-next] netfilter: nft_compat: use call_rcu for nfnl_compat_get

2018-05-28 Thread Pablo Neira Ayuso
On Sun, May 27, 2018 at 11:20:48AM +0200, Florian Westphal wrote: > Just use .call_rcu instead. We can drop the rcu read lock > after obtaining a reference and re-acquire on return. Applied, thanks Florian. -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body

Re: [PATCH nf-next 1/8] netfilter: nf_tables: nf_tables_getgen: use call_rcu

2018-05-28 Thread Pablo Neira Ayuso
On Sun, May 27, 2018 at 11:31:46AM +0200, Florian Westphal wrote: > This callback just fetches the current base sequence, > there is no need to serialize this with nfnl nft mutex. Series applied, thanks! -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a

Re: [PATCH v2 nf-next 1/2] netfilter: nat: merge ipv4/ipv6 masquerade code into main nat module

2018-05-28 Thread Pablo Neira Ayuso
On Thu, May 24, 2018 at 01:17:28PM +0200, Florian Westphal wrote: > Instead of using extra modules for these, turn the config options into > an implicit dependency that adds masq feature to the protocol specific nf_nat > module. Applied, thanks Florian. -- To unsubscribe from this list: send the

Re: [PATCH v2 nf-next 2/2] netfilter: nat: merge nf_nat_redirect into nf_nat

2018-05-28 Thread Pablo Neira Ayuso
On Thu, May 24, 2018 at 01:17:29PM +0200, Florian Westphal wrote: > Similar to previous patch, this time, merge redirect+nat. > The redirect module is just 2k in size, get rid of it and make > redirect part available from the nat core. Also applied, thanks. -- To unsubscribe from this list: send t

Re: [PATCH] iptables-compat: homogenize error message

2018-05-28 Thread Pablo Neira Ayuso
On Sun, May 27, 2018 at 06:39:01PM +0530, Arushi Singhal wrote: > There is a difference between error messages in iptables and > iptables-compat: > > #sudo iptables-compat -D INPUT 4 > iptables: No chain/target/match by that name. > > #sudo iptables -D INPUT 4 > iptables: Index of deletion too bi

Re: [PATCH net-next] netfilter: nat: make symbol nat_hook static

2018-05-28 Thread Pablo Neira Ayuso
On Sat, May 26, 2018 at 09:48:53AM +, Wei Yongjun wrote: > Fixes the following sparse warning: > > net/netfilter/nf_nat_core.c:1039:20: warning: > symbol 'nat_hook' was not declared. Should it be static? Applied, thanks. -- To unsubscribe from this list: send the line "unsubscribe netfilter-

Re: [PATCH v2 nf-next] netfilter: added includes to nf_socket.h

2018-05-28 Thread Pablo Neira Ayuso
On Mon, May 28, 2018 at 09:03:47AM +0200, Máté Eckl wrote: > Is it okay now Pablo? You were right, those forward declarations became > unnecessary. It's fine. Applied, thanks. -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majord...@vger.

[PATCH net-next v17 0/8] sched: Add Common Applications Kept Enhanced (cake) qdisc

2018-05-28 Thread Toke Høiland-Jørgensen
This patch series adds the CAKE qdisc, and has been split up to ease review. I have attempted to split out each configurable feature into its own patch. The first commit adds the base shaper and packet scheduler, while subsequent commits add the optional features. The full userspace API and most d

[PATCH net-next v17 5/8] sch_cake: Add NAT awareness to packet classifier

2018-05-28 Thread Toke Høiland-Jørgensen
When CAKE is deployed on a gateway that also performs NAT (which is a common deployment mode), the host fairness mechanism cannot distinguish internal hosts from each other, and so fails to work correctly. To fix this, we add an optional NAT awareness mode, which will query the kernel conntrack me

Re: [PATCH nf] netfilter: nf_tables: fix NULL-ptr in nf_tables_dump_obj()

2018-05-28 Thread Pablo Neira Ayuso
On Tue, May 29, 2018 at 01:13:45AM +0900, Taehee Yoo wrote: > The table of nft_obj_filter is not array. > So, in order to check tablename, we should use pointer of that. > > test commands: > >%nft add table ip filter >%nft add counter ip filter ct1 >%nft reset counters Applied, thank

[PATCH net-next v17 4/8] netfilter: Add nf_ct_get_tuple_skb global lookup function

2018-05-28 Thread Toke Høiland-Jørgensen
This adds a global netfilter function to extract a conntrack tuple from an skb. The function uses a new function added to nf_ct_hook, which will try to get the tuple from skb->_nfct, and do a full lookup if that fails. This makes it possible to use the lookup function before the skb has passed thro

Re: [PATCH nf-next 2/2] netfilter: nf_tables: remove synchronize_rcu in commit phase

2018-05-28 Thread Pablo Neira Ayuso
On Fri, May 25, 2018 at 12:25:48AM +0200, Florian Westphal wrote: > synchronize_rcu() is expensive. > > The commit phase currently enforces an unconditional > synchronize_rcu() after incrementing the generation counter. > > This is to make sure that a packet always sees a consistent chain, either

Re: [PATCH nf] netfilter: nf_tables: increse nft_counters_enabled in nft_chain_stats_replace()

2018-05-28 Thread Pablo Neira Ayuso
On Tue, May 29, 2018 at 01:14:12AM +0900, Taehee Yoo wrote: > When a chain is updated, a counter can be attached. if so, > the nft_counters_enabled should be increased. > > test commands: > >%nft add table ip filter >%nft add chain ip filter input { type filter hook input priority 4\; } >

Re: [PATCH net-next v16 5/8] sch_cake: Add NAT awareness to packet classifier

2018-05-28 Thread Toke Høiland-Jørgensen
Pablo Neira Ayuso writes: > On Mon, May 28, 2018 at 04:27:46PM +0200, Toke Høiland-Jørgensen wrote: >> When CAKE is deployed on a gateway that also performs NAT (which is a >> common deployment mode), the host fairness mechanism cannot distinguish >> internal hosts from each other, and so fails t

Re: [PATCH] ebtables: fix limit and mark modules incompatibilities between 32-bit user space and 64-bit kernel space

2018-05-28 Thread Pablo Neira Ayuso
On Mon, May 28, 2018 at 06:07:29PM +0200, Alin Nastac wrote: > Signed-off-by: Alin Nastac > --- > include/linux/netfilter_bridge/ebt_limit.h | 4 > include/linux/netfilter_bridge/ebt_mark_m.h | 5 + > include/linux/netfilter_bridge/ebt_mark_t.h | 4 > 3 files changed, 13 insertions

Re: [PATCH net-next v16 5/8] sch_cake: Add NAT awareness to packet classifier

2018-05-28 Thread Pablo Neira Ayuso
On Mon, May 28, 2018 at 04:27:46PM +0200, Toke Høiland-Jørgensen wrote: > When CAKE is deployed on a gateway that also performs NAT (which is a > common deployment mode), the host fairness mechanism cannot distinguish > internal hosts from each other, and so fails to work correctly. > > To fix thi

Re: [PATCH net-next v16 4/8] netfilter: Add nf_ct_get_tuple_skb callback

2018-05-28 Thread Pablo Neira Ayuso
On Mon, May 28, 2018 at 04:27:46PM +0200, Toke Høiland-Jørgensen wrote: [...] > diff --git a/net/netfilter/core.c b/net/netfilter/core.c > index 0f6b8172fb9a..520565198f0e 100644 > --- a/net/netfilter/core.c > +++ b/net/netfilter/core.c > @@ -572,6 +572,27 @@ void nf_conntrack_destroy(struct nf_con

[PATCH xtables] xtables-compat: append all errors into single line

2018-05-28 Thread Florian Westphal
iptables-restore < /tmp/bogus iptables-restore v1.6.2: iptables-restore: line 49: RULE_APPEND failed (No such file or directory): rule in chain FOOBAR line 2023: RULE_APPEND failed (Invalid argument): rule in chain TESTSNAT This is a followup commit to 437746c7b528f ("xtables: extended error repo

[PATCH xtables] xtables-compat: ignore '+' interface name

2018-05-28 Thread Florian Westphal
its same as omitting it, so instead of generating invalid compare-with-0-sized-register, just ignore it. Reported-by: Pablo Neira Ayuso Signed-off-by: Florian Westphal --- iptables/nft-shared.c | 14 -- 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/iptables/nft-share

[PATCH xtables 3/4] xtables: rework rule cache logic

2018-05-28 Thread Pablo Neira Ayuso
Perform incremental tracking on rule cache updates, instead of flushing and resynchronizing with the kernel over and over again. Note that there is no need to call flush_rule_cache() from nft_rule_delete() and nft_rule_delete_num(), since __nft_rule_del() already deletes the rule from the list. S

[PATCH xtables 4/4] xtables: initialize basechains for rule flush command too

2018-05-28 Thread Pablo Neira Ayuso
Otherwise, flush commands on not-yet-initialized basechains hit ENOENT. Signed-off-by: Pablo Neira Ayuso --- iptables/nft.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/iptables/nft.c b/iptables/nft.c index 3cfd23c7cdab..851073fb4a44 100644 --- a/iptables/nft.c +++ b/iptables/nft.c @@

[PATCH xtables 2/4] xtables: add chain cache

2018-05-28 Thread Pablo Neira Ayuso
So we don't have to dump the chain cache content over and over again. Moreover, perform incremental updates on the chain cache to add and to delete non-base chains. Signed-off-by: Pablo Neira Ayuso --- iptables/nft.c | 82 -- iptables/nft.h

[PATCH xtables 1/4] xtables: always initialize basechains on ruleset restore

2018-05-28 Thread Pablo Neira Ayuso
We cannot assume iptables-restore files always come with explicit basechain definition, eg. :PREROUTING ACCEPT incremental ruleset updates may deliberately skip this. Signed-off-by: Pablo Neira Ayuso --- iptables/nft.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/iptables/nft.c b/ipta

[PATCH libnftnl] rule: add nftnl_rule_list_insert_at()

2018-05-28 Thread Pablo Neira Ayuso
Allow to add rule object before any existing rule. Signed-off-by: Pablo Neira Ayuso --- include/libnftnl/rule.h | 1 + src/libnftnl.map| 4 src/rule.c | 6 ++ 3 files changed, 11 insertions(+) diff --git a/include/libnftnl/rule.h b/include/libnftnl/rule.h index 947

[nft PATCH v2 08/14] JSON: Simplify tcp option expression parsing a bit

2018-05-28 Thread Phil Sutter
When parsing the optional "field" property, use return code of json_unpack() directly to check if it was present or not. Signed-off-by: Phil Sutter --- src/parser_json.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/parser_json.c b/src/parser_json.c index f3d2c0f1d

[nft PATCH v2 00/14] JSON: Some minor schema changes

2018-05-28 Thread Phil Sutter
While writing JSON schema documentation, a number of ugly/broken bits were identified which this series addresses in patches 1-7. Patches 8-11 contain some fixes and improvements to parser_json.c which don't change the schema. Patches 12, 13 and 14 contain fixes for JSON part of tests/py, identif

[nft PATCH v2 02/14] JSON: Use "type" for CT helper object

2018-05-28 Thread Phil Sutter
Property name "helper" was a bit unclear, "type" is better. Signed-off-by: Phil Sutter --- src/json.c| 2 +- src/parser_json.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/json.c b/src/json.c index e458eb3e4bdd8..1b73b919d5df2 100644 --- a/src/json.c +++ b

[nft PATCH v2 03/14] JSON: Disallow non-array concat expression values

2018-05-28 Thread Phil Sutter
Concat expressions with just a single element don't make sense, so there's no point in supporting a shorter syntax for this. Signed-off-by: Phil Sutter --- src/parser_json.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/parser_json.c b/src/parser_json.c index 993368f

[nft PATCH v2 07/14] JSON: Fix parsing and printing of limit objects

2018-05-28 Thread Phil Sutter
Fix parsing and printing of named limit objects by aligning the code with parser/printer of anonymous ones. Signed-off-by: Phil Sutter --- src/json.c| 43 - src/parser_json.c | 49 ++- 2 files changed, 48

[nft PATCH v2 14/14] tests/py: Add missing JSON equivalent for rule in inet/tcp.t

2018-05-28 Thread Phil Sutter
Signed-off-by: Phil Sutter --- tests/py/inet/tcp.t.json | 16 1 file changed, 16 insertions(+) diff --git a/tests/py/inet/tcp.t.json b/tests/py/inet/tcp.t.json index 559206dfd323f..f5df72aa252a6 100644 --- a/tests/py/inet/tcp.t.json +++ b/tests/py/inet/tcp.t.json @@ -1021,6 +102

[nft PATCH v2 01/14] objref: Use "ct helper" for NFT_OBJECT_CT_HELPER

2018-05-28 Thread Phil Sutter
Change name of NFT_OBJECT_CT_HELPER in objref_type table to "ct helper" for consistency. Note that this is not used in regular nft output since objref_stmt_print() treats this object type separately. Signed-off-by: Phil Sutter --- src/parser_json.c | 2 +- src/statement.c| 2

[nft PATCH v2 13/14] tests/py: Add missing JSON equivalent for inet/sets.t

2018-05-28 Thread Phil Sutter
This adds the missing JSON variant for the two rules which are supposed to work. Fixes: 2efbdf7b8fcf7 ("tests: py: allow to specify sets with a timeout") Signed-off-by: Phil Sutter --- tests/py/inet/sets.t.json | 37 + 1 file changed, 37 insertions(+) create

[nft PATCH v2 05/14] JSON: Review meter statement support

2018-05-28 Thread Phil Sutter
Meter name being optional seems to come from old flow statement, so don't support this. Also add size support as was recently added to standard syntax. Signed-off-by: Phil Sutter --- src/json.c| 5 +++-- src/parser_json.c | 11 ++- 2 files changed, 9 insertions(+), 7 deletions(-

[nft PATCH v2 09/14] JSON: Improve prefix expression parsing error message a bit

2018-05-28 Thread Phil Sutter
Signed-off-by: Phil Sutter --- src/parser_json.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/parser_json.c b/src/parser_json.c index bd1c0a04993c8..432991fa152d4 100644 --- a/src/parser_json.c +++ b/src/parser_json.c @@ -951,7 +951,7 @@ static struct expr *json_parse_p

[nft PATCH v2 04/14] JSON: Sort out rule position and handles in general

2018-05-28 Thread Phil Sutter
First of all, don't print the position property when listing rules. This was there only because libnftnl JSON output has it too, but since the preferred way to *add* a rule at some location is via 'handle' keyword, keeping "position" in output would be non-intuitive. Changing "position" property na

[nft PATCH v2 10/14] JSON: Fix parsing of meter statement key

2018-05-28 Thread Phil Sutter
The key must be a set elem expression, but if a "regular" expression was provided (which should be commonly accepted in case no set elem specific properties are required), the resulting object tree crashed libnftables. Signed-off-by: Phil Sutter --- src/parser_json.c | 4 ++-- 1 file changed, 2

[nft PATCH v2 12/14] tests/py: Adjust JSON for changes in any/ct.t

2018-05-28 Thread Phil Sutter
Commit 71624f25f22b1 ("tests: py: add expires tests with different time bases") removed two testcases and added five other ones, adjust JSON equivalent and recorded output to those changes. Fixes: 71624f25f22b1 ("tests: py: add expires tests with different time bases") Signed-off-by: Phil Sutter

[nft PATCH v2 11/14] JSON: Simplify immediate value parsing

2018-05-28 Thread Phil Sutter
Since an explicit "immediate" expression doesn't exist in JSON (the values are represented as plain JSON string/integer/boolean types), there is no need for json_parse_immediate_expr() to comply to the common expression parser parameter format. Apart from that: * Drop CTX_F_RHS checks - caller as

[nft PATCH v2 06/14] JSON: Review set elem expressions

2018-05-28 Thread Phil Sutter
* There is no need to prefix element-specific properties with 'elem_', they can't conflict. * In json_parse_set_stmt(), searching for above properties is pointless since that's already done by called function. * Fix potential NULL-pointer deref in json_parse_set_elem_expr_stmt(): json_parse_f

Re: [PATCH nf] netfilter: nf_tables: fix NULL-ptr in nf_tables_dump_obj()

2018-05-28 Thread Florian Westphal
Taehee Yoo wrote: > The table of nft_obj_filter is not array. > So, in order to check tablename, we should use pointer of that. > > test commands: > >%nft add table ip filter >%nft add counter ip filter ct1 >%nft reset counters Fixes: e46abbcc05aa8 ("netfilter: nf_tables: Allow tabl

Re: [PATCH nf-next] netfilter: nf_tables: remove unused variables

2018-05-28 Thread Florian Westphal
Taehee Yoo wrote: > The comment and trace_loginfo are not used anymore. Indeed, thanks for fixing this up. Acked-by: Florian Westphal -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majord...@vger.kernel.org More majordomo info at http:

[PATCH nf-next] netfilter: nf_tables: remove unused variables

2018-05-28 Thread Taehee Yoo
The comment and trace_loginfo are not used anymore. Signed-off-by: Taehee Yoo --- net/netfilter/nf_tables_core.c | 16 1 file changed, 16 deletions(-) diff --git a/net/netfilter/nf_tables_core.c b/net/netfilter/nf_tables_core.c index d457d85..a1b93fa 100644 --- a/net/netfilter/

[PATCH nf] netfilter: nf_tables: increse nft_counters_enabled in nft_chain_stats_replace()

2018-05-28 Thread Taehee Yoo
When a chain is updated, a counter can be attached. if so, the nft_counters_enabled should be increased. test commands: %nft add table ip filter %nft add chain ip filter input { type filter hook input priority 4\; } %iptables-compat -Z input %nft delete chain ip filter input we can s

[PATCH nf] netfilter: nf_tables: fix NULL-ptr in nf_tables_dump_obj()

2018-05-28 Thread Taehee Yoo
The table of nft_obj_filter is not array. So, in order to check tablename, we should use pointer of that. test commands: %nft add table ip filter %nft add counter ip filter ct1 %nft reset counters we can see below messages: [ 306.510504] kasan: CONFIG_KASAN_INLINE enabled [ 306.51618

Re: [PATCH] ebtables: fix limit and mark modules incompatibilities between 32-bit user space and 64-bit kernel space

2018-05-28 Thread Florian Westphal
Alin Nastac wrote: Whats wrong exactly? 64bit kernel should be able to understand this without userspace kludges (see net/bridge/netfilter/ebt_mark_m.c, mark_mt_compat_from_user()). -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majord..

[PATCH] ebtables: fix limit and mark modules incompatibilities between 32-bit user space and 64-bit kernel space

2018-05-28 Thread Alin Nastac
Signed-off-by: Alin Nastac --- include/linux/netfilter_bridge/ebt_limit.h | 4 include/linux/netfilter_bridge/ebt_mark_m.h | 5 + include/linux/netfilter_bridge/ebt_mark_t.h | 4 3 files changed, 13 insertions(+) diff --git a/include/linux/netfilter_bridge/ebt_limit.h b/include/l

Re: [nft PATCH 14/14] meter: Don't print default size value

2018-05-28 Thread Phil Sutter
Hi, On Mon, May 28, 2018 at 03:59:39PM +0200, Florian Westphal wrote: > Phil Sutter wrote: > > A meter size of 0x is the default, so regardless of whether it was > > explicitly specified by user or not, don't print it. This is in line > > with nft's tendency of shortening rules down to the mi

Re: [PATCH nft] Introduce socket matching

2018-05-28 Thread Florian Westphal
Máté Eckl wrote: > > +const struct socket_template socket_templates[] = { > > + [NFT_SOCKET_TRANSPARENT]= {.token = "transparent", > > + .dtype = &integer_type, > > + .len = 1 * BITS_PER_BYTE, > > I wanted to use

Re: [PATCH nft] Introduce socket matching

2018-05-28 Thread Máté Eckl
> +const struct socket_template socket_templates[] = { > + [NFT_SOCKET_TRANSPARENT]= {.token = "transparent", > +.dtype = &integer_type, > +.len = 1 * BITS_PER_BYTE, I wanted to use len = 1 here to only mak

[PATCH nft] Introduce socket matching

2018-05-28 Thread Máté Eckl
For now it can only match sockets with IP(V6)_TRANSPARENT socket option set. Example: table inet sockin { chain sockchain { type filter hook prerouting priority -150; policy accept; socket transparent 1 mark set 0x0001 nftrace set 1 counter packets 0 by

[PATCH net-next v16 0/8] sched: Add Common Applications Kept Enhanced (cake) qdisc

2018-05-28 Thread Toke Høiland-Jørgensen
This patch series adds the CAKE qdisc, and has been split up to ease review. I have attempted to split out each configurable feature into its own patch. The first commit adds the base shaper and packet scheduler, while subsequent commits add the optional features. The full userspace API and most d

[PATCH net-next v16 4/8] netfilter: Add nf_ct_get_tuple_skb callback

2018-05-28 Thread Toke Høiland-Jørgensen
This adds a callback to netfilter to extract a conntrack tuple from an skb that works before the _nfct skb field has been initialised (e.g., in an ingress qdisc). The tuple is copied to the caller to avoid issues with reference counting. The callback will return false when conntrack is not loaded,

[PATCH net-next v16 5/8] sch_cake: Add NAT awareness to packet classifier

2018-05-28 Thread Toke Høiland-Jørgensen
When CAKE is deployed on a gateway that also performs NAT (which is a common deployment mode), the host fairness mechanism cannot distinguish internal hosts from each other, and so fails to work correctly. To fix this, we add an optional NAT awareness mode, which will query the kernel conntrack me

Re: [nft PATCH 14/14] meter: Don't print default size value

2018-05-28 Thread Florian Westphal
Phil Sutter wrote: > A meter size of 0x is the default, so regardless of whether it was > explicitly specified by user or not, don't print it. This is in line > with nft's tendency of shortening rules down to the minimal required > form. I think it should be printed to not depend on future ve

[nft PATCH 09/14] JSON: Improve prefix expression parsing error message a bit

2018-05-28 Thread Phil Sutter
Signed-off-by: Phil Sutter --- src/parser_json.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/parser_json.c b/src/parser_json.c index bd1c0a04993c8..432991fa152d4 100644 --- a/src/parser_json.c +++ b/src/parser_json.c @@ -951,7 +951,7 @@ static struct expr *json_parse_p

[nft PATCH 06/14] JSON: Review set elem expressions

2018-05-28 Thread Phil Sutter
* There is no need to prefix element-specific properties with 'elem_', they can't conflict. * In json_parse_set_stmt(), searching for above properties is pointless since that's already done by called function. * Fix potential NULL-pointer deref in json_parse_set_elem_expr_stmt(): json_parse_f

[nft PATCH 10/14] JSON: Fix parsing of meter statement key

2018-05-28 Thread Phil Sutter
The key must be a set elem expression, but if a "regular" expression was provided (which should be commonly accepted in case no set elem specific properties are required), the resulting object tree crashed libnftables. Signed-off-by: Phil Sutter --- src/parser_json.c | 4 ++-- 1 file changed, 2

[nft PATCH 05/14] JSON: Review meter statement support

2018-05-28 Thread Phil Sutter
Meter name being optional seems to come from old flow statement, so don't support this. Also add size support as was recently added to standard syntax. Signed-off-by: Phil Sutter --- src/json.c| 5 +++-- src/parser_json.c | 11 ++- 2 files changed, 9 insertions(+), 7 deletions(-

[nft PATCH 13/14] tests/py: Add missing JSON equivalent for inet/sets.t

2018-05-28 Thread Phil Sutter
This adds the missing JSON variant for the two rules which are supposed to work. Fixes: 2efbdf7b8fcf7 ("tests: py: allow to specify sets with a timeout") Signed-off-by: Phil Sutter --- tests/py/inet/sets.t.json | 37 + 1 file changed, 37 insertions(+) create

[nft PATCH 12/14] tests/py: Adjust JSON for changes in any/ct.t

2018-05-28 Thread Phil Sutter
Commit 71624f25f22b1 ("tests: py: add expires tests with different time bases") removed two testcases and added five other ones, adjust JSON equivalent and recorded output to those changes. Fixes: 71624f25f22b1 ("tests: py: add expires tests with different time bases") Signed-off-by: Phil Sutter

[nft PATCH 01/14] objref: Use "ct helper" for NFT_OBJECT_CT_HELPER

2018-05-28 Thread Phil Sutter
Change name of NFT_OBJECT_CT_HELPER in objref_type table to "ct helper" for consistency. Note that this is not used in regular nft output since objref_stmt_print() treats this object type separately. Signed-off-by: Phil Sutter --- src/parser_json.c | 2 +- src/statement.c| 2

[nft PATCH 02/14] JSON: Use "type" for CT helper object

2018-05-28 Thread Phil Sutter
Property name "helper" was a bit unclear, "type" is better. Signed-off-by: Phil Sutter --- src/json.c| 2 +- src/parser_json.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/json.c b/src/json.c index e458eb3e4bdd8..1b73b919d5df2 100644 --- a/src/json.c +++ b

[nft PATCH 03/14] JSON: Disallow non-array concat expression values

2018-05-28 Thread Phil Sutter
Concat expressions with just a single element don't make sense, so there's no point in supporting a shorter syntax for this. Signed-off-by: Phil Sutter --- src/parser_json.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/parser_json.c b/src/parser_json.c index 993368f

[nft PATCH 08/14] JSON: Simplify tcp option expression parsing a bit

2018-05-28 Thread Phil Sutter
When parsing the optional "field" property, use return code of json_unpack() directly to check if it was present or not. Signed-off-by: Phil Sutter --- src/parser_json.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/parser_json.c b/src/parser_json.c index f3d2c0f1d

[nft PATCH 14/14] meter: Don't print default size value

2018-05-28 Thread Phil Sutter
A meter size of 0x is the default, so regardless of whether it was explicitly specified by user or not, don't print it. This is in line with nft's tendency of shortening rules down to the minimal required form. While being at it, clean things up a bit: - Introduce a macro to hold the default s

[nft PATCH 00/14] JSON: Some minor schema changes

2018-05-28 Thread Phil Sutter
While writing JSON schema documentation, a number of ugly/broken bits were identified which this series addresses in patches 1-7. Patches 8-11 contain some fixes and improvements to parser_json.c which don't change the schema. Patches 12 and 13 contain fixes for JSON part of tests/py, identified

[nft PATCH 11/14] JSON: Simplify immediate value parsing

2018-05-28 Thread Phil Sutter
Since an explicit "immediate" expression doesn't exist in JSON (the values are represented as plain JSON string/integer/boolean types), there is no need for json_parse_immediate_expr() to comply to the common expression parser parameter format. Apart from that: * Drop CTX_F_RHS checks - caller as

[nft PATCH 07/14] JSON: Fix parsing and printing of limit objects

2018-05-28 Thread Phil Sutter
Fix parsing and printing of named limit objects by aligning the code with parser/printer of anonymous ones. Signed-off-by: Phil Sutter --- src/json.c| 43 - src/parser_json.c | 49 ++- 2 files changed, 48

[nft PATCH 04/14] JSON: Sort out rule position and handles in general

2018-05-28 Thread Phil Sutter
First of all, don't print the position property when listing rules. This was there only because libnftnl JSON output has it too, but since the preferred way to *add* a rule at some location is via 'handle' keyword, keeping "position" in output would be non-intuitive. Changing "position" property na

  1   2   >