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
56 CTA_LABELS_MASK,56 CTA_LABELS_MASK,
57 CTA_SYNPROXY,57 CTA_SYNPROXY,
58 CTA_FILTER,58 CTA_FILTER,
59 CTA_STATUS_MASK,
59 __CTA_MAX60 __CTA_MAX
60};61};
61#define CTA_MAX (__CTA_MAX - 1)62#define CTA_MAX (__CTA_MAX - 1)