diff options
author | Zhouyi Zhou <zhouzhouyi@gmail.com> | 2014-08-21 22:40:15 -0400 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2014-08-25 04:45:28 -0400 |
commit | d1c85c2ebe7ffe1f1b27846bd1ba0944c513d822 (patch) | |
tree | 453ec7871afc5de44b46fb3be68967d5f000133d | |
parent | 1e8430f30b55a1f3f6925c9f37f8cc9afd141d2e (diff) |
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: Zhouyi Zhou <yizhouzhou@ict.ac.cn>
Reviewed-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-rw-r--r-- | include/linux/netfilter.h | 5 | ||||
-rw-r--r-- | net/netfilter/core.c | 6 |
2 files changed, 6 insertions, 5 deletions
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h index 2077489f9887..2517ece98820 100644 --- a/include/linux/netfilter.h +++ b/include/linux/netfilter.h | |||
@@ -9,6 +9,7 @@ | |||
9 | #include <linux/in6.h> | 9 | #include <linux/in6.h> |
10 | #include <linux/wait.h> | 10 | #include <linux/wait.h> |
11 | #include <linux/list.h> | 11 | #include <linux/list.h> |
12 | #include <linux/static_key.h> | ||
12 | #include <uapi/linux/netfilter.h> | 13 | #include <uapi/linux/netfilter.h> |
13 | #ifdef CONFIG_NETFILTER | 14 | #ifdef CONFIG_NETFILTER |
14 | static inline int NF_DROP_GETERR(int verdict) | 15 | static inline int NF_DROP_GETERR(int verdict) |
@@ -99,9 +100,9 @@ void nf_unregister_sockopt(struct nf_sockopt_ops *reg); | |||
99 | 100 | ||
100 | extern struct list_head nf_hooks[NFPROTO_NUMPROTO][NF_MAX_HOOKS]; | 101 | extern struct list_head nf_hooks[NFPROTO_NUMPROTO][NF_MAX_HOOKS]; |
101 | 102 | ||
102 | #if defined(CONFIG_JUMP_LABEL) | 103 | #ifdef HAVE_JUMP_LABEL |
103 | #include <linux/static_key.h> | ||
104 | extern struct static_key nf_hooks_needed[NFPROTO_NUMPROTO][NF_MAX_HOOKS]; | 104 | extern struct static_key nf_hooks_needed[NFPROTO_NUMPROTO][NF_MAX_HOOKS]; |
105 | |||
105 | static inline bool nf_hooks_active(u_int8_t pf, unsigned int hook) | 106 | static inline bool nf_hooks_active(u_int8_t pf, unsigned int hook) |
106 | { | 107 | { |
107 | if (__builtin_constant_p(pf) && | 108 | if (__builtin_constant_p(pf) && |
diff --git a/net/netfilter/core.c b/net/netfilter/core.c index a93c97f106d4..024a2e25c8a4 100644 --- a/net/netfilter/core.c +++ b/net/netfilter/core.c | |||
@@ -54,7 +54,7 @@ EXPORT_SYMBOL_GPL(nf_unregister_afinfo); | |||
54 | struct list_head nf_hooks[NFPROTO_NUMPROTO][NF_MAX_HOOKS] __read_mostly; | 54 | struct list_head nf_hooks[NFPROTO_NUMPROTO][NF_MAX_HOOKS] __read_mostly; |
55 | EXPORT_SYMBOL(nf_hooks); | 55 | EXPORT_SYMBOL(nf_hooks); |
56 | 56 | ||
57 | #if defined(CONFIG_JUMP_LABEL) | 57 | #ifdef HAVE_JUMP_LABEL |
58 | struct static_key nf_hooks_needed[NFPROTO_NUMPROTO][NF_MAX_HOOKS]; | 58 | struct static_key nf_hooks_needed[NFPROTO_NUMPROTO][NF_MAX_HOOKS]; |
59 | EXPORT_SYMBOL(nf_hooks_needed); | 59 | EXPORT_SYMBOL(nf_hooks_needed); |
60 | #endif | 60 | #endif |
@@ -72,7 +72,7 @@ int nf_register_hook(struct nf_hook_ops *reg) | |||
72 | } | 72 | } |
73 | list_add_rcu(®->list, elem->list.prev); | 73 | list_add_rcu(®->list, elem->list.prev); |
74 | mutex_unlock(&nf_hook_mutex); | 74 | mutex_unlock(&nf_hook_mutex); |
75 | #if defined(CONFIG_JUMP_LABEL) | 75 | #ifdef HAVE_JUMP_LABEL |
76 | static_key_slow_inc(&nf_hooks_needed[reg->pf][reg->hooknum]); | 76 | static_key_slow_inc(&nf_hooks_needed[reg->pf][reg->hooknum]); |
77 | #endif | 77 | #endif |
78 | return 0; | 78 | return 0; |
@@ -84,7 +84,7 @@ void nf_unregister_hook(struct nf_hook_ops *reg) | |||
84 | mutex_lock(&nf_hook_mutex); | 84 | mutex_lock(&nf_hook_mutex); |
85 | list_del_rcu(®->list); | 85 | list_del_rcu(®->list); |
86 | mutex_unlock(&nf_hook_mutex); | 86 | mutex_unlock(&nf_hook_mutex); |
87 | #if defined(CONFIG_JUMP_LABEL) | 87 | #ifdef HAVE_JUMP_LABEL |
88 | static_key_slow_dec(&nf_hooks_needed[reg->pf][reg->hooknum]); | 88 | static_key_slow_dec(&nf_hooks_needed[reg->pf][reg->hooknum]); |
89 | #endif | 89 | #endif |
90 | synchronize_net(); | 90 | synchronize_net(); |