Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b8d0aad0 authored by Pablo Neira's avatar Pablo Neira Committed by David S. Miller
Browse files

netfilter: add nf_hook_list_active()



In preparation to have netfilter ingress per-device hook list.

Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f7191483
Loading
Loading
Loading
Loading
+12 −5
Original line number Diff line number Diff line
@@ -134,21 +134,28 @@ extern struct list_head nf_hooks[NFPROTO_NUMPROTO][NF_MAX_HOOKS];
#ifdef HAVE_JUMP_LABEL
extern struct static_key nf_hooks_needed[NFPROTO_NUMPROTO][NF_MAX_HOOKS];

static inline bool nf_hooks_active(u_int8_t pf, unsigned int hook)
static inline bool nf_hook_list_active(struct list_head *nf_hook_list,
				       u_int8_t pf, unsigned int hook)
{
	if (__builtin_constant_p(pf) &&
	    __builtin_constant_p(hook))
		return static_key_false(&nf_hooks_needed[pf][hook]);

	return !list_empty(&nf_hooks[pf][hook]);
	return !list_empty(nf_hook_list);
}
#else
static inline bool nf_hooks_active(u_int8_t pf, unsigned int hook)
static inline bool nf_hook_list_active(struct list_head *nf_hook_list,
				       u_int8_t pf, unsigned int hook)
{
	return !list_empty(&nf_hooks[pf][hook]);
	return !list_empty(nf_hook_list);
}
#endif

static inline bool nf_hooks_active(u_int8_t pf, unsigned int hook)
{
	return nf_hook_list_active(&nf_hooks[pf][hook], pf, hook);
}

int nf_hook_slow(struct sk_buff *skb, struct nf_hook_state *state);

/**