summaryrefslogtreecommitdiff
path: root/net/netfilter/nft_set_pipapo.h
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2023-10-18 22:23:07 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2023-10-24 13:16:30 +0200
commit9dad402b89e81a0516bad5e0ac009b7a0a80898f (patch)
tree81dafe42dc001052ca13f89ab8e8c1f6a864b79d /net/netfilter/nft_set_pipapo.h
parent6509a2e410c3cb36c78a0a85c6102debe171337e (diff)
netfilter: nf_tables: expose opaque set element as struct nft_elem_priv
Add placeholder structure and place it at the beginning of each struct nft_*_elem for each existing set backend, instead of exposing elements as void type to the frontend which defeats compiler type checks. Use this pointer to this new type to replace void *. This patch updates the following set backend API to use this new struct nft_elem_priv placeholder structure: - update - deactivate - flush - get as well as the following helper functions: - nft_set_elem_ext() - nft_set_elem_init() - nft_set_elem_destroy() - nf_tables_set_elem_destroy() This patch adds nft_elem_priv_cast() to cast struct nft_elem_priv to native element representation from the corresponding set backend. BUILD_BUG_ON() makes sure this .priv placeholder is always at the top of the opaque set element representation. Suggested-by: Florian Westphal <fw@strlen.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net/netfilter/nft_set_pipapo.h')
-rw-r--r--net/netfilter/nft_set_pipapo.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/net/netfilter/nft_set_pipapo.h b/net/netfilter/nft_set_pipapo.h
index 2e164a319945..1040223da5fa 100644
--- a/net/netfilter/nft_set_pipapo.h
+++ b/net/netfilter/nft_set_pipapo.h
@@ -170,10 +170,12 @@ struct nft_pipapo_elem;
/**
* struct nft_pipapo_elem - API-facing representation of single set element
+ * @priv: element placeholder
* @ext: nftables API extensions
*/
struct nft_pipapo_elem {
- struct nft_set_ext ext;
+ struct nft_elem_priv priv;
+ struct nft_set_ext ext;
};
int pipapo_refill(unsigned long *map, int len, int rules, unsigned long *dst,