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

Commit d1c85c2e authored by Zhouyi Zhou's avatar Zhouyi Zhou Committed by Pablo Neira Ayuso
Browse files

netfilter: HAVE_JUMP_LABEL instead of CONFIG_JUMP_LABEL



Use HAVE_JUMP_LABEL as elsewhere in the kernel to ensure
that the toolchain has the required support in addition to
CONFIG_JUMP_LABEL being set.

Signed-off-by: default avatarZhouyi Zhou <yizhouzhou@ict.ac.cn>
Reviewed-by: default avatarFlorian Westphal <fw@strlen.de>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent 1e8430f3
Loading
Loading
Loading
Loading
+3 −2
Original line number Original line Diff line number Diff line
@@ -9,6 +9,7 @@
#include <linux/in6.h>
#include <linux/in6.h>
#include <linux/wait.h>
#include <linux/wait.h>
#include <linux/list.h>
#include <linux/list.h>
#include <linux/static_key.h>
#include <uapi/linux/netfilter.h>
#include <uapi/linux/netfilter.h>
#ifdef CONFIG_NETFILTER
#ifdef CONFIG_NETFILTER
static inline int NF_DROP_GETERR(int verdict)
static inline int NF_DROP_GETERR(int verdict)
@@ -99,9 +100,9 @@ void nf_unregister_sockopt(struct nf_sockopt_ops *reg);


extern struct list_head nf_hooks[NFPROTO_NUMPROTO][NF_MAX_HOOKS];
extern struct list_head nf_hooks[NFPROTO_NUMPROTO][NF_MAX_HOOKS];


#if defined(CONFIG_JUMP_LABEL)
#ifdef HAVE_JUMP_LABEL
#include <linux/static_key.h>
extern struct static_key nf_hooks_needed[NFPROTO_NUMPROTO][NF_MAX_HOOKS];
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_hooks_active(u_int8_t pf, unsigned int hook)
{
{
	if (__builtin_constant_p(pf) &&
	if (__builtin_constant_p(pf) &&
+3 −3
Original line number Original line Diff line number Diff line
@@ -54,7 +54,7 @@ EXPORT_SYMBOL_GPL(nf_unregister_afinfo);
struct list_head nf_hooks[NFPROTO_NUMPROTO][NF_MAX_HOOKS] __read_mostly;
struct list_head nf_hooks[NFPROTO_NUMPROTO][NF_MAX_HOOKS] __read_mostly;
EXPORT_SYMBOL(nf_hooks);
EXPORT_SYMBOL(nf_hooks);


#if defined(CONFIG_JUMP_LABEL)
#ifdef HAVE_JUMP_LABEL
struct static_key nf_hooks_needed[NFPROTO_NUMPROTO][NF_MAX_HOOKS];
struct static_key nf_hooks_needed[NFPROTO_NUMPROTO][NF_MAX_HOOKS];
EXPORT_SYMBOL(nf_hooks_needed);
EXPORT_SYMBOL(nf_hooks_needed);
#endif
#endif
@@ -72,7 +72,7 @@ int nf_register_hook(struct nf_hook_ops *reg)
	}
	}
	list_add_rcu(&reg->list, elem->list.prev);
	list_add_rcu(&reg->list, elem->list.prev);
	mutex_unlock(&nf_hook_mutex);
	mutex_unlock(&nf_hook_mutex);
#if defined(CONFIG_JUMP_LABEL)
#ifdef HAVE_JUMP_LABEL
	static_key_slow_inc(&nf_hooks_needed[reg->pf][reg->hooknum]);
	static_key_slow_inc(&nf_hooks_needed[reg->pf][reg->hooknum]);
#endif
#endif
	return 0;
	return 0;
@@ -84,7 +84,7 @@ void nf_unregister_hook(struct nf_hook_ops *reg)
	mutex_lock(&nf_hook_mutex);
	mutex_lock(&nf_hook_mutex);
	list_del_rcu(&reg->list);
	list_del_rcu(&reg->list);
	mutex_unlock(&nf_hook_mutex);
	mutex_unlock(&nf_hook_mutex);
#if defined(CONFIG_JUMP_LABEL)
#ifdef HAVE_JUMP_LABEL
	static_key_slow_dec(&nf_hooks_needed[reg->pf][reg->hooknum]);
	static_key_slow_dec(&nf_hooks_needed[reg->pf][reg->hooknum]);
#endif
#endif
	synchronize_net();
	synchronize_net();