[PATCH RFC tip/core/rcu 14/15] netfilter: Remove now-redundant smp_read_barrier_depends()

2017-10-09 Thread Paul E. McKenney
READ_ONCE() now implies smp_read_barrier_depends(), which means that the instances in arpt_do_table(), ipt_do_table(), and ip6t_do_table() are now redundant. This commit removes them and adjusts the comments. Signed-off-by: Paul E. McKenney Cc: Pablo Neira Ayuso Cc: Jozsef Kadlecsik Cc: Floria

Re: [PATCH] doc: nft.8 Document rule replace

2017-10-09 Thread Pablo Neira Ayuso
On Tue, Oct 10, 2017 at 01:58:41AM +1100, Duncan Roe wrote: > Insert synopsis and description between those for add|insert and delete 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

Re: [PATCH 00/12] Netfilter/IPVS fixes for net

2017-10-09 Thread David Miller
From: Pablo Neira Ayuso Date: Mon, 9 Oct 2017 18:25:34 +0200 > The following patchset contains Netfilter/IPVS fixes for your net tree, > they are: ... > You can pull these changes from: > > git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf.git Pulled, thanks! -- To unsubscribe from thi

[PATCH 00/12] Netfilter/IPVS fixes for net

2017-10-09 Thread Pablo Neira Ayuso
Hi David, The following patchset contains Netfilter/IPVS fixes for your net tree, they are: 1) Fix packet drops due to incorrect ECN handling in IPVS, from Vadim Fedorenko. 2) Fix splat with mark restoration in xt_socket with non-full-sock, patch from Subash Abhinov Kasiviswanathan. 3) ip

[PATCH 01/12] netfilter: ipvs: full-functionality option for ECN encapsulation in tunnel

2017-10-09 Thread Pablo Neira Ayuso
From: Vadim Fedorenko IPVS tunnel mode works as simple tunnel (see RFC 3168) copying ECN field to outer header. That's result in packet drops on egress tunnels in case the egress tunnel operates as ECN-capable with Full-functionality option (like ip_tunnel and ip6_tunnel kernel modules), accordin

[PATCH 04/12] netfilter: ipset: pernet ops must be unregistered last

2017-10-09 Thread Pablo Neira Ayuso
From: Florian Westphal Removing the ipset module leaves a small window where one cpu performs module removal while another runs a command like 'ipset flush'. ipset uses net_generic(), unregistering the pernet ops frees this storage area. Fix it by first removing the user-visible api handlers an

[PATCH 03/12] netfilter: ipset: Fix adding an IPv4 range containing more than 2^31 addresses

2017-10-09 Thread Pablo Neira Ayuso
From: Jozsef Kadlecsik Wrong comparison prevented the hash types to add a range with more than 2^31 addresses but reported as a success. Fixes Netfilter's bugzilla id #1005, reported by Oleg Serditov and Oliver Ford. Signed-off-by: Jozsef Kadlecsik Signed-off-by: Pablo Neira Ayuso --- net/ne

[PATCH 07/12] netfilter: ebtables: fix race condition in frame_filter_net_init()

2017-10-09 Thread Pablo Neira Ayuso
From: Artem Savkov It is possible for ebt_in_hook to be triggered before ebt_table is assigned resulting in a NULL-pointer dereference. Make sure hooks are registered as the last step. Fixes: aee12a0a3727 ("ebtables: remove nf_hook_register usage") Signed-off-by: Artem Savkov Signed-off-by: Pab

[PATCH 05/12] netfilter: ipset: Fix race between dump and swap

2017-10-09 Thread Pablo Neira Ayuso
From: Ross Lagerwall Fix a race between ip_set_dump_start() and ip_set_swap(). The race is as follows: * Without holding the ref lock, ip_set_swap() checks ref_netlink of the set and it is 0. * ip_set_dump_start() takes a reference on the set. * ip_set_swap() does the swap (even though it now h

[PATCH 06/12] netfilter: nf_tables: fix update chain error

2017-10-09 Thread Pablo Neira Ayuso
From: JingPiao Chen # nft add table filter # nft add chain filter c1 # nft rename chain filter c1 c2 Error: Could not process rule: No such file or directory rename chain filter c1 c2 ^^ # nft add chain filter c2 # nft rename chain filter c1 c2 # nft list table fil

[PATCH 09/12] netfilter: nf_tables: do not dump chain counters if not enabled

2017-10-09 Thread Pablo Neira Ayuso
Chain counters are only enabled on demand since 9f08ea848117, skip them when dumping them via netlink. Fixes: 9f08ea848117 ("netfilter: nf_tables: keep chain counters away from hot path") Reported-by: Johny Mattsson Tested-by: Johny Mattsson Signed-off-by: Pablo Neira Ayuso --- net/netfilter/

[PATCH 08/12] netfilter: nf_tables: Release memory obtained by kasprintf

2017-10-09 Thread Pablo Neira Ayuso
From: Arvind Yadav Free memory region, if nf_tables_set_alloc_name is not successful. Fixes: 387454901bd6 ("netfilter: nf_tables: Allow set names of up to 255 chars") Signed-off-by: Arvind Yadav Signed-off-by: Pablo Neira Ayuso --- net/netfilter/nf_tables_api.c | 4 +++- 1 file changed, 3 ins

[PATCH 10/12] netfilter: x_tables: avoid stack-out-of-bounds read in xt_copy_counters_from_user

2017-10-09 Thread Pablo Neira Ayuso
From: Eric Dumazet syzkaller reports an out of bound read in strlcpy(), triggered by xt_copy_counters_from_user() Fix this by using memcpy(), then forcing a zero byte at the last position of the destination, as Florian did for the non COMPAT code. Fixes: d7591f0c41ce ("netfilter: x_tables: intr

[PATCH 11/12] netfilter: SYNPROXY: skip non-tcp packet in {ipv4, ipv6}_synproxy_hook

2017-10-09 Thread Pablo Neira Ayuso
From: Lin Zhang In function {ipv4,ipv6}_synproxy_hook we expect a normal tcp packet, but the real server maybe reply an icmp error packet related to the exist tcp conntrack, so we will access wrong tcp data. Fix it by checking for the protocol field and only process tcp traffic. Signed-off-by:

[PATCH 12/12] netfilter: xt_bpf: Fix XT_BPF_MODE_FD_PINNED mode of 'xt_bpf_info_v1'

2017-10-09 Thread Pablo Neira Ayuso
From: Shmulik Ladkani Commit 2c16d6033264 ("netfilter: xt_bpf: support ebpf") introduced support for attaching an eBPF object by an fd, with the 'bpf_mt_check_v1' ABI expecting the '.fd' to be specified upon each IPT_SO_SET_REPLACE call. However this breaks subsequent iptables calls: # iptable

[PATCH 02/12] netfilter: xt_socket: Restore mark from full sockets only

2017-10-09 Thread Pablo Neira Ayuso
From: Subash Abhinov Kasiviswanathan An out of bounds error was detected on an ARM64 target with Android based kernel 4.9. This occurs while trying to restore mark on a skb from an inet request socket. BUG: KASAN: slab-out-of-bounds in socket_match.isra.2+0xc8/0x1f0 net/netfilter/xt_socket.c:24

[PATCH] doc: nft.8 Document rule replace

2017-10-09 Thread Duncan Roe
Insert synopsis and description between those for add|insert and delete Signed-off-by: Duncan Roe --- doc/nft.xml | 17 + 1 file changed, 17 insertions(+) diff --git a/doc/nft.xml b/doc/nft.xml index 80ffcd7..c7e12c9 100644 --- a/doc/nft.xml +++ b/doc/nft.xml @@ -839,6 +839,15 @

[iptables PATCH] extensions: libxt_tcpmss: Detect invalid ranges

2017-10-09 Thread Phil Sutter
Previously, an MSS range of e.g. 65535:1000 was silently accepted but would then never match a packet since the kernel checks whether the MSS value is greater than or equal to the first *and* less than or equal to the second value. Detect this as a parameter problem and update the man page accordi

Re: [PATCH v2] netfilter: xt_bpf: Fix XT_BPF_MODE_FD_PINNED mode of 'xt_bpf_info_v1'

2017-10-09 Thread Pablo Neira Ayuso
On Mon, Oct 09, 2017 at 02:35:46PM +0200, Daniel Borkmann wrote: > On 10/09/2017 02:27 PM, Shmulik Ladkani wrote: > >From: Shmulik Ladkani > > > >Commit 2c16d6033264 ("netfilter: xt_bpf: support ebpf") introduced > >support for attaching an eBPF object by an fd, with the > >'bpf_mt_check_v1' ABI e

Re: [PATCH v2] nftables: make pointers in string arrays constant

2017-10-09 Thread Pablo Neira Ayuso
On Fri, Oct 06, 2017 at 08:17:54PM +0530, Harsha Sharma wrote: > Static const char * array should be static const char * > const array as per linux-kernel coding style Applied. -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majord...@vger.

Re: [PATCH] test: shell: update shell/run-tests.sh to refer to relative path of testcase

2017-10-09 Thread Pablo Neira Ayuso
On Sat, Oct 07, 2017 at 04:17:52AM +0530, Harsha Sharma wrote: > Refer to relative path for tests from any directory if path for testcases > is specified. Applied, thanks. -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majord...@vger.kerne

Re: [PATCH] src: Merge assignment with return

2017-10-09 Thread Pablo Neira Ayuso
Hi Harsha, On Sat, Oct 07, 2017 at 04:00:33AM +0530, Harsha Sharma wrote: > Merge assignment with return statement to directly return the value. > Done using following coccinelle semantic patch > > @@ > local idexpression ret; > expression e; > @@ > > -ret = > +return > e; > -return ret; >

Re: [PATCH v2] netfilter: xt_bpf: Fix XT_BPF_MODE_FD_PINNED mode of 'xt_bpf_info_v1'

2017-10-09 Thread Daniel Borkmann
On 10/09/2017 02:27 PM, Shmulik Ladkani wrote: From: Shmulik Ladkani Commit 2c16d6033264 ("netfilter: xt_bpf: support ebpf") introduced support for attaching an eBPF object by an fd, with the 'bpf_mt_check_v1' ABI expecting the '.fd' to be specified upon each IPT_SO_SET_REPLACE call. However t

Re: [PATCH] tests: shell: add testcases for named objects

2017-10-09 Thread Harsha Sharma
On Mon, Oct 9, 2017 at 5:32 PM, Pablo Neira Ayuso 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 >> wrote: >> > On Thu, Oct 05, 2017 at 03:45:39PM +0530, Harsha Sharma wrote: >> >> Add testcases for creating named obje

[PATCH v2] netfilter: xt_bpf: Fix XT_BPF_MODE_FD_PINNED mode of 'xt_bpf_info_v1'

2017-10-09 Thread Shmulik Ladkani
From: Shmulik Ladkani Commit 2c16d6033264 ("netfilter: xt_bpf: support ebpf") introduced support for attaching an eBPF object by an fd, with the 'bpf_mt_check_v1' ABI expecting the '.fd' to be specified upon each IPT_SO_SET_REPLACE call. However this breaks subsequent iptables calls: # iptable

Re: [PATCH] tests: shell: add testcases for named objects

2017-10-09 Thread Pablo Neira Ayuso
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 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 fro

Re: [PATCH] netfilter: xt_bpf: Fix XT_BPF_MODE_FD_PINNED mode of 'xt_bpf_info_v1'

2017-10-09 Thread Daniel Borkmann
Hi Shmulik, On 10/09/2017 01:57 PM, Pablo Neira Ayuso wrote: On Mon, Oct 09, 2017 at 01:18:23PM +0200, Pablo Neira Ayuso wrote: On Fri, Oct 06, 2017 at 01:40:13PM -0400, Willem de Bruijn wrote: On Fri, Oct 6, 2017 at 12:02 PM, Shmulik Ladkani wrote: From: Shmulik Ladkani Commit 2c16d603326

Re: [PATCH nft] parser_bison: allow to used named limit from dictionaries too

2017-10-09 Thread Pablo Neira Ayuso
On Mon, Oct 09, 2017 at 01:48:11PM +0200, Pablo Neira Ayuso wrote: > Allow to use limit objects from dictionaries. Please, ignore this. My robot accidentally included this, this is already upstream for a while. -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the bo

Re: [PATCH] netfilter: xt_bpf: Fix XT_BPF_MODE_FD_PINNED mode of 'xt_bpf_info_v1'

2017-10-09 Thread Pablo Neira Ayuso
On Mon, Oct 09, 2017 at 01:18:23PM +0200, Pablo Neira Ayuso wrote: > On Fri, Oct 06, 2017 at 01:40:13PM -0400, Willem de Bruijn wrote: > > On Fri, Oct 6, 2017 at 12:02 PM, Shmulik Ladkani wrote: > > > From: Shmulik Ladkani > > > > > > Commit 2c16d6033264 ("netfilter: xt_bpf: support ebpf") introd

[PATCH nft] scanner: IPv4-Mapped IPv6 addresses support

2017-10-09 Thread Pablo Neira Ayuso
The scanner rejects IPv4-Mapped IPv6 addresses, eg. # cat test #!/usr/sbin/nft -f flush ruleset table inet global { set blackhole_ipv6 { type ipv6_addr flags interval elements = { :::0.0.0.0/96 } } } # nft -f test test:8:30-38: Error: syntax error, unexp

[PATCH nft] parser_bison: allow to used named limit from dictionaries too

2017-10-09 Thread Pablo Neira Ayuso
Allow to use limit objects from dictionaries. Fixes: c0697eabe832 ("src: add stateful object support for limit") Signed-off-by: Pablo Neira Ayuso --- src/parser_bison.y | 9 + 1 file changed, 9 insertions(+) diff --git a/src/parser_bison.y b/src/parser_bison.y index f996d9d94880..7016f5

Re: [PATCH] netfilter: xt_bpf: Fix XT_BPF_MODE_FD_PINNED mode of 'xt_bpf_info_v1'

2017-10-09 Thread Pablo Neira Ayuso
On Fri, Oct 06, 2017 at 01:40:13PM -0400, Willem de Bruijn wrote: > On Fri, Oct 6, 2017 at 12:02 PM, Shmulik Ladkani wrote: > > From: Shmulik Ladkani > > > > Commit 2c16d6033264 ("netfilter: xt_bpf: support ebpf") introduced > > support for attaching an eBPF object by an fd, with the > > 'bpf_mt_

Re: [PATCH v3] netfilter: SYNPROXY: fix process non tcp packet bug in {ipv4,ipv6}_synproxy_hook

2017-10-09 Thread Pablo Neira Ayuso
On Fri, Oct 06, 2017 at 12:44:03AM +0800, Lin Zhang wrote: > In function {ipv4,ipv6}_synproxy_hook we expect a normal tcp packet, > but the real server maybe reply an icmp error packet related to the > exist tcp conntrack, so we will access wrong tcp data. > > For fix it, check for the protocol fi

Re: [PATCH 41/47] netfilter: convert hook list to an array

2017-10-09 Thread Tariq Toukan
On 09/10/2017 12:31 PM, Florian Westphal wrote: Tariq Toukan wrote: On 04/09/2017 1:42 AM, Pablo Neira Ayuso wrote: From: Aaron Conole This converts the storage and layout of netfilter hook entries from a linked list to an array. After this commit, hook entries will be stored adjacent in

Re: [PATCH 41/47] netfilter: convert hook list to an array

2017-10-09 Thread Florian Westphal
Tariq Toukan wrote: > On 04/09/2017 1:42 AM, Pablo Neira Ayuso wrote: > >From: Aaron Conole > > > >This converts the storage and layout of netfilter hook entries from a > >linked list to an array. After this commit, hook entries will be > >stored adjacent in memory. The next pointer is no longe