netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] netfilter: ctnetlink: Resolve conntrack L3-protocol flush regression
@ 2019-05-03 15:40 Kristian Evensen
  2019-05-03 17:02 ` Nicolas Dichtel
  2019-05-05 22:32 ` Pablo Neira Ayuso
  0 siblings, 2 replies; 11+ messages in thread
From: Kristian Evensen @ 2019-05-03 15:40 UTC (permalink / raw)
  To: netdev, netfilter-devel; +Cc: Kristian Evensen

Commit 59c08c69c278 ("netfilter: ctnetlink: Support L3 protocol-filter
on flush") introduced a user-space regression when flushing connection
track entries. Before this commit, the nfgen_family field was not used
by the kernel and all entries were removed. Since this commit,
nfgen_family is used to filter out entries that should not be removed.
One example a broken tool is conntrack. conntrack always sets
nfgen_family to AF_INET, so after 59c08c69c278 only IPv4 entries were
removed with the -F parameter.

Pablo Neira Ayuso suggested using nfgenmsg->version to resolve the
regression, and this commit implements his suggestion. nfgenmsg->version
is so far set to zero, so it is well-suited to be used as a flag for
selecting old or new flush behavior. If version is 0, nfgen_family is
ignored and all entries are used. If user-space sets the version to one
(or any other value than 0), then the new behavior is used. As version
only can have two valid values, I chose not to add a new
NFNETLINK_VERSION-constant.

Fixes: 59c08c69c278 ("netfilter: ctnetlink: Support L3 protocol-filter
on flush")

Reported-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Suggested-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Kristian Evensen <kristian.evensen@gmail.com>
---
 net/netfilter/nf_conntrack_netlink.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c
index 8dcc064d518d..7db79c1b8084 100644
--- a/net/netfilter/nf_conntrack_netlink.c
+++ b/net/netfilter/nf_conntrack_netlink.c
@@ -1256,7 +1256,7 @@ static int ctnetlink_del_conntrack(struct net *net, struct sock *ctnl,
 	struct nf_conntrack_tuple tuple;
 	struct nf_conn *ct;
 	struct nfgenmsg *nfmsg = nlmsg_data(nlh);
-	u_int8_t u3 = nfmsg->nfgen_family;
+	u_int8_t u3 = nfmsg->version ? nfmsg->nfgen_family : AF_UNSPEC;
 	struct nf_conntrack_zone zone;
 	int err;
 
-- 
2.19.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH] netfilter: ctnetlink: Resolve conntrack L3-protocol flush regression
  2019-05-03 15:40 [PATCH] netfilter: ctnetlink: Resolve conntrack L3-protocol flush regression Kristian Evensen
@ 2019-05-03 17:02 ` Nicolas Dichtel
  2019-05-03 17:05   ` Pablo Neira Ayuso
  2019-05-05 22:32 ` Pablo Neira Ayuso
  1 sibling, 1 reply; 11+ messages in thread
From: Nicolas Dichtel @ 2019-05-03 17:02 UTC (permalink / raw)
  To: Kristian Evensen, netdev, netfilter-devel, Pablo Neira Ayuso,
	Florian Westphal, David Miller

Please, keep in CC all involved people.

Le 03/05/2019 à 17:40, Kristian Evensen a écrit :
> Commit 59c08c69c278 ("netfilter: ctnetlink: Support L3 protocol-filter
> on flush") introduced a user-space regression when flushing connection
> track entries. Before this commit, the nfgen_family field was not used
> by the kernel and all entries were removed. Since this commit,
> nfgen_family is used to filter out entries that should not be removed.
> One example a broken tool is conntrack. conntrack always sets
> nfgen_family to AF_INET, so after 59c08c69c278 only IPv4 entries were
> removed with the -F parameter.
> 
> Pablo Neira Ayuso suggested using nfgenmsg->version to resolve the
> regression, and this commit implements his suggestion. nfgenmsg->version
> is so far set to zero, so it is well-suited to be used as a flag for
> selecting old or new flush behavior. If version is 0, nfgen_family is
> ignored and all entries are used. If user-space sets the version to one
> (or any other value than 0), then the new behavior is used. As version
> only can have two valid values, I chose not to add a new
> NFNETLINK_VERSION-constant.
> 
> Fixes: 59c08c69c278 ("netfilter: ctnetlink: Support L3 protocol-filter
> on flush")
> 
Please, don't break the fixes line and don't separate it from other tags with an
empty line.

> Reported-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> Suggested-by: Pablo Neira Ayuso <pablo@netfilter.org>
> Signed-off-by: Kristian Evensen <kristian.evensen@gmail.com>
Tested-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] netfilter: ctnetlink: Resolve conntrack L3-protocol flush regression
  2019-05-03 17:02 ` Nicolas Dichtel
@ 2019-05-03 17:05   ` Pablo Neira Ayuso
  2019-05-04 10:57     ` Kristian Evensen
  0 siblings, 1 reply; 11+ messages in thread
From: Pablo Neira Ayuso @ 2019-05-03 17:05 UTC (permalink / raw)
  To: Nicolas Dichtel
  Cc: Kristian Evensen, netdev, netfilter-devel, Florian Westphal,
	David Miller

On Fri, May 03, 2019 at 07:02:54PM +0200, Nicolas Dichtel wrote:
> Please, keep in CC all involved people.
> 
> Le 03/05/2019 à 17:40, Kristian Evensen a écrit :
> > Commit 59c08c69c278 ("netfilter: ctnetlink: Support L3 protocol-filter
> > on flush") introduced a user-space regression when flushing connection
> > track entries. Before this commit, the nfgen_family field was not used
> > by the kernel and all entries were removed. Since this commit,
> > nfgen_family is used to filter out entries that should not be removed.
> > One example a broken tool is conntrack. conntrack always sets
> > nfgen_family to AF_INET, so after 59c08c69c278 only IPv4 entries were
> > removed with the -F parameter.
> > 
> > Pablo Neira Ayuso suggested using nfgenmsg->version to resolve the
> > regression, and this commit implements his suggestion. nfgenmsg->version
> > is so far set to zero, so it is well-suited to be used as a flag for
> > selecting old or new flush behavior. If version is 0, nfgen_family is
> > ignored and all entries are used. If user-space sets the version to one
> > (or any other value than 0), then the new behavior is used. As version
> > only can have two valid values, I chose not to add a new
> > NFNETLINK_VERSION-constant.
> > 
> > Fixes: 59c08c69c278 ("netfilter: ctnetlink: Support L3 protocol-filter
> > on flush")
> > 
> Please, don't break the fixes line and don't separate it from other tags with an
> empty line.

Will fix this before applying, no worries.

> > Reported-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> > Suggested-by: Pablo Neira Ayuso <pablo@netfilter.org>
> > Signed-off-by: Kristian Evensen <kristian.evensen@gmail.com>
> Tested-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] netfilter: ctnetlink: Resolve conntrack L3-protocol flush regression
  2019-05-03 17:05   ` Pablo Neira Ayuso
@ 2019-05-04 10:57     ` Kristian Evensen
  0 siblings, 0 replies; 11+ messages in thread
From: Kristian Evensen @ 2019-05-04 10:57 UTC (permalink / raw)
  To: Pablo Neira Ayuso
  Cc: Nicolas Dichtel, Network Development,
	Netfilter Development Mailing list, Florian Westphal,
	David Miller

On Fri, May 3, 2019 at 7:05 PM Pablo Neira Ayuso <pablo@netfilter.org> wrote:
> Will fix this before applying, no worries.

Thanks for taking care of my mistake :)

BR,
Kristian

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] netfilter: ctnetlink: Resolve conntrack L3-protocol flush regression
  2019-05-03 15:40 [PATCH] netfilter: ctnetlink: Resolve conntrack L3-protocol flush regression Kristian Evensen
  2019-05-03 17:02 ` Nicolas Dichtel
@ 2019-05-05 22:32 ` Pablo Neira Ayuso
  2019-05-06  8:49   ` Nicolas Dichtel
  1 sibling, 1 reply; 11+ messages in thread
From: Pablo Neira Ayuso @ 2019-05-05 22:32 UTC (permalink / raw)
  To: Kristian Evensen; +Cc: netdev, netfilter-devel

On Fri, May 03, 2019 at 05:40:07PM +0200, Kristian Evensen wrote:
> Commit 59c08c69c278 ("netfilter: ctnetlink: Support L3 protocol-filter
> on flush") introduced a user-space regression when flushing connection
> track entries. Before this commit, the nfgen_family field was not used
> by the kernel and all entries were removed. Since this commit,
> nfgen_family is used to filter out entries that should not be removed.
> One example a broken tool is conntrack. conntrack always sets
> nfgen_family to AF_INET, so after 59c08c69c278 only IPv4 entries were
> removed with the -F parameter.
> 
> Pablo Neira Ayuso suggested using nfgenmsg->version to resolve the
> regression, and this commit implements his suggestion. nfgenmsg->version
> is so far set to zero, so it is well-suited to be used as a flag for
> selecting old or new flush behavior. If version is 0, nfgen_family is
> ignored and all entries are used. If user-space sets the version to one
> (or any other value than 0), then the new behavior is used. As version
> only can have two valid values, I chose not to add a new
> NFNETLINK_VERSION-constant.

Applied, thanks.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] netfilter: ctnetlink: Resolve conntrack L3-protocol flush regression
  2019-05-05 22:32 ` Pablo Neira Ayuso
@ 2019-05-06  8:49   ` Nicolas Dichtel
  2019-05-06 13:16     ` Pablo Neira Ayuso
  0 siblings, 1 reply; 11+ messages in thread
From: Nicolas Dichtel @ 2019-05-06  8:49 UTC (permalink / raw)
  To: Pablo Neira Ayuso, Kristian Evensen; +Cc: netdev, netfilter-devel

Le 06/05/2019 à 00:32, Pablo Neira Ayuso a écrit :
> On Fri, May 03, 2019 at 05:40:07PM +0200, Kristian Evensen wrote:
>> Commit 59c08c69c278 ("netfilter: ctnetlink: Support L3 protocol-filter
>> on flush") introduced a user-space regression when flushing connection
>> track entries. Before this commit, the nfgen_family field was not used
>> by the kernel and all entries were removed. Since this commit,
>> nfgen_family is used to filter out entries that should not be removed.
>> One example a broken tool is conntrack. conntrack always sets
>> nfgen_family to AF_INET, so after 59c08c69c278 only IPv4 entries were
>> removed with the -F parameter.
>>
>> Pablo Neira Ayuso suggested using nfgenmsg->version to resolve the
>> regression, and this commit implements his suggestion. nfgenmsg->version
>> is so far set to zero, so it is well-suited to be used as a flag for
>> selecting old or new flush behavior. If version is 0, nfgen_family is
>> ignored and all entries are used. If user-space sets the version to one
>> (or any other value than 0), then the new behavior is used. As version
>> only can have two valid values, I chose not to add a new
>> NFNETLINK_VERSION-constant.
> 
> Applied, thanks.
> 
Thank you.
Is it possible to queue this for stable?


Regards,
Nicolas

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] netfilter: ctnetlink: Resolve conntrack L3-protocol flush regression
  2019-05-06  8:49   ` Nicolas Dichtel
@ 2019-05-06 13:16     ` Pablo Neira Ayuso
  2019-05-20  8:35       ` Nicolas Dichtel
  0 siblings, 1 reply; 11+ messages in thread
From: Pablo Neira Ayuso @ 2019-05-06 13:16 UTC (permalink / raw)
  To: Nicolas Dichtel; +Cc: Kristian Evensen, netdev, netfilter-devel

On Mon, May 06, 2019 at 10:49:52AM +0200, Nicolas Dichtel wrote:
> Le 06/05/2019 à 00:32, Pablo Neira Ayuso a écrit :
> > On Fri, May 03, 2019 at 05:40:07PM +0200, Kristian Evensen wrote:
> >> Commit 59c08c69c278 ("netfilter: ctnetlink: Support L3 protocol-filter
> >> on flush") introduced a user-space regression when flushing connection
> >> track entries. Before this commit, the nfgen_family field was not used
> >> by the kernel and all entries were removed. Since this commit,
> >> nfgen_family is used to filter out entries that should not be removed.
> >> One example a broken tool is conntrack. conntrack always sets
> >> nfgen_family to AF_INET, so after 59c08c69c278 only IPv4 entries were
> >> removed with the -F parameter.
> >>
> >> Pablo Neira Ayuso suggested using nfgenmsg->version to resolve the
> >> regression, and this commit implements his suggestion. nfgenmsg->version
> >> is so far set to zero, so it is well-suited to be used as a flag for
> >> selecting old or new flush behavior. If version is 0, nfgen_family is
> >> ignored and all entries are used. If user-space sets the version to one
> >> (or any other value than 0), then the new behavior is used. As version
> >> only can have two valid values, I chose not to add a new
> >> NFNETLINK_VERSION-constant.
> > 
> > Applied, thanks.
> > 
> Thank you.
> Is it possible to queue this for stable?

Sure, as soon as this hits Linus' tree.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] netfilter: ctnetlink: Resolve conntrack L3-protocol flush regression
  2019-05-06 13:16     ` Pablo Neira Ayuso
@ 2019-05-20  8:35       ` Nicolas Dichtel
  2019-05-24  9:22         ` Pablo Neira Ayuso
  0 siblings, 1 reply; 11+ messages in thread
From: Nicolas Dichtel @ 2019-05-20  8:35 UTC (permalink / raw)
  To: Pablo Neira Ayuso; +Cc: Kristian Evensen, netdev, netfilter-devel

Le 06/05/2019 à 15:16, Pablo Neira Ayuso a écrit :
> On Mon, May 06, 2019 at 10:49:52AM +0200, Nicolas Dichtel wrote:
[snip]
>> Is it possible to queue this for stable?
> 
> Sure, as soon as this hits Linus' tree.
> 
FYI, it's now in Linus tree:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f8e608982022


Thank you,
Nicolas

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] netfilter: ctnetlink: Resolve conntrack L3-protocol flush regression
  2019-05-20  8:35       ` Nicolas Dichtel
@ 2019-05-24  9:22         ` Pablo Neira Ayuso
  2019-05-28 13:57           ` Nicolas Dichtel
  0 siblings, 1 reply; 11+ messages in thread
From: Pablo Neira Ayuso @ 2019-05-24  9:22 UTC (permalink / raw)
  To: Nicolas Dichtel; +Cc: Kristian Evensen, netdev, netfilter-devel

On Mon, May 20, 2019 at 10:35:07AM +0200, Nicolas Dichtel wrote:
> Le 06/05/2019 à 15:16, Pablo Neira Ayuso a écrit :
> > On Mon, May 06, 2019 at 10:49:52AM +0200, Nicolas Dichtel wrote:
> [snip]
> >> Is it possible to queue this for stable?
> > 
> > Sure, as soon as this hits Linus' tree.
> > 
> FYI, it's now in Linus tree:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f8e608982022

Please, send an email requesting this to stable@vger.kernel.org and
keep me on CC.

I'll ACK it.

Thanks.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] netfilter: ctnetlink: Resolve conntrack L3-protocol flush regression
  2019-05-24  9:22         ` Pablo Neira Ayuso
@ 2019-05-28 13:57           ` Nicolas Dichtel
  2019-05-28 22:59             ` Greg KH
  0 siblings, 1 reply; 11+ messages in thread
From: Nicolas Dichtel @ 2019-05-28 13:57 UTC (permalink / raw)
  To: stable; +Cc: Pablo Neira Ayuso, Kristian Evensen, netdev, netfilter-devel

Le 24/05/2019 à 11:22, Pablo Neira Ayuso a écrit :
> On Mon, May 20, 2019 at 10:35:07AM +0200, Nicolas Dichtel wrote:
>> Le 06/05/2019 à 15:16, Pablo Neira Ayuso a écrit :
>>> On Mon, May 06, 2019 at 10:49:52AM +0200, Nicolas Dichtel wrote:
>> [snip]
>>>> Is it possible to queue this for stable?
>>>
>>> Sure, as soon as this hits Linus' tree.
>>>
>> FYI, it's now in Linus tree:
>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f8e608982022
> 
> Please, send an email requesting this to stable@vger.kernel.org and
> keep me on CC.
This is a request to backport the upstream commit f8e608982022 ("netfilter:
ctnetlink: Resolve conntrack L3-protocol flush regression") in stable trees.


Thank you,
Nicolas

> 
> I'll ACK it.
> 
> Thanks.
> 

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] netfilter: ctnetlink: Resolve conntrack L3-protocol flush regression
  2019-05-28 13:57           ` Nicolas Dichtel
@ 2019-05-28 22:59             ` Greg KH
  0 siblings, 0 replies; 11+ messages in thread
From: Greg KH @ 2019-05-28 22:59 UTC (permalink / raw)
  To: Nicolas Dichtel
  Cc: stable, Pablo Neira Ayuso, Kristian Evensen, netdev, netfilter-devel

On Tue, May 28, 2019 at 03:57:37PM +0200, Nicolas Dichtel wrote:
> Le 24/05/2019 à 11:22, Pablo Neira Ayuso a écrit :
> > On Mon, May 20, 2019 at 10:35:07AM +0200, Nicolas Dichtel wrote:
> >> Le 06/05/2019 à 15:16, Pablo Neira Ayuso a écrit :
> >>> On Mon, May 06, 2019 at 10:49:52AM +0200, Nicolas Dichtel wrote:
> >> [snip]
> >>>> Is it possible to queue this for stable?
> >>>
> >>> Sure, as soon as this hits Linus' tree.
> >>>
> >> FYI, it's now in Linus tree:
> >> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f8e608982022
> > 
> > Please, send an email requesting this to stable@vger.kernel.org and
> > keep me on CC.
> This is a request to backport the upstream commit f8e608982022 ("netfilter:
> ctnetlink: Resolve conntrack L3-protocol flush regression") in stable trees.

Now queued up, thanks.

greg k-h

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2019-05-28 22:59 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-03 15:40 [PATCH] netfilter: ctnetlink: Resolve conntrack L3-protocol flush regression Kristian Evensen
2019-05-03 17:02 ` Nicolas Dichtel
2019-05-03 17:05   ` Pablo Neira Ayuso
2019-05-04 10:57     ` Kristian Evensen
2019-05-05 22:32 ` Pablo Neira Ayuso
2019-05-06  8:49   ` Nicolas Dichtel
2019-05-06 13:16     ` Pablo Neira Ayuso
2019-05-20  8:35       ` Nicolas Dichtel
2019-05-24  9:22         ` Pablo Neira Ayuso
2019-05-28 13:57           ` Nicolas Dichtel
2019-05-28 22:59             ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).