1 #ifndef _NETFILTER_INGRESS_H_
2 #define _NETFILTER_INGRESS_H_
4 #include <linux/netfilter.h>
5 #include <linux/netdevice.h>
7 #ifdef CONFIG_NETFILTER_INGRESS
8 static inline bool nf_hook_ingress_active(const struct sk_buff *skb)
10 #ifdef HAVE_JUMP_LABEL
11 if (!static_key_false(&nf_hooks_needed[NFPROTO_NETDEV][NF_NETDEV_INGRESS]))
14 return !list_empty(&skb->dev->nf_hooks_ingress);
17 /* caller must hold rcu_read_lock */
18 static inline int nf_hook_ingress(struct sk_buff *skb)
20 struct nf_hook_state state;
22 nf_hook_state_init(&state, &skb->dev->nf_hooks_ingress,
23 NF_NETDEV_INGRESS, INT_MIN, NFPROTO_NETDEV,
24 skb->dev, NULL, NULL, dev_net(skb->dev), NULL);
25 return nf_hook_slow(skb, &state);
28 static inline void nf_hook_ingress_init(struct net_device *dev)
30 INIT_LIST_HEAD(&dev->nf_hooks_ingress);
32 #else /* CONFIG_NETFILTER_INGRESS */
33 static inline int nf_hook_ingress_active(struct sk_buff *skb)
38 static inline int nf_hook_ingress(struct sk_buff *skb)
43 static inline void nf_hook_ingress_init(struct net_device *dev) {}
44 #endif /* CONFIG_NETFILTER_INGRESS */
45 #endif /* _NETFILTER_INGRESS_H_ */