aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/netfilter.h
diff options
context:
space:
mode:
authorAaron Conole <aconole@bytheb.org>2016-11-15 17:48:44 -0500
committerPablo Neira Ayuso <pablo@netfilter.org>2016-12-06 21:42:15 +0100
commit0aa8c57a04907a5d02068ff9f917629be97ea78d (patch)
tree80da65fdc51b442fc5aeddb99c60c3c32853e4dc /include/linux/netfilter.h
parentnetfilter: defrag: only register defrag functionality if needed (diff)
downloadlinux-dev-0aa8c57a04907a5d02068ff9f917629be97ea78d.tar.xz
linux-dev-0aa8c57a04907a5d02068ff9f917629be97ea78d.zip
netfilter: introduce accessor functions for hook entries
This allows easier future refactoring. Signed-off-by: Aaron Conole <aconole@bytheb.org> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'include/linux/netfilter.h')
-rw-r--r--include/linux/netfilter.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index 69230140215b..575aa198097e 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -79,6 +79,33 @@ struct nf_hook_entry {
const struct nf_hook_ops *orig_ops;
};
+static inline void
+nf_hook_entry_init(struct nf_hook_entry *entry, const struct nf_hook_ops *ops)
+{
+ entry->next = NULL;
+ entry->ops = *ops;
+ entry->orig_ops = ops;
+}
+
+static inline int
+nf_hook_entry_priority(const struct nf_hook_entry *entry)
+{
+ return entry->ops.priority;
+}
+
+static inline int
+nf_hook_entry_hookfn(const struct nf_hook_entry *entry, struct sk_buff *skb,
+ struct nf_hook_state *state)
+{
+ return entry->ops.hook(entry->ops.priv, skb, state);
+}
+
+static inline const struct nf_hook_ops *
+nf_hook_entry_ops(const struct nf_hook_entry *entry)
+{
+ return entry->orig_ops;
+}
+
static inline void nf_hook_state_init(struct nf_hook_state *p,
unsigned int hook,
u_int8_t pf,