diff options
author | Florian Westphal <fw@strlen.de> | 2012-05-10 18:11:54 -0400 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2012-05-16 18:56:31 -0400 |
commit | 1f27e2516c1d95ae19024bec5be68a3f489cc47e (patch) | |
tree | 9eeb1a8d5b8248ec36602198aeafaf9e07e7fcc5 /include/linux | |
parent | 6d8823db422ae6719c7840fe11f737a40ffe4993 (diff) |
netfilter: xt_hashlimit: use _ALL macro to reject unknown flag bits
David Miller says:
The canonical way to validate if the set bits are in a valid
range is to have a "_ALL" macro, and test:
if (val & ~XT_HASHLIMIT_ALL)
goto err;"
make it so.
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/netfilter/xt_hashlimit.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/include/linux/netfilter/xt_hashlimit.h b/include/linux/netfilter/xt_hashlimit.h index 05fe7993dd76..c42e52f39f8f 100644 --- a/include/linux/netfilter/xt_hashlimit.h +++ b/include/linux/netfilter/xt_hashlimit.h | |||
@@ -22,10 +22,12 @@ enum { | |||
22 | XT_HASHLIMIT_HASH_SPT = 1 << 3, | 22 | XT_HASHLIMIT_HASH_SPT = 1 << 3, |
23 | XT_HASHLIMIT_INVERT = 1 << 4, | 23 | XT_HASHLIMIT_INVERT = 1 << 4, |
24 | XT_HASHLIMIT_BYTES = 1 << 5, | 24 | XT_HASHLIMIT_BYTES = 1 << 5, |
25 | }; | ||
25 | #ifdef __KERNEL__ | 26 | #ifdef __KERNEL__ |
26 | XT_HASHLIMIT_MAX = 1 << 6, | 27 | #define XT_HASHLIMIT_ALL (XT_HASHLIMIT_HASH_DIP | XT_HASHLIMIT_HASH_DPT | \ |
28 | XT_HASHLIMIT_HASH_SIP | XT_HASHLIMIT_HASH_SPT | \ | ||
29 | XT_HASHLIMIT_INVERT | XT_HASHLIMIT_BYTES) | ||
27 | #endif | 30 | #endif |
28 | }; | ||
29 | 31 | ||
30 | struct hashlimit_cfg { | 32 | struct hashlimit_cfg { |
31 | __u32 mode; /* bitmask of XT_HASHLIMIT_HASH_* */ | 33 | __u32 mode; /* bitmask of XT_HASHLIMIT_HASH_* */ |