|
@@ -135,6 +135,7 @@
|
|
|
#include <linux/if_macvlan.h>
|
|
|
#include <linux/errqueue.h>
|
|
|
#include <linux/hrtimer.h>
|
|
|
+#include <linux/netfilter_ingress.h>
|
|
|
|
|
|
#include "net-sysfs.h"
|
|
|
|
|
@@ -3666,6 +3667,13 @@ static inline struct sk_buff *handle_ing(struct sk_buff *skb,
|
|
|
|
|
|
return skb;
|
|
|
}
|
|
|
+#else
|
|
|
+static inline struct sk_buff *handle_ing(struct sk_buff *skb,
|
|
|
+ struct packet_type **pt_prev,
|
|
|
+ int *ret, struct net_device *orig_dev)
|
|
|
+{
|
|
|
+ return skb;
|
|
|
+}
|
|
|
#endif
|
|
|
|
|
|
/**
|
|
@@ -3739,6 +3747,28 @@ static bool skb_pfmemalloc_protocol(struct sk_buff *skb)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+#ifdef CONFIG_NETFILTER_INGRESS
|
|
|
+static inline int nf_ingress(struct sk_buff *skb, struct packet_type **pt_prev,
|
|
|
+ int *ret, struct net_device *orig_dev)
|
|
|
+{
|
|
|
+ if (nf_hook_ingress_active(skb)) {
|
|
|
+ if (*pt_prev) {
|
|
|
+ *ret = deliver_skb(skb, *pt_prev, orig_dev);
|
|
|
+ *pt_prev = NULL;
|
|
|
+ }
|
|
|
+
|
|
|
+ return nf_hook_ingress(skb);
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+#else
|
|
|
+static inline int nf_ingress(struct sk_buff *skb, struct packet_type **pt_prev,
|
|
|
+ int *ret, struct net_device *orig_dev)
|
|
|
+{
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+#endif
|
|
|
+
|
|
|
static int __netif_receive_skb_core(struct sk_buff *skb, bool pfmemalloc)
|
|
|
{
|
|
|
struct packet_type *ptype, *pt_prev;
|
|
@@ -3803,6 +3833,9 @@ skip_taps:
|
|
|
skb = handle_ing(skb, &pt_prev, &ret, orig_dev);
|
|
|
if (!skb)
|
|
|
goto unlock;
|
|
|
+
|
|
|
+ if (nf_ingress(skb, &pt_prev, &ret, orig_dev) < 0)
|
|
|
+ goto unlock;
|
|
|
}
|
|
|
#endif
|
|
|
#ifdef CONFIG_NET_CLS_ACT
|
|
@@ -6968,6 +7001,9 @@ struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name,
|
|
|
dev->group = INIT_NETDEV_GROUP;
|
|
|
if (!dev->ethtool_ops)
|
|
|
dev->ethtool_ops = &default_ethtool_ops;
|
|
|
+
|
|
|
+ nf_hook_ingress_init(dev);
|
|
|
+
|
|
|
return dev;
|
|
|
|
|
|
free_all:
|