Skip to content

Commit

Permalink
netfilter: kill nf_hooks_active
Browse files Browse the repository at this point in the history
The function obscures what is going on in nf_hook_thresh and it's existence
requires computing the hook list twice.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
  • Loading branch information
Eric W. Biederman authored and Pablo Neira Ayuso committed Jul 15, 2015
1 parent 0d6ef06 commit 70aa996
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions include/linux/netfilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,6 @@ static inline bool nf_hook_list_active(struct list_head *nf_hook_list,
}
#endif

static inline bool nf_hooks_active(u_int8_t pf, unsigned int hook)
{
return nf_hook_list_active(&nf_hooks[pf][hook], pf, hook);
}

int nf_hook_slow(struct sk_buff *skb, struct nf_hook_state *state);

/**
Expand All @@ -172,10 +167,12 @@ static inline int nf_hook_thresh(u_int8_t pf, unsigned int hook,
int (*okfn)(struct sock *, struct sk_buff *),
int thresh)
{
if (nf_hooks_active(pf, hook)) {
struct list_head *nf_hook_list = &nf_hooks[pf][hook];

if (nf_hook_list_active(nf_hook_list, pf, hook)) {
struct nf_hook_state state;

nf_hook_state_init(&state, &nf_hooks[pf][hook], hook, thresh,
nf_hook_state_init(&state, nf_hook_list, hook, thresh,
pf, indev, outdev, sk, okfn);
return nf_hook_slow(skb, &state);
}
Expand Down

0 comments on commit 70aa996

Please sign in to comment.