Skip to content
Snippets Groups Projects
Commit dc08626e authored by st s's avatar st s
Browse files

samsung-zeroltexx: Copied/adapted patch to set random MAC address instead of...

samsung-zeroltexx: Copied/adapted patch to set random MAC address instead of 00:00:00:00:00:00 for rndis connection.
parent fcb7700c
No related branches found
No related tags found
No related merge requests found
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/function/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 bf8b64d904c..9ce3ab6de34 100644
--- a/drivers/usb/gadget/u_ether.c
+++ b/drivers/usb/gadget/u_ether.c
@@ -1224,8 +1224,16 @@
dev_warn(&g->dev,
"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,
......@@ -24,6 +24,7 @@ source="
03-fix-fimc-is-firmware-path.patch
Makefile_fix_paths.patch
gcc10-extern_YYLOC_global_declaration.patch
0007-usb_gadget-set-random-rndis-host-MAC-address-to-prev.patch
"
builddir="$srcdir/$_repository-$_commit"
......@@ -58,4 +59,5 @@ sha512sums="1f8917dfaf01865cbc0385579cad1565dcb1ec4445bbeaf3e70d0bd8a6a572a45781
9afbb020311f0bf8043f021292d0f05041ff4e29003bf2114dfc31906869f44dbf15ff560170bc9e9baf62d7bb4ed73d58415212fecac6f1bdd6886783b0fcc1 02-fix-wifi-firmware-path.patch
c98a074f46376936493b74285632cf38818bdb9d5e7b70b5b291aa8774711a93f352cb569d856215ebc75a33f819a8ce6cd5ccbee506d0a81141938924cf45e3 03-fix-fimc-is-firmware-path.patch
00aac98cfbaa68bd30c41622b12f38106f6595e2d74ee5cdd05add56f03facb4db45deb43b5df997143b54497d621b9fc5bae7207898c70df0672ebb482c4b46 Makefile_fix_paths.patch
2b48f1bf0e3f70703d2cdafc47d5e615cc7c56c70bec56b2e3297d3fa4a7a1321d649a8679614553dde8fe52ff1051dae38d5990e3744c9ca986d92187dcdbeb gcc10-extern_YYLOC_global_declaration.patch"
2b48f1bf0e3f70703d2cdafc47d5e615cc7c56c70bec56b2e3297d3fa4a7a1321d649a8679614553dde8fe52ff1051dae38d5990e3744c9ca986d92187dcdbeb gcc10-extern_YYLOC_global_declaration.patch
8684da1ef7032cb2160c9b071b2bf8cb57a31f5527ee3f6e9e3b58fa485a0ff244e3bc85446c8b09f5b5cec7d1a3f92da681f63495728aaa547438c93eb375d5 0007-usb_gadget-set-random-rndis-host-MAC-address-to-prev.patch"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment