mirror of
https://github.com/hanwckf/immortalwrt-mt798x.git
synced 2025-01-10 03:09:08 +08:00
128 lines
3.7 KiB
Diff
128 lines
3.7 KiB
Diff
diff --git a/include/net/netfilter/nf_flow_table.h b/include/net/netfilter/nf_flow_table.h
|
|
index 3d73c0c..960ade1 100644
|
|
--- a/include/net/netfilter/nf_flow_table.h
|
|
+++ b/include/net/netfilter/nf_flow_table.h
|
|
@@ -92,9 +92,12 @@ struct flow_offload {
|
|
#define FLOW_OFFLOAD_PATH_VLAN BIT(1)
|
|
#define FLOW_OFFLOAD_PATH_PPPOE BIT(2)
|
|
#define FLOW_OFFLOAD_PATH_DSA BIT(3)
|
|
+#define FLOW_OFFLOAD_PATH_DSLITE BIT(4)
|
|
+#define FLOW_OFFLOAD_PATH_6RD BIT(5)
|
|
|
|
struct flow_offload_hw_path {
|
|
struct net_device *dev;
|
|
+ struct net_device *virt_dev;
|
|
u32 flags;
|
|
|
|
u8 eth_src[ETH_ALEN];
|
|
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
|
|
index be6801524..c51af70f6 100644
|
|
--- a/net/8021q/vlan_dev.c
|
|
+++ b/net/8021q/vlan_dev.c
|
|
@@ -761,6 +761,7 @@ static int vlan_dev_flow_offload_check(struct flow_offload_hw_path *path)
|
|
path->flags |= FLOW_OFFLOAD_PATH_VLAN;
|
|
path->vlan_proto = vlan->vlan_proto;
|
|
path->vlan_id = vlan->vlan_id;
|
|
+ path->virt_dev = dev;
|
|
path->dev = vlan->real_dev;
|
|
|
|
if (vlan->real_dev->netdev_ops->ndo_flow_offload_check)
|
|
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
|
|
index 1b7e3141c..da4e34f74 100644
|
|
--- a/net/ipv6/ip6_tunnel.c
|
|
+++ b/net/ipv6/ip6_tunnel.c
|
|
@@ -57,6 +57,11 @@
|
|
#include <net/netns/generic.h>
|
|
#include <net/dst_metadata.h>
|
|
|
|
+#if IS_ENABLED(CONFIG_NF_FLOW_TABLE)
|
|
+#include <linux/netfilter.h>
|
|
+#include <net/netfilter/nf_flow_table.h>
|
|
+#endif
|
|
+
|
|
MODULE_AUTHOR("Ville Nuorvala");
|
|
MODULE_DESCRIPTION("IPv6 tunneling device");
|
|
MODULE_LICENSE("GPL");
|
|
@@ -1880,6 +1885,22 @@ int ip6_tnl_get_iflink(const struct net_device *dev)
|
|
}
|
|
EXPORT_SYMBOL(ip6_tnl_get_iflink);
|
|
|
|
+#if IS_ENABLED(CONFIG_NF_FLOW_TABLE)
|
|
+static int ipip6_dev_flow_offload_check(struct flow_offload_hw_path *path)
|
|
+{
|
|
+ struct net_device *dev = path->dev;
|
|
+ struct ip6_tnl *tnl = netdev_priv(dev);
|
|
+
|
|
+ if (path->flags & FLOW_OFFLOAD_PATH_DSLITE)
|
|
+ return -EEXIST;
|
|
+
|
|
+ path->flags |= FLOW_OFFLOAD_PATH_DSLITE;
|
|
+ path->dev = tnl->dev;
|
|
+
|
|
+ return 0;
|
|
+}
|
|
+#endif /* CONFIG_NF_FLOW_TABLE */
|
|
+
|
|
int ip6_tnl_encap_add_ops(const struct ip6_tnl_encap_ops *ops,
|
|
unsigned int num)
|
|
{
|
|
@@ -1941,6 +1962,9 @@ static const struct net_device_ops ip6_tnl_netdev_ops = {
|
|
.ndo_change_mtu = ip6_tnl_change_mtu,
|
|
.ndo_get_stats = ip6_get_stats,
|
|
.ndo_get_iflink = ip6_tnl_get_iflink,
|
|
+#if IS_ENABLED(CONFIG_NF_FLOW_TABLE)
|
|
+ .ndo_flow_offload_check = ipip6_dev_flow_offload_check,
|
|
+#endif
|
|
};
|
|
|
|
#define IPXIPX_FEATURES (NETIF_F_SG | \
|
|
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
|
|
index 98954830c..42b6e8c4c 100644
|
|
--- a/net/ipv6/sit.c
|
|
+++ b/net/ipv6/sit.c
|
|
@@ -52,6 +52,11 @@
|
|
#include <net/net_namespace.h>
|
|
#include <net/netns/generic.h>
|
|
|
|
+#if IS_ENABLED(CONFIG_NF_FLOW_TABLE)
|
|
+#include <linux/netfilter.h>
|
|
+#include <net/netfilter/nf_flow_table.h>
|
|
+#endif
|
|
+
|
|
/*
|
|
This version of net/ipv6/sit.c is cloned of net/ipv4/ip_gre.c
|
|
|
|
@@ -1345,6 +1350,22 @@ ipip6_tunnel_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
|
|
return err;
|
|
}
|
|
|
|
+#if IS_ENABLED(CONFIG_NF_FLOW_TABLE)
|
|
+static int ipip6_dev_flow_offload_check(struct flow_offload_hw_path *path)
|
|
+{
|
|
+ struct net_device *dev = path->dev;
|
|
+ struct ip_tunnel *tnl = netdev_priv(dev);
|
|
+
|
|
+ if (path->flags & FLOW_OFFLOAD_PATH_6RD)
|
|
+ return -EEXIST;
|
|
+
|
|
+ path->flags |= FLOW_OFFLOAD_PATH_6RD;
|
|
+ path->dev = tnl->dev;
|
|
+
|
|
+ return 0;
|
|
+}
|
|
+#endif /* CONFIG_NF_FLOW_TABLE */
|
|
+
|
|
static const struct net_device_ops ipip6_netdev_ops = {
|
|
.ndo_init = ipip6_tunnel_init,
|
|
.ndo_uninit = ipip6_tunnel_uninit,
|
|
@@ -1352,6 +1373,9 @@ static const struct net_device_ops ipip6_netdev_ops = {
|
|
.ndo_do_ioctl = ipip6_tunnel_ioctl,
|
|
.ndo_get_stats64 = ip_tunnel_get_stats64,
|
|
.ndo_get_iflink = ip_tunnel_get_iflink,
|
|
+#if IS_ENABLED(CONFIG_NF_FLOW_TABLE)
|
|
+ .ndo_flow_offload_check = ipip6_dev_flow_offload_check,
|
|
+#endif
|
|
};
|
|
|
|
static void ipip6_dev_free(struct net_device *dev)
|