Loading include/linux/netfilter.h +5 −2 Original line number Original line Diff line number Diff line Loading @@ -54,10 +54,12 @@ struct nf_hook_state { struct net_device *in; struct net_device *in; struct net_device *out; struct net_device *out; struct sock *sk; struct sock *sk; struct list_head *hook_list; int (*okfn)(struct sock *, struct sk_buff *); int (*okfn)(struct sock *, struct sk_buff *); }; }; static inline void nf_hook_state_init(struct nf_hook_state *p, static inline void nf_hook_state_init(struct nf_hook_state *p, struct list_head *hook_list, unsigned int hook, unsigned int hook, int thresh, u_int8_t pf, int thresh, u_int8_t pf, struct net_device *indev, struct net_device *indev, Loading @@ -71,6 +73,7 @@ static inline void nf_hook_state_init(struct nf_hook_state *p, p->in = indev; p->in = indev; p->out = outdev; p->out = outdev; p->sk = sk; p->sk = sk; p->hook_list = hook_list; p->okfn = okfn; p->okfn = okfn; } } Loading Loading @@ -166,8 +169,8 @@ static inline int nf_hook_thresh(u_int8_t pf, unsigned int hook, if (nf_hooks_active(pf, hook)) { if (nf_hooks_active(pf, hook)) { struct nf_hook_state state; struct nf_hook_state state; nf_hook_state_init(&state, hook, thresh, pf, nf_hook_state_init(&state, &nf_hooks[pf][hook], hook, thresh, indev, outdev, sk, okfn); pf, indev, outdev, sk, okfn); return nf_hook_slow(skb, &state); return nf_hook_slow(skb, &state); } } return 1; return 1; Loading net/netfilter/core.c +2 −4 Original line number Original line Diff line number Diff line Loading @@ -166,11 +166,9 @@ int nf_hook_slow(struct sk_buff *skb, struct nf_hook_state *state) /* We may already have this, but read-locks nest anyway */ /* We may already have this, but read-locks nest anyway */ rcu_read_lock(); rcu_read_lock(); elem = list_entry_rcu(&nf_hooks[state->pf][state->hook], elem = list_entry_rcu(state->hook_list, struct nf_hook_ops, list); struct nf_hook_ops, list); next_hook: next_hook: verdict = nf_iterate(&nf_hooks[state->pf][state->hook], skb, state, verdict = nf_iterate(state->hook_list, skb, state, &elem); &elem); if (verdict == NF_ACCEPT || verdict == NF_STOP) { if (verdict == NF_ACCEPT || verdict == NF_STOP) { ret = 1; ret = 1; } else if ((verdict & NF_VERDICT_MASK) == NF_DROP) { } else if ((verdict & NF_VERDICT_MASK) == NF_DROP) { Loading Loading
include/linux/netfilter.h +5 −2 Original line number Original line Diff line number Diff line Loading @@ -54,10 +54,12 @@ struct nf_hook_state { struct net_device *in; struct net_device *in; struct net_device *out; struct net_device *out; struct sock *sk; struct sock *sk; struct list_head *hook_list; int (*okfn)(struct sock *, struct sk_buff *); int (*okfn)(struct sock *, struct sk_buff *); }; }; static inline void nf_hook_state_init(struct nf_hook_state *p, static inline void nf_hook_state_init(struct nf_hook_state *p, struct list_head *hook_list, unsigned int hook, unsigned int hook, int thresh, u_int8_t pf, int thresh, u_int8_t pf, struct net_device *indev, struct net_device *indev, Loading @@ -71,6 +73,7 @@ static inline void nf_hook_state_init(struct nf_hook_state *p, p->in = indev; p->in = indev; p->out = outdev; p->out = outdev; p->sk = sk; p->sk = sk; p->hook_list = hook_list; p->okfn = okfn; p->okfn = okfn; } } Loading Loading @@ -166,8 +169,8 @@ static inline int nf_hook_thresh(u_int8_t pf, unsigned int hook, if (nf_hooks_active(pf, hook)) { if (nf_hooks_active(pf, hook)) { struct nf_hook_state state; struct nf_hook_state state; nf_hook_state_init(&state, hook, thresh, pf, nf_hook_state_init(&state, &nf_hooks[pf][hook], hook, thresh, indev, outdev, sk, okfn); pf, indev, outdev, sk, okfn); return nf_hook_slow(skb, &state); return nf_hook_slow(skb, &state); } } return 1; return 1; Loading
net/netfilter/core.c +2 −4 Original line number Original line Diff line number Diff line Loading @@ -166,11 +166,9 @@ int nf_hook_slow(struct sk_buff *skb, struct nf_hook_state *state) /* We may already have this, but read-locks nest anyway */ /* We may already have this, but read-locks nest anyway */ rcu_read_lock(); rcu_read_lock(); elem = list_entry_rcu(&nf_hooks[state->pf][state->hook], elem = list_entry_rcu(state->hook_list, struct nf_hook_ops, list); struct nf_hook_ops, list); next_hook: next_hook: verdict = nf_iterate(&nf_hooks[state->pf][state->hook], skb, state, verdict = nf_iterate(state->hook_list, skb, state, &elem); &elem); if (verdict == NF_ACCEPT || verdict == NF_STOP) { if (verdict == NF_ACCEPT || verdict == NF_STOP) { ret = 1; ret = 1; } else if ((verdict & NF_VERDICT_MASK) == NF_DROP) { } else if ((verdict & NF_VERDICT_MASK) == NF_DROP) { Loading