|
@@ -62,17 +62,17 @@ static DEFINE_MUTEX(nf_hook_mutex);
|
|
|
|
|
|
int nf_register_hook(struct nf_hook_ops *reg)
|
|
|
{
|
|
|
- struct list_head *i;
|
|
|
+ struct nf_hook_ops *elem;
|
|
|
int err;
|
|
|
|
|
|
err = mutex_lock_interruptible(&nf_hook_mutex);
|
|
|
if (err < 0)
|
|
|
return err;
|
|
|
- list_for_each(i, &nf_hooks[reg->pf][reg->hooknum]) {
|
|
|
- if (reg->priority < ((struct nf_hook_ops *)i)->priority)
|
|
|
+ list_for_each_entry(elem, &nf_hooks[reg->pf][reg->hooknum], list) {
|
|
|
+ if (reg->priority < elem->priority)
|
|
|
break;
|
|
|
}
|
|
|
- list_add_rcu(®->list, i->prev);
|
|
|
+ list_add_rcu(®->list, elem->list.prev);
|
|
|
mutex_unlock(&nf_hook_mutex);
|
|
|
return 0;
|
|
|
}
|