]> git.baikalelectronics.ru Git - kernel.git/commit
netfilter: ctnetlink: allow to filter dump by status bits
authorFlorian Westphal <fw@strlen.de>
Fri, 30 Jul 2021 13:14:22 +0000 (15:14 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Thu, 5 Aug 2021 11:36:39 +0000 (13:36 +0200)
commitdb1165a4bdcc0b05dae2eac2a10cf83bb5c9d6d9
treeb99cd41bb9628a98b4993532d88eeaf1d8360ab2
parentbef5c86f4cc2dfe0c3600b22f65d51d1608f333d
netfilter: ctnetlink: allow to filter dump by status bits

If CTA_STATUS is present, but CTA_STATUS_MASK is not, then the
mask is automatically set to 'status', so that kernel returns those
entries that have all of the requested bits set.

This makes more sense than using a all-one mask since we'd hardly
ever find a match.

There are no other checks for status bits, so if e.g. userspace
sets impossible combinations it will get an empty dump.

If kernel would reject unknown status bits, then a program that works on
a future kernel that has IPS_FOO bit fails on old kernels.

Same for 'impossible' combinations:

Kernel never sets ASSURED without first having set SEEN_REPLY, but its
possible that a future kernel could do so.

Therefore no sanity tests other than a 0-mask.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
include/uapi/linux/netfilter/nfnetlink_conntrack.h
net/netfilter/nf_conntrack_netlink.c