samsung-serranolte: fix zero host MAC (MR 3057)

[ci:skip-build] Already built fine on CI in MR
This commit is contained in:
Ignacy Kuchciński 2022-04-05 13:47:26 +02:00 committed by Alexey Minnekhanov
parent 17beef02f2
commit 55fb881c42
No known key found for this signature in database
GPG key ID: 6FE3B029D9D9FAFF
2 changed files with 46 additions and 1 deletions

View file

@ -0,0 +1,43 @@
From 2e32a401ea5df22ab899f4da3e5e1b448b2df51a Mon Sep 17 00:00:00 2001
From: Alexey Min <alexey.min@gmail.com>
Date: Thu, 7 Mar 2019 17:25:48 +0300
Subject: [PATCH 5/6] usb_gadget: set random rndis host MAC address to prevent
zero address
This fixes zero host MAC:
rndis0: MAC f6:45:91:9b:4e:43
rndis0: HOST MAC 00:00:00:00:00:00
and allows devive to automatically obtain IP addrest on PC host side
zero MAC address prevented interface from autoconfiguring
---
drivers/usb/gadget/u_ether.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/gadget/u_ether.c b/drivers/usb/gadget/u_ether.c
index 72c4a992594..c0fc0698697 100644
--- a/drivers/usb/gadget/u_ether.c
+++ b/drivers/usb/gadget/u_ether.c
@@ -1075,8 +1075,16 @@ int gether_setup_name(struct usb_gadget *g, u8 ethaddr[ETH_ALEN],
"using random %s ethernet address\n", "self");
#ifdef CONFIG_USB_ANDROID_SAMSUNG_COMPOSITE
- memcpy(dev->host_mac, ethaddr, ETH_ALEN);
- printk(KERN_DEBUG "usb: set unique host mac\n");
+ if ((ethaddr[0] == 0x00) && (ethaddr[1] == 0x00) &&
+ (ethaddr[2] == 0x00) && (ethaddr[3] == 0x00) &&
+ (ethaddr[4] == 0x00) && (ethaddr[5] == 0x00)) {
+ printk(KERN_DEBUG "%s: no unique host MAC was set, generate random\n", __func__);
+ /* we can use random_ether_addr() from include/linux/etherdevice.h */
+ random_ether_addr(ethaddr);
+ } else {
+ printk(KERN_DEBUG "%s: set unique host mac\n", __func__);
+ }
+ memcpy(dev->host_mac, ethaddr, ETH_ALEN);
#else
if (get_ether_addr(host_addr, dev->host_mac))
dev_warn(&g->dev,
--
2.21.0

View file

@ -2,7 +2,7 @@
pkgname=linux-samsung-serranolte
pkgver=3.4.113
pkgrel=1
pkgrel=2
pkgdesc="Samsung Samsung Galaxy S4 Mini kernel fork"
arch="armv7"
_carch="arm"
@ -31,6 +31,7 @@ source="
01_msm-fix-perf_trace_counters.patch
02_gpu-msm-fix-gcc5-compile.patch
03_fix-video-argb-setting.patch
04_usb_gadget-set-random-rndis-host-MAC-address-to-prev.patch
"
builddir="$srcdir/$_repository-$_commit"
@ -55,4 +56,5 @@ sha512sums="
f85ced49ee2f2461adea68dac0a10452aa809a7d41d869092d94eb085344919a9a385dec0c48011f4601ca4f441700f7fe49075c7eca4fb2d66b01f7d413ccb7 01_msm-fix-perf_trace_counters.patch
7be03a9e78b7ac330a54b1f00509caa0621a95c0c55901878ad757f9dd69cc05ba2c8b5ea987063ae1224f92c4d090d515fa5d369e7755181a4871b0d0f82881 02_gpu-msm-fix-gcc5-compile.patch
e3083c260ed9c4fc0d83f43106700b6173876dbfae072f6e6696ac6785a4dc17771fbcb3e21601e04ed29a11bf0f7a2a09ad549375e0c34cea245c7f2e2bcbbd 03_fix-video-argb-setting.patch
27f890cf82027649ba742b606a87ce6a82f9685b075bb7b50bffec77221e70434ee78d118d39048350537c5ecdad208658967e492eeeb997e7f6884fa78ac696 04_usb_gadget-set-random-rndis-host-MAC-address-to-prev.patch
"