[PATCH 1/5] netfilter: ipset: list:set: Decrease refcount synchronously on deletion and replace

2018-10-27 Thread Jozsef Kadlecsik
ported-by: Li Shuang Fixes: 45040978c899 ("netfilter: ipset: Fix set:list type crash when flush/dump set in parallel") Signed-off-by: Stefano Brivio Signed-off-by: Jozsef Kadlecsik --- include/linux/netfilter/ipset/ip_set.h | 2 +- net/netfilter/ipset/ip_set_core.c | 23

[PATCH 4/5] netfilter: ipset: Correct rcu_dereference() call in ip_set_put_comment()

2018-10-27 Thread Jozsef Kadlecsik
The function is called when rcu_read_lock() is held and not when rcu_read_lock_bh() is held. Signed-off-by: Jozsef Kadlecsik --- include/linux/netfilter/ipset/ip_set_comment.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/netfilter/ipset/ip_set_comment.h

[PATCH 5/5] netfilter: ipset: Fix calling ip_set() macro at dumping

2018-10-27 Thread Jozsef Kadlecsik
The ip_set() macro is called when either ip_set_ref_lock held only or no lock/nfnl mutex is held at dumping. Take this into account properly. Signed-off-by: Jozsef Kadlecsik --- net/netfilter/ipset/ip_set_core.c | 23 +++ 1 file changed, 19 insertions(+), 4 deletions

[PATCH 0/5] ipset patches for nf

2018-10-27 Thread Jozsef Kadlecsik
allow allowable CIDR 0 in hash:net,port,net Jozsef Kadlecsik (2): netfilter: ipset: Correct rcu_dereference() call in ip_set_put_comment() netfilter: ipset: Fix calling ip_set() macro at dumping Stefano Brivio (1): netfilter: ipset: list:set: Decrease refcount synchronously on del

[PATCH 2/5] netfilter: ipset: actually allow allowable CIDR 0 in hash:net,port,net

2018-10-27 Thread Jozsef Kadlecsik
1f003ff1a7580d6c1d9c Signed-off-by: Eric Westbrook Signed-off-by: Jozsef Kadlecsik --- net/netfilter/ipset/ip_set_hash_netportnet.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/net/netfilter/ipset/ip_set_hash_netportnet.c b/net/netfilter/ipset/ip_set_hash_netpor

[PATCH 1/3] netfilter: ipset: Allow matching on destination MAC address for mac and ipmac sets

2018-10-27 Thread Jozsef Kadlecsik
ip netns exec A iptables -I INPUT -m set --match-set test dst -j ACCEPT ipset will match packets based on destination MAC address: # ping -c1 192.0.2.2 >/dev/null # echo $? 0 Reported-by: Yi Chen Signed-off-by: Stefano Brivio Signed-off-by: Jozsef Kadlecsik --- net/netfilt

[PATCH 3/3] netfilter: ipset: Introduction of new commands and protocol version 7

2018-10-27 Thread Jozsef Kadlecsik
, userspace can exactly know which functionality is supported by the running kernel. Both the kernel and userspace is fully backward compatible. Signed-off-by: Jozsef Kadlecsik --- include/linux/netfilter/ipset/ip_set.h | 2 +- include/uapi/linux/netfilter/ipset/ip_set.h | 19 ++-- net

[PATCH 0/3] ipset patches for nf-next

2018-10-27 Thread Jozsef Kadlecsik
kfki.hu/nf-next 23c42a403a9cfdbad6 for you to fetch changes up to 23c42a403a9cfdbad6004a556c927be7dd61a8ee: netfilter: ipset: Introduction of new commands and protocol version 7 (2018-10-27 15:49:09 +0200) -------- Jozsef Ka

[PATCH 2/3] netfilter: ipset: Make invalid MAC address checks consistent

2018-10-27 Thread Jozsef Kadlecsik
sets in commit 26c97c5d8dac ("netfilter: ipset: Use is_zero_ether_addr instead of static and memcmp"). Signed-off-by: Stefano Brivio Signed-off-by: Jozsef Kadlecsik --- net/netfilter/ipset/ip_set_bitmap_ipmac.c | 3 +++ net/netfilter/ipset/ip_set_hash_ipmac.c | 11 --- 2 fil

[ANNOUNCE] ipset 7.0 released

2018-10-27 Thread Jozsef Kadlecsik
Hi, I'm happy to announce ipset 7.0 which - besides of a couple fixes and corrections - brings a new internal protocol version between the kernel and userspace. The system is fully backward compatible: - the new kernel modules work fine with any older ipset userspace binary, - the new ipset bin

Re: [PATCH 5/5] netfilter: ipset: Fix calling ip_set() macro at dumping

2018-10-30 Thread Jozsef Kadlecsik
Hi Pablo, On Mon, 29 Oct 2018, Pablo Neira Ayuso wrote: > On Sat, Oct 27, 2018 at 06:05:43PM +0200, Jozsef Kadlecsik wrote: > > The ip_set() macro is called when either ip_set_ref_lock held only > > or no lock/nfnl mutex is held at dumping. Take this into account > > prop

[PATCH v2] netfilter: ipset: Fix calling ip_set() macro at dumping

2018-10-30 Thread Jozsef Kadlecsik
The ip_set() macro is called when either ip_set_ref_lock held only or no lock/nfnl mutex is held at dumping. Take this into account properly. Also, use Pablo's suggestion to use rcu_dereference_raw(), the ref_netlink protects the set. Signed-off-by: Jozsef Kadlecsik --- net/netfilter/

Re: [PATCH] netfilter: ipset: replace a strncpy() with strscpy()

2018-11-26 Thread Jozsef Kadlecsik
Hi, On Wed, 21 Nov 2018, Qian Cai wrote: > To make overflows as obvious as possible and to prevent code from blithely > proceeding with a truncated string. This also has a side-effect to fix a > compilation warning using GCC 8.2.1. > > net/netfilter/ipset/ip_set_core.c: In function 'ip_set_sockf

Re: [PATCH v2] netfilter: ipset: replace a strncpy() with strscpy()

2018-12-01 Thread Jozsef Kadlecsik
Hi, On Mon, 26 Nov 2018, Qian Cai wrote: > To make overflows as obvious as possible and to prevent code from blithely > proceeding with a truncated string. This also has a side-effect to fix a > compilation warning when using GCC 8.2.1. > > net/netfilter/ipset/ip_set_core.c: In function 'ip_set_

Re: [PATCH] netfilter: ipset: fix ip_set_byindex function

2018-12-01 Thread Jozsef Kadlecsik
On Tue, 27 Nov 2018, Florent Fourcot wrote: > New function added by "Introduction of new commands and protocol > version 7" is not working, since we return skb2 to user Oh my, I dunno, maybe copy&paste bug. Thanks, patch is applied. Best regards, Jozsef > Signed-off-by: Victorien Molle > Sign

Re: [PATCH v3] netfilter/ipset: replace a strncpy() with strscpy()

2018-12-04 Thread Jozsef Kadlecsik
Hi, On Sat, 1 Dec 2018, Qian Cai wrote: > To make overflows as obvious as possible and to prevent code from blithely > proceeding with a truncated string. This also has a side-effect to fix a > compilation warning when using GCC 8.2.1. > > net/netfilter/ipset/ip_set_core.c: In function 'ip_set_s

Re: [PATCH] netfilter: ipset: actually allow allowable CIDR 0 in hash:net,port,net

2018-08-30 Thread Jozsef Kadlecsik
On Tue, 28 Aug 2018, Eric Westbrook wrote: > Allow /0 as advertised for hash:net,port,net sets. > > For "hash:net,port,net", ipset(8) says that "either subnet > is permitted to be a /0 should you wish to match port > between all destinations." > > Make that statement true. > > Before: > >

Re: [PATCH 14/16] netfilter: Replace spin_is_locked() with lockdep

2018-10-03 Thread Jozsef Kadlecsik
; Cc: Pablo Neira Ayuso > Cc: Jozsef Kadlecsik > Cc: Florian Westphal > Cc: "David S. Miller" > Cc: > Cc: > Cc: > --- > net/netfilter/ipset/ip_set_hash_gen.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Acked-by: Jozsef Kadlecsi

Re: [PATCH] netfilter: ipset: do not call ipset_nest_end after nla_nest_cancel

2018-12-01 Thread Jozsef Kadlecsik
Hi, On Mon, 26 Nov 2018, Pan Bian wrote: > In the error handling block, nla_nest_cancel(skb, atd) is called to > cancel the nest operation. But then, ipset_nest_end(skb, atd) is > unexpected called to end the nest operation. This patch calls the > ipset_nest_end only on the branch that nla_nest_c

[PATCH 4/5] netfilter: ipset: do not call ipset_nest_end after nla_nest_cancel

2018-12-10 Thread Jozsef Kadlecsik
: 45040978c89("netfilter: ipset: Fix set:list type crash when flush/dump set in parallel") Signed-off-by: Pan Bian Signed-off-by: Jozsef Kadlecsik --- net/netfilter/ipset/ip_set_list_set.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/netfilter/ipset/ip_set_list_se

[PATCH 0/5] ipset patches for nf-next

2018-12-10 Thread Jozsef Kadlecsik
fd for you to fetch changes up to c8770d8908fd5a5abc5061f5c57d55593ba86d8b: netfilter: ipset: replace a strncpy() with strscpy() (2018-12-10 14:12:50 +0100) -------- Jozsef Kadlecsik (1): netfilter: ipset: Introduction of new c

[PATCH 3/5] netfilter: ipset: Introduction of new commands and protocol version 7

2018-12-10 Thread Jozsef Kadlecsik
: Jozsef Kadlecsik Signed-off-by: Victorien Molle Signed-off-by: Florent Fourcot Signed-off-by: Jozsef Kadlecsik --- include/linux/netfilter/ipset/ip_set.h | 2 +- include/uapi/linux/netfilter/ipset/ip_set.h | 19 ++-- net/netfilter/ipset/ip_set_core.c | 164

[PATCH 5/5] netfilter: ipset: replace a strncpy() with strscpy()

2018-12-10 Thread Jozsef Kadlecsik
lter/ipset/ip_set_core.c:2027:3: warning: 'strncpy' writing 32 bytes into a region of size 2 overflows the destination [-Wstringop-overflow=] Signed-off-by: Qian Cai Signed-off-by: Jozsef Kadlecsik --- net/netfilter/ipset/ip_set_core.c | 6 -- 1 file changed, 4 insertions(+), 2 deleti

[PATCH 2/5] netfilter: ipset: Make invalid MAC address checks consistent

2018-12-10 Thread Jozsef Kadlecsik
sets in commit 26c97c5d8dac ("netfilter: ipset: Use is_zero_ether_addr instead of static and memcmp"). Signed-off-by: Stefano Brivio Signed-off-by: Jozsef Kadlecsik --- net/netfilter/ipset/ip_set_bitmap_ipmac.c | 3 +++ net/netfilter/ipset/ip_set_hash_ipmac.c | 11 --- 2 fil

[PATCH 1/5] netfilter: ipset: Allow matching on destination MAC address for mac and ipmac sets

2018-12-10 Thread Jozsef Kadlecsik
ip netns exec A iptables -I INPUT -m set --match-set test dst -j ACCEPT ipset will match packets based on destination MAC address: # ping -c1 192.0.2.2 >/dev/null # echo $? 0 Reported-by: Yi Chen Signed-off-by: Stefano Brivio Signed-off-by: Jozsef Kadlecsik --- net/netfilt

[ANNOUNCE] ipset 7.1 released

2018-12-11 Thread Jozsef Kadlecsik
Hi, I'm happy to announce ipset 7.1. Besides the usual bugfixes there's a new feature: sorting is implemented for the hash types of the sets, which is useful for config management systems (ansible, chef, puppet, etc.). Userspace changes: - Add compatibility support for strscpy() - Correct t

Re: [PATCH 0/5] ipset patches for nf-next

2018-12-13 Thread Jozsef Kadlecsik
Hi Pablo, On Thu, 13 Dec 2018, Pablo Neira Ayuso wrote: > On Mon, Dec 10, 2018 at 02:39:33PM +0100, Jozsef Kadlecsik wrote: > > > > Please consider to pull the next patches for nf-next: > > > > - Replace a strncpy() with strscpy() from Qian Cai. > > - D

Re: [PATCH 0/5] RFC: Add new ip/net,port,ip/net,port sets

2018-12-18 Thread Jozsef Kadlecsik
Hi Oliver, On Sun, 16 Dec 2018, Oliver Smith wrote: > The proceeding patch-set adds three new sets for usage: > > * ip,port,ip,port > * ip,port,net,port > * net,port,net,port > > I would like to solicit some feedback as I am fairly certain that there > are bugs or possibly backwards-incompatib

Re: [PATCH 5/5] lib/ipset.c: Fix a compilation failure when using --enable-debug

2018-12-18 Thread Jozsef Kadlecsik
Hi, On Sun, 16 Dec 2018, Oliver Smith wrote: > When using GCC8.2, since --enable-debug treats warnings as errors, the > compiler detects that a switch/case is falling through. > > Since the fallthrough is intentional, we apply the attribute to indicate > to the compiler that this is correct beha

[PATCH 20/22] netfilter: ipset: use setup_timer() and mod_timer().

2016-10-17 Thread Jozsef Kadlecsik
be activated). Use setup_timer() and mod_timer() to setup and arm a timer, making the code compact and easier to read. Signed-off-by: Muhammad Falak R Wani Signed-off-by: Jozsef Kadlecsik --- net/netfilter/ipset/ip_set_hash_gen.h | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) d

[PATCH 06/22] netfilter: ipset: Separate memsize calculation code into dedicated function

2016-10-17 Thread Jozsef Kadlecsik
Hash types already has it's memsize calculation code in separate functions. Do the same for *bitmap* and *list* sets. Ported from a patch proposed by Sergey Popovich . Suggested-by: Sergey Popovich Signed-off-by: Jozsef Kadlecsik --- net/netfilter/ipset/ip_set_bitmap_gen.h

[PATCH 21/22] netfilter: ipset: use setup_timer() and mod_timer().

2016-10-17 Thread Jozsef Kadlecsik
be activated). Use setup_timer() and mod_timer() to setup and arm a timer, making the code compact and easier to read. Signed-off-by: Muhammad Falak R Wani Signed-off-by: Jozsef Kadlecsik --- net/netfilter/ipset/ip_set_list_set.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) d

[PATCH 05/22] netfilter: ipset: Split extensions into separate files

2016-10-17 Thread Jozsef Kadlecsik
Ported from a patch proposed by Sergey Popovich . Suggested-by: Sergey Popovich Signed-off-by: Jozsef Kadlecsik --- include/linux/netfilter/ipset/ip_set.h | 95 +- include/linux/netfilter/ipset/ip_set_counter.h | 75 include/linux/netfilter

[PATCH 13/22] netfilter: ipset: Make sure element data size is a multiple of u32

2016-10-17 Thread Jozsef Kadlecsik
Data for hashing required to be array of u32. Make sure that element data always multiple of u32. Ported from a patch proposed by Sergey Popovich . Signed-off-by: Jozsef Kadlecsik --- net/netfilter/ipset/ip_set_hash_gen.h | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff

[PATCH 14/22] netfilter: ipset: Optimize hash creation routine

2016-10-17 Thread Jozsef Kadlecsik
Exit as easly as possible on error and use RCU_INIT_POINTER() as set is not seen at creation time. Signed-off-by: Jozsef Kadlecsik --- net/netfilter/ipset/ip_set_hash_gen.h | 63 --- 1 file changed, 29 insertions(+), 34 deletions(-) diff --git a/net/netfilter

[PATCH 12/22] netfilter: ipset: Make NLEN compile time constant for hash types

2016-10-17 Thread Jozsef Kadlecsik
Hash types define HOST_MASK before inclusion of ip_set_hash_gen.h and the only place where NLEN needed to be calculated at runtime is *_create() method. Ported from a patch proposed by Sergey Popovich . Signed-off-by: Jozsef Kadlecsik --- net/netfilter/ipset/ip_set_hash_gen.h | 51

[PATCH 15/22] netfilter: ipset: Make struct htype per ipset family

2016-10-17 Thread Jozsef Kadlecsik
. Signed-off-by: Jozsef Kadlecsik --- net/netfilter/ipset/ip_set_hash_gen.h| 51 +++- net/netfilter/ipset/ip_set_hash_ip.c | 10 +++--- net/netfilter/ipset/ip_set_hash_ipmark.c | 10 +++--- net/netfilter/ipset/ip_set_hash_ipport.c | 6 ++-- net

[PATCH 04/22] netfilter: ipset: Improve comment extension helpers

2016-10-17 Thread Jozsef Kadlecsik
Allocate memory with kmalloc() rather than kzalloc(). Ported from a patch proposed by Sergey Popovich . Suggested-by: Sergey Popovich Signed-off-by: Jozsef Kadlecsik --- include/linux/netfilter/ipset/ip_set_comment.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include

[PATCH 22/22] netfilter: ipset: hash: fix boolreturn.cocci warnings

2016-10-17 Thread Jozsef Kadlecsik
n type bool Return statements in functions returning bool should use true/false instead of 1/0. Generated by: scripts/coccinelle/misc/boolreturn.cocci CC: Tomasz Chilinski Signed-off-by: Fengguang Wu Signed-off-by: Jozsef Kadlecsik --- net/netfilter/ipset/ip_set_hash_ipmac.c | 8 ---

[PATCH 01/22] netfilter: ipset: Correct rcu_dereference_bh_nfnl() usage

2016-10-17 Thread Jozsef Kadlecsik
: Jozsef Kadlecsik --- net/netfilter/ipset/ip_set_hash_gen.h | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/net/netfilter/ipset/ip_set_hash_gen.h b/net/netfilter/ipset/ip_set_hash_gen.h index d32fd6b..bc54be4 100644 --- a/net/netfilter/ipset/ip_set_hash_gen.h +++ b

[PATCH 11/22] netfilter: ipset: Simplify mtype_expire() for hash types

2016-10-17 Thread Jozsef Kadlecsik
Remove redundant parameters nets_length and dsize: they could be get from other parameters. Remove one leve of intendation by using continue while iterating over elements in bucket. Ported from a patch proposed by Sergey Popovich . Signed-off-by: Jozsef Kadlecsik --- net/netfilter/ipset

[PATCH 09/22] netfilter: ipset: Add element count to all set types header

2016-10-17 Thread Jozsef Kadlecsik
It is better to list the set elements for all set types, thus the header information is uniform. Element counts are therefore added to the bitmap and list types. Signed-off-by: Jozsef Kadlecsik --- include/linux/netfilter/ipset/ip_set.h| 2 ++ include/linux/netfilter/ipset

[PATCH 08/22] netfilter: ipset: Add element count to hash headers

2016-10-17 Thread Jozsef Kadlecsik
userspace. This field is then printed by the userspace tool for hashes. Signed-off-by: Eric B Munson Cc: Pablo Neira Ayuso Cc: Josh Hunt Cc: netfilter-devel@vger.kernel.org Signed-off-by: Jozsef Kadlecsik --- net/netfilter/ipset/ip_set_hash_gen.h | 3 ++- 1 file changed, 2 insertions(+), 1

[PATCH 19/22] netfilter: ipset: use setup_timer() and mod_timer().

2016-10-17 Thread Jozsef Kadlecsik
be activated). Use setup_timer() and mod_timer() to setup and arm a timer, making the code compact and easier to read. Signed-off-by: Muhammad Falak R Wani Signed-off-by: Jozsef Kadlecsik --- net/netfilter/ipset/ip_set_bitmap_gen.h | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) d

[PATCH 00/22] ipset patches for nf-next

2016-10-17 Thread Jozsef Kadlecsik
Munson (1): netfilter: ipset: Add element count to hash headers Jozsef Kadlecsik (16): netfilter: ipset: Correct rcu_dereference_bh_nfnl() usage netfilter: ipset: Headers file cleanup netfilter: ipset: Improve skbinfo get/init helpers netfilter: ipset: Improve comment extensi

[PATCH 07/22] netfilter: ipset: Regroup ip_set_put_extensions and add extern

2016-10-17 Thread Jozsef Kadlecsik
Signed-off-by: Jozsef Kadlecsik --- include/linux/netfilter/ipset/ip_set.h | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/include/linux/netfilter/ipset/ip_set.h b/include/linux/netfilter/ipset/ip_set.h index b5bd0fb3..7a218eb 100644 --- a/include/linux/netfilter/ipset

[PATCH 17/22] netfilter: ipset: Fix reported memory size for hash:* types

2016-10-17 Thread Jozsef Kadlecsik
The calculation of the full allocated memory did not take into account the size of the base hash bucket structure at some places. Signed-off-by: Jozsef Kadlecsik --- net/netfilter/ipset/ip_set_hash_gen.h | 16 +--- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/net

[PATCH 10/22] netfilter: ipset: Count non-static extension memory for userspace

2016-10-17 Thread Jozsef Kadlecsik
: Jozsef Kadlecsik --- include/linux/netfilter/ipset/ip_set.h | 8 ++-- include/linux/netfilter/ipset/ip_set_comment.h | 7 +-- net/netfilter/ipset/ip_set_bitmap_gen.h| 5 +++-- net/netfilter/ipset/ip_set_core.c | 2 +- net/netfilter/ipset/ip_set_hash_gen.h

[PATCH 03/22] netfilter: ipset: Improve skbinfo get/init helpers

2016-10-17 Thread Jozsef Kadlecsik
Use struct ip_set_skbinfo in struct ip_set_ext instead of open coded fields and assign structure members in get/init helpers instead of copying members one by one. Ported from a patch proposed by Sergey Popovich . Suggested-by: Sergey Popovich Signed-off-by: Jozsef Kadlecsik --- include/linux

[PATCH 16/22] netfilter: ipset: Collapse same condition body to a single one

2016-10-17 Thread Jozsef Kadlecsik
Signed-off-by: Jozsef Kadlecsik --- net/netfilter/ipset/ip_set_hash_gen.h | 8 +--- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/net/netfilter/ipset/ip_set_hash_gen.h b/net/netfilter/ipset/ip_set_hash_gen.h index 0082ccf..f4b30b6 100644 --- a/net/netfilter/ipset

[PATCH 02/22] netfilter: ipset: Headers file cleanup

2016-10-17 Thread Jozsef Kadlecsik
Remove extra whitespace, group counter helper together. Mark some of the helpers arguments as const. Ported from a patch proposed by Sergey Popovich . Suggested-by: Sergey Popovich Signed-off-by: Jozsef Kadlecsik --- include/linux/netfilter/ipset/ip_set.h | 57

[PATCH 18/22] netfilter: ipset: hash:ipmac type support added to ipset

2016-10-17 Thread Jozsef Kadlecsik
From: Tomasz Chilinski Signed-off-by: Tomasz Chili??ski Signed-off-by: Jozsef Kadlecsik --- net/netfilter/ipset/Kconfig | 9 + net/netfilter/ipset/Makefile| 1 + net/netfilter/ipset/ip_set_hash_ipmac.c | 315 3 files changed, 325

[ANNOUNCE] ipset 6.30 released

2016-10-17 Thread Jozsef Kadlecsik
Hi, I'm happy to announce ipset 6.30 which introduces a new set type, hash:ip,mac, and brings a couple of small corrections and backports from the most recent kernel tree. Userspace changes: - Drop extra comma from error message (Neutron Soutmun) - Fix the incorrect dynamic/static modules l

[PATCH 01/22] netfilter: ipset: Correct rcu_dereference_bh_nfnl() usage

2016-10-23 Thread Jozsef Kadlecsik
: Jozsef Kadlecsik --- net/netfilter/ipset/ip_set_hash_gen.h | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/net/netfilter/ipset/ip_set_hash_gen.h b/net/netfilter/ipset/ip_set_hash_gen.h index d32fd6b..bc54be4 100644 --- a/net/netfilter/ipset/ip_set_hash_gen.h +++ b

[PATCH 08/22] netfilter: ipset: Add element count to hash headers

2016-10-23 Thread Jozsef Kadlecsik
userspace. This field is then printed by the userspace tool for hashes. Signed-off-by: Eric B Munson Cc: Pablo Neira Ayuso Cc: Josh Hunt Cc: netfilter-devel@vger.kernel.org Signed-off-by: Jozsef Kadlecsik --- net/netfilter/ipset/ip_set_hash_gen.h | 3 ++- 1 file changed, 2 insertions(+), 1

[PATCH 12/22] netfilter: ipset: Make NLEN compile time constant for hash types

2016-10-23 Thread Jozsef Kadlecsik
Hash types define HOST_MASK before inclusion of ip_set_hash_gen.h and the only place where NLEN needed to be calculated at runtime is *_create() method. Ported from a patch proposed by Sergey Popovich . Signed-off-by: Jozsef Kadlecsik --- net/netfilter/ipset/ip_set_hash_gen.h | 51

[PATCH 13/22] netfilter: ipset: Make sure element data size is a multiple of u32

2016-10-23 Thread Jozsef Kadlecsik
Data for hashing required to be array of u32. Make sure that element data always multiple of u32. Ported from a patch proposed by Sergey Popovich . Signed-off-by: Jozsef Kadlecsik --- net/netfilter/ipset/ip_set_hash_gen.h | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff

[PATCH 03/22] netfilter: ipset: Improve skbinfo get/init helpers

2016-10-23 Thread Jozsef Kadlecsik
Use struct ip_set_skbinfo in struct ip_set_ext instead of open coded fields and assign structure members in get/init helpers instead of copying members one by one. Ported from a patch proposed by Sergey Popovich . Suggested-by: Sergey Popovich Signed-off-by: Jozsef Kadlecsik --- include/linux

[PATCH 10/22] netfilter: ipset: Count non-static extension memory for userspace

2016-10-23 Thread Jozsef Kadlecsik
: Jozsef Kadlecsik --- include/linux/netfilter/ipset/ip_set.h | 8 ++-- include/linux/netfilter/ipset/ip_set_comment.h | 7 +-- net/netfilter/ipset/ip_set_bitmap_gen.h| 5 +++-- net/netfilter/ipset/ip_set_core.c | 2 +- net/netfilter/ipset/ip_set_hash_gen.h

[PATCH 22/22] netfilter: ipset: hash: fix boolreturn.cocci warnings

2016-10-23 Thread Jozsef Kadlecsik
n type bool Return statements in functions returning bool should use true/false instead of 1/0. Generated by: scripts/coccinelle/misc/boolreturn.cocci CC: Tomasz Chilinski Signed-off-by: Fengguang Wu Signed-off-by: Jozsef Kadlecsik --- net/netfilter/ipset/ip_set_hash_ipmac.c | 8 ---

[PATCH 06/22] netfilter: ipset: Separate memsize calculation code into dedicated function

2016-10-23 Thread Jozsef Kadlecsik
Hash types already has it's memsize calculation code in separate functions. Do the same for *bitmap* and *list* sets. Ported from a patch proposed by Sergey Popovich . Suggested-by: Sergey Popovich Signed-off-by: Jozsef Kadlecsik --- net/netfilter/ipset/ip_set_bitmap_gen.h

[PATCH 19/22] netfilter: ipset: use setup_timer() and mod_timer().

2016-10-23 Thread Jozsef Kadlecsik
be activated). Use setup_timer() and mod_timer() to setup and arm a timer, making the code compact and easier to read. Signed-off-by: Muhammad Falak R Wani Signed-off-by: Jozsef Kadlecsik --- net/netfilter/ipset/ip_set_bitmap_gen.h | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) d

[PATCH 09/22] netfilter: ipset: Add element count to all set types header

2016-10-23 Thread Jozsef Kadlecsik
It is better to list the set elements for all set types, thus the header information is uniform. Element counts are therefore added to the bitmap and list types. Signed-off-by: Jozsef Kadlecsik --- include/linux/netfilter/ipset/ip_set.h| 2 ++ include/linux/netfilter/ipset

[PATCH 21/22] netfilter: ipset: use setup_timer() and mod_timer().

2016-10-23 Thread Jozsef Kadlecsik
be activated). Use setup_timer() and mod_timer() to setup and arm a timer, making the code compact and easier to read. Signed-off-by: Muhammad Falak R Wani Signed-off-by: Jozsef Kadlecsik --- net/netfilter/ipset/ip_set_list_set.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) d

[PATCH 04/22] netfilter: ipset: Improve comment extension helpers

2016-10-23 Thread Jozsef Kadlecsik
Allocate memory with kmalloc() rather than kzalloc(). Ported from a patch proposed by Sergey Popovich . Suggested-by: Sergey Popovich Signed-off-by: Jozsef Kadlecsik --- include/linux/netfilter/ipset/ip_set_comment.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include

[PATCH 15/22] netfilter: ipset: Make struct htype per ipset family

2016-10-23 Thread Jozsef Kadlecsik
. Signed-off-by: Jozsef Kadlecsik --- net/netfilter/ipset/ip_set_hash_gen.h| 51 +++- net/netfilter/ipset/ip_set_hash_ip.c | 10 +++--- net/netfilter/ipset/ip_set_hash_ipmark.c | 10 +++--- net/netfilter/ipset/ip_set_hash_ipport.c | 6 ++-- net

[PATCH 18/22] netfilter: ipset: hash:ipmac type support added to ipset

2016-10-23 Thread Jozsef Kadlecsik
From: Tomasz Chilinski Signed-off-by: Tomasz Chili??ski Signed-off-by: Jozsef Kadlecsik --- net/netfilter/ipset/Kconfig | 9 + net/netfilter/ipset/Makefile| 1 + net/netfilter/ipset/ip_set_hash_ipmac.c | 315 3 files changed, 325

[PATCH 11/22] netfilter: ipset: Simplify mtype_expire() for hash types

2016-10-23 Thread Jozsef Kadlecsik
Remove redundant parameters nets_length and dsize: they could be get from other parameters. Remove one leve of intendation by using continue while iterating over elements in bucket. Ported from a patch proposed by Sergey Popovich . Signed-off-by: Jozsef Kadlecsik --- net/netfilter/ipset

[PATCH 05/22] netfilter: ipset: Split extensions into separate files

2016-10-23 Thread Jozsef Kadlecsik
Ported from a patch proposed by Sergey Popovich . Suggested-by: Sergey Popovich Signed-off-by: Jozsef Kadlecsik --- include/linux/netfilter/ipset/ip_set.h | 95 +- include/linux/netfilter/ipset/ip_set_counter.h | 75 include/linux/netfilter

[PATCH 02/22] netfilter: ipset: Headers file cleanup

2016-10-23 Thread Jozsef Kadlecsik
Remove extra whitespace, group counter helper together. Mark some of the helpers arguments as const. Ported from a patch proposed by Sergey Popovich . Suggested-by: Sergey Popovich Signed-off-by: Jozsef Kadlecsik --- include/linux/netfilter/ipset/ip_set.h | 57

[PATCH 17/22] netfilter: ipset: Fix reported memory size for hash:* types

2016-10-23 Thread Jozsef Kadlecsik
The calculation of the full allocated memory did not take into account the size of the base hash bucket structure at some places. Signed-off-by: Jozsef Kadlecsik --- net/netfilter/ipset/ip_set_hash_gen.h | 16 +--- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/net

[PATCH 20/22] netfilter: ipset: use setup_timer() and mod_timer().

2016-10-23 Thread Jozsef Kadlecsik
be activated). Use setup_timer() and mod_timer() to setup and arm a timer, making the code compact and easier to read. Signed-off-by: Muhammad Falak R Wani Signed-off-by: Jozsef Kadlecsik --- net/netfilter/ipset/ip_set_hash_gen.h | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) d

[PATCH 14/22] netfilter: ipset: Optimize hash creation routine

2016-10-23 Thread Jozsef Kadlecsik
Exit as easly as possible on error and use RCU_INIT_POINTER() as set is not seen at creation time. Signed-off-by: Jozsef Kadlecsik --- net/netfilter/ipset/ip_set_hash_gen.h | 63 --- 1 file changed, 29 insertions(+), 34 deletions(-) diff --git a/net/netfilter

[PATCH 00/22] ipset patches for nf-next, v2

2016-10-23 Thread Jozsef Kadlecsik
pset: hash: fix boolreturn.cocci warnings (2016-10-23 22:24:56 +0200) Eric B Munson (1): netfilter: ipset: Add element count to hash headers Jozsef Kadlecsik (16): netfilter: ipset: Correct rcu_dereference_bh_nf

[PATCH 16/22] netfilter: ipset: Collapse same condition body to a single one

2016-10-23 Thread Jozsef Kadlecsik
Signed-off-by: Jozsef Kadlecsik --- net/netfilter/ipset/ip_set_hash_gen.h | 8 +--- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/net/netfilter/ipset/ip_set_hash_gen.h b/net/netfilter/ipset/ip_set_hash_gen.h index 0082ccf..f4b30b6 100644 --- a/net/netfilter/ipset

[PATCH 07/22] netfilter: ipset: Regroup ip_set_put_extensions and add extern

2016-10-23 Thread Jozsef Kadlecsik
Signed-off-by: Jozsef Kadlecsik --- include/linux/netfilter/ipset/ip_set.h | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/include/linux/netfilter/ipset/ip_set.h b/include/linux/netfilter/ipset/ip_set.h index b5bd0fb3..7a218eb 100644 --- a/include/linux/netfilter/ipset

[PATCH 01/22] netfilter: ipset: Remove extra whitespaces in ip_set.h

2016-11-10 Thread Jozsef Kadlecsik
Remove unnecessary whitespaces. Ported from a patch proposed by Sergey Popovich . Suggested-by: Sergey Popovich Signed-off-by: Jozsef Kadlecsik --- include/linux/netfilter/ipset/ip_set.h | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/include/linux/netfilter

[PATCH 02/22] netfilter: ipset: Mark some helper args as const.

2016-11-10 Thread Jozsef Kadlecsik
Mark some of the helpers arguments as const. Ported from a patch proposed by Sergey Popovich . Suggested-by: Sergey Popovich Signed-off-by: Jozsef Kadlecsik --- include/linux/netfilter/ipset/ip_set.h | 4 ++-- include/linux/netfilter/ipset/ip_set_comment.h | 2 +- include/linux

[PATCH 00/22] ipset patches for nf-next, v3

2016-11-10 Thread Jozsef Kadlecsik
) Eric B Munson (1): netfilter: ipset: Add element count to hash headers Jozsef Kadlecsik (19): netfilter: ipset: Remove extra whitespaces in ip_set.h netfilter: ipset: Mark some helper args as const. netfilter: ipset: Headers file cleanup netfilter: ipset: Improve

[PATCH 09/22] netfilter: ipset: Add element count to hash headers

2016-11-10 Thread Jozsef Kadlecsik
userspace. This field is then printed by the userspace tool for hashes. Signed-off-by: Eric B Munson Cc: Pablo Neira Ayuso Cc: Josh Hunt Cc: netfilter-devel@vger.kernel.org Signed-off-by: Jozsef Kadlecsik --- net/netfilter/ipset/ip_set_hash_gen.h | 3 ++- 1 file changed, 2 insertions(+), 1

[PATCH 13/22] netfilter: ipset: Simplify mtype_expire() for hash types

2016-11-10 Thread Jozsef Kadlecsik
Remove one leve of intendation by using continue while iterating over elements in bucket. Ported from a patch proposed by Sergey Popovich . Signed-off-by: Jozsef Kadlecsik --- net/netfilter/ipset/ip_set_hash_gen.h | 25 - 1 file changed, 12 insertions(+), 13 deletions

[PATCH 12/22] netfilter: ipset: Remove redundant mtype_expire() arguments

2016-11-10 Thread Jozsef Kadlecsik
Remove redundant parameters nets_length and dsize, because they can be get from other parameters. Ported from a patch proposed by Sergey Popovich . Signed-off-by: Jozsef Kadlecsik --- net/netfilter/ipset/ip_set_hash_gen.h | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff

[PATCH 22/22] netfilter: ipset: hash: fix boolreturn.cocci warnings

2016-11-10 Thread Jozsef Kadlecsik
n type bool Return statements in functions returning bool should use true/false instead of 1/0. Generated by: scripts/coccinelle/misc/boolreturn.cocci CC: Tomasz Chilinski Signed-off-by: Fengguang Wu Signed-off-by: Jozsef Kadlecsik --- net/netfilter/ipset/ip_set_hash_ipmac.c | 8 ---

[PATCH 08/22] netfilter: ipset: Regroup ip_set_put_extensions and add extern

2016-11-10 Thread Jozsef Kadlecsik
Cleanup: group ip_set_put_extensions and ip_set_get_extensions together and add missing extern. Signed-off-by: Jozsef Kadlecsik --- include/linux/netfilter/ipset/ip_set.h | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/include/linux/netfilter/ipset/ip_set.h b/include

[PATCH 14/22] netfilter: ipset: Make NLEN compile time constant for hash types

2016-11-10 Thread Jozsef Kadlecsik
Hash types define HOST_MASK before inclusion of ip_set_hash_gen.h and the only place where NLEN needed to be calculated at runtime is *_create() method. Ported from a patch proposed by Sergey Popovich . Signed-off-by: Jozsef Kadlecsik --- net/netfilter/ipset/ip_set_hash_gen.h | 51

[PATCH 18/22] netfilter: ipset: Collapse same condition body to a single one

2016-11-10 Thread Jozsef Kadlecsik
The set full case (with net_ratelimit()-ed pr_warn()) is already handled, simply jump there. Signed-off-by: Jozsef Kadlecsik --- net/netfilter/ipset/ip_set_hash_gen.h | 8 +--- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/net/netfilter/ipset/ip_set_hash_gen.h b/net

[PATCH 05/22] netfilter: ipset: Use kmalloc() in comment extension helper

2016-11-10 Thread Jozsef Kadlecsik
Allocate memory with kmalloc() rather than kzalloc(): the string is immediately initialized so it is unnecessary to zero out the allocated memory area. Ported from a patch proposed by Sergey Popovich . Suggested-by: Sergey Popovich Signed-off-by: Jozsef Kadlecsik --- include/linux/netfilter

[PATCH 10/22] netfilter: ipset: Add element count to all set types header

2016-11-10 Thread Jozsef Kadlecsik
It is better to list the set elements for all set types, thus the header information is uniform. Element counts are therefore added to the bitmap and list types. Signed-off-by: Jozsef Kadlecsik --- include/linux/netfilter/ipset/ip_set.h| 2 ++ include/linux/netfilter/ipset

[PATCH 21/22] netfilter: ipset: use setup_timer() and mod_timer().

2016-11-10 Thread Jozsef Kadlecsik
mer() and mod_timer() to setup and arm a timer, making the code compact and easier to read. Signed-off-by: Muhammad Falak R Wani Signed-off-by: Jozsef Kadlecsik --- net/netfilter/ipset/ip_set_bitmap_gen.h | 7 ++- net/netfilter/ipset/ip_set_hash_gen.h | 7 ++- net/netfilter/ip

[PATCH 20/22] netfilter: ipset: hash:ipmac type support added to ipset

2016-11-10 Thread Jozsef Kadlecsik
From: Tomasz Chilinski Introduce the hash:ipmac type. Signed-off-by: Tomasz Chili??ski Signed-off-by: Jozsef Kadlecsik --- net/netfilter/ipset/Kconfig | 9 + net/netfilter/ipset/Makefile| 1 + net/netfilter/ipset/ip_set_hash_ipmac.c | 315

[PATCH 06/22] netfilter: ipset: Split extensions into separate files

2016-11-10 Thread Jozsef Kadlecsik
Cleanup to separate all extensions into individual files. Ported from a patch proposed by Sergey Popovich . Suggested-by: Sergey Popovich Signed-off-by: Jozsef Kadlecsik --- include/linux/netfilter/ipset/ip_set.h | 95 +- include/linux/netfilter/ipset

[PATCH 11/22] netfilter: ipset: Count non-static extension memory for userspace

2016-11-10 Thread Jozsef Kadlecsik
: Jozsef Kadlecsik --- include/linux/netfilter/ipset/ip_set.h | 8 ++-- include/linux/netfilter/ipset/ip_set_comment.h | 7 +-- net/netfilter/ipset/ip_set_bitmap_gen.h| 5 +++-- net/netfilter/ipset/ip_set_core.c | 2 +- net/netfilter/ipset/ip_set_hash_gen.h

[PATCH 04/22] netfilter: ipset: Improve skbinfo get/init helpers

2016-11-10 Thread Jozsef Kadlecsik
proposed by Sergey Popovich . Suggested-by: Sergey Popovich Signed-off-by: Jozsef Kadlecsik --- include/linux/netfilter/ipset/ip_set.h | 30 +++--- net/netfilter/ipset/ip_set_core.c | 12 ++-- net/netfilter/xt_set.c | 12 +++- 3 files

[PATCH 19/22] netfilter: ipset: Fix reported memory size for hash:* types

2016-11-10 Thread Jozsef Kadlecsik
The calculation of the full allocated memory did not take into account the size of the base hash bucket structure at some places. Signed-off-by: Jozsef Kadlecsik --- net/netfilter/ipset/ip_set_hash_gen.h | 16 +--- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/net

[PATCH 03/22] netfilter: ipset: Headers file cleanup

2016-11-10 Thread Jozsef Kadlecsik
Group counter helper functions together. Ported from a patch proposed by Sergey Popovich . Suggested-by: Sergey Popovich Signed-off-by: Jozsef Kadlecsik --- include/linux/netfilter/ipset/ip_set.h | 42 +- 1 file changed, 21 insertions(+), 21 deletions(-) diff

[PATCH 16/22] netfilter: ipset: Optimize hash creation routine

2016-11-10 Thread Jozsef Kadlecsik
Exit as easly as possible on error and use RCU_INIT_POINTER() as set is not seen at creation time. Signed-off-by: Jozsef Kadlecsik --- net/netfilter/ipset/ip_set_hash_gen.h | 63 --- 1 file changed, 29 insertions(+), 34 deletions(-) diff --git a/net/netfilter

[PATCH 17/22] netfilter: ipset: Make struct htype per ipset family

2016-11-10 Thread Jozsef Kadlecsik
. Signed-off-by: Jozsef Kadlecsik --- net/netfilter/ipset/ip_set_hash_gen.h| 51 +++- net/netfilter/ipset/ip_set_hash_ip.c | 10 +++--- net/netfilter/ipset/ip_set_hash_ipmark.c | 10 +++--- net/netfilter/ipset/ip_set_hash_ipport.c | 6 ++-- net

[PATCH 07/22] netfilter: ipset: Separate memsize calculation code into dedicated function

2016-11-10 Thread Jozsef Kadlecsik
Hash types already has it's memsize calculation code in separate functions. Clean up and do the same for *bitmap* and *list* sets. Ported from a patch proposed by Sergey Popovich . Suggested-by: Sergey Popovich Signed-off-by: Jozsef Kadlecsik --- net/netfilter/ipset/ip_set_bitmap_gen.h

[PATCH 15/22] netfilter: ipset: Make sure element data size is a multiple of u32

2016-11-10 Thread Jozsef Kadlecsik
Data for hashing required to be array of u32. Make sure that element data always multiple of u32. Ported from a patch proposed by Sergey Popovich . Signed-off-by: Jozsef Kadlecsik --- net/netfilter/ipset/ip_set_hash_gen.h | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff

Re: [PATCH v3 nf-next 5/7] netfilter: add and use nf_ct_set helper

2017-01-23 Thread Jozsef Kadlecsik
Hi Florian, On Mon, 23 Jan 2017, Florian Westphal wrote: > Pablo Neira Ayuso wrote: > > On Mon, Jan 23, 2017 at 01:28:48PM +0100, Florian Westphal wrote: > > > diff --git a/net/netfilter/core.c b/net/netfilter/core.c > > > index 0c629fdf90e1..ce6adfae521a 100644 > > > --- a/net/netfilter/core.c

<    1   2   3   >