Re: [PATCH nft] tests: shell: Add test for IPv4 Mapped IPv6 address.

2017-11-22 Thread Varsha Rao
On Mon, Nov 20, 2017 at 6:58 PM, Pablo Neira Ayuso wrote: > On Sun, Nov 19, 2017 at 06:04:32PM +0530, Varsha Rao wrote: >> This patch adds test case for IPv4 Mapped IPv6 address and renames >> file 0025named_limit_0 to 0026named_limit_0. > > Applied, thanks Varsha. > > Please, next time, send one

Re: [PATCH nft 2/2] gmputil: turn mpz_printf into mpz_vfprintf to restore --with-mini-gmp

2017-11-22 Thread Pablo Neira Ayuso
On Wed, Nov 22, 2017 at 08:36:16PM +0100, Pablo Neira Ayuso wrote: > 2535ba7006f2 ("src: get rid of printf") uses gmp_vfprintf() which > doesn't exists in mini-gmp.c, this breaks compilation with --mini-gmp. > > This patch implements poor man's gmp_vfprintf that takes one single > argument which i

[PATCH nft 1/2] utils: fix one compilation error with --with-mini-gmp

2017-11-22 Thread Pablo Neira Ayuso
Restore some code that is needed, until we have a version of gmp_printf that takes variable arguments. In file included from ../include/utils.h:12:0, from ../include/nftables.h:6, from ../include/rule.h:5, from segtree.c:15: segtree.c: In function

[PATCH nft 2/2] gmputil: turn mpz_printf into mpz_vfprintf to restore --with-mini-gmp

2017-11-22 Thread Pablo Neira Ayuso
2535ba7006f2 ("src: get rid of printf") uses gmp_vfprintf() which doesn't exists in mini-gmp.c, this breaks compilation with --mini-gmp. This patch implements poor man's gmp_vfprintf that takes one single argument which is what we need. Signed-off-by: Pablo Neira Ayuso --- @Phil: We're still hit

Re: [nft PATCH] libnftables: Fix for multiple context instances

2017-11-22 Thread Pablo Neira Ayuso
Hi Phil, On Wed, Nov 22, 2017 at 06:49:43PM +0100, Phil Sutter wrote: > On Mon, Nov 20, 2017 at 05:53:13PM +0100, Pablo Neira Ayuso wrote: > > On Mon, Nov 20, 2017 at 04:58:22PM +0100, Phil Sutter wrote: > > > On Mon, Nov 20, 2017 at 02:07:32PM +0100, Pablo Neira Ayuso wrote: > > > > On Mon, Nov 2

Re: [PATCH nf-next] netfilter: ipvs: Remove useless ipvsh param of frag_safe_skb_hp

2017-11-22 Thread Simon Horman
On Mon, Nov 13, 2017 at 10:58:18PM +0800, gfree.w...@vip.163.com wrote: > From: Gao Feng > > The param of frag_safe_skb_hp, ipvsh, isn't used now. So remove it and > update the callers' codes too. > > Signed-off-by: Gao Feng > --- > Simon advise me send the patch to netfilter group Acked-by:

Re: [nft PATCH] libnftables: Fix for multiple context instances

2017-11-22 Thread Phil Sutter
On Mon, Nov 20, 2017 at 05:53:13PM +0100, Pablo Neira Ayuso wrote: > On Mon, Nov 20, 2017 at 04:58:22PM +0100, Phil Sutter wrote: > > On Mon, Nov 20, 2017 at 02:07:32PM +0100, Pablo Neira Ayuso wrote: > > > On Mon, Nov 20, 2017 at 01:54:18PM +0100, Phil Sutter wrote: > > > > On Mon, Nov 20, 2017 at

Re: [RFC PATCH] netfilter: call synchronize_net only once from nf_register_net_hooks

2017-11-22 Thread Florian Westphal
Giuseppe Scrivano wrote: > > However, I suggest you try to go with call_rcu to get rid of all of the > > synchronize_net() calls. I don't even see why its still needed for > > nfqueue case provided we invoke the nfqueue drop handler first. > > > > PoC example, untested: > > thanks, the patch seem

Re: [RFC PATCH] netfilter: call synchronize_net only once from nf_register_net_hooks

2017-11-22 Thread Giuseppe Scrivano
Florian Westphal writes: > However, I suggest you try to go with call_rcu to get rid of all of the > synchronize_net() calls. I don't even see why its still needed for > nfqueue case provided we invoke the nfqueue drop handler first. > > PoC example, untested: thanks, the patch seems to work for

[PATCH nf-next 1/2] netfilter: nf_tables_arp: don't set forward chain

2017-11-22 Thread Pablo Neira Ayuso
46928a0b49f3 ("netfilter: nf_tables: remove multihook chains and families") already removed this, this is a leftover. Signed-off-by: Pablo Neira Ayuso --- net/ipv4/netfilter/nf_tables_arp.c | 1 - 1 file changed, 1 deletion(-) diff --git a/net/ipv4/netfilter/nf_tables_arp.c b/net/ipv4/netfilte

[PATCH nf-next] netfilter: nf_tables: explicit nft_set_pktinfo() call from hook path

2017-11-22 Thread Pablo Neira Ayuso
Instead of calling this function from the family specific variant, this reduces the code size in the fast path for the netdev, bridge and inet families. After this change, we must call nft_set_pktinfo() unfront from the chain hook indirection. Before: textdata bss dec hex filen

[PATCH nf-next 2/2] netfilter: nf_tables: remove hooks from family definition

2017-11-22 Thread Pablo Neira Ayuso
They don't belong to the family definition, move them to the filter chain type definition instead. Signed-off-by: Pablo Neira Ayuso --- include/net/netfilter/nf_tables.h | 2 +- net/bridge/netfilter/nf_tables_bridge.c | 14 +++--- net/ipv4/netfilter/nf_tables_arp.c | 8 -

[PATCH nf-next 4/5] netfilter: nf_tables_inet: don't use multihook infrastructure anymore

2017-11-22 Thread Pablo Neira Ayuso
Use new native NFPROTO_INET support in netfilter core, this gets rid of ad-hoc code in the nf_tables API codebase. Signed-off-by: Pablo Neira Ayuso --- include/net/netfilter/nf_tables_ipv4.h | 2 -- include/net/netfilter/nf_tables_ipv6.h | 2 -- net/ipv4/netfilter/nf_tables_ipv4.c| 3 +-

[PATCH nf-next 2/5] netfilter: pass hook number and family as parameter to nf_find_hook_list()

2017-11-22 Thread Pablo Neira Ayuso
Just a preparation change, this is needed by follow up patches to handle NFPROTO_INET as a real family from the core. Signed-off-by: Pablo Neira Ayuso --- net/netfilter/core.c | 32 ++-- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/net/netfilter/cor

[PATCH nf-next 3/5] netfilter: handle NFPROTO_INET family hook registration from core

2017-11-22 Thread Pablo Neira Ayuso
Expand NFPROTO_INET in two hook registrations, one for NFPROTO_IPV4 and another for NFPROTO_IPV6. Hence, we handle NFPROTO_INET as a real family from the core. Signed-off-by: Pablo Neira Ayuso --- net/netfilter/core.c | 61 +--- 1 file changed, 53

[PATCH nf-next 0/5] promote NFPROTO_INET as real family

2017-11-22 Thread Pablo Neira Ayuso
Hi, This is a patchset to handle NFPROTO_INET hook registration from the Netfilter core, as we discussed during the NFWS in Faro, Portugal [1]. >From the hook path, your code just needs to check for state->pf to know if this either IPv4 or IPv6 traffic, alternatively skb->protocol could be used fo

[PATCH nf-next 5/5] netfilter: nf_tables: remove multihook chains and families

2017-11-22 Thread Pablo Neira Ayuso
Since NFPROTO_INET is handled from the core, we don't need to maintain extra infrastructure in nf_tables to handle the double hook registration, one for IPv4 and another for IPv6. Signed-off-by: Pablo Neira Ayuso --- include/net/netfilter/nf_tables.h | 9 +-- net/bridge/netfilter/nf_table

[PATCH nf-next 1/5] netfilter: add nf_remove_net_hook

2017-11-22 Thread Pablo Neira Ayuso
Just a cleanup, __nf_unregister_net_hook() is used by a follow up patch when handling NFPROTO_INET as a real family from the core. Signed-off-by: Pablo Neira Ayuso --- net/netfilter/core.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/net/netfilter/core.c b/net/n

Re: [PATCH nf-next 2/4] netfilter: add BUILD_BUG_ON asserts for hook array sizes

2017-11-22 Thread Pablo Neira Ayuso
On Wed, Nov 22, 2017 at 01:44:10PM +0100, Florian Westphal wrote: > Pablo Neira Ayuso wrote: > > Hi Florian, > > > > On Mon, Nov 13, 2017 at 05:41:05PM +0100, Florian Westphal wrote: > > > Check that the array hooks are not accessed out-of-bounds. > > > Next patch will then reduce their sizes to

Re: [PATCH nf-next 2/4] netfilter: add BUILD_BUG_ON asserts for hook array sizes

2017-11-22 Thread Florian Westphal
Pablo Neira Ayuso wrote: > Hi Florian, > > On Mon, Nov 13, 2017 at 05:41:05PM +0100, Florian Westphal wrote: > > Check that the array hooks are not accessed out-of-bounds. > > Next patch will then reduce their sizes to reflect the number > > of hooks implemented for each family. > > I'm hitting

Re: [PATCH nf-next 2/4] netfilter: add BUILD_BUG_ON asserts for hook array sizes

2017-11-22 Thread Pablo Neira Ayuso
Hi Florian, On Mon, Nov 13, 2017 at 05:41:05PM +0100, Florian Westphal wrote: > Check that the array hooks are not accessed out-of-bounds. > Next patch will then reduce their sizes to reflect the number > of hooks implemented for each family. I'm hitting this here. In file included from ./includ

Re: [nft PATCH] libnftables: Ensure output_fp is never NULL

2017-11-22 Thread Pablo Neira Ayuso
On Mon, Nov 20, 2017 at 04:54:04PM +0100, Phil Sutter wrote: > Initialize output_fp to 'stdout' upon context creation and check output > stream validity in nft_ctx_set_output(). This allows to drop checks in > nft_{gmp_,}print() and do_command_export(). While doing so for the > latter, simplify it

Re: [nft PATCH] tests: shell: Prevent lockout in nft-f/0008split_tables_0

2017-11-22 Thread Pablo Neira Ayuso
On Tue, Nov 21, 2017 at 11:13:39PM +0100, Phil Sutter wrote: > Since packets traverse both tables, the accept rule in the first one is > ineffective due to the second table's drop policy. To prevent lockouts > when running the testsuite via SSH connection, set the second chain's > policy to accept

Re: [RFC PATCH] netfilter: call synchronize_net only once from nf_register_net_hooks

2017-11-22 Thread Florian Westphal
Giuseppe Scrivano wrote: > Florian Westphal writes: > > > Giuseppe Scrivano wrote: > >> SELinux, if enabled, registers for each new network namespace 6 > >> netfilter hooks. Avoid to use synchronize_net for each new hook, but do > >> it once after all the hooks are added. The net benefit on a

Re: [RFC PATCH] netfilter: call synchronize_net only once from nf_register_net_hooks

2017-11-22 Thread Giuseppe Scrivano
Florian Westphal writes: > Giuseppe Scrivano wrote: >> SELinux, if enabled, registers for each new network namespace 6 >> netfilter hooks. Avoid to use synchronize_net for each new hook, but do >> it once after all the hooks are added. The net benefit on an SMP >> machine with two cores is tha

Re: [RFC PATCH] netfilter: call synchronize_net only once from nf_register_net_hooks

2017-11-22 Thread Florian Westphal
Florian Westphal wrote: > Giuseppe Scrivano wrote: > > SELinux, if enabled, registers for each new network namespace 6 > > netfilter hooks. Avoid to use synchronize_net for each new hook, but do > > it once after all the hooks are added. The net benefit on an SMP > > machine with two cores is t

Re: [RFC PATCH] netfilter: call synchronize_net only once from nf_register_net_hooks

2017-11-22 Thread Florian Westphal
Giuseppe Scrivano wrote: > SELinux, if enabled, registers for each new network namespace 6 > netfilter hooks. Avoid to use synchronize_net for each new hook, but do > it once after all the hooks are added. The net benefit on an SMP > machine with two cores is that creating a new network namespac

Re: [RFC PATCH] netfilter: call synchronize_net only once from nf_register_net_hooks

2017-11-22 Thread Florian Westphal
Giuseppe Scrivano wrote: > SELinux, if enabled, registers for each new network namespace 6 > netfilter hooks. Avoid to use synchronize_net for each new hook, but do > it once after all the hooks are added. The net benefit on an SMP > machine with two cores is that creating a new network namespac

[RFC PATCH] netfilter: call synchronize_net only once from nf_register_net_hooks

2017-11-22 Thread Giuseppe Scrivano
SELinux, if enabled, registers for each new network namespace 6 netfilter hooks. Avoid to use synchronize_net for each new hook, but do it once after all the hooks are added. The net benefit on an SMP machine with two cores is that creating a new network namespace takes -40% of the original time.