netfilter: ctnetlink: Resolve conntrack L3-protocol flush regression
Subsystems (4)
PATCH 1/1 netfilter: ctnetlink: Resolve conntrack L3-protocol flush regression
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.
on flush")
--- net/netfilter/nf_conntrack_netlink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/nf_conntrack_netlink.c +1 -1
@@ -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;
Signature · 1 line
2.19.1
Please, keep in CC all involved people.
Le 03/05/2019 à 17:40, Kristian Evensen a écrit :
Quoted 18 lines
Commit
59c08c69c278("netfilter: ctnetlink: Support L3 protocol-filter on flush") introduced a user-space regression when flushing connection track entries. Before this commit, thenfgen_familyfield was not used by the kernel and all entries were removed. Since this commit,nfgen_familyis used to filter out entries that should not be removed. One example a broken tool is conntrack. conntrack always setsnfgen_familytoAF_INET, so after59c08c69c278only IPv4 entries were removed with the -F parameter.Pablo Neira Ayuso suggested using
nfgenmsg->versionto resolve the regression, and this commit implements his suggestion.nfgenmsg->versionis 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_familyis 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.
Quoted 3 lines
Fixes 59c08c69c278 ("netfilter: ctnetlink: Support L3 protocol-filteron flush")
Please, don't break the fixes line and don't separate it from other tags with an empty line.
Quoted 3 lines
Reported-by Nicolas Dichtel <[email protected]>Suggested-by Pablo Neira Ayuso <[email protected]>Signed-off-by Kristian Evensen <[email protected]>
Pablo Neira Ayuso
maintainerQuoted 21 lines · Nicolas Dichtel
Please, keep in CC all involved people.
Le 03/05/2019 à 17:40, Kristian Evensen a écrit :
Quoted 18 lines
Commit
59c08c69c278("netfilter: ctnetlink: Support L3 protocol-filter on flush") introduced a user-space regression when flushing connection track entries. Before this commit, thenfgen_familyfield was not used by the kernel and all entries were removed. Since this commit,nfgen_familyis used to filter out entries that should not be removed. One example a broken tool is conntrack. conntrack always setsnfgen_familytoAF_INET, so after59c08c69c278only IPv4 entries were removed with the -F parameter.Pablo Neira Ayuso suggested using
nfgenmsg->versionto resolve the regression, and this commit implements his suggestion.nfgenmsg->versionis 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_familyis 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.
Quoted 5 lines
Quoted 3 lines
Fixes 59c08c69c278 ("netfilter: ctnetlink: Support L3 protocol-filteron 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.
Quoted 4 lines
Quoted 3 lines
Reported-by Nicolas Dichtel <[email protected]>Suggested-by Pablo Neira Ayuso <[email protected]>Signed-off-by Kristian Evensen <[email protected]>Tested-by Nicolas Dichtel <[email protected]>
Quoted 1 line · Pablo Neira Ayuso
Will fix this before applying, no worries.
Thanks for taking care of my mistake :)
BR,
Kristian
Quoted 9 lines · 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, thenfgen_familyfield was not used by the kernel and all entries were removed. Since this commit,nfgen_familyis used to filter out entries that should not be removed. One example a broken tool is conntrack. conntrack always setsnfgen_familytoAF_INET, so after59c08c69c278only IPv4 entries were removed with the -F parameter.
Quoted 8 lines
Pablo Neira Ayuso suggested using
nfgenmsg->versionto resolve the regression, and this commit implements his suggestion.nfgenmsg->versionis 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_familyis 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.
Le 06/05/2019 à 00:32, Pablo Neira Ayuso a écrit :
Quoted 19 lines · Kristian Evensen
Quoted 9 lines
Commit
59c08c69c278("netfilter: ctnetlink: Support L3 protocol-filter on flush") introduced a user-space regression when flushing connection track entries. Before this commit, thenfgen_familyfield was not used by the kernel and all entries were removed. Since this commit,nfgen_familyis used to filter out entries that should not be removed. One example a broken tool is conntrack. conntrack always setsnfgen_familytoAF_INET, so after59c08c69c278only IPv4 entries were removed with the -F parameter.Quoted 8 lines
Pablo Neira Ayuso suggested using
nfgenmsg->versionto resolve the regression, and this commit implements his suggestion.nfgenmsg->versionis 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_familyis 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.
Quoted 2 lines
Applied, thanks.
Thank you.
Is it possible to queue this for stable?
Regards,
Nicolas
Pablo Neira Ayuso
maintainerQuoted 20 lines · Nicolas Dichtel
Le 06/05/2019 à 00:32, Pablo Neira Ayuso a écrit :
Quoted 19 lines · Kristian Evensen
Quoted 17 lines
Commit
59c08c69c278("netfilter: ctnetlink: Support L3 protocol-filter on flush") introduced a user-space regression when flushing connection track entries. Before this commit, thenfgen_familyfield was not used by the kernel and all entries were removed. Since this commit,nfgen_familyis used to filter out entries that should not be removed. One example a broken tool is conntrack. conntrack always setsnfgen_familytoAF_INET, so after59c08c69c278only IPv4 entries were removed with the -F parameter.Pablo Neira Ayuso suggested using
nfgenmsg->versionto resolve the regression, and this commit implements his suggestion.nfgenmsg->versionis 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_familyis 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.
Quoted 4 lines
Quoted 2 lines
Applied, thanks.
Thank you.
Is it possible to queue this for stable?
Sure, as soon as this hits Linus' tree.
Le 06/05/2019 à 15:16, Pablo Neira Ayuso a écrit :
Quoted 1 line · Nicolas Dichtel
[snip]
Quoted 4 lines
Quoted 1 line
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
Pablo Neira Ayuso
maintainerQuoted 9 lines · Nicolas Dichtel
Le 06/05/2019 à 15:16, Pablo Neira Ayuso a écrit :
Quoted 1 line · Nicolas Dichtel
[snip]
Quoted 4 lines
Quoted 1 line
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 [email protected] and keep me on CC.
I'll ACK it.
Thanks.
Le 24/05/2019 à 11:22, Pablo Neira Ayuso a écrit :
Quoted 6 lines · Nicolas Dichtel
Quoted 5 lines
Le 06/05/2019 à 15:16, Pablo Neira Ayuso a écrit :
Quoted 1 line · Nicolas Dichtel
[snip]
Quoted 2 lines
Quoted 1 line
Is it possible to queue this for stable?
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
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=f8e608982022Please, send an email requesting this to [email protected] 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
Quoted 5 lines
I'll ACK it.
Thanks.
Greg KH
maintainerQuoted 9 lines · Nicolas Dichtel
Le 24/05/2019 à 11:22, Pablo Neira Ayuso a écrit :
Quoted 8 lines · Nicolas Dichtel
Quoted 7 lines
Le 06/05/2019 à 15:16, Pablo Neira Ayuso a écrit :
Quoted 1 line · Nicolas Dichtel
[snip]
Quoted 4 lines
Quoted 1 line
Is it possible to queue this for stable?
Sure, as soon as this hits Linus' tree.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
FYI, it's now in Linus tree:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f8e608982022Please, send an email requesting this to [email protected] 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