Commit 01026ede authored by Florian Westphal's avatar Florian Westphal Committed by Pablo Neira Ayuso

nefilter: eache: reduce struct size from 32 to 24 byte

Only "cache" needs to use ulong (its used with set_bit()), missed can use
u16.  Also add build-time assertion to ensure event bits fit.
Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent c6dd940b
...@@ -20,11 +20,11 @@ enum nf_ct_ecache_state { ...@@ -20,11 +20,11 @@ enum nf_ct_ecache_state {
struct nf_conntrack_ecache { struct nf_conntrack_ecache {
unsigned long cache; /* bitops want long */ unsigned long cache; /* bitops want long */
unsigned long missed; /* missed events */ u16 missed; /* missed events */
u16 ctmask; /* bitmask of ct events to be delivered */ u16 ctmask; /* bitmask of ct events to be delivered */
u16 expmask; /* bitmask of expect events to be delivered */ u16 expmask; /* bitmask of expect events to be delivered */
enum nf_ct_ecache_state state:8;/* ecache state */
u32 portid; /* netlink portid of destroyer */ u32 portid; /* netlink portid of destroyer */
enum nf_ct_ecache_state state; /* ecache state */
}; };
static inline struct nf_conntrack_ecache * static inline struct nf_conntrack_ecache *
......
...@@ -119,6 +119,9 @@ enum ip_conntrack_events { ...@@ -119,6 +119,9 @@ enum ip_conntrack_events {
IPCT_NATSEQADJ = IPCT_SEQADJ, IPCT_NATSEQADJ = IPCT_SEQADJ,
IPCT_SECMARK, /* new security mark has been set */ IPCT_SECMARK, /* new security mark has been set */
IPCT_LABEL, /* new connlabel has been set */ IPCT_LABEL, /* new connlabel has been set */
#ifdef __KERNEL__
__IPCT_MAX
#endif
}; };
enum ip_conntrack_expect_events { enum ip_conntrack_expect_events {
......
...@@ -420,6 +420,9 @@ int nf_conntrack_ecache_init(void) ...@@ -420,6 +420,9 @@ int nf_conntrack_ecache_init(void)
int ret = nf_ct_extend_register(&event_extend); int ret = nf_ct_extend_register(&event_extend);
if (ret < 0) if (ret < 0)
pr_err("nf_ct_event: Unable to register event extension.\n"); pr_err("nf_ct_event: Unable to register event extension.\n");
BUILD_BUG_ON(__IPCT_MAX >= 16); /* ctmask, missed use u16 */
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment