[PATCH nf-next 2/4] netfilter: conntrack: built-in support for DCCP

2016-11-10 Thread Davide Caratti
CONFIG_NF_CT_PROTO_DCCP is no more a tristate. When set to y, connection tracking support for DCCP protocol is built-in into nf_conntrack.ko. footprint test: $ ls -l net/netfilter/nf_conntrack{_proto_dccp,}.ko \ net/ipv4/netfilter/nf_conntrack_ipv4.ko \ net/ipv6/netfilter/nf_conntr

[PATCH nf-next 3/4] netfilter: conntrack: built-in support for SCTP

2016-11-10 Thread Davide Caratti
CONFIG_NF_CT_PROTO_SCTP is no more a tristate. When set to y, connection tracking support for SCTP protocol is built-in into nf_conntrack.ko. footprint test: $ ls -l net/netfilter/nf_conntrack{_proto_sctp,}.ko \ net/ipv4/netfilter/nf_conntrack_ipv4.ko \ net/ipv6/netfilter/nf_conntr

[PATCH nf-next 4/4] netfilter: conntrack: built-in support for UDPlite

2016-11-10 Thread Davide Caratti
CONFIG_NF_CT_PROTO_UDPLITE is no more a tristate. When set to y, connection tracking support for UDPlite protocol is built-in into nf_conntrack.ko. footprint test: $ ls -l net/netfilter/nf_conntrack{_proto_udplite,}.ko \ net/ipv4/netfilter/nf_conntrack_ipv4.ko \ net/ipv6/netfilter/

[PATCH nf-next 0/4] netfilter: built-in conntrack support for DCCP, SCTP, UDPlite

2016-11-10 Thread Davide Caratti
When netfilter needs to match traffic made by one of the above protocols, layer-4 connection tracking functionality will not be available, unless the user explicly loads it in the kernel (e.g. "modprobe nf_conntrack_proto_sctp") or modifies the default kernel configuration and rebuilds. In order to

[PATCH nf-next 1/4] netfilter: nf_conntrack_tuple_common.h: fix #include

2016-11-10 Thread Davide Caratti
In commit 1ffad83dffd6 ("netfilter: fix include files for compilation"), compile-time errors were fixed for userspace programs including UAPI nf_conntrack_tuple_common.h: this was done by adding a "#include " line to that header file. This patch replaces "" with "" in nf_conntrack_tuple_common.h t

[PATCH nf] netfilter: fix nf_conntrack_helper documentation

2016-11-10 Thread Florian Westphal
Since kernel 4.7 this defaults to off. Signed-off-by: Florian Westphal --- Documentation/networking/nf_conntrack-sysctl.txt | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Documentation/networking/nf_conntrack-sysctl.txt b/Documentation/networking/nf_conntrack-sysctl.

[PATCH nf-next] netfilter: conntrack: remove unused netns_ct member

2016-11-10 Thread Florian Westphal
since 23014011ba420 ('netfilter: conntrack: support a fixed size of 128 distinct labels') this isn't needed anymore. Signed-off-by: Florian Westphal --- include/net/netns/conntrack.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/net/netns/conntrack.h b/include/net/netns/conntrack.h

[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/ips

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

2016-11-10 Thread Jozsef Kadlecsik
Before this patch struct htype created at the first source of ip_set_hash_gen.h and it is common for both IPv4 and IPv6 set variants. Make struct htype per ipset family and use NLEN to make nets array fixed size to simplify struct htype allocation. Ported from a patch proposed by Sergey Popovich

[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 | 11 ++

[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 --

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

2016-11-10 Thread Jozsef Kadlecsik
Non-static (i.e. comment) extension was not counted into the memory size. A new internal counter is introduced for this. In the case of the hash types the sizes of the arrays are counted there as well so that we can avoid to scan the whole set when just the header data is requested. Signed-off-by:

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

2016-11-10 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. Explicitly note that struct ip_set_skbinfo must be padded to prevent non-aligned access in the extension blob. Ported from a patch pro

[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/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 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/netfilter

[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/ip

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

2016-11-10 Thread Jozsef Kadlecsik
Use setup_timer() and instead of init_timer(), being the preferred way of setting up a timer. Also, quoting the mod_timer() function comment: -> mod_timer() is a more efficient way to update the expire field of an active timer (if the timer is inactive it will be activated). Use setup_timer()

[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 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 --gi

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

2016-11-10 Thread Jozsef Kadlecsik
From: kbuild test robot net/netfilter/ipset/ip_set_hash_ipmac.c:70:8-9: WARNING: return of 0/1 in function 'hash_ipmac4_data_list' with return type bool net/netfilter/ipset/ip_set_hash_ipmac.c:178:8-9: WARNING: return of 0/1 in function 'hash_ipmac6_data_list' with return type bool Return sta

[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/l

[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 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/ip_set_bitmap

[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/ip_set_cou

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

2016-11-10 Thread Jozsef Kadlecsik
From: Eric B Munson It would be useful for userspace to query the size of an ipset hash, however, this data is not exposed to userspace outside of counting the number of member entries. This patch uses the attribute IPSET_ATTR_ELEMENTS to indicate the size in the the header that is exported to u

[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 00/22] ipset patches for nf-next, v3

2016-11-10 Thread Jozsef Kadlecsik
Hi Pablo, Here follows the new batch for nf-next: I addressed all your concerns about the previous version. Please review and consider to apply the patchset. Thanks! Jozsef * Cleanup: Remove extra whitespaces in ip_set.h * Cleanup: Mark some of the helpers arguments as const in ip_set.h * Cleanu

[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/i

[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/netfilt