History

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.

Florian Westphal committed 5 years ago

Commit 93449881 parent ff1199d2 files · +34 −1Browse files

Showing the changes to include/uapi (1 of 2 files). Show all

Unified · Split

include/uapi/linux/netfilter/nfnetlink_conntrack.h+1−0
@@ -56,6 +56,7 @@ enum ctattr_type { · 55 unmodified lines
5656 CTA_LABELS_MASK,
5757 CTA_SYNPROXY,
5858 CTA_FILTER,
59+ CTA_STATUS_MASK,
5960 __CTA_MAX
6061 };
6162 #define CTA_MAX (__CTA_MAX - 1)