From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Cc: davem@davemloft.net, netdev@vger.kernel.org, jhs@mojatatu.com,
daniel@iogearbox.net, eric.dumazet@gmail.com, kaber@trash.net,
ast@plumgrid.com
Subject: [PATCH 3/5] netfilter: add nf_hook_list_active()
Date: Wed, 13 May 2015 18:19:36 +0200 [thread overview]
Message-ID: <1431533978-26901-4-git-send-email-pablo@netfilter.org> (raw)
In-Reply-To: <1431533978-26901-1-git-send-email-pablo@netfilter.org>
In preparation to have netfilter ingress per-device hook list.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
include/linux/netfilter.h | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index 388ed19..49d0063 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -134,26 +134,33 @@ extern struct list_head nf_hooks[NFPROTO_NUMPROTO][NF_MAX_HOOKS];
#ifdef HAVE_JUMP_LABEL
extern struct static_key nf_hooks_needed[NFPROTO_NUMPROTO][NF_MAX_HOOKS];
-static inline bool nf_hooks_active(u_int8_t pf, unsigned int hook)
+static inline bool nf_hook_list_active(struct list_head *nf_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_hooks[pf][hook]);
+ return !list_empty(nf_hook_list);
}
#else
-static inline bool nf_hooks_active(u_int8_t pf, unsigned int hook)
+static inline bool nf_hook_list_active(struct list_head *nf_hook_list,
+ u_int8_t pf, unsigned int hook)
{
- return !list_empty(&nf_hooks[pf][hook]);
+ return !list_empty(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);
/**
* nf_hook_thresh - call a netfilter hook
- *
+ *
* Returns 1 if the hook has allowed the packet to pass. The function
* okfn must be invoked by the caller in this case. Any other return
* value indicates the packet has been consumed by the hook.
--
1.7.10.4
next prev parent reply other threads:[~2015-05-13 16:19 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-13 16:19 [PATCH 0/5 net-next] Netfilter ingress support (v4) Pablo Neira Ayuso
2015-05-13 16:19 ` [PATCH 1/5] netfilter: cleanup struct nf_hook_ops indentation Pablo Neira Ayuso
2015-05-13 16:19 ` [PATCH 2/5] netfilter: add hook list to nf_hook_state Pablo Neira Ayuso
2015-05-13 16:19 ` Pablo Neira Ayuso [this message]
2015-05-13 16:19 ` [PATCH 4/5] net: add CONFIG_NET_INGRESS to enable ingress filtering Pablo Neira Ayuso
2015-05-13 16:55 ` Alexei Starovoitov
2015-05-13 16:19 ` [PATCH 5/5] netfilter: add netfilter ingress hook after handle_ing() under unique static key Pablo Neira Ayuso
2015-05-13 16:59 ` Alexei Starovoitov
2015-05-13 17:56 ` Pablo Neira Ayuso
2015-05-13 19:36 ` Nicolas Dichtel
2015-05-14 5:11 ` David Miller
2015-05-14 5:10 ` [PATCH 0/5 net-next] Netfilter ingress support (v4) David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1431533978-26901-4-git-send-email-pablo@netfilter.org \
--to=pablo@netfilter.org \
--cc=ast@plumgrid.com \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=jhs@mojatatu.com \
--cc=kaber@trash.net \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).