aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/generic/backport-5.10/882-v5.19-rndis_host-limit-scope-of-bogus-MAC-address-detectio.patch
diff options
context:
space:
mode:
authorLech Perczak <lech.perczak@gmail.com>2022-04-01 22:05:08 +0200
committerHauke Mehrtens <hauke@hauke-m.de>2022-04-17 21:31:02 +0200
commit19c65d36d776b4f9e2a19f0f487fc9bc8fcc2858 (patch)
treef7896af96d5472f5858ecc204a615a39d91fac6f /target/linux/generic/backport-5.10/882-v5.19-rndis_host-limit-scope-of-bogus-MAC-address-detectio.patch
parent835454661d69aa8a031e320602ad359381812c98 (diff)
downloadupstream-19c65d36d776b4f9e2a19f0f487fc9bc8fcc2858.tar.gz
upstream-19c65d36d776b4f9e2a19f0f487fc9bc8fcc2858.tar.bz2
upstream-19c65d36d776b4f9e2a19f0f487fc9bc8fcc2858.zip
kernel: backport ZTE RNDIS bogus MAC address fix
This is required to support built-in modem of ZTE MF286R, in addition to other external modems, such as MF831, MF910, MF920, which refuse to reconfigure their remote MAC address, even if "locally administered" bit is set, leading to dropped traffic towards the host. Add a workaround for that issue already present in cdc_ether to rndis_host driver as well. Signed-off-by: Lech Perczak <lech.perczak@gmail.com> (cherry picked from commit c99013e242682a71051619806f9cc4f4e51a58fa)
Diffstat (limited to 'target/linux/generic/backport-5.10/882-v5.19-rndis_host-limit-scope-of-bogus-MAC-address-detectio.patch')
-rw-r--r--target/linux/generic/backport-5.10/882-v5.19-rndis_host-limit-scope-of-bogus-MAC-address-detectio.patch63
1 files changed, 63 insertions, 0 deletions
diff --git a/target/linux/generic/backport-5.10/882-v5.19-rndis_host-limit-scope-of-bogus-MAC-address-detectio.patch b/target/linux/generic/backport-5.10/882-v5.19-rndis_host-limit-scope-of-bogus-MAC-address-detectio.patch
new file mode 100644
index 0000000000..bdb78ff170
--- /dev/null
+++ b/target/linux/generic/backport-5.10/882-v5.19-rndis_host-limit-scope-of-bogus-MAC-address-detectio.patch
@@ -0,0 +1,63 @@
+From 1bfbe1799b9ec5d00f7f032d6e7db1980e466aeb Mon Sep 17 00:00:00 2001
+From: Lech Perczak <lech.perczak@gmail.com>
+Date: Sat, 2 Apr 2022 02:19:57 +0200
+Subject: [PATCH 3/3] rndis_host: limit scope of bogus MAC address detection to
+ ZTE devices
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Reporting of bogus MAC addresses and ignoring configuration of new
+destination address wasn't observed outside of a range of ZTE devices,
+among which this seems to be the common bug. Align rndis_host driver
+with implementation found in cdc_ether, which also limits this workaround
+to ZTE devices.
+
+Suggested-by: Bjørn Mork <bjorn@mork.no>
+Cc: Kristian Evensen <kristian.evensen@gmail.com>
+Cc: Oliver Neukum <oliver@neukum.org>
+Signed-off-by: Lech Perczak <lech.perczak@gmail.com>
+---
+ drivers/net/usb/rndis_host.c | 17 ++++++++++++-----
+ 1 file changed, 12 insertions(+), 5 deletions(-)
+
+--- a/drivers/net/usb/rndis_host.c
++++ b/drivers/net/usb/rndis_host.c
+@@ -418,10 +418,7 @@ generic_rndis_bind(struct usbnet *dev, s
+ goto halt_fail_and_release;
+ }
+
+- if (bp[0] & 0x02)
+- eth_hw_addr_random(net);
+- else
+- ether_addr_copy(net->dev_addr, bp);
++ ether_addr_copy(net->dev_addr, bp);
+
+ /* set a nonzero filter to enable data transfers */
+ memset(u.set, 0, sizeof *u.set);
+@@ -463,6 +460,16 @@ static int rndis_bind(struct usbnet *dev
+ return generic_rndis_bind(dev, intf, FLAG_RNDIS_PHYM_NOT_WIRELESS);
+ }
+
++static int zte_rndis_bind(struct usbnet *dev, struct usb_interface *intf)
++{
++ int status = rndis_bind(dev, intf);
++
++ if (!status && (dev->net->dev_addr[0] & 0x02))
++ eth_hw_addr_random(dev->net);
++
++ return status;
++}
++
+ void rndis_unbind(struct usbnet *dev, struct usb_interface *intf)
+ {
+ struct rndis_halt *halt;
+@@ -615,7 +622,7 @@ static const struct driver_info zte_rndi
+ .description = "ZTE RNDIS device",
+ .flags = FLAG_ETHER | FLAG_POINTTOPOINT | FLAG_FRAMING_RN | FLAG_NO_SETINT,
+ .data = RNDIS_DRIVER_DATA_DST_MAC_FIXUP,
+- .bind = rndis_bind,
++ .bind = zte_rndis_bind,
+ .unbind = rndis_unbind,
+ .status = rndis_status,
+ .rx_fixup = rndis_rx_fixup,