netfilter: annotate nf_tables base hook ops
This will allow a followup patch to treat the 'ops->priv' pointer as nft_chain argument without having to first walk the table/chains to check if there is a matching base chain pointer. Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
This commit is contained in:
parent
1d91d2e1a7
commit
7b4b2fa375
2 changed files with 10 additions and 2 deletions
|
@ -77,12 +77,18 @@ struct nf_hook_state {
|
||||||
typedef unsigned int nf_hookfn(void *priv,
|
typedef unsigned int nf_hookfn(void *priv,
|
||||||
struct sk_buff *skb,
|
struct sk_buff *skb,
|
||||||
const struct nf_hook_state *state);
|
const struct nf_hook_state *state);
|
||||||
|
enum nf_hook_ops_type {
|
||||||
|
NF_HOOK_OP_UNDEFINED,
|
||||||
|
NF_HOOK_OP_NF_TABLES,
|
||||||
|
};
|
||||||
|
|
||||||
struct nf_hook_ops {
|
struct nf_hook_ops {
|
||||||
/* User fills in from here down. */
|
/* User fills in from here down. */
|
||||||
nf_hookfn *hook;
|
nf_hookfn *hook;
|
||||||
struct net_device *dev;
|
struct net_device *dev;
|
||||||
void *priv;
|
void *priv;
|
||||||
u_int8_t pf;
|
u8 pf;
|
||||||
|
enum nf_hook_ops_type hook_ops_type:8;
|
||||||
unsigned int hooknum;
|
unsigned int hooknum;
|
||||||
/* Hooks are ordered in ascending priority. */
|
/* Hooks are ordered in ascending priority. */
|
||||||
int priority;
|
int priority;
|
||||||
|
|
|
@ -2168,8 +2168,10 @@ static int nf_tables_addchain(struct nft_ctx *ctx, u8 family, u8 genmask,
|
||||||
}
|
}
|
||||||
|
|
||||||
nft_trans_chain_policy(trans) = NFT_CHAIN_POLICY_UNSET;
|
nft_trans_chain_policy(trans) = NFT_CHAIN_POLICY_UNSET;
|
||||||
if (nft_is_base_chain(chain))
|
if (nft_is_base_chain(chain)) {
|
||||||
|
basechain->ops.hook_ops_type = NF_HOOK_OP_NF_TABLES;
|
||||||
nft_trans_chain_policy(trans) = policy;
|
nft_trans_chain_policy(trans) = policy;
|
||||||
|
}
|
||||||
|
|
||||||
err = nft_chain_add(table, chain);
|
err = nft_chain_add(table, chain);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue