[PATCH nft] src: netlink: Subscribe nft monitor and nft monitor trace to respective groups.

2017-07-24 Thread Varsha Rao
Subscribe nft monitor only to NFNLGRP_NFTABLES and nft monitor trace only to NFNLGRP_NFTRACE. In netlink_monitor() depending on the command call setsockopt() once. Signed-off-by: Varsha Rao --- src/netlink.c | 11 --- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/netl

Re: [PATCH] conntrack: labels: Avoid crash when labels file is not installed

2017-07-24 Thread Florian Westphal
Marcos Paulo de Souza wrote: > [marcos@Icarus ~]$ conntrack -l something > nfct_labelmap_new: No such file or directory > Segmentation fault (core dumped) conntrack should not pass NULL in the first place. However I agree that lnf-conntrack should be more robust so I applied this patch, thanks.

[PATCH] conntrack: labels: Avoid crash when labels file is not installed

2017-07-24 Thread Marcos Paulo de Souza
When CONNLABEL_CFG isn't available (/etc/xtables/connlabel.conf), conntrack tool crashes: [marcos@Icarus ~]$ conntrack -l something nfct_labelmap_new: No such file or directory Segmentation fault (core dumped) I can see this problem in Fedora 26, because connlabel.conf does not come along the con

Re: [4.4.y,netfilter/ipvs] please, apply 3c5ab3f395d6

2017-07-24 Thread Greg Kroah-Hartman
On Mon, Jul 24, 2017 at 11:59:40AM +0200, Pablo Neira Ayuso wrote: > Hi Greg, > > Please, apply this commit: > > commit 3c5ab3f395d66a9e4e937fcfdf6ebc63894f028b > Author: Julian Anastasov > Date: Sat Apr 29 20:33:09 2017 +0300 > > ipvs: SNAT packet replies only for NATed connections > >

[PATCH tip/core/rcu 1/9] net/netfilter/nf_conntrack_core: Fix net_conntrack_lock()

2017-07-24 Thread Paul E. McKenney
From: Manfred Spraul As we want to remove spin_unlock_wait() and replace it with explicit spin_lock()/spin_unlock() calls, we can use this to simplify the locking. In addition: - Reading nf_conntrack_locks_all needs ACQUIRE memory ordering. - The new code avoids the backwards loop. Only slightl

[nf-next PATCH v2 0/5] netfilter: nf_tables: Kill name length restrictions

2017-07-24 Thread Phil Sutter
The following series removes the hard-coded restriction on name length of tables, chains, sets and objects. The first patch introduces nla_strdup() which aids in duplicating a string contained in a netlink attribute. It is used to replace the call to nla_strlcpy() when populating name fields. I'v

[nf-next PATCH v2 5/5] netfilter: nf_tables: Unlimit object name length

2017-07-24 Thread Phil Sutter
Same conversion as for table names, use NFT_NAME_MAXLEN as upper boundary as well. Signed-off-by: Phil Sutter --- include/net/netfilter/nf_tables.h| 2 +- include/uapi/linux/netfilter/nf_tables.h | 1 - net/netfilter/nf_tables_api.c| 13 ++--- net/netfilter/nft_objr

[nf-next PATCH v2 2/5] netfilter: nf_tables: Unlimit table name length

2017-07-24 Thread Phil Sutter
Allocate all table names dynamically to allow for arbitrary lengths but introduce NFT_NAME_MAXLEN as an upper sanity boundary. It's value was chosen to allow using a domain name as per RFC 1035. Signed-off-by: Phil Sutter --- include/net/netfilter/nf_tables.h| 2 +- include/uapi/linux/n

[nf-next PATCH v2 1/5] networking: Introduce nla_strdup()

2017-07-24 Thread Phil Sutter
This is similar to strdup() for netlink string attributes. Signed-off-by: Phil Sutter --- include/net/netlink.h | 1 + lib/nlattr.c | 24 2 files changed, 25 insertions(+) diff --git a/include/net/netlink.h b/include/net/netlink.h index 01709172b3d38..5c1fc1d4

[nf-next PATCH v2 3/5] netfilter: nf_tables: Unlimit chain name length

2017-07-24 Thread Phil Sutter
Same conversion as for table names, use NFT_NAME_MAXLEN as upper boundary as well. Signed-off-by: Phil Sutter --- include/net/netfilter/nf_tables.h| 4 ++-- include/uapi/linux/netfilter/nf_tables.h | 1 - net/netfilter/nf_tables_api.c| 40 +++- n

[nf-next PATCH v2 4/5] netfilter: nf_tables: Unlimit set name length

2017-07-24 Thread Phil Sutter
Same conversion as for table names, use NFT_NAME_MAXLEN as upper boundary as well. Signed-off-by: Phil Sutter --- include/net/netfilter/nf_tables.h| 2 +- include/uapi/linux/netfilter/nf_tables.h | 1 - net/netfilter/nf_tables_api.c| 22 -- net/netfilter

Re: [nft PATCH v2] monitor: Print NEWGEN events

2017-07-24 Thread Pablo Neira Ayuso
On Mon, Jul 24, 2017 at 07:29:11PM +0200, Phil Sutter wrote: > Now that they contain process information, they're actually interesting. > For backwards compatibility, print process information only if it was > present in the message. Applied, thanks Phil. -- To unsubscribe from this list: send the

Re: [PATCH net-next 1/6] bnxt: fix unsigned comparsion with 0

2017-07-24 Thread Michael Chan
On Mon, Jul 24, 2017 at 10:25 AM, Stephen Hemminger wrote: > Fixes warning because location is u32 and can never be netative > warning: comparison of unsigned expression < 0 is always false [-Wtype-limits] > > Signed-off-by: Stephen Hemminger Acked-by: Michael Chan -- To unsubscribe from this l

Re: [PATCH net-next 2/6] bnxt: fix unused variable warnings

2017-07-24 Thread Michael Chan
On Mon, Jul 24, 2017 at 10:25 AM, Stephen Hemminger wrote: > Fix a couple of warnings where variable ‘txq’ set but not used > > Signed-off-by: Stephen Hemminger Acked-by: Michael Chan v, i); -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to

[PATCH net-next 6/6] 6lowpan: fix set not used warning

2017-07-24 Thread Stephen Hemminger
Signed-off-by: Stephen Hemminger --- net/bluetooth/6lowpan.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/net/bluetooth/6lowpan.c b/net/bluetooth/6lowpan.c index 2af4f1cc0ab4..4e2576fc0c59 100644 --- a/net/bluetooth/6lowpan.c +++ b/net/bluetooth/6lowpan.c @@ -273,9 +273,6 @@ static int i

[nft PATCH v2] monitor: Print NEWGEN events

2017-07-24 Thread Phil Sutter
Now that they contain process information, they're actually interesting. For backwards compatibility, print process information only if it was present in the message. Signed-off-by: Phil Sutter --- changes since v1: - Abort with netlink_abi_error() if attribute validation fails. - Prefix message

[PATCH net-next 4/6] netfilter: remove unused variable

2017-07-24 Thread Stephen Hemminger
warning: ‘recent_old_fops’ defined but not used Signed-off-by: Stephen Hemminger --- net/netfilter/xt_recent.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/netfilter/xt_recent.c b/net/netfilter/xt_recent.c index 3f6c4fa78bdb..245fa350a7a8 100644 --- a/net/netfilter/xt_

[PATCH net-next 5/6] socket: fix set not used warning

2017-07-24 Thread Stephen Hemminger
The variable owned_by_user is always set, but only used when kernel is configured with LOCKDEP enabled. Get rid of the warning by moving the code to put the call to owned_by_user into the the rcu_protected call. Signed-off-by: Stephen Hemminger --- net/socket.c | 6 ++ 1 file changed, 2 ins

[PATCH net-next 3/6] benet: fix set but not used warning

2017-07-24 Thread Stephen Hemminger
warning: variable ‘netdev’ set but not used Signed-off-by: Stephen Hemminger --- drivers/net/ethernet/emulex/benet/be_roce.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/net/ethernet/emulex/benet/be_roce.c b/drivers/net/ethernet/emulex/benet/be_roce.c index 2b62841c4c63..05989a

[PATCH net-next 0/6] network related warning fixes

2017-07-24 Thread Stephen Hemminger
Various fixes for warnings in network code and drivers. Stephen Hemminger (6): bnxt: fix unsigned comparsion with 0 bnxt: fix unused variable warnings benet: fix set but not used warning netfilter: remove unused variable socket: fix set not used warning 6lowpan: fix set not used warnin

[PATCH net-next 1/6] bnxt: fix unsigned comparsion with 0

2017-07-24 Thread Stephen Hemminger
Fixes warning because location is u32 and can never be netative warning: comparison of unsigned expression < 0 is always false [-Wtype-limits] Signed-off-by: Stephen Hemminger --- drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

[PATCH net-next 2/6] bnxt: fix unused variable warnings

2017-07-24 Thread Stephen Hemminger
Fix a couple of warnings where variable ‘txq’ set but not used Signed-off-by: Stephen Hemminger --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 4 1 file changed, 4 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index e7c853

[PATCH nf-next 4/4] netfilter: nfnetlink_queue: don't queue dying conntracks to userspace

2017-07-24 Thread Florian Westphal
When skb is queued to userspace it leaves softirq/rcu protection. skb->nfct (via conntrack extensions such as helper) could then reference modules that no longer exist if the conntrack was not yet confirmed. nf_ct_iterate_destroy() will set the DYING bit for unconfirmed conntracks, we therefore so

[PATCH nf-next 0/4] netfilter: handle race w. module removal and nfqueue

2017-07-24 Thread Florian Westphal
There is a long-standing race that occurs with module removal (such as helpers) nfqueue, and unconfirmed (not in hash table) conntracks. The main issue is that a). unconfirmed conntracks can't safely be mangled from other cpu (we assume exclusive access to grow/alter the extension area) and b)

[PATCH nf-next 1/4] netfilter: expect: add and use nf_ct_expect_iterate helpers

2017-07-24 Thread Florian Westphal
We have several spots that open-code a expect walk, add a helper that is similar to nf_ct_iterate_destroy/nf_ct_iterate_cleanup. Signed-off-by: Florian Westphal --- include/net/netfilter/nf_conntrack_expect.h | 5 +++ net/netfilter/nf_conntrack_expect.c | 54 + n

[PATCH nf-next 3/4] netfilter: conntrack: destroy functions need to free queued packets

2017-07-24 Thread Florian Westphal
queued skbs might be using conntrack extensions that are being removed, such as timeout. This happens for skbs that have a skb->nfct in unconfirmed state (i.e., not in hash table yet). This is destructive, but there are only two use cases: - module removal (rare) - netns cleanup (most likely no

[PATCH nf-next 2/4] netfilter: add and use nf_ct_unconfirmed_destroy

2017-07-24 Thread Florian Westphal
This also removes __nf_ct_unconfirmed_destroy() call from nf_ct_iterate_cleanup_net, so that function can be used only when missing conntracks from unconfirmed list isn't a problem. Signed-off-by: Florian Westphal --- include/net/netfilter/nf_conntrack.h | 3 +++ net/netfilter/nf_conntrack_core

Re: [nft PATCH] monitor: Print NEWGEN events

2017-07-24 Thread Phil Sutter
On Mon, Jul 24, 2017 at 01:17:30PM +0200, Pablo Neira Ayuso wrote: > On Wed, Jul 19, 2017 at 04:32:57PM +0200, Phil Sutter wrote: > > Now that they contain process information, they're actually interesting. > > For backwards compatibility, print process information only if it was > > present in the

Re: [nf-next PATCH 6/5] netfilter: nf_tables: Reintroduce name length boundary

2017-07-24 Thread Pablo Neira Ayuso
On Mon, Jul 24, 2017 at 05:10:05PM +0200, Phil Sutter wrote: > Since all names in nftables are now dynamically allocated, choosing a > large hard-coded length limit does not bloat nftables' footprint > anymore. > > Introduce a common upper limit on all names for sanity reasons - the > chosen value

[nf-next PATCH 6/5] netfilter: nf_tables: Reintroduce name length boundary

2017-07-24 Thread Phil Sutter
Since all names in nftables are now dynamically allocated, choosing a large hard-coded length limit does not bloat nftables' footprint anymore. Introduce a common upper limit on all names for sanity reasons - the chosen value of 255 characters allows to use a DNS name as per RFC 1035. Sugested-by

Re: [3.10.y,3.16.y,4.1.y,netfilter/ipvs] please, apply 3c5ab3f395d6

2017-07-24 Thread Willy Tarreau
Hi Pablo! On Mon, Jul 24, 2017 at 11:58:05AM +0200, Pablo Neira Ayuso wrote: > Hi Willy, Ben & Sasha, > > Please, apply this commit: > > commit 3c5ab3f395d66a9e4e937fcfdf6ebc63894f028b > Author: Julian Anastasov > Date: Sat Apr 29 20:33:09 2017 +0300 > > ipvs: SNAT packet replies only fo

Re: [nft PATCH] monitor: Print NEWGEN events

2017-07-24 Thread Pablo Neira Ayuso
On Wed, Jul 19, 2017 at 04:32:57PM +0200, Phil Sutter wrote: > Now that they contain process information, they're actually interesting. > For backwards compatibility, print process information only if it was > present in the message. Wait, a couple of comments. [...] > diff --git a/src/netlink.c

Re: [nft PATCH] monitor: Print NEWGEN events

2017-07-24 Thread Pablo Neira Ayuso
On Wed, Jul 19, 2017 at 04:32:57PM +0200, Phil Sutter wrote: > Now that they contain process information, they're actually interesting. > For backwards compatibility, print process information only if it was > present in the message. Also applied, thanks. -- To unsubscribe from this list: send the

Re: [nf-next PATCH] netfilter: nf_tables: Attach process info to NFT_MSG_NEWGEN notifications

2017-07-24 Thread Pablo Neira Ayuso
On Wed, Jul 19, 2017 at 04:32:23PM +0200, Phil Sutter wrote: > This is helpful for 'nft monitor' to track which process caused a given > change to the ruleset. Applied, thanks Phil. -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majord...@

Re: [PATCH V3] netfilter: Remove duplicated rcu_read_lock.

2017-07-24 Thread Pablo Neira Ayuso
On Wed, Jul 19, 2017 at 02:27:33PM +0900, Taehee Yoo wrote: > This patch removes duplicate rcu_read_lock(). 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.kerne

Re: [PATCH nf] netfilter: expect: add to hash table after expect init

2017-07-24 Thread Pablo Neira Ayuso
On Mon, Jul 10, 2017 at 03:06:39PM +0200, Florian Westphal wrote: > assuming we have lockless readers we should make sure they can only > see expectations that have already been initialized. > > hlist_add_head_rcu acts as memory barrier, move it after timer setup. > > Theoretically we could crash

Re: [3.10.y,3.16.y,4.1.y,netfilter/ipvs] please, apply 3c5ab3f395d6

2017-07-24 Thread Pablo Neira Ayuso
On Mon, Jul 24, 2017 at 11:58:05AM +0200, Pablo Neira Ayuso wrote: > Hi Willy, Ben & Sasha, > > Please, apply this commit: > > commit 3c5ab3f395d66a9e4e937fcfdf6ebc63894f028b > Author: Julian Anastasov > Date: Sat Apr 29 20:33:09 2017 +0300 > > ipvs: SNAT packet replies only for NATed con

[4.4.y,netfilter/ipvs] please, apply 3c5ab3f395d6

2017-07-24 Thread Pablo Neira Ayuso
Hi Greg, Please, apply this commit: commit 3c5ab3f395d66a9e4e937fcfdf6ebc63894f028b Author: Julian Anastasov Date: Sat Apr 29 20:33:09 2017 +0300 ipvs: SNAT packet replies only for NATed connections to stable 4.4.y. Julian made a backport for you, in case cherry-pick doesn't work, that

Re: libnetfilter_queue & multithreading

2017-07-24 Thread Oleg
On Mon, Jul 24, 2017 at 11:44:51AM +0200, Florian Westphal wrote: > Oleg wrote: > > On Sat, Jul 22, 2017 at 06:38:55PM +0200, Florian Westphal wrote: > > > Oleg wrote: > > > > static void* > > > > thread_start(void *data) > > > > { > > > > struct nfq_handle *h; > > > > int fd, n;

[3.10.y,3.16.y,4.1.y,netfilter/ipvs] please, apply 3c5ab3f395d6

2017-07-24 Thread Pablo Neira Ayuso
Hi Willy, Ben & Sasha, Please, apply this commit: commit 3c5ab3f395d66a9e4e937fcfdf6ebc63894f028b Author: Julian Anastasov Date: Sat Apr 29 20:33:09 2017 +0300 ipvs: SNAT packet replies only for NATed connections to stable 3.2.y. Julian made a backport for you, that is available at Netf

[3.2.y,netfilter/ipvs] please, apply 3c5ab3f395d6

2017-07-24 Thread Pablo Neira Ayuso
Hi Ben, Please, apply this commit: commit 3c5ab3f395d66a9e4e937fcfdf6ebc63894f028b Author: Julian Anastasov Date: Sat Apr 29 20:33:09 2017 +0300 ipvs: SNAT packet replies only for NATed connections to stable 3.2.y. Julian also made a backport for you, that is available at Netfilter's pa

Re: [nf-next PATCH 0/5] netfilter: nf_tables: Kill name length restrictions

2017-07-24 Thread Pablo Neira Ayuso
Hi Phil, On Thu, Jul 20, 2017 at 05:24:45PM +0200, Phil Sutter wrote: > The following series removes the hard-coded restriction on name length > of tables, chains, sets and objects. > > The first patch introduces nla_strdup() which aids in duplicating a > string contained in a netlink attribute.

Re: libnetfilter_queue & multithreading

2017-07-24 Thread Florian Westphal
Oleg wrote: > On Sat, Jul 22, 2017 at 06:38:55PM +0200, Florian Westphal wrote: > > Oleg wrote: > > > static void* > > > thread_start(void *data) > > > { > > > struct nfq_handle *h; > > > int fd, n; > > > static char *pkt_buf; > > > > static? Looks buggy... > > Hm, why

Re: libnetfilter_queue & multithreading

2017-07-24 Thread Oleg
On Sat, Jul 22, 2017 at 06:38:55PM +0200, Florian Westphal wrote: > Oleg wrote: > > static void* > > thread_start(void *data) > > { > > struct nfq_handle *h; > > int fd, n; > > static char *pkt_buf; > > static? Looks buggy... Hm, why :-)? This function must be local and