[][openvswitch][common][Fix IPv6 client can't get RA packet]
[Description]
Fix IPv6 client can't get RA packet
1. Bypass icmpv6 rs and ra packet
[Release-log]
Change-Id: Ie389492e5ae5c0b774a8aa37f84c98f46ef2ccdb
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/8847553
diff --git a/autobuild_mac80211_release/target/linux/mediatek/patches-5.4/999-3000-ovs-add-multicast-to-unicast-support.patch b/autobuild_mac80211_release/target/linux/mediatek/patches-5.4/999-3000-ovs-add-multicast-to-unicast-support.patch
index dc060ea..afd633a 100644
--- a/autobuild_mac80211_release/target/linux/mediatek/patches-5.4/999-3000-ovs-add-multicast-to-unicast-support.patch
+++ b/autobuild_mac80211_release/target/linux/mediatek/patches-5.4/999-3000-ovs-add-multicast-to-unicast-support.patch
@@ -1,4 +1,4 @@
-From 4d7eabd37042f541f085cca6265bd22ae3f05e6e Mon Sep 17 00:00:00 2001
+From 2d5090dc6072979167593c8fee026341774efb53 Mon Sep 17 00:00:00 2001
From: mtk22468 <Xuzhu.Wang@mediatek.com>
Date: Mon, 18 Sep 2023 10:50:36 +0800
Subject: [PATCH] ovs add multicast to unicast support
@@ -6,13 +6,13 @@
---
net/openvswitch/actions.c | 30 ++++
net/openvswitch/datapath.c | 290 +++++++++++++++++++++++++++++++++++++
- net/openvswitch/datapath.h | 32 ++++
+ net/openvswitch/datapath.h | 40 +++++
net/openvswitch/vport.c | 8 +
net/openvswitch/vport.h | 26 ++++
- 5 files changed, 386 insertions(+)
+ 5 files changed, 394 insertions(+)
diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c
-index 9e8a5c4..e953e62 100644
+index 9e8a5c4..82cd46e 100644
--- a/net/openvswitch/actions.c
+++ b/net/openvswitch/actions.c
@@ -919,6 +919,10 @@ static void do_output(struct datapath *dp, struct sk_buff *skb, int out_port,
@@ -30,7 +30,7 @@
if (likely(!mru ||
(skb->len <= mru + vport->dev->hard_header_len))) {
-+ if (is_multicast_addr(skb) && !is_igmp_mld(skb)) {
++ if (is_multicast_addr(skb) && !is_igmp_mld(skb) && !is_icmpv6_ndp_rs_ra(skb)) {
+ mdb = vport->mdb;
+ spin_lock_bh(&mdb->tbl_lock);
+ list_for_each_entry(table, &mdb->list_head, mdb_node) {
@@ -60,7 +60,7 @@
} else if (mru <= vport->dev->mtu) {
struct net *net = read_pnet(&dp->net);
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
-index 4c537e7..e6787cc 100644
+index 4c537e7..0c8d344 100644
--- a/net/openvswitch/datapath.c
+++ b/net/openvswitch/datapath.c
@@ -11,6 +11,9 @@
@@ -349,7 +349,7 @@
OVS_CB(packet)->input_vport = input_vport;
sf_acts = rcu_dereference(flow->sf_acts);
-+ if (is_multicast_addr(packet))
++ if (is_multicast_addr(packet) && !is_icmpv6_ndp_rs_ra(packet))
+ ovs_multicast_rcv(packet, input_vport);
+
local_bh_disable();
@@ -389,10 +389,10 @@
ovs_dp_detach_port(vport);
diff --git a/net/openvswitch/datapath.h b/net/openvswitch/datapath.h
-index 81e85dd..6830d3b 100644
+index 81e85dd..50596bc 100644
--- a/net/openvswitch/datapath.h
+++ b/net/openvswitch/datapath.h
-@@ -215,6 +215,38 @@ static inline struct datapath *get_dp(struct net *net, int dp_ifindex)
+@@ -215,6 +215,46 @@ static inline struct datapath *get_dp(struct net *net, int dp_ifindex)
return dp;
}
@@ -428,6 +428,14 @@
+ return err;
+}
+
++static inline bool is_icmpv6_ndp_rs_ra(struct sk_buff *skb)
++{
++ if (!skb)
++ return 0;
++
++ return ((icmp6_hdr(skb)->icmp6_type == NDISC_ROUTER_SOLICITATION) && (icmp6_hdr(skb)->icmp6_type == NDISC_ROUTER_ADVERTISEMENT));
++}
++
extern struct notifier_block ovs_dp_device_notifier;
extern struct genl_family dp_vport_genl_family;