blob: cb0727fe2b3dbc5894b98867370615295edd3c87 [file] [log] [blame]
Pablo Neirae687ad62015-05-13 18:19:38 +02001#ifndef _NETFILTER_INGRESS_H_
2#define _NETFILTER_INGRESS_H_
3
4#include <linux/netfilter.h>
5#include <linux/netdevice.h>
6
7#ifdef CONFIG_NETFILTER_INGRESS
8static inline int nf_hook_ingress_active(struct sk_buff *skb)
9{
10 return nf_hook_list_active(&skb->dev->nf_hooks_ingress,
11 NFPROTO_NETDEV, NF_NETDEV_INGRESS);
12}
13
14static inline int nf_hook_ingress(struct sk_buff *skb)
15{
16 struct nf_hook_state state;
17
18 nf_hook_state_init(&state, &skb->dev->nf_hooks_ingress,
19 NF_NETDEV_INGRESS, INT_MIN, NFPROTO_NETDEV, NULL,
20 skb->dev, NULL, NULL);
21 return nf_hook_slow(skb, &state);
22}
23
24static inline void nf_hook_ingress_init(struct net_device *dev)
25{
26 INIT_LIST_HEAD(&dev->nf_hooks_ingress);
27}
28#else /* CONFIG_NETFILTER_INGRESS */
29static inline int nf_hook_ingress_active(struct sk_buff *skb)
30{
31 return 0;
32}
33
34static inline int nf_hook_ingress(struct sk_buff *skb)
35{
36 return 0;
37}
38
39static inline void nf_hook_ingress_init(struct net_device *dev) {}
40#endif /* CONFIG_NETFILTER_INGRESS */
41#endif /* _NETFILTER_INGRESS_H_ */