aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/netfilter/nf_conntrack_helper.h
diff options
context:
space:
mode:
authorFlorian Westphal <fw@strlen.de>2017-04-16 01:29:15 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2017-04-19 17:55:16 +0200
commitdcf67740f22d31be685d7172f05b289c8243ea12 (patch)
treee7f9efc1a8a7a1115b15ce1a1576ffa4f58a0c9c /include/net/netfilter/nf_conntrack_helper.h
parentnetfilter: conntrack: move helper struct to nf_conntrack_helper.h (diff)
downloadlinux-dev-dcf67740f22d31be685d7172f05b289c8243ea12.tar.xz
linux-dev-dcf67740f22d31be685d7172f05b289c8243ea12.zip
netfilter: helper: add build-time asserts for helper data size
add a 32 byte scratch area in the helper struct instead of relying on variable sized helpers plus compile-time asserts to let us know if 32 bytes aren't enough anymore. Not having variable sized helpers will later allow to add BUILD_BUG_ON for the total size of conntrack extensions -- the helper extension is the only one that doesn't have a fixed size. The (useless!) NF_CT_HELPER_BUILD_BUG_ON(0); are added so that in case someone adds a new helper and copy-pastes from one that doesn't store private data at least some indication that this macro should be used somehow is there... Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'include/net/netfilter/nf_conntrack_helper.h')
-rw-r--r--include/net/netfilter/nf_conntrack_helper.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/include/net/netfilter/nf_conntrack_helper.h b/include/net/netfilter/nf_conntrack_helper.h
index 15d746558665..29539ed1008f 100644
--- a/include/net/netfilter/nf_conntrack_helper.h
+++ b/include/net/netfilter/nf_conntrack_helper.h
@@ -66,9 +66,12 @@ struct nf_conn_help {
u8 expecting[NF_CT_MAX_EXPECT_CLASSES];
/* private helper information. */
- char data[];
+ char data[32] __aligned(8);
};
+#define NF_CT_HELPER_BUILD_BUG_ON(structsize) \
+ BUILD_BUG_ON((structsize) > FIELD_SIZEOF(struct nf_conn_help, data))
+
struct nf_conntrack_helper *__nf_conntrack_helper_find(const char *name,
u16 l3num, u8 protonum);