#ifdef HAVE_JUMP_LABEL
extern struct static_key nf_hooks_needed[NFPROTO_NUMPROTO][NF_MAX_HOOKS];
-static inline bool nf_hook_list_active(struct list_head *nf_hook_list,
+static inline bool nf_hook_list_active(struct list_head *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_hook_list);
+ return !list_empty(hook_list);
}
#else
-static inline bool nf_hook_list_active(struct list_head *nf_hook_list,
+static inline bool nf_hook_list_active(struct list_head *hook_list,
u_int8_t pf, unsigned int hook)
{
- return !list_empty(nf_hook_list);
+ return !list_empty(hook_list);
}
#endif
int thresh)
{
struct net *net = dev_net(indev ? indev : outdev);
- struct list_head *nf_hook_list = &net->nf.hooks[pf][hook];
+ struct list_head *hook_list = &net->nf.hooks[pf][hook];
- if (nf_hook_list_active(nf_hook_list, pf, hook)) {
+ if (nf_hook_list_active(hook_list, pf, hook)) {
struct nf_hook_state state;
- nf_hook_state_init(&state, nf_hook_list, hook, thresh,
+ nf_hook_state_init(&state, hook_list, hook, thresh,
pf, indev, outdev, sk, okfn);
return nf_hook_slow(skb, &state);
}
static DEFINE_MUTEX(nf_hook_mutex);
-static struct list_head *find_nf_hook_list(struct net *net,
+static struct list_head *nf_find_hook_list(struct net *net,
const struct nf_hook_ops *reg)
{
- struct list_head *nf_hook_list = NULL;
+ struct list_head *hook_list = NULL;
if (reg->pf != NFPROTO_NETDEV)
- nf_hook_list = &net->nf.hooks[reg->pf][reg->hooknum];
+ hook_list = &net->nf.hooks[reg->pf][reg->hooknum];
else if (reg->hooknum == NF_NETDEV_INGRESS) {
#ifdef CONFIG_NETFILTER_INGRESS
if (reg->dev && dev_net(reg->dev) == net)
- nf_hook_list = ®->dev->nf_hooks_ingress;
+ hook_list = ®->dev->nf_hooks_ingress;
#endif
}
- return nf_hook_list;
+ return hook_list;
}
struct nf_hook_entry {
int nf_register_net_hook(struct net *net, const struct nf_hook_ops *reg)
{
- struct list_head *nf_hook_list;
+ struct list_head *hook_list;
struct nf_hook_entry *entry;
struct nf_hook_ops *elem;
entry->orig_ops = reg;
entry->ops = *reg;
- nf_hook_list = find_nf_hook_list(net, reg);
- if (!nf_hook_list) {
+ hook_list = nf_find_hook_list(net, reg);
+ if (!hook_list) {
kfree(entry);
return -ENOENT;
}
mutex_lock(&nf_hook_mutex);
- list_for_each_entry(elem, nf_hook_list, list) {
+ list_for_each_entry(elem, hook_list, list) {
if (reg->priority < elem->priority)
break;
}
void nf_unregister_net_hook(struct net *net, const struct nf_hook_ops *reg)
{
- struct list_head *nf_hook_list;
+ struct list_head *hook_list;
struct nf_hook_entry *entry;
struct nf_hook_ops *elem;
- nf_hook_list = find_nf_hook_list(net, reg);
- if (!nf_hook_list)
+ hook_list = nf_find_hook_list(net, reg);
+ if (!hook_list)
return;
mutex_lock(&nf_hook_mutex);
- list_for_each_entry(elem, nf_hook_list, list) {
+ list_for_each_entry(elem, hook_list, list) {
entry = container_of(elem, struct nf_hook_entry, ops);
if (entry->orig_ops == reg) {
list_del_rcu(&entry->ops.list);
}
}
mutex_unlock(&nf_hook_mutex);
- if (&elem->list == nf_hook_list) {
+ if (&elem->list == hook_list) {
WARN(1, "nf_unregister_net_hook: hook not found!\n");
return;
}