From 21b378754286327dfc89a5854e6d4dcfc589d86e Mon Sep 17 00:00:00 2001 From: SqTER-PL Date: Wed, 5 Mar 2025 18:51:08 +0100 Subject: [PATCH] Updated iptunnel patches. Switch to codelinaro.org source. Minor fixes and patch sorting. --- .../990-045-add-iptunnel-support.patch | 77 ----------- ...t-vxlan-Adding-APIs-to-VxLAN-driver.patch} | 0 ...ULL-pointer-check-before-netif_is_vx.patch | 113 ++++++++++++++++ ...le-fast-path-support-for-6RD-DS-Lite.patch | 110 +++++++++++++++ ...-netdevice-priv-flag-for-soft-tunnel.patch | 28 ++++ ...Correct-FMR-Calculation-in-Linux-6.1.patch | 49 +++++++ ...050-Squashed-commit-of-the-following.patch | 126 ++++++++++++++++++ ...atch => 990-051-qca-nss-cfi-support.patch} | 0 ...netfilter_optional_tcp_window_check.patch} | 0 ...ark-extention-doesn-t-set-the-type-.patch} | 0 ...xtra-priv_flag-support-in-netdevice.patch} | 0 ...0-055-qca-nss-drv-add-qdisc-support.patch} | 0 ...0-056-net-fix-potential-memory-leak.patch} | 0 ...e-skb_vlan_untag-skb-after-sfe-hook.patch} | 0 ...ch => 990-058-net-add-fast-xmit-api.patch} | 0 ...e-rather-than-fully-update-in-the-f.patch} | 0 ...set-skb-fast_xmit-flag-in-slow-path.patch} | 0 ...le-hairpin-for-WLAN-netdevices-only.patch} | 0 ...unicast-loop-back-when-hairpin-enab.patch} | 0 ...e-adding-API-to-check-GRE-net-device.patch | 41 ++++++ ...e-Adding-support-to-detect-fb-netdev.patch | 96 +++++++++++++ 21 files changed, 563 insertions(+), 77 deletions(-) delete mode 100644 target/linux/ipq806x/patches-6.6/990-045-add-iptunnel-support.patch rename target/linux/ipq806x/patches-6.6/{990-046-net-vxlan-Adding-APIs-to-VxLAN-driver.patch => 990-045-net-vxlan-Adding-APIs-to-VxLAN-driver.patch} (100%) create mode 100644 target/linux/ipq806x/patches-6.6/990-046-ip_tunnel_core-NULL-pointer-check-before-netif_is_vx.patch create mode 100644 target/linux/ipq806x/patches-6.6/990-047-net-Enable-fast-path-support-for-6RD-DS-Lite.patch create mode 100644 target/linux/ipq806x/patches-6.6/990-048-net-added-a-new-netdevice-priv-flag-for-soft-tunnel.patch create mode 100644 target/linux/ipq806x/patches-6.6/990-049-net-Correct-FMR-Calculation-in-Linux-6.1.patch create mode 100644 target/linux/ipq806x/patches-6.6/990-050-Squashed-commit-of-the-following.patch rename target/linux/ipq806x/patches-6.6/{990-047-qca-nss-cfi-support.patch => 990-051-qca-nss-cfi-support.patch} (100%) rename target/linux/ipq806x/patches-6.6/{990-048-netfilter_optional_tcp_window_check.patch => 990-052-netfilter_optional_tcp_window_check.patch} (100%) rename target/linux/ipq806x/patches-6.6/{990-049-linux-fix-dscpremark-extention-doesn-t-set-the-type-.patch => 990-053-linux-fix-dscpremark-extention-doesn-t-set-the-type-.patch} (100%) rename target/linux/ipq806x/patches-6.6/{990-050-net-Add-extra-priv_flag-support-in-netdevice.patch => 990-054-net-Add-extra-priv_flag-support-in-netdevice.patch} (100%) rename target/linux/ipq806x/patches-6.6/{990-051-qca-nss-drv-add-qdisc-support.patch => 990-055-qca-nss-drv-add-qdisc-support.patch} (100%) rename target/linux/ipq806x/patches-6.6/{990-052-net-fix-potential-memory-leak.patch => 990-056-net-fix-potential-memory-leak.patch} (100%) rename target/linux/ipq806x/patches-6.6/{990-053-net-Move-skb_vlan_untag-skb-after-sfe-hook.patch => 990-057-net-Move-skb_vlan_untag-skb-after-sfe-hook.patch} (100%) rename target/linux/ipq806x/patches-6.6/{990-054-net-add-fast-xmit-api.patch => 990-058-net-add-fast-xmit-api.patch} (100%) rename target/linux/ipq806x/patches-6.6/{990-055-net-do-time-update-rather-than-fully-update-in-the-f.patch => 990-059-net-do-time-update-rather-than-fully-update-in-the-f.patch} (100%) rename target/linux/ipq806x/patches-6.6/{990-057-dev_queue_xmit-Reset-skb-fast_xmit-flag-in-slow-path.patch => 990-060-dev_queue_xmit-Reset-skb-fast_xmit-flag-in-slow-path.patch} (100%) rename target/linux/ipq806x/patches-6.6/{990-058-arm-arm64-enable-hairpin-for-WLAN-netdevices-only.patch => 990-061-arm-arm64-enable-hairpin-for-WLAN-netdevices-only.patch} (100%) rename target/linux/ipq806x/patches-6.6/{990-059-net-bridge-Allow-unicast-loop-back-when-hairpin-enab.patch => 990-062-net-bridge-Allow-unicast-loop-back-when-hairpin-enab.patch} (100%) create mode 100644 target/linux/ipq806x/patches-6.6/990-063-net-gre-adding-API-to-check-GRE-net-device.patch create mode 100644 target/linux/ipq806x/patches-6.6/990-064-net-gre-Adding-support-to-detect-fb-netdev.patch diff --git a/target/linux/ipq806x/patches-6.6/990-045-add-iptunnel-support.patch b/target/linux/ipq806x/patches-6.6/990-045-add-iptunnel-support.patch deleted file mode 100644 index 86c9688ade..0000000000 --- a/target/linux/ipq806x/patches-6.6/990-045-add-iptunnel-support.patch +++ /dev/null @@ -1,77 +0,0 @@ ---- a/include/net/ip6_tunnel.h -+++ b/include/net/ip6_tunnel.h -@@ -36,6 +36,7 @@ struct __ip6_tnl_parm { - __u8 proto; /* tunnel protocol */ - __u8 encap_limit; /* encapsulation limit for tunnel */ - __u8 hop_limit; /* hop limit for tunnel */ -+ __u8 draft03; /* FMR using draft03 of map-e - QCA NSS Clients Support */ - bool collect_md; - __be32 flowinfo; /* traffic class and flowlabel for tunnel */ - __u32 flags; /* tunnel flags */ ---- a/include/net/ip_tunnels.h -+++ b/include/net/ip_tunnels.h -@@ -592,4 +592,9 @@ static inline void ip_tunnel_info_opts_s - - #endif /* CONFIG_INET */ - -+/* QCA NSS Clients Support - Start */ -+void ipip6_update_offload_stats(struct net_device *dev, void *ptr); -+void ip6_update_offload_stats(struct net_device *dev, void *ptr); -+/* QCA NSS Clients Support - End */ -+ - #endif /* __NET_IP_TUNNELS_H */ ---- a/net/ipv6/ip6_tunnel.c -+++ b/net/ipv6/ip6_tunnel.c -@@ -2414,6 +2414,26 @@ nla_put_failure: - return -EMSGSIZE; - } - -+/* QCA NSS Client Support - Start */ -+/* -+ * Update offload stats -+ */ -+void ip6_update_offload_stats(struct net_device *dev, void *ptr) -+{ -+ struct pcpu_sw_netstats *tstats = per_cpu_ptr(dev->tstats, 0); -+ const struct pcpu_sw_netstats *offload_stats = -+ (struct pcpu_sw_netstats *)ptr; -+ -+ u64_stats_update_begin(&tstats->syncp); -+ u64_stats_add(&tstats->tx_packets, u64_stats_read(&offload_stats->tx_packets)); -+ u64_stats_add(&tstats->tx_bytes, u64_stats_read(&offload_stats->tx_bytes)); -+ u64_stats_add(&tstats->rx_packets, u64_stats_read(&offload_stats->rx_packets)); -+ u64_stats_add(&tstats->rx_bytes, u64_stats_read(&offload_stats->rx_bytes)); -+ u64_stats_update_end(&tstats->syncp); -+} -+EXPORT_SYMBOL(ip6_update_offload_stats); -+/* QCA NSS Client Support - End */ -+ - struct net *ip6_tnl_get_link_net(const struct net_device *dev) - { - struct ip6_tnl *tunnel = netdev_priv(dev); ---- a/net/ipv6/sit.c -+++ b/net/ipv6/sit.c -@@ -1734,6 +1734,23 @@ nla_put_failure: - return -EMSGSIZE; - } - -+/* QCA NSS Clients Support - Start */ -+void ipip6_update_offload_stats(struct net_device *dev, void *ptr) -+{ -+ struct pcpu_sw_netstats *tstats = per_cpu_ptr(dev->tstats, 0); -+ const struct pcpu_sw_netstats *offload_stats = -+ (struct pcpu_sw_netstats *)ptr; -+ -+ u64_stats_update_begin(&tstats->syncp); -+ u64_stats_add(&tstats->tx_packets, u64_stats_read(&offload_stats->tx_packets)); -+ u64_stats_add(&tstats->tx_bytes, u64_stats_read(&offload_stats->tx_bytes)); -+ u64_stats_add(&tstats->rx_packets, u64_stats_read(&offload_stats->rx_packets)); -+ u64_stats_add(&tstats->rx_bytes, u64_stats_read(&offload_stats->rx_bytes)); -+ u64_stats_update_end(&tstats->syncp); -+} -+EXPORT_SYMBOL(ipip6_update_offload_stats); -+/* QCA NSS Clients Support - End */ -+ - static const struct nla_policy ipip6_policy[IFLA_IPTUN_MAX + 1] = { - [IFLA_IPTUN_LINK] = { .type = NLA_U32 }, - [IFLA_IPTUN_LOCAL] = { .type = NLA_U32 }, diff --git a/target/linux/ipq806x/patches-6.6/990-046-net-vxlan-Adding-APIs-to-VxLAN-driver.patch b/target/linux/ipq806x/patches-6.6/990-045-net-vxlan-Adding-APIs-to-VxLAN-driver.patch similarity index 100% rename from target/linux/ipq806x/patches-6.6/990-046-net-vxlan-Adding-APIs-to-VxLAN-driver.patch rename to target/linux/ipq806x/patches-6.6/990-045-net-vxlan-Adding-APIs-to-VxLAN-driver.patch diff --git a/target/linux/ipq806x/patches-6.6/990-046-ip_tunnel_core-NULL-pointer-check-before-netif_is_vx.patch b/target/linux/ipq806x/patches-6.6/990-046-ip_tunnel_core-NULL-pointer-check-before-netif_is_vx.patch new file mode 100644 index 0000000000..64d76805b9 --- /dev/null +++ b/target/linux/ipq806x/patches-6.6/990-046-ip_tunnel_core-NULL-pointer-check-before-netif_is_vx.patch @@ -0,0 +1,113 @@ +From bd7f46b6e8b0ef8a0e74277b9528e27a39af4ea2 Mon Sep 17 00:00:00 2001 +From: Sachin Kohli +Date: Tue, 19 Dec 2023 10:17:14 +0530 +Subject: [PATCH 207/500] ip_tunnel_core: NULL pointer check before + netif_is_vxlan + +We need to check if in_dev is NULL before calling netif_is_vxlan +Change-Id: Ia1d38441bf37af691d2afab7f5545a721192e83e +Signed-off-by: Tian Yang +Signed-off-by: Vishnu Vardhan Bantanahal + +net: Setting skb input interface to vxlan during encapsulation. + +Setting skb_iif to vxlan when encapsulating with IP/IPv6 header. +Also removed the is_vxlan_dev() API support, as it can be replaced +by in-built API netif_is_vxlan(). + +Change-Id: I480d15b2ef2e91038676c620a98217e35e29b002 +Signed-off-by: Apoorv Gupta +Signed-off-by: Vishnu Vardhan Bantanahal +--- + drivers/net/vxlan/vxlan_core.c | 6 ++++++ + include/net/vxlan.h | 15 ++++----------- + net/ipv4/ip_tunnel_core.c | 15 +++++++++++++++ + 3 files changed, 25 insertions(+), 11 deletions(-) + +--- a/drivers/net/vxlan/vxlan_core.c ++++ b/drivers/net/vxlan/vxlan_core.c +@@ -2631,6 +2631,9 @@ void vxlan_xmit_one(struct sk_buff *skb, + goto out_unlock; + } + ++ /* Reset the skb_iif to Tunnels interface index */ ++ skb->skb_iif = dev->ifindex; ++ + tos = ip_tunnel_ecn_encap(tos, old_iph, skb); + ttl = ttl ? : ip4_dst_hoplimit(&rt->dst); + err = vxlan_build_skb(skb, ndst, sizeof(struct iphdr), +@@ -2702,6 +2705,9 @@ void vxlan_xmit_one(struct sk_buff *skb, + if (err < 0) + goto tx_error; + ++ /* Reset the skb_iif to Tunnels interface index */ ++ skb->skb_iif = dev->ifindex; ++ + udp_tunnel6_xmit_skb(ndst, sock6->sock->sk, skb, dev, + &local_ip.sin6.sin6_addr, + &dst->sin6.sin6_addr, tos, ttl, +--- a/include/net/vxlan.h ++++ b/include/net/vxlan.h +@@ -454,19 +454,12 @@ static inline __be32 vxlan_compute_rco(u + } + + /* +- * is_vxlan_dev() +- * Check if it is a VxLAN netdevice. ++ * vxlan_get_vni() ++ * Returns the vni corresponding to tunnel + */ +-static inline bool is_vxlan_dev(const struct net_device *dev) ++static inline u32 vxlan_get_vni(struct vxlan_dev *vxlan_tun) + { +- if (!dev) +- return false; +- +- if ((dev->dev.type) && +- !strncmp(dev->dev.type->name, "vxlan", sizeof("vxlan"))) { +- return true; +- } +- return false; ++ return be32_to_cpu(vxlan_tun->cfg.vni); + } + + static inline unsigned short vxlan_get_sk_family(struct vxlan_sock *vs) +--- a/net/ipv4/ip_tunnel_core.c ++++ b/net/ipv4/ip_tunnel_core.c +@@ -38,6 +38,7 @@ + #include + #include + #include ++#include + + const struct ip_tunnel_encap_ops __rcu * + iptun_encaps[MAX_IPTUN_ENCAP_OPS] __read_mostly; +@@ -55,7 +56,12 @@ void iptunnel_xmit(struct sock *sk, stru + struct net *net = dev_net(rt->dst.dev); + struct net_device *dev = skb->dev; + struct iphdr *iph; ++ struct net_device *in_dev = NULL; + int err; ++ int skb_iif; ++ ++ /* Save input interface index */ ++ skb_iif = skb->skb_iif; + + skb_scrub_packet(skb, xnet); + +@@ -79,6 +85,15 @@ void iptunnel_xmit(struct sock *sk, stru + iph->ttl = ttl; + __ip_select_ident(net, iph, skb_shinfo(skb)->gso_segs ?: 1); + ++ /* Get input interface */ ++ if (skb_iif) { ++ in_dev = __dev_get_by_index(&init_net, skb_iif); ++ } ++ ++ if (proto == IPPROTO_IPV6 || proto == IPPROTO_GRE || (in_dev && netif_is_vxlan(in_dev))) { ++ skb->skb_iif = skb_iif; ++ } ++ + err = ip_local_out(net, sk, skb); + + if (dev) { diff --git a/target/linux/ipq806x/patches-6.6/990-047-net-Enable-fast-path-support-for-6RD-DS-Lite.patch b/target/linux/ipq806x/patches-6.6/990-047-net-Enable-fast-path-support-for-6RD-DS-Lite.patch new file mode 100644 index 0000000000..82dd28ad68 --- /dev/null +++ b/target/linux/ipq806x/patches-6.6/990-047-net-Enable-fast-path-support-for-6RD-DS-Lite.patch @@ -0,0 +1,110 @@ +From 365bac798ea16e3eb34d8c164b94bc3a4c1fcc51 Mon Sep 17 00:00:00 2001 +From: Murat Sezgin +Date: Tue, 20 Jun 2023 13:19:29 -0700 +Subject: [PATCH 274/500] net: Enable fast path support for 6RD, DS-Lite + +1). Added stats update function +2). Added changes to set the skb->skb_iif to tunnel dev + +Change-Id: I7f43746436b4f6483952997fdf91180096d3ed62 +Signed-off-by: Shyam Sunder +Signed-off-by: Murat Sezgin +Signed-off-by: John Sanli +Signed-off-by: Pavithra R +--- + +--- a/net/ipv6/ip6_tunnel.c ++++ b/net/ipv6/ip6_tunnel.c +@@ -100,6 +100,23 @@ static inline int ip6_tnl_mpls_supported + #define for_each_ip6_tunnel_rcu(start) \ + for (t = rcu_dereference(start); t; t = rcu_dereference(t->next)) + ++/* ++ * Update offload stats ++ */ ++void ip6_update_offload_stats(struct net_device *dev, void *ptr) ++{ ++ struct pcpu_sw_netstats *tstats = this_cpu_ptr(dev->tstats); ++ const struct pcpu_sw_netstats *offload_stats = ++ (struct pcpu_sw_netstats *)ptr; ++ ++ u64_stats_update_begin(&tstats->syncp); ++ u64_stats_add(&tstats->tx_packets, u64_stats_read(&offload_stats->tx_packets)); ++ u64_stats_add(&tstats->tx_bytes, u64_stats_read(&offload_stats->tx_bytes)); ++ u64_stats_add(&tstats->rx_packets, u64_stats_read(&offload_stats->rx_packets)); ++ u64_stats_add(&tstats->rx_bytes, u64_stats_read(&offload_stats->rx_bytes)); ++ u64_stats_update_end(&tstats->syncp); ++} ++EXPORT_SYMBOL(ip6_update_offload_stats); + /** + * ip6_tnl_lookup - fetch tunnel matching the end-point addresses + * @net: network namespace +@@ -1024,6 +1041,9 @@ static int __ip6_tnl_rcv(struct ip6_tnl + if (tun_dst) + skb_dst_set(skb, (struct dst_entry *)tun_dst); + ++ /* Reset the skb_iif to Tunnels interface index */ ++ skb->skb_iif = tunnel->dev->ifindex; ++ + gro_cells_receive(&tunnel->gro_cells, skb); + return 0; + +@@ -1105,7 +1125,6 @@ static int ipxip6_rcv(struct sk_buff *sk + rcu_read_unlock(); + + return ret; +- + drop: + rcu_read_unlock(); + kfree_skb(skb); +@@ -1424,6 +1443,9 @@ route_lookup: + ipv6h->nexthdr = proto; + ipv6h->saddr = fl6->saddr; + ipv6h->daddr = fl6->daddr; ++ ++ /* Reset the skb_iif to Tunnels interface index */ ++ skb->skb_iif = dev->ifindex; + ip6tunnel_xmit(NULL, skb, dev); + return 0; + tx_err_link_failure: +--- a/net/ipv6/sit.c ++++ b/net/ipv6/sit.c +@@ -90,6 +90,20 @@ static inline struct sit_net *dev_to_sit + return net_generic(t->net, sit_net_id); + } + ++void ipip6_update_offload_stats(struct net_device *dev, void *ptr) ++{ ++ struct pcpu_sw_netstats *tstats = this_cpu_ptr(dev->tstats); ++ const struct pcpu_sw_netstats *offload_stats = ++ (struct pcpu_sw_netstats *)ptr; ++ ++ u64_stats_update_begin(&tstats->syncp); ++ u64_stats_add(&tstats->tx_packets, u64_stats_read(&offload_stats->tx_packets)); ++ u64_stats_add(&tstats->tx_bytes, u64_stats_read(&offload_stats->tx_bytes)); ++ u64_stats_add(&tstats->rx_packets, u64_stats_read(&offload_stats->rx_packets)); ++ u64_stats_add(&tstats->rx_bytes, u64_stats_read(&offload_stats->rx_bytes)); ++ u64_stats_update_end(&tstats->syncp); ++} ++EXPORT_SYMBOL(ipip6_update_offload_stats); + /* + * Must be invoked with rcu_read_lock + */ +@@ -722,6 +736,8 @@ static int ipip6_rcv(struct sk_buff *skb + + dev_sw_netstats_rx_add(tunnel->dev, skb->len); + ++ /* Reset the skb_iif to Tunnels interface index */ ++ skb->skb_iif = tunnel->dev->ifindex; + netif_rx(skb); + + return 0; +@@ -1031,6 +1047,8 @@ static netdev_tx_t ipip6_tunnel_xmit(str + + skb_set_inner_ipproto(skb, IPPROTO_IPV6); + ++ /* Reset the skb_iif to Tunnels interface index */ ++ skb->skb_iif = tunnel->dev->ifindex; + iptunnel_xmit(NULL, rt, skb, fl4.saddr, fl4.daddr, protocol, tos, ttl, + df, !net_eq(tunnel->net, dev_net(dev))); + return NETDEV_TX_OK; diff --git a/target/linux/ipq806x/patches-6.6/990-048-net-added-a-new-netdevice-priv-flag-for-soft-tunnel.patch b/target/linux/ipq806x/patches-6.6/990-048-net-added-a-new-netdevice-priv-flag-for-soft-tunnel.patch new file mode 100644 index 0000000000..736a375051 --- /dev/null +++ b/target/linux/ipq806x/patches-6.6/990-048-net-added-a-new-netdevice-priv-flag-for-soft-tunnel.patch @@ -0,0 +1,28 @@ +From e3e9167247b3e234d915e25a4692ed6c6ec11935 Mon Sep 17 00:00:00 2001 +From: Vishnu Vardhan Bantanahal +Date: Thu, 1 Jun 2023 17:55:00 +0530 +Subject: [PATCH 271/500] net: added a new netdevice priv flag for soft tunnel + +This flag can be used by flow acceleration managers +to identify whether a flow is originated from or +destined to a tun/tap device + +Change-Id: I9631a13f083f5096be2c0046eedd277b9971c72d +Signed-off-by: Amit Gupta +Signed-off-by: Pavithra R +Signed-off-by: Vishnu Vardhan Bantanahal +Signed-off-by: Pavithra R +--- + drivers/net/tun.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/net/tun.c ++++ b/drivers/net/tun.c +@@ -999,6 +999,7 @@ static int tun_net_init(struct net_devic + dev->vlan_features = dev->features & + ~(NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_STAG_TX); ++ dev->priv_flags_ext |= IFF_EXT_TUN_TAP; + + tun->flags = (tun->flags & ~TUN_FEATURES) | + (ifr->ifr_flags & TUN_FEATURES); diff --git a/target/linux/ipq806x/patches-6.6/990-049-net-Correct-FMR-Calculation-in-Linux-6.1.patch b/target/linux/ipq806x/patches-6.6/990-049-net-Correct-FMR-Calculation-in-Linux-6.1.patch new file mode 100644 index 0000000000..d15251a344 --- /dev/null +++ b/target/linux/ipq806x/patches-6.6/990-049-net-Correct-FMR-Calculation-in-Linux-6.1.patch @@ -0,0 +1,49 @@ +From 3d55122c4a9bab65e4e9652e72155d1e20b3d27d Mon Sep 17 00:00:00 2001 +From: John Sanli +Date: Tue, 20 Jun 2023 13:03:01 -0700 +Subject: [PATCH 239/500] net: Correct FMR Calculation in Linux 6.1 + +Previously FMR calculation was set to only occur in ip4ip6_tnl_xmit() +Linux 6.1 replaces this with ipxip6_tnl_xmit() + +There is one tnl_xmit function for both ipv4 and ipv6 in this kernel. +This patch ensures FMR calculation is only performed in outbound direction. + +Change-Id: If36e1033be7f8b9fbea4e1d9a3664c1d8b41c666 +Signed-off-by: John Sanli +--- + net/ipv6/ip6_tunnel.c | 22 ++++++++++++---------- + 1 file changed, 12 insertions(+), 10 deletions(-) + +--- a/net/ipv6/ip6_tunnel.c ++++ b/net/ipv6/ip6_tunnel.c +@@ -1562,17 +1562,19 @@ ipxip6_tnl_xmit(struct sk_buff *skb, str + fl6.flowi6_uid = sock_net_uid(dev_net(dev), NULL); + dsfield = INET_ECN_encapsulate(dsfield, orig_dsfield); + +- /* try to find matching FMR */ +- for (fmr = t->parms.fmrs; fmr; fmr = fmr->next) { +- unsigned mshift = 32 - fmr->ip4_prefix_len; +- if (ntohl(fmr->ip4_prefix.s_addr) >> mshift == +- ntohl(ip_hdr(skb)->daddr) >> mshift) +- break; +- } ++ if (protocol == IPPROTO_IPIP) { ++ /* try to find matching FMR */ ++ for (fmr = t->parms.fmrs; fmr; fmr = fmr->next) { ++ unsigned mshift = 32 - fmr->ip4_prefix_len; ++ if (ntohl(fmr->ip4_prefix.s_addr) >> mshift == ++ ntohl(ip_hdr(skb)->daddr) >> mshift) ++ break; ++ } + +- /* change dstaddr according to FMR */ +- if (fmr) +- ip4ip6_fmr_calc(&fl6.daddr, ip_hdr(skb), skb_tail_pointer(skb), fmr, true); ++ /* change dstaddr according to FMR */ ++ if (fmr) ++ ip4ip6_fmr_calc(&fl6.daddr, ip_hdr(skb), skb_tail_pointer(skb), fmr, true); ++ } + + if (iptunnel_handle_offloads(skb, SKB_GSO_IPXIP6)) + return -1; diff --git a/target/linux/ipq806x/patches-6.6/990-050-Squashed-commit-of-the-following.patch b/target/linux/ipq806x/patches-6.6/990-050-Squashed-commit-of-the-following.patch new file mode 100644 index 0000000000..975ce97905 --- /dev/null +++ b/target/linux/ipq806x/patches-6.6/990-050-Squashed-commit-of-the-following.patch @@ -0,0 +1,126 @@ +From 926028b718c2a79b02365698fbac658b2ec5d297 Mon Sep 17 00:00:00 2001 +From: Ramkishan Gurjar +Date: Tue, 3 Oct 2023 09:42:20 +0530 +Subject: [PATCH 240/500] Squashed commit of the following: + +commit cde5e3757488b6753036c3e31a124b25f50a93fd +Author: Ken Zhu +Date: Mon Mar 12 11:21:31 2018 -0700 + + linux: fix the memory is not clean after memmove + + the memory won't be set to zero after memmove, set it + to zero. + + Change-Id: I9996aa5fa56a41967e31ec4df9820932feec6256 + Signed-off-by: Ken Zhu + +commit a81e33134a7d14a8fb9e1f636b946affb2c8fc80 +Author: Himanshu Joshi +Date: Fri Apr 24 12:12:10 2020 +0530 + + net: add draft03 specification support for tunipip6 + + draft03 of map-e is used in some environment, we add this supported + + Change-Id: I81462632f0e6f2b5af0b1f8229c42572892c5972 + Signed-off-by: Zhu Ken + +Change-Id: I3569082ddbdf3f30b8ab273cb7dc9ab2bfbc886c +--- + include/net/ip6_tunnel.h | 1 + + include/uapi/linux/if_tunnel.h | 1 + + net/ipv6/ip6_tunnel.c | 31 +++++++++++++++++++++++++++---- + 3 files changed, 29 insertions(+), 4 deletions(-) + +--- a/include/net/ip6_tunnel.h ++++ b/include/net/ip6_tunnel.h +@@ -37,6 +37,7 @@ struct __ip6_tnl_parm { + __u8 encap_limit; /* encapsulation limit for tunnel */ + __u8 hop_limit; /* hop limit for tunnel */ + bool collect_md; ++ __u8 draft03; /* FMR using draft03 of map-e */ + __be32 flowinfo; /* traffic class and flowlabel for tunnel */ + __u32 flags; /* tunnel flags */ + struct in6_addr laddr; /* local tunnel end-point address */ +--- a/include/uapi/linux/if_tunnel.h ++++ b/include/uapi/linux/if_tunnel.h +@@ -78,6 +78,7 @@ enum { + IFLA_IPTUN_COLLECT_METADATA, + IFLA_IPTUN_FWMARK, + IFLA_IPTUN_FMRS, ++ IFLA_IPTUN_DRAFT03, + __IFLA_IPTUN_MAX, + }; + #define IFLA_IPTUN_MAX (__IFLA_IPTUN_MAX - 1) +--- a/net/ipv6/ip6_tunnel.c ++++ b/net/ipv6/ip6_tunnel.c +@@ -839,7 +839,7 @@ EXPORT_SYMBOL_GPL(ip6_tnl_rcv_ctl); + **/ + static void ip4ip6_fmr_calc(struct in6_addr *dest, + const struct iphdr *iph, const uint8_t *end, +- const struct __ip6_tnl_fmr *fmr, bool xmit) ++ const struct __ip6_tnl_fmr *fmr, bool xmit, bool draft03) + { + int psidlen = fmr->ea_len - (32 - fmr->ip4_prefix_len); + u8 *portp = NULL; +@@ -927,10 +927,28 @@ static void ip4ip6_fmr_calc(struct in6_a + << (64 - fmr->ea_len - fromrem)); + t = cpu_to_be64(t | (eabits >> fromrem)); + memcpy(&dest->s6_addr[frombyte], &t, bytes); ++ if (draft03) { ++ /** ++ * Draft03 IPv6 address format ++ * +--+---+---+---+---+---+---+---+---+ ++ * |PL| 8 16 24 32 40 48 56 | ++ * +--+---+---+---+---+---+---+---+---+ ++ * |64| u | IPv4 address |PSID |0 | ++ * +--+---+---+---+---+---+---+---+---+ ++ * Final specification IPv6 address format ++ * +--+---+---+---+---+---+---+---+---+ ++ * |PL| 8 16 24 32 40 48 56 | ++ * +--+---+---+---+---+---+---+---+---+ ++ * |64| 0 | IPv4 address |PSID | ++ * +--+---+---+---+---+---+---+---+---+ ++ * We need move last six Bytes 1 byte forward ++ */ ++ memmove(&dest->s6_addr[9], &dest->s6_addr[10], 6); ++ dest->s6_addr[15] = 0; ++ } + } + } + +- + static int __ip6_tnl_rcv(struct ip6_tnl *tunnel, struct sk_buff *skb, + const struct tnl_ptk_info *tpi, + struct metadata_dst *tun_dst, +@@ -1011,7 +1029,8 @@ static int __ip6_tnl_rcv(struct ip6_tnl + /* Check that IPv6 matches IPv4 source to prevent spoofing */ + if (fmr) + ip4ip6_fmr_calc(&expected, ip_hdr(skb), +- skb_tail_pointer(skb), fmr, false); ++ skb_tail_pointer(skb), fmr, false, ++ tunnel->parms.draft03); + + if (!ipv6_addr_equal(&ipv6h->saddr, &expected)) { + rcu_read_unlock(); +@@ -1573,7 +1592,8 @@ ipxip6_tnl_xmit(struct sk_buff *skb, str + + /* change dstaddr according to FMR */ + if (fmr) +- ip4ip6_fmr_calc(&fl6.daddr, ip_hdr(skb), skb_tail_pointer(skb), fmr, true); ++ ip4ip6_fmr_calc(&fl6.daddr, ip_hdr(skb), skb_tail_pointer(skb), fmr, ++ true, t->parms.draft03); + } + + if (iptunnel_handle_offloads(skb, SKB_GSO_IPXIP6)) +@@ -2207,6 +2227,9 @@ static void ip6_tnl_netlink_parms(struct + if (data[IFLA_IPTUN_FWMARK]) + parms->fwmark = nla_get_u32(data[IFLA_IPTUN_FWMARK]); + ++ if (data[IFLA_IPTUN_DRAFT03]) ++ parms->draft03 = nla_get_u8(data[IFLA_IPTUN_DRAFT03]); ++ + if (data[IFLA_IPTUN_FMRS]) { + unsigned rem; + struct nlattr *fmr; diff --git a/target/linux/ipq806x/patches-6.6/990-047-qca-nss-cfi-support.patch b/target/linux/ipq806x/patches-6.6/990-051-qca-nss-cfi-support.patch similarity index 100% rename from target/linux/ipq806x/patches-6.6/990-047-qca-nss-cfi-support.patch rename to target/linux/ipq806x/patches-6.6/990-051-qca-nss-cfi-support.patch diff --git a/target/linux/ipq806x/patches-6.6/990-048-netfilter_optional_tcp_window_check.patch b/target/linux/ipq806x/patches-6.6/990-052-netfilter_optional_tcp_window_check.patch similarity index 100% rename from target/linux/ipq806x/patches-6.6/990-048-netfilter_optional_tcp_window_check.patch rename to target/linux/ipq806x/patches-6.6/990-052-netfilter_optional_tcp_window_check.patch diff --git a/target/linux/ipq806x/patches-6.6/990-049-linux-fix-dscpremark-extention-doesn-t-set-the-type-.patch b/target/linux/ipq806x/patches-6.6/990-053-linux-fix-dscpremark-extention-doesn-t-set-the-type-.patch similarity index 100% rename from target/linux/ipq806x/patches-6.6/990-049-linux-fix-dscpremark-extention-doesn-t-set-the-type-.patch rename to target/linux/ipq806x/patches-6.6/990-053-linux-fix-dscpremark-extention-doesn-t-set-the-type-.patch diff --git a/target/linux/ipq806x/patches-6.6/990-050-net-Add-extra-priv_flag-support-in-netdevice.patch b/target/linux/ipq806x/patches-6.6/990-054-net-Add-extra-priv_flag-support-in-netdevice.patch similarity index 100% rename from target/linux/ipq806x/patches-6.6/990-050-net-Add-extra-priv_flag-support-in-netdevice.patch rename to target/linux/ipq806x/patches-6.6/990-054-net-Add-extra-priv_flag-support-in-netdevice.patch diff --git a/target/linux/ipq806x/patches-6.6/990-051-qca-nss-drv-add-qdisc-support.patch b/target/linux/ipq806x/patches-6.6/990-055-qca-nss-drv-add-qdisc-support.patch similarity index 100% rename from target/linux/ipq806x/patches-6.6/990-051-qca-nss-drv-add-qdisc-support.patch rename to target/linux/ipq806x/patches-6.6/990-055-qca-nss-drv-add-qdisc-support.patch diff --git a/target/linux/ipq806x/patches-6.6/990-052-net-fix-potential-memory-leak.patch b/target/linux/ipq806x/patches-6.6/990-056-net-fix-potential-memory-leak.patch similarity index 100% rename from target/linux/ipq806x/patches-6.6/990-052-net-fix-potential-memory-leak.patch rename to target/linux/ipq806x/patches-6.6/990-056-net-fix-potential-memory-leak.patch diff --git a/target/linux/ipq806x/patches-6.6/990-053-net-Move-skb_vlan_untag-skb-after-sfe-hook.patch b/target/linux/ipq806x/patches-6.6/990-057-net-Move-skb_vlan_untag-skb-after-sfe-hook.patch similarity index 100% rename from target/linux/ipq806x/patches-6.6/990-053-net-Move-skb_vlan_untag-skb-after-sfe-hook.patch rename to target/linux/ipq806x/patches-6.6/990-057-net-Move-skb_vlan_untag-skb-after-sfe-hook.patch diff --git a/target/linux/ipq806x/patches-6.6/990-054-net-add-fast-xmit-api.patch b/target/linux/ipq806x/patches-6.6/990-058-net-add-fast-xmit-api.patch similarity index 100% rename from target/linux/ipq806x/patches-6.6/990-054-net-add-fast-xmit-api.patch rename to target/linux/ipq806x/patches-6.6/990-058-net-add-fast-xmit-api.patch diff --git a/target/linux/ipq806x/patches-6.6/990-055-net-do-time-update-rather-than-fully-update-in-the-f.patch b/target/linux/ipq806x/patches-6.6/990-059-net-do-time-update-rather-than-fully-update-in-the-f.patch similarity index 100% rename from target/linux/ipq806x/patches-6.6/990-055-net-do-time-update-rather-than-fully-update-in-the-f.patch rename to target/linux/ipq806x/patches-6.6/990-059-net-do-time-update-rather-than-fully-update-in-the-f.patch diff --git a/target/linux/ipq806x/patches-6.6/990-057-dev_queue_xmit-Reset-skb-fast_xmit-flag-in-slow-path.patch b/target/linux/ipq806x/patches-6.6/990-060-dev_queue_xmit-Reset-skb-fast_xmit-flag-in-slow-path.patch similarity index 100% rename from target/linux/ipq806x/patches-6.6/990-057-dev_queue_xmit-Reset-skb-fast_xmit-flag-in-slow-path.patch rename to target/linux/ipq806x/patches-6.6/990-060-dev_queue_xmit-Reset-skb-fast_xmit-flag-in-slow-path.patch diff --git a/target/linux/ipq806x/patches-6.6/990-058-arm-arm64-enable-hairpin-for-WLAN-netdevices-only.patch b/target/linux/ipq806x/patches-6.6/990-061-arm-arm64-enable-hairpin-for-WLAN-netdevices-only.patch similarity index 100% rename from target/linux/ipq806x/patches-6.6/990-058-arm-arm64-enable-hairpin-for-WLAN-netdevices-only.patch rename to target/linux/ipq806x/patches-6.6/990-061-arm-arm64-enable-hairpin-for-WLAN-netdevices-only.patch diff --git a/target/linux/ipq806x/patches-6.6/990-059-net-bridge-Allow-unicast-loop-back-when-hairpin-enab.patch b/target/linux/ipq806x/patches-6.6/990-062-net-bridge-Allow-unicast-loop-back-when-hairpin-enab.patch similarity index 100% rename from target/linux/ipq806x/patches-6.6/990-059-net-bridge-Allow-unicast-loop-back-when-hairpin-enab.patch rename to target/linux/ipq806x/patches-6.6/990-062-net-bridge-Allow-unicast-loop-back-when-hairpin-enab.patch diff --git a/target/linux/ipq806x/patches-6.6/990-063-net-gre-adding-API-to-check-GRE-net-device.patch b/target/linux/ipq806x/patches-6.6/990-063-net-gre-adding-API-to-check-GRE-net-device.patch new file mode 100644 index 0000000000..272373aae3 --- /dev/null +++ b/target/linux/ipq806x/patches-6.6/990-063-net-gre-adding-API-to-check-GRE-net-device.patch @@ -0,0 +1,41 @@ +From 9d5acd39ef0579f27dcd2ce44316f3a4df973fa1 Mon Sep 17 00:00:00 2001 +From: Nitin Shetty +Date: Wed, 12 Jan 2022 00:06:57 +0530 +Subject: [PATCH 299/500] net: gre: adding API to check GRE net device + +adding support to check if the net device +is GRE. + +Change-Id: Ic50f41299b19939fb8313667e4b8c9c571432235 +Signed-off-by: Nitin Shetty +--- + include/net/gre.h | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +--- a/include/net/gre.h ++++ b/include/net/gre.h +@@ -43,12 +43,24 @@ static inline bool netif_is_gretap(const + !strcmp(dev->rtnl_link_ops->kind, "gretap"); + } + ++static inline bool netif_is_gre(const struct net_device *dev) ++{ ++ return dev->rtnl_link_ops && ++ !strcmp(dev->rtnl_link_ops->kind, "gre"); ++} ++ + static inline bool netif_is_ip6gretap(const struct net_device *dev) + { + return dev->rtnl_link_ops && + !strcmp(dev->rtnl_link_ops->kind, "ip6gretap"); + } + ++static inline bool netif_is_ip6gre(const struct net_device *dev) ++{ ++ return dev->rtnl_link_ops && ++ !strcmp(dev->rtnl_link_ops->kind, "ip6gre"); ++} ++ + static inline int gre_calc_hlen(__be16 o_flags) + { + int addend = 4; diff --git a/target/linux/ipq806x/patches-6.6/990-064-net-gre-Adding-support-to-detect-fb-netdev.patch b/target/linux/ipq806x/patches-6.6/990-064-net-gre-Adding-support-to-detect-fb-netdev.patch new file mode 100644 index 0000000000..9cccab9d10 --- /dev/null +++ b/target/linux/ipq806x/patches-6.6/990-064-net-gre-Adding-support-to-detect-fb-netdev.patch @@ -0,0 +1,96 @@ +From 512681ea05f185d80a6511407ccefacda94cfe21 Mon Sep 17 00:00:00 2001 +From: Swati Singh +Date: Wed, 24 Aug 2022 09:37:33 -0700 +Subject: [PATCH 300/500] net:gre: Adding support to detect fb netdev + +adding support to detect whether the +given netdevice is fallback device +for gretap and ipv6 tunnel. + +Change-Id: Idf275af604ea56061e48f45c89154ef1d20c902a +Signed-off-by: Swati Singh +--- + include/net/gre.h | 1 + + include/net/ip_tunnels.h | 3 +++ + net/ipv4/ip_gre.c | 20 ++++++++++++++++++++ + net/ipv6/ip6_tunnel.c | 20 ++++++++++++++++++++ + 4 files changed, 44 insertions(+) + +--- a/include/net/gre.h ++++ b/include/net/gre.h +@@ -31,6 +31,7 @@ struct gre_protocol { + + int gre_add_protocol(const struct gre_protocol *proto, u8 version); + int gre_del_protocol(const struct gre_protocol *proto, u8 version); ++bool gre_tunnel_is_fallback_dev(struct net_device *dev); + + struct net_device *gretap_fb_dev_create(struct net *net, const char *name, + u8 name_assign_type); +--- a/include/net/ip_tunnels.h ++++ b/include/net/ip_tunnels.h +@@ -592,4 +592,7 @@ static inline void ip_tunnel_info_opts_s + + #endif /* CONFIG_INET */ + ++void ipip6_update_offload_stats(struct net_device *dev, void *ptr); ++void ip6_update_offload_stats(struct net_device *dev, void *ptr); ++bool ip6_tunnel_is_fallback_dev(struct net_device *dev); + #endif /* __NET_IP_TUNNELS_H */ +--- a/net/ipv4/ip_gre.c ++++ b/net/ipv4/ip_gre.c +@@ -459,6 +459,26 @@ drop: + return 0; + } + ++bool gre_tunnel_is_fallback_dev(struct net_device *dev) ++{ ++ struct net *net; ++ struct ip_tunnel_net *itn; ++ struct net_device *fb_tunnel_dev; ++ ++ net = dev_net(dev); ++ if (!net) ++ return false; ++ ++ itn = net_generic(net, gre_tap_net_id); ++ if (!itn) ++ return false; ++ ++ fb_tunnel_dev = itn->fb_tunnel_dev; ++ ++ return (fb_tunnel_dev == dev); ++} ++EXPORT_SYMBOL(gre_tunnel_is_fallback_dev); ++ + static void __gre_xmit(struct sk_buff *skb, struct net_device *dev, + const struct iphdr *tnl_params, + __be16 proto) +--- a/net/ipv6/ip6_tunnel.c ++++ b/net/ipv6/ip6_tunnel.c +@@ -2469,6 +2469,26 @@ struct net *ip6_tnl_get_link_net(const s + } + EXPORT_SYMBOL(ip6_tnl_get_link_net); + ++bool ip6_tunnel_is_fallback_dev(struct net_device *dev) ++{ ++ struct net *net; ++ struct ip6_tnl_net *ip6n; ++ struct net_device *fb_tnl_dev; ++ ++ net = dev_net(dev); ++ if (!net) ++ return false; ++ ++ ip6n = net_generic(net, ip6_tnl_net_id); ++ if (!ip6n) ++ return false; ++ ++ fb_tnl_dev = ip6n->fb_tnl_dev; ++ ++ return (fb_tnl_dev == dev); ++} ++EXPORT_SYMBOL(ip6_tunnel_is_fallback_dev); ++ + static const struct nla_policy ip6_tnl_policy[IFLA_IPTUN_MAX + 1] = { + [IFLA_IPTUN_LINK] = { .type = NLA_U32 }, + [IFLA_IPTUN_LOCAL] = { .len = sizeof(struct in6_addr) },