@@ -154,6 +154,7 @@ static inline void nf_hook_state_init(struct nf_hook_state *p,
{
p->hook = hook;
p->pf = pf;
+ p->hook_index = 0;
p->in = indev;
p->out = outdev;
p->sk = sk;
@@ -198,7 +199,7 @@ extern struct static_key nf_hooks_needed[NFPROTO_NUMPROTO][NF_MAX_HOOKS];
#endif
int nf_hook_slow(struct sk_buff *skb, struct nf_hook_state *state,
- const struct nf_hook_entries *e, unsigned int i);
+ const struct nf_hook_entries *e);
void nf_hook_slow_list(struct list_head *head, struct nf_hook_state *state,
const struct nf_hook_entries *e);
@@ -260,7 +261,7 @@ static inline int nf_hook(u_int8_t pf, unsigned int hook, struct net *net,
nf_hook_state_init(&state, hook, pf, indev, outdev,
sk, net, okfn);
- ret = nf_hook_slow(skb, &state, hook_head, 0);
+ ret = nf_hook_slow(skb, &state, hook_head);
}
rcu_read_unlock();
@@ -31,7 +31,7 @@ static inline int nf_hook_ingress(struct sk_buff *skb)
nf_hook_state_init(&state, NF_NETDEV_INGRESS,
NFPROTO_NETDEV, skb->dev, NULL, NULL,
dev_net(skb->dev), NULL);
- ret = nf_hook_slow(skb, &state, e, 0);
+ ret = nf_hook_slow(skb, &state, e);
if (ret == 0)
return -1;
@@ -1020,7 +1020,8 @@ int br_nf_hook_thresh(unsigned int hook, struct net *net,
nf_hook_state_init(&state, hook, NFPROTO_BRIDGE, indev, outdev,
sk, net, okfn);
- ret = nf_hook_slow(skb, &state, e, i);
+ state.hook_index = i;
+ ret = nf_hook_slow(skb, &state, e);
if (ret == 1)
ret = okfn(net, sk, skb);
@@ -580,9 +580,9 @@ EXPORT_SYMBOL(nf_unregister_net_hooks);
/* Returns 1 if okfn() needs to be executed by the caller,
* -EPERM for NF_DROP, 0 otherwise. Caller must hold rcu_read_lock. */
int nf_hook_slow(struct sk_buff *skb, struct nf_hook_state *state,
- const struct nf_hook_entries *e, unsigned int s)
+ const struct nf_hook_entries *e)
{
- unsigned int verdict;
+ unsigned int verdict, s = state->hook_index;
int ret;
for (; s < e->num_hook_entries; s++) {
@@ -625,7 +625,7 @@ void nf_hook_slow_list(struct list_head *head, struct nf_hook_state *state,
list_for_each_entry_safe(skb, next, head, list) {
skb_list_del_init(skb);
- ret = nf_hook_slow(skb, state, e, 0);
+ ret = nf_hook_slow(skb, state, e);
if (ret == 1)
list_add_tail(&skb->list, &sublist);
}
Previous patch added hook_entry member to nf_hook_state struct, so use that for passing the index. Signed-off-by: Florian Westphal <fw@strlen.de> --- include/linux/netfilter.h | 5 +++-- include/linux/netfilter_ingress.h | 2 +- net/bridge/br_netfilter_hooks.c | 3 ++- net/netfilter/core.c | 6 +++--- 4 files changed, 9 insertions(+), 7 deletions(-)